Skip to content

Commit 17c9d41

Browse files
authored
Add pelican support (#744)
* add support for deploy attribute * improved `to_deploy` logic * test deploy/deploy-dir logic * revert elaborate example, create project to test deploy stuff programmatically * add pelican and rough draft theme * update pelican template, add example files * formatting * move pelican theme files * wip * format * sample source * halfway working pelican_default * lint * formatting * ignore Pelican type errors * 3.8 compatible typing * install pelican * add styling and background to pelican theme * bump copyright * fix styling * update stage_deployment * update pelican-theme * format
1 parent 1b7e8f5 commit 17c9d41

28 files changed

Lines changed: 3518 additions & 389 deletions

pelican-testing.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from pelican import Pelican
2+
from pelican.settings import configure_settings, DEFAULT_CONFIG
3+
from pretext.project import Project
4+
5+
config = DEFAULT_CONFIG
6+
config["PATH"] = "foobar-in"
7+
config["THEME"] = "pelican-ptx"
8+
config["OUTPUT_PATH"] = "foobar-out"
9+
config["RELATIVE_URLS"] = True
10+
config["TIMEZONE"] = "Etc/UTC"
11+
config["ARTICLE_PATHS"] = ["updates"]
12+
config["ARTICLE_SAVE_AS"] = "updates/{date:%Y%m%d}-{slug}.html"
13+
config["ARTICLE_URL"] = config["ARTICLE_SAVE_AS"]
14+
15+
p = Project.parse("new-pretext-project")
16+
root = p.get_target().source_element()
17+
for title_ele in root.iterdescendants("title"):
18+
config["SITENAME"] = title_ele.text
19+
break
20+
else:
21+
config["SITENAME"] = "My PreTeXt Project"
22+
for title_ele in root.iterdescendants("subtitle"):
23+
config["SITESUBTITLE"] = title_ele.text
24+
break
25+
26+
config["PTX_TARGETS"] = [
27+
(t.name.capitalize(), t.deploy_dir_path()) for t in p.deploy_targets()
28+
]
29+
30+
Pelican(configure_settings(config)).run()

0 commit comments

Comments
 (0)