1
0
Fork 0
mirror of https://github.com/Oreolek/gamebookformat.git synced 2024-05-05 10:38:19 +03:00

Changed name of format from debug to json.

This commit is contained in:
Pelle Nilsson 2014-09-24 22:01:02 +02:00
parent 43b6e93ea6
commit ff60c5826b
73 changed files with 59 additions and 55 deletions

3
.gitignore vendored
View file

@ -1,6 +1,6 @@
*~ *~
*.pyc *.pyc
test.debug test.json
test.tex test.tex
test.dot test.dot
*.log *.log
@ -9,6 +9,7 @@ test.dot
*.pdf *.pdf
examples/*.check examples/*.check
examples/*.vcheck examples/*.vcheck
examples/*.json
test.rtf test.rtf
*.out *.out
test.html test.html

View file

@ -1,13 +1,13 @@
examples=$(wildcard examples/*.gamebook) examples=$(wildcard examples/*.gamebook)
all: rtf pdf html debug png txt all: rtf pdf html json png txt
rtf: $(examples:.gamebook=.rtf) rtf: $(examples:.gamebook=.rtf)
tex: $(examples:.gamebook=.tex) tex: $(examples:.gamebook=.tex)
pdf: $(examples:.gamebook=.pdf) pdf: $(examples:.gamebook=.pdf)
html: $(examples:.gamebook=.html) examples/gamebookformatplay.js \ html: $(examples:.gamebook=.html) examples/gamebookformatplay.js \
examples/gamebookformat.css examples/gamebookformat.css
debug: $(examples:.gamebook=.debug) json: $(examples:.gamebook=.json)
check: $(examples:.gamebook=.check) check: $(examples:.gamebook=.check)
vcheck: $(examples:.gamebook=.vcheck) vcheck: $(examples:.gamebook=.vcheck)
dot: $(examples:.gamebook=.dot) dot: $(examples:.gamebook=.dot)
@ -38,13 +38,13 @@ examples/gamebookformat.css: gamebookformat.css
%.dot: %.gamebook *.py templates/dot/*.dot %.dot: %.gamebook *.py templates/dot/*.dot
python2.7 ./buildexamplegamebook.py $< $@ python2.7 ./buildexamplegamebook.py $< $@
%.debug: %.gamebook *.py templates/debug/*.debug %.json: %.gamebook *.py templates/json/*.json
python2.7 ./buildexamplegamebook.py $< $@ python2.7 ./buildexamplegamebook.py $< $@
%.check: %.debug %.check: %.json
python2.7 ./checkgamebook.py $< > $@ || true python2.7 ./checkgamebook.py $< > $@ || true
%.vcheck: %.debug %.vcheck: %.json
python2.7 ./checkgamebook.py -v $< > $@ || true python2.7 ./checkgamebook.py -v $< > $@ || true
%.txt: %.gamebook *.py templates/txt/*.txt %.txt: %.gamebook *.py templates/txt/*.txt
@ -58,12 +58,12 @@ examples/gamebookformat.css: gamebookformat.css
test: unittest checkexpected templatejstest 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/* && \ $(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 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" \ diff -r -x "*.aux" -x "*.gamebook" -x "*.log" -x "*.out" -x "*.png" \
-x "*.pdf" -x .gitignore -x "*.js" -x "*.css" \ -x "*.pdf" -x .gitignore -x "*.js" -x "*.css" \
-x "*.options" -q examples expected -x "*.options" -q examples expected
@ -88,7 +88,7 @@ templatejstest:
clean: clean:
$(RM) examples/*rtf examples/*.html examples/*.tex \ $(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/*.pdf examples/*.out *~ examples/*~ *.pyc examples/*.vcheck \
examples/*.dot examples/*.aux examples/*.toc $(png) \ examples/*.dot examples/*.aux examples/*.toc $(png) \
$(map) templates/*~ templates/*/*~ \ $(map) templates/*~ templates/*/*~ \

View file

