Skip to content

Commit

Permalink
Added the create_tutorials_html.py to the Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
rum1887 committed Jun 13, 2023
1 parent 4a63a13 commit 51aec10
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ help:
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

create_tutorials:
python3 source/tutorials-website/create_tutorials_html.py

# Modify the html target to include create_tutorials as a prerequisite
html: create_tutorials
@$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) "$(SOURCEDIR)" "$(BUILDDIR)/html"
12 changes: 6 additions & 6 deletions doc/source/tutorials-website/create_tutorials_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def generate_index_html(version_directory, tutorial_directories, title, version_
title = 'Tutorials for QuTiP Version 4'
version_note = 'These are the tutorials for QuTiP Version 4. You can find the tutorials for QuTiP Version 5 <a href="./index-v5.html">here</a>.'
html = generate_index_html(os.path.join(cloned_repo_dir, 'tutorials-v4/'), tutorial_directories, title, version_note)
with open('qutip-qip.html', 'w+') as f:
with open('source/tutorials-website/qutip-qip.html', 'w+') as f:
#f.write(prefix)
f.write(html)
#f.write(suffix)
Expand All @@ -110,7 +110,7 @@ def generate_index_html(version_directory, tutorial_directories, title, version_
title = 'Tutorials for QuTiP Version 5'
version_note = 'These are the tutorials for QuTiP Version 5. You can find the tutorials for QuTiP Version 4 <a href="./index.html">here</a>.'
html = generate_index_html(os.path.join(cloned_repo_dir, 'tutorials-v5/'), tutorial_directories, title, version_note)
with open('qutip-qip-v5.html', 'w+') as f:
with open('source/tutorials-website/qutip-qip-v5.html', 'w+') as f:
#f.write(prefix)
f.write(html)
#f.write(suffix)
Expand All @@ -122,11 +122,11 @@ def convert_html_to_rst(html_file_path, rst_file_path):
# Use the subprocess module to call the pandoc command-line tool
subprocess.run(['pandoc', html_file_path, '-o', rst_file_path])

html_file_path = 'qutip-qip.html'
html_file_path_v5 = 'qutip-qip-v5.html'
html_file_path = 'source/tutorials-website/qutip-qip.html'
html_file_path_v5 = 'source/tutorials-website/qutip-qip-v5.html'

rst_file_path = '../tutorials.rst'
rst_file_path_v5 = '../tutorials_v5.rst'
rst_file_path = 'source/tutorials.rst'
rst_file_path_v5 = 'source/tutorials_v5.rst'

#convert_html_to_rst(html_file_path, rst_file_path)
convert_html_to_rst(html_file_path_v5, rst_file_path_v5)
Expand Down
2 changes: 1 addition & 1 deletion doc/source/tutorials-website/tutorials.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>

<h4 id="quantum-information-processing">Quantum information processing</h4>
<p>This section contains tutorials for QuTiP Version 4. You can find the tutorials for QuTiP Version 5 here.
<p>This section contains tutorials for QuTiP Version 5. You can find the tutorials for QuTiP Version 4 here.
</p>

<h5 id="qip-circuits">Quantum circuits and algorithms</h5>
Expand Down

0 comments on commit 51aec10

Please sign in to comment.