Minor fixes to website generation

This commit is contained in:
William Langford committed 2020-03-02 10:55:51 -05:00
1 parent d24c3d2263
commit 8c61ebad0a
4 files changed
+13 -5

No files matched your search

+9 -1
View File
@@ -35,13 +35,21 @@ env.globals['navigation'] = ['tutorial', 'download', 'manual']
def generate_file(env, fname='content/1.tutorial/default.yml'):
path, base = os.path.split(fname)
path = os.path.relpath(path, 'content')
if path == '.':
path = ''
slug = 'index'
permalink = ''
else:
slug = os.path.basename(path)
permalink = path + '/'
output_dir = os.path.join('output', path)
output_path = os.path.join(output_dir, 'index.html')
template_name = re.sub(r".yml$", '.html.j2', base)
ctx = load_yml_file(fname)
ctx.update(unique_ctr=itertools.count(1), permalink=path)
ctx.update(unique_ctr=itertools.count(1), permalink=permalink, slug=slug, navitem=path)
os.makedirs(output_dir, exist_ok=True)
env.get_template(template_name).stream(ctx).dump(output_path, encoding='utf-8')
+1 -1
View File
@@ -1,6 +1,6 @@
# The key value pairs found below are available within the templates.
:url: https://stedolan.github.io/jq
url: https://stedolan.github.io/jq
# This line is modified by the Makefile. To change the version number,
# edit the Autoconf version number at the top of configure.ac
+1 -1
View File
@@ -7,7 +7,7 @@
<title>{{headline}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="canonical" href="{{ url }}{{ permalink | replace('/index','') }}" />
<link rel="canonical" href="{{ url }}/{{ permalink }}" />
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/spacelab/bootstrap.min.css" rel="stylesheet" integrity="sha256-j7Dtnd7ZjexEiPNbscbopFn9+Cs0b3TLipKsWAPHZIM= sha512-RFhfi6P8zWMAJrEGU+CPjuxPh3r/UUBGqQ+/o6WKPIVZmQqeOipGotH2ihRULuQ8wsMBoK15TSZqc/7VYWyuIw==" crossorigin="anonymous">
<link rel="stylesheet" href="{{ root }}/css/base.css" type="text/css">
<!--[if lt IE 9]>
+2 -2
View File
@@ -13,8 +13,8 @@
<div class="navbar-collapse collapse" id="nav-collapse">
<ul class="nav navbar-nav">
{% for item in navigation %}
<li {% if item == permalink %} class="active" {% endif %}>
<a href="{{root}}/{{item}}">{{item | capitalize}}</a>
<li {% if item == navitem %} class="active" {% endif %}>
<a href="{{root}}/{{item}}/">{{item | capitalize}}</a>
</li>
{% endfor %}
<li><a href="https://github.com/stedolan/jq/issues">Issues</a></li>