mirror of
https://github.com/Oreolek/gamebookformat.git
synced 2024-06-26 03:41:04 +03:00
Added simple HTML output support.
This commit is contained in:
parent
f01eb0a3f3
commit
bdc101a6db
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -9,4 +9,5 @@ test.dot
|
|||
*.pdf
|
||||
test.rtf
|
||||
*.png
|
||||
*.out
|
||||
*.out
|
||||
test.html
|
||||
|
|
|
@ -28,6 +28,8 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
"""
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import json
|
||||
|
||||
|
@ -37,6 +39,7 @@ from output import OutputFormat
|
|||
from latex import LatexFormat
|
||||
from rtf import RtfFormat
|
||||
from dot import DotFormat
|
||||
from html import HtmlFormat
|
||||
from debug import DebugFormat
|
||||
|
||||
USAGE = "usage: %prog [options] inputfile(s)... outputfile"
|
||||
|
@ -44,6 +47,7 @@ USAGE = "usage: %prog [options] inputfile(s)... outputfile"
|
|||
OUTPUT_FORMATS = [LatexFormat(),
|
||||
RtfFormat(),
|
||||
DotFormat(),
|
||||
HtmlFormat(),
|
||||
DebugFormat()]
|
||||
|
||||
def make_supported_formats_list_string():
|
||||
|
|
6
html.py
Normal file
6
html.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from output import OutputFormat
|
||||
|
||||
class HtmlFormat (OutputFormat):
|
||||
def __init__(self):
|
||||
super(HtmlFormat, self).__init__('html',
|
||||
'HTML+JS playable in browser')
|
11
output_formats/html/begin.html
Normal file
11
output_formats/html/begin.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Gamebook Title Here</title>
|
||||
<script>
|
||||
// inline js to make it easier to distribute book?
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- TODO definitely need to add content here, but mostly book specific? -->
|
||||
|
2
output_formats/html/end.html
Normal file
2
output_formats/html/end.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
</body>
|
||||
</html>
|
5
output_formats/html/paragraph.html
Normal file
5
output_formats/html/paragraph.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<div class="paragraph">
|
||||
<span class="paragraphnumber" id="para%(nr)d">%(nr)d</span>
|
||||
-
|
||||
%(text)s
|
||||
</div>
|
1
output_formats/html/paragraph_ref.html
Normal file
1
output_formats/html/paragraph_ref.html
Normal file
|
@ -0,0 +1 @@
|
|||
<a href="#para%(nr)d">%(nr)d</a>
|
|
@ -35,9 +35,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
| Name | Extension | Description |
|
||||
|------------------+-----------+-------------------------------------------------------------------------------------------------|
|
||||
| LaTeX | .tex | Useful to generate PDFs using pdflatex. |
|
||||
| LaTeX | .tex | Useful to generate PDFs using pdflatex or whatever LaTeX tools you prefer. |
|
||||
| Rich Text Format | .rtf | Supported because the Windhammer Prize requires it. |
|
||||
| Graphviz DOT | .dot | Use with the Graphviz dot tool to generate a flowchart graph of all paragraphs in the gamebook. |
|
||||
| HTML | .html | Play gamebook in browser. javascript to make fully playable not yet implemented. |
|
||||
| Debug Plain Text | .debug | Plain text debug output of gamebook contents. |
|
||||
|
||||
More to be added.
|
||||
|
|
6
test.sh
6
test.sh
|
@ -9,6 +9,10 @@ dot -Tpng test.dot > test.png && open test.png
|
|||
./formatgamebook.py test.json test.tex
|
||||
pdflatex test.tex && open test.pdf
|
||||
|
||||
#./formatgamebook.py test.json test.rtf
|
||||
./formatgamebook.py test.json test.html
|
||||
open test.html
|
||||
|
||||
./formatgamebook.py test.json test.rtf
|
||||
open test.rtf
|
||||
|
||||
|
||||
|
|
12
todo.org
12
todo.org
|
@ -1,19 +1,23 @@
|
|||
* TODO [3/12] [25%]
|
||||
* TODO [5/15] [33%]
|
||||
- [X] Debug output
|
||||
- [X] DOT output
|
||||
- [X] LaTeX output
|
||||
- [ ] RTF output
|
||||
- [ ] HTML+JS output
|
||||
- [ ] Debug HTML+JS output
|
||||
- [X] RTF output
|
||||
- [X] HTML output
|
||||
- [ ] Save paragraph-number mapping and reuse automatically
|
||||
- [ ] Add support for custom begin/end document templates.
|
||||
Fixed names and/or command-line options.
|
||||
- [ ] Add paragraph links in LaTeX output.
|
||||
- [ ] Debug HTML output
|
||||
- [ ] Inventory (take, drop, check)
|
||||
- [ ] Codewords/Sightings (set, check, clean)
|
||||
- [ ] Skill checks? Or is this higher level? No?
|
||||
- [ ] More formatting possibilities in paragraphs
|
||||
Look at existing gamebooks to get ideas.
|
||||
- [ ] Prettier LaTeX output
|
||||
Look at how some existing gamebooks are formatted.
|
||||
- [ ] Command-line flag to set max paragraph number to use
|
||||
- [ ] Dummy paragraphs
|
||||
- [ ] Combat? Or is this higher level?
|
||||
- [ ] Document Gamebook JSON format.
|
||||
- [ ] Higher level text-language for Gamebooks
|
||||
|
|
Loading…
Reference in a new issue