mirror of
https://github.com/Oreolek/gamebookformat.git
synced 2024-06-28 20:55:13 +03:00
Added -o to add format overrides from the options subdirectory.
This commit is contained in:
parent
03acdf1938
commit
2ce0cd6f6d
5
examples/letter.gamebook
Normal file
5
examples/letter.gamebook
Normal file
|
@ -0,0 +1,5 @@
|
|||
title = Letter
|
||||
* start
|
||||
LaTeX output (and this PDF output) from this book
|
||||
should be in letter size rather than the default A5 size
|
||||
(see command-line options used in letter.gamebook.options).
|
1
examples/letter.gamebook.options
Normal file
1
examples/letter.gamebook.options
Normal file
|
@ -0,0 +1 @@
|
|||
--option letter
|
8
expected/letter.debug
Normal file
8
expected/letter.debug
Normal file
|
@ -0,0 +1,8 @@
|
|||
BEGIN DEBUG OUTPUT
|
||||
Book title: Letter
|
||||
Number of sections: 1
|
||||
|
||||
|
||||
Turn to 1 to begin.
|
||||
1 (start) - LaTeX output (and this PDF output) from this book should be in letter size rather than the default A5 size (see command-line options used in letter.gamebook.options).
|
||||
END DEBUG OUTPUT
|
3
expected/letter.dot
Normal file
3
expected/letter.dot
Normal file
|
@ -0,0 +1,3 @@
|
|||
digraph gamebook {
|
||||
|
||||
}
|
68
expected/letter.html
Normal file
68
expected/letter.html
Normal file
|
@ -0,0 +1,68 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>Letter</title>
|
||||
<script type="text/javascript" src="gamebookformatplay.js"></script>
|
||||
<link rel="stylesheet" href="gamebookformat.css"
|
||||
type="text/css" />
|
||||
<script>
|
||||
if (typeof gamebook !== 'undefined') {
|
||||
gamebook.id = 'letter';
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="hideintrolink nodisplay"
|
||||
onclick="gamebook.hideIntroSections()">(hide instructions)</div>
|
||||
<div class="gamebook">
|
||||
|
||||
<div class="resumelink nodisplay"
|
||||
onclick="gamebook.loadGame()">Resume saved game.</div>
|
||||
|
||||
<div class="startlink"
|
||||
onclick="gamebook.turnTo(1)">Turn to 1 to begin.</div>
|
||||
<script>
|
||||
if (typeof gamebook !== 'undefined' && gamebook.hasSavedGame()) {
|
||||
var resumeLinks = document.getElementsByClassName('resumelink');
|
||||
Array.prototype.forEach.call(resumeLinks, function(e) {
|
||||
e.classList.remove('nodisplay');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<div class="section" id="section1">
|
||||
<div class="sectionnumber" id="para1">1</div>
|
||||
<div class="sectiontext">
|
||||
LaTeX output (and this PDF output) from this book should be in letter size rather than the default A5 size (see command-line options used in letter.gamebook.options).
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
if (this.gamebook) {
|
||||
gamebook.addSection(1, document.getElementById('section1'));
|
||||
}
|
||||
</script> <div id="counters" class="counters">
|
||||
</div>
|
||||
<div id="counterTemplate" class="counterTemplate">
|
||||
<span class="counterheading"></span>
|
||||
<span class="countercontents"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="collections" class="collections">
|
||||
</div>
|
||||
<div id="collectionTemplate" class="collectionTemplate">
|
||||
<span class="collectionheading"></span>
|
||||
<span class="collectioncontents"></span>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
if (typeof gamebook !== 'undefined') {
|
||||
gamebook.prepare();
|
||||
}
|
||||
</script>
|
||||
<div class="displayintrolink nodisplay"
|
||||
onclick="gamebook.showIntroSections()">(show instructions)</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
20
expected/letter.rtf
Normal file
20
expected/letter.rtf
Normal file
|
@ -0,0 +1,20 @@
|
|||
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360
|
||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\paperw11900\paperh16840\margl1440\margr1440\vieww14140\viewh14860\viewkind0
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
|
||||
|
||||
\f0\b\fs24 \cf0
|
||||
|
||||
\b \qc Letter
|
||||
\b0\
|
||||
|
||||
\b Turn to 1 to begin.
|
||||
\b0\
|
||||
\
|
||||
\b \qc 1
|
||||
\b0\
|
||||
\ql LaTeX output (and this PDF output) from this book should be in letter size rather than the default A5 size (see command-line options used in letter.gamebook.options). \
|
||||
\
|
||||
|
||||
}
|
46
expected/letter.tex
Normal file
46
expected/letter.tex
Normal file
|
@ -0,0 +1,46 @@
|
|||
\documentclass[letter,onecolumn]{book}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[hidelinks]{hyperref}
|
||||
\usepackage{graphicx}
|
||||
|
||||
\usepackage[top=3.3cm, bottom=3.3cm, left=2cm, right=2cm]{geometry}
|
||||
\newif\ifpdf
|
||||
\ifx\pdfoutput\undefined
|
||||
\pdffalse
|
||||
\else
|
||||
\ifnum\pdfoutput=1
|
||||
\pdftrue
|
||||
\else
|
||||
\pdffalse
|
||||
\fi
|
||||
\fi
|
||||
|
||||
\title{Letter}
|
||||
\author{}
|
||||
\date{}
|
||||
|
||||
\newcounter{sectionnr}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
|
||||
\thispagestyle{empty}
|
||||
|
||||
\pagestyle{empty}
|
||||
|
||||
\clearpage
|
||||
|
||||
|
||||
|
||||
Turn to 1 to begin.
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
\label{section1}
|
||||
\subsection*{\begin{center} \textbf{1} \end{center}}
|
||||
|
||||
\noindent
|
||||
LaTeX output (and this PDF output) from this book should be in letter size rather than the default A5 size (see command-line options used in letter.gamebook.options).
|
||||
\vspace{1em}
|
||||
\end{document}
|
8
expected/letter.txt
Normal file
8
expected/letter.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
Letter
|
||||
|
||||
|
||||
|
||||
Turn to 1 to begin.
|
||||
1
|
||||
LaTeX output (and this PDF output) from this book should be in letter size rather than the default A5 size (see command-line options used in letter.gamebook.options).
|
||||
|
|
@ -193,15 +193,22 @@ if __name__ == '__main__':
|
|||
help='ignore default map file')
|
||||
ap.add_argument('-t', '--template', metavar='D', dest='templatedirs',
|
||||
action='append', help='add custom template dir')
|
||||
ap.add_argument('-o', '--option', metavar='D', dest='optionsdirs',
|
||||
action='append', help='add template override options dir')
|
||||
ap.add_argument('-S', '--no-shuffle', action='store_false',
|
||||
dest='shuffle',
|
||||
help='do not shuffle sections')
|
||||
args = ap.parse_args()
|
||||
templatedirs = ['templates',
|
||||
os.path.join(os.path.dirname(sys.argv[0]), 'templates')]
|
||||
optionsbasedir = os.path.join(os.path.dirname(sys.argv[0]), 'options')
|
||||
if args.templatedirs:
|
||||
for t in args.templatedirs:
|
||||
templatedirs.insert(-2, t)
|
||||
if args.optionsdirs:
|
||||
for o in args.optionsdirs:
|
||||
print os.path.join(optionsbasedir, o)
|
||||
templatedirs.insert(-2, os.path.join(optionsbasedir, o))
|
||||
format_gamebook(args.inputfiles,
|
||||
args.outputfile,
|
||||
args.import_default_map_file,
|
||||
|
|
21
readme.org
21
readme.org
|
@ -15,6 +15,7 @@ gamebook on paper or a screen (or for debugging it).
|
|||
: -i T, --include T only include sections with tag
|
||||
: -M, --no-default-map ignore default map file
|
||||
: -t D, --template D add custom template dir
|
||||
: -o D, --option D add template override options dir
|
||||
: -S, --no-shuffle do not shuffle sections
|
||||
|
||||
** Supported Output Formats
|
||||
|
@ -28,7 +29,25 @@ gamebook on paper or a screen (or for debugging it).
|
|||
| Plain Text | .txt | Raw plain text without formatting. |
|
||||
| Debug Plain Text | .debug | Plain text debug output of gamebook contents. |
|
||||
|
||||
More to be added.
|
||||
More to be added. Custom output formats or modifications to the
|
||||
default formats can easily be added. Use the *-t* command-line
|
||||
option to add subdirectories containing new templates or
|
||||
overrides for default templates.
|
||||
|
||||
** Included Optional Templates
|
||||
|
||||
The *-o* command-line option is like *-t* but searches the *options*
|
||||
subdirectory (next to the default *templates* subdirectory) that
|
||||
contains useful overrides for some behavior of the default output
|
||||
formats. For example adding *-o letter* to the command-line will
|
||||
produce LaTeX files in Letter size rather than the default A5 size.
|
||||
|
||||
| Name | Formats | Description |
|
||||
|--------+---------+--------------------------------------|
|
||||
| a4 | tex | A4 paper size documents (PDF). |
|
||||
| a5 | tex | A5 paper size documents (PDF). |
|
||||
| letter | tex | Letter paper size documents (PDF). |
|
||||
| static | html | Remove script link from HTML output. |
|
||||
|
||||
** Gamebook Format
|
||||
|
||||
|
|
Loading…
Reference in a new issue