public class DocUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <E> String |
describedList(Collection<E> items,
java.util.function.Function<E,String> namer,
java.util.function.Function<E,String> describer,
boolean isDescriptionXml)
Returns a XML string listing an array of objects
with names and descriptions.
|
static <E> String |
describedList(E[] items,
java.util.function.Function<E,String> namer,
java.util.function.Function<E,String> describer,
boolean isDescriptionXml)
Returns a XML string listing an array of objects
with names and descriptions.
|
static String |
filterRef(BasicFilter filter)
Provides a snippet of XML which references a processing filter.
|
static String |
fromXhtml(String xhtml)
Does minimal conversion from XHTML-like XML to SUN-friendly XML.
|
static String |
getXmlDescription(Documented item)
Returns the XML description provided by an item implementing the
Documented interface, in a form suitable for insertion into
the STILTS user document.
|
static String |
join(String[] lines)
Concatenates an array of strings, appending a carriage return
to each one.
|
static String |
listInfos(ValueInfo[] infos)
Returns a string listing the supplied array of metadata objects.
|
static String |
modeRef(String name)
Provides a snippet of XML which references a named
ProcessingMode . |
public static String join(String[] lines)
lines
- array of input stringspublic static String filterRef(BasicFilter filter)
filter
- processing filterpublic static String modeRef(String name)
ProcessingMode
.name
- mode namepublic static String listInfos(ValueInfo[] infos)
infos
- array of infosinfos
by namepublic static <E> String describedList(E[] items, java.util.function.Function<E,String> namer, java.util.function.Function<E,String> describer, boolean isDescriptionXml)
<ul>
element.
This is a convenience wrapper for the overloaded method
that takes a Collection<E>
.
items
- objects to listnamer
- maps object to object namedescriber
- maps object to object descriptionisDescriptionXml
- if true, the description text may contain
XML formatting, and should be inserted
into the output as is;
if false, any magic characters will be
escaped as required for XMLpublic static <E> String describedList(Collection<E> items, java.util.function.Function<E,String> namer, java.util.function.Function<E,String> describer, boolean isDescriptionXml)
<ul>
element.items
- objects to listnamer
- maps object to object namedescriber
- maps object to object descriptionisDescriptionXml
- if true, the description text may contain
XML formatting, and should be inserted
into the output as is;
if false, any magic characters will be
escaped as required for XMLpublic static String getXmlDescription(Documented item) throws IOException
Note the implementation of this is currently somewhat scrappy; it works on the things that it's called upon to transform during the STILTS user document build, but it may need extra work if some less constrained XHTML gets fed to it. If that becomes the case, problems should show up at TTOOLS package build/test time.
item
- supplier of (XHTML-like) documentation XMLIOException
public static String fromXhtml(String xhtml) throws IOException, TransformerException
xhtml
- input XHTML-like XML string, expected to be a sequence
of P elementsIOException
TransformerException
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.