@ -33,8 +33,6 @@ import os.path
import sys import sys
import json import json
USAGE = "usage: %prog [options] inputfile(s)... outputfile"
def find_section_nr_names(sections): def find_section_nr_names(sections):
section_nr_to_name = {} section_nr_to_name = {}
for section_name,section_contents in sections.iteritems(): for section_name,section_contents in sections.iteritems():
@ -118,7 +116,7 @@ if __name__ == '__main__':
ap = argparse.ArgumentParser( ap = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument('inputfile', metavar='debugfile', 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', ap.add_argument('-v', '--verbose', action='store_true',
dest='verbose', dest='verbose',
help='verbose output') help='verbose output')

View file

@ -50,7 +50,7 @@ This is the format-specific HTML section. Now you [[good][win]].
* formatspecific :TXT: * formatspecific :TXT:
This is the format-specific TXT section. Now you [[good][win]]. 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]]. This is the format-specific section for no other formats. Now you [[bad][lose]].
* good * good

View file

@ -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 is blocking your path and will only allow you to go there
if you give it a [trade item]gold ring[/trade]. 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. Now you have 50 less gold than you just had.
You can go back to [[start]]. You can go back to [[start]].

View file

@ -1 +1 @@
examples/bgg.debug: ending (death?) section found: end examples/bgg.json: ending (death?) section found: end

View file

@ -1,2 +1,2 @@
examples/codewords.debug: ending (death?) section found: the_end examples/codewords.json: ending (death?) section found: the_end
examples/codewords.debug: ending (death?) section found: cheater examples/codewords.json: ending (death?) section found: cheater

View file

@ -1 +1 @@
examples/counters.debug: ending (death?) section found: death examples/counters.json: ending (death?) section found: death

View file

@ -1,2 +1,2 @@
examples/format.debug: ending (death?) section found: good examples/format.json: ending (death?) section found: good
examples/format.debug: ending (death?) section found: bad examples/format.json: ending (death?) section found: bad

View file

@ -1,2 +1,2 @@
examples/htmlbook.debug: ending (death?) section found: second examples/htmlbook.json: ending (death?) section found: second
examples/htmlbook.debug: ending (death?) section found: third examples/htmlbook.json: ending (death?) section found: third

View file

@ -1 +1 @@
examples/items.debug: ending (death?) section found: won examples/items.json: ending (death?) section found: won

View file

@ -1 +1 @@
examples/itemslist.debug: ending (death?) section found: won examples/itemslist.json: ending (death?) section found: won

View file

@ -1 +1 @@
examples/itemstaglist.debug: No start section found. Cancelling checks. examples/itemstaglist.json: No start section found. Cancelling checks.

View file

@ -1 +1 @@
examples/itemstaglist.debug: No start section found. Cancelling checks. examples/itemstaglist.json: No start section found. Cancelling checks.

View file

@ -1 +1 @@
examples/letter.debug: ending (death?) section found: start examples/letter.json: ending (death?) section found: start

View file

@ -1,2 +1,2 @@
examples/references.debug: ending (death?) section found: end examples/references.json: ending (death?) section found: end
examples/references.debug: ending (death?) section found: altend examples/references.json: ending (death?) section found: altend

View file

@ -1 +1 @@
examples/trade.debug: Could not reach section 'someotherplace' from start. examples/trade.json: Could not reach section 'someotherplace' from start.

View file

@ -1,2 +1,2 @@
examples/trade.debug: Could not reach section 'someotherplace' from start. examples/trade.json: Could not reach section 'someotherplace' from start.
examples/trade.debug: ending (death?) section found: theend examples/trade.json: ending (death?) section found: theend

View file

@ -1,3 +1,3 @@
examples/unreachable.debug: Could not reach section 'nothere' from start. examples/unreachable.json: Could not reach section 'nothere' from start.
examples/unreachable.debug: Could not reach section 'nothereeither' from start. examples/unreachable.json: Could not reach section 'nothereeither' from start.
examples/unreachable.debug: Could not reach section 'secondfake' from start. examples/unreachable.json: Could not reach section 'secondfake' from start.

View file

