// -- macro declarations: start reading with first headline +BC:\B<\C<__body__>> // -- end of "preface" =0.37 This is a maintenance update. It can replace version 0.36 transparently except for verbatim block paragraph filters and \C output handling. See next section for details. ==Incompatible changes * Paragraph filters intended to be applied to verbatim paragraphs need to be adapted: they now receive the \I paragraph text \I the enclosing heredoc parts (e.g. \C<< and matching \C). * Extended headline stream interface. This only effects converter authors, but not really, because there are just two \I parameters now. See below. * \BC now needs an explicit result file setup by the new option \C<-sdffile>. Previous versions wrote to \C. ==Bugfixes * \C: \BC<\\SEQ> did not set an anchor when the \C option was specified. * A combination of \C<\\REF>, \C<\\SEQ> and activated cache caused trouble illustrating open tasks in the implementation both of finish hooks and anchor objects. This is fixed, see \REF{type=linked name="0.37 | Features | Cache"} below for details. * For grammatical reasons, paragraph filters applied to blocks or lists could cause trouble in detection of the subsequent paragraph. This is fixed. * Filtered paragraphs were cached but are made potentially dynamic in an unpredictable way by the filter(s). So they are cached no longer. * Filtering of headlines and verbatim blocks was not really fully supported yet. Improved. ==Features \LOCALTOC{type=linked} ===Document streams Robert Inder asked how to achieve an HTML layout where notes are placed below the slide context. When we discussed several ideas, I thought it might be useful to have a general solution which I called \I<"document streams">. Thanks, Robert! So what is a document stream? Consider the following layout: ------------------------------------- | header navigation | ------------------------------------- | | | Title | | | | Introduction text, points etc. | | | ------------------------------------- | | | | Here we are | Here we are | | talking about | talking about | | subtheme 1. | subtheme 2. | | | | ------------------------------------- | notes | ------------------------------------- | trailer navigation | ------------------------------------- The kernel parts can be easily generalized into a more abstract scheme: ------------------------------------- | | | main stream | | | ------------------------------------- | | | | item 1 stream | item 2 stream | | | | ------------------------------------- | stream 3 | ------------------------------------- This may be used in many ways - to compare software or hardware items, to place reader hints besides a main text, to write about the lifes of two or more individuals and present certain life parts in parallel, and so on. But how to distinguish document streams in a PerlPoint document? Well, here are the simple rules: * Every headline (re)enters the main stream. * \I enter certain streams. They are a new one line paragraph type, beginning with a \BC<~> character and ending with the line (like comments do): =Main stream Bla bla \B<~The first docstream> Blu blu \B<~The 2nd doc stream> Bli bli ==Back to main stream Converters need to add docstream support, so currently only \C provides a first (reference) implementation. \I But to implement generally useful methods in the framework, the parser can be set up to transform all docstream entry points into headlines (at a sublevel of the current headline level) or to ignore all document streams at all (except of the main stream). More, docstreams can be skipped more selectively as well: the parsers \C method provides a new parameter \BC to pass the parts to be ignored. When an ignored docstream is entered, all subsequent document parts till the next entry point (or headline) are completely ignored (including conditions - take care). Finally, \I start directives now provide a list of docstreams used in this certain chapter - allowing converter authors to adapt the chapters layout dynamically. See "Writing converters" for details. ===\\INCLUDE Now it's easy to use a central repository of (macro / variable / code / filter / document) libraries: * \BC<\\INCLUDE> now searches pathes specified by an environment variable \BC (similar to \C, shells, linkers etc.) if the specified file cannot be found directly. In the tradition of \C and \C, pathes are delimited by (optional whitespaces and) semicolons. path1\B<;>path2\B<;> path3 \B<;> path4\B<;>path5 * The new C path feature is available immediately with this package version, regardless of converter adaptations. * Converters can pass a new parameter \C to the parsers method \C. The argument of \C should be a reference to an array filled by converter options. I suggest a new conventional option \I<\C<-includelib>> to be invoked multiple times (in the tradition of \C<-I> options available for \C and various compilers). * \C<-includelib> needs converter adaptations, so please use \C till updated converters appear. Pathes specified via \C<-includelib> (or the internal representation \C, respectively) are searched \I pathes specified via \C. * Pathes of included files are resolved now - circular inclusions caused by links pointing to the same file can be detected earlier this way. As a side effect, the resulting absolute file names improve error messages. ===Cache * Paragraphs containing tags using finish hooks are no longer cached. A tag finished after parsing makes the whole paragraph depending on something that cannot be cached on base of the parsed text. * Anchors defined by a cached paragraph are cached now as well - and restored after a cache hit. * The implementation of the mentioned last point required an extension of the internal cache format. Cache files made by versions prior 0.37 will be rebuilt automatically next time they are used. ===pp2sdf * Avoiding more backslashes in paragraphs starting with an SDF command. * New option \BC<-result> to specify an output file. * Supports document streams by three modes: docstreams can be ignored, entry points can be made headlines, or \C can produce one document per docstream. * Provides new conventional converter options \BC<-includelib>, \BC<-docstreaming> and \BC<-skipstream>. ===Misc * Slightly improved the \C file. * \BC now takes a \I of flag names and checks if at least one of the flags is set (implicit \I condition). This makes it more handy to write combined conditions. Thanks to Helmut Steinbach to make me thinking about this. old: ? flagSet('a') or flagSet('b') or flagSet('all') new: ? flagSet(qw(a b all)) * \C was extended by a logging mode to trace newly added anchors. * Added tests of condition interface functions (currently \C and \C). * Improved headline tests. * Added paragraph filter tests. * Paragraph filter functions can access the type of the paragraph using the new variable $main::_pfilterType. * Empty text paragraphs are no longer made part of the stream. * Blocks were streamed with a final newline, improved. * Demos \C and \C auto-anchor headlines now (so \C<\\REF> can be used). * New headline shortcuts. Thanks to Robert Inder who asked for them. A shortcut is a plain string appended to the headline title, separated by a "~". \I =A very long headline which may not fit into the navigation bars \B<~ \I> * Updated \C extensions for Emacs (in the \C directory). * Updated docs. =0.36 This is a major update - in the sense that it modifies a lot of internals, especially stream handling. Nevertheless, it's almost completely compatible with earlier versions of the package (and the few \REF{name="Summary: Incompatible changes" type=linked} most likely do \I affect existing converters). So \I While working on this version, I began to make use of the modified internals myself. As a result, there are various new \I features as well. See section "\REF{name="Visible Changes" type=linked}" below for all details. Internals are described in chapter "\REF{name=Internals type=linked}". \I> (included in CPAN package \C - do \I install the still available standalone distribution of \C). You may have to update \C as well. ==Bugfixes * Several very slight fixes in calls of \C (these bugs caused no errors). * \C embedded native SDF incorrectly into the produced result. Thanks to Lorenz for the bug report. * \C: unintended SDF recognitions caused by ">" characters are now avoided by generating ">" as "{{CHAR:gt}}" (outside verbatim blocks). * If the only contents of a table cell was a \C<0>, this number was removed. Fixed. * If a macro overwrote a tag with the same name and a (parsing) hook, the tag hook was invoked when the macro had been used. * Tag parsing hooks received tag options instead of the tag body. * Helmut Steinbach found that the closing sequences of verbatim blocks made by Active Content were not recognized correctly. This could be fixed. * Investigating the previous point I found that is was also impossible to dynamically make a usual example block or a paragraph that starts with a tag or macro. This is now fixed as well. * Internal bugfix in macro body reparsing. The bug could cause infinite parsing loops. ==Internals This chapter can be safely skipped by "pure" PerlPoint users which might like to continue with chapter "\REF{name="0.36 | Visible Changes" type=linked}". This chapter describes these news: \LOCALTOC{type=linked} ===PerlPoint::Backend, stream format \B<\I> I do not know of any direct stream access in a converter, but \I anyone did access the stream directly, he will need to adapt his code. Code using \C does \I need to be adapted. The stream is still a stream basically, but with additional structural hints stored in parallel, which are currently a stream of headline index numbers. This way I hope to stay with the performance advantages of a stream while enabling things like chapter inspection and arbitrary chapter navigation. For example, \C 0.11 in fact needs to process the stream twice because it needs the whole picture of the headline structure when building slides. Now it would be possible to inspect headlines in the first pass \I, and to process \I tokens in the 2nd pass then. This is a common task - \C might be modified or not, but future converters can definitely make use of this. (And there's an even better and faster way now to grab the TOC, see below.) To make use of the new structure, \C provides several new methods: * \C now works in \I. By default, it processes all tokens as usual. This is called the "token mode". In \I, it processes \I. Switch modes by \BC - even from within a callback! * Navigate within the stream: \BC goes back to the very beginning, while \BC allows you to jump to a certain chapter. * Get the number of all headlines by \BC, and the number of the current chapter by \BC. * The stream data structure is now bound to a backend object while \C is running. If navigation methods, \C or \C shall be called outside \C - which means outside a callback - \BC can be used to perform this binding manually. * Instead of using \C, converter authors may prefer to process the stream step by step having full control (e.g. to use the stream while presenting instead of in format translation). This is possible by using \C, sequential calls of \BC and finally \BC. The new backend method \BC uses the new features to provide a table of contents. If called for a certain chapter, all subchapters are listed. The reported depth can be limited. # get the complete \I $toc=$backend->\B; # get a list of all \I $subchapters=$backend->toc($backend->currentChapterNr); # get a list of the subchapters \I (do not list the complete tree, if there # are more levels) $subchapters=$backend->toc($backend->currentChapterNr, \B<1>); All backend extensions are documented both in \C's POD and in the converter tutorial. Hopefully. ===More stream enhancements * Headline start directives provide the full headline title (plained, which means without possibly used tags) as new data. * Unordered and description list directives now reserve a parameter at the position where \I directives traditionally pass a list startup level. This parameter is currently unused. * All list directives provide four new additional parameters to give converter authors a hint about subsequent or preceeding \I. For reasons of stream construction, hints about \I level shifts are provided in list \I directives \I, while hints about \I level shifts are provided in list \I directives \I. (But these are exactly the places where these informations can help, so symmetry is the only thing lost here.) This feature is intended to help a converter to build really \I lists. (In PerlPoint, a list level shift implicitly closes a previous list, but this is different in various target languages.) * Parser and backend now interact via directive hints. This is an internal interface. For example, it is used to flag that a tag and / or its contents should be skipped (see below). ===New finish hook to complete tags With the new tag declarations by module introduced by version \REF{name="0.34" type=linked}, it became possible to hook into tag parsing. Now there's another hook to \I a tag \I parsing - this means, when all input informations are available. The new \C<\\REF> macro makes use of this feature to verify links and to complete itself by linked content. The new hook interface is quite similar to parsing hooks except that it does not provide informations only available at parsing time (like the tag body). See \C for a detailed doc. ===New hook return codes PARSING_IGNORE and PARSING_ERASE Tag \I hooks can return two new codes: * \BC causes the parser to ignore the tag. The result is just the body. * \BC removes the tag \I which means together with all its content. See the new basic tag \\HIDE for an example. Finish hooks can return these codes as well, with exactly the same effect. (The tag remains streamed (as well as its body), but will be bypassed by the backend.) See \C for a detailed doc. ===Hooks can now be interchanged It is now possible to use hooks of a "foreign" tag (declared by another tag module) in your own tag hooks. This helps to emulate other tags, for example if an \I (tag and option names) shall be preserved but the \I shall be used. To invoke a foreign hook, call \C anywhere in your own hook, passing tag name, hook type and parameters, like so: $rc=PerlPoint::Tags::call('TAG', 'hook', @_); If the tag is not registered, or has no hook of the specified type, an undefined value is supplied, otherwise the return code of the invoked function. ===New anchor management The parser can relieve converters from anchor management partially now. This is an \I. * A new minimal class \BC provides basic anchor collection services. Addresses and related values can be added and queried. * The parser maintains a \C object. * On request, headline titles (stripped off of tags) are automatically added to the parsers anchor collection. (This is inspired by the automatic headline anchors idea by Lorenz, built into \C for versions and already imitated by \C. Why not make it a general feature?) To activate this feature call \C with \C set to a true value. * The parsers anchor collection object is passed to all tag hooks (both parsing and finishing ones), where the collection can be extended (most probably by parsing hooks) or queried (supposedly by finish hooks). This is the complete management for now. The parsers collection is \I made part of the stream. It's just a help to verify links at parsing time, and to insert named values into the stream. The new \C<\\REF> macro uses the parsers anchor collection to resolve values not available at parsing time, like sequence numbers generated by the new \C<\\SEQ> tag. Again: with this feature (and tag finish hooks), it becomes easy to reference strings defined \I than the reference. ===Summary: Incompatible changes Various incompatible modifications might have been mentioned before, but it might be useful to have a check list: * The stream format was \I extended, both in structur and semantics. \C manages this for you. (And you already used it, didn't you? ;-) * List shift paragraphs are no longer streamed by opening \I closing directives. There's only an \I directive from now on. * Tag (parsing) hooks have a modified interface: the tag body is now passed by reference, no longer as a list. This was necessary to add new parameters to the interface. * Tag completion directives in the stream no longer provide exactly the same informations as corresponding start directives, because the new finish hooks are only invoked for startup directives. So, if a tag finish hook modifies tag options, this will affect the startup directive only. (Let me know if this causes problems.) * Likewise, headline start directives in the stream now provide more informations than related completion directives: the full (plained) headline title is only provided with the startup hint. * \C<\\TABLE> tags are streamed with additional informations about the separators used (options \C and options \C). If they were made from a table \I, there's an additional option \C<_paragraph_> set to 1. These informations are intended to be used when a paragraph is retranslated for a \REF{name="New type of active contents: paragraph filters" type=linked}. ==Visible Changes While the modified internals are especially of converter authors interest and do not affect existing documents, there are already \I features in this version implemented on base of the new internals which \I find your interest and help you in writing documents. These new features include: \LOCALTOC{type=linked} Please see the \REF{name="0.36 | Misc" type=linked}<"Misc"> section below for more visible changes which are not based on the modified internals. ===More active content: tags and macros can be made optional If a tag or macro has an option \BC<_cnd_>, the parser treats this option as a \I to activate the tag/macro or not. The condition is evaluated as Active Content. If Active Content is disabled, the condition defaults to "false". \\IMAGE{_cnd_="$illustrate" src="piegraph.gif"} Unfortunately, because it is done via option, only tags and macros \I options can be made conditional. So, \\I{_cnd_="$italics"} cannot be written because of a parsing error. That's bad. If anyone has an idea for a well fitting general solution, please let me know. (Hint for converter authors: the condition option is stripped off of the options hash if the condition (and therefore the tag) turns out to be valid. You cannot evaluate it yourself again.) ===New basic tag \\LOCALTOC \BC<\\LOCALTOC> inserts all subsections of the current chapter (in requested depth). Simply say: =Parent chapter In this chapter: \B<\\LOCALTOC> ==Subchapter 1 ===Subchapter 1.1 ==Subchapter 2 , and a converter will produce results according to \I source: =Parent chapter In this chapter: \B<* Subchapter 1> \B<* Subchapter 1.1> \B<* Subchapter 2> ==Subchapter 1 ==Subchapter 2 I missed something like this tag for a long time, indeed. Think of all the empty pages produced by headlines which just collect various subchapters, but without own text. It is possible to limit the subhierarchy depth taken into account (suppress the display of subchapter 1.1 in the example above by setting \C to 1), to format the produced list in various ways (ordered, unordered, with chapter numbers) and even to make the chapter titles hyperlinks to their related chapters (if supported by the target format). The transformation has to be done \I. As I know, the tag shall be supported by \C<\PP::Converters> 0.12. For now, you may get an impression by using \C which as a reference implementation is already supporting \C<\\LOCALTOC>. ===New basic tag \\SEQ Generates the next value of a certain sequence "type" which is declared by option: \\SEQ{type=example}, \\SEQ{type=example}, \\SEQ{type=example} will produce \C<1, 2, 3>, while \\SEQ{type=example}, \\SEQ{type=image}, \\SEQ{type=table} results in \C<1, 1, 1> (provided no sequence was started before). It is possible to name the generated number, which makes it easy to reference it. Naming is done by option \BC. \SEQ{type=image name="Blue water"} (Note: Converter authors have to deal with this tag a special way because the number is passed by a generated tag \I