Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

18 lines (18 sloc) 29.14 kb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>The Simple Nice-Looking Manual Generator</title><style type="text/css">/*
Copyright John Morrice 2010
This document is part of The Simple Nice-Looking Manual Generator documentation
This document is released under the terms of the GNU Free Documentation Licence
See the file DOC-COPYING.
*/
.intro_banner {text-align: center;}
.example
{
font-family: monospace;
font-size: x-large;
border-style: solid;
border-width: 0.02em;
padding: 0.4em;
}
body {font: arial; font-family: sans;}
.boring {font-weight: bold}
</style></head><body><h1 class="intro_banner">The Simple Nice-Looking Manual Generator</h1><h2 class="intro_banner">Copyright John Morrice 2010</h2><h2 class="intro_banner">Contact spoon@killersmurf.com</h2><p class="boring">This document is released under the terms of the GNU Free Documentation License. See the file <a href="DOC-COPYING"> DOC-COPYING</a> for details</p><p class="boring">All snm source code is released under the terms of the GNU General Public Licence Version 3. See the file <a href="COPYING"> COPYING</a> for details.</p><p class="">The Simple Nice-Looking Manual Generator - A.K.A snm - generates nice looking manuals from <a href="http://www.yaml.org/"> YAML</a> files.</p><p class="">Currently, it can produce XHTML and text manuals.</p><p class="">snm is <a href="http://github.com/elginer/snm"> hosted on github</a>.</p><p class="">The sources for this manual are also in that repository, in the snm_help directory.</p><h2 class="contents_announce">Contents:</h2><p><a href="#what">1. What snm does and is</a><br /><a href="#whatnot">2. What snm does not do and is not</a><br /><a href="#build">3. Building snm</a><br />&nbsp;&nbsp;&nbsp;<a href="#easy">3.1. The Easy Way</a><br />&nbsp;&nbsp;&nbsp;<a href="#hard">3.2. The Hard Way</a><br />&nbsp;&nbsp;&nbsp;<a href="#install">3.3. Install snm to /usr/bin</a><br /><a href="#invoke">4. Invoking snm</a><br /><a href="#how">5. How to use snm</a><br />&nbsp;&nbsp;&nbsp;<a href="#header">5.1. header.yaml</a><br />&nbsp;&nbsp;&nbsp;<a href="#sections">5.2. Sections</a><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#subsections">5.2.1. Subsections</a><br />&nbsp;&nbsp;&nbsp;<a href="#paragraphs">5.3. Paragraphs</a><br />&nbsp;&nbsp;&nbsp;<a href="#banners">5.4. Banners</a><br />&nbsp;&nbsp;&nbsp;<a href="#inline">5.5. Inline Elements</a><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#links">5.5.1. Hyperlinks</a><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#literal">5.5.2. Literal text</a><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#inlineclass">5.5.3. Inline classes</a><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#inlinesyntax">5.5.4. Inline Syntax Highlighting</a><br />&nbsp;&nbsp;&nbsp;<a href="#style">5.6. Style: CSS</a><br />&nbsp;&nbsp;&nbsp;<a href="#syntax">5.7. Syntax Highlighting</a><br /><a href="#abuse">6. Further help, misuse and shortfalls</a><br /></p><h2 class="banner"><a name="what">1. What snm does and is</a></h2><p class="">snm allows you to write clean, web-friendly reports, user guides and manuals without having to edit fickle html.</p><p class="">snm allows you to structure your document in a modular fashion.</p><p class="">snm document sections are written in yaml and are easy to write and understand.</p><p class="">snm is a generator of small, valid xhtml files.</p><h2 class="banner"><a name="whatnot">2. What snm does not do and is not</a></h2><p class="">snm is not (currently) a man-page generator.</p><p class="">snm is not a web-page creator</p><p class="">snm is not a gui based tool</p><p class="">snm is not an adult activity.</p><h2 class="banner"><a name="build">3. Building snm</a></h2><p class="">First, install <a href="http://yaml.kwiki.org/index.cgi?LibSyck"> libsyck</a>.</p><p class="">Then choose to proceed to build snm in either <a href="#easy"> The Easy Way</a> or <a href="#hard"> The Hard Way</a>.</p><p class="">The hard way is presented to give more information to people who may need it. The Easy Way is recommended for absolutely everyone else!</p><h2 class="banner"><a name="easy">3.1. The Easy Way</a></h2><p class="">First install <a href="http://hackage.haskell.org/platform/"> The Haskell Platform</a>.</p><p class="">Then just do:</p><p class="">cabal install snm</p><p class="">Now <a href="#install"> install snm to /usr/bin</a></p><h2 class="banner"><a name="hard">3.2. The Hard Way</a></h2><p class="">To build snm the hard way, you must install:</p><p class=""><a href="http://haskell.org/ghc/"> The Glasgow Haskell Compiler</a>. snm has been tested with GHC 6.10.4</p><p class="">And from <a href="http://hackage.haskell.org"> Hackage</a>, the following libraries</p><p class="">base&gt;=4, parsec&gt;=3, filepath, directory, containers, HsSyck, safe, SpoonsUtilities, xhtml</p><p class="">Download the source distribution of snm from github</p><p class="">cd into its directory.</p><p class="">Run:</p><p class="example">&nbsp;&nbsp;&nbsp;cabal&nbsp;install</p><p class="">Now <a href="#install"> install snm to /usr/bin</a></p><h2 class="banner"><a name="install">3.3. Install snm to /usr/bin</a></h2><p class="">cabal install typically installs snm into your local cabal directory, usually ~/.cabal/bin/snm</p><p class="">So you'll probably need to:</p><p class="example">&nbsp;&nbsp;&nbsp;sudo&nbsp;cp&nbsp;~/.cabal/bin/snm&nbsp;/usr/bin</p><p class="">Now, try to <a href="#invoke"> invoke</a> snm</p><h2 class="banner"><a name="invoke">4. Invoking snm</a></h2><p class="">Once it is <a href="#install"> installed</a>, try invoking snm with</p><p class="example">&nbsp;&nbsp;&nbsp;snm&nbsp;--help</p><p class="">If it was successfully installed, you will see some helpful information and a list of snm's command line options:</p><p class="example">&nbsp;&nbsp;&nbsp;snm:&nbsp;The&nbsp;Simple&nbsp;Nice-Looking&nbsp;Manual&nbsp;Generator&nbsp;<br />&nbsp;<br />&nbsp;&nbsp;&nbsp;usage:&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;snm&nbsp;documentation_source_directory&nbsp;options*&nbsp;<br />&nbsp;<br />&nbsp;&nbsp;&nbsp;Where&nbsp;options*&nbsp;stands&nbsp;for&nbsp;zero&nbsp;or&nbsp;more&nbsp;of&nbsp;the&nbsp;options&nbsp;below.&nbsp;<br />&nbsp;<br />&nbsp;&nbsp;&nbsp;Note:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Only&nbsp;one&nbsp;output&nbsp;format&nbsp;is&nbsp;permitted&nbsp;per&nbsp;invocation.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;-d&nbsp;or&nbsp;--dump&nbsp;is&nbsp;used,&nbsp;snm&nbsp;will&nbsp;not&nbsp;write&nbsp;a&nbsp;file&nbsp;unless&nbsp;-o&nbsp;or&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--output&nbsp;is&nbsp;&nbsp;used.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;There&nbsp;can&nbsp;be&nbsp;no&nbsp;whitespace&nbsp;between&nbsp;-o&nbsp;and&nbsp;its&nbsp;argument,&nbsp;nor&nbsp;can&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;there&nbsp;be&nbsp;whitespace&nbsp;between&nbsp;--output=&nbsp;and&nbsp;its&nbsp;argument.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;no&nbsp;arguments&nbsp;are&nbsp;given&nbsp;to&nbsp;-o,&nbsp;then&nbsp;the&nbsp;file&nbsp;written&nbsp;will&nbsp;have&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;same&nbsp;filename&nbsp;as&nbsp;the&nbsp;documentation&nbsp;source&nbsp;directory,&nbsp;with&nbsp;an&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;appropriate&nbsp;extension&nbsp;added.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;snm&nbsp;will&nbsp;always&nbsp;add&nbsp;an&nbsp;appropriate&nbsp;extension&nbsp;to&nbsp;output&nbsp;files.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;By&nbsp;default,&nbsp;snm&nbsp;will&nbsp;produce&nbsp;xhtml,&nbsp;and&nbsp;act&nbsp;as&nbsp;if&nbsp;the&nbsp;user&nbsp;had&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;specified&nbsp;-o&nbsp;without&nbsp;an&nbsp;argument.&nbsp;<br />&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-d&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--dump&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Print&nbsp;output&nbsp;to&nbsp;stdout.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-o[A&nbsp;file&nbsp;name]&nbsp;&nbsp;--output[=A&nbsp;file&nbsp;name]&nbsp;&nbsp;Write&nbsp;output&nbsp;to&nbsp;a&nbsp;file.&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Multiple&nbsp;outputs&nbsp;ignored,&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printing&nbsp;warning&nbsp;to&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stderr.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--help&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Print&nbsp;usage&nbsp;information&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--text,&nbsp;--txt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;output.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-x&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--xhtml,&nbsp;--html&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Output&nbsp;in&nbsp;xhtml&nbsp;format.</p><h2 class="banner"><a name="how">5. How to use snm</a></h2><p class="">snm generates a manual from a number of yaml files, held in a documentation source directory. In the snm source distribution, this directory is called 'snm_help'.</p><p class="">This source directory must contain a file called 'header.yaml'. The next sub-section deals with what you put in header.yaml, and what it means.</p><h2 class="banner"><a name="header">5.1. header.yaml</a></h2><p class="">The header file has 1 required field:</p><p class="example">&nbsp;&nbsp;&nbsp;title:&nbsp;A&nbsp;<a href="#banners">&nbsp;banner</a>,&nbsp;the&nbsp;title&nbsp;of&nbsp;the&nbsp;manual.</p><p class="">The header file has 2 optional fields:</p><p class="example">&nbsp;&nbsp;&nbsp;banners:&nbsp;Zero&nbsp;or&nbsp;more&nbsp;<a href="#banners">&nbsp;banners</a>,&nbsp;used&nbsp;to&nbsp;announce&nbsp;important&nbsp;things&nbsp;at&nbsp;the&nbsp;start&nbsp;of&nbsp;a&nbsp;manual,&nbsp;for&nbsp;example,&nbsp;its&nbsp;author.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;preamble:&nbsp;Zero&nbsp;or&nbsp;more&nbsp;<a href="#paragraph">&nbsp;paragraphs</a>,&nbsp;which&nbsp;are&nbsp;not&nbsp;included&nbsp;in&nbsp;the&nbsp;manual's&nbsp;<a href="#contents">&nbsp;contents</a>.</p><p class="">For example, here is a slightly simplified version of the header.yaml file for this document:</p><p class="example">&nbsp;&nbsp;&nbsp;title:&nbsp;&quot;The&nbsp;Simple&nbsp;Nice-Looking&nbsp;Manual&nbsp;Generator&quot;&nbsp;<br />&nbsp;&nbsp;&nbsp;banners:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&quot;Copyright&nbsp;John&nbsp;Morrice&nbsp;2010&quot;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&quot;Contact&nbsp;spoon@killersmurf.com&quot;&nbsp;<br />&nbsp;&nbsp;&nbsp;preamble:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&quot;This&nbsp;document&nbsp;is&nbsp;released&nbsp;under&nbsp;the&nbsp;terms&nbsp;of&nbsp;the&nbsp;GNU&nbsp;Free&nbsp;Documentation&nbsp;License.&nbsp;See&nbsp;the&nbsp;file&nbsp;<a href="DOC-COPYING">&nbsp;DOC-COPYING</a>&nbsp;for&nbsp;details&quot;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&quot;All&nbsp;snm&nbsp;source&nbsp;code&nbsp;is&nbsp;released&nbsp;under&nbsp;the&nbsp;terms&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;Licence&nbsp;Version&nbsp;3.&nbsp;&nbsp;See&nbsp;the&nbsp;file&nbsp;<a href="COPYING">&nbsp;COPYING</a>&nbsp;for&nbsp;details.&quot;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&quot;The&nbsp;Simple&nbsp;Nice-Looking&nbsp;Manual&nbsp;Generator&nbsp;-&nbsp;A.K.A&nbsp;snm&nbsp;-&nbsp;generates&nbsp;nice&nbsp;looking&nbsp;manuals&nbsp;from&nbsp;<a href="http://www.yaml.org/">&nbsp;YAML</a>&nbsp;files.&quot;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&quot;Currently,&nbsp;it&nbsp;can&nbsp;produce&nbsp;XHTML&nbsp;and&nbsp;text&nbsp;manuals.&quot;</p><p class="">You can see how snm processes this by looking at the <a href="#"> top</a> of the document.</p><p class="">When emitting xhtml, the notices displayed at the top of the page are automatically given the css class 'banner'.</p><h2 class="banner"><a name="sections">5.2. Sections</a></h2><p class="">An snm manual, much like other structured documents, is arranged into heirarchical sections and <a href="#subsections"> subsections</a>.</p><p class="">Top level sections are described by yaml files in the documentation source directory.</p><p class="">A section file in the top directory can be given any filename, other than <a href="#header"> header.yaml</a> and <a href="#style"> style.css</a> which are reserved. This restriction does not apply to subsections.</p><p class="">Each section has 4 required fields:</p><p class="example">&nbsp;&nbsp;&nbsp;title:&nbsp;A&nbsp;<a href="#banners">&nbsp;banner</a>,&nbsp;the&nbsp;title&nbsp;of&nbsp;the&nbsp;section.&nbsp;&nbsp;This&nbsp;section's&nbsp;title&nbsp;is&nbsp;'Sections'&nbsp;<br />&nbsp;&nbsp;&nbsp;number:&nbsp;the&nbsp;number&nbsp;of&nbsp;the&nbsp;section.&nbsp;&nbsp;This&nbsp;section's&nbsp;number&nbsp;is&nbsp;2.&nbsp;<br />&nbsp;&nbsp;&nbsp;unique:&nbsp;A&nbsp;one-word,&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;this&nbsp;section.&nbsp;&nbsp;This&nbsp;is&nbsp;used&nbsp;in&nbsp;constructing&nbsp;<a href="#links">&nbsp;hyperlinks</a>.&nbsp;<br />&nbsp;&nbsp;&nbsp;text:&nbsp;Zero&nbsp;or&nbsp;more&nbsp;<a href="#paragraphs">&nbsp;paragraphs</a>.</p><p class="">For a concrete example, here is the beginning of the section file for this section.</p><p class="example">&nbsp;&nbsp;&nbsp;title:&nbsp;Sections&nbsp;<br />&nbsp;&nbsp;&nbsp;number:&nbsp;2&nbsp;<br />&nbsp;&nbsp;&nbsp;unique:&nbsp;sections&nbsp;<br />&nbsp;&nbsp;&nbsp;text:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;'An&nbsp;snm&nbsp;manual,&nbsp;much&nbsp;like&nbsp;other&nbsp;structured&nbsp;documents,&nbsp;is&nbsp;arranged&nbsp;into&nbsp;heirarchical&nbsp;sections...</p><h2 class="banner"><a name="subsections">5.2.1. Subsections</a></h2><p class="">A section is associated with subsections when the subsection files are located in a directory which has the same filename (excluding extensions) as its section file, in its same directory.</p><p class="">For example, here is a partial listing of this manual's source directory, snm_help:</p><p class="example">&nbsp;&nbsp;&nbsp;snm_help:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header.yaml&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;how&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;how.yaml&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...more&nbsp;files</p><p class="">Note the file 'how.yaml'. This is the file describing <a href="#how"> section 3, How to use snm,</a> of this document.</p><p class="">Note also the directory called how. This directory contains the subsections associated with how.yaml. Inside the how directory:</p><p class="example">&nbsp;&nbsp;&nbsp;snm_help/how:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;section&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;section.yaml&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...more&nbsp;files</p><p class="">Note the 'section.yaml' file, which describes <a href="#sections"> section 3.2, Sections</a> and its associated subsection directory 'section'.</p><p class="">Inside the section directory:</p><p class="example">&nbsp;&nbsp;&nbsp;snm_help/how/section:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subsection.yaml</p><p class="">how/section/subsection.yaml is the file describing this section.</p><p class="">A subsection's number is automatically computed by snm. Hence, according to the file describing this section, this section's number is 1. snm has discovered it is nested within section 3.2. It is an error to specify a subsection's whole number within a section file. Specify one number only!</p><h2 class="banner"><a name="paragraphs">5.3. Paragraphs</a></h2><p class="">When a sequence of paragraphs is called for in a manual yaml file, either a single text element, or a yaml <a href="http://yaml.kwiki.org/index.cgi?YamlInFiveMinutesMinuteOne"> sequence</a> is expected.</p><p class="">Paragraphs are not just plain text: they may contain <a href="#inline"> inline elements</a> like hyperlinks or literal text.</p><p class="">In a produced manual, a series of paragraphs are rendered with two line breaks between each of them. This corresponds to two newline characters in a text document, and being within a &lt;p&gt; tag in an html document. An example:</p><p class="example">&nbsp;&nbsp;&nbsp;This&nbsp;is&nbsp;a&nbsp;valid,&nbsp;although&nbsp;boring,&nbsp;paragraph.</p><p class="">Paragraphs can be associated with a class, using a yaml <a href="http://yaml.kwiki.org/index.cgi?YamlInFiveMinutesMinuteTwo"> map</a>. When rendering xhtml documents, this class is becomes the value of the class attribute for the paragraph produced. This is useful when working using a <a href="#style"> style sheet</a>. An example:</p><p class="example">&nbsp;&nbsp;&nbsp;class:&nbsp;curved_corner&nbsp;<br />&nbsp;&nbsp;&nbsp;text:&nbsp;This&nbsp;paragraph&nbsp;is&nbsp;a&nbsp;bit&nbsp;more&nbsp;exciting,&nbsp;because&nbsp;it&nbsp;is&nbsp;being&nbsp;given&nbsp;curved&nbsp;corners&nbsp;by&nbsp;css!</p><p class="">Word wrapping can be turned on or off on a paragraph basis, by setting wrap to True or false in a map paragraph. When emitting xhtml, if wrap is off, then all spaces are replaced by &amp;nbsp; and all new-lines replaced by &lt;br/&gt;. By default wrapping is on. Example:</p><p class="">This paragraph...</p><p class="example">&nbsp;&nbsp;&nbsp;wrap:&nbsp;False&nbsp;<br />&nbsp;&nbsp;&nbsp;text:&nbsp;&quot;Hey&nbsp;ho,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;let's&nbsp;go!&quot;</p><p class="">Is rendered as:</p><p class="example">&nbsp;&nbsp;&nbsp;&quot;Hey&nbsp;ho,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;let's&nbsp;go!&quot;</p><p class="">But this paragraph...</p><p class="example">&nbsp;&nbsp;&nbsp;wrap:&nbsp;True&nbsp;<br />&nbsp;&nbsp;&nbsp;text:&nbsp;&quot;Hey&nbsp;ho,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;let's&nbsp;go!&quot;</p><p class="">And this paragraph...</p><p class="example">&nbsp;&nbsp;&nbsp;&quot;Hey&nbsp;ho,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;let's&nbsp;go!&quot;</p><p class="">Are rendered as:</p><p class="example">&nbsp;&nbsp;&nbsp;Hey&nbsp;ho,&nbsp;let's&nbsp;go!</p><p class="">Paragraphs can also be associated with a formal language. This will trigger <a href="#syntax"> syntax highlighting</a>.</p><p class="">An example:</p><p class="example">&nbsp;&nbsp;&nbsp;language:&nbsp;math&nbsp;<br />&nbsp;&nbsp;&nbsp;text:&nbsp;&quot;forall&nbsp;A.&nbsp;A&nbsp;!member&nbsp;empty&quot;</p><p class="">Is rendered as:</p><p class="">&nbsp;&nbsp;&nbsp;<span class="math_symbol">&#8704;</span>&nbsp;A.&nbsp;A&nbsp;<span class="math_symbol">&#8713;</span>&nbsp;<span class="math_symbol">&#8709;</span></p><h2 class="banner"><a name="banners">5.4. Banners</a></h2><p class="">Banners appear at the top of the manual, and at the beginning of sections.</p><p class="">Banners may contain inline elements in the same manner as a paragraph.</p><p class="">Banner defined in the <a href="#header"> header</a> file are, by default, given the class 'intro_banner'. Banners defined in <a href="#sections"> sections</a> are given the class 'banner'.</p><p class="">The default banner classes can be replaced by user defined classes, in the same manner that a class can be assigned to a paragraph.</p><h2 class="banner"><a name="inline">5.5. Inline Elements</a></h2><p class="">Inline elements within paragraphs and banners allow more expressive text. The idea of an inline snm element is roughly equivalent to an inline HTML element. Much as an xhtml anchor can only appear within an xhtml block element, an inline element can only appear within an snm paragraph or banner.</p><p class="">Inline elements appear within curly braces { }.</p><p class="">If you need to actually write an opening brace in your document, the opening brace may be escaped with a backslash \.</p><p class="">The following inline elements are available: <a href="#links"> section links</a>, <a href="#links"> external links</a>, <a href="#inlineclass"> inline classes</a>, <a href="#inlinesyntax"> inline syntax highlighting</a> and <a href="#literal"> literal text</a>.</p><h2 class="banner"><a name="links">5.5.1. Hyperlinks</a></h2><p class="">snm supports two types of links.</p><p class="">Section links are hyperlinks to a <a href="#sections"> section of the document</a>, using that section's unique name.</p><p class="">External links are a more traditional link to a URL.</p><p class="">As an inline element, links begin with an opening curly brace {.</p><p class="">Then either the word 'section', which indicates a section link, or the word 'external' which indicates an external link.</p><p class="">Then the link text. This may consist of a number of words separated by whitespace.</p><p class="">Then the destination. No explicit syntax separates the link text from the destination - the last word is taken to be the destination. Obviously, section links expect a section's unique name, whereas external links expect a URL.</p><p class="">As with all inline elements, a link is closed with a curly brace }.</p><p class="">Whitespace is optional throughout links.</p><p class="">Examples:</p><p class="">The link above, which is a section link to the unique identifier 'sections':</p><p class="example">&nbsp;&nbsp;&nbsp;{section&nbsp;section&nbsp;of&nbsp;the&nbsp;document&nbsp;sections}</p><p class="">The external link in <a href="#paragraphs"> section 3.3 Paragraphs</a>, to the 'YAML in Five Minutes' tutorial</p><p class="example">&nbsp;&nbsp;&nbsp;{external&nbsp;sequence&nbsp;http://yaml.kwiki.org/index.cgi?YamlInFiveMinutesMinuteOne}</p><h2 class="banner"><a name="literal">5.5.2. Literal text</a></h2><p class="">Literal text can be specified through the literal inline element.</p><p class="">Literal text is not processed or transformed by snm: it is output directly into the output document.</p><p class="">This is risky because allows it you to write invalid xhtml, for instance; but it does allow you to write html that snm does not generate.</p><p class="">However, this approach suffers from many problems and is very much a working solution for current needs. Problems are discussed <a href="#abuse"> below</a>.</p><p class="">Example:</p><p class="example">&nbsp;&nbsp;&nbsp;{literal&nbsp;&lt;table&gt;&lt;td&gt;Embed&nbsp;a&nbsp;html&nbsp;table&lt;/td&gt;&lt;/table&gt;}</p><h2 class="banner"><a name="inlineclass">5.5.3. Inline classes</a></h2><p class="">snm supports inline classes. This allows a section of text to have a different style to the rest of the text block.</p><p class="">An inline class in an inline element beginning with the word class, and lasting until the closing brace.</p><p class="">An example:</p><p class="example">&nbsp;&nbsp;&nbsp;class:&nbsp;quote&nbsp;<br />&nbsp;&nbsp;&nbsp;text:&nbsp;&quot;Don't&nbsp;make&nbsp;me&nbsp;angry.&nbsp;You&nbsp;wouldn't&nbsp;like&nbsp;me&nbsp;when&nbsp;I'm&nbsp;angry&quot;&nbsp;{class&nbsp;--&nbsp;David&nbsp;Banner,&nbsp;The&nbsp;Incredible&nbsp;Hulk,&nbsp;1978.&nbsp;aside}</p><p class="">The text within the class element is assigned the class 'aside', allowing it to be rendered differently from the rest of the paragraph.</p><p class="">In the xhtml renderer, an inline class element:</p><p class="example">&nbsp;&nbsp;&nbsp;{class&nbsp;the&nbsp;text&nbsp;goes&nbsp;here&nbsp;x}</p><p class="">Corresponds to a span element thus:</p><p class="example">&nbsp;&nbsp;&nbsp;&lt;span&nbsp;class=&quot;x&quot;&gt;the&nbsp;text&nbsp;goes&nbsp;here&lt;/span&gt;&nbsp;</p><h2 class="banner"><a name="inlinesyntax">5.5.4. Inline Syntax Highlighting</a></h2><p class="">snm supports inline <a href="#syntax"> syntax highlighting</a> through <span class="example"> language</span> inline elements. An example:</p><p class="example">&nbsp;&nbsp;&nbsp;Some&nbsp;logic:{language&nbsp;forall&nbsp;E.&nbsp;A&nbsp;subset&nbsp;B.&nbsp;E&nbsp;member&nbsp;A&nbsp;implies&nbsp;E&nbsp;member&nbsp;B&nbsp;math}</p><p class="">This is rendered as:</p><p class="example">&nbsp;&nbsp;&nbsp;Some&nbsp;logic:&nbsp;<span class="math_symbol">&#8704;</span>&nbsp;E.&nbsp;A&nbsp;<span class="math_symbol">&#8838;</span>&nbsp;B.&nbsp;E&nbsp;<span class="math_symbol">&#8712;</span>&nbsp;A&nbsp;<span class="math_symbol">&#8658;</span>&nbsp;E&nbsp;<span class="math_symbol">&#8712;</span>&nbsp;B</p><h2 class="banner"><a name="style">5.6. Style: CSS</a></h2><p class="">When generating xhtml, snm will look for a file called 'style.css' in the documentation source directory, and embed the contents of that file into the document's header as a CSS style sheet.</p><h2 class="banner"><a name="syntax">5.7. Syntax Highlighting</a></h2><p class="">snm supports extensible syntax highlighting through dynamically loaded plugins.</p><p class="">Once a highlighting plugin is set up for a language, the language may be used in a <a href="#paragraphs"> paragraph</a> or in an <a href="#language"> inline language element</a></p><p class="">Syntax highlighting is configured through the top-level syntax.yaml file.</p><p class="">This file contains either a syntax map, or a sequence of such maps.</p><p class="">The syntax map has four elements:</p><p class="">language: The name of the language. It gives a name to the syntax highlighter in the document.</p><p class="">package: The name of the Haskell package providing the plugin. Version number included.</p><p class="">module: The name of the module providing the plugin.</p><p class="">symbol: The name of the plugin.</p><p class="">Syntax plugins must have type <span class="example"> Dynamic</span>. However, this type must have been constructed from a <span class="example"> SyntaxHighlighter</span>, defined in snm's <span class="example"> Manual.Structure</span>.</p><p class="">snm provides a module <span class="example"> Text.Syntax.Simple</span> which makes it easy to write keyword-oriented syntax highlighters.</p><p class="">Be aware that snm will not html escape strings returned by the syntax highlighter. <span class="example"> Text.XHtml.Strict.stringToHtmlString</span> from the <a href="http://hackage.haskell.org/package/xhtml"> xhtml package</a> may be useful.</p><p class="">As an example, here is this document's syntax.yaml:</p><p class="example">&nbsp;&nbsp;&nbsp;language:&nbsp;math&nbsp;<br />&nbsp;&nbsp;&nbsp;package:&nbsp;snmmath-0.0.1&nbsp;<br />&nbsp;&nbsp;&nbsp;module:&nbsp;Text.Syntax.Math&nbsp;<br />&nbsp;&nbsp;&nbsp;symbol:&nbsp;math</p><p class=""><a href="http://github.com/elginer/snm_math"> snmmath is hosted on github, too</a>.</p><h2 class="banner"><a name="abuse">6. Further help, misuse and shortfalls</a></h2><p class="">If you use snm and need more help than is available in this manual then do not hesitate to contact the author at spoon@killersmurf.com.</p><p class="">Please note that snm suffers from a number of shortfalls:</p><p class="">Invalid xhtml can be generated through manipulation of the <a href="#style"> style sheet</a>, <a href="#literal"> literal text</a>, <a href="#links"> link destinations</a>, and the <a href="#sections"> unique names of sections</a>.</p><p class="">While I regret that this is possible, attempting xhtml kludges through these means ill-fitting means is misuse of snm and may result in generation of shoddy manuals, a telling off and early bed-times all around. You have been warned!</p><p class="">Other problems:</p><p class="">snm will not check that your section links actually point anywhere.</p><p class="">section numbering is difficult at the moment.</p><p class="">Track these issues at the <a href="http://github.com/elginer/snm"> repository</a></p></body></html>
Jump to Line
Something went wrong with that request. Please try again.