Loading .gitignore +4 −1 Original line number Diff line number Diff line README.html LAYOUT.html FAQ.html DESIGN.html *~ *.pyc _site README.html Makefile +7 −6 Original line number Diff line number Diff line Loading @@ -3,12 +3,17 @@ SRC_RMD = $(wildcard ??-*.Rmd) DST_RMD = $(patsubst %.Rmd,%.md,$(SRC_RMD)) # All Markdown files (hand-written and generated). SRC_MD = $(wildcard *.md) $(DST_RMD) ALL_MD = $(wildcard *.md) $(DST_RMD) EXCLUDE_MD = README.md LAYOUT.md FAQ.md DESIGN.md SRC_MD = $(filter-out $(EXCLUDE_MD),$(ALL_MD)) DST_HTML = $(patsubst %.md,%.html,$(SRC_MD)) # All outputs. DST_ALL = $(DST_HTML) # Pandoc filters. FILTERS = $(wildcard tools/filters/*.py) # Inclusions. INCLUDES = \ -Vheader="$$(cat _includes/header.html)" \ Loading @@ -32,7 +37,7 @@ motivation.html : motivation.md _layouts/slides.html -o $@ $< # Pattern to build a generic page. %.html : %.md _layouts/page.html %.html : %.md _layouts/page.html $(FILTERS) pandoc -s -t html \ --template=_layouts/page \ --filter=tools/filters/blockquote2div.py \ Loading Loading @@ -63,7 +68,3 @@ settings : ## clean : Clean up temporary and intermediate files. clean : @rm -rf $$(find . -name '*~' -print) # very-clean : Remove generated HTML. very-clean : @rm -f $(DST_MD) tools/filters/blockquote2div.py +1 −12 Original line number Diff line number Diff line Loading @@ -51,15 +51,6 @@ import pandocfilters as pf # trigger the blockquote to be converted to a div. SPECIAL_CLASSES = ['callout', 'challenge', 'prereq', 'objectives'] # These are titles of blockquotes that will cause the blockquote to # be converted into a div. They are 'title': 'class' pairs, where the # 'title' will create a blockquote with the corresponding 'class'. SPECIAL_TITLES = {'prerequisites': 'prereq', 'learning objectives': 'objectives', 'objectives': 'objectives', 'challenge': 'challenge', 'callout': 'callout'} def find_header(blockquote): """Find attributes in a blockquote if they are defined on a Loading Loading @@ -104,9 +95,7 @@ def blockquote2div(key, value, format, meta): id, classes, kvs = attr lowercase_title = pf.stringify(inlines).lower() if lowercase_title in SPECIAL_TITLES: classes.append(SPECIAL_TITLES[lowercase_title]) ltitle = pf.stringify(inlines).lower() if len(classes) == 1 and classes[0] in SPECIAL_CLASSES: remove_attributes(blockquote) Loading Loading
.gitignore +4 −1 Original line number Diff line number Diff line README.html LAYOUT.html FAQ.html DESIGN.html *~ *.pyc _site README.html
Makefile +7 −6 Original line number Diff line number Diff line Loading @@ -3,12 +3,17 @@ SRC_RMD = $(wildcard ??-*.Rmd) DST_RMD = $(patsubst %.Rmd,%.md,$(SRC_RMD)) # All Markdown files (hand-written and generated). SRC_MD = $(wildcard *.md) $(DST_RMD) ALL_MD = $(wildcard *.md) $(DST_RMD) EXCLUDE_MD = README.md LAYOUT.md FAQ.md DESIGN.md SRC_MD = $(filter-out $(EXCLUDE_MD),$(ALL_MD)) DST_HTML = $(patsubst %.md,%.html,$(SRC_MD)) # All outputs. DST_ALL = $(DST_HTML) # Pandoc filters. FILTERS = $(wildcard tools/filters/*.py) # Inclusions. INCLUDES = \ -Vheader="$$(cat _includes/header.html)" \ Loading @@ -32,7 +37,7 @@ motivation.html : motivation.md _layouts/slides.html -o $@ $< # Pattern to build a generic page. %.html : %.md _layouts/page.html %.html : %.md _layouts/page.html $(FILTERS) pandoc -s -t html \ --template=_layouts/page \ --filter=tools/filters/blockquote2div.py \ Loading Loading @@ -63,7 +68,3 @@ settings : ## clean : Clean up temporary and intermediate files. clean : @rm -rf $$(find . -name '*~' -print) # very-clean : Remove generated HTML. very-clean : @rm -f $(DST_MD)
tools/filters/blockquote2div.py +1 −12 Original line number Diff line number Diff line Loading @@ -51,15 +51,6 @@ import pandocfilters as pf # trigger the blockquote to be converted to a div. SPECIAL_CLASSES = ['callout', 'challenge', 'prereq', 'objectives'] # These are titles of blockquotes that will cause the blockquote to # be converted into a div. They are 'title': 'class' pairs, where the # 'title' will create a blockquote with the corresponding 'class'. SPECIAL_TITLES = {'prerequisites': 'prereq', 'learning objectives': 'objectives', 'objectives': 'objectives', 'challenge': 'challenge', 'callout': 'callout'} def find_header(blockquote): """Find attributes in a blockquote if they are defined on a Loading Loading @@ -104,9 +95,7 @@ def blockquote2div(key, value, format, meta): id, classes, kvs = attr lowercase_title = pf.stringify(inlines).lower() if lowercase_title in SPECIAL_TITLES: classes.append(SPECIAL_TITLES[lowercase_title]) ltitle = pf.stringify(inlines).lower() if len(classes) == 1 and classes[0] in SPECIAL_CLASSES: remove_attributes(blockquote) Loading