Implemented --field/ dynamic parameter to define fields. * Closes #41.
h3rald h3rald@h3rald.com
Sat, 11 Jun 2016 11:48:38 +0200
3 files changed,
35 insertions(+),
18 deletions(-)
M
doc/HastyScribe_UserGuide.htm
→
doc/HastyScribe_UserGuide.htm
@@ -242,14 +242,14 @@ <h2 id="Getting.Started">Getting Started<a href="#document-top" title="Go to top"></a></h2>
<h3 id="Downloading.Pre-built.Binaries">Downloading Pre-built Binaries<a href="#document-top" title="Go to top"></a></h3> -<p>The easiest way to get HastyScribe is by downloading one of the prebuilt binaries from the <a href="https://github.com/h3rald/hastyscribe/releases/download/v1.1.3">Github Release Page</a>:</p> +<p>The easiest way to get HastyScribe is by downloading one of the prebuilt binaries from the <a href="https://github.com/h3rald/hastyscribe/releases/download/v">Github Release Page</a>:</p> <ul> -<li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.1.3/hastyscribe_v1.1.3_macosx_x64.zip">HastyScribe for Mac OS X (x64)</a> – Compiled on OS X Yosemite (LLVM CLANG 6.0)</li> -<li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.1.3/hastyscribe_v1.1.3_windows_x64.zip">HastyScribe for Windows (x64)</a> – Cross-compiled on OS X Yosemite (MinGW-w64 GCC 4.8.2)</li> -<li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.1.3/hastyscribe_v1.1.3_windows_x86.zip">HastyScribe for Windows (x86)</a> – Cross-compiled on OS X Yosemite (MinGW-w64 GCC 4.8.2)</li> -<li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.1.3/hastyscribe_v1.1.3_linux_x86.zip">HastyScribe for Linux (x86)</a> – Cross-compiled on OS X Yosemite (GNU GCC 4.8.1)</li> -<li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.1.3/hastyscribe_v1.1.3_linux_arm.zip">HastyScribe for Linux (ARM)</a> – Cross-compiled on OS X Yosemite (GNU GCC 4.8.2)</li> +<li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.2.0/hastyscribe_v1.2.0_macosx_x64.zip">HastyScribe for Mac OS X (x64)</a> – Compiled on OS X Yosemite (LLVM CLANG 6.0)</li> +<li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.2.0/hastyscribe_v1.2.0_windows_x64.zip">HastyScribe for Windows (x64)</a> – Cross-compiled on OS X Yosemite (MinGW-w64 GCC 4.8.2)</li> +<li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.2.0/hastyscribe_v1.2.0_windows_x86.zip">HastyScribe for Windows (x86)</a> – Cross-compiled on OS X Yosemite (MinGW-w64 GCC 4.8.2)</li> +<li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.2.0/hastyscribe_v1.2.0_linux_x86.zip">HastyScribe for Linux (x86)</a> – Cross-compiled on OS X Yosemite (GNU GCC 4.8.1)</li> +<li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.2.0/hastyscribe_v1.2.0_linux_arm.zip">HastyScribe for Linux (ARM)</a> – Cross-compiled on OS X Yosemite (GNU GCC 4.8.2)</li> </ul>@@ -391,7 +391,7 @@ </thead>
<tbody> <tr> <td><code>{{$timestamp}}</code> </td> -<td> 1465637520</td> +<td> 1465638495</td> </tr> <tr> <td><code>{{$date}}</code> </td>@@ -415,19 +415,19 @@ <td> 6/11/16</td>
</tr> <tr> <td><code>{{$short-time}}</code> </td> -<td> 11:32 AM</td> +<td> 11:48 AM</td> </tr> <tr> <td><code>{{$short-time-24}}</code> </td> -<td> 11:32</td> +<td> 11:48</td> </tr> <tr> <td><code>{{$time}}</code> </td> -<td> 11:32:00 AM</td> +<td> 11:48:15 AM</td> </tr> <tr> <td><code>{{$time-24}}</code> </td> -<td> 11:32:00</td> +<td> 11:48:15</td> </tr> <tr> <td><code>{{$day}}</code> </td>@@ -480,6 +480,12 @@ </tr>
</tbody> </table> </div> + +<p>Additionally, you can define your own custom fields via command-line parameters, using the <span class="arg">–field/</span> dynamic parameter, like this:</p> + +<div class="terminal"><p>hastyscribe my-document.md –field/product:HastyScribe –field/version:1.2.0</p></div> + +<p>In this case it will be possible to access the <kwd>product</kwd> and <kwd>product</kwd> fields within <span class="file">my-document.md</span> using <code>{{$product}}</code> and <code>{{$version}}</code>.</p> <h3 id="Inline.Formatting">Inline Formatting<a href="#document-top" title="Go to top"></a></h3>
M
doc/HastyScribe_UserGuide.md
→
doc/HastyScribe_UserGuide.md
@@ -81,11 +81,11 @@ ### Downloading Pre-built Binaries
The easiest way to get {{hs}} is by downloading one of the prebuilt binaries from the [Github Release Page][release]: - * [HastyScribe for Mac OS X (x64)]({{release}}/hastyscribe_v1.1.3_macosx_x64.zip) -- Compiled on OS X Yosemite (LLVM CLANG 6.0) - * [HastyScribe for Windows (x64)]({{release}}/hastyscribe_v1.1.3_windows_x64.zip) -- Cross-compiled on OS X Yosemite (MinGW-w64 GCC 4.8.2) - * [HastyScribe for Windows (x86)]({{release}}/hastyscribe_v1.1.3_windows_x86.zip) -- Cross-compiled on OS X Yosemite (MinGW-w64 GCC 4.8.2) - * [HastyScribe for Linux (x86)]({{release}}/hastyscribe_v1.1.3_linux_x86.zip) -- Cross-compiled on OS X Yosemite (GNU GCC 4.8.1) - * [HastyScribe for Linux (ARM)]({{release}}/hastyscribe_v1.1.3_linux_arm.zip) -- Cross-compiled on OS X Yosemite (GNU GCC 4.8.2) + * [HastyScribe for Mac OS X (x64)]({{release}}{{$version}}/hastyscribe_v{{$version}}_macosx_x64.zip) -- Compiled on OS X Yosemite (LLVM CLANG 6.0) + * [HastyScribe for Windows (x64)]({{release}}{{$version}}/hastyscribe_v{{$version}}_windows_x64.zip) -- Cross-compiled on OS X Yosemite (MinGW-w64 GCC 4.8.2) + * [HastyScribe for Windows (x86)]({{release}}{{$version}}/hastyscribe_v{{$version}}_windows_x86.zip) -- Cross-compiled on OS X Yosemite (MinGW-w64 GCC 4.8.2) + * [HastyScribe for Linux (x86)]({{release}}{{$version}}/hastyscribe_v{{$version}}_linux_x86.zip) -- Cross-compiled on OS X Yosemite (GNU GCC 4.8.1) + * [HastyScribe for Linux (ARM)]({{release}}{{$version}}/hastyscribe_v{{$version}}_linux_arm.zip) -- Cross-compiled on OS X Yosemite (GNU GCC 4.8.2) ### Installing using Nimble@@ -232,6 +232,13 @@ > <code>\{\{$month-name\}\}</code> | {{$month-name}}
> <code>\{\{$month-name-abbr\}\}</code> | {{$month-name-abbr}} > <code>\{\{$timezone\}\}</code> | {{$timezone}} > <code>\{\{$timezone-offset\}\}</code> | {{$timezone-offset}} + +Additionally, you can define your own custom fields via command-line parameters, using the [--field/](class:arg) dynamic parameter, like this: + +> %terminal% +> hastyscribe my-document.md --field/product:HastyScribe --field/version:1.2.0 + +In this case it will be possible to access the <kwd>product</kwd> and <kwd>product</kwd> fields within [my-document.md](class:file) using <code>\{\{$product\}\}</code> and <code>\{\{$version\}\}</code>. ### Inline Formatting@@ -802,4 +809,4 @@ [fa]:http://fortawesome.github.io/Font-Awesome/
[fa-icons]:http://fortawesome.github.io/Font-Awesome/icons/ [pme]:http://michelf.com/projects/php-markdown/extra/ [sudtipos]:http://www.sudtipos.com/ -[release]:{{release -> https://github.com/h3rald/hastyscribe/releases/download/v1.1.3}} +[release]:{{release -> https://github.com/h3rald/hastyscribe/releases/download/v}}
M
hastyscribe.nim
→
hastyscribe.nim
@@ -14,7 +14,7 @@ from version import v
let usage* = " HastyScribe v" & v & " - Self-contained Markdown Compiler" & """ - (c) 2013-2015 Fabio Cevasco + (c) 2013-2016 Fabio Cevasco Usage: hastyscribe <markdown_file_or_glob> [options]@@ -22,6 +22,7 @@
Arguments: markdown_file_or_glob The markdown (or glob expression) file to compile into HTML. Options: + --field/<name>=<value> Define a new field called <name> with value <value>. --notoc Do not generate a Table of Contents. --user-css=<file> Insert contents of <file> as a CSS stylesheet. --output-file=<file> Write output to <file>.@@ -400,6 +401,9 @@ user_css = val
of "output-file": output_file = val else: + if key.startsWith("field/"): + FIELDS[key.replace("field/", "")] = proc(): string = + return val discard else: discard