diff --git a/Examples/example.html b/Examples/example.html new file mode 100644 index 0000000..1c320b6 --- /dev/null +++ b/Examples/example.html @@ -0,0 +1,356 @@ + + +
+ + + + + + + + + + . local a 1
+
+ . scalar b = 2
+
+ . local c "HI"
+
+ . scalar d = "World"
+
+ . sysuse auto, clear
+ (1978 Automobile Data)
+
+ . summarize price
+
+ Variable | Obs Mean Std. Dev. Min Max
+ -------------+---------------------------------------------------------
+ price | 74 6165.257 2949.496 3291 15906
+
+ . di "and this?"
+ and this?
+to read the documentation, visit The GitHub Repository
+ + diff --git a/Examples/example.smcl b/Examples/example.smcl new file mode 100644 index 0000000..9646514 --- /dev/null +++ b/Examples/example.smcl @@ -0,0 +1,50 @@ +{smcl} +{com}{sf}{ul off}{txt} +{com}. +. /*** +> MarkDoc: A literate programming package for Stata +> ================================================= +> +> ***/ +. +. +. local a 1 +{txt} +{com}. scalar b = 2 +{txt} +{com}. local c "HI" +{txt} +{com}. scalar d = "World" +{txt} +{com}. sysuse auto, clear +{txt}(1978 Automobile Data) + +{com}. summarize price + +{txt} Variable {c |} Obs Mean Std. Dev. Min Max +{hline 13}{c +}{hline 57} +{space 7}price {c |}{res} 74 6165.257 2949.496 3291 15906 +{txt} +{com}. di "and this?" +{res}and this? +{txt} +{com}. +. /*** +> Header one +> ========== +> +> Header 2 +> -------- +> +> ### Header 3 and also +> +> #### Header 4 here +> +> to read the documentation, visit +> [The GitHub Repository](http://github.com/haghish/markdoc) +> +> ***/ +. +. qui log c +{smcl} +{com}{sf}{ul off} \ No newline at end of file diff --git a/Examples/styles/example.pdf b/Examples/styles/example.pdf new file mode 100644 index 0000000..f9bf10c Binary files /dev/null and b/Examples/styles/example.pdf differ diff --git a/markdoc.ado b/markdoc.ado index 6077933..ac46589 100755 --- a/markdoc.ado +++ b/markdoc.ado @@ -973,7 +973,7 @@ program markdoc // specified for each output format. The available styles are "simple" // and "stata." The default style is "simple" // ========================================================================= - if "`style'" == "" local style "simple" + if "`style'" == "" local style "stata" //??? CHANGE IT if "`export'" == "pdf" & "`style'" == "" local style "stata" // CHECK FOR REQUIRED SOFTWARE @@ -1414,11 +1414,9 @@ program markdoc // replacing the "dots" with "{com}. " // ================================================================= if substr(`"`macval(line)'"',1,1) == "." & `"`macval(line)'"' > "." { - local h : di substr(`"`macval(line)'"',2,.) - local line `"{com}. `macval(h)'"' + local line : subinstr local line "." "{com}." } - // ----------------------------------------------------------------- // LOOP CORRECTION // ================================================================= @@ -3073,8 +3071,8 @@ program markdoc if !missing("`noisily'") { di _n(2) "{title:Print the HTML to PDF}" _n /// "$setpath --footer-center [page] " /// - " --footer-font-size 10 --margin-right 30mm " /// - "--margin-left 30mm --margin-top 35mm " /// + " --footer-font-size 10 --margin-right 15mm " /// + "--margin-left 15mm --margin-top 35mm " /// "--no-stop-slow-scripts --javascript-delay 2000 " /// "--enable-javascript `toc' --debug-javascript " /// ///"`in'.html `output'" @@ -3085,8 +3083,8 @@ program markdoc `quietly' shell "$setpath" /// --footer-center [page] --footer-font-size 10 /// - --margin-right 30mm /// - --margin-left 30mm /// + --margin-right 15mm /// + --margin-left 15mm /// --margin-top 35mm /// --no-stop-slow-scripts --javascript-delay 2000 /// --enable-javascript /// @@ -3112,8 +3110,8 @@ program markdoc if !missing("`noisily'") { di _n(2) "{title:Print the HTML to PDF}" _n /// "$setpath --footer-center \[page\] " /// - " --footer-font-size 10 --margin-right 30mm " /// - "--margin-left 30mm --margin-top 35mm " /// + " --footer-font-size 10 --margin-right 15mm " /// + "--margin-left 15mm --margin-top 35mm " /// "--no-stop-slow-scripts --javascript-delay 2000 " /// "--enable-javascript `toc' --debug-javascript " /// `"`html' `convert'"' @@ -3123,8 +3121,8 @@ program markdoc `quietly' shell "$setpath" /// --footer-center \[page\] --footer-font-size 10 /// - --margin-right 30mm /// - --margin-left 30mm /// + --margin-right 15mm /// + --margin-left 15mm /// --margin-top 35mm /// --no-stop-slow-scripts --javascript-delay 2000 /// --enable-javascript /// @@ -3150,8 +3148,8 @@ program markdoc if !missing("`noisily'") { di _n(2) "{title:Print the HTML to PDF}" _n /// "$setpath --footer-center \[page\] " /// - " --footer-font-size 10 --margin-right 30mm " /// - "--margin-left 30mm --margin-top 35mm " /// + " --footer-font-size 10 --margin-right 15mm " /// + "--margin-left 15mm --margin-top 35mm " /// "--no-stop-slow-scripts --javascript-delay 3000 " /// "--enable-javascript `toc' --debug-javascript " /// `"`html'" "`convert'"' @@ -3161,8 +3159,8 @@ program markdoc `quietly' shell "$setpath" /// --footer-center \[page\] --footer-font-size 10 /// - --margin-right 30mm /// - --margin-left 30mm /// + --margin-right 15mm /// + --margin-left 15mm /// --margin-top 35mm /// --no-stop-slow-scripts --javascript-delay 3000 /// --enable-javascript /// diff --git a/markdocstyle.ado b/markdocstyle.ado index d09a4af..10d1fe8 100644 --- a/markdocstyle.ado +++ b/markdocstyle.ado @@ -254,7 +254,7 @@ syntax [anything] , export(str) tmp(str) tmp1(str) [master] [markup(str)] /// qui cap file open `knot' using "`tmp1'", write replace - if !missing("`master'") | "`markup'" == "" | "`markup'" == "markdown" { + if !missing("`master'") & "`markup'" == "" | !missing("`master'") & "`markup'" == "markdown" { file write `knot' "" _n /// "" _n /// "" _n /// @@ -276,7 +276,25 @@ syntax [anything] , export(str) tmp(str) tmp1(str) [master] [markup(str)] /// file write `knot' _n "" _n(2) /// `"" _n(4) - + + + // Stata (DEFAULT) STYLE //====================== if "`style'" == "stata" { file write `knot' _n(2) "" _newline(2) /// `"" _newline(4) } - + if !missing("`statax'") { file write `knot' `""' _n } + if !missing("`template'") { file write `knot' `""' _n } + file write `knot' "" _n /// *writing the header