~javiljoen/yatte

6f92a10cea6fb7319e3e55eeceb438f9ded29473 — JA Viljoen 9 months ago d96980e
Don't collapse blank lines in rendered docs

This improves the code formatting in `manual.html`
and makes the output more predictable.
2 files changed, 1 insertions(+), 4 deletions(-)

M docs/doctasks.py
M docs/pages/quickstart.html
M docs/doctasks.py => docs/doctasks.py +1 -1
@@ 119,7 119,7 @@ def render_page(page: Path, template: str, out_html: Path):
    data = {"title": f"{title} | yatte", "content": content, "date": date.today()}
    stderr(f"chevron {page} {page_template} > {out_html}")
    rendered = chevron.render(template, data)
    out_html.write_text(rendered.replace("\n\n", "\n"))
    out_html.write_text(rendered)


def get_title(doc: str) -> str:

M docs/pages/quickstart.html => docs/pages/quickstart.html +0 -3
@@ 11,19 11,16 @@ containing some functions decorated with <code>@task</code>:</p>

<span class="kn">from</span> <span class="nn">yatte</span> <span class="kn">import</span> task


@task(<span class="s2">&quot;greet&quot;</span>)
<span class="k">def</span> hello():
    <span class="sd">&quot;&quot;&quot;Greet the world&quot;&quot;&quot;</span>
    print(<span class="s2">&quot;Hello, world!&quot;</span>)


@task(<span class="s2">&quot;list-files&quot;</span>)
<span class="k">def</span> list_files(dir):
    <span class="sd">&quot;&quot;&quot;List the files in the directory&quot;&quot;&quot;</span>
    shell(<span class="sa">f</span><span class="s2">&quot;ls </span><span class="si">{</span>dir<span class="si">}</span><span class="s2">&quot;</span>)


<span class="k">def</span> shell(cmd):
    print(<span class="s2">&quot;sh&gt;&quot;</span>, cmd, file=stderr)
    p = run(cmd, shell=<span class="kc">True</span>)