Skip to content

Commit 993c4fa

Browse files
committed
Deployed f5c5a04 with MkDocs version: 1.6.1
1 parent 0f3edca commit 993c4fa

File tree

2 files changed

+30
-28
lines changed

2 files changed

+30
-28
lines changed

guides/pages/index.html

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -740,27 +740,27 @@
740740
</li>
741741

742742
<li class="md-nav__item">
743-
<a href="#content-pages" class="md-nav__link">
743+
<a href="#the-page-template" class="md-nav__link">
744744
<span class="md-ellipsis">
745-
Content pages
745+
The page template
746746
</span>
747747
</a>
748748

749749
</li>
750750

751751
<li class="md-nav__item">
752-
<a href="#how-routing-works" class="md-nav__link">
752+
<a href="#content-pages" class="md-nav__link">
753753
<span class="md-ellipsis">
754-
How routing works
754+
Content pages
755755
</span>
756756
</a>
757757

758758
</li>
759759

760760
<li class="md-nav__item">
761-
<a href="#the-page-template" class="md-nav__link">
761+
<a href="#how-routing-works" class="md-nav__link">
762762
<span class="md-ellipsis">
763-
The page template
763+
How routing works
764764
</span>
765765
</a>
766766

@@ -1924,27 +1924,27 @@
19241924
</li>
19251925

19261926
<li class="md-nav__item">
1927-
<a href="#content-pages" class="md-nav__link">
1927+
<a href="#the-page-template" class="md-nav__link">
19281928
<span class="md-ellipsis">
1929-
Content pages
1929+
The page template
19301930
</span>
19311931
</a>
19321932

19331933
</li>
19341934

19351935
<li class="md-nav__item">
1936-
<a href="#how-routing-works" class="md-nav__link">
1936+
<a href="#content-pages" class="md-nav__link">
19371937
<span class="md-ellipsis">
1938-
How routing works
1938+
Content pages
19391939
</span>
19401940
</a>
19411941

19421942
</li>
19431943

19441944
<li class="md-nav__item">
1945-
<a href="#the-page-template" class="md-nav__link">
1945+
<a href="#how-routing-works" class="md-nav__link">
19461946
<span class="md-ellipsis">
1947-
The page template
1947+
How routing works
19481948
</span>
19491949
</a>
19501950

@@ -2026,22 +2026,28 @@ <h1 id="pages">Pages</h1>
20262026
<p>This feature is provided by <a href="https://github.com/hyperflask/flask-file-routes">Flask-File-Routes</a></p>
20272027
</div>
20282028
<h2 id="dynamic-pages">Dynamic pages</h2>
2029-
<p>Dynamic pages can use the following formats:</p>
2030-
<ul>
2031-
<li><strong>jpy</strong>: jinjapy hybrid format that let you execute code before rendering the template</li>
2032-
<li><strong>py</strong>: python code only</li>
2033-
</ul>
2034-
<p>A jinjapy file contains 2 sections:</p>
2035-
<ul>
2036-
<li>Some Python code enclosed by lines containg 3 dashes "---"</li>
2037-
<li>A body containing some Jinja template code</li>
2038-
</ul>
2039-
<p>Both are optional:</p>
2029+
<p>Pages use the <a href="https://github.com/hyperflask/jinjapy">jinjapy</a> file format. It combines python code and a <a href="#the-page-template">jinja template</a>. The python code will be executed first on every request, then the template will be rendered.</p>
2030+
<p>The python code is enclosed inside 2 lines containing 3 dashes "---"</p>
2031+
<p>A special <a href="#the-page-object">page object</a> is available in the python code. Assign values to this object so that they become available in the template.</p>
2032+
<div class="highlight"><pre><span></span><code><span class="c">---</span>
2033+
<span class="n">page</span><span class="o">.</span><span class="n">message</span> <span class="o">=</span> <span class="s2">&quot;Hello world&quot;</span>
2034+
<span class="c">---</span>
2035+
<span class="cp">{{</span> <span class="nv">message</span> <span class="cp">}}</span>
2036+
</code></pre></div>
2037+
<p>Both the python code or the templates are optional:</p>
20402038
<ul>
20412039
<li>If the python code is missing, the file only contains a Jinja template</li>
20422040
<li>If the python code is left unclosed (the file starts with "---" on a single line followed by some python code), the file has no template</li>
20432041
</ul>
20442042
<p>The python code has a few global variables injected when executed: <code>page</code>, <code>request</code>, <code>abort</code>, <code>redirect</code>, <code>url_for</code>, <code>current_app</code>, <code>render_template</code>.</p>
2043+
<div class="admonition tip">
2044+
<p class="admonition-title">Tip</p>
2045+
<p>Pages can also be declared using .py files. In this case they will be pure python modules. Use <code>page.respond()</code> to send a response.</p>
2046+
</div>
2047+
<h2 id="the-page-template">The page template</h2>
2048+
<p>Templates are powered by <a href="https://jinja.palletsprojects.com/en/stable/">Jinja</a>.</p>
2049+
<p>We recommend reading the <a href="https://flask.palletsprojects.com/en/stable/templating/">Flask templating guide</a>.</p>
2050+
<p>Hyperflask includes built-ins UI components powered by <a href="https://daisyui.com/">DaisyUI</a>. Check out the <a href="/guides/components/#built-in-ui-components">Components</a> guide.</p>
20452051
<h2 id="content-pages">Content pages</h2>
20462052
<p>No python code will be executed on content pages.</p>
20472053
<p>Content pages can use the following formats:</p>
@@ -2066,10 +2072,6 @@ <h2 id="how-routing-works">How routing works</h2>
20662072
</li>
20672073
</ul>
20682074
<p>The placeholder value is available through the <a href="#the-page-object"><code>page</code> object</a> (eg: <code>page.slug</code>).</p>
2069-
<h2 id="the-page-template">The page template</h2>
2070-
<p>Templates are powered by <a href="https://jinja.palletsprojects.com/en/stable/">Jinja</a>.</p>
2071-
<p>We recommend reading the <a href="https://flask.palletsprojects.com/en/stable/templating/">Flask templating guide</a>.</p>
2072-
<p>Hyperflask includes built-ins UI components powered by <a href="https://daisyui.com/">DaisyUI</a>. Check out the <a href="/guides/components/#built-in-ui-components">Components</a> guide.</p>
20732075
<h2 id="layouts">Layouts</h2>
20742076
<p>Hyperflask makes managing layouts for your pages easier. Layouts are saved in the <em>app/layouts</em> folder. The default layout can be overriden at <em>app/layouts/default.html</em>.
20752077
(Hyperflask provides a default layout when none is created)</p>

search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)