mirror of
https://github.com/Oreolek/gamebookformat.git
synced 2024-06-16 23:20:44 +03:00
Template for plain non-tagged text.
This commit is contained in:
parent
47a663e014
commit
6897e5e11a
15
expected/bgg.debug
Normal file
15
expected/bgg.debug
Normal file
|
@ -0,0 +1,15 @@
|
|||
BEGIN DEBUG OUTPUT
|
||||
Book title: Title of Game
|
||||
Number of sections: 4
|
||||
Introduction
|
||||
For information that goes before the actual numbered sections, if needed.
|
||||
More Introduction
|
||||
Any number of these optional pre-game sections are possible really. It would be useful to be able to do sub-sections here to mark up a complete rulebook as part of the paragraph booklet, but there is no such feature (yet?).
|
||||
|
||||
|
||||
Turn to 1 to begin.
|
||||
1 (start) - This is the first section (or paragraph, if you prefer). From here you can go to section 4 or 3.
|
||||
2 (end) - This is the end. There is nothing more in this gamebook.
|
||||
3 (third) - Third section. Again, its number is not known. You can go to the end at 2. This section has an image to show the syntax for doing that (same as images in bgg forums really). [IMG]testimage.png[/IMG]
|
||||
4 (second) - This is the second section. It may or may not end up with number 2 in the generated gamebook. From here you can skip to the 2 or go to the third section at 3.
|
||||
END DEBUG OUTPUT
|
10
expected/bgg.dot
Normal file
10
expected/bgg.dot
Normal file
|
@ -0,0 +1,10 @@
|
|||
digraph gamebook {
|
||||
|
||||
1->3
|
||||
|
||||
1->4
|
||||
3->2
|
||||
4->2
|
||||
|
||||
4->3
|
||||
}
|
115
expected/bgg.html
Normal file
115
expected/bgg.html
Normal file
|
@ -0,0 +1,115 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>Title of Game</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 = 'bgg';
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="hideintrolink nodisplay"
|
||||
onclick="gamebook.hideIntroSections()">(hide instructions)</div>
|
||||
<div class="gamebook">
|
||||
<div class="introsection">
|
||||
<div class="introsectionheading">Introduction</div>
|
||||
<div class="introsectionbody">
|
||||
For information that goes before the actual numbered sections, if needed.
|
||||
</div>
|
||||
</div>
|
||||
<div class="introsection">
|
||||
<div class="introsectionheading">More Introduction</div>
|
||||
<div class="introsectionbody">
|
||||
Any number of these optional pre-game sections are possible really. It would be useful to be able to do sub-sections here to mark up a complete rulebook as part of the paragraph booklet, but there is no such feature (yet?).
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
This is the first section (or paragraph, if you prefer). From here you can go to section <a class="sectionref enabledlink" data-ref="4"
|
||||
href="#section4">4</a> or <a class="sectionref enabledlink" data-ref="3"
|
||||
href="#section3">3</a>.
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
if (this.gamebook) {
|
||||
gamebook.addSection(1, document.getElementById('section1'));
|
||||
}
|
||||
</script><div class="section" id="section2">
|
||||
<div class="sectionnumber" id="para2">2</div>
|
||||
<div class="sectiontext">
|
||||
This is the end. There is nothing more in this gamebook.
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
if (this.gamebook) {
|
||||
gamebook.addSection(2, document.getElementById('section2'));
|
||||
}
|
||||
</script><div class="section" id="section3">
|
||||
<div class="sectionnumber" id="para3">3</div>
|
||||
<div class="sectiontext">
|
||||
Third section. Again, its number is not known. You can go to the end at <a class="sectionref enabledlink" data-ref="2"
|
||||
href="#section2">2</a>. This section has an image to show the syntax for doing that (same as images in bgg forums really). <img src="testimage.png" class="sectionimage"></img>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
if (this.gamebook) {
|
||||
gamebook.addSection(3, document.getElementById('section3'));
|
||||
}
|
||||
</script><div class="section" id="section4">
|
||||
<div class="sectionnumber" id="para4">4</div>
|
||||
<div class="sectiontext">
|
||||
This is the second section. It may or may not end up with number 2 in the generated gamebook. From here you can skip to the <a class="sectionref enabledlink" data-ref="2"
|
||||
href="#section2">2</a> or go to the third section at <a class="sectionref enabledlink" data-ref="3"
|
||||
href="#section3">3</a>.
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
if (this.gamebook) {
|
||||
gamebook.addSection(4, document.getElementById('section4'));
|
||||
}
|
||||
</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>
|
61
expected/bgg.rtf
Normal file
61
expected/bgg.rtf
Normal file
|
@ -0,0 +1,61 @@
|
|||
{\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 Title of Game
|
||||
\b0\
|
||||
\
|
||||
\b \qc Introduction
|
||||
\b0\
|
||||
|
||||
|
||||
|
||||
\ql For information that goes before the actual numbered sections, if needed. \
|
||||
\
|
||||
\
|
||||
\b \qc More Introduction
|
||||
\b0\
|
||||
|
||||
|
||||
|
||||
\ql Any number of these optional pre-game sections are possible really. It would be useful to be able to do sub-sections here to mark up a complete rulebook as part of the paragraph booklet, but there is no such feature (yet?). \
|
||||
\
|
||||
|
||||
\b Turn to 1 to begin.
|
||||
\b0\
|
||||
\
|
||||
\b \qc 1
|
||||
\b0\
|
||||
\ql This is the first section (or paragraph, if you prefer). From here you can go to section \b 4
|
||||
\b0
|
||||
or \b 3
|
||||
\b0
|
||||
. \
|
||||
\
|
||||
|
||||
\b \qc 2
|
||||
\b0\
|
||||
\ql This is the end. There is nothing more in this gamebook. \
|
||||
\
|
||||
|
||||
\b \qc 3
|
||||
\b0\
|
||||
\ql Third section. Again, its number is not known. You can go to the end at \b 2
|
||||
\b0
|
||||
. This section has an image to show the syntax for doing that (same as images in bgg forums really). testimage.png \
|
||||
\
|
||||
|
||||
\b \qc 4
|
||||
\b0\
|
||||
\ql This is the second section. It may or may not end up with number 2 in the generated gamebook. From here you can skip to the \b 2
|
||||
\b0
|
||||
or go to the third section at \b 3
|
||||
\b0
|
||||
. \
|
||||
\
|
||||
|
||||
}
|
87
expected/bgg.tex
Normal file
87
expected/bgg.tex
Normal file
|
@ -0,0 +1,87 @@
|
|||
\documentclass[a5paper,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{Title of Game}
|
||||
\author{Your Name}
|
||||
\date{}
|
||||
|
||||
\newcounter{sectionnr}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
|
||||
\thispagestyle{empty}
|
||||
|
||||
\pagestyle{empty}
|
||||
|
||||
\clearpage
|
||||
|
||||
\subsection*{\begin{center} \textbf{Introduction} \end{center}}
|
||||
|
||||
|
||||
\noindent
|
||||
For information that goes before the actual numbered sections, if needed.
|
||||
\vspace{1em}
|
||||
\subsection*{\begin{center} \textbf{More Introduction} \end{center}}
|
||||
|
||||
|
||||
\noindent
|
||||
Any number of these optional pre-game sections are possible really. It would be useful to be able to do sub-sections here to mark up a complete rulebook as part of the paragraph booklet, but there is no such feature (yet?).
|
||||
\vspace{1em}
|
||||
|
||||
|
||||
Turn to 1 to begin.
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
\label{section1}
|
||||
\subsection*{\begin{center} \textbf{1} \end{center}}
|
||||
|
||||
\noindent
|
||||
This is the first section (or paragraph, if you prefer). From here you can go to section \textbf{\autoref{section4}} or \textbf{\autoref{section3}}.
|
||||
\vspace{1em}
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
\label{section2}
|
||||
\subsection*{\begin{center} \textbf{2} \end{center}}
|
||||
|
||||
\noindent
|
||||
This is the end. There is nothing more in this gamebook.
|
||||
\vspace{1em}
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
\label{section3}
|
||||
\subsection*{\begin{center} \textbf{3} \end{center}}
|
||||
|
||||
\noindent
|
||||
Third section. Again, its number is not known. You can go to the end at \textbf{\autoref{section2}}. This section has an image to show the syntax for doing that (same as images in bgg forums really). \begin{center}
|
||||
\includegraphics[width=.9\textwidth]{testimage.png}
|
||||
\end{center}
|
||||
|
||||
|
||||
\vspace{1em}
|
||||
\phantomsection
|
||||
\refstepcounter{sectionnr}
|
||||
\label{section4}
|
||||
\subsection*{\begin{center} \textbf{4} \end{center}}
|
||||
|
||||
\noindent
|
||||
This is the second section. It may or may not end up with number 2 in the generated gamebook. From here you can skip to the \textbf{\autoref{section2}} or go to the third section at \textbf{\autoref{section3}}.
|
||||
\vspace{1em}
|
||||
\end{document}
|
23
expected/bgg.txt
Normal file
23
expected/bgg.txt
Normal file
|
@ -0,0 +1,23 @@
|
|||
Title of Game
|
||||
|
||||
Introduction
|
||||
For information that goes before the actual numbered sections, if needed.
|
||||
|
||||
More Introduction
|
||||
Any number of these optional pre-game sections are possible really. It would be useful to be able to do sub-sections here to mark up a complete rulebook as part of the paragraph booklet, but there is no such feature (yet?).
|
||||
|
||||
|
||||
|
||||
Turn to 1 to begin.
|
||||
1
|
||||
This is the first section (or paragraph, if you prefer). From here you can go to section 4 or 3.
|
||||
|
||||
2
|
||||
This is the end. There is nothing more in this gamebook.
|
||||
|
||||
3
|
||||
Third section. Again, its number is not known. You can go to the end at 2. This section has an image to show the syntax for doing that (same as images in bgg forums really). testimage.png
|
||||
|
||||
4
|
||||
This is the second section. It may or may not end up with number 2 in the generated gamebook. From here you can skip to the 2 or go to the third section at 3.
|
||||
|
|
@ -75,7 +75,7 @@ class OutputFormat (object):
|
|||
ref_start = section.text.find('[[', i)
|
||||
tag_start = section.text.find('[', i)
|
||||
if ref_start >= 0 and ref_start <= tag_start:
|
||||
res += self.quote(section.text[i:ref_start])
|
||||
res += self.format_text(section.text[i:ref_start])
|
||||
ref_end = section.text.find(']]', ref_start)
|
||||
if ref_end > ref_start:
|
||||
ref = section.text[ref_start+2:ref_end]
|
||||
|
@ -90,7 +90,7 @@ class OutputFormat (object):
|
|||
raise Exception('Mismatched ref start [[ in section %s' %
|
||||
self.name)
|
||||
elif tag_start >= 0:
|
||||
res += self.quote(section.text[i:tag_start])
|
||||
res += self.format_text(section.text[i:tag_start])
|
||||
tag_end = section.text.find(']', tag_start)
|
||||
if tag_end < 0:
|
||||
raise Exception('Mismatched tag start [ in section %s' %
|
||||
|
@ -123,10 +123,13 @@ class OutputFormat (object):
|
|||
res += self.quote(inner)
|
||||
i = section.text.find(']', end_tag_start) + 1
|
||||
else:
|
||||
res += self.quote(section.text[i:])
|
||||
res += self.format_text(section.text[i:])
|
||||
break
|
||||
return res
|
||||
|
||||
def format_text(self, text):
|
||||
return self.format_with_template('text', {'text' : self.quote(text)})
|
||||
|
||||
def format_empty_section(self, nr):
|
||||
return self.format_with_template("empty_section", {
|
||||
'nr' : nr,
|
||||
|
|
1
templates/DEFAULT/text.txt
Normal file
1
templates/DEFAULT/text.txt
Normal file
|
@ -0,0 +1 @@
|
|||
%(text)s
|
17
todo.org
17
todo.org
|
@ -1,4 +1,4 @@
|
|||
* TODO [52/75] [69%]
|
||||
* TODO [53/79] [67%]
|
||||
- [X] Debug output
|
||||
- [X] DOT output
|
||||
- [X] LaTeX output
|
||||
|
@ -68,10 +68,11 @@
|
|||
followed by cost tag to specify what it will cost, eg [cost gold]3[/cost]
|
||||
Implemented by adding cost to the old found tag (put cost tag after it).
|
||||
Might reconsider and make explicit buy tag for clarity?
|
||||
- [ ] Sell (optionally increase a counter to drop something from a collection)
|
||||
sell tag to specify what can be bought, eg [sell item]sword[/sell]
|
||||
followed by cost tag to specify what it will cost, eg [cost gold]2[/cost]
|
||||
Might want to wait with this and add normal drop function first?
|
||||
- [X] Add text template used for outputting non-tagged (plain) text.
|
||||
- [ ] Make debug output more useful with a stricter format easy to parse.
|
||||
- [ ] Add json output file containing sections, counters, collections etc.
|
||||
- [ ] Javascript GUI tests running in a browser
|
||||
Preferably headless (in nodejs?). Run tests on gamebook html example(s).
|
||||
- [ ] Trade decrease on counter to increase another counter.
|
||||
- [ ] Pick a specific number of things from those found in a(n intro) section
|
||||
Used to pick up one or more of something found, or before starting.
|
||||
|
@ -101,8 +102,6 @@
|
|||
The big scripts in html templates are split out into separate files
|
||||
already (script.html and endscript.html). It should be possible to
|
||||
test those from nodejs?
|
||||
- [ ] Javascript GUI tests running in a browser
|
||||
Preferably headless (in nodejs?). Run tests on gamebook html example(s).
|
||||
- [ ] Combat
|
||||
Tag to mark up the link to use to trigger next round.
|
||||
Tag to mark up the enemy and its values.
|
||||
|
@ -129,6 +128,10 @@
|
|||
- [ ] Higher level text-language for Gamebooks
|
||||
- [ ] BGG forum output (.bgg)
|
||||
- [ ] Verify gamebook
|
||||
- [ ] Sell (optionally increase a counter to drop something from a collection)
|
||||
sell tag to specify what can be bought, eg [sell item]sword[/sell]
|
||||
followed by cost tag to specify what it will cost, eg [cost gold]2[/cost]
|
||||
Might want to wait with this and add normal drop function first?
|
||||
- [ ] Dummy and fake sections (handle properly when verifying)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue