initial commit
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
*~
|
||||
.*.swp
|
||||
.*.swo
|
||||
build/*
|
||||
.lock-waf_linux_build
|
||||
63
Main.tex
Normal file
63
Main.tex
Normal file
@@ -0,0 +1,63 @@
|
||||
% Title:
|
||||
% Author: Zoë A. Porter <afanen@afanen-writes.net>
|
||||
% Created: TIMESTAM
|
||||
% Last Modified: TIMESTAM
|
||||
% Rating:
|
||||
% Summary:
|
||||
%
|
||||
%
|
||||
|
||||
%% preamble
|
||||
|
||||
\documentclass[twoside, openright, 10pt, pdflatex]{memoir}
|
||||
|
||||
% use special colour tables for pdf output
|
||||
\ifpdf{}
|
||||
\usepackage{pdfcolmk}
|
||||
\fi{}
|
||||
|
||||
% paper size for pocket books
|
||||
\setstocksize{19cm}{12.5cm}
|
||||
\usepackage[paperwidth=12.5cm, paperheight=19cm]{geometry}
|
||||
|
||||
% all source code is UTF-8
|
||||
\usepackage{ucs}
|
||||
\usepackage[utf8x]{inputenc}
|
||||
|
||||
% allow import of images
|
||||
\usepackage{graphicx}
|
||||
|
||||
% use the ding font
|
||||
\usepackage{pifont}
|
||||
|
||||
% allow nicely formatted quotes
|
||||
\usepackage{quoting}
|
||||
|
||||
% print pretty fleurons on paragraph breaks
|
||||
\renewcommand{\pfbreakdisplay}{\ding{167}\quad{}\ding{167}\quad{}\ding{167}}
|
||||
|
||||
%% start of document
|
||||
|
||||
\begin{document}
|
||||
|
||||
% Make the title page
|
||||
\begin{titlingpage}
|
||||
\let\cleardoublepage\clearpage
|
||||
\title{<++>}
|
||||
\author{Zo\"{e} A. Porter}
|
||||
\titlePM{}
|
||||
\end{titlingpage}
|
||||
|
||||
% set the correctnumbering etc.
|
||||
\mainmatter{}
|
||||
\chapterstyle{novel}
|
||||
|
||||
% place chapters or story content here
|
||||
|
||||
% and the epologue here
|
||||
\backmatter{}
|
||||
\chapterstyle{dowding}
|
||||
|
||||
\end{document}
|
||||
|
||||
% vim: spelllang=en_gb:
|
||||
9
README.md
Normal file
9
README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# <Name-Of-Story>
|
||||
|
||||
> Version: 1.0.<YYDayOfYear>.<revision> \
|
||||
> Created By: Afanen <afanen@afanan-writes.net> \
|
||||
> Last Modified By: Afanen <afanen@afanan-writes.net>
|
||||
|
||||
## Description
|
||||
|
||||
|
||||
207
wscript
Normal file
207
wscript
Normal file
@@ -0,0 +1,207 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
# Created On: Tue 28 Aug 2012 11:44:05 CEST
|
||||
# Last Modified: Sun 08 Apr 2018 10:46:32 pm CEST
|
||||
# MAKEFILE for compiling LaTeX Files
|
||||
|
||||
VERSION='1.1.0'
|
||||
APPNAME='MAKEFILE FOR LaTeX'
|
||||
|
||||
top='.'
|
||||
out='build'
|
||||
chapterpath='./chapters'
|
||||
|
||||
# query the options that are possible outputs
|
||||
def options(ctx):
|
||||
ctx.add_option('--form',action='store',default='pdflatex',help='Specify the output format. Allowed values are: pdflatex, latex, htlatex, odt, epub, handlatex')
|
||||
ctx.add_option('--cover',action='store',default='images/cover.png',help='Specify an image as cover for ePubs.\nOnly works with --form=epub')
|
||||
ctx.add_option('--infile',action='store',help='Specify the tex file to use as input file.\nIf not given, all files in the top level directory will be compiled.')
|
||||
ctx.add_option('--css',action='store',default='css/epub.css',help='Specifiy a style sheet to design an ebook')
|
||||
ctx.add_option('--spellckpath',action='store',help='Specify the path in which to look for the content files for spellcheck.\nDefault is ./chapters',default=chapterpath);
|
||||
|
||||
# configure script
|
||||
def configure(ctx):
|
||||
# local functions to configure the selected element
|
||||
def find_tex_files(path):
|
||||
import os
|
||||
ret = []
|
||||
for name in os.listdir(path):
|
||||
if os.path.isfile(os.path.join(path,name)):
|
||||
if (name.endswith('.tex')) or (name.endswith('.ltx')):
|
||||
ret.append(name)
|
||||
return ret
|
||||
|
||||
def conf_tex(ctx):
|
||||
ctx.load('tex')
|
||||
|
||||
def conf_htlatex(ctx):
|
||||
ctx.find_program('mk4ht',var='TEX')
|
||||
ctx.env.TEXINPUT = ctx.path.abspath() + '//'
|
||||
|
||||
def conf_epub(ctx):
|
||||
ctx.find_program('pandoc',var='EPUB')
|
||||
ctx.env.TEXINPUT = ctx.path.abspath() + '//'
|
||||
|
||||
def conf_odt(ctx):
|
||||
ctx.find_program('pandoc',var='ODT')
|
||||
ctx.env.TEXINPUT = ctx.path.abspath() + '//'
|
||||
|
||||
def conf_handlatex(ctx):
|
||||
ctx.find_program('handlatex',var='TEX')
|
||||
ctx.env.TEXINPUT = ctx.path.abspath() + '//'
|
||||
|
||||
# define a structure to assign the functions to the parameters
|
||||
conf_output = {'pdflatex' : conf_tex,
|
||||
'latex' : conf_tex,
|
||||
'htlatex' : conf_htlatex,
|
||||
'odt' : conf_odt,
|
||||
'epub' : conf_epub,
|
||||
'handlatex' : conf_handlatex
|
||||
|
||||
}
|
||||
|
||||
# set the selected mode
|
||||
if ctx.options.form:
|
||||
ctx.env.FORM = ctx.options.form
|
||||
conf_output[ctx.env.FORM](ctx)
|
||||
else:
|
||||
ctx.fatal('Output format is not set!')
|
||||
|
||||
# set a cover image
|
||||
if ctx.options.cover:
|
||||
ctx.env.COVER = ctx.options.cover
|
||||
else:
|
||||
ctx.env.COVER = ''
|
||||
|
||||
# set the css style
|
||||
if ctx.options.css:
|
||||
ctx.env.CSS = ctx.options.css
|
||||
else:
|
||||
ctx.env.CSS = ''
|
||||
|
||||
# find the aspell program
|
||||
ctx.find_program('aspell',var='ASPELL')
|
||||
|
||||
# set a default path to look for spellck sources
|
||||
if ctx.options.spellckpath:
|
||||
ctx.env.SPELLCK = ctx.options.spellckpath
|
||||
|
||||
# Set a list of all files to use
|
||||
if ctx.options.infile:
|
||||
sf = []
|
||||
sf.append(ctx.options.infile)
|
||||
ctx.env.SOURCEFILES = sf
|
||||
else:
|
||||
ctx.env.SOURCEFILES = find_tex_files(top)
|
||||
|
||||
|
||||
def build(ctx):
|
||||
import os.path
|
||||
# metadata parameters
|
||||
def build_metadata(fileName,cover):
|
||||
ret = ''
|
||||
if os.path.isfile(fileName):
|
||||
ret += '--css="' + fileName + '"'
|
||||
if os.path.isfile(cover):
|
||||
ret += ' --epub-cover="' + cover + '"'
|
||||
|
||||
return ret
|
||||
|
||||
# local functions to control the build process
|
||||
def build_tex(ctx):
|
||||
import os
|
||||
for f in ctx.env.SOURCEFILES:
|
||||
ctx(features = 'tex',
|
||||
type = ctx.env.FORM,
|
||||
source = f,
|
||||
prompt = 0
|
||||
)
|
||||
if ctx.cmd == 'install':
|
||||
outExt = '.dvi'
|
||||
if ctx.env.FORM == 'pdflatex':
|
||||
outExt = '.pdf'
|
||||
fileName, fileExt = os.path.splitext(f)
|
||||
ctx.install_files('${PREFIX}',fileName + outExt)
|
||||
|
||||
def build_htlatex(ctx):
|
||||
for f in ctx.env.SOURCEFILES:
|
||||
ctx(rule='TEXINPUTS=${TEXINPUT}: ${TEX} ${FORM} ${SRC} >/dev/null',source=f)
|
||||
if ctx.cmd == 'install':
|
||||
fileName, fileExt = os.path.splitext(f)
|
||||
ctx.install_files('${PREFIX}',fileName + '.html')
|
||||
|
||||
def build_epub(ctx):
|
||||
import os
|
||||
for f in ctx.env.SOURCEFILES:
|
||||
if os.path.isfile(ctx.env.COVER) :
|
||||
ctx.env.META = build_metadata(ctx.path.find_resource(ctx.env.CSS).abspath(),ctx.path.find_resource(ctx.env.COVER).abspath())
|
||||
else:
|
||||
ctx.env.META = build_metadata(ctx.path.find_resource(ctx.env.CSS).abspath(),'')
|
||||
fileName, fileExt = os.path.splitext(f)
|
||||
ctx(rule='TEXINPUTS=${TEXINPUT}: ${EPUB} ${META} -t epub ${SRC} -o ${TGT} >/dev/null',source=f, target=fileName + '.epub')
|
||||
if ctx.cmd == 'install':
|
||||
ctx.install_files('${PREFIX}',fileName + '.epub')
|
||||
|
||||
def build_odt(ctx):
|
||||
import os
|
||||
for f in ctx.env.SOURCEFILES:
|
||||
fileName, fileExt = os.path.splitext(f)
|
||||
ctx(rule='TEXINPUTS=${TEXINPUT}: ${ODT} -t odt ${SRC} -o ${TGT} >/dev/null',source=f,
|
||||
target=fileName + '.odt')
|
||||
if ctx.cmd == 'install':
|
||||
ctx.install_files('${PREFIX}',fileName + '.odt')
|
||||
|
||||
def build_handlatex(ctx):
|
||||
import os
|
||||
for f in ctx.env.SOURCEFILES:
|
||||
ctx(rule='TEXINPUTS=${TEXINPUT}: ${TEX} ${SRC} >/dev/null && rm -f ../*.h*',source=f)
|
||||
if ctx.cmd == 'install':
|
||||
fileName, fileExt = os.path.splitext(f)
|
||||
ctx.install_files('${PREFIX}',fileName + outExt)
|
||||
|
||||
|
||||
# define a structure to assign the functions to the parameters
|
||||
build_output = {'pdflatex' : build_tex,
|
||||
'latex' : build_tex,
|
||||
'htlatex' : build_htlatex,
|
||||
'odt' : build_odt,
|
||||
'epub' : build_epub,
|
||||
'handlatex' : build_handlatex
|
||||
}
|
||||
|
||||
# call the configured build method
|
||||
build_output[ctx.env.FORM](ctx)
|
||||
|
||||
|
||||
# Custom command to spellcheck all
|
||||
def spellck(ctx):
|
||||
|
||||
# Search for all possible TEX files
|
||||
def find_tex_files(path):
|
||||
import os
|
||||
ret = []
|
||||
for root, dirs, files in os.walk(path):
|
||||
for name in files:
|
||||
if (name.endswith('.tex')) or (name.endswith('.ltx')):
|
||||
ret.append(os.path.join(root,name))
|
||||
return ret
|
||||
|
||||
# Set a list of input files to use
|
||||
if ctx.options.infile:
|
||||
sf = []
|
||||
sf.append(ctx.options.infile)
|
||||
ctx.env.SOURCEFILES = sf
|
||||
else :
|
||||
ctx.env.SOURCEFILES = find_tex_files(ctx.env.SPELLCK)
|
||||
|
||||
# run aspell
|
||||
from os import system
|
||||
for f in ctx.env.SOURCEFILES :
|
||||
system(ctx.env.ASPELL[0] + ' -c ' + f)
|
||||
system('rm ' + f + '.' +'bak')
|
||||
|
||||
# Class declarartion to bind the build context to the spellck command
|
||||
from waflib.Build import BuildContext
|
||||
class spck(BuildContext):
|
||||
cmd='spellck'
|
||||
fun='spellck'
|
||||
Reference in New Issue
Block a user