internal package
Foswiki::Plugins::BookmakerPlugin::Book internal package
Foswiki::Plugins::BookmakerPlugin::Book ClassMethod
new($topic) $topic
. If $topic
does not
specify a web, then the preference BOOKMAKER_BOOKWEB
will be used or, if that is not set,
Sandbox
.
If the topic already exists, access controls will be checked for read access. If this is
denied, a Foswiki::AccessControlException
will be thrown.
It is not an error to open a non-existent book topic (it will be created on the first save).
Note that Foswiki macros in the book topic are expanded when it is loaded, thus allowing use of%INCLUDE
etc. However these macros will be lost when the book is saved.
The book parser accepts topics in a variety of formats, as described in BookmakerPlugin
ObjectMethod
find($topic) → $index $topic
does not have a web specification, it will be assumed to
be in the same web as the book topic.
Returns -1 if the topic is not found in the book.
Note that a topic can only occur once in a book.
ObjectMethod
at($index) → $entry $index
, or undef
if it is out of range.
The entry is a hash containing { web, topic, level }
ObjectMethod
remove($i) → $entry $i < 0
, will shift the first entry. If $i >
length=, will pop the last. Otherwise will splice.
Returns the removed entry.
ObjectMethod
add($entry) → $entry ObjectMethod
add($topic [, $level]) → $entry If $topic does not have a web specification, it will be placed in the same web as the book topic.
The topic will be added at level 0 if$level
is not given.
Returns the new entry.
ObjectMethod
insert($i, $topic [, $level]) → $entry $i < 0
, will add at the
start, if $i > length
at the end,
If $topic does not have a web specification, it will be placed in the same web as the book topic.
The topic will be added at level 0 if$level
is not given.
Returns the new entry.
ObjectMethod
insert($i, $entry) → $entry $i < 0
, will add at the
start, if $i > length
at the end,
ObjectMethod
each() → $iterator my $i = $book->each(); while ($i->hasNext()) { my $entry = $i->next(); # $entry is a hash with {web, topic, level} }Modifying the list during iteration is not supported.
ObjectMethod
save() Foswiki::AccessControlException
will be thrown. Existing meta-data is kept, as are
header and footer sections.
ObjectMethod
stringify() → $string Generate a string representation of the book, suitable for debugging.