|
make_faq
|
The script reads in plain text files, and then indexes sections or chapters or questions in that file and puts that index at the top of an HTML file (like a table of contents) which then link down into the file. Furthermore, it will do this for a number of files and create a global index/table of contents. This is difficult to explain, so it's better to just see some examples, but keep in mind that this can be used for more general purpose tasks than just FAQ building.
As a specific example, Section 2 of the DaveFAQ is generated from a simple text file. The configuration file is a little more complicated, but keep in mind that it needs to hold all the extra header and footer HTML.
Chapter One - Monty's Questions
q: What is your quest?
I seek the holy grail
q: What is your favorite color?
Blue
We create a few files like this, let's name them txt_1, txt_2, etc..
Some_String = blah
Multiline_String = "this
is many
lines"
Another_Quoting = 'or use halfquotes
if you need to include
"doublequotes"
in your string'
Another_Quoting = 'but don't worry, 'quotes' only
end a string at the end of a line.'
We can also use some tricks in our conf file to save typing:
# shell style comments are okay
Name = David Ljung Madison
Hello = Hi, my name is conf(Name) # Replaces with configuration value 'Name'
# And no, order is not important.
Bad_Idea = include_file(/etc/passwd) # Can include files
# Header is special, it can do a few things:
Header = SPACE_OUT(Hi there) # Spaces out text using
Header = Section $NUMBER # Replaced with a string version of
# the section number ("one","two",..)
Header = Topic $TOPIC # Replaced with the topic
File = This file is saved in $OUT # Path of the current file
All of this goes in a file called conf. You need to define the following:
There's one last trick, since the Short_Header and Long_Header are
likely to be the same except for their linking to each other, you
can refer to the other by name with $OTHER and by link with $OTHER_HTML.
In other words, you can do something like this:
Short_Header = "
Blah blah blah..
<a href=$OTHER_HTML>$OTHER Index</a>
"
Long_Header = conf(Short_Header)
It might help to snag the conf file
from DaveFAQ and using it as a starting point.