Skip to content

Commit

Permalink
Adjust page layout to changes in plasTeX
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickMassot committed Mar 15, 2021
1 parent e8e7599 commit a839d37
Show file tree
Hide file tree
Showing 2 changed files with 176 additions and 16 deletions.
32 changes: 16 additions & 16 deletions leanblueprint/Packages/renderer_templates/default-layout.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,22 @@
</head>

<body>
{% if links.document.title or toc %}
<header>
{% if toc %}{{ icon('list-numbered', id='toc-toggle')}}{% endif %}
<h1 id="doc_title"><a href="{{ links.home.url }}">{{ links.document.title }}</a></h1>
</header>
{% endif %}

<div class="wrapper">
{% if toc %}
<nav class="toc">
{{ icon('cross', class='close-toc') }}
<ul class="sub-toc-0">
{% for section in toc recursive %}
<li class="{{ isActive(section) }}{{ isCurrent(section) }}">
{% if section.tableofcontents %}
<a href="{{ section.url }}">{{ tocEntry(section) }}</a>
{% if isActive(section) %}{{ icon('cross', class='expand-toc') }}{% else %}{{ icon('plus', class='expand-toc') }}{% endif %}
<span class="expand-toc">{% if isActive(section) %}{% else %}{% endif %}</span>
<ul class="sub-toc-{{loop.depth}}{{ isActive(section) }}">
{{ loop(section.tableofcontents) }}
</ul>
Expand All @@ -73,9 +80,6 @@
<li>
<a href="dep_graph.html">Dependency graph</a>
</li>
<li>
<a href="coverage.html">Progess report</a>
</li>
{% if 'project_home' in obj.ownerDocument.userdata %}
<li>
<a href="{{ obj.ownerDocument.userdata['project_home'] }}">Project home</a>
Expand All @@ -85,12 +89,8 @@
</nav>
{% endif %}

<div class="wrapper{% if toc %} with-toc{% endif %}">
{% if links.document.title or toc %}
<header>
<h1 id="doc_title">{{ links.document.title }}</h1>
</header>
{% endif %}
<div class="content">
<div class="content-wrapper">

{% if obj.level >= config.html5['breadcrumbs-level'] %}
<ul class="breadcrumbs">
Expand All @@ -104,9 +104,9 @@
</ul>
{% endif %}

<div class="content">

<div class="main-text">
{{ obj }}
</div> <!--main-text -->
{% if obj.tableofcontents and obj.level <= config.html5['localtoc-level'] %}
<nav class=local_toc>
<ul>
Expand All @@ -132,7 +132,9 @@
</ol>
</footer>
{% endif %}
</div>
</div> <!-- content-wrapper -->
</div> <!-- content -->
</div> <!-- wrapper -->

<nav class="prev_up_next">
{% for nav in rendererdata.get('extra-nav', []) %}
Expand All @@ -150,12 +152,10 @@
{% if links.index.url %}
<a href="{{ links.index.url }}" class="index">Index</a>
{% endif %}
{% if toc %}{{ icon('list-numbered', id='toc-toggle')}}{% endif %}
</nav>

{% for js in rendererdata.get('js', []) %}
<script type="text/javascript" src="js/{{ js }}"></script>
{% endfor %}
</div>
</body>
</html>
160 changes: 160 additions & 0 deletions leanblueprint/Packages/renderer_templates/document-layout.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{% set links = obj.links %}
{% set doc = obj.ownerDocument.getElementsByTagName('document')[0] %}
{% set toc = doc.tableofcontents if config.html5['display-toc'] else None %}
{% set rendererdata = obj.ownerDocument.rendererdata['html5'] %}
{% macro tocEntry(section) %}
<span class="toc_ref">{{ section.ref.textContent }}</span> <span class="toc_entry">{{ section.tocEntry }}</span>{% endmacro %}
{% macro isActive(section) %}
{% if section in links.breadcrumbs %} active{% endif %}
{% endmacro %}
{% macro isCurrent(section) %}
{% if section.url == obj.url %} current{% endif %}
{% endmacro %}
{% macro icon(icon, id='', class='') %}
<svg {% if id %}id="{{id}}" {% endif %}class="icon icon-{{ icon }} {{ class }}"><use xlink:href="symbol-defs.svg#icon-{{ icon }}"></use></svg>
{% endmacro %}
<!DOCTYPE html>
<html lang="en">
<head>
{% if config.html5['use-mathjax'] %}
<script type="text/x-mathjax-config">
{% if config.html5['mathjax-dollars'] %}
MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
{% else %}
MathJax.Hub.Config({tex2jax: {inlineMath: [ ['\\(','\\)']]}});
{% endif %}
</script>
<script type="text/javascript" src="{{ config.html5['mathjax-url'] }}">
</script>
{% endif %}
<meta name="generator" content="plasTeX" />
<meta charset="{{ config.files['output-encoding']}}" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
{% if obj.title %}
{% if obj.level > config.html5['localtoc-level'] %}
<title>{{ links.document.title }}: {{ obj.title }}</title>
{% else %}
<title>{{ obj.title }}</title>
{% endif %}
{% endif %}
{% if links.next.url %}
<link rel="next" href="{{ links.next.url }}" title="{{ links.next.title.textContent }}" />
{% endif %}
{% if links.prev.url %}
<link rel="prev" href="{{ links.prev.url }}" title="{{ links.prev.title.textContent }}" />
{% endif %}
{% if links.up.url %}
<link rel="up" href="{{ links.up.url }}" title="{{ links.up.title.textContent }}" />
{% endif %}
{% for css in rendererdata.get('css', []) %}
<link rel="stylesheet" href="styles/{{ css }}" />
{% endfor %}
</head>

