No such thing as a small change | |
PerlMonks |
Re^3: Make a Markup Method in Perl?by roboticus (Chancellor) |
on May 16, 2012 at 11:02 UTC ( [id://970809]=note: print w/replies, xml ) | Need Help?? |
Ah, so you're doing it as a learning exercise, then? In that case, the first thing I'd do is figure out what the grammar for my markup would be, and what it would mean. Sketch it out on a sheet of paper. Then, start writing code to read the text and parse out your instructions. If it gets nasty, you might change your grammar to simplify it. The roff, troff, etc., layout programs kept their grammar simple by using the rule "if a line begins with a period, then it's a layout command, otherwise it's text". So a marked-up file would look like this:
This is the first few lines of the man page for 7z. The man system in *NIX uses *roff formatted files. On most(?) Linux systems, you can read man 7 groff to get details on the grammar used. ...roboticus When your only tool is a hammer, all problems look like your thumb.
In Section
Seekers of Perl Wisdom
|
|