Vocaloid Wiki
Advertisement
Vocaloid Wiki
!
This task is now over and the blog has been archived.
!
!
This blog post is here to help you with the task of replacing former templates with the help of scripts.
!
!
This blog post is intended to be for moderate level editors. If you are a beginner, please read all the help pages this post refers to.
!

Current task, replacing the template Derivatives by the new one Derivative.

This blog post will help you for the task.

Analyze how each template is done

First, it is advised to study how each template is done.

According to the documentation of the obsolete template Derivatives, this template uses the following arguments:

  • 00_id : Replace "00" by the corresponding code depending of the platform. nnd_id, nn_id, yt_id, bb_id, pp_id, sc_id... This is where all IDs are set.
    • sometimes is followed by 00_comment by replacing "00" by the same code for the corresponding platform.
  • author : producers of the work
  • singer : vocals in the work
  • category : type of the work (cover? previous version? succeeding one? parody?)
  • description : an accompanying comment
  • title : title of the work
  • color : color of the box, first arg for the background color, second one for the text color

Now, what everything becomes in Derivative:

  • 00_id : becomes links = 00. Separate each ID with a semi-colon.
    • Example: links = nn sm0587569 ; yt lkzIquNDE (these IDs are random)
  • 00_comment : becomes comments =  ; separate each part by a semi-colon.
    • in the case of the 2nd ID only requiring a comment, write the comments argument comments = ; comment (replace "comment" by the correct one)
  • author : producers
  • singer : singers
  • category : categories
  • description, title, color work the same way. Useless to touch them.

Make the task easier with scripts

A script exists to make the task easier. This script is called FindAndReplace.

Be sure the JavaScript option is ENABLED in your preferences!

You can use this script in source mode and in the classic editor. This is displayed in the right side of the editor.

If you are in source mode and don't see the right side of the editor, there is a little arrow at the right of the source editor. Click on it and the right side will reappear. The script will appear above the button for adding media files.

To install this script, you'll need to create a global.js page on the English Community Central (here). You can access it here!

Add the following to your global.js:

importArticles({

   type: 'script',
   articles: [
       'u:dev:MediaWiki:FindAndReplace/code.js',
   ]

});

Then purge your browser cache.

How to use FindAndReplace

First step: source mode

For better accuracy, it is better to manually change the templates.

You need to be in source mode to avoid any code corruptions: VisualEditor adds code breaking lines for templates such as Shared and some mobile compatible code ; classic editor will tend to corrupt the whole page if a template is badly closed.

To set source editor by default, go to your preferences, third tab then first menu, switch it to "Source mode". By default, when you'll edit the article, this will open source editor.

Second step: changes to apply

Once in the source editor, in the whole article, it's time to look at the code. Sometimes, the Derivatives template separates the arguments either by spaces, either by line breaks.

For better visibility of the code, line breaks are HIGHLY preferred.

Open your FindAndReplace tab in the right side.

And apply everything that is said in this table!

