From 15995e10bfc68edf79970c4ea4fbb6678566c46e Mon Sep 17 00:00:00 2001
From: Mojca Miklavec <mojca.miklavec@gmail.com>
Date: Mon, 14 May 2012 17:38:55 +0000
Subject: ConTeXt 2012.05.14 16:00

git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/context/base/mtx-context-markdown.tex      | 92 ++++++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 Master/texmf-dist/tex/context/base/mtx-context-markdown.tex

(limited to 'Master/texmf-dist/tex/context/base/mtx-context-markdown.tex')

diff --git a/Master/texmf-dist/tex/context/base/mtx-context-markdown.tex b/Master/texmf-dist/tex/context/base/mtx-context-markdown.tex
new file mode 100644
index 00000000000..1bd57945f21
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mtx-context-markdown.tex
@@ -0,0 +1,92 @@
+%D \module
+%D   [       file=mtx-context-markdown,
+%D        version=2011.07.24,
+%D          title=\CONTEXT\ Extra Trickry,
+%D       subtitle=Rendering Markdown Files,
+%D         author=Hans Hagen,
+%D           date=\currentdate,
+%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% begin help
+%
+% usage: context --extra=markdown [options] list-of-files
+%
+% --sort                   : sort filenames first
+% --paperoffset=dimension  : left-top-offset
+% --duplex                 : doublesided (singlesided is default)
+% --backspace=dimension    : extra left offset
+% --topspace=dimension     : extra top offset
+% --bodyfont=specification : additional bodyfont specification
+% --contents               : add table of contents
+%
+% end help
+
+\usemodule[markdown]
+
+\doifdocumentargument {paperoffset} {
+    \definepapersize
+      [offset=\getdocumentargument{paperoffset}]
+}
+
+\doifdocumentargument{duplex} {
+    \setuppagenumbering
+      [alternative=doublesided]
+} {
+    \setuppagenumbering
+      [alternative=singlesided]
+}
+
+\setdocumentargumentdefault {textwidth} {middle}
+\setdocumentargumentdefault {backspace} {2cm}
+\setdocumentargumentdefault {topspace}  {2cm}
+\setdocumentargumentdefault {bodyfont}  {}
+
+\setuptolerance
+  [verytolerant,stretch]
+
+\setuplayout
+  [width=middle,
+   height=middle,
+   backspace=\getdocumentargument{backspace},
+   topspace=\getdocumentargument{topspace},
+   footer=0pt]
+
+\setupbodyfont
+  [dejavu,10pt,\getdocumentargument{bodyfont}]
+
+\setupwhitespace
+  [big]
+
+% \enabletrackers[context.trace]
+
+\setuplist
+  [chapter,section,subsection]
+  [aligntitle=yes,
+   width=4em]
+
+\starttext
+
+\doifdocumentargument{contents} {
+    \starttitle[title={Table of contents}]
+        \placelist[chapter,section,subsection] % todo: levels
+    \stoptitle
+}
+
+
+\startluacode
+    if #document.files > 0 then
+        if document.arguments.sort then
+            table.sort(document.files)
+        end
+        for i=1,#document.files do
+            context.processmarkdownfile(document.files[i])
+            context.page()
+        end
+    end
+\stopluacode
+
+\stoptext
-- 
cgit v1.2.3

