From 1d18a15e760ede506119712090f49243882e84e2 Mon Sep 17 00:00:00 2001 From: Michael Murtaugh Date: Sat, 29 Nov 2014 09:08:55 +0100 Subject: [PATCH] updates --- cgi-bin/settings.py | 4 +-- projects/sample/README.md | 9 +++++++ projects/sample/makefile | 51 ++++++++++++++++++++++++++++++++++++ projects/sample/metadata.txt | 6 +++++ projects/sample/styles.css | 48 +++++++++++++++++++++++++++++++++ 5 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 projects/sample/README.md create mode 100644 projects/sample/makefile create mode 100644 projects/sample/metadata.txt create mode 100644 projects/sample/styles.css diff --git a/cgi-bin/settings.py b/cgi-bin/settings.py index af90310..8f2e2d4 100644 --- a/cgi-bin/settings.py +++ b/cgi-bin/settings.py @@ -1,9 +1,9 @@ PANDOC = "pandoc" EPUB_PATH = None MAKE = "make" -MAKEFILE = "/home/murtaugh/projects/DPT/hybrideditor/cgi-bin/makefile" +MAKEFILE = None PROJECT_PATH = "./projects" PROJECT_URL = "/projects/" # must end with / EDITOR_URL = "/cgi-bin/hype.cgi" -SAMPLE_PROJECT_PATH = "projects/sample" \ No newline at end of file +SAMPLE_PROJECT_PATH = "projects/sample" diff --git a/projects/sample/README.md b/projects/sample/README.md new file mode 100644 index 0000000..f9c54a8 --- /dev/null +++ b/projects/sample/README.md @@ -0,0 +1,9 @@ +How to create a simple EPUB +=========================== + +* Drag in files in either saved in the DOCX (.docx) or Markdown (.md) format. +* Gray links will appear for conversion. +* Click on the publication.epub to create it. + +The _styles.css_ file is the main stylesheet of the EPUB. + diff --git a/projects/sample/makefile b/projects/sample/makefile new file mode 100644 index 0000000..4c01336 --- /dev/null +++ b/projects/sample/makefile @@ -0,0 +1,51 @@ +# +# DEVELOPERS: +# +# This is the projects makefile +# It determines how source files get converted +# into an EPUB + +# You can change this file to adjust the process +# and add new outputs. + +DOCX=$(shell ls *.docx) +DOCX_MD = $(DOCX:%.docx=%.md) +scripts=/usr/lib/cgi-bin +sources=$(shell python $(scripts)/sources.py) + +all: publication.epub publication.icml publication.gif + +publication.epub: metadata.txt publication.md styles.css + pandoc metadata.txt publication.md \ + --table-of-contents \ + --epub-stylesheet styles.css \ + -o publication.epub + +publication.icml: publication.md styles.css + pandoc publication.md --to ICML -o publication.icml + +# Concatenate all Markdown sources into a single file +# Adding the filename as a unique identifier for footnotes +#publication.md: $(sources) +# cat $(sources) > publication.md + +publication.gif: publication.epub styles.css + python $(scripts)/epubtrailer.py $< --background "#EEEEEE" --width 320 --height 240 --duration=0.5 -o $@ + +publication.md: metadata.txt $(sources) $(DOCX_MD) + rm -f $@ + cat metadata.txt > $@ + $(foreach c,$(sources),pandoc --to markdown --id-prefix=$(c) $(c) >> $@; echo >> $@; echo >> $@;) + echo "The End" >> $@ + + # cat metadata.txt >> $@ + # $(scripts)/expand_toc.py toc.md --filter $(scripts)/chapter.sh | \ + # python $(scripts)/enable_links_markdown.py >> $@ + +# MARKDOWN <= DOCX +%.md: %.docx + pandoc $< -o $@ + +# special rule for debugging variable names in this makefile +print-%: + @echo '$*=$($*)' diff --git a/projects/sample/metadata.txt b/projects/sample/metadata.txt new file mode 100644 index 0000000..80ebd4e --- /dev/null +++ b/projects/sample/metadata.txt @@ -0,0 +1,6 @@ +--- +title: Title of book +author: Luther Blisset +rights: Creative Commons Non-Commercial Share Alike 3.0 +language: en-UK +... diff --git a/projects/sample/styles.css b/projects/sample/styles.css new file mode 100644 index 0000000..bc3040f --- /dev/null +++ b/projects/sample/styles.css @@ -0,0 +1,48 @@ +/* +This is the projects style sheet. +You can control the visual properties of your EPUB here. +*/ + +body { + margin: 5%; + text-align: justify; + font-size: medium; + font-family: sans-serif; +} + +h1,h2,h3,h4,h5 { + font-family: sans-serif; + font-weight: bold; + font-style: normal; +} + +code { font-family: monospace; } +h1 { text-align: left; } +h2 { text-align: left; } +h3 { text-align: left; } +h4 { text-align: left; } +h5 { text-align: left; } +h6 { text-align: left; } + +a { + color: black; + text-decoration: none; + border-bottom: 1px dotted blue; +} + +a.footnoteRef, a.footnote_backlink { + padding: 2px; + font-size: 60%; + border-bottom: 1px dotted blue; + margin-left: 0.5em; + margin-right: 0.5em; + position: relative; + top: -0.1em; + color: blue; + white-space: nowrap; +} + +a +#cover-image img { + max-width: 100%; +} \ No newline at end of file