saait.html - www.codemadness.org - www.codemadness.org saait content files
 (HTM) git clone git://git.codemadness.org/www.codemadness.org
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       saait.html (9508B)
       ---
            1 <!DOCTYPE html>
            2 <html dir="ltr" lang="en">
            3 <head>
            4         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            5         <meta http-equiv="Content-Language" content="en" />
            6         <meta name="viewport" content="width=device-width" />
            7         <meta name="keywords" content="saait, web" />
            8         <meta name="description" content="Saait: a boring HTML page generator" />
            9         <meta name="author" content="Hiltjo" />
           10         <meta name="generator" content="Static content generated using saait: https://codemadness.org/saait.html" />
           11         <title>Saait: a boring HTML page generator - Codemadness</title>
           12         <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
           13         <link rel="stylesheet" href="print.css" type="text/css" media="print" />
           14         <link rel="alternate" href="atom.xml" type="application/atom+xml" title="Codemadness Atom Feed" />
           15         <link rel="alternate" href="atom_content.xml" type="application/atom+xml" title="Codemadness Atom Feed with content" />
           16         <link rel="icon" href="/favicon.png" type="image/png" />
           17 </head>
           18 <body>
           19         <nav id="menuwrap">
           20                 <table id="menu" width="100%" border="0">
           21                 <tr>
           22                         <td id="links" align="left">
           23                                 <a href="index.html">Blog</a> |
           24                                 <a href="/git/" title="Git repository with some of my projects">Git</a> |
           25                                 <a href="/releases/">Releases</a> |
           26                                 <a href="gopher://codemadness.org">Gopherhole</a>
           27                         </td>
           28                         <td id="links-contact" align="right">
           29                                 <span class="hidden"> | </span>
           30                                 <a href="feeds.html">Feeds</a> |
           31                                 <a href="pgp.asc">PGP</a> |
           32                                 <a href="mailto:hiltjo@AT@codemadness.DOT.org">Mail</a>
           33                         </td>
           34                 </tr>
           35                 </table>
           36         </nav>
           37         <hr class="hidden" />
           38         <main id="mainwrap">
           39                 <div id="main">
           40                         <article>
           41 <header>
           42         <h1>Saait: a boring HTML page generator</h1>
           43         <p>
           44         <strong>Last modification on </strong> <time>2020-07-20</time>
           45         </p>
           46 </header>
           47 
           48 <p>Saait is the most boring static HTML page generator.</p>
           49 <p>Meaning of saai (dutch): boring. Pronunciation: site</p>
           50 <p><a href="/git/saait/file/README.html">Read the README for more information about it.</a></p>
           51 <p>I used to use <a href="/git/static-site-scripts/files.html">shellscripts</a> to generate the static pages, but realised I
           52 wanted a small program that works on each platform consistently.  There are
           53 many incompatibilities or unimplemented features in base tools across different
           54 platforms: Linux, UNIX, Windows.</p>
           55 <p>This site is created using saait.</p>
           56 <h2>Features</h2>
           57 <ul>
           58 <li>Single small binary that handles all the things. At run-time no dependency on
           59 other tools.</li>
           60 <li>Few lines of code (about 575 lines of C) and no dependencies except: a C
           61 compiler and libc.</li>
           62 <li>Works on most platforms: tested on Linux, *BSD, Windows.</li>
           63 <li>Simple template syntax.</li>
           64 <li>Uses HTML output by default, but can easily be modified to generate any
           65 textual content, like gopher pages, wiki pages or other kinds of documents.</li>
           66 <li>Out-of-the-box supports: creating an index page of all pages, Atom feed,
           67 twtxt.txt feed, sitemap.xml and urllist.txt.</li>
           68 </ul>
           69 <h2>Cons</h2>
           70 <ul>
           71 <li>Simple template syntax, but very basic. Requires C knowledge to extend it if
           72 needed.</li>
           73 <li>Only basic (no nested) template blocks supported.</li>
           74 </ul>
           75 <h2>Clone</h2>
           76 <pre><code>git clone git://git.codemadness.org/saait
           77 </code></pre>
           78 <h2>Browse</h2>
           79 <p>You can browse the source-code at:</p>
           80 <ul>
           81 <li><a href="https://git.codemadness.org/saait/">https://git.codemadness.org/saait/</a></li>
           82 <li><a href="gopher://codemadness.org/1/git/saait">gopher://codemadness.org/1/git/saait</a></li>
           83 </ul>
           84 <h2>Download releases</h2>
           85 <p>Releases are available at:</p>
           86 <ul>
           87 <li><a href="https://codemadness.org/releases/saait/">https://codemadness.org/releases/saait/</a></li>
           88 <li><a href="gopher://codemadness.org/1/releases/saait">gopher://codemadness.org/1/releases/saait</a></li>
           89 </ul>
           90 <h2>Documentation / man page</h2>
           91 <p>Below is the saait(1) man page, which includes usage examples.</p>
           92 <pre><code>
           93 SAAIT(1)                    General Commands Manual                      SAAIT(1)
           94 
           95 NAME
           96      saait  the most boring static page generator
           97 
           98 SYNOPSIS
           99      saait [-c configfile] [-o outputdir] [-t templatesdir] pages...
          100 
          101 DESCRIPTION
          102      saait writes HTML pages to the output directory.
          103 
          104      The arguments pages are page config files, which are processed in the
          105      given order.
          106 
          107      The options are as follows:
          108 
          109      -c configfile
          110              The global configuration file, the default is "config.cfg". Each
          111              page configuration file inherits variables from this file. These
          112              variables can be overwritten per page.
          113 
          114      -o outputdir
          115              The output directory, the default is "output".
          116 
          117      -t templatesdir
          118              The templates directory, the default is "templates".
          119 
          120 DIRECTORY AND FILE STRUCTURE
          121      A recommended directory structure for pages, although the names can be
          122      anything:
          123      pages/001-page.cfg
          124      pages/001-page.html
          125      pages/002-page.cfg
          126      pages/002-page.html
          127 
          128      The directory and file structure for templates must be:
          129      templates/&lt;templatename&gt;/header.ext
          130      templates/&lt;templatename&gt;/item.ext
          131      templates/&lt;templatename&gt;/footer.ext
          132 
          133      The following filename prefixes are detected for template blocks and
          134      processed in this order:
          135 
          136      "header."
          137              Header block.
          138 
          139      "item."
          140              Item block.
          141 
          142      "footer."
          143              Footer block.
          144 
          145      The files are saved as output/&lt;templatename&gt;, for example
          146      templates/atom.xml/* will become: output/atom.xml. If a template block
          147      file does not exist then it is treated as if it was empty.
          148 
          149      Template directories starting with a dot (".") are ignored.
          150 
          151      The "page" templatename is special and will be used per page.
          152 
          153 CONFIG FILE
          154      A config file has a simple key=value configuration syntax, for example:
          155 
          156      # this is a comment line.
          157      filename = example.html
          158      title = Example page
          159      description = This is an example page
          160      created = 2009-04-12
          161      updated = 2009-04-14
          162 
          163      The following variable names are special with their respective defaults:
          164 
          165      contentfile
          166              Path to the input content filename, by default this is the path
          167              of the config file with the last extension replaced to ".html".
          168 
          169      filename
          170              The filename or relative file path for the output file for this
          171              page.  By default the value is the basename of the contentfile.
          172              The path of the written output file is the value of filename
          173              appended to the outputdir path.
          174 
          175      A line starting with # is a comment and is ignored.
          176 
          177      TABs and spaces before and after a variable name are ignored.  TABs and
          178      spaces before a value are ignored.
          179 
          180 TEMPLATES
          181      A template (block) is text.  Variables are replaced with the values set
          182      in the config files.
          183 
          184      The possible operators for variables are:
          185 
          186      $             Escapes a XML string, for example: &lt; to the entity &amp;lt;.
          187 
          188      #             Literal raw string value.
          189 
          190      %             Insert contents of file of the value of the variable.
          191 
          192      For example in a HTML item template:
          193 
          194      &lt;article&gt;
          195              &lt;header&gt;
          196                      &lt;h1&gt;&lt;a href=""&gt;${title}&lt;/a&gt;&lt;/h1&gt;
          197                      &lt;p&gt;
          198                              &lt;strong&gt;Last modification on &lt;/strong&gt;
          199                              &lt;time datetime="${updated}"&gt;${updated}&lt;/time&gt;
          200                      &lt;/p&gt;
          201              &lt;/header&gt;
          202              %{contentfile}
          203      &lt;/article&gt;
          204 
          205 EXIT STATUS
          206      The saait utility exits 0 on success, and &gt;0 if an error occurs.
          207 
          208 EXAMPLES
          209      A basic usage example:
          210 
          211      1.   Create a directory for a new site:
          212 
          213           mkdir newsite
          214 
          215      2.   Copy the example pages, templates, global config file and example
          216           stylesheets to a directory:
          217 
          218           cp -r pages templates config.cfg style.css print.css newsite/
          219 
          220      3.   Change the current directory to the created directory.
          221 
          222           cd newsite/
          223 
          224      4.   Change the values in the global config.cfg file.
          225 
          226      5.   If you want to modify parts of the header, like the navigation menu
          227           items, you can change the following two template files:
          228           templates/page/header.html
          229           templates/index.html/header.html
          230 
          231      6.   Create any new pages in the pages directory. For each config file
          232           there has to be a corresponding HTML file.  By default this HTML
          233           file has the path of the config file, but with the last extension
          234           (".cfg" in this case) replaced to ".html".
          235 
          236      7.   Create an output directory:
          237 
          238           mkdir -p output
          239 
          240      8.   After any modifications the following commands can be used to
          241           generate the output and process the pages in descending order:
          242 
          243           find pages -type f -name '*.cfg' -print0 | sort -zr | xargs -0 saait
          244 
          245      9.   Copy the modified stylesheets to the output directory also:
          246 
          247           cp style.css print.css output/
          248 
          249      10.  Open output/index.html locally in your webbrowser to review the
          250           changes.
          251 
          252      11.  To synchronize files, you can securely transfer them via SSH using
          253           rsync:
          254 
          255           rsync -av output/ user@somehost:/var/www/htdocs/
          256 
          257 TRIVIA
          258      The most boring static page generator.
          259 
          260      Meaning of saai (dutch): boring, pronunciation of saait: site
          261 
          262 SEE ALSO
          263      find(1), sort(1), xargs(1)
          264 
          265 AUTHORS
          266      Hiltjo Posthuma &lt;hiltjo@codemadness.org&gt;
          267 </code></pre>
          268 
          269                         </article>
          270                 </div>
          271         </main>
          272 </body>
          273 </html>