Convert from Skimpy Markup to HTML
What it does
This script takes input with single-character skimpy markup and outputs full HTML. Perfect for converting poorly-formatted word documents.
It has some useful things if you need to do score tables, but otherwise just ignore that.
Markup characters must appear at the start of the line, but any white space that follows them will be stripped.
Skimpy Markup Syntax
- #page title
- Converted to an H1 level title.
- ##header
- Converted to an H2 level title.
- ###subheader
- Converted to an H3 level title.
- <,1
- Start a table.
Must be at the start of the line. The comma specifies the delimiter - if missing, will default to comma.
The 1 is optional, and if present sets the disable_rowspan flag, disabling the automatic rowspans.
If not using either of the optional arguments, make sure you strip white space at the end of the line.
- >#,h,h,etc
- Print table header row; replace comma with delimiter specified at table start.
- cell,cell,etc
- Delimited table data, using delimiter specified at table start.
Space between cell data and delimiter is stripped.
There is no way to escape a delimiter - use a different character to delimit.
- >
- End table.
- *<
- Start a list.
Must be on a line on its own.
- List data
- One line per list item. If the first line starts with a number followed by a full stop, the list will become an ordered list.
- >
- End a list.
- @<TYPE
- Start an HTML block of type TYPE.
If TYPE starts with a !, HTML will not be escaped; otherwise defaults to checkbox setting
If TYPE is not supplied, defaults to !.
Blocks can be infinite depth.
- >
- Close the innermost HTML block
Table output is a little quirky. If the text in each column of the first row is under 15 characters, the width will be set to 100. If rowspan is enabled, the table can only have as many columns as the first row.
If the "Convert unmarked lines to paragraphs" option is not ticked, lines without markup will be flagged up with warnings. Lines can then be converted to paragraphs with:
- [ Plain text
- Convert line into paragraph.
Nesting
You can nest a table in a list, and a list in a block. And a table in a block, or a table in a list in a block. You get the idea.
Score table extensions
- ###Sport/team v Somewhere
- Converts to an H3 level title, and stores Sport/team for later.
- ####v Competitor
- Inserts Sport/team from previous ##, at the start of the line.
In addition, if the first cell of a line looks as if it is supposed to say "Home" or "Away", it will be standardised; ie "(H)" will become "Home", "home:" will become "Home" etc.
Warning: this markup will be extended in the future, and may therefore be subject change.