Skip to content
Myr

website: remove unused root path on building website (#3248)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

We no longer use the `--root` option of `build_website.py` since we have moved to jqlang.org (from jqlang.github.io/jq where the root was `/jq`). We don't need the option on local development either since `http.server` has the `-d` option to specify the directory to serve from.

authored by itchyny · committed by GitHub · parent e33578a · Browse files · 7 files+20 added−28 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+20 added−28 removed

  • other:+20 added−28 removed

7 files+20 added−28 removed

modified:docs/content/download/default.yml+2 added-2 removed
237 unmodified lines
238239 #### Building the documentation240241 jq's documentation is compiled into static HTML using Python.242 To build the docs, run `pipenv run python3 build_website.py --root /output`242 To build the docs, run `pipenv run python3 build_website.py`243 in the `docs/` directory. To serve them locally, you can run244 `python3 -m http.server`. You'll need a few Python dependencies,244 `python3 -m http.server -d output`. You'll need a few Python dependencies,245 which can be installed by following the instructions in `docs/README.md`.246247 The man page is built by `make jq.1`, or just `make`, also from248 the YAML docs, and you'll still need the Python dependencies to
1 unmodified line
modified:docs/templates/shared/_head.html.j2+4 added-4 removed
3 unmodified lines
4 <meta name="viewport" content="width=device-width, initial-scale=1">5 <meta property="og:title" content="{{ headline }}">6 <meta property="og:description" content="jq is a lightweight and flexible command-line JSON processor">7 <meta property="og:type" content="website">8 <meta property="og:image" content="{{ url }}{{ root }}/icon.png">8 <meta property="og:image" content="{{ url }}/icon.png">9 <meta property="og:url" content="{{ url }}/{{ permalink }}">10 <link rel="icon" href="{{ root }}/icon.svg" type="image/svg+xml">11 <link rel="apple-touch-icon" href="{{ root }}/icon.png" type="image/png">10 <link rel="icon" href="/icon.svg" type="image/svg+xml">11 <link rel="apple-touch-icon" href="/icon.png" type="image/png">12 <link rel="canonical" href="{{ url }}/{{ permalink }}">13 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootswatch@5.3.1/dist/cosmo/bootstrap.min.css"14 integrity="sha384-dulfW0vmzZ638jigSgZXvDxMmd70GCnIv6oa+riKq6Kk4E0MKf7qmBfwP02wltv5" crossorigin="anonymous">15 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css"16 integrity="sha384-Ay26V7L8bsJTsX9Sxclnvsn+hkdiwRnrjZJXqKmkIDobPgIIWBOVguEcQQLDuhfN" crossorigin="anonymous">17 <link rel="stylesheet" href="{{ root }}/css/style.css" type="text/css">17 <link rel="stylesheet" href="/css/style.css" type="text/css">18 <script>19 (function() {20 function setTheme(mediaQuery) {21 document.documentElement.setAttribute('data-bs-theme',
7 unmodified lines
modified:docs/templates/shared/_navbar.html.j2+3 added-3 removed
8 unmodified lines
9 <button type="button" class="navbar-toggler" data-bs-toggle="offcanvas" data-bs-target="#navbar-collapse"10 aria-controls="navbar-collapse" aria-expanded="false" aria-label="Toggle page navigation">11 <span class="navbar-toggler-icon"></span>12 </button>13 <a class="navbar-brand" href="{{ root }}/" aria-label="Top page"><img src="{{ root }}/jq.svg" alt="jq logo" style="height:1.5rem"></a>13 <a class="navbar-brand" href="/" aria-label="Top page"><img src="/jq.svg" alt="jq logo" style="height:1.5rem"></a>14 <div id="navbar-collapse" class="offcanvas offcanvas-start navbar-collapse w-auto" aria-labelledby="navbar-title">15 <div class="offcanvas-header">16 <h3 id="navbar-title" class="me-3">jq</h3>17 <button type="button" class="d-md-none btn-close" data-bs-dismiss="offcanvas" aria-label="Close page navigation"></button>18 </div>19 <ul class="offcanvas-body navbar-nav me-auto text-nowrap">20 <li class="nav-item d-md-none"><a class="nav-link{% if not navitem %} active{% endif %}"{% if not navitem %} aria-current="page"{% endif %} href="{{ root }}/">Top page</a></li>20 <li class="nav-item d-md-none"><a class="nav-link{% if not navitem %} active{% endif %}"{% if not navitem %} aria-current="page"{% endif %} href="/">Top page</a></li>21 {%- for item in ['tutorial', 'download', 'manual'] %}22 <li class="nav-item"><a class="nav-link{% if item == navitem %} active{% endif %}"{% if item == navitem %} aria-current="page"{% endif %} href="{{ root }}/{{ item }}/">{{ item | capitalize }}</a></li>22 <li class="nav-item"><a class="nav-link{% if item == navitem %} active{% endif %}"{% if item == navitem %} aria-current="page"{% endif %} href="/{{ item }}/">{{ item | capitalize }}</a></li>23 {%- endfor %}24 <li class="nav-item"><a class="nav-link" href="https://github.com/jqlang/jq" target="_blank" rel="noopener">GitHub</a></li>25 <li class="nav-item"><a class="nav-link" href="https://github.com/jqlang/jq/issues" target="_blank" rel="noopener">Issues</a></li>26 <li class="nav-item"><a class="nav-link" href="https://jqplay.org" target="_blank" rel="noopener">Try online!</a></li>
14 unmodified lines
modified:docs/templates/index.html.j2+2 added-2 removed
6 unmodified lines
78 <main id="main" class="container-lg">9 <div class="row">10 <div class="col-md-6 text-center p-3">11 <h1><img src="{{ root }}/jq.svg" class="img-fluid" alt="jq" width="400" height="220"></h1>11 <h1><img src="/jq.svg" class="img-fluid" alt="jq" width="400" height="220"></h1>12 </div>13 <div class="col-md-6 d-flex flex-column justify-content-center text-center align-items-center">14 <h2 class="px-1" style="width:16em">{{ blurb }}</h2>15 <div class="btn-group d-print-none" role="group">
6 unmodified lines
22 <li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-arm64" aria-label="Link to download executable: Linux (ARM64)"><span class="bi bi-download me-2" aria-hidden="true"></span>Linux (ARM64)</a></li>23 <li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-amd64" aria-label="Link to download executable: macOS (AMD64)"><span class="bi bi-download me-2" aria-hidden="true"></span>macOS (AMD64)</a></li>24 <li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-arm64" aria-label="Link to download executable: macOS (ARM64)"><span class="bi bi-download me-2" aria-hidden="true"></span>macOS (ARM64)</a></li>25 <li><a class="dropdown-item" href="https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-windows-amd64.exe" aria-label="Link to download executable: Windows (AMD64)"><span class="bi bi-download me-2" aria-hidden="true"></span>Windows (AMD64)</a></li>26 <li><a class="dropdown-item" href="{{ root }}/download/">Other platforms, older versions, and source</a></li>26 <li><a class="dropdown-item" href="/download/">Other platforms, older versions, and source</a></li>27 </ul>28 <a class="btn btn-primary text-nowrap" href="https://jqplay.org" target="_blank" rel="noopener">29 Try online at jqplay.org!<span class="bi bi-box-arrow-up-right ms-1" aria-hidden="true"></span>30 </a>
28 unmodified lines
modified:docs/templates/manual.html.j2+7 added-7 removed
34 unmodified lines
35 <h1>{{ headline }}</h1>36 <p>37 <em>38 For other versions, see39 <a href="{{ root }}/manual/v1.7/">1.7</a>,40 <a href="{{ root }}/manual/v1.6/">1.6</a>,41 <a href="{{ root }}/manual/v1.5/">1.5</a>,42 <a href="{{ root }}/manual/v1.4/">1.4</a>,43 <a href="{{ root }}/manual/v1.3/">1.3</a> or44 <a href="{{ root }}/manual/dev/">development version</a>.39 <a href="/manual/v1.7/">1.7</a>,40 <a href="/manual/v1.6/">1.6</a>,41 <a href="/manual/v1.5/">1.5</a>,42 <a href="/manual/v1.4/">1.4</a>,43 <a href="/manual/v1.3/">1.3</a> or44 <a href="/manual/dev/">development version</a>.45 </em>46 </p>47 {{ body | markdownify }}48 {%- for section in sections %}
65 unmodified lines
114 {{ section.title | search_id | tojson }}: {{ section.title | section_id | tojson }}{{ "," if not loop.last }}115 {%- endfor %}116 }117 </script>118 <script src="{{ root }}/js/manual-search.js"></script>118 <script src="/js/manual-search.js"></script>119 </body>120</html>
modified:docs/build_website.py-7 removed
1#!/usr/bin/env python32import argparse2import glob3import itertools4from jinja2 import Environment, FileSystemLoader, select_autoescape, pass_context5from markdown import markdown
3 unmodified lines
9import re10import shutil11import yaml1214parser = argparse.ArgumentParser()15parser.add_argument('--root', default='')16args = parser.parse_args()1713env = Environment(14 loader=FileSystemLoader('templates'),15 autoescape=select_autoescape(['html.j2']),16)
4 unmodified lines
21 return yaml.safe_load(f)222324env.globals['url'] = 'https://jqlang.org'30env.globals['root'] = args.root3125env.filters['search_id'] = lambda input: input.replace(r'`', '')26env.filters['section_id'] = lambda input: re.sub(27 r'[^-a-zA-Z0-9_]', '', input.replace(' ', '-')).lower()28env.filters['entry_id'] = lambda input: re.sub(
60 unmodified lines
modified:docs/README.md+2 added-3 removed