@ -1,7 +1,7 @@
examples/unreachable.debug: Could not reach section 'nothere' from start. examples/unreachable.json: Could not reach section 'nothere' from start.
examples/unreachable.debug: Could not reach section 'nothereeither' from start. examples/unreachable.json: Could not reach section 'nothereeither' from start.
examples/unreachable.debug: Could not reach section 'secondfake' from start. examples/unreachable.json: Could not reach section 'secondfake' from start.
examples/unreachable.debug: ending (death?) section found: nothere examples/unreachable.json: ending (death?) section found: nothere
examples/unreachable.debug: ending (death?) section found: here examples/unreachable.json: ending (death?) section found: here
examples/unreachable.debug: ending (death?) section found: nothereeither examples/unreachable.json: ending (death?) section found: nothereeither
examples/unreachable.debug: ending (death?) section found: secondfake examples/unreachable.json: ending (death?) section found: secondfake

View file

@ -1 +1 @@
examples/withdemo.debug: ending (death?) section found: theend examples/withdemo.json: ending (death?) section found: theend

View file

@ -1 +1 @@
examples/withmaps.debug: ending (death?) section found: end examples/withmaps.json: ending (death?) section found: end

View file

@ -1 +1 @@
examples/withoutdemo.debug: Could not reach section 'demoinfo' from start. examples/withoutdemo.json: Could not reach section 'demoinfo' from start.

View file

@ -1,3 +1,3 @@
examples/withoutdemo.debug: Could not reach section 'demoinfo' from start. examples/withoutdemo.json: Could not reach section 'demoinfo' from start.
examples/withoutdemo.debug: ending (death?) section found: theend examples/withoutdemo.json: ending (death?) section found: theend
examples/withoutdemo.debug: ending (death?) section found: altend examples/withoutdemo.json: ending (death?) section found: altend

View file

@ -55,7 +55,7 @@ OUTPUT_FORMATS = [
of('dot', 'Graphviz section flowchart', quote.no), of('dot', 'Graphviz section flowchart', quote.no),
of('html', 'HTML+JS playable in browser', quote.html), of('html', 'HTML+JS playable in browser', quote.html),
of('txt', 'Plain text', quote.no), of('txt', 'Plain text', quote.no),
of('debug', 'Debug (JSON) Output', quote.js), of('json', 'JSON', quote.js),
] ]
def make_supported_formats_list_string(): def make_supported_formats_list_string():

View file

@ -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. | | 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. | | HTML | .html | Play gamebook in browser. |
| Plain Text | .txt | Raw plain text without formatting. | | 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 More to be added. Custom output formats or modifications to the
default formats can easily be added. Use the *-t* command-line default formats can easily be added. Use the *-t* command-line
@ -87,9 +87,9 @@ you like.
** Check Gamebook ** Check Gamebook
The included *checkgamebook.py* script can be used to run tests The included *checkgamebook.py* script can be used to run tests
on a book and warn about things that do not look right. 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 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, Currently only tests that all sections can be reached, in theory,
from the *start* section. It only looks for existing references, from the *start* section. It only looks for existing references,
and has no idea for instance if a locked door can never be and has no idea for instance if a locked door can never be

View file

@ -1,4 +1,4 @@
* TODO [64/93] [68%] * TODO [65/95] [68%]
** DONE Debug output ** DONE Debug output
** DONE DOT output ** DONE DOT output
** DONE LaTeX output ** DONE LaTeX output
@ -83,7 +83,10 @@
CLOSED: [2014-09-23 Tue 23:10] CLOSED: [2014-09-23 Tue 23:10]
** DONE checkgamebook.py find unreachable sections ** DONE checkgamebook.py find unreachable sections
CLOSED: [2014-09-23 Tue 23:10] 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 Many strange things can happen when clicking one link changes something
that should now enable or disable some link. Instead of the current that should now enable or disable some link. Instead of the current
hacks all links should be re-calculated every time something have been 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 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 as a reminder that the book is not done yet, and show you what
sections remain to be written. sections remain to be written.
** TODO Generic MAP section numbers substitution script
Use generated MAP file to insert section numbers in any external file.