<body>
{% if toc %}
<header>
{% if toc %}{{ icon('list-numbered', id='toc-toggle')}}{% endif %}
</header>
{% endif %}

<div class="wrapper">
{% if toc %}
<nav class="toc">
<ul class="sub-toc-0">
{% for section in toc recursive %}
<li class="{{ isActive(section) }}{{ isCurrent(section) }}">
{% if section.tableofcontents %}
<a href="{{ section.url }}">{{ tocEntry(section) }}</a>
<span class="expand-toc">{% if isActive(section) %}{% else %}{% endif %}</span>
<ul class="sub-toc-{{loop.depth}}{{ isActive(section) }}">
{{ loop(section.tableofcontents) }}
</ul>
{% else %}
<a href="{{ section.url }}">{{ tocEntry(section) }}</a>
{% endif %}
</li>
{% endfor %}
<li></li>
<li>
<a href="dep_graph.html">Dependency graph</a>
</li>
{% if 'project_home' in obj.ownerDocument.userdata %}
<li>
<a href="{{ obj.ownerDocument.userdata['project_home'] }}">Project home</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}

<div class="content">
<div class="content-wrapper">

{% if obj.level >= config.html5['breadcrumbs-level'] %}
<ul class="breadcrumbs">
{% for crumb in links.breadcrumbs %}
{% if loop.last %}
<li class="last_crumb">{{ crumb.title }}</li>
{% else %}
<li class="crumb"><a href="{{ crumb.url }}" class="crumb">{{ crumb.title }}</a></li>
{% endif %}
{% endfor %}
</ul>
{% endif %}

<div class="main-text">
{{ obj }}
</div> <!--main-text -->
{% if obj.tableofcontents and obj.level <= config.html5['localtoc-level'] %}
<nav class=local_toc>
<ul>
{% for section in obj.tableofcontents recursive %}
<li>
<a href="{{ section.url }}">{{ tocEntry(section) }}</a>
{% if section.tableofcontents %}
<ul>
{{ loop(section.tableofcontents) }}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
{% endif %}
{% if obj.footnotes %}
<footer id="footnotes">
<ol>
{% for footnote in obj.footnotes %}
<li id="{{ footnote.id }}">{{ footnote }}</li>
{% endfor %}
</ol>
</footer>
{% endif %}
</div> <!-- content-wrapper -->
</div> <!-- content -->
</div> <!-- wrapper -->

<nav class="prev_up_next">
{% for nav in rendererdata.get('extra-nav', []) %}
{{ icon(nav['icon'], id=nav['id'], class=nav['class']) }}
{% endfor %}
{% if links.prev.url %}
<a href="{{ links.prev.url }}" title="{{ links.prev.title | striptags }}">{{ icon('arrow-left')}}</a>
{% endif %}
{% if links.up.url %}
<a href="{{ links.up.url }}" title="{{ links.up.title | striptags }}">{{ icon('arrow-up')}}</a>
{% endif %}
{% if links.next.url %}
<a href="{{ links.next.url }}" title="{{ links.next.title | striptags }}">{{ icon('arrow-right')}}</a>
{% endif %}
{% if links.index.url %}
<a href="{{ links.index.url }}" class="index">Index</a>
{% endif %}
</nav>

{% for js in rendererdata.get('js', []) %}
<script type="text/javascript" src="js/{{ js }}"></script>
{% endfor %}
</body>
</html>

0 comments on commit a839d37

Please sign in to comment.