Class MarkupDocument


  • public class MarkupDocument
    extends Object
    The Class MarkupDocument representing a generic document that can be encoded in different formats using Typesetters.
    Author:
    Martin Scharm
    See Also:
    Typesetting
    • Constructor Detail

      • MarkupDocument

        public MarkupDocument​(String headline)
        Instantiates a new markup document.
        Parameters:
        headline - the headline
    • Method Detail

      • addHeader

        public void addHeader​(String header)
        Adds a header.
        Parameters:
        header - the header to add
      • addSection

        public void addSection​(MarkupSection section)
        Adds a section.
        Parameters:
        section - the section
      • highlight

        public static final String highlight​(String s)
        Highlights a string, e.g. a special word or phrase.
        Parameters:
        s - the string to highlight
        Returns:
        the highlighted string
      • insert

        public static final String insert​(String s)
        Highlights an insert.
        Parameters:
        s - the string to highlight
        Returns:
        the highlighted string
      • delete

        public static final String delete​(String s)
        Highlights a delete.
        Parameters:
        s - the string to highlight
        Returns:
        the highlighted string
      • supplemental

        public static final String supplemental​(String s)
        Highlights supplementary information.
        Parameters:
        s - the string to highlight
        Returns:
        the highlighted string
      • attribute

        public static final String attribute​(String s)
        Highlights an attribute.
        Parameters:
        s - the string to highlight
        Returns:
        the highlighted string
      • math

        public static final String math​(String s)
        Container for unchanged math.
        Parameters:
        s - the string representing math
        Returns:
        the container containing the math
      • math

        public static final String math​(String s,
                                        boolean original)
        Container for modified math.
        Parameters:
        s - the string representing math
        original - the is that the original document?
        Returns:
        the container containing the math
      • rightArrow

        public static final String rightArrow()
        Produces a right arrow. (e.g. for chemical reactions)
        Returns:
        the right arrow
      • multiply

        public static final String multiply()
        Produces a multiply symbol. (e.g. * )
        Returns:
        the multiply symbol
      • getHeader

        public List<String> getHeader()
        Gets the header.
        Returns:
        the header
      • getSections

        public List<MarkupSection> getSections()
        Gets the sections.
        Returns:
        the sections
      • getHeadline

        public String getHeadline()
        Gets the headline.
        Returns:
        the headline
      • replaceHighlights

        public static final String replaceHighlights​(String s,
                                                     String pre,
                                                     String post)
        Replaces highlights.
        Parameters:
        s - the string containing highlights
        pre - the opening, e.g. <em>
        post - the closing, e.g. </em>
        Returns:
        the final string
      • replaceInserts

        public static final String replaceInserts​(String s,
                                                  String pre,
                                                  String post)
        Replaces inserts.
        Parameters:
        s - the string containing inserts
        pre - the opening, e.g. <ins>
        post - the closing, e.g. </ins>
        Returns:
        the final string
      • replaceDeletes

        public static final String replaceDeletes​(String s,
                                                  String pre,
                                                  String post)
        Replaces deletes.
        Parameters:
        s - the string containing deletes
        pre - the opening, e.g. <del>
        post - the closing, e.g. </del>
        Returns:
        the final string
      • replaceSupplementals

        public static final String replaceSupplementals​(String s,
                                                        String pre,
                                                        String post)
        Replaces supplementary information.
        Parameters:
        s - the string containing supp info
        pre - the opening, e.g. <supp>
        post - the closing, e.g. </supp>
        Returns:
        the final string
      • replaceAttributes

        public static final String replaceAttributes​(String s,
                                                     String pre,
                                                     String post)
        Replaces attributes.
        Parameters:
        s - the string containing attributes
        pre - the opening, e.g. <attr>
        post - the closing, e.g. </attr>
        Returns:
        the final string
      • replaceModifiedMaths

        public static final String replaceModifiedMaths​(String s,
                                                        String pre,
                                                        String post)
        Replaces modified math.
        Parameters:
        s - the string containing modified math
        pre - the opening, e.g. <inserted math>
        post - the closing, e.g. </inserted math>
        Returns:
        the final string
      • replaceOriginalMaths

        public static final String replaceOriginalMaths​(String s,
                                                        String pre,
                                                        String post)
        Replaces original math.
        Parameters:
        s - the string containing original math
        pre - the opening, e.g. <deleted math>
        post - the closing, e.g. </deleted math>
        Returns:
        the final string
      • replaceAllMaths

        public static final String replaceAllMaths​(String s,
                                                   String pre,
                                                   String post)
        Replaces all math stuff, doesn't matter if inserted or deleted.
        Parameters:
        s - the string containing inserted or deleted math
        pre - the opening, e.g. <my math tag>
        post - the closing, e.g. </my math tag>
        Returns:
        the final string
      • replaceUnchangedMaths

        public static final String replaceUnchangedMaths​(String s,
                                                         String pre,
                                                         String post)
        Replaces math that hasn't changed.
        Parameters:
        s - the string containing math
        pre - the opening, e.g. <unchanged math>
        post - the closing, e.g. </unchanged math>
        Returns:
        the final string
      • replaceMultiplication

        public static final String replaceMultiplication​(String s,
                                                         String replacement)
        Replaces multiplication.
        Parameters:
        s - the string containing multiplications
        replacement - the replacement, e.g. "*"
        Returns:
        the final string
      • replaceRightArrow

        public static final String replaceRightArrow​(String s,
                                                     String replacement)
        Replaces right arrow.
        Parameters:
        s - the string containing arrows
        replacement - the replacement, e.g. "->"
        Returns:
        the final string