Replacement table
Derivatives (text to find) Derivative (text to replace) Notes on the order
{{Derivatives {{Derivative FIRST STEP TO APPLY. Do not input any space after the word.
{{Derivative tabber {{Derivatives tabber APPLY THIS JUST AFTER THE PREVIOUS LINE. "Derivative tabber" not existing and because of the previous change that has been done, not applying this step may result in a code break.
|nnd_id = |links = nn First step if Japanese song, second one if English song (or most of Western ones) or Chinese song which use in majority bilibili IDs first. If exists, replace the space before the "|" by a line break. Add a space after the equal sign for the finding text, and after "nn" for the replacement text.
If all arguments are separated by a line break, ignore the space at the start of the finding text and the line break at the start of the replacement text.
|yt_id = |links = yt Second step if Japanese song, first one if English song (or most of Western ones), third one if Chinese song. If exists, replace the space before the "|" by a line break. Add a space after the equal sign for the finding text, and after "yt" for the replacement text.
If all arguments are separated by a line break, ignore the space at the start of the finding text and the line break at the start of the replacement text.
|bb_id = |links = bb Third step if Japanese song or English song (or most of Western ones), first one if Chinese song. If exists, replace the space before the "|" by a line break. Add a space after the equal sign for the finding text, and after "bb" for the replacement text.
If all arguments are separated by a line break, ignore the space at the start of the finding text and the line break at the start of the replacement text.
|sc_id = |links = sc Applies to the following platforms: pp, sc, 5s, ac, tm, vl, bc. If exists, replace the space before the "|" by a line break. Add a space after the equal sign for the finding text, and after the platform identification set of characters for the replacement text.
If all arguments are separated by a line break, ignore the space at the start of the finding text and the line break at the start of the replacement text.
|etc_id = |links = 00 !! Particular case, apply this in last when treating the links. Make the "00" follow by a space then the full URL. You'll also need to use the argument "comments" to specify which platform the "00" is referring to.
|00_comment = |comments = 00 is the code for a platform: nn, yt, sc, bc, pp, 5s, ac, etc
After having treated all the platform ID arguments.
There is NO platform code to input after the equal sign! Also be careful to input a space after each equal sign.
|author = |producers = After the main template name changes. If exists, replace the space before the "|" by a line break. Add a space after the equal sign for the finding text, and after the platform identification set of characters for the replacement text.
If all arguments are separated by a line break, ignore the space at the start of the finding text and the line break at the start of the replacement text.
|category = |categories = Same as above.
|singer = |singers = Same as above. Please note that for human covers only, you have the right to merge the singers into the argument "producers", indicate they are doing vocals in the credits.
|description = ONLY IF THE ARGUMENT IS EMPTY. How to do: type the "|description = " and set a line break at the end of the text to find. Type literally nothing in the field for the replacement text. This will result in a "find and delete". Otherwise, do not touch this argument if text is in it!
|icon = |thumb = Can be done near the last steps.

When to insert spaces, line breaks etc

  • All arguments have to be separated by line breaks. If the former template separates all arguments by line breaks, only insert the code you are seeing. Don't forget the spaces at the end of each argument to find and to replace.
  • If arguments in the former template are separated by spaces, start your text to find by a space. Start your text to replace by a line break. Then write your arguments and the final space for both of them.
  • Keep in mind the IDs of the derivative and the platform IDs have to be separated by a single space.

Third step: check the changes

After the script passes done, recheck the code. This is especially needed for the Derivative templates for which there are several IDs available.

Example: most common, a Niconico and a YouTube ID. Be sure your argument for IDs is like this:

|links = nn id1 ; yt id2
|comments = commentid1 ; commentid2

Replace id1, id2, commentid1 and commentid2, and the two latter can be empty! If no comment exists, omit the comments argument, avoid useless code!

A comment-less derivative will look like:

|links = nn id1 ; yt id2

And that's it :)

So if ever you have the following:

|links = nn id1 |links = yt id2
or
|links = nn id1
|links = yt id2

You know what to do... :)

Important: in the case the YouTube ID is not the first one, you'll need another argument, "|thumb = yt" somewhere in the template, to force YouTube's thumbnail.

Thanks to this first example, you know how to manage the different arguments.

Note that often, Derivatives template is here because the page hasn't been edited by a human a long, long while ago... And sometimes the box went colorless.

Example 1 - VOCALOIDs: |color = luka

All the VOCALOIDs having a first name and a last name need their full name in Eastern disposition (last name then first name!) for the full color. "luka" thus becomes "megurine luka", "miku" becomes "hatsune miku" etc. This doesn't apply to VOCALOIDs having a single name (ex: Lily, Chika, GUMI, Rana, DEX, AVANNA...).

Example 2 - other synths: |color = teto

The colors for each singer from a different synth engine have been replaced by an unique color corresponding to the engine. "teto", "meiji", "ritsu" or "momo" become "utau". "haiyi" becomes "synthv"...

It's the easier and the fastest solution. Without the fuss we said!

What we should obtain at last...

So let's put a final example of a whole Derivatives code:

{{Derivatives |nnd_id = sm4333362
|singer = Kagamine Rin and Kagamine Len |author = [[Chiho-P]] |category = Fanmade PV
|title = Chiho's PV
|description = A hand-drawn PV by Chiho-P with a colorful style in pastel tones. This PV shows the first signs of what would distinguish Chiho's style in the future.
|color = white; color:#E5C940 }}

When we convert with all the steps, the following code should be obtained:

{{Derivative
|links = nn sm4333362
|singers = Kagamine Rin and Kagamine Len
|producers = [[Chiho-P]]
|categories = Fanmade PV
|title = Chiho's PV
|description = A hand-drawn PV by Chiho-P with a colorful style in pastel tones. This PV shows the first signs of what would distinguish Chiho's style in the future.
|color = white; color:#E5C940 }}

Waaay better... It's easier to read the source already, and especially, we converted everything. :D

More information

Advertisement