mirror of
https://github.com/Oreolek/gamebookformat.git
synced 2024-04-25 13:49:23 +03:00
Changed name of format from debug to json.
This commit is contained in:
parent
43b6e93ea6
commit
ff60c5826b
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
|||
*~
|
||||
*.pyc
|
||||
test.debug
|
||||
test.json
|
||||
test.tex
|
||||
test.dot
|
||||
*.log
|
||||
|
@ -9,6 +9,7 @@ test.dot
|
|||
*.pdf
|
||||
examples/*.check
|
||||
examples/*.vcheck
|
||||
examples/*.json
|
||||
test.rtf
|
||||
*.out
|
||||
test.html
|
||||
|
|
18
Makefile
18
Makefile
|
@ -1,13 +1,13 @@
|
|||
examples=$(wildcard examples/*.gamebook)
|
||||
|
||||
all: rtf pdf html debug png txt
|
||||
all: rtf pdf html json png txt
|
||||
|
||||
rtf: $(examples:.gamebook=.rtf)
|
||||
tex: $(examples:.gamebook=.tex)
|
||||
pdf: $(examples:.gamebook=.pdf)
|
||||
html: $(examples:.gamebook=.html) examples/gamebookformatplay.js \
|
||||
examples/gamebookformat.css
|
||||
debug: $(examples:.gamebook=.debug)
|
||||
json: $(examples:.gamebook=.json)
|
||||
check: $(examples:.gamebook=.check)
|
||||
vcheck: $(examples:.gamebook=.vcheck)
|
||||
dot: $(examples:.gamebook=.dot)
|
||||
|
@ -38,13 +38,13 @@ examples/gamebookformat.css: gamebookformat.css
|
|||
%.dot: %.gamebook *.py templates/dot/*.dot
|
||||
python2.7 ./buildexamplegamebook.py $< $@
|
||||
|
||||
%.debug: %.gamebook *.py templates/debug/*.debug
|
||||
%.json: %.gamebook *.py templates/json/*.json
|
||||
python2.7 ./buildexamplegamebook.py $< $@
|
||||
|
||||
%.check: %.debug
|
||||
%.check: %.json
|
||||
python2.7 ./checkgamebook.py $< > $@ || true
|
||||
|
||||
%.vcheck: %.debug
|
||||
%.vcheck: %.json
|
||||
python2.7 ./checkgamebook.py -v $< > $@ || true
|
||||
|
||||
%.txt: %.gamebook *.py templates/txt/*.txt
|
||||
|
@ -58,12 +58,12 @@ examples/gamebookformat.css: gamebookformat.css
|
|||
|
||||
test: unittest checkexpected templatejstest
|
||||
|
||||
expected: rtf tex html debug txt dot map check vcheck
|
||||
expected: rtf tex html json txt dot map check vcheck
|
||||
$(RM) expected/* && \
|
||||
cp examples/*.{rtf,tex,html,debug,txt,dot,map,check,vcheck} \
|
||||
cp examples/*.{rtf,tex,html,json,txt,dot,map,check,vcheck} \
|
||||
expected
|
||||
|
||||
checkexpected: clean rtf tex html debug dot txt check vcheck
|
||||
checkexpected: clean rtf tex html json dot txt check vcheck
|
||||
diff -r -x "*.aux" -x "*.gamebook" -x "*.log" -x "*.out" -x "*.png" \
|
||||
-x "*.pdf" -x .gitignore -x "*.js" -x "*.css" \
|
||||
-x "*.options" -q examples expected
|
||||
|
@ -88,7 +88,7 @@ templatejstest:
|
|||
|
||||
clean:
|
||||
$(RM) examples/*rtf examples/*.html examples/*.tex \
|
||||
examples/*.txt examples/*.debug examples/*.check examples/*.log \
|
||||
examples/*.txt examples/*.json examples/*.check examples/*.log \
|
||||
examples/*.pdf examples/*.out *~ examples/*~ *.pyc examples/*.vcheck \
|
||||
examples/*.dot examples/*.aux examples/*.toc $(png) \
|
||||
$(map) templates/*~ templates/*/*~ \
|
||||
|
|
|
@ -33,8 +33,6 @@ import os.path
|
|||
import sys
|
||||
import json
|
||||
|
||||
USAGE = "usage: %prog [options] inputfile(s)... outputfile"
|
||||
|
||||
def find_section_nr_names(sections):
|
||||
section_nr_to_name = {}
|
||||
for section_name,section_contents in sections.iteritems():
|
||||
|
@ -118,7 +116,7 @@ if __name__ == '__main__':
|
|||
ap = argparse.ArgumentParser(
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument('inputfile', metavar='debugfile',
|
||||
help='input gamebook debug file (eg test.debug)')
|
||||
help='input gamebook JSON file (eg test.json)')
|
||||
ap.add_argument('-v', '--verbose', action='store_true',
|
||||
dest='verbose',
|
||||
help='verbose output')
|
||||
|
|
|
@ -50,7 +50,7 @@ This is the format-specific HTML section. Now you [[good][win]].
|
|||
* formatspecific :TXT:
|
||||
This is the format-specific TXT section. Now you [[good][win]].
|
||||
|
||||
*formatspecific :DOT:RTF:DEBUG:
|
||||
*formatspecific :DOT:RTF:JSON:
|
||||
This is the format-specific section for no other formats. Now you [[bad][lose]].
|
||||
|
||||
* good
|
||||
|
|
|
@ -19,7 +19,7 @@ You can also go to [[someotherplace]] but an angry troll
|
|||
is blocking your path and will only allow you to go there
|
||||
if you give it a [trade item]gold ring[/trade].
|
||||
|
||||
* other :TXT:DEBUG:TEX:DOT:RTF:
|
||||
* other :TXT:JSON:TEX:DOT:RTF:
|
||||
Now you have 50 less gold than you just had.
|
||||
You can go back to [[start]].
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
examples/bgg.debug: ending (death?) section found: end
|
||||
examples/bgg.json: ending (death?) section found: end
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
examples/codewords.debug: ending (death?) section found: the_end
|
||||
examples/codewords.debug: ending (death?) section found: cheater
|
||||
examples/codewords.json: ending (death?) section found: the_end
|
||||
examples/codewords.json: ending (death?) section found: cheater
|
||||
|
|
|
@ -1 +1 @@
|
|||
examples/counters.debug: ending (death?) section found: death
|
||||
examples/counters.json: ending (death?) section found: death
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
examples/format.debug: ending (death?) section found: good
|
||||
examples/format.debug: ending (death?) section found: bad
|
||||
examples/format.json: ending (death?) section found: good
|
||||
examples/format.json: ending (death?) section found: bad
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
examples/htmlbook.debug: ending (death?) section found: second
|
||||
examples/htmlbook.debug: ending (death?) section found: third
|
||||
examples/htmlbook.json: ending (death?) section found: second
|
||||
examples/htmlbook.json: ending (death?) section found: third
|
||||
|
|
|
@ -1 +1 @@
|
|||
examples/items.debug: ending (death?) section found: won
|
||||
examples/items.json: ending (death?) section found: won
|
||||
|
|
|
@ -1 +1 @@
|
|||
examples/itemslist.debug: ending (death?) section found: won
|
||||
examples/itemslist.json: ending (death?) section found: won
|
||||
|
|
|
@ -1 +1 @@
|
|||
examples/itemstaglist.debug: No start section found. Cancelling checks.
|
||||
examples/itemstaglist.json: No start section found. Cancelling checks.
|
||||
|
|
|
@ -1 +1 @@
|
|||
examples/itemstaglist.debug: No start section found. Cancelling checks.
|
||||
examples/itemstaglist.json: No start section found. Cancelling checks.
|
||||
|
|
|
@ -1 +1 @@
|
|||
examples/letter.debug: ending (death?) section found: start
|
||||
examples/letter.json: ending (death?) section found: start
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
examples/references.debug: ending (death?) section found: end
|
||||
examples/references.debug: ending (death?) section found: altend
|
||||
examples/references.json: ending (death?) section found: end
|
||||
examples/references.json: ending (death?) section found: altend
|
||||
|
|
|
@ -1 +1 @@
|
|||
examples/trade.debug: Could not reach section 'someotherplace' from start.
|
||||
examples/trade.json: Could not reach section 'someotherplace' from start.
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
examples/trade.debug: Could not reach section 'someotherplace' from start.
|
||||
examples/trade.debug: ending (death?) section found: theend
|
||||
examples/trade.json: Could not reach section 'someotherplace' from start.
|
||||
examples/trade.json: ending (death?) section found: theend
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
examples/unreachable.debug: Could not reach section 'nothere' from start.
|
||||
examples/unreachable.debug: Could not reach section 'nothereeither' from start.
|
||||
examples/unreachable.debug: Could not reach section 'secondfake' from start.
|
||||
examples/unreachable.json: Could not reach section 'nothere' from start.
|
||||
examples/unreachable.json: Could not reach section 'nothereeither' from start.
|
||||
examples/unreachable.json: Could not reach section 'secondfake' from start.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
examples/unreachable.debug: Could not reach section 'nothere' from start.
|
||||
examples/unreachable.debug: Could not reach section 'nothereeither' from start.
|
||||
examples/unreachable.debug: Could not reach section 'secondfake' from start.
|
||||
examples/unreachable.debug: ending (death?) section found: nothere
|
||||
examples/unreachable.debug: ending (death?) section found: here
|
||||
examples/unreachable.debug: ending (death?) section found: nothereeither
|
||||
examples/unreachable.debug: ending (death?) section found: secondfake
|
||||
examples/unreachable.json: Could not reach section 'nothere' from start.
|
||||
examples/unreachable.json: Could not reach section 'nothereeither' from start.
|
||||
examples/unreachable.json: Could not reach section 'secondfake' from start.
|
||||
examples/unreachable.json: ending (death?) section found: nothere
|
||||
examples/unreachable.json: ending (death?) section found: here
|
||||
examples/unreachable.json: ending (death?) section found: nothereeither
|
||||
examples/unreachable.json: ending (death?) section found: secondfake
|
||||
|
|
|
@ -1 +1 @@
|
|||
examples/withdemo.debug: ending (death?) section found: theend
|
||||
examples/withdemo.json: ending (death?) section found: theend
|
||||
|
|
|
@ -1 +1 @@
|
|||
examples/withmaps.debug: ending (death?) section found: end
|
||||
examples/withmaps.json: ending (death?) section found: end
|
||||
|
|
|
@ -1 +1 @@
|
|||
examples/withoutdemo.debug: Could not reach section 'demoinfo' from start.
|
||||
examples/withoutdemo.json: Could not reach section 'demoinfo' from start.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
examples/withoutdemo.debug: Could not reach section 'demoinfo' from start.
|
||||
examples/withoutdemo.debug: ending (death?) section found: theend
|
||||
examples/withoutdemo.debug: ending (death?) section found: altend
|
||||
examples/withoutdemo.json: Could not reach section 'demoinfo' from start.
|
||||
examples/withoutdemo.json: ending (death?) section found: theend
|
||||
examples/withoutdemo.json: ending (death?) section found: altend
|
||||
|
|
|
@ -55,7 +55,7 @@ OUTPUT_FORMATS = [
|
|||
of('dot', 'Graphviz section flowchart', quote.no),
|
||||
of('html', 'HTML+JS playable in browser', quote.html),
|
||||
of('txt', 'Plain text', quote.no),
|
||||
of('debug', 'Debug (JSON) Output', quote.js),
|
||||
of('json', 'JSON', quote.js),
|
||||
]
|
||||
|
||||
def make_supported_formats_list_string():
|
||||
|
|
|
@ -28,7 +28,7 @@ gamebook on paper or a screen (or for debugging it).
|
|||
| Graphviz DOT | .dot | Use with the [[http://www.graphviz.org][Graphviz]] dot tool to generate a flowchart graph of all sections in the gamebook. |
|
||||
| HTML | .html | Play gamebook in browser. |
|
||||
| Plain Text | .txt | Raw plain text without formatting. |
|
||||
| Debug JSON | .debug | [[http://json.org][JSON-formatted]] debug output of gamebook contents. |
|
||||
| JSON | .json | [[http://json.org][JSON-format]] for debugging |
|
||||
|
||||
More to be added. Custom output formats or modifications to the
|
||||
default formats can easily be added. Use the *-t* command-line
|
||||
|
@ -87,9 +87,9 @@ you like.
|
|||
** Check Gamebook
|
||||
The included *checkgamebook.py* script can be used to run tests
|
||||
on a book and warn about things that do not look right.
|
||||
To use it first generate a *debug* output file version of
|
||||
To use it first generate a *json* output file version of
|
||||
the book, using the same flags (eg include-tags) as when
|
||||
formatting the real book. Then run *checkgamebook.py bookname.debug*.
|
||||
formatting the real book. Then run *checkgamebook.py bookname.json*.
|
||||
Currently only tests that all sections can be reached, in theory,
|
||||
from the *start* section. It only looks for existing references,
|
||||
and has no idea for instance if a locked door can never be
|
||||
|
|
9
todo.org
9
todo.org
|
@ -1,4 +1,4 @@
|
|||
* TODO [64/93] [68%]
|
||||
* TODO [65/95] [68%]
|
||||
** DONE Debug output
|
||||
** DONE DOT output
|
||||
** DONE LaTeX output
|
||||
|
@ -83,7 +83,10 @@
|
|||
CLOSED: [2014-09-23 Tue 23:10]
|
||||
** DONE checkgamebook.py find unreachable sections
|
||||
CLOSED: [2014-09-23 Tue 23:10]
|
||||
** TODO JavaScript improved design/code for what links to enable
|
||||
** DONE Debug output should be called just JSON
|
||||
CLOSED: [2014-09-24 Wed 21:36]
|
||||
** TODO JavaScript improved design/code for what links to enable using JSON
|
||||
Rewrite HTML player to generate HTML from JSON dynamically.
|
||||
Many strange things can happen when clicking one link changes something
|
||||
that should now enable or disable some link. Instead of the current
|
||||
hacks all links should be re-calculated every time something have been
|
||||
|
@ -185,3 +188,5 @@ listed even if it is not tagged.
|
|||
Some tag that can be set on incomplete sections to trigger warnings
|
||||
as a reminder that the book is not done yet, and show you what
|
||||
sections remain to be written.
|
||||
** TODO Generic MAP section numbers substitution script
|
||||
Use generated MAP file to insert section numbers in any external file.
|
||||
|
|
Loading…
Reference in a new issue