Skip to content

Commit

Permalink
remove <body> from help-file for boilerplates
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenteaches committed May 10, 2024
1 parent 3ad492e commit 5029308
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 46 deletions.
10 changes: 6 additions & 4 deletions bench/mp_test1.mpb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<header>
<head>
<mkproject> boilerplate
<reqs> Stata 18
<reqs> smclpres
</header>
<version> 2.1.0
</head>
<body>
foo
</body>
3 changes: 0 additions & 3 deletions bench/mp_test2.mpb
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
<header>
<mkproject> boilerplate
</header>
Binary file modified lmkproject.mlib
Binary file not shown.
1 change: 1 addition & 0 deletions mkproject_main.mata
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class mpcreate extends mkproject {
void write_help()
void write_help_p()
void write_help_b()
void copy_b_help()
void write_help_header()
void write_help_footer()
void write_help_p_body()
Expand Down
31 changes: 25 additions & 6 deletions mkproject_mpcreate.mata
Original file line number Diff line number Diff line change
Expand Up @@ -285,22 +285,41 @@ void mpcreate::write_help_b(string scalar fn_in, string scalar templ, real scala
mpfclose(reading.fh)
}
void mpcreate::write_help_b_body(real scalar fh)
void mpcreate::copy_b_help(real scalar fh)
{
string scalar line, EOF
real scalar tocopy, old
string scalar line, EOF, first
EOF = J(0,0,"")
old = lt(reading.fversion,(2,1,0))
tocopy = old
while ((line=mpfget())!= EOF) {
first = ""
if (old == 0 & line != "") {
first = tokens(line)[1]
}
if (first == "</body>") {
break
}
if (tocopy) {
mpfput(fh, " " + line)
}
if (first == "<body>") {
tocopy = 1
}
}
}
void mpcreate::write_help_b_body(real scalar fh)
{
mpfput(fh, "{title:Boilerplate}")
mpfput(fh, "")
mpfput(fh, "{pstd}")
mpfput(fh, "This template creates a .do file with the following content: ")
mpfput(fh, "")
mpfput(fh, "{cmd}")
while ((line=mpfget())!= EOF) {
mpfput(fh, " " + line)
}
copy_b_help(fh)
mpfput(fh, "{txt}")
mpfput(fh,"")
mpfput(fh, "{title:Tags}")
Expand Down
3 changes: 0 additions & 3 deletions mp_b_ana.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ was previously cleaned by another .do file.
This template creates a .do file with the following content:

{cmd}

<body> -------------------------------------------------------------------------
capture log close
log using <stub>.txt, replace text

Expand All @@ -41,7 +39,6 @@ This template creates a .do file with the following content:

log close
exit
</body> ------------------------------------------------------------------------
{txt}

{title:Tags}
Expand Down
3 changes: 0 additions & 3 deletions mp_b_dta.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ This is a template for a .do file that cleans the data.
This template creates a .do file with the following content:

{cmd}

<body> -------------------------------------------------------------------------
capture log close
log using <stub>.txt, replace text

Expand Down Expand Up @@ -50,7 +48,6 @@ This template creates a .do file with the following content:

log close
exit
</body> ------------------------------------------------------------------------
{txt}

{title:Tags}
Expand Down
3 changes: 0 additions & 3 deletions mp_b_dta_c.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ a project a student might do for a course.
This template creates a .do file with the following content:

{cmd}

<body> -------------------------------------------------------------------------
capture log close
log using <stub>.txt, replace text

Expand Down Expand Up @@ -51,7 +49,6 @@ This template creates a .do file with the following content:

log close
exit
</body> ------------------------------------------------------------------------
{txt}

{title:Tags}
Expand Down
3 changes: 0 additions & 3 deletions mp_b_excer.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ exercise in a course.
This template creates a .do file with the following content:

{cmd}

<body> -------------------------------------------------------------------------
cd "<basedir>"
capture log close
log using <stub>.txt, replace text
Expand Down Expand Up @@ -53,7 +51,6 @@ This template creates a .do file with the following content:

log close
exit
</body> ------------------------------------------------------------------------
{txt}

{title:Tags}
Expand Down
3 changes: 0 additions & 3 deletions mp_b_ignore.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ individual level data on a place like github.
This template creates a .do file with the following content:

{cmd}

<body> -------------------------------------------------------------------------
data/
*.dta
*.csv
</body> ------------------------------------------------------------------------
{txt}

{title:Tags}
Expand Down
3 changes: 0 additions & 3 deletions mp_b_main.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ computer, you only have to change the {cmd:cd} command in this file and it will
This template creates a .do file with the following content:

{cmd}

<body> -------------------------------------------------------------------------
version <stata_version>
clear all
macro drop _all
Expand All @@ -38,7 +36,6 @@ This template creates a .do file with the following content:
do <abbrev>_ana01.do // some comment

exit
</body> ------------------------------------------------------------------------
{txt}

{title:Tags}
Expand Down
3 changes: 0 additions & 3 deletions mp_b_readme.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ on github to introduce your project to people visiting your project page.
This template creates a .do file with the following content:

{cmd}

<body> -------------------------------------------------------------------------
# Title

*Author*
Expand All @@ -48,7 +46,6 @@ This template creates a .do file with the following content:
3. Obtain the raw data files [name1, name2, ...] from https://doi.org/######### and save those in the directory `data`
4. In ana/main.do change line 5 (`cd ..."`) to where your directory is
5. run main.do
</body> ------------------------------------------------------------------------
{txt}
{title:Tags}
Expand Down
3 changes: 0 additions & 3 deletions mp_b_readme_sp.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ how to use your presentation.
This template creates a .do file with the following content:

{cmd}

<body> -------------------------------------------------------------------------
Readme
======

Expand Down Expand Up @@ -55,7 +53,6 @@ This template creates a .do file with the following content:
o use -cd- to change to this directory
o make the presentation by typing
-smclpres using presentation.do , dir(../presentation) replace-
</body> ------------------------------------------------------------------------
{txt}

{title:Tags}
Expand Down
3 changes: 0 additions & 3 deletions mp_b_rlog.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ and why.
This template creates a .do file with the following content:

{cmd}

<body> -------------------------------------------------------------------------
# Research log: [project name]

## <date>: Preliminaries
Expand Down Expand Up @@ -54,7 +52,6 @@ This template creates a .do file with the following content:
### Intended Journal

journal, requirements, e.g. max word count
</body> ------------------------------------------------------------------------
{txt}

{title:Tags}
Expand Down
3 changes: 0 additions & 3 deletions mp_b_rlogc.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ course. Here you keep track of what you are doing and why.
This template creates a .do file with the following content:

{cmd}

<body> -------------------------------------------------------------------------
# Research log: [project name]

## <date>: Preliminaries
Expand All @@ -49,7 +47,6 @@ This template creates a .do file with the following content:

- deadline:
- max word count:
</body> ------------------------------------------------------------------------
{txt}

{title:Tags}
Expand Down
3 changes: 0 additions & 3 deletions mp_b_smclpres.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ This template starts a {help smclpres} presentation.
This template creates a .do file with the following content:

{cmd}

<body> -------------------------------------------------------------------------
//version 4.0.2

//layout toc title(subsection) link(subsection)
Expand All @@ -45,7 +43,6 @@ This template creates a .do file with the following content:
//ex
//endex
//endslide ------------------------------------------------------------------------
</body> ------------------------------------------------------------------------
{txt}

{title:Tags}
Expand Down

0 comments on commit 5029308

Please sign in to comment.