Difference between revisions of "Documentation:How to use the Parser"

Jump to navigation Jump to search
m
28 revisions imported
m (28 revisions imported)
 
(8 intermediate revisions by the same user not shown)
Line 109: Line 109:
</nowiki></poem></blockquote>
</nowiki></poem></blockquote>


What we want to do is to turn a block of text that looks like this:<blockquote><poem><nowiki>
What I needed to do was to turn a block of text that looks like this:<blockquote><poem><nowiki>
| align=center | 503
| align=center | 502
| [[Agrippa Menenius Lanatus (consul 503 BC)|Agrippa Menenius Lanatus]]
| [[Opiter Verginius Tricostus (consul 502 BC)|Opet. Verginius Tricostus]]
| [[Publius Postumius Tubertus|P. Postumius Tubertus]] II
| [[Spurius Cassius Viscellinus|Sp. Cassius Viscellinus]]
</nowiki></poem></blockquote>
</nowiki></poem></blockquote>


Into this:<blockquote><poem><nowiki>
into a block of text that looks like this:<blockquote><poem><nowiki>
[[Agrippa Menenius Lanatus (consul 503 BC)|Agrippa Menenius Lanatus]];;;;09.01.-503;;
[[Opiter Verginius Tricostus (consul 502 BC)|Opet. Verginius Tricostus]];;;;09.01.-502;;
[[Publius Postumius Tubertus|P. Postumius Tubertus II]] (post.);;;;09.01.-503;;
[[Spurius Cassius Viscellinus|Sp. Cassius Viscellinus]] (post.);;;;09.01.-502;;
</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).  
I could have done 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, do replacements. Before doing searching and replacing don’t forget to press the button with dot and asterisk to activate regular expressions:
Create new file, paste the text into it, do replacements. Before doing searching and replacing don’t forget to press the button with a dot and an asterisk to activate regular expressions:


[[File:SearchWithRegExp.png]]
[[File:SearchWithRegExp.png]]
Line 133: Line 133:
To learn about regular expressions read this [https://docs.microsoft.com/en-us/visualstudio/ide/using-regular-expressions-in-visual-studio article].
To learn about regular expressions read this [https://docs.microsoft.com/en-us/visualstudio/ide/using-regular-expressions-in-visual-studio article].


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 what 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.
 
==Converting Julian dates to Gregorian dates==
Sometimes (very rarely though) the sources that you use may provide only old style dates. In this case you work with the data the same way, but in the end, after the dates are formatted, you just click the ''Julian to Gregorian'' button. All the dates after the calendar reform of 1582 will be converted. The dates before the reform will stay the same. Just make sure you don’t accidentally convert a date that was Gregorian to begin with.
 
When testing such layer on the Timeline turn on Julian dates in the Menu. This way you'll be able to compare the dates on the Timeline with the dates in the sources that you used, as they will all be Julian dates.

Navigation menu