From df7ea9838a0061c7bd912c76b5f704aef3f22646 Mon Sep 17 00:00:00 2001 From: Pelle Nilsson Date: Fri, 28 Feb 2014 22:59:10 +0100 Subject: [PATCH] Added test for listing only sections with some tag. Noted that unfortunately a missingto setting is required for this to work, and the missingto section will be included in the list. Not ideal perhaps for things like listening todo-tagged sections. --- examples/itemstaglist.gamebook | 87 +++++++++++++++++++++ examples/itemstaglist.gamebook.options | 1 + expected/itemstaglist.debug | 11 +++ expected/itemstaglist.dot | 4 + expected/itemstaglist.html | 101 +++++++++++++++++++++++++ expected/itemstaglist.rtf | 41 ++++++++++ expected/itemstaglist.tex | 67 ++++++++++++++++ expected/itemstaglist.txt | 3 + todo.org | 6 +- 9 files changed, 320 insertions(+), 1 deletion(-) create mode 100644 examples/itemstaglist.gamebook create mode 100644 examples/itemstaglist.gamebook.options create mode 100644 expected/itemstaglist.debug create mode 100644 expected/itemstaglist.dot create mode 100644 expected/itemstaglist.html create mode 100644 expected/itemstaglist.rtf create mode 100644 expected/itemstaglist.tex create mode 100644 expected/itemstaglist.txt diff --git a/examples/itemstaglist.gamebook b/examples/itemstaglist.gamebook new file mode 100644 index 0000000..438f30d --- /dev/null +++ b/examples/itemstaglist.gamebook @@ -0,0 +1,87 @@ +title = Items +author = Pelle Nilsson +missingto = end_todo + += Info +This file is for testing the list option. +This section should not be listed. +Using the options given in the options file for this gamebook, +only the sections tagged as todo will be listed. + +* 1 start +Demonstrating how to manage player [collect item]Inventory[/collect]. +You start +the book carrying a [add item]sword[/add] +and a [add item]shield[/add]. +Turn to [[tjunction]] or go to the autotest at [[autotest]]. + +* tjunction :todo: +(This section needs some work!) +Here you find a [found item]key[/found] +and a [found item]stick[/found]. +You can go west to [[door]], or +east to [[curse]]. + +* door +There is a locked door here. +If you have a [has item]key[/has] you can use that to +open the door, see [[inside]]. Being right before the link +should be enough for the formatter to figure out that the +key is required to be allowed to follow the link. +Else you can try to open with the [has item]sword[/has], +if you have it, see [[attempt_break_door_with_sword]]. +Hopefully the magic is good enough to pair +pre-conditions to links, or more markup must be added later. +You could also try to go back to pick up the key, see [[tjunction]]. + +* attempt_break_door_with_sword +OK. The door is broken, but so is the [drop item]sword[/drop]. +Turn to [[inside]]. + +* curse :todo: +Need to write this section. +Sorry for it being a dead-end for now. + +* drop_stick +OK [drop item]stick[/drop] dropped. Turn back to [[tjunction]] to confirm +stick can not be picked up again even if the text says it is there +(books work that way, although ideally this dynamic version should +provide some hints that it is no longer there). + +* portal +A magic portal ahead will only allow you to pass if you did not pick up the +[hasnot item]cursed bracelet[/hasnot], leading you to [[treasure]]. +If you have the [has item]cursed bracelet[/has] +you have to go back to [[tjunction]] instead. +Actually feel free to head back to [[tjunction]] either way. + +* treasure +You found [found item]something valuable[/found], but there is no way forward, +so you head back to [[tjunction]]. + +* inside +There is a rope here that can be cut using a [has item]sword[/has]. +If you have one and want to do that, see [[cut_rope]]. +You can also run to the autotest at [[autotest]]. +Otherwise turn to [[won]]. + +* cut_rope +OK. That was fun. Turn to [[won]]. + +* won +Congratulations, you won. +* autotest +If you have the [has item]stick[/has] then you must turn +immediately to [[auto tjunction]], and everything else in this +section is ignored. You find a [add item]book[/add] here. +If you have the [has item]sword[/has] you must turn +immediately to [[auto inside]], again ignoring everything +that follows. You drop the [drop item]something valuable[/drop] +here if you have it, then go on to [[portal]]. + +* end_todo :todo: +There has to be a section set as missingto (ie this section), otherwise +generating a list with only todo sections will fail (as one of them +references non-todo sections). Unfortunate side-effect is that this +section will always be included in the list. +TODO figure out some fix for this. \ No newline at end of file diff --git a/examples/itemstaglist.gamebook.options b/examples/itemstaglist.gamebook.options new file mode 100644 index 0000000..d71bd05 --- /dev/null +++ b/examples/itemstaglist.gamebook.options @@ -0,0 +1 @@ +--option list --include todo \ No newline at end of file diff --git a/expected/itemstaglist.debug b/expected/itemstaglist.debug new file mode 100644 index 0000000..f092cea --- /dev/null +++ b/expected/itemstaglist.debug @@ -0,0 +1,11 @@ +BEGIN DEBUG OUTPUT +Book title: Items +Number of sections: 3 +Info + This file is for testing the list option. This section should not be listed. Using the options given in the options file for this gamebook, only the sections tagged as todo will be listed. + +Turn to 1 to begin. +1 (end_todo) - There has to be a section set as missingto (ie this section), otherwise generating a list with only todo sections will fail (as one of them references non-todo sections). Unfortunate side-effect is that this section will always be included in the list. TODO figure out some fix for this. +2 (curse) - Need to write this section. Sorry for it being a dead-end for now. +3 (tjunction) - (This section needs some work!) Here you find a [FOUND item]key[/FOUND] and a [FOUND item]stick[/FOUND]. You can go west to 1, or east to 2. +END DEBUG OUTPUT diff --git a/expected/itemstaglist.dot b/expected/itemstaglist.dot new file mode 100644 index 0000000..a35e51c --- /dev/null +++ b/expected/itemstaglist.dot @@ -0,0 +1,4 @@ +digraph gamebook { + 3->1 +3->2 +} diff --git a/expected/itemstaglist.html b/expected/itemstaglist.html new file mode 100644 index 0000000..6cf59f0 --- /dev/null +++ b/expected/itemstaglist.html @@ -0,0 +1,101 @@ + + + + + + Items + + + + + + +
+
+
Info
+
+ This file is for testing the list option. This section should not be listed. Using the options given in the options file for this gamebook, only the sections tagged as todo will be listed. +
+
+ + + + +
+
1
+
+ There has to be a section set as missingto (ie this section), otherwise generating a list with only todo sections will fail (as one of them references non-todo sections). Unfortunate side-effect is that this section will always be included in the list. TODO figure out some fix for this. +
+
+
+
2
+
+ Need to write this section. Sorry for it being a dead-end for now. +
+
+
+
3
+
+ (This section needs some work!) Here you find a key + and a stick +. You can go west to 1, or east to 2. +
+
+
+
+
+ + +
+
+
+
+
+ + +
+ + + + + + diff --git a/expected/itemstaglist.rtf b/expected/itemstaglist.rtf new file mode 100644 index 0000000..f2c7745 --- /dev/null +++ b/expected/itemstaglist.rtf @@ -0,0 +1,41 @@ +{\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 Items +\b0\ +\ +\b \qc Info +\b0\ + + + +\ql This file is for testing the list option. This section should not be listed. Using the options given in the options file for this gamebook, only the sections tagged as todo will be listed. \ +\ +\b Turn to 1 to begin. +\b0\ +\ +\b \qc 1 +\b0\ +\ql There has to be a section set as missingto (ie this section), otherwise generating a list with only todo sections will fail (as one of them references non-todo sections). Unfortunate side-effect is that this section will always be included in the list. TODO figure out some fix for this. \ +\ + +\b \qc 2 +\b0\ +\ql Need to write this section. Sorry for it being a dead-end for now. \ +\ + +\b \qc 3 +\b0\ +\ql (This section needs some work!) Here you find a key and a stick. You can go west to \b 1 +\b0 +, or east to \b 2 +\b0 +. \ +\ + +} diff --git a/expected/itemstaglist.tex b/expected/itemstaglist.tex new file mode 100644 index 0000000..78b04cc --- /dev/null +++ b/expected/itemstaglist.tex @@ -0,0 +1,67 @@ +\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{Items} +\author{Pelle Nilsson} +\date{} + +\newcounter{sectionnr} + +\begin{document} + +\maketitle + +\clearpage + +\thispagestyle{empty} + +\pagestyle{empty} +\subsection*{\begin{center} \textbf{Info} \end{center}} + + + \noindent + This file is for testing the list option. This section should not be listed. Using the options given in the options file for this gamebook, only the sections tagged as todo will be listed. +\vspace{1em} + +Turn to 1 to begin. +\phantomsection +\refstepcounter{sectionnr} +\label{section1} +\subsection*{\begin{center} \textbf{1} \end{center}} + + \noindent + There has to be a section set as missingto (ie this section), otherwise generating a list with only todo sections will fail (as one of them references non-todo sections). Unfortunate side-effect is that this section will always be included in the list. TODO figure out some fix for this. +\vspace{1em} +\phantomsection +\refstepcounter{sectionnr} +\label{section2} +\subsection*{\begin{center} \textbf{2} \end{center}} + + \noindent + Need to write this section. Sorry for it being a dead-end for now. +\vspace{1em} +\phantomsection +\refstepcounter{sectionnr} +\label{section3} +\subsection*{\begin{center} \textbf{3} \end{center}} + + \noindent + (This section needs some work!) Here you find a \textbf{key} and a \textbf{stick}. You can go west to \textbf{\autoref{section1}}, or east to \textbf{\autoref{section2}}. +\vspace{1em} +\end{document} diff --git a/expected/itemstaglist.txt b/expected/itemstaglist.txt new file mode 100644 index 0000000..3914461 --- /dev/null +++ b/expected/itemstaglist.txt @@ -0,0 +1,3 @@ +1 end_todo +2 curse +3 tjunction diff --git a/todo.org b/todo.org index 232b440..5b710c5 100644 --- a/todo.org +++ b/todo.org @@ -1,4 +1,4 @@ -* TODO [56/79] [70%] +* TODO [56/80] [70%] ** DONE Debug output ** DONE DOT output ** DONE LaTeX output @@ -129,6 +129,10 @@ ** TODO Higher level text-language for Gamebooks ** TODO BGG forum output (.bgg) ** TODO Verify gamebook +** TODO Fix broken references in list option output for some tag +When using the list option, and only including only sections for a tag, +there currently has to be a missingto section, and that section is always +listed even if it is not tagged. ** TODO Add json output file containing sections, counters, collections etc. This output format down-prioed because requires some changes to handle new-lines. All previously supported formats handles new-lines in text without problems, JSON do not.