Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
briantoby committed Apr 10, 2024
1 parent de411a9 commit ef81024
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/tutorials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,30 @@ jobs:

- name: Checkout
uses: actions/checkout@v4

- name: Get tutorials index
run: |
curl -L https://github.com/AdvancedPhotonSource/GSAS-II/raw/master/GSASII/tutorialIndex.py -o scripts/tutorialIndex.py
ls -lt scripts
pwd
- name: save old tutorials index
run: |
cp tutorials.html tutorials.html.original
git status
- name: build tutorials index
run: |
cd scripts
python makeGitTutorial.py ..
- name: see what has been done
- name: see changes
run: |
git status
diff ../tutorials.html ../tutorials.html.original
- name: prepare to push changes back
run: |
cd ..
git add tutorials.html
git add */index.html
git status
diff tutorials.html tutorials.html.original
9 changes: 6 additions & 3 deletions scripts/makeGitTutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
how to retrieve this automatically any more.
'''
def makeDataIndex(datadir,title):
'''Create an index.html file in the specified directory, listing the contents
'''Create an index.html file in the specified directory,
with a URL for each file in the directory. This is run on
every <tutorial>/data directory to provide web browser access to
the contents since GitHub does not offer allow directory views
'''
fp = open(os.path.join(datadir,'tutorials.html'),'w')
fp = open(os.path.join(datadir,'index.html'),'w')
fp.write(f'''<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html> <head>
<title>Data: {title}</title>
Expand Down Expand Up @@ -87,7 +90,7 @@ def makeDataIndex(datadir,title):

tutURL = '' # URL of Tutorials directories, either absolute
# or relative to the page being created here
outname = os.path.join(TutorialsDir,'index.html')
outname = os.path.join(TutorialsDir,'tutorials.html')

dirList = [l[0] for l in G2G.tutorialIndex if len(l) >= 3]

Expand Down

0 comments on commit ef81024

Please sign in to comment.