This module colourises Prolog source using HTML+CSS using the same
cross-reference based technology as used by PceEmacs.
- author
- - Jan Wielemaker
- To be done
- - Create hyper-links to documentation and definitions.
- source_to_html(+In:filename, +Out, :Options) is det
- Colourise Prolog source as HTML. The idea is to first create a
sequence of fragments and then to apply these to the code.
Options are:
- format_comments(+Boolean)
- If
true
(default), use PlDoc formatting for structured
comments.
Other options are passed to the following predicates:
- Arguments:
-
In | - A filename. Can also be an abstract name,
which is subject to library(prolog_source)
abstract file handling. See
prolog_open_source/2. Note that this cannot
be a stream as we need to read the file three
times: (1) xref, (2) assign colours and (3)
generate HTML. |
Out | - Term stream(Stream) or filename specification |
- print_html_head(+Out:stream, +Options) is det[private]
- Print the
DOCTYPE
line and HTML header. Options:
- header(Bool)
- Only print the header if Bool is not
false
- title(Title)
- Title of the HTML document
- stylesheets(List)
- Reference to the CSS style-sheets.
- format_comments(Bool)
- If
true
(default), format structured comments.
- skin(Closure)
- Called using
call(Closure, Where, Out)
, where Where
is one of header
or footer
. These calls are made
just after opening body
and before closing body
.
- html_fragments(+Fragments, +In, +Out, +State, +Options) is det[private]
- Copy In to Out, inserting HTML elements using Fragments.
- html_fragment(+Fragment, +In, +Out, +StateIn, -StateOut, +Options) is det[private]
- Print from current position upto the end of Fragment. First
clause deals with structured comments.
- anchor(+Class, -Label) is semidet[private]
- True when Label is the
id
we must assign to the fragment of
class Class. This that the first definition of a head with
the id name/arity.
- copy_to(+In:stream, +End:int, +Out:stream, +State) is det[private]
- Copy data from In to Out upto character-position End. Inserts
HTML entities for HTML the reserved characters
<&>
. If State
does not include a pre
environment, create one and skip all
leading blank lines.
- copy_full_stop(+In, +Out) is det[private]
- Copy upto and including the .
- delete_leading_white_lines(+CodesIn, -CodesOut, +LineIn, -Line) is det[private]
- Delete leading white lines. Used after structured comments. The
last two arguments update the start-line number of the <pre>
block that is normally created.
- copy_without_trailing_white_lines(+In, +End, +StateIn, -StateOut) is det[private]
- Copy input, but skip trailing white-lines. Used to copy the text
leading to a structured comment.
- append(-First, -FirstTail, ?Rest, +List) is nondet[private]
- Split List. First part is the difference-list First-FirstTail.
- write_codes(+Codes, +Line, +Out) is det[private]
- Write codes that have been read starting at Line.
- content_escape(+Code, +Out, +Line0, -Line) is det[private]
- Write Code to Out, while taking care of.
- Use HTML entities for
<&>
- If a line-no-tag is requested, write it
- On \n, post a line-no request. If nonl/0 is set,
do not emit a newline as it is implied by the
closed environment.
- copy_rest(+In, +Out, +StateIn, -StateOut) is det[private]
- Copy upto the end of the input In.
- read_n_codes(+In, +N, -Codes)[private]
- Read the next N codes from In as a list of codes. If N < 0, read
upto the end of stream In.
- element(+Class, -HTMLElement, -CSSClass) is nondet[private]
- Map classified objects to an HTML element and CSS class. The
actual clauses are created from the 1st argument of
prolog_src_style/2.