Added release task & fixed date parsing Closes #13.
h3rald h3rald@h3rald.com
Thu, 07 Aug 2014 21:56:35 +0200
6 files changed,
38 insertions(+),
15 deletions(-)
M
.gitignore
→
.gitignore
@@ -4,4 +4,5 @@ libmarkdown.a
README.htm hastyscribe.exe hastyscribe -nakefile+nakefile +*.zip
M
doc/HastyScribe_UserGuide.htm
→
doc/HastyScribe_UserGuide.htm
@@ -1053,7 +1053,7 @@ </ul>
</div> <div id="footer"> - <p>Fabio Cevasco – August 2, 2014</p> + <p>Fabio Cevasco – August 7, 2014</p> <p><span>Powered by</span> <a href="https://h3rald.com/hastyscribe"><span class="hastyscribe"></span></a></p> </div> </body>
M
hastyscribe.babel
→
hastyscribe.babel
@@ -1,6 +1,6 @@
[Package] name = "hastyscribe" -version = "1.0.1" +version = "1.0.2" author = "Fabio Cevasco" description = "Self-contained markdown compiler generating self-contained HTML documents" license = "MIT"
M
hastyscribe.nim
→
hastyscribe.nim
@@ -1,7 +1,8 @@
import os, parseopt2, strutils, times, pegs, base64, markdown, tables -let v = "1.0.2" -let usage = " HastyScribe v" & v & " - Self-contained Markdown Compiler" & """ +from version import v + +let usage* = " HastyScribe v" & v & " - Self-contained Markdown Compiler" & """ (c) 2013-2014 Fabio Cevasco@@ -9,7 +10,7 @@ Usage:
hastyscribe markdown_file_or_glob.md [--notoc] Arguments: - markdown_file The markdown file to compile into HTML. + markdown_file_or_glob The markdown (or glob expression) file to compile into HTML. Options: --notoc Do not generate a Table of Contents."""@@ -34,6 +35,8 @@ i.parseInt
except: 0 ) + if parts.len < 3: + return false try: timeinfo = TTimeInfo(year: parts[0], month: TMonth(parts[1]-1), monthday: parts[2]) # Fix invalid dates (e.g. Feb 31st -> Mar 3rd)@@ -193,11 +196,8 @@
# Date parsing and validation var timeinfo: TTimeInfo = getLocalTime(getTime()) - if metadata.date == "": + if parse_date(metadata.date, timeinfo) == false: discard parse_date(getDateStr(), timeinfo) - else: - if parse_date(metadata.date, timeinfo) == false: - discard parse_date(getDateStr(), timeinfo) var document = """<!doctype html> <html lang="en">
M
nakefile.nim
→
nakefile.nim
@@ -1,17 +1,38 @@
import nake +from version import v const - compile = "nimrod c" + compile = "nimrod c -d:release" linux_x86 = "--cpu:i386 --os:linux" windows_x86 = "--cpu:i386 --os:windows" parallel = "--parallelBuild:1" - hs = "hastyscribe.nim" + hs = "hastyscribe" + hs_file = "hastyscribe.nim" + zip = "zip -X" + +proc filename_for(os: string, arch: string): string = + return "hastyscribe" & "_v" & v & "_" & os & "_" & arch & ".zip" task "windows-build", "Build HastyScribe for Windows (x86)": - direshell compile, windows_x86, hs + direshell compile, "--cpu:i386 --os:windows", hs_file task "linux-build", "Build HastyScribe for Linux (x86)": - direshell compile, linux_x86, hs + direshell compile, "--cpu:i386 --os:linux", hs_file task "macosx-build", "Build HastyScribe for Mac OS X (x86)": - direshell compile, hs + direshell compile, hs_file + +task "release", "Release HastyScribe": + echo "\n\n\n WINDOWS:\n\n" + runTask "windows-build" + direshell zip, filename_for("windows", "x86"), hs & ".exe" + direshell "rm", hs & ".exe" + echo "\n\n\n LINUX:\n\n" + runTask "linux-build" + direshell zip, filename_for("linux", "x86"), hs + direshell "rm", hs + echo "\n\n\n MAC OS X:\n\n" + runTask "macosx-build" + direshell zip, filename_for("macosx", "x86"), hs + direshell "rm", hs + echo "\n\n\n ALL DONE!"