|Keep It Simple, Stupid|
Re^2: Thanks to Ikegami, Chromatic & Corionby Logicus
|on Nov 01, 2011 at 21:46 UTC||Need Help??|
The complete sourcecode to PerlNights.com, including all site assets, will be available shortly in the "Castle Blueprints" section. (gosh a self-replicating castle... whatever next?)
In the table below, input refers to information either loaded from disc, retrieved from a db, created by a plugin, or entered through the query data by an end user.
Output refers to the final produced output at end of processing.
In between these two there is usually no need to consider these specials at all as they are all automatically dealt with by the system, so unless your doing something very bizarre your not likely to ever see them or need to know what they are about.
Having said that for the sake of absolute completeness the special symbols work as follows;
Note: if you want to use a tag other than "special" to instruct the parser to insert a special char, perhaps in the case where your using an XML file containing tags of the same name, provision has been made to rename the special tag by changing a value in the Conf.pm file.
It's also possible in theory, that since the end programmer is not expected to know or care about these symbols for the vast majority of their tasks, that the system could be automated such that input is scanned for the existence of <special> tags and automatically shift to using a different delimiter, for instance <special1>. I'm not sure if that would be overkill, there is such a thing as a sledgehammer and a nut.
In the case where you wish to output aXML code such as <db_mask> then you have the choice to either use &lab;/&rab; or </>, either will work, and which you use depends on whether you want the literal output, or output is to be encoded for display in a browser. (the latter being I suspect the far more common requirement.
The following aXML file was used to test the round trip completeness for the parser code:
As you can see, no mention of any specials is required at the document level, as they are all handled automatically at the parser/plugin level. The above code run with the standard set, can take the parser as input in the text area, and correctly displays it above, and encodes it in the input area for another go around the circle if you click submit again. Sending it around the circle multiple times has no detrimental effect; the output remains identical to the input.
Modifying the above like this :
Causes fragments of perl wrapped in <code> tags to be highlighted in a similar fashion to the "nano" text editor, and fragments of aXML wrapped in <aXML> tags to be highlighted in a similar vein.
The highlighting is done with <span> tags and can then be styled using CSS. PerlNights currently has two colour-schemes, midnight (light-text on darkblue bg) and daytime (dark text on white bg), and more might be added later.
P.s, if you want a sneak peak at the PerlNights code before I'm finished writing it, you can drop me an email and I will bundle you over a ZIP or tar.gz file, I'm sure you know my address, either that or you can just wait till I'm done and PerlNights is operational, won't be too long!