Container
Reference
Target format
Defining new functions
Fontification
Common Classes
Scribe Library
Container numbering
Target format
Programming Back-ends
The HTML back end
Bibliography
Embedding Scribe into Bigloo
Scribe Apache module
Classes, Functions and Variables
Bibliography
|
This chapter describes the functions provided by Scribe that can be
used to retrieve informations about the current document and nodes
that are processed. These functions are available to Scribe documents.
That is with the Standard Library functions they
compose the set of the whole Scribe user functions.
Introspection facilities are mostly useful in order to
implement Scribe styles. It may happens that a
style need informations about the document structure, which chapter
comes next, etc. The style used to render the HTML of this manual
uses the facilities to implement the left margin. For instance, this
part of the text contains references to the previous and next chapters
in the manual. For the sake of the example, here is the source code
that implement the left margin:
(define (local-margin)
(let ((c (current-chapter)))
(if c
(let* ((title (ctitle c "Sections"))
(prev (chapter-previous (current-chapter)))
(next (chapter-next (current-chapter)))
(dtitle (document-title (current-document)))
(items (if next
(list (list (bold "Previous: ")))
'()))
(items (if prev
(cons (list (bold "Next: ")
(ref :chapter prev (ctitle prev)))
items)
items))
(rhome (tr (th :align 'left :valign 'top "Home: ")
(td :align 'right (ref :url (document-file (current-document)) dtitle))))
(rnext (tr (th :align 'left :valign 'top "Next chapter: ")
(td :align 'right
(if next
(ref :chapter next (ctitle next))
""))))
(rprev (tr (th :align 'left :valign 'top "Previous chapter: ")
(td :align 'right
(if prev
(ref :chapter prev (ctitle prev))
""))))
(browse (section :title "Browsing" :toc #f :number #f
(table :width 1.
rhome
(tr (td (linebreak 1)))
rprev
rnext))))
(if (pair? (chapter-children c))
(list browse
(section :title title :toc #f :number #f
(table-of-contents :chapter #f)))
browse))
"")))
(define (ctitle c . def)
(if (string? (chapter-title c))
(chapter-title c)
(if (string? (chapter-subtitle c))
(chapter-subtitle c)
(car defs)))) |
In this chapter we present the functions used in that example.
(generic container-file ::%container) | Scribe function |
Returns the file the %container is compiled to.
|
4.2 Document
(current-document::%document) | Scribe function |
Returns a pointer to the document being processed.
|
(with-document ::%document ::procedure) | Scribe function |
Invokes the procedure in argument in the context where
current-document is document.
|
(document-chapters::pair-nil ::%document) | Scribe function |
Returns the list of chapters in the
document.
|
(document-sections::pair-nil ::%document) | Scribe function |
The list of sections of the
document that are not embedded in any
chapter.
|
(document-sections*::pair-nil ::%document) | Scribe function |
The list whole of sections of the
document. This list contains
the sections that not embedded in any
chapter and also those contained in chapters.
|
(document-title::bstring ::%document) | Scribe function |
The title of the document.
|
(document-file ::%document) | Scribe function |
The file where to compile the document.
|
4.3 Chapter
(current-chapter::%chapter) | Scribe function |
Returns a pointer to the chapter being processed.
|
(with-chapter ::%chapter ::procedure) | Scribe function |
Invokes the procedure in argument in the context where
current-chapter is chapter.
|
(chapter-sections::pair-nil ::%chapter) | Scribe function |
The list of sections of the
chapter.
|
(chapter-title::bstring ::%chapter) | Scribe function |
The title of the chapter. This may be #f
if the chapter has a subtitle.
|
(chapter-subtitle::bstring ::%chapter) | Scribe function |
The subtitle of the chapter. This may be #f
if the chapter has a title.
|
(chapter-children ::%chapter) | Scribe function |
The list of block in the chapter.
|
(chapter-file ::%chapter) | Scribe function |
A boolean value that is used by some back-end (such as the HTML back-end)
to decide if the chapter must be compiled into a separate target.
|
(chapter-next ::%chapter) | Scribe function |
The next chapter in the document the chapter
belongs to.
|
(chapter-previous ::%chapter) | Scribe function |
The previous chapter in the document the chapter
belongs to.
|
4.4 Section
(section-title::bstring ::%section) | Scribe function |
The title of the section.
|
(section-subsections::pair-nil ::%section) | Scribe function |
The list of the subsection in the section.
|
4.5 Subsection
(subsection-title::bstring ::%subsection) | Scribe function |
The title of the subsection.
|
(subsection-subsubsections::pair-nil ::%subsection) | Scribe function |
The list of the subsubsection
in the subsection.
|
4.6 Subsubsection
(subsubsection-title::bstring ::%subsubsection) | Scribe function |
The title of the subsubsection.
|
(generic find-reference ::obj ::%document) | Scribe function |
Find the reference obj in the document. If
the argument obj is a string. The function find-reference
searches for all possible references in document.
If the argument is a reference the search is
restricted to a subset of all references, such as
chapter-ref or
mark-ref.
|
(scribe-format? ::symbol) | Scribe function |
See chapter 6. Target format.
|
|