diff --git a/markdoc.ado b/markdoc.ado index 91de91a..599937a 100755 --- a/markdoc.ado +++ b/markdoc.ado @@ -1031,6 +1031,7 @@ program markdoc if (index(lower("`input'"),".smcl")) { local input : subinstr local input ".smcl" "" + local extension smcl if "`export'" == "slidehtm" { local convert "`input'.htm" @@ -1057,6 +1058,7 @@ program markdoc } else if (index(lower("`input'"),".ado")) { local input : subinstr local input ".ado" "" + local extension ado *if "`export'" == "slide" local convert "`input'.pdf" *else if "`export'" == "dzslide" local convert "`input'.html" *else if "`export'" == "slidy" local convert "`input'.html" @@ -1087,6 +1089,7 @@ program markdoc } else if (index(lower("`input'"),".mata")) { local input : subinstr local input ".mata" "" + local extension mata if "`export'" == "slidehtm" { local convert "`input'.htm" local output "`output'.htm" @@ -1104,6 +1107,7 @@ program markdoc } else if (index(lower("`input'"),".do")) { local input : subinstr local input ".do" "" + local extension do if "`export'" == "slidehtm" { local convert "`input'.htm" @@ -1130,9 +1134,36 @@ program markdoc local input "`input'.do" *local scriptfile 1 //define a scriptfile local rundoc 1 //run rundoc + global rundoc "`input'" //allow rundoc get nested in the file + } + else if (index(lower("`input'"),".md")) { + local extension md + local input : subinstr local input ".md" "" + + if "`export'" == "slidehtm" { + local convert "`input'.htm" + local output "`output'.htm" + } + else if "`export'" == "slide" { + local convert "`input'.pdf" + local output "`output'.pdf" + } + else if "`export'" == "dzslide" | "`export'" == "slidy" { + local convert "`input'.html" + local output "`output'.html" + } + else { + local convert "`input'.`export'" + local output "`output'.`export'" + } + + local md "`input'_.md" + local html "`input'_.html" + local pdf "`input'.pdf" + local name "`input'" + local input "`input'.md" + local scriptfile 1 //define a scriptfile - //allow rundoc get nested in the file - global rundoc "`input'" } else if (!index(lower("`input'"),".smcl")) { @@ -2666,6 +2697,13 @@ program markdoc if !missing("`debug'") { copy "`tmp1'" 0process5.txt , replace } + + + // If a Markdown file was given, replace the processed file + // ----------------------------------------------------------------- + if "`extension'" == "md" { + quietly copy "`input'" "`tmp1'" , replace public + } @@ -3348,6 +3386,7 @@ program markdoc if _rc == 0 { di as txt "(markdoc created "`"{bf:{browse "`convert'"}})"' _n if "`export'" != "md" cap qui erase "`md'" + if "`extension'" == "md" cap qui erase "`md'" } else display as err "markdoc could not produce `convert'" _n } @@ -3585,6 +3624,7 @@ program markdoc if _rc == 0 { di as txt "(markdoc created "`"{bf:{browse "`convert'"}})"' _n if "`export'" != "md" cap qui erase "`md'" + if "`extension'" == "md" cap qui erase "`md'" } else display as err "markdoc could not produce `convert'" _n } diff --git a/markup.ado b/markup.ado index 31912bd..c4b8d8d 100644 --- a/markup.ado +++ b/markup.ado @@ -75,6 +75,11 @@ program define markup local convert "`name'.`export'" local extension do } + else if (index(lower("`input'"),".md")) { + local name : subinstr local input ".md" "" + local convert "`name'.`export'" + local extension md + } // assume it's an ADO file capture confirm file "`script'.ado" diff --git a/mini.ado b/mini.ado index 6f825a5..b4a7782 100644 --- a/mini.ado +++ b/mini.ado @@ -7,8 +7,8 @@ _version 4.8_ mini ===== -__mini__ is a simplified command to call __markdoc__ in light-weight _mini_ mode, -without requiring any dependencies +__mini__ is a simplified command to call the _mini_ engine from the __markdoc__ +package Syntax ------ @@ -20,13 +20,23 @@ where _options_ are identical to the [markdoc](help markdoc) options Description ----------- -__mini__ is just a wrapper for __markdoc__ with the _mini_ option to run -__markdoc__ independent of any third-party dependencies. +__mini__ is a simplified command to call the light-weight _mini_ engine forom +the __markdoc__ command. it can be called to convert a Markdown file to any +file format supported by the mini engine (html, docx, pdf, sthlp, slide). the +command also can execute a do-file to produce a dynamic document. Examples -------- -execute a do-file and produce a word, pdf, and html files +convert a Markdown file to a word, pdf, html, sthlp, and slides files + + . mini "filename.md" , export(docx) + . mini "filename.md" , export(pdf) + . mini "filename.md" , export(html) + . mini "filename.md" , export(sthlp) + . mini "filename.md" , export(slide) + +execute a do-file and produce a word, pdf, and html files... . mini "filename.do" , export(docx) . mini "filename.do" , export(pdf) diff --git a/mini.sthlp b/mini.sthlp index 5586af8..0af0e97 100644 --- a/mini.sthlp +++ b/mini.sthlp @@ -5,8 +5,10 @@ {title:mini} {p 4 4 2} -{bf:mini} is a simplified command to call {bf:markdoc} in light-weight {it:mini} mode, -without requiring any dependencies +{bf:mini} is a simplified command to call the {it:mini} engine from the {bf:markdoc} +package to convert a Markdown file to any file format supported by the +mini engine (html, docx, pdf, sthlp, slide). the command also can execute a +do-file to produce a dynamic document. {title:Syntax} @@ -27,7 +29,16 @@ where {it:options} are identical to the {browse "help markdoc":markdoc} options {title:Examples} {p 4 4 2} -execute a do-file and produce a word, pdf, and html files +convert a Markdown file to a word, pdf, html, sthlp, and slides files + + . mini "filename.md" , export(docx) + . mini "filename.md" , export(pdf) + . mini "filename.md" , export(html) + . mini "filename.md" , export(sthlp) + . mini "filename.md" , export(slide) + +{p 4 4 2} +execute a do-file and produce a word, pdf, and html files... . mini "filename.do" , export(docx) . mini "filename.do" , export(pdf)