Add rules for import and cleanup of CCEL books

parent 5d94926d
......@@ -21,8 +21,13 @@ $(BOOKBASE).md: $(LANGUAGE)/$(CCMBOOKCODE).md
$(BOOKBASE)-$(_processed).md: PANDOCFILTERS = --lua-filter=$(CASILEDIR)/pandoc-filters/withoutheadinglinks.lua
normalize_markdown_en: cleanup_gutenberg
normalize_markdown_en: cleanup_gutenberg cleanup_ccel
.PHONY: cleanup_gutenberg
cleanup_gutenberg: $(filter en/%,$(MARKDOWNSOURCES))
$(call munge,$^,$(PERL) $(PERLARGS) -i -pne 's!\[\]\{#[^#]+#Page_(\d+) \.x-ebookmaker-pageno\}![]{#page_\1 .print}!g',Fix Gutenberg ebook page number anchors)
$(call munge,$^,$(PERL) $(PERLARGS) -pne 's!\[\]\{#[^#]+?#Page_(\S+) \.x-ebookmaker-pageno\}![]{#page_\1 .print}!g',Fix Gutenberg ebook page number anchors)
.PHONY: cleanup_ccel
cleanup_ccel: $(filter en/%,$(MARKDOWNSOURCES))
$(call munge,$^,$(PERL) $(PERLARGS) -pne 's!\[\]\{#[^#}]+#[^}]*?Page_([^\s}]+) \.pb\}![]{#page_\1 .print}!g',Fix CCEL ebook page number anchors)
$(call munge,$^,$(PERL) $(PERLARGS) -pne 's!\[(\[\]\{[^}]*\})!\1\[!g',Unwrap CCEL ebook page number anchors from other markup)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment