Editing Documentation:How to use the Parser
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 109: | Line 109: | ||
</nowiki></poem></blockquote> | </nowiki></poem></blockquote> | ||
What | What we want to do is to turn a block of text that looks like this:<blockquote><poem><nowiki> | ||
| align=center | 502 | | align=center | 502 | ||
| [[Opiter Verginius Tricostus (consul 502 BC)|Opet. Verginius Tricostus]] | | [[Opiter Verginius Tricostus (consul 502 BC)|Opet. Verginius Tricostus]] | ||
Line 120: | Line 120: | ||
</nowiki></poem></blockquote> | </nowiki></poem></blockquote> | ||
You can do it manually, but the problem is that there is almost 500 years worth of Roman consuls (I only did consuls of Roman Republic). | |||
Regular expressions allowed me to find every such block of text and do the needed replacements automatically. In this particular case I created the final syntax right in the text editor without using Parser at all. But a lot of times I use the text editor to prepare the text for the Parser. It all depends on the situation. | Regular expressions allowed me to find every such block of text and do the needed replacements automatically. In this particular case I created the final syntax right in the text editor without using Parser at all. But a lot of times I use the text editor to prepare the text for the Parser. It all depends on the situation. | ||
Line 127: | Line 127: | ||
To use regular expressions you need a special text editor that programmers use. The one I’m using is VSCode. You can download it [https://code.visualstudio.com/ here]. Don’t worry, you don’t need to be a programmer to use it. Treat it as just a text editor. Your workflow will be: | To use regular expressions you need a special text editor that programmers use. The one I’m using is VSCode. You can download it [https://code.visualstudio.com/ here]. Don’t worry, you don’t need to be a programmer to use it. Treat it as just a text editor. Your workflow will be: | ||
Create new file, paste the text into it, do replacements. Before doing searching and replacing don’t forget to press the button with | Create new file, paste the text into it, do replacements. Before doing searching and replacing don’t forget to press the button with dot and asterisk to activate regular expressions: | ||
[[File:SearchWithRegExp.png]] | [[File:SearchWithRegExp.png]] | ||
Line 134: | Line 134: | ||
In the article they use a different text editor, which you may probably use as well (I just never used it, so I recommend the one I’m familiar with), but the syntax of regular expressions is the same no matter which text editor you use. | In the article they use a different text editor, which you may probably use as well (I just never used it, so I recommend the one I’m familiar with), but the syntax of regular expressions is the same no matter which text editor you use. | ||