all repos — hastyscribe @ d457e4ccb756c0b2d68f80cd7b80eee4665c20d0

A professional markdown compiler.

Minor changes
h3rald h3rald@h3rald.com
Sat, 12 Oct 2013 15:21:15 +0200
commit

d457e4ccb756c0b2d68f80cd7b80eee4665c20d0

parent

4d0c8dc5442826786ad1d915a1b74a7cad3c64d3

4 files changed, 21 insertions(+), 14 deletions(-)

jump to
M assets/badges.lessassets/badges.less

@@ -8,6 +8,5 @@ .gray-circle {.mix-circle(@gray)}

.star { .mix-symbol("\2605", @bright-yellow)} .heart {.mix-symbol("\2665", @bright-red)} -.shamrock {.mix-symbol("\2618", @bright-green, 105%)} .cross {.mix-symbol("\2718 ", @bright-red)} .check {.mix-symbol("\2714 ", @bright-green)}
M assets/hastyscribe.cssassets/hastyscribe.css

@@ -1,1 +1,1 @@

-/*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:transparent}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}body{background-color:#fff;margin:0 auto;height:100%;zoom:1;letter-spacing:normal;word-spacing:normal;color:#333;font:15px "Calibri","Helvetica","Arial","Freesans","Clean",sans-serif;line-height:1.4;-webkit-font-smoothing:antialiased;width:960px;-webkit-hyphens:$val;-moz-hyphens:$val;-ms-hyphens:$val;-o-hyphens:$val;hyphens:$val}#main,#footer,#header{width:96%;margin:auto}ul,ol{padding-left:30px}@media screen and (max-width:959px){body{width:100%}}@media screen and (min-width:960px){body{width:960px}}h1,h2,h3,h4,h5,h6{color:#111;border-bottom:1px solid #ddd}#toc{margin-top:-10px}#toc ul{list-style-type:none;padding-left:20px}#toc>ul{padding-left:0}blockquote{border-left:3px solid #dedede;padding:0 10px;margin:10px 0;font-style:italic}dl{margin-left:5px}dl dt{font-weight:bold}code{color:#333;background-color:#efefef;padding:0 3px 0;display:inline-block;width:auto;margin:1px;border:1px solid #999;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;text-shadow:0 1px 0 rgba(255,255,255,0.8);box-shadow:0 1px 3px rgba(0,0,0,0.1);font-family:"Monaco","DejaVu Sans Mono","Courier New",monospace;font-size:80%}kbd,span.kbd{color:#333;background-color:#efefef;padding:0 3px 0;display:inline-block;width:auto;margin:1px;border:1px solid #999;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;text-shadow:0 1px 0 rgba(255,255,255,0.8);box-shadow:0 1px 3px rgba(0,0,0,0.1);font-weight:bold;border-right:1px solid #333;border-bottom:1px solid #333;line-height:.9em;font-size:85%}mark,span.mark{padding:0 1px;color:#222}pre{-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;margin:10px auto;padding:7px 7px 0 7px;box-shadow:0 1px 3px rgba(0,0,0,0.1);text-shadow:0 1px 0 rgba(255,255,255,0.8);color:#333;background-color:#efefef;border:1px solid #999;margin:auto;font-family:"Monaco","DejaVu Sans Mono","Courier New",monospace}pre code{box-shadow:none;padding:0;border:0}table{-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;margin:10px auto;padding:7px 7px 0 7px;box-shadow:0 1px 3px rgba(0,0,0,0.1);text-shadow:0 1px 0 rgba(255,255,255,0.8);color:#333;background-color:transparent;border:1px solid #999;border-collapse:collapse;margin:15px auto;border-spacing:0;empty-cells:show}table thead{background:#efefef;color:#222;text-align:left;vertical-align:bottom}table td,table th{background-color:transparent;border:1px solid #999;font-size:inherit;margin:0;overflow:visible;padding:6px 12px}#footer{text-align:center;font-size:70%}a,a:visited{color:#4183c4;text-decoration:none}a:hover,a:visited:hover{text-decoration:underline}a:before,a:visited:before{font-style:normal}a[href*=http]:before{font-weight:bold;content:"\21AA "}a[href^=mailto]:before{font-weight:bold;font-size:110%;content:"\2709 "}a[href^=tel]:before{font-weight:bold;font-size:110%;content:"\2706 "}abbr,blockquote,code,kbd,q,samp,tt,var{-webkit-hyphens:$val;-moz-hyphens:$val;-ms-hyphens:$val;-o-hyphens:$val;hyphens:$val}abbr{font-variant:small-caps;font-weight:bolder}abbr:hover{cursor:help}address{font-style:italic;color:#999}hr{border:0;height:1px;background-image:-webkit-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.75),rgba(0,0,0,0));background-image:-moz-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.75),rgba(0,0,0,0));background-image:-ms-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.75),rgba(0,0,0,0));background-image:-o-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.75),rgba(0,0,0,0))}samp,span.samp{font-size:80%;color:#333;background-color:#efefef;padding:0 3px 0;display:inline-block;width:auto;margin:1px;border:1px solid #efefef;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;text-shadow:0 1px 0 rgba(255,255,255,0.8);box-shadow:0 1px 3px rgba(0,0,0,0.1)}var,span.var{font-size:80%;font-family:"Monaco","DejaVu Sans Mono","Courier New",monospace;font-weight:bold;font-style:normal}cite,span.cite{font-weight:bold;font-style:italic}q,span.q{font-style:italic;color:#666}tt,span.tt{font-family:"Monaco","DejaVu Sans Mono","Courier New",monospace;font-size:80%}.note{-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;margin:10px auto;padding:7px 7px 0 7px;box-shadow:0 1px 3px rgba(0,0,0,0.1);text-shadow:0 1px 0 rgba(255,255,255,0.8);color:#555;background-color:#efefef;border:1px solid #efefef}.note p{margin-top:0;margin-bottom:0}.note p:first-child{font-size:105%;font-style:italic;color:#333}.warning{border-top:2px solid #555;border-bottom:2px solid #555;background-color:#efefef;margin:10px auto;padding:7px 7px 0 7px}.warning p{margin-top:0;margin-bottom:0}.warning p:first-child{font-size:105%;font-weight:bold;color:#333}.sidebar{-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;margin:10px auto;padding:7px 7px 0 7px;box-shadow:0 1px 3px rgba(0,0,0,0.1);text-shadow:0 1px 0 rgba(255,255,255,0.8);color:#555;background-color:#efefef;border:1px solid #efefef}.sidebar p{margin-top:0;margin-bottom:0}.sidebar p:first-child{font-size:105%;font-weight:bold;color:#333}.note,.warning{width:66.6667%}@media screen and (max-width:599px){.note,.warning{width:96%}}@media screen and (min-width:600px){.note,.warning{width:66.6667%}}span.todo{font-weight:bold;color:#c30;text-decoration:underline;vertical-align:top}span.todo:before{font-variant:small-caps;font-size:120%;content:"todo"}span.fixme{font-weight:bold;color:#c30;text-decoration:underline;vertical-align:top}span.fixme:before{font-variant:small-caps;font-size:120%;content:"fixme"}.red-circle:before{font-style:normal;font-size:100%;color:#c30;content:"\25CF"}.green-circle:before{font-style:normal;font-size:100%;color:#0c3;content:"\25CF"}.yellow-circle:before{font-style:normal;font-size:100%;color:#f5b800;content:"\25CF"}.gray-circle:before{font-style:normal;font-size:100%;color:#999;content:"\25CF"}.star:before{font-style:normal;font-size:100%;color:#f5b800;content:"\2605"}.heart:before{font-style:normal;font-size:100%;color:#c30;content:"\2665"}.shamrock:before{font-style:normal;font-size:105%;color:#0c3;content:"\2618"}.cross:before{font-style:normal;font-size:100%;color:#c30;content:"\2718 "}.check:before{font-style:normal;font-size:100%;color:#0c3;content:"\2714 "}+/*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:transparent}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}body{background-color:#fff;margin:0 auto;height:100%;zoom:1;letter-spacing:normal;word-spacing:normal;color:#333;font:15px "Calibri","Helvetica","Arial","Freesans","Clean",sans-serif;line-height:1.4;-webkit-font-smoothing:antialiased;width:960px;-webkit-hyphens:$val;-moz-hyphens:$val;-ms-hyphens:$val;-o-hyphens:$val;hyphens:$val}#main,#footer,#header{width:96%;margin:auto}ul,ol{padding-left:30px}@media screen and (max-width:959px){body{width:100%}}@media screen and (min-width:960px){body{width:960px}}h1,h2,h3,h4,h5,h6{color:#111;border-bottom:1px solid #ddd}#toc{margin-top:-10px}#toc ul{list-style-type:none;padding-left:20px}#toc>ul{padding-left:0}blockquote{border-left:3px solid #dedede;padding:0 10px;margin:10px 0;font-style:italic}dl{margin-left:5px}dl dt{font-weight:bold}code{color:#333;background-color:#efefef;padding:0 3px 0;display:inline-block;width:auto;margin:1px;border:1px solid #999;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;text-shadow:0 1px 0 rgba(255,255,255,0.8);box-shadow:0 1px 3px rgba(0,0,0,0.1);font-family:"Monaco","DejaVu Sans Mono","Courier New",monospace;font-size:80%}kbd,span.kbd{color:#333;background-color:#efefef;padding:0 3px 0;display:inline-block;width:auto;margin:1px;border:1px solid #999;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;text-shadow:0 1px 0 rgba(255,255,255,0.8);box-shadow:0 1px 3px rgba(0,0,0,0.1);font-weight:bold;border-right:1px solid #333;border-bottom:1px solid #333;line-height:.9em;font-size:85%}mark,span.mark{padding:0 1px;color:#222}pre{-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;margin:10px auto;padding:7px 7px 0 7px;box-shadow:0 1px 3px rgba(0,0,0,0.1);text-shadow:0 1px 0 rgba(255,255,255,0.8);color:#333;background-color:#efefef;border:1px solid #999;margin:auto;font-family:"Monaco","DejaVu Sans Mono","Courier New",monospace}pre code{box-shadow:none;padding:0;border:0}table{-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;margin:10px auto;padding:7px 7px 0 7px;box-shadow:0 1px 3px rgba(0,0,0,0.1);text-shadow:0 1px 0 rgba(255,255,255,0.8);color:#333;background-color:transparent;border:1px solid #999;border-collapse:collapse;margin:15px auto;border-spacing:0;empty-cells:show}table thead{background:#efefef;color:#222;text-align:left;vertical-align:bottom}table td,table th{background-color:transparent;border:1px solid #999;font-size:inherit;margin:0;overflow:visible;padding:6px 12px}#footer{text-align:center;font-size:70%}a,a:visited{color:#4183c4;text-decoration:none}a:hover,a:visited:hover{text-decoration:underline}a:before,a:visited:before{font-style:normal}a[href*=http]:before{font-weight:bold;content:"\21AA "}a[href^=mailto]:before{font-weight:bold;font-size:110%;content:"\2709 "}a[href^=tel]:before{font-weight:bold;font-size:110%;content:"\2706 "}abbr,blockquote,code,kbd,q,samp,tt,var{-webkit-hyphens:$val;-moz-hyphens:$val;-ms-hyphens:$val;-o-hyphens:$val;hyphens:$val}abbr{font-variant:small-caps;font-weight:bolder}abbr:hover{cursor:help}address{font-style:italic;color:#999}hr{border:0;height:1px;background-image:-webkit-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.75),rgba(0,0,0,0));background-image:-moz-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.75),rgba(0,0,0,0));background-image:-ms-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.75),rgba(0,0,0,0));background-image:-o-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.75),rgba(0,0,0,0))}samp,span.samp{font-size:80%;color:#333;background-color:#efefef;padding:0 3px 0;display:inline-block;width:auto;margin:1px;border:1px solid #efefef;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;text-shadow:0 1px 0 rgba(255,255,255,0.8);box-shadow:0 1px 3px rgba(0,0,0,0.1)}var,span.var{font-size:80%;font-family:"Monaco","DejaVu Sans Mono","Courier New",monospace;font-weight:bold;font-style:normal}cite,span.cite{font-weight:bold;font-style:italic}q,span.q{font-style:italic;color:#666}tt,span.tt{font-family:"Monaco","DejaVu Sans Mono","Courier New",monospace;font-size:80%}.note{-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;margin:10px auto;padding:7px 7px 0 7px;box-shadow:0 1px 3px rgba(0,0,0,0.1);text-shadow:0 1px 0 rgba(255,255,255,0.8);color:#555;background-color:#efefef;border:1px solid #efefef}.note p{margin-top:0;margin-bottom:0}.note p:first-child{font-size:105%;font-style:italic;color:#333}.warning{border-top:2px solid #555;border-bottom:2px solid #555;background-color:#efefef;margin:10px auto;padding:7px 7px 0 7px}.warning p{margin-top:0;margin-bottom:0}.warning p:first-child{font-size:105%;font-weight:bold;color:#333}.sidebar{-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;margin:10px auto;padding:7px 7px 0 7px;box-shadow:0 1px 3px rgba(0,0,0,0.1);text-shadow:0 1px 0 rgba(255,255,255,0.8);color:#555;background-color:#efefef;border:1px solid #efefef}.sidebar p{margin-top:0;margin-bottom:0}.sidebar p:first-child{font-size:105%;font-weight:bold;color:#333}.note,.warning{width:66.6667%}@media screen and (max-width:599px){.note,.warning{width:96%}}@media screen and (min-width:600px){.note,.warning{width:66.6667%}}span.todo{font-weight:bold;color:#c30;text-decoration:underline;vertical-align:top}span.todo:before{font-variant:small-caps;font-size:120%;content:"todo"}span.fixme{font-weight:bold;color:#c30;text-decoration:underline;vertical-align:top}span.fixme:before{font-variant:small-caps;font-size:120%;content:"fixme"}.red-circle:before{font-style:normal;font-size:100%;color:#c30;content:"\25CF"}.green-circle:before{font-style:normal;font-size:100%;color:#0c3;content:"\25CF"}.yellow-circle:before{font-style:normal;font-size:100%;color:#f5b800;content:"\25CF"}.gray-circle:before{font-style:normal;font-size:100%;color:#999;content:"\25CF"}.star:before{font-style:normal;font-size:100%;color:#f5b800;content:"\2605"}.heart:before{font-style:normal;font-size:100%;color:#c30;content:"\2665"}.cross:before{font-style:normal;font-size:100%;color:#c30;content:"\2718 "}.check:before{font-style:normal;font-size:100%;color:#0c3;content:"\2714 "}
M hastyscribe.nimhastyscribe.nim

@@ -6,15 +6,22 @@

(c) 2013 Fabio Cevasco Usage: - hastyscribe markdown_file + hastyscribe markdown_file [--notoc] Arguments: - markdown_file the markdown file to compile into HTML.""" + markdown_file The markdown file to compile into HTML. + Options: + --notoc Do not generate a Table of Contents.""" # Procedures proc parse_date(date: string, timeinfo: var TTimeInfo): bool = - var parts = date.split('-').map(proc(i:string): int = i.parseInt) + var parts = date.split('-').map(proc(i:string): int = + try: + i.parseInt + except: + 0 + ) try: timeinfo = TTimeInfo(year: parts[0], month: TMonth(parts[1]-1), monthday: parts[2]) # Fix invalid dates (e.g. Feb 31st -> Mar 3rd)

@@ -35,16 +42,18 @@

### MAIN var input_file = "" +var generate_toc = true # Parse Parameters -var opt = initOptParser() - -opt.next - -if opt.kind == cmdArgument: - # Input file name - input_file = opt.key +for kind, key, val in getopt(): + case kind + of cmdArgument: + input_file = key + of cmdLongOption: + if key == "notoc": + generate_toc = false + else: nil if input_file == "": quit(usage, 1)

@@ -66,7 +75,6 @@ var metadata = TMDMetaData(title:"", author:"", date:"")

var body = source.md(MKD_DOTOC or MKD_EXTRA_FOOTNOTE, metadata) let css = src_css.style_tag - # Manage metadata if metadata.author != "": metadata.author = "by <em>" & metadata.author & "</em> &ndash;"

@@ -80,7 +88,7 @@ else:

title_tag = "" header_tag = "" -if metadata.toc != "": +if generate_toc == true and metadata.toc != "": toc = "<div id=\"toc\">" & metadata.toc & "</div>" else: toc = ""