Last active
June 9, 2025 07:26
-
-
Save sudarkoff/3956724 to your computer and use it in GitHub Desktop.
Revisions
-
sudarkoff renamed this gist
Jan 9, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
sudarkoff revised this gist
Oct 26, 2012 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -62,3 +62,12 @@ $(BUILD_DIR)/%.html: %.markdown clean: @rm -rf $(BUILD_DIR) # EXPERIMENTAL! Publish to our corporate Wiki (using the script mwupdate) # WARNING! This is a one-way process, no changes are pulled from the wiki. # If you're now careful, you'll override somebody else's edits. # # Usage: make DocumentName.wiki # If the DocumentName page doesn't exist, it will be created. %.wiki: $(BUILD_DIR)/%.mediawiki @cat $< | mwupdate $(patsubst %.wiki,%,$@) -
sudarkoff created this gist
Oct 26, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,64 @@ BUILD_DIR := gen # pandoc is a handy tool for converting between numerous text formats: # http://johnmacfarlane.net/pandoc/installing.html PANDOC := pandoc # pandoc options # Liberation fonts: http://en.wikipedia.org/wiki/Liberation_fonts PANDOC_PDF_OPTS := --toc --chapters --base-header-level=1 --number-sections --template=virsto_doc.tex --variable mainfont="Liberation Serif" --variable sansfont="Liberation Sans" --variable monofont="Liberation Mono" --variable fontsize=12pt --variable documentclass=book PANDOC_EBOOK_OPTS := --toc --epub-stylesheet=epub.css --epub-cover-image=cover.jpg --base-header-level=1 # download kindlegen from http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211 KINDLEGEN := kindlegen KINDLEGEN_OPTS := MARKDOWN := $(wildcard *.markdown) PDF := $(patsubst %.markdown,$(BUILD_DIR)/%.pdf,$(MARKDOWN)) EBOOK := $(patsubst %.markdown,$(BUILD_DIR)/%.epub,$(MARKDOWN)) DOCX := $(patsubst %.markdown,$(BUILD_DIR)/%.docx,$(MARKDOWN)) WIKI := $(patsubst %.markdown,$(BUILD_DIR)/%.mediawiki,$(MARKDOWN)) HTML := $(patsubst %.markdown,$(BUILD_DIR)/%.html,$(MARKDOWN)) .PHONY: all checkdirs pdf ebook doc wiki html clean all: checkdirs $(PDF) $(EBOOK) $(DOCX) $(WIKI) $(HTML) checkdirs: $(BUILD_DIR) pdf: checkdirs $(PDF) ebook: checkdirs $(EBOOK) doc: checkdirs $(DOCX) wiki: checkdirs $(WIKI) html: checkdirs $(HTML) $(BUILD_DIR): @mkdir -p $@ # generate PDF $(BUILD_DIR)/%.pdf: %.markdown $(PANDOC) $(PANDOC_PDF_OPTS) --self-contained -o $@ $< # generate both iBooks (.epub) and then Kindle (.mobi) formats $(BUILD_DIR)/%.epub: %.markdown $(PANDOC) $(PANDOC_EBOOK_OPTS) --self-contained -o $@ $< $(KINDLEGEN) $(KINDLEGEN_OPTS) $@ > /dev/null # generate Microsoft Word documents (.docx) $(BUILD_DIR)/%.docx: %.markdown $(PANDOC) --self-contained -o $@ $< # generate files suitable for pasting into mediawiki $(BUILD_DIR)/%.mediawiki: %.markdown $(PANDOC) -t mediawiki --self-contained -o $@ $< # generate HTML files $(BUILD_DIR)/%.html: %.markdown $(PANDOC) --self-contained -o $@ $< clean: @rm -rf $(BUILD_DIR)