Skip to content

Commit

Permalink
Merge pull request #311 from hsorby/target_cellml_org
Browse files Browse the repository at this point in the history
Switch for targeting cellml.org
  • Loading branch information
hsorby authored Jun 28, 2022
2 parents 4320ea4 + 2d4d1be commit 8f94934
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,15 @@ then run the command::
Now launch your internet browser and open the location::

http://localhost:8008/

Building the documentation for cellml.org
-----------------------------------------

The documentation required for cellml.org can be built from this repository.
The documenation can be built by setting the variable `target_cellml_org` to `True` in the `conf.py` file and then building the documentation with the single html builder.
With `target_cellml_org = True` saved in the `conf.py` file the command::

make singlehtml

will create a file `index.html` in the directory `build/singlehtml` relative to the root of the repository directory.
The contents of the `index.html` can be copied and pasted into cellml.org.
9 changes: 7 additions & 2 deletions src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@
date_today = datetime.datetime.today()

unofficial = True
target_cellml_org = False

if unofficial:
tags.add('unofficial')

if target_cellml_org:
tags.add('target_cellml_org')

build_type = os.environ['CELLML_SPEC_BUILD'] if 'CELLML_SPEC_BUILD' in os.environ else 'Normative'
if build_type not in ('Normative', 'Full'):
raise ValueError('Build type must be "Normative" or "Full".')
Expand Down Expand Up @@ -193,9 +197,9 @@ def define_excluded_patterns():
# built documents.
#
# The short X.Y version.
version = '2.0'
version = '2.1'
# The full version, including alpha/beta/rc tags.
release = '2.0'
release = '2.1'
if unofficial:
version += '-unofficial'
release += '-unofficial'
Expand Down Expand Up @@ -259,6 +263,7 @@ def define_excluded_patterns():
# Pass options through to the template
html_context = {
'unofficial': unofficial,
'target_cellml_org': target_cellml_org,
}

# Automagically convert all :ref: blocks to show a tooltip using the hoverxref
Expand Down
14 changes: 7 additions & 7 deletions src/static/templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if builder == "singlehtml" and not unofficial %}
{% if builder == "singlehtml" and target_cellml_org %}

<!DOCTYPE html>
<head>
Expand All @@ -18,11 +18,11 @@
{% else %}
{% extends "!layout.html" %}
{% if unofficial %}
{% block document %}
{{super()}}
<a href="https://cellml.org/specifications/cellml_2.0">
<img style="position: fixed; top: 0; right: 0; border: 0;" src="{{ pathto('_static/images/unofficial_version_dark_background_red.png', 1) }}" alt="unofficial version"/>
</a>
{% endblock %}
{% block document %}
{{super()}}
<a href="https://cellml.org/specifications/cellml_2.0">
<img style="position: fixed; top: 0; right: 0; border: 0;" src="{{ pathto('_static/images/unofficial_version_dark_background_red.png', 1) }}" alt="unofficial version"/>
</a>
{% endblock %}
{% endif %}
{% endif %}
8 changes: 6 additions & 2 deletions src/static/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

{% block body %}

<div class="cellml-spec">
{% if target_cellml_org %}
<div class="cellml-spec">
{% endif %}

{{ body }}

</div>
{% if target_cellml_org %}
</div>
{% endif %}

{% endblock %}

Expand Down

0 comments on commit 8f94934

Please sign in to comment.