~javiljoen/yatte

86569d2d880958decef4ceb9c03c55fd41a1bb6f — JA Viljoen 3 months ago c561ff9
Remove chevron dependency

Injecting variables into the documentation templates
can be done using standard string formatting.
M docs/doctasks.py => docs/doctasks.py +5 -7
@@ 4,8 4,6 @@ from datetime import date
from logging import error
from pathlib import Path

import chevron

import yatte
from yatte import task
from yatte.utils import check_envvars, is_newer, mkdir, run, stderr


@@ 76,8 74,8 @@ def pipe(cmd, input=None):

def scdoc2man(scd, man):
    """Convert manual in scdoc format to man format."""
    stderr(f"$ chevron {scd} | scdoc > {man}")
    scdoc = chevron.render(scd.read_text(), {"version": yatte.__version__})
    stderr(f"$ compile {scd} | scdoc > {man}")
    scdoc = scd.read_text().format(version=yatte.__version__)
    pipe(f"scdoc > {man}", input=scdoc)




@@ 101,9 99,9 @@ def render_page(page, template, out_html):
        error(f"{e} in {page}")
        raise SystemExit(1)

    data = {"title": f"{title} | yatte", "content": content, "date": date.today()}
    stderr(f"chevron {page} {page_template} > {out_html}")
    rendered = chevron.render(template, data)
    title = f"{title} | yatte"
    stderr(f"$ compile {page_template} {page} > {out_html}")
    rendered = template.format(title=title, content=content, date=date.today())
    out_html.write_text(rendered)



M docs/man/yatte.1.scd => docs/man/yatte.1.scd +1 -1
@@ 1,4 1,4 @@
yatte(1) "yatte {{version}}"
yatte(1) "yatte {version}"

# NAME


M docs/pages/development.html => docs/pages/development.html +2 -2
@@ 3,9 3,9 @@
<h1>Development</h1>

<p>In order to run project-related tasks defined in <code>tasks.py</code>,
  its immediate dependencies must first be installed:</p>
  <code class="cmd">yatte</code> itself must first be installed:</p>

<pre><code><span class="gp">$ </span>pip install . chevron==0.14</code></pre>
<pre><code><span class="gp">$ </span>pip install .</code></pre>

<p>The package can now be installed in development mode
  via <code class="cmd">yatte</code> itself:</p>

M docs/templates/page.html => docs/templates/page.html +4 -5
@@ 3,7 3,7 @@
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>{{ title }}</title>
  <title>{title}</title>
  <link rel="stylesheet" href="style.css" />
</head>
<body>


@@ 18,13 18,12 @@
  </ul>
</nav>

{{{  content  }}}
{content}

<footer>
  <p>Documentation © {{ date.year }} JA Viljoen and licensed under
  <p>Documentation © {date.year} JA Viljoen and licensed under
    <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.</p>
  <p>Site generated using Python and <a href="https://pypi.org/project/chevron/">Chevron</a>
    on {{ date }}.</p>
  <p>Site generated using Yatte on {date}.</p>
</footer>

</body>

M requirements.txt => requirements.txt +0 -1
@@ 4,4 4,3 @@ flake8~=4.0
flake8-bugbear~=22.1
flit~=3.6
pytest~=7.0
chevron~=0.14