Class HtmlRenderer
- java.lang.Object
-
- eu.bandm.tools.util2.TunableParser<D>
-
- eu.bandm.tools.util2.TunableParserForXml<XMLDocumentIdentifier>
-
- eu.bandm.tools.dtd.TunedDTDParser
-
- eu.bandm.tools.dtm.HtmlRenderer
-
public class HtmlRenderer extends TunedDTDParser
Collects some references and creates an interactive HTML documentation.Principle: There is a complete parsed DTD (given to the constructor by param "dtd") and there is the source text. The source is parsed a second time and copied to the output, after being wrapped into HTML elements according to the parameters and the cross-reference info in the Dtd object.
ATTENTION this class inherits from "TunedDTDParser", but is used for incomplete functionality, so that many field values are under-defined and can be irritating, esp when in "PARSED-dtd" they have the same name (e.g. "this.entityUsage" is totally undefined, and "parsedDtd.entityUsage" is meant!)
After the object has been created,
#printHtml(Writer,String,ToolOptions,String)
must be called.
The current implementation renders a primitive html document which (modulo color) CAN LOOK EXACTLY like the dtd source.Indeed, color, links and tool-tips are added for easy orientation: All colors are defined by css classes for
<span>
,<a>
,<p>
elements, etc.
Anchors are given to (the start of)- each element definition,
- each entity declaration,
- each attlist
Links are put accordingly,
- from element references in content models, to element declarations,
- from entity references in content models, to entity declarations,
- from entity references in attlists, to entity declarations,
- from entity references in entity values, to entity declarations,
- from element references in entity values, iff the entity is used in a content model anywhere,
- between the heads of attlists and content declarations for the same tag.
TOOLTIPS are given
- with element references, showing content model and attribute names
- with entity references, showing definition or replacement text.
--expandTooltips
for switching all tooltips between definition text and expanded(=effective) text.Attlists stand a little bit aside and are reachable by links in a cyclic way:
- from element definition header to the sequence of attlists,
- and from the last attlist back to the element.
When the NAME in a definiton (content model or attlist) is given by a parameter entity, than the switch --expandDefNames decides what to show. The cyclic links through elements and attlists are the same as above, but additionally the tooltip is prepended with the other variant, and, iff shown, the character "%" is a link to the definition place.
Preparing all this syntactic information requires expansion, but the goal for verbatim visual presentation forbids. Therefore the method of choice is a two(2)-phase approach: The successfully parsed dtd model and the unparsed text are both parameters to this process.
The original layout shall be kept verbatim. The parsing process fromTunedDTDParser
is partly overridden, most analysis is skipped and reduced to mere verbatim character copying. The required syntax information is taken from the dtd model.
Nearly all generated output is contained in one top-level "<pre>
" element, which is the most-light-weight way of making browsers respect whitespace and line-breaks.
Switching visibility goes by java-script. It operates on PAIRS OF SIBLINGS:
- a FIRST "
<span>
" element carries the "onclick" code for expanding its successor and collapsing itself. It is additionally marked by the dedicated class "dtd_meta_switch".- the FIRST CHILD of the SECOND SIBLING "
<span>
" carries the "onclick" code for expanding the predecessor of its parent and collapsing its parent.- the code for "expand all"/"collaps all" searches for the switch-on
spans and identifies their flavour by a certain "indicator class",
which can appear with the first or second child of the second span.
pre | | (<=== ON/OFF PAIR ====>) ( +-----------------------------+------------------------(------- | | ( span span style="display:none;" style="display:block;" class=dtd_meta_switch | ( onclick=switchon() +------------------+-------------(-+---- | | | ( | | span(/div/?) span (span div(/i/?) onclick=switchoff() | ( | class="dtd_attlist_decl" | --> arbitrary nesting (=indicator class!) | #PCDATA "switchOnText"
Seen from the standpoint of the following code, there is the additional level of "content" packing:pre | +-----------------------------+------------------------------- | | pre.Content pre.Content span class=meta_switch span class=PI/Comment/Eldef etc switchOnText | onclick=switchon() +----------------+-------------(-+---- | | ( | span.Content span.Content (span.Content span span (span onclick=switchoff()
=============================================================
Attention : The base classes have a different wording w.r.t errors: they use "MessageGenerator" and provide "error()", "warning()" etc.. "msg" is not known there. =============================================================
- the code for "expand all"/"collaps all" searches for the switch-on
spans and identifies their flavour by a certain "indicator class",
which can appear with the first or second child of the second span.
- the FIRST CHILD of the SECOND SIBLING "
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class eu.bandm.tools.dtd.TunedDTDParser
TunedDTDParser.ParsingFailed
-
Nested classes/interfaces inherited from class eu.bandm.tools.util2.TunableParser
TunableParser.CharSet, TunableParser.ExtensionalCharSet
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.Integer>
attlistCount
protected java.util.Map<java.lang.String,java.lang.String>
attributeSourceText
protected Multimap<java.lang.String,Element_a>
attributeSourceToolTip
static java.lang.String
class_alert
static java.lang.String
class_att_def
static java.lang.String
class_att_def_DANGLING
static java.lang.String
class_att_ref
static java.lang.String
class_att_ref_UNDEF
static java.lang.String
class_comment
static java.lang.String
class_copyright_comment
static java.lang.String
class_el_def
static java.lang.String
class_el_ref
static java.lang.String
class_el_ref_UNDEF
static java.lang.String
class_ent_g_def
static java.lang.String
class_ent_g_ref
static java.lang.String
class_ent_g_ref_UNDEF
static java.lang.String
class_ent_ignore
static java.lang.String
class_ent_include
static java.lang.String
class_ent_p_def
static java.lang.String
class_ent_p_ext_content
static java.lang.String
class_ent_p_ext_content_frame
static java.lang.String
class_ent_p_ext_nonshow
static java.lang.String
class_ent_p_ext_ref
static java.lang.String
class_ent_p_ref
static java.lang.String
class_ent_p_ref_UNDEF
static java.lang.String
class_meta_generated
static java.lang.String
class_meta_switch
static java.lang.String
class_noclass
static java.lang.String
class_pi
static java.lang.String
class_textdecl
(package private) java.util.function.Function<java.lang.String,java.lang.String>
const_el_ref
(package private) java.util.function.Function<java.lang.String,java.lang.String>
const_el_ref_UNDEF
(package private) java.util.function.Function<java.lang.String,java.lang.String>
const_ent_p_ref
protected java.lang.StringBuilder
consumed
Temporary storage of consumed input characters, fed by overriden "consume()" below.protected int
content_linewidth
The width after the first two columns.static int
DISTANCE_CONTENTS_OVERALL_WIDTH
static int
DISTANCE_TOOLTIP_OVERALL_WIDTH
protected static DTD.Comment
dummy_comment
protected static DTD.Element
dummy_element
(package private) DTD.Entity
dummy_entity
protected DTD.PI
dummy_PI
protected boolean
eatWs
protected java.util.Map<DTD.Element,java.lang.String>
el2tooltip
Map of elements to Strings with content-plus-attributenamesprotected java.util.Map<DTD.Entity,java.lang.String>
ent2tooltip
protected boolean
expandAttlists
protected boolean
expandContents
protected boolean
expandDefNames
protected boolean
expandEntities
protected boolean
expandTooltips
protected int
fileInsertionNumber
(package private) java.util.function.Function<java.lang.String,java.lang.String>
geDefCheck
(package private) java.util.function.Function<java.lang.String,java.lang.String>
gePeCheck
protected boolean
hasPEs
static java.lang.String
href_bandm_online_docu
protected boolean
htmlIsDynamic
static java.lang.String
infotext_bandm_online_docu
protected Element_span
last_appended_span
Memo for a-posteriori modification (FIXME besser raus)protected java.util.Map<java.lang.String,Element_a>
lastAttlist
protected int
max_tooltip_width
protected ToolOptions.visibility
mode_alphaindex
protected ToolOptions.visibility
mode_analyses
protected ToolOptions.visibility
mode_attlist
protected ToolOptions.visibility
mode_comment
protected ToolOptions.visibility
mode_element
protected ToolOptions.visibility
mode_elementGraph
protected ToolOptions.visibility
mode_entityGraph
protected ToolOptions.visibility
mode_ge
protected ToolOptions.visibility
mode_insert
protected ToolOptions.visibility
mode_pe
protected ToolOptions.visibility
mode_pi
protected static Element_span.Content
nbsp2
protected int
output_linewidth
protected java.lang.String
outputDifferences
protected boolean
outputFormatIsDynamic
protected DTD.Dtd
parsedDtd
static java.lang.String
path_to_javascript
static java.lang.String
path_to_stylesheet
(package private) java.util.function.Function<java.lang.String,java.lang.String>
peDefCheck
protected java.util.List<Element_pre.Content>
preItems
Output storage of constructed html elements, top-level, i.e.static int
ref_list_right_margin
static java.lang.String
ref_list_spacer
protected java.lang.String
separator_content_attlist
static java.util.function.Function<java.lang.String,java.lang.String>
shortname2graphanchor
ATTENTION must be in synch with renderedDtd.js, because there the back-calculation to text anchors takes place !?static java.util.function.Function<java.lang.String,java.lang.String>
shortname2usertext
static Element_span
span_ref_list_spacer
protected Element_span
spanLF
protected java.util.Stack<java.util.List<Element_span.Content>>
spanLists
Stack of layers BEYOND the preItems, i.e.protected Element_span
spanSP
protected Statistics
statistics
-
Fields inherited from class eu.bandm.tools.dtd.TunedDTDParser
currentElementName, entityUsage, errorOnExpand, generalEntities, ignoreErrors, LAZY_ENTITY_ERROR, nicePE, parameterEntities, UNPARSED_CONTENTS
-
Fields inherited from class eu.bandm.tools.util2.TunableParserForXml
asciiLetterSet, decDigitSet, encNameSet, hexDigitSet, initialSet, nameSet, prefix_GE, prefix_PE, pubidCharSet, sNoPESet, sSet, stringconstant_IGNORE, stringconstant_INCLUDE, versionNumSet
-
Fields inherited from class eu.bandm.tools.util2.TunableParser
base, in, messageReceiver, topleveldocumentid
-
-
Constructor Summary
Constructors Constructor Description HtmlRenderer(DTD.Dtd dtd, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, Statistics statistics, java.io.Reader text)
Only constructor, returns a use-once instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_close(java.lang.String switchOnText, ToolOptions.visibility visible, java.lang.String switch_on_class)
Take the currently top-level (currently growing) list "Ln" of span elements.protected Element_a
anchorCH(java.lang.String contents, java.lang.String href)
static java.lang.String
anchorEntityName(java.lang.String name, boolean parameter)
For anchors in generated html.static java.lang.String
anchorName(DTD.Attlist a, int count)
static java.lang.String
anchorName(DTD.Element e)
protected void
append(Element_a a)
Append to top-level list (either in spanLists or the lsit preItems).protected void
append(Element_span a)
Append to top-level list (either in spanLists or the lsit preItems).protected void
append_list_all_references(java.util.Set<java.lang.String> c, int maxColumn, java.util.function.Function<java.lang.String,java.lang.String> getClass)
protected DTD.Attlist
attlistDecl()
Parsing AND rendering function, DEEPLY CHANGED COPY of super(): Entities can appear anywhere and cover more than one "column".protected void
checkCssClass(java.lang.String cssClass)
protected void
checkMassSwitch(ToolOptions.visibility visible, boolean present, java.lang.String text, java.lang.String cssClass, java.util.List<Element_span.Content> ons, java.util.List<Element_span.Content> offs)
protected void
close_region_and_prepend_switch(java.lang.String switchtext, ToolOptions.visibility visible)
Special values for text and css class, but operation as in_close(String, ToolOptions.visibility,String)
}.protected void
close_region_and_prepend_switch_external_entity_content(java.lang.String switchtext, ToolOptions.visibility visible)
Special values for text and css class, but operation as in_close(String, ToolOptions.visibility,String)
}.static java.lang.String
codekey2anchorname(java.lang.String s)
protected void
collectAttlistSource(java.lang.String name)
protected DTD.Comment
comment()
Parsing function.protected void
conditionalSection(DTD.Dtd dtd)
Parsing function.protected void
consume()
CALL-BACK function, influencing the parsing functionality of the super-class to store all character data in the buffer#consumed()
.protected boolean
containsPERefs(java.lang.String s)
ATTENTION GERefs will also be signalled !?!?! ATTENTION external PERefs will also be signalled !?!?! With "conventional" usage both facts should not be confusing.protected void
content_match(java.lang.String keyword)
protected DTD.Element
elementDecl()
Parsing AND rendering function, EXTENDED COPY of super():static java.lang.String
elementGraphFileName(java.lang.String resultFileName)
protected DTD.Entity
entityDecl()
Parsing AND rendering function, EXTENDED COPY of super():static java.lang.String
entityGraphFileName(java.lang.String resultFileName)
protected java.lang.String
expandedText(DTD.Attlist a)
protected java.lang.String
expandedText(DTD.Element e)
ATTENION "mode=1" ??? FIXME WAS SOLL DAS BEDEUTEN ?? append the content model behind each "DTD.Abbrev"protected java.lang.String
expandedText(DTD.Entity e)
ATTENTION intended only for INTERNAL PARAMETER entities!protected ToolOptions.visibility
firstPart(ToolOptions.visibility m)
protected void
includeTrailingWs()
Consume whitespace before the "close span region()" is called, so that the whitespace will be part of collapsing/exploding/skipping.protected void
initModes(ToolOptions options)
Sets the global boolean flags etc.protected void
insert_switchOff(java.lang.String text, java.lang.String cssClass, ToolOptions.visibility currentmode)
Do the same asreduce_switchOff(String, ToolOptions.visibility)
, but not with accumulated source text, but with synthetic, explicit text (probably in a Dtd "comment" syntax !-)
Is required for insertion of external parameter entities and additional print-outs like graphics and analyses!protected void
insertAlphaindex(ToolOptions options)
protected void
insertAnalyses(ToolOptions options)
protected ToolOptions.visibility
intern(ToolOptions options, ToolOptions.visibility optionMode)
Option still does not use enumerations.protected boolean
isDynamic(ToolOptions.visibility m)
protected Element_p
makeFooter(java.lang.String basicFileName, java.lang.String url_htmlRenderer_docu)
protected void
makeHeadline_dtd_coords(java.lang.String alternative, boolean dynamic, java.lang.String cmdline, java.lang.String date, java.lang.String userText)
protected void
makeMassSwitches(boolean withInstructions)
assume only called if "htmlIsDynamic==true"protected void
makeSvg(java.io.File outputfile, java.lang.String title, Multimap<java.lang.String,java.lang.String> relation, java.lang.String altText, java.lang.String switchText, java.lang.String mapIdentifier, ToolOptions.visibility visibility)
DOCMEprotected void
open_span_region()
push a new (intially empty) list of span.content, for later reducing it to a single content element.protected java.lang.String
peRef2deftext(java.lang.String entname)
A pe REF can be dangling! ONLY in this case null is returned.protected DTD.PI
pi()
Parsing function.void
prepareTooltips(boolean expand)
Collect tool-tip text for element references.void
printHtml(java.io.Writer output, java.lang.String dtdFileName, java.lang.String outfilename, @Opt java.io.File outputdir, ToolOptions options, java.lang.String cmdLineText)
Main (currently: the only) entry method after constructor call.protected ToolOptions.visibility
readMode(boolean present, boolean isFileInsert, boolean isAdditional, java.lang.String name, ToolOptions.visibility code, ToolOptions options)
Processes on/off/onOff/offOn-switches.protected Element_a
reduce_a(java.lang.String cssClass, java.lang.String ownAnchor, java.lang.String foreignAnchor, java.lang.String tooltip)
Append an xhtml "anchor" object to the currently growing list.protected void
reduce_element_reference()
Output either a link to the definition, as calculated by the global "object to anchor" mechanisms, or a span, iff the reference is void/dangling!
INCLUDES PARSING, ie.protected DTD.Entity
reduce_entity_reference(boolean parameter)
Output either a link to the definition, as calculated by the global "object to anchor" mechanisms, or a span, iff the reference is void/dangling!
INCLUDES PARSING, ie.protected Element_span
reduce_span()
Substitute the "css class for the rest, which has no own class"protected Element_span
reduce_span(java.lang.String cssClass)
Append an xhtml "span" object containing ALL characters accumulated in the buffer#consumed()
, with the given (non-null, non-empty!) css class.protected void
reduce_switchOff(java.lang.String cssClass, ToolOptions.visibility currentmode)
Do the same asreduce_span(String)
, but additionally set the onclick-action, iff ToolOptions.visibility is dynamic.protected void
s()
Parsing function for non-optional whitespace, at those places where expansion pf PEs is allowed.protected void
scanForReferences_attOrEnt(boolean inSingleQuotes, boolean inDoubleQuotes, boolean possiblyElementRefs)
Parses the definition string of a entity defintion, or a whole sequence of attribute definition entries.protected void
scanForReferences_contentModel()
Parses an element definition's content model and outputs all sub-segments correctly wrapped to the html element list.protected void
skip_entityDef()
protected Element_span
spanC(java.lang.String contents)
protected Element_span
spanCC(java.lang.String contents, java.lang.String cssClass)
protected DTD.TextDecl
textDecl()
Parsing function.protected void
throwAwayConsumed()
protected void
throwAwaySpanRegion()
-
Methods inherited from class eu.bandm.tools.dtd.TunedDTDParser
attDef, attType, attValue, AUX_convert, children, constructReplacementText, content, cp, declareGeneralEntity, declareParameterEntity, defaultDecl, dtd, encName, encodingDecl, entityValue, enumerated, eq, eRef, externalId, extSubset, fatalError, ignore, markupDecl, mixed, modifierOpt, name, niceEntityValue, nmtoken, notationDecl, parse, parse, parseId, parselocal, peRef, pubidLiteral, resolve, retrieveGeneralEntity, retrieveParameterEntity, retrieveReplacementText, sNoPE, sOpt, sOptNoPE, storeEntityUsage, sWsOpt, systemLiteral, versionInfo, versionNum
-
Methods inherited from class eu.bandm.tools.util2.TunableParserForXml
lookahead_pe, prefixedEntityName
-
Methods inherited from class eu.bandm.tools.util2.TunableParser
eof, error, failure, getMessageReceiver, lookahead, lookahead, lookahead, lookahead, lookahead, lookahead_eof, match, match, match, match, matchahead, matchahead, matchahead, matchUpto, matchUpto, readExternal, setBase, setMessageReceiver, skipUpto, warning, word
-
-
-
-
Field Detail
-
path_to_stylesheet
public static final java.lang.String path_to_stylesheet
- See Also:
- Constant Field Values
-
path_to_javascript
public static final java.lang.String path_to_javascript
- See Also:
- Constant Field Values
-
href_bandm_online_docu
public static final java.lang.String href_bandm_online_docu
- See Also:
- Constant Field Values
-
infotext_bandm_online_docu
public static final java.lang.String infotext_bandm_online_docu
- See Also:
- Constant Field Values
-
class_noclass
public static final java.lang.String class_noclass
- See Also:
- Constant Field Values
-
class_meta_switch
public static final java.lang.String class_meta_switch
- See Also:
- Constant Field Values
-
class_meta_generated
public static final java.lang.String class_meta_generated
- See Also:
- Constant Field Values
-
class_alert
public static final java.lang.String class_alert
- See Also:
- Constant Field Values
-
class_textdecl
public static final java.lang.String class_textdecl
- See Also:
- Constant Field Values
-
class_comment
public static final java.lang.String class_comment
- See Also:
- Constant Field Values
-
class_copyright_comment
public static final java.lang.String class_copyright_comment
- See Also:
- Constant Field Values
-
class_pi
public static final java.lang.String class_pi
- See Also:
- Constant Field Values
-
class_ent_include
public static final java.lang.String class_ent_include
- See Also:
- Constant Field Values
-
class_ent_ignore
public static final java.lang.String class_ent_ignore
- See Also:
- Constant Field Values
-
class_ent_p_def
public static final java.lang.String class_ent_p_def
- See Also:
- Constant Field Values
-
class_ent_p_ref
public static final java.lang.String class_ent_p_ref
- See Also:
- Constant Field Values
-
class_ent_p_ref_UNDEF
public static final java.lang.String class_ent_p_ref_UNDEF
- See Also:
- Constant Field Values
-
class_ent_p_ext_ref
public static final java.lang.String class_ent_p_ext_ref
- See Also:
- Constant Field Values
-
class_ent_p_ext_content_frame
public static final java.lang.String class_ent_p_ext_content_frame
- See Also:
- Constant Field Values
-
class_ent_p_ext_content
public static final java.lang.String class_ent_p_ext_content
- See Also:
- Constant Field Values
-
class_ent_p_ext_nonshow
public static final java.lang.String class_ent_p_ext_nonshow
- See Also:
- Constant Field Values
-
class_ent_g_def
public static final java.lang.String class_ent_g_def
- See Also:
- Constant Field Values
-
class_ent_g_ref
public static final java.lang.String class_ent_g_ref
- See Also:
- Constant Field Values
-
class_ent_g_ref_UNDEF
public static final java.lang.String class_ent_g_ref_UNDEF
- See Also:
- Constant Field Values
-
class_el_def
public static final java.lang.String class_el_def
- See Also:
- Constant Field Values
-
class_el_ref
public static final java.lang.String class_el_ref
- See Also:
- Constant Field Values
-
class_el_ref_UNDEF
public static final java.lang.String class_el_ref_UNDEF
- See Also:
- Constant Field Values
-
class_att_def
public static final java.lang.String class_att_def
- See Also:
- Constant Field Values
-
class_att_def_DANGLING
public static final java.lang.String class_att_def_DANGLING
- See Also:
- Constant Field Values
-
class_att_ref
public static final java.lang.String class_att_ref
- See Also:
- Constant Field Values
-
class_att_ref_UNDEF
public static final java.lang.String class_att_ref_UNDEF
- See Also:
- Constant Field Values
-
mode_pi
protected ToolOptions.visibility mode_pi
-
mode_comment
protected ToolOptions.visibility mode_comment
-
mode_insert
protected ToolOptions.visibility mode_insert
-
mode_element
protected ToolOptions.visibility mode_element
-
mode_attlist
protected ToolOptions.visibility mode_attlist
-
mode_pe
protected ToolOptions.visibility mode_pe
-
mode_ge
protected ToolOptions.visibility mode_ge
-
mode_elementGraph
protected ToolOptions.visibility mode_elementGraph
-
mode_entityGraph
protected ToolOptions.visibility mode_entityGraph
-
mode_analyses
protected ToolOptions.visibility mode_analyses
-
mode_alphaindex
protected ToolOptions.visibility mode_alphaindex
-
expandTooltips
protected boolean expandTooltips
-
expandEntities
protected boolean expandEntities
-
expandContents
protected boolean expandContents
-
expandAttlists
protected boolean expandAttlists
-
expandDefNames
protected boolean expandDefNames
-
separator_content_attlist
protected java.lang.String separator_content_attlist
-
eatWs
protected boolean eatWs
-
output_linewidth
protected int output_linewidth
-
content_linewidth
protected int content_linewidth
The width after the first two columns.
-
max_tooltip_width
protected int max_tooltip_width
-
DISTANCE_TOOLTIP_OVERALL_WIDTH
public static final int DISTANCE_TOOLTIP_OVERALL_WIDTH
- See Also:
- Constant Field Values
-
DISTANCE_CONTENTS_OVERALL_WIDTH
public static final int DISTANCE_CONTENTS_OVERALL_WIDTH
- See Also:
- Constant Field Values
-
nbsp2
protected static final Element_span.Content nbsp2
-
htmlIsDynamic
protected boolean htmlIsDynamic
-
outputFormatIsDynamic
protected boolean outputFormatIsDynamic
-
hasPEs
protected boolean hasPEs
-
outputDifferences
protected java.lang.String outputDifferences
-
el2tooltip
protected final java.util.Map<DTD.Element,java.lang.String> el2tooltip
Map of elements to Strings with content-plus-attributenames
-
ent2tooltip
protected final java.util.Map<DTD.Entity,java.lang.String> ent2tooltip
-
parsedDtd
protected final DTD.Dtd parsedDtd
-
statistics
protected final Statistics statistics
-
preItems
protected java.util.List<Element_pre.Content> preItems
Output storage of constructed html elements, top-level, i.e. contents of the top-level xhtml [pre] element.
-
spanLists
protected java.util.Stack<java.util.List<Element_span.Content>> spanLists
Stack of layers BEYOND the preItems, i.e. levels of nesting of [span] xhtml elements.
-
last_appended_span
protected Element_span last_appended_span
Memo for a-posteriori modification (FIXME besser raus)
-
consumed
protected java.lang.StringBuilder consumed
Temporary storage of consumed input characters, fed by overriden "consume()" below.
-
spanLF
protected final Element_span spanLF
-
spanSP
protected final Element_span spanSP
-
fileInsertionNumber
protected int fileInsertionNumber
-
dummy_PI
protected final DTD.PI dummy_PI
-
dummy_comment
protected static final DTD.Comment dummy_comment
-
dummy_element
protected static final DTD.Element dummy_element
-
dummy_entity
DTD.Entity dummy_entity
-
attlistCount
protected final java.util.Map<java.lang.String,java.lang.Integer> attlistCount
-
lastAttlist
protected final java.util.Map<java.lang.String,Element_a> lastAttlist
-
attributeSourceText
protected final java.util.Map<java.lang.String,java.lang.String> attributeSourceText
-
shortname2graphanchor
public static java.util.function.Function<java.lang.String,java.lang.String> shortname2graphanchor
ATTENTION must be in synch with renderedDtd.js, because there the back-calculation to text anchors takes place !?
-
shortname2usertext
public static java.util.function.Function<java.lang.String,java.lang.String> shortname2usertext
-
ref_list_spacer
public static final java.lang.String ref_list_spacer
- See Also:
- Constant Field Values
-
span_ref_list_spacer
public static final Element_span span_ref_list_spacer
-
ref_list_right_margin
public static final int ref_list_right_margin
- See Also:
- Constant Field Values
-
peDefCheck
final java.util.function.Function<java.lang.String,java.lang.String> peDefCheck
-
geDefCheck
final java.util.function.Function<java.lang.String,java.lang.String> geDefCheck
-
gePeCheck
final java.util.function.Function<java.lang.String,java.lang.String> gePeCheck
-
const_ent_p_ref
final java.util.function.Function<java.lang.String,java.lang.String> const_ent_p_ref
-
const_el_ref
final java.util.function.Function<java.lang.String,java.lang.String> const_el_ref
-
const_el_ref_UNDEF
final java.util.function.Function<java.lang.String,java.lang.String> const_el_ref_UNDEF
-
-
Constructor Detail
-
HtmlRenderer
public HtmlRenderer(DTD.Dtd dtd, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, Statistics statistics, java.io.Reader text)
Only constructor, returns a use-once instance. Usage: construct instance and invokeprintHtml(java.io.Writer, java.lang.String, java.lang.String, java.io.File, eu.bandm.tools.dtm.ToolOptions, java.lang.String)
.- Parameters:
dtd
- already successfully parsed dtd with all digested informationmsg
- for all error messagestext
- the same text as in "dtd", but unparsed
-
-
Method Detail
-
isDynamic
protected boolean isDynamic(ToolOptions.visibility m)
-
firstPart
protected ToolOptions.visibility firstPart(ToolOptions.visibility m)
-
entityGraphFileName
public static java.lang.String entityGraphFileName(java.lang.String resultFileName)
-
elementGraphFileName
public static java.lang.String elementGraphFileName(java.lang.String resultFileName)
-
anchorEntityName
public static final java.lang.String anchorEntityName(java.lang.String name, boolean parameter)
For anchors in generated html.
-
anchorName
public static final java.lang.String anchorName(DTD.Element e)
-
anchorName
public static final java.lang.String anchorName(DTD.Attlist a, int count)
-
codekey2anchorname
public static final java.lang.String codekey2anchorname(java.lang.String s)
-
prepareTooltips
public void prepareTooltips(boolean expand)
Collect tool-tip text for element references.
FIXME with [(text)+] toFormat() omits parentheses !?!?!
-
peRef2deftext
protected java.lang.String peRef2deftext(java.lang.String entname)
A pe REF can be dangling! ONLY in this case null is returned.
-
containsPERefs
protected boolean containsPERefs(java.lang.String s)
ATTENTION GERefs will also be signalled !?!?! ATTENTION external PERefs will also be signalled !?!?! With "conventional" usage both facts should not be confusing.
-
expandedText
protected java.lang.String expandedText(DTD.Element e)
ATTENION "mode=1" ??? FIXME WAS SOLL DAS BEDEUTEN ?? append the content model behind each "DTD.Abbrev"
-
expandedText
protected java.lang.String expandedText(DTD.Attlist a)
-
expandedText
protected java.lang.String expandedText(DTD.Entity e)
ATTENTION intended only for INTERNAL PARAMETER entities!
-
append
protected void append(Element_a a)
Append to top-level list (either in spanLists or the lsit preItems).
-
append
protected void append(Element_span a)
Append to top-level list (either in spanLists or the lsit preItems).
-
open_span_region
protected void open_span_region()
push a new (intially empty) list of span.content, for later reducing it to a single content element.
-
throwAwaySpanRegion
protected void throwAwaySpanRegion()
-
_close
protected void _close(java.lang.String switchOnText, ToolOptions.visibility visible, java.lang.String switch_on_class)
Take the currently top-level (currently growing) list "Ln" of span elements. Pop this list off the stack and pack its contents according to the mode switch. If off, then discard, if on, then append it to the next higher list "L(n-1)" Otherwise create the on-switch and append this and Ln to the L(n-1). (Assume off-switch already contained at the beginning of Ln!)
-
close_region_and_prepend_switch
protected void close_region_and_prepend_switch(java.lang.String switchtext, ToolOptions.visibility visible)
Special values for text and css class, but operation as in_close(String, ToolOptions.visibility,String)
}.
-
close_region_and_prepend_switch_external_entity_content
protected void close_region_and_prepend_switch_external_entity_content(java.lang.String switchtext, ToolOptions.visibility visible)
Special values for text and css class, but operation as in_close(String, ToolOptions.visibility,String)
}.
-
consume
protected void consume()
CALL-BACK function, influencing the parsing functionality of the super-class to store all character data in the buffer#consumed()
.- Overrides:
consume
in classTunableParser<XMLDocumentIdentifier>
-
throwAwayConsumed
protected void throwAwayConsumed()
-
checkCssClass
protected void checkCssClass(java.lang.String cssClass)
-
spanC
protected Element_span spanC(java.lang.String contents)
-
spanCC
protected Element_span spanCC(java.lang.String contents, java.lang.String cssClass)
-
anchorCH
protected Element_a anchorCH(java.lang.String contents, java.lang.String href)
-
reduce_a
protected Element_a reduce_a(java.lang.String cssClass, java.lang.String ownAnchor, java.lang.String foreignAnchor, java.lang.String tooltip)
Append an xhtml "anchor" object to the currently growing list. (No further effects on the list stack!) Assume name of target element has just been consumed, but not yet reduceed.
-
reduce_span
protected Element_span reduce_span(java.lang.String cssClass)
Append an xhtml "span" object containing ALL characters accumulated in the buffer#consumed()
, with the given (non-null, non-empty!) css class. Flush that buffer. (No further effects on the list stack!)
-
reduce_span
protected Element_span reduce_span()
Substitute the "css class for the rest, which has no own class"
-
reduce_switchOff
protected void reduce_switchOff(java.lang.String cssClass, ToolOptions.visibility currentmode)
Do the same asreduce_span(String)
, but additionally set the onclick-action, iff ToolOptions.visibility is dynamic.
-
insert_switchOff
protected void insert_switchOff(java.lang.String text, java.lang.String cssClass, ToolOptions.visibility currentmode)
Do the same asreduce_switchOff(String, ToolOptions.visibility)
, but not with accumulated source text, but with synthetic, explicit text (probably in a Dtd "comment" syntax !-)
Is required for insertion of external parameter entities and additional print-outs like graphics and analyses!
-
reduce_element_reference
protected void reduce_element_reference()
Output either a link to the definition, as calculated by the global "object to anchor" mechanisms, or a span, iff the reference is void/dangling!
INCLUDES PARSING, ie. everything before the name has been flushed from theconsumed
buffer, and no component of the name has been parsed/consumed.
-
reduce_entity_reference
protected DTD.Entity reduce_entity_reference(boolean parameter)
Output either a link to the definition, as calculated by the global "object to anchor" mechanisms, or a span, iff the reference is void/dangling!
INCLUDES PARSING, ie. everything before the lead-in character has been flushed from theconsumed
buffer, and the lead-in character has just been recognized, but not consumed.
-
scanForReferences_contentModel
protected void scanForReferences_contentModel()
Parses an element definition's content model and outputs all sub-segments correctly wrapped to the html element list. IGNORES all syntactic structure, except explicit parameter entity references, plain identifiers and the special identifier for content models. (All other character data is copies transparently into the current output buffer and reduced at the end of this method into on span element one level above!) Assume "#EMPTY" already intercepted one level above.
-
scanForReferences_attOrEnt
protected void scanForReferences_attOrEnt(boolean inSingleQuotes, boolean inDoubleQuotes, boolean possiblyElementRefs)
Parses the definition string of a entity defintion, or a whole sequence of attribute definition entries. IGNORES all syntactic structure, except explicit entity references, and quoted string constants. Is called for top-level of attribute list and for the defining text of an entity declaration, both after the name(). So even the top-level quotes are not yet recognized when entering. Can be called recursively at most three times (due to quote variants).
-
s
protected void s()
Parsing function for non-optional whitespace, at those places where expansion pf PEs is allowed. MUST only be called from TOP-LEVEL dtd parser. The PEs referred to must expand to "files" (=external pe), and syntactically to a sequnence of zero or more COMPLETE top-level mark-up declarations. (MUST NOT be called INSIDE of attlist or element decl, for these situations there are DEDICATED parsing routines!)- Overrides:
s
in classTunedDTDParser
-
textDecl
protected DTD.TextDecl textDecl()
Description copied from class:TunedDTDParser
Parsing function.- Overrides:
textDecl
in classTunedDTDParser
-
includeTrailingWs
protected void includeTrailingWs()
Consume whitespace before the "close span region()" is called, so that the whitespace will be part of collapsing/exploding/skipping.
-
pi
protected DTD.PI pi()
Description copied from class:TunedDTDParser
Parsing function.- Overrides:
pi
in classTunedDTDParser
-
comment
protected DTD.Comment comment()
Description copied from class:TunedDTDParser
Parsing function.- Overrides:
comment
in classTunedDTDParser
-
elementDecl
protected DTD.Element elementDecl()
Parsing AND rendering function, EXTENDED COPY of super():- Overrides:
elementDecl
in classTunedDTDParser
-
content_match
protected void content_match(java.lang.String keyword)
-
conditionalSection
protected void conditionalSection(DTD.Dtd dtd)
Parsing function.- Overrides:
conditionalSection
in classTunedDTDParser
-
entityDecl
protected DTD.Entity entityDecl()
Parsing AND rendering function, EXTENDED COPY of super():- Overrides:
entityDecl
in classTunedDTDParser
-
skip_entityDef
protected void skip_entityDef()
-
collectAttlistSource
protected void collectAttlistSource(java.lang.String name)
-
attlistDecl
protected DTD.Attlist attlistDecl()
Parsing AND rendering function, DEEPLY CHANGED COPY of super(): Entities can appear anywhere and cover more than one "column". Relies on ">" not appearing outside of (single/double) quotes.- Overrides:
attlistDecl
in classTunedDTDParser
-
initModes
protected void initModes(ToolOptions options)
Sets the global boolean flags etc. according to the supplied options. Non-trivial interdependencies are calculated. Output differences accumulates the diagnosis whether and why the pure text differs from the original.
-
intern
protected ToolOptions.visibility intern(ToolOptions options, ToolOptions.visibility optionMode)
Option still does not use enumerations. Go from int via string array to interal enumeration value! FIXME
-
readMode
protected ToolOptions.visibility readMode(boolean present, boolean isFileInsert, boolean isAdditional, java.lang.String name, ToolOptions.visibility code, ToolOptions options)
Processes on/off/onOff/offOn-switches. (1) whether feasible, otherwise trunc them, (2) collect whether result is dynamic, (3) add diagnosis which category in initial doc state differs from original.
-
makeHeadline_dtd_coords
protected void makeHeadline_dtd_coords(java.lang.String alternative, boolean dynamic, java.lang.String cmdline, java.lang.String date, java.lang.String userText)
-
makeMassSwitches
protected void makeMassSwitches(boolean withInstructions)
assume only called if "htmlIsDynamic==true"
-
checkMassSwitch
protected void checkMassSwitch(ToolOptions.visibility visible, boolean present, java.lang.String text, java.lang.String cssClass, java.util.List<Element_span.Content> ons, java.util.List<Element_span.Content> offs)
-
makeFooter
protected Element_p makeFooter(java.lang.String basicFileName, java.lang.String url_htmlRenderer_docu)
-
makeSvg
protected void makeSvg(java.io.File outputfile, java.lang.String title, Multimap<java.lang.String,java.lang.String> relation, java.lang.String altText, java.lang.String switchText, java.lang.String mapIdentifier, ToolOptions.visibility visibility)
DOCME- Parameters:
filename
- the relative or absolute path where to put the result file ?? FIXME
-
append_list_all_references
protected void append_list_all_references(java.util.Set<java.lang.String> c, int maxColumn, java.util.function.Function<java.lang.String,java.lang.String> getClass)
-
insertAlphaindex
protected void insertAlphaindex(ToolOptions options)
-
insertAnalyses
protected void insertAnalyses(ToolOptions options)
-
printHtml
public void printHtml(java.io.Writer output, java.lang.String dtdFileName, java.lang.String outfilename, @Opt @Opt java.io.File outputdir, ToolOptions options, java.lang.String cmdLineText)
Main (currently: the only) entry method after constructor call. Writes an html rendering to the output. ATTENTION mode xhtml_stand_alone CURRENTLY WRITES NOTHING ?? FIXME
Called from dtm.Tool.main and from tdom.TDOM_Main.
ATTENTION renderedDtd.js COUNTS pre-elements and ASSUMES nr 2 contains all expandable items FIXME !!- Parameters:
output
- theWriter
to create the html file.dtdFileName
- DOCMEoutfilename
- local name of the written html text, used only to derive the names of the svg files, if any (and for one single warning, if it ends not with "html")outputdir
- directory of the written html text, there the svg files will be placed. When null, svg generation is suppressed.options
- needed for all the fine-tuning switches. Can come from a command line, or can be constructed explicitly when html rendering is initiated programmatically. (Therefore the options already decoded into the other method parameters are ignored.)cmdLineText
- DOCMEdtdTitle
- ??????? FIXME used as the html title (to appear in browser head lines, etc)
-
-