Minor fixes to website generation
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by William Langford · committed by William Langford · parent d24c3d2 · Browse files · 4 files·+13 added−5 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+13 added−5 removed
- other:+13 added−5 removed
Provenance
- Commit
8c61eba- Tree
d62b837- Author
William Langford <wlangfor@gmail.com>- Committer
William Langford <wlangfor@gmail.com>- Parent
d24c3d2
4 files changed+13 added−5 removed
modified:docs/templates/shared/_head.html.j2+1 added-1 removed
5 unmodified lines6 <meta charset="utf-8">7 <title>{{headline}}</title>8 <meta name="viewport" content="width=device-width, initial-scale=1">9 <meta http-equiv="X-UA-Compatible" content="IE=edge" />10- <link rel="canonical" href="{{ url }}{{ permalink | replace('/index','') }}" />10+ <link rel="canonical" href="{{ url }}/{{ permalink }}" />11 <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">12 <link rel="stylesheet" href="{{ root }}/css/base.css" type="text/css">13 <!--[if lt IE 9]>14 <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>3 unmodified linesmodified:docs/templates/shared/_navbar.html.j2+2 added-2 removed
11 unmodified lines12 13 <div class="navbar-collapse collapse" id="nav-collapse">14 <ul class="nav navbar-nav">15 {% for item in navigation %}16- <li {% if item == permalink %} class="active" {% endif %}>17- <a href="{{root}}/{{item}}">{{item | capitalize}}</a>16+ <li {% if item == navitem %} class="active" {% endif %}>17+ <a href="{{root}}/{{item}}/">{{item | capitalize}}</a>18 </li>19 {% endfor %}20 <li><a href="https://github.com/stedolan/jq/issues">Issues</a></li>21 <li><a href="https://github.com/stedolan/jq">Source</a></li>6 unmodified linesmodified:docs/build_website.py+9 added-1 removed
33 unmodified lines34 35 def generate_file(env, fname='content/1.tutorial/default.yml'):36 path, base = os.path.split(fname)37 path = os.path.relpath(path, 'content')38+ if path == '.':39+ path = ''40+ slug = 'index'41+ permalink = ''42+ else:43+ slug = os.path.basename(path)44+ permalink = path + '/'45+46 output_dir = os.path.join('output', path)47 output_path = os.path.join(output_dir, 'index.html')48 49 template_name = re.sub(r".yml$", '.html.j2', base)50 51 ctx = load_yml_file(fname)44- ctx.update(unique_ctr=itertools.count(1), permalink=path)52+ ctx.update(unique_ctr=itertools.count(1), permalink=permalink, slug=slug, navitem=path)53 os.makedirs(output_dir, exist_ok=True)54 env.get_template(template_name).stream(ctx).dump(output_path, encoding='utf-8')55 56 14 unmodified linesmodified:docs/site.yml+1 added-1 removed
123345672 unmodified lines# The key value pairs found below are available within the templates.
:url: https://stedolan.github.io/jqurl: 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.acjq_version: "1.4-2-g15c4a7f-dirty"2 unmodified lines