-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
101 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,11 @@ SUPPORT: [email protected] | |
HELP: After installation, type | ||
|
||
. help stmd2dyn | ||
. help stmd2html | ||
. help stmd | ||
|
||
FILES: | ||
|
||
stmd.ado | ||
stmd.sthlp | ||
stmd2dyn.ado | ||
stmd2dyn.sthlp | ||
stmd2html.ado | ||
stmd2html.sthlp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
capture mata: mata drop _dd_do() | ||
mata: string colvector function _dd_do(real matrix fenceinfo, real matrix tagmatch) { | ||
dotags = J(rows(fenceinfo),1,"") | ||
for (i=1; i<=rows(fenceinfo); i++) { | ||
if (fenceinfo[i,2]==1) { | ||
if (sum(tagmatch[i,.])==0) dotags[i,1]=("<<dd_do>>") | ||
else if (tagmatch[i,3]==1) { | ||
if (tagmatch[i,4]==0) dotags[i,1]=("<<dd_do: nocommands>>") | ||
else if (tagmatch[i,4]==1) dotags[i,1]=("<<dd_do: quietly>>") | ||
} | ||
else if (tagmatch[i,3]==0 & tagmatch[i,4]==1) dotags[i,1]=("<<dd_do: nooutput>>") | ||
else if (tagmatch[i,5]==1) dotags[i,1]=("<<dd_do: noprompt>>") | ||
} | ||
else if (fenceinfo[i,2]==-1) dotags[i,1]=("<</dd_do>>") | ||
else dotags[i,1]=("") | ||
} | ||
return(dotags) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
capture mata: mata drop _fence_info() | ||
mata: | ||
real matrix function _fence_info(string colvector X) { | ||
codefence = "^( ? ? ?)(```+|~~~+)([ ]*)$" | ||
infofence = "^( ? ? ?)(```+|~~~+)\{?s(tata)?\/?(,.*)?\}?$" | ||
fence = ustrregexm(X, codefence) | ||
codebegin = ustrregexm(X, infofence) | ||
fence = fence + codebegin | ||
prespace = J(rows(X),1,.) | ||
cbdepth = J(rows(X),1,0) | ||
fencel = J(rows(X),7,.) | ||
doblock = 0 | ||
//cbflen = 0 | ||
for (i=1; i<=rows(X); i++) { | ||
// check out the fence | ||
if (i>=2) { | ||
cbdepth[i]=cbdepth[i-1] | ||
fencel[i,.]=fencel[i-1,.] | ||
} | ||
if (ustrregexm(X[i,1], infofence) | ustrregexm(X[i,1], codefence)) { | ||
//X[i,1] | ||
if (ustrregexm(X[i,1], infofence)) { | ||
prespace[i] = ustrlen(ustrregexs(1)) | ||
fl = ustrlen(ustrregexs(2)) | ||
} | ||
else if (ustrregexm(X[i,1], codefence)) { | ||
prespace[i] = ustrlen(ustrregexs(1)) | ||
fl = ustrlen(ustrregexs(2)) | ||
} | ||
//fl | ||
// doable? | ||
if (cbdepth[i]==0 & ustrregexm(X[i,1], infofence)) { | ||
cbdepth[i]=cbdepth[i]+1 | ||
fencel[i, cbdepth[i]] = fl | ||
codebegin[i] = 1 // redundant | ||
doblock = 1 | ||
//cbflen = fencel[i] | ||
} | ||
// not doable: deeper? | ||
else if (ustrregexm(X[i,1], infofence) | cbdepth[i]==0) { | ||
cbdepth[i]=cbdepth[i]+1 | ||
fencel[i, cbdepth[i]] = fl | ||
codebegin[i] = 0 // redundant | ||
} | ||
// also deeper | ||
else if (fl < fencel[i, cbdepth[i]]) { | ||
cbdepth[i]=cbdepth[i]+1 | ||
fencel[i, cbdepth[i]] = fl | ||
} | ||
else { | ||
fencel[i, cbdepth[i]] = . | ||
cbdepth[i] = cbdepth[i]-1 | ||
} | ||
// is this the end of doable? | ||
if (cbdepth[i]==0 & doblock) { | ||
codebegin[i] = -1 | ||
doblock=0 | ||
} | ||
} | ||
//X[i,1] | ||
} | ||
return(fence,codebegin,cbdepth,prespace,fencel) | ||
} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
* Check for previous installation | ||
ado dir stmd | ||
ado uninstall stmd | ||
* If there are more than one previous installation, | ||
* you have to remove them by [number] rather than name | ||
|
||
* The actual installation | ||
net from https://www.ssc.wisc.edu/~hemken/Stataworkshops/ | ||
net install stmd, replace | ||
|
||
* Check | ||
which stmd | ||
which stmd2dyn |
This file was deleted.
Oops, something went wrong.