forked from gvwilson/mccole
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
255 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
"""Page elements.""" | ||
|
||
import ark | ||
import ibis | ||
|
||
import util | ||
|
||
|
||
@ibis.filters.register("is_chapter") | ||
def is_chapter(node): | ||
"""Is this a chapter node (vs. appendix)?""" | ||
return node.slug and node.slug in ark.site.config["chapters"] | ||
|
||
|
||
@ibis.filters.register("nav_next") | ||
def nav_next(node): | ||
"""Create next-page link.""" | ||
return _nav_link(node, "next") | ||
|
||
|
||
@ibis.filters.register("nav_prev") | ||
def nav_prev(node): | ||
"""Create previous-page link.""" | ||
return _nav_link(node, "prev") | ||
|
||
|
||
@ibis.filters.register("tagline") | ||
def tagline(node): | ||
"""Insert chapter tagline (must exist).""" | ||
util.require( | ||
node.slug in ark.site.config["chapters"], | ||
f"bad tagline request: {node.path} is not a chapter", | ||
) | ||
util.require( | ||
node.slug in ark.site.config["_meta_"], | ||
f"no metadata for {node.path}", | ||
) | ||
return util.markdownify(ark.site.config["_meta_"][node.slug].get("tagline")) | ||
|
||
|
||
def _nav_link(node, kind): | ||
"""Generate previous/next page links.""" | ||
if not node.slug: | ||
return "" | ||
contents = ark.site.config["chapters"] + ark.site.config["appendices"] | ||
try: | ||
where = contents.index(node.slug) | ||
except ValueError: | ||
util.fail(f"unknown slug {node.slug} in {node.path}") | ||
if kind == "prev": | ||
if where == 0: | ||
return "" | ||
return f'<a href="@root/{contents[where - 1]}/">⇐</a>' | ||
elif kind == "next": | ||
if where == (len(contents) - 1): | ||
return "" | ||
return f'<a href="@root/{contents[where + 1]}/">⇒</a>' | ||
else: | ||
util.fail(f"Unknown nav link type '{kind}' in {node.path}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
</head> | ||
<body> | ||
<main> | ||
{% include "title.html" %} | ||
{{ node.html }} | ||
</main> | ||
{% include "foot.html" %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<h1>{% if node.title %}{{ node.title }}{% else %}{{ site.title }}{% endif %}</h1> | ||
<div class="row notex"> | ||
<div class="col-1 left"> | ||
{{node | nav_prev }} | ||
</div> | ||
<div class="col-10 center"> | ||
{% if node | is_chapter %}<span class="tagline">{{ node | tagline }}</span>{% endif %} | ||
</div> | ||
<div class="col-1 right"> | ||
{{node | nav_next }} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
title: "Code of Conduct" | ||
--- | ||
|
||
[% rootfile "CODE_OF_CONDUCT.md" strip=False %] | ||
[% rootfile "CODE_OF_CONDUCT.md" %] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
--- | ||
title: "Introduction" | ||
tagline: "Where we're going and why." | ||
--- | ||
|
||
- Reference to conclusion [%x finale %] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
title: "License" | ||
--- | ||
|
||
[% rootfile "LICENSE.md" strip=False %] | ||
[% rootfile "LICENSE.md" %] |