MPhtml features
MPhtml generates an HTML output from MemPad's Export (single page, node or all):
+ the text will be indented according to the index structure
+ title lines will be highlighted and/or colored
+ "horizontal ruler" between pages (optional)
Other features:
+ user defined HTML templates are used as framework for the output
+ HTML tags are supported in MemPad text (in square brackets)
+ some special tags for current date, titles etc. are supported
MemPad export
In MemPad's Export window you specify a temporary file (anywhere) that will be used to pass the exported text to MPhtml.
If you want to take advantage of MPhtml's indenting and title capabilities,
+ the "Title Decoration" must be a dollar sign in square brackets [$]
+ the "Level symbol" must be a period (a different level symbol can be defined in the ini FILE)
Check "Open file.. with program..", and specify MPhtml.exe with path (browse).
This will open the MPhtml window with the exported text preset as source.
MPhtml window
The MPhtml window is opened through the MemPad Export window.
Template files are assumed in the MPhtml program directory by default (*) .
You can edit the file before generating a new output. It is also possible to edit a file, save it under a different name, and then select it.
The Source file was supplied as command parameter from the MemPad Export.
The Product file is the HTML file to produce. The default directory is the MPhtml program directory, if the program was started through MemPad.
If you check "Open it", the result will be displayed in your browser. (You may need to bring the browser to the foreground.)
Options: The page separator line can be turned on/off, and a title for the browser window can be given (for the <title> line in the HTML header section).
* Note: If you want to use a different template directory, specify it in the INI file (which is always in the program directory), Section: [Template], item: Directory. Do not forget to move existing files to the new folder.
Template files
A "Template file" is required to provide the necessary framework for a HTML document, and should also include a Cascading Style Sheet section for your preferences. See Demo file "DemoStyle.tpl.txt".
Besides global HTML output settings the style sheet allows redefining the title and highlighting tags (bold, underline etc.); see following page.
A template file must have the double extension ".tpl.txt", which makes it unique, though it has the ".txt" extension for easy opening with a text editor.
The template file must include the replacement token [...] (three dots in square brackets) at the place where the source is to be inserted.
If you want fixed content at the top or bottom of the output, you can insert anything before or after the replacement token.
For more HTML info: http://www.w3schools.com/default.asp;
Colors by name: http://www.w3schools.com/tags/ref_colornames.asp
Color picker: http://colorcop.net/?homepage
Note: If you don't know much about "Style Sheets", please be very careful with curly brackets, colons and semicolons.
Style Sheet
The style sheet section in the template "DemoStyle.tpl.txt" includes:
(1) body - overall font, background outside text area
(2) .text - a class for the text area: width, padding etc.
Units: "pt" means points, "px" means pixels, (width also handles "%");
The .text specifications become effective with the statement:
<div class="text"> in the <body> section of the template.
(3) h1, h2.. - level 1,2.. header: font size, color..
You can redefine the HTML header tags, that are used for the MemPad page titles.
For more about title lines see next page.
(4) b,i,u,s attributes (bold, italic, underline, strike-out)
Each attribute can be redefined to look completely different (color, font-family, font-size or attributes, see demo file). Frequently used style attributes are:
- font-weight:bold or normal
- text-decoration:underline or none
- font-style:italic or normal
Of course, you can leave the attributes with their predefined properties (i.e. remove the lines from the style sheet).
Page titles
Through the "title decoration" [$] and "level symbol" in the MemPad export window MPhtml will get title lines in square brackets with one or more periods indicating the level.
Example: [.. This is a title]
This is handled by MPhtml as follows:
The title lines will show bold by default. If you want special styles for headers, you have to specify how many different styles you intend to use in the MPhtml window. (This does not limit the number of levels that will be handled.)
For example, if you specify 3, MPhtml will use the HTML tags <h1>, <h2> and <h3> for the first three levels. Higher levels (in case) will all use the highest tag.
However, these header tags will produce very large titles by default, so it is necessary to redefine them in the style sheet with appropriate font-size (see example in file "DemoStyle.tpl.txt").
Title symbols
The symbols preceding the page titles are a feature of the HTML list tag <ul>.
By default a dot ("disc") will show on the base level, and different symbols on the higher levels.
You can define an overall symbol in the style sheet section of the template file.
The following example will produce no symbols at all:
ul {list-style-type:none}
Frequently used disk style types:
- disc
- circle
- square
- decimal
See http://www.w3schools.com/CSS/pr_list-style-type.asp for more
Generating HTML output
If the required title decoration and level symbol have been specified in MemPad's export window, MPhtml will generate a <ul> unit for each node, resulting in indented text and a title line with a dot (the dot symbol may vary depending on the level).
An extra separator line between pages will be drawn if activated in the MPhtml window (Options).
Line breaks and empty lines will look like in MemPad (when word wrap is activated).
Exception: if a line begins with an opening square bracket, and ends with a closing square bracket, it is assumed to be a tag-only line, and the (extra) output line feed will be suppressed. Add blank space at the end of the line to defeat this behaviour.
Special characters
The greater and less symbols (< >) as well as the double quote mark (outside HTML tags) in your text will be converted to named character entities, so they will show correctly.
The HTML file is written as Unicode (UTF-8), and handles characters of all languages. If you want to use named character entities, these should be written like in a HTML document, i.e. € for the € symbol.
If you want to see the ampersand literally, code it as &
The opening square bracket ("[") can be produced literally by doubling it (this does not apply to the closing square bracket).
Tags in MemPad text
Tags for the HTML output must be enclosed in square brackets, which will be simply replaced by angle brackets (as required by the HTML standard), unless MPhtml detects a keyword/code for special handling.
Angle brackets have no effect, and will show literally in your HTML output.
If you want to see the opening square bracket literally, double it.
Note that HTML tags will not necessarily have the textbook effect, because they can be redefined in the template's style sheet section.
Though you can insert any HTML tags in your MemPad text, you will probably use only highlighting tags like bold.
For special tags see following pages.
Current date
With a date tag like [date=YYYY-MM-DD] you can insert the current date in a variety of formats, using the letters Y, M and D (case ignored) with any delimiters.
Tokens: yy, yyyy, m, mm, mmm, mmmm, d, dd, ddd, dddd
Results: 12, 2012, 9, 09, Sep, September, 23, 23, So, Sonntag
Months and weekdays will show in the user's language
Example: [date=DDDD, D MMMM YYYY] produces: Sonntag, 23 September 2012
Date tokens can be used in the template as well as in the source text, in both cases with square brackets(!)
Hyperlinks
If you enclose a "http:" hyperlink in square brackets, it will show as clickable link (which will open a new browser window).
Example: http://home.mnet-online.de/horst.muc/
INI file summary
INI file "MPhtml.ini" in Program directory.
[Template]
Directory - path, default is the program directory
Last - last used template, kept by program
[Files]
Source - path\file, kept by program
Product - path\file, kept by program
[Settings]
PageSeparator - separator line between pages: 1 or 0 (Y/N, default:1)
BrowserTitle - title for browser window
TitleRange - number of different page title styles, default:0
TagStartSymbol - for tags in MemPad, default [
TagEndSymbol - for tags in MemPad, default ]
LevelSymbol - title level symbol (export window) default:point
[Named]
Gt - replace ">" with ">" 1 or 0 (Y/N, default:1)
Lt - replace "<" with "<" 1 or 0 (Y/N, default:1)
Quot - replace double quote mark with """ 1 or 0 (Y/N, default:1)
If a section does not exist, add the section name in square brackets at the bottom.
Author
MPhtml © 2008-2012, Horst Schaeffer
horst.schaeffer@gmx.net
Generated: 23 Sep 2012