Lucius Chiaraviglio
Joined 12 February 2024
m →Keyboard Layout Lab: Forgot to update the Last Modified |
→Editing Tips: Add what to do if ratios are expressed as colons and you need to change them to slashes |
||
| Line 7: | Line 7: | ||
== Editing Tips == | == Editing Tips == | ||
I edited the Intervals table for [[84edo]], [[55edo]], and [[171edo]] to add links to the intervals. Since these have a LOT of intervals even only considering the simplest ones, and the tables even had some fairly complicated intervals, I did not want to do this by hand. Instead, I copied the Wiki source for the section to a text file ("171EDOintervals.txt" in the latest example) on my computer (running MacOS, but in principle this should work on Linux or Windows Subsystem for Linux), used the "sed" command on it to do the actual editing (took less time to learn to use "sed" than to do all that by hand), and then copied the output file ("171EDOintervals.new.txt" in the latest example) back into the article section. First, here is the full "sed" command: | I edited the Intervals table for [[84edo]], [[55edo]], and [[171edo]] to add links to the intervals. Since these have a LOT of intervals even only considering the simplest ones, and the tables even had some fairly complicated intervals, I did not want to do this by hand. Instead, I copied the Wiki source for the section to a text file ("171EDOintervals.txt" in the latest example) on my computer (running MacOS, but in principle this should work on Linux or Windows Subsystem for Linux), used the "sed" command on it to do the actual editing (took less time to learn to use "sed" than to do all that by hand), and then copied the output file ("171EDOintervals.new.txt" in the latest example) back into the article section. First, here is the full "sed" command (note that the "-E" option indicates the use of extended regular expressions): | ||
<code>sed -E "s#[0-9]+/[0-9]+#\[\[&\]\]#g" 171EDOintervals.txt > 171EDOintervals.new.txt</code> | <code>sed -E "s#[0-9]+/[0-9]+#\[\[&\]\]#g" 171EDOintervals.txt > 171EDOintervals.new.txt</code> | ||
And it | And it did the right thing, and has worked since then for several other interval tables, although sometimes the Intervals sections have stuff after (or rarely, before) their tables that I have to manually exclude from editing (to avoid creating duplicate links or otherwise altering something that shouldn't be altered). | ||
To put it into the comments of what I did is not so straightforward. This requires escaping the backslashes with backslashes (doubling them) and converting the ampersand into "&amp;". | To put it into the comments of what I did is not so straightforward. This requires escaping the backslashes with backslashes (doubling them) and converting the ampersand into "&amp;". | ||
The case for [[23edo and octave stretching]] was more complicated, because the ratios were expressed with colons instead of slashes, and I needed to change them to slashes. This required the following "sed" command using capture groups (which Google's AI actually did a decent job of explaining how to use when I didn't know the name and was trying to look up "divided regular expression"): | |||
<code>sed -E "s#([0-9]+):([0-9]+)#\[\[\1/\2\]\]#g" 23EDOintervals.txt > 23EDOintervals.new.txt</code> | |||
The parentheses delimit the input capture groups (and note that the "+" needs to be inside each capture group or it won't work right, and if you need to look for literal parentheses you have to escape them with backslashes, same as with the square brackets), and the \1 and \2 indicate the output capture groups, which also gives you the option to reverse them (for instance, if the table contained the ratios inverted, which was not the case in this particular example, but is somewhat common elsewhere). | |||
Added: [[User:Lucius Chiaraviglio|Lucius Chiaraviglio]] ([[User talk:Lucius Chiaraviglio|talk]]) 07:20, 29 October 2025 (UTC)<br> | Added: [[User:Lucius Chiaraviglio|Lucius Chiaraviglio]] ([[User talk:Lucius Chiaraviglio|talk]]) 07:20, 29 October 2025 (UTC)<br> | ||
Last modified: [[User:Lucius Chiaraviglio|Lucius Chiaraviglio]] ([[User talk:Lucius Chiaraviglio|talk]]) | Last modified: [[User:Lucius Chiaraviglio|Lucius Chiaraviglio]] ([[User talk:Lucius Chiaraviglio|talk]]) 10:42, 2 January 2026 (UTC) | ||
== Keyboard Layout Lab == | == Keyboard Layout Lab == | ||