Skip to content

Commit e346ca9

Browse files
committed
put tutorial template into web site
1 parent 291ed6e commit e346ca9

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

.github/workflows/builddocsite.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ jobs:
9393
done
9494
#git add ${dest}
9595
done
96+
mkdir ../help/tutorial_template
97+
cp tutorial.css ../help/tutorial_template
9698
fil=template.md
97-
outfile=template.html
99+
outfile=../help/tutorial_template/template.html
98100
echo "creating $outfile from $fil"
99101
pandoc --standalone --mathjax --css tutorial.css -o ${outfile} ${fil}
100102
sed -i "s/<figure>/<BR clear=all><figure>/g" ${outfile}

MDtutorials/README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
This directory contains files used to generate new GSAS-II tutorials. (The older tutorials were created using Microsoft Word to produce `.html` files directly.)
22
The tutorials are placed on the web at
3-
https://advancedphotonsource.github.io/GSAS-II-tutorials/<subdir> using two commands:
3+
https://advancedphotonsource.github.io/GSAS-II-tutorials/<subdir> using two commands to build the HTML:
44

55
pandoc --standalone --css tutorial.css --mathjax -o ${outfile} ${infil}
66
sed -i "s/<figure>/<BR clear=all><figure>/g" ${outfile}
77

8-
Note that on MacOS the sed command must be `sed -i "" "s/...`. The tutorial.css file is found in the MDtutorials directory and is copied to the same location as `$outfile`.
8+
Note that on MacOS the sed command must be `sed -i "" "s/...`. The [`tutorial.css` file](https://github.com/AdvancedPhotonSource/GSAS-II-tutorials/blob/main/MDtutorials/tutorial.css) is found in the `MDtutorials` directory and is copied to the same location as `$outfile`.
99

1010
# Steps in creating a new tutorial
1111

@@ -14,7 +14,9 @@ Note that on MacOS the sed command must be `sed -i "" "s/...`. The tutorial.css
1414
1515
1. Create a new directory in the current location. Make sure not to use a name already in use for an existing tutorial (in the main directory, (https://github.com/AdvancedPhotonSource/GSAS-II-tutorials/tree/main).
1616

17-
1. Create a &lt;filename&gt;.md file in the new directory. Name is arbitrary, but repeating the directory name is not a bad idea. Look at file `template.md` as an outline for formatting the tutorial. Start the file with content like this:
17+
1. Create a &lt;filename&gt;.md file in the new directory. Name is arbitrary, but repeating the directory name is not a bad idea, as `.../new-tutorial/new-tutorial.md`. Look at file `template.md` as an outline for formatting the tutorial ([formatted version is here](https://advancedphotonsource.github.io/GSAS-II-tutorials/tutorial_template/tutorial.html))
18+
19+
Start the new tutorial file with content like this:
1820

1921
---
2022
title: "Tutorial: ...anything you want to put here"
@@ -27,14 +29,19 @@ Note that on MacOS the sed command must be `sed -i "" "s/...`. The tutorial.css
2729
2830
## Intro
2931

30-
omit the "Exercise files..." line if no exercise files are in use. Note that the `.../data/index.html` file is generated automatically.
32+
omit the "Exercise files..." line if no exercise files are in use. Note that the `.../data/index.html` file is generated automatically.
3133

3234
1. Create a directory named `imgs` inside the new directory. Any images used in the tutorial go here.
3335

3436
1. (Optional) Create a directory named `data` inside the new directory. Any data files used in the tutorial go here.
3537

3638
1. Edit the file `tutorialIndex.py` (in the main GSAS-II repo) to include the new tutorial. Note that the first item in the list will be the directory name chosen in the first step, above. The second item will be the name of the generated `.html` file which will be based on the name of the `.md` file chosen in the second step. The remaining entries are the title of the tutorial and a synopsis.
3739

40+
41+
Editing of MarkDown can be done with any text editor, but it is sometimes nice to see the final result before committing the file. One can use the `pandoc` command above to see the result, or use VS Code, which has a MarkDown viewer. There are also lots of programs that can be used as MarkDown editors: https://github.com/mundimark/awesome-markdown-editors/blob/master/README.md
42+
but I have not tried any of them.
43+
44+
3845
TODO: someday, I'd like to have keywords associated with tutorials and a search mechanism to make it easier to find some of the "little things" (for example constraint definition) that are shown in them.
3946

4047

0 commit comments

Comments
 (0)