]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/contrib/texinfo.mdwn
web commit by tschwinge: Further explanation.
[ikiwiki.git] / doc / plugins / contrib / texinfo.mdwn
1 [[I|tschwinge]] started writing a plugin to render
2 [GNU Texinfo](http://www.gnu.org/software/texinfo/)
3 inside the ikiwiki environment.
4
5 This plugin is not neccessarily meant to enable people to write arbitrary
6 wiki pages in the Texinfo format (even though that is possible, of course),
7 but rather to ease collaboration on existing Texinfo documents.
8
9 The plugin is available at <http://www.schwinge.homeip.net/~thomas/tmp/texinfo.pm>.
10
11 It's very basic at the moment, but will be improved over time.
12
13
14 # Issues
15
16 ## N-to-M Mapping of Input and Output Files
17
18 Conventional ikiwiki [[*htmlize*ing|plugins/write#index6h3]] plugins
19 have a one-to-one mapping of input file and output file:
20 `some/where/page.mdwn` is rendered to `some/where/page.html`.
21 This can also be achieved for Texinfo files, but is somewhat
22 unusual there, when rendering them to HTML.  In general, there
23 is a N-to-M mapping:
24
25 * N Texinfo input files (a main `.texi` file,
26   several helper files (`fdl.texi`, `version.texi`, ...), and
27   additional text files which are included from the main `.texi`
28   file, e.g. `history.texi`, `libfoo.texi`, `libbar.texi`.  --[[tschwinge]]
29
30 > As far as multiple input files, you'd need to use add_depends()
31 > to let ikiwiki know that a change to any of those files should cause a
32 > rebuild of the "main" file. --[[Joey]]
33
34 >> (?) I'll see about a frob to get `makeinfo` provide me with a list of additional files
35 >> it used for rendering a given `.texi` file. --[[tschwinge]]
36
37 > I guess you'd also have to somehow deal with
38 > it wanting to render pages for each of the helper files. Not quite sure
39 > what the best way would be to avoid that. --[[Joey]]
40
41 >> Might it be an option to simply not render the pages that are already
42 >> being used as an `include` file for another `.texi` file?
43 >> But how to assemble that list before actually having rendered all `.texi` files?
44 >> One possibility might be to already render them at ikiwiki's *scanning* stage and
45 >> store the rendered HTML files into temporary directories, and then at ikiwiki's
46 >> *rendering* stage simply install the desired ones into the main tree and discard
47 >> the others.  --[[tschwinge]]
48
49 * M Texinfo output files: the main `.texi` file (which `include`s
50   the other input files) is usually rendered into a (flat) hierarchy
51   of HTML files, one file per node, see the table on
52   <http://www.gnu.org/software/texinfo/manual/texinfo/html_node/#Top>
53   for an example.  --[[tschwinge]]
54
55 > Ikiwiki is perfectly happy with a page creating other files (see eg, the
56 > img and teximg plugins, as well as the inline plugin's rss generation).
57 > The will_render() function supports that.
58
59 > What hasn't been done though is a page creating more than one other _page_.
60 > Perhaps you could call IkiWiki::genpage by hand for each additional page.
61 > You might also want to manipulate each data structure that tracks info about
62 > pages, adding the additional pages to them, so that they're first class
63 > pages that work as pages everywhere in ikiwiki (ie, can be inlined,
64 > appear in a site map, be linked to, etc). Not sure how to do that,
65 > and perhaps you could get away without doing it actually. --[[Joey]]
66
67 >> Currently I use `makeinfo --no-split` and render to stdout, so that I can
68 >> easily capture the output and stuff it into the appropriate ikiwiki data structure.
69 >> If we want to have multiple output files (which we'll eventually want to have,
70 >> to avoid having such large single-file outputs), we won't be able to
71 >> do this anymore.
72 >> (?) Then we'll need a way to find the main output file, which
73 >> will be the one to be copied into what ikiwiki expects to be the main output
74 >> of the rendered `.texi` file.
75 >> Perhaps (again) parse the `.texi` file for a `@setfilename` statement?
76 >> The other generated files will also have to
77 >> copied somewhere (preferably into a subdirectory named alike the main file
78 >> to avoid name space collisions; but need to take care of links between the files then)
79 >> and need to be registed within the ikiwiki system.
80 >> --[[tschwinge]]
81
82 There needs to be some logic to establish a mapping between the *N* input files
83 and the *M* output files.
84 (At least for web-editing via CGI this is needed: ikiwiki (currently) needs to be able
85 to deduce *one* input file from a given output file)
86 Easiest would be either to have *N = 1*
87 (plus perhaps some input files that are not meant to be editable, like `gpl.texi`)
88 or to have
89 *M = N* and have a (?) one-to-one mapping between *input file n* and *output file m*
90 (which is not possible in Texinfo's `makeinfo` at the moment).
91 --[[tschwinge]]
92
93
94 ## `makeinfo` Output
95
96 `makeinfo --html` is being used for rendering.  It creates stand-alone
97 HTML files, while ikiwiki only needs the files' `<body>`s.
98
99 (?) One possibility (which is what I'm doing at the moment) is to simply cut away
100 everythin until `<body>` is seen and after `</body>` has been seen.  --[[tschwinge]]