Skip to content

Commit

Permalink
4.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
haghish committed Jun 8, 2019
1 parent ffdc217 commit 597f5ad
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 10 deletions.
44 changes: 42 additions & 2 deletions markdoc.ado
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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")) {

Expand Down Expand Up @@ -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
}



Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
5 changes: 5 additions & 0 deletions markup.ado
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
20 changes: 15 additions & 5 deletions mini.ado
Original file line number Diff line number Diff line change
Expand Up @@ -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
------
Expand All @@ -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)
Expand Down
17 changes: 14 additions & 3 deletions mini.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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)
Expand Down

0 comments on commit 597f5ad

Please sign in to comment.