|
||||||||||||||||||||||||||||||||||||||||
With the addition of this blog to our website we soon found the need to publish Basic+ source code along with technical articles, and, being bored of plain <pre> tags, we decided write a tool that would allow us to easily generate HTML for syntax-coloured Basic+ code. We also wanted something we could use on the Revelation Forum as well as on the blog.
Well, after digging up some old prototype syntax highlighting code and wrapping it in a simple form, the "Sprezzatura Basic+ Source Code HTML Publisher" was born. The bad news is the awful title - the good news is that we're giving it away so you can use it yourself if you wish. The rest of this post simply describes how to use it - if you want a copy then simply drop us a line and we'll send you one. The installation is a standard setup.exe compiled with the RDK/NSIS on OI9, so it will ask you the usual questions such as the location of the target OI system and the login credentials etc. The software will be copied into the SYSPROG application - once you've got it installed into your copy of OI execute the ZZ_IDE_BP_PUBLISHER form to launch the Publisher. Using the Publisher The Publisher is composed of four tabs - publishing your Basic+ code to HTML is simply a matter of following this sequence:
Source Code Tab Use this tab to enter the source code you wish to publish. You can enter it directly, paste it from the clipboard, or use the "Open" button to load the contents of a Stored Procedure or Insert from the repository. Styling Options Tab This tab lets you define how you want your source formatted when it's published to HTML. StyleSheet Options: This settings allows you to specify how you wish to use CSS with your published source code. You can use one of the following options:
Add [ ] brackets: This option adds a "[" character to the beginning of the generated HTML and an "]" character afterwards. These two characters are necessary when adding your published source code to the revelation.com forum - when making a post anything between these two characters is considered to be raw HTML to be embedded in the posting. Without these it is considered to be text. Overall CSS formatting: This group of options is applied to the <div> tag that surrounds the published source code. There are prompts for the most common CSS requirements, and a miscellaneous tag to allow ad-hoc CSS styles to be applied as required. Syntax-specific CSS formatting: This group of options controls the formatting applied to each type of token found in the Basic+ code. Again, there are prompts for the most common CSS requirements, and a miscellaneous tag to allow ad-hoc CSS styles to be applied as required. Replace tabs: When the Basic+ code is formatted to HTML all tab characters are translated to non-breaking space characters. This option allows you to specify how many spaces are used per tab character. Include Line Numbers: Check this option to include line numbers in the published source code. Save Styling Options: Click this button to save the styling options to a record in the SYSENV table. The Publisher automatically loads saved styling options when the form is created. Styling options are saved with a key structure like so:
If no user specific config record is found the Publisher attempts to load an application specific one:
The application inheritance chain is respected. HTML Code Tab When you click on this tab the Publisher processes the Basic+ source code and applies the CSS styling - the result is displayed in this tab. Copy To Clipboard: This button copies the entire text to the clipboard so you can paste it into your post. Save As: This button creates a very basic HTML document that contains the generated HTML and allows you to save it to disk. HTML Preview Tab This tab uses the ActiveX WebBrowser control to display a preview of the generated HTML. Keywords and Styling When the publisher processes your Basic+ code it breaks it up into tokens and applies the relevant CSS to each token found. If you elect to use a stylesheet with your source code rather than inline-styling a CSS class name is applied to each token. The CSS class name of each token and the type of token it applies to is listed below:
The list of keywords using for publishing is contained in a record in the SYSENV table called CFG_ZZ_TCL_EDIT_BP_KEYWORDS. This record has four fields, each of which contain a multivalued list of words:
Labels: Basic+, freeware, OpenInsight, ZZ_IDE_BP_PUBLISHER |
||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home