HTML by itself is a very verbous document language with lengthy opening and ending tags and detailed attribute descriptions. This makes writing HTML tedious and error prone. Many web authors resort to markup languages like
markdown. Naturally however, all markup languages include only the most common subset of HTML functionality, limiting an authors abilty to define complex document structures, class attributes, and even some HTML tags.
Shorthand aims to be a simplified notation of HTML. It lets you enter arbitrary tags and attributes, without the unnecessary verbosity of plain HTML. It lets you build the full document structure including the HTML header, empty elements, wrappers, input forms, and so on.
Shorthand is written in
sed script. A
sed interpreter is availale in all posix compliant Unices, including
GNU Linux and
busybox based OSes.
Shorthand is developed as part of cgilte, but can be used standalone.
you can either clone the entire cgilite repository, or just download the plain scripts file:
$ git clone https://git.plutz.net/git/cgilite
Here is an example
[!DOCTYPE HTML] [html [head [title Example] [link rel="stylesheet" type="text/css" href="style.css"] ][body [h1 Headline] [p You can also define classes and IDs] [form #search method="POST" action="/search" [input name="q" placeholder="Search"] ] [pre .code \[p a Shorthand example\]] ]]
[tag .foo #id .bar narf="noob" Content also="content"]
is equivalent to
<tag class="foo bar" id="id" narf="noob">Content also="content"</tag>
<tag>with everything between brackets as either attribute or content
.) become class names, but
class="classname"is also fine
#) become the id, but
id="id"is also fine
<tag>) will still act as valid HTML
ä) will also retain their meaning
\). This goes for tags (
<>), brackets (
), dot, sharp, quotation, ampersand, (
. # " ' &). Literal backslashes must also be escaped via backslash (
\, or actually
There are a few simplifications, e.g.
[a "http://example.org" link]
will turn into a link, with the first item in quotes becoming
here is the source code of this document
shorthand script reads shorthand notation from
stdin and prints HTML to
$ html-sh.sed < input.short > output.html
$ printf '[html [head [title Title]][body \n %s \n ]]' "$muchtext" |html-sh.sed
Tags that are not closed by the end of the input will automatically be closed.