Minor fixes to website generation
This commit is contained in:
1 parent
d24c3d2263
commit
8c61ebad0a
4 files changed
+13
-5
No files matched your search
@@ -35,13 +35,21 @@ env.globals['navigation'] = ['tutorial', 'download', 'manual']
|
|||||||
def generate_file(env, fname='content/1.tutorial/default.yml'):
|
def generate_file(env, fname='content/1.tutorial/default.yml'):
|
||||||
path, base = os.path.split(fname)
|
path, base = os.path.split(fname)
|
||||||
path = os.path.relpath(path, 'content')
|
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_dir = os.path.join('output', path)
|
||||||
output_path = os.path.join(output_dir, 'index.html')
|
output_path = os.path.join(output_dir, 'index.html')
|
||||||
|
|
||||||
template_name = re.sub(r".yml$", '.html.j2', base)
|
template_name = re.sub(r".yml$", '.html.j2', base)
|
||||||
|
|
||||||
ctx = load_yml_file(fname)
|
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)
|
os.makedirs(output_dir, exist_ok=True)
|
||||||
env.get_template(template_name).stream(ctx).dump(output_path, encoding='utf-8')
|
env.get_template(template_name).stream(ctx).dump(output_path, encoding='utf-8')
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# The key value pairs found below are available within the templates.
|
# 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,
|
# This line is modified by the Makefile. To change the version number,
|
||||||
# edit the Autoconf version number at the top of configure.ac
|
# edit the Autoconf version number at the top of configure.ac
|
||||||
|
|||||||
Vendored
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
<title>{{headline}}</title>
|
<title>{{headline}}</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<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 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">
|
<link rel="stylesheet" href="{{ root }}/css/base.css" type="text/css">
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
|
|||||||
+2
-2
@@ -13,8 +13,8 @@
|
|||||||
<div class="navbar-collapse collapse" id="nav-collapse">
|
<div class="navbar-collapse collapse" id="nav-collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
{% for item in navigation %}
|
{% for item in navigation %}
|
||||||
<li {% if item == permalink %} class="active" {% endif %}>
|
<li {% if item == navitem %} class="active" {% endif %}>
|
||||||
<a href="{{root}}/{{item}}">{{item | capitalize}}</a>
|
<a href="{{root}}/{{item}}/">{{item | capitalize}}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<li><a href="https://github.com/stedolan/jq/issues">Issues</a></li>
|
<li><a href="https://github.com/stedolan/jq/issues">Issues</a></li>
|
||||||
|
|||||||
Reference in new issue
Block a user