Uploaded image for project: 'Maven Doxia'
  1. Maven Doxia
  2. DOXIA-685

Replace SinkEventAttributes#BOXED with #SOURCE to clearly separate between regular verbatim and verbatim source (code)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-M4
    • 2.0.0-M5, 2.0.0
    • Core
    • None

    Description

      Currently, verbatim text is inconsistently handled in the Sink API and formats apt, xhtml5, xdoc, fml and markdown.

      BOXED implies that some both should be rendered in the output (see APT spec and its use for xdoc source): since introduction of source code highlighting in skins, apt boxed more importantly indicates that this is source code to be likely highlighted.

      In other words, from the API does not know this mix between boxed and source and about the look and feel at the end the output format and styling should decide rather than the sink.

      For those reasons the following change is proposed:

      • BOXED as original name will be deprecated and then removed w/o replacement (SOURCE is not really a replacement for the boxing)
      • Sink#verbatim() and Sink#verbatim(null) will print verbatim text w/o any implications
      • The Xhtml5Sink will make add to every verbatim block <div class="verbatim"> instead of no class
      • instead of BOXED, SinkEventAttributes#SOURCE to explicitly denotimate verbatim source code, Xhtml5Sink will add <div class="verbatim source">, the Apt format will turn -...- to verbatim source as well.
      • The EchoMacro and SnippetMacro won't use BOXED anymore
      • The SnippetMacro will have a source=true attribute which denotes source code, but only IF verbatim=true

      Current situation for non-boxed vs boxed verbatim:

      non-boxed

      input

      • APT:
        ----
        non-boxed verbatim text...
        ----
        
      • Doxia Sink API:
        Sink#verbatim(void);
        Sink#text(String);
        Sink#verbatim_(void);
        
      • Markdown: TBD
      • xdoc: TBD

      output

      boxed

      input

      • APT:
        +----+
        boxed verbatim text...
        +----+
        
      • Doxia Sink API:
        Sink#verbatim(SinkEventAttributeSet.BOXED);
        Sink#text(String);
        Sink#verbatim_(void);
        
      • Markdown: TBD
      • xdoc: TBD

      output

      • HTML
        <div class="source"><pre>boxed verbatim text...</pre></div>
        

        TBD: what is precisely done at Doxia level when rendering HTML, what is done at skin level server-side, what is done by JS/CSS at skin level browser time

      • HTML + CSS visual
        <div class="source"><pre class="prettyprint linenums">verbatim text...</pre></div>
        

        HTML result is not focused on boxing or not boxing, but on source hightlighting and linenums (reason: this has been done over years, when introducing source code highlighting in Fluido, and discovering that what we needed in apt was more about activating/disabling highlighting, not so much about boxing. But this was never really specified anywhere, just explaining history 10 years after the fact)
        rendered example on https://github.com/apache/maven-site/blob/master/content/apt/guides/introduction/introduction-to-the-lifecycle.apt

      Future situation:

      non-boxed

      input

      Sink#verbatim(void);
      Sink#text(String);
      Sink#verbatim_(void);
      

      output

      source

      input

      Sink#verbatim(SinkEventAttributeSet.SOURCE);
      Sink#text(String);
      Sink#verbatim_(void);
      

      output

      Attachments

        1. screenshot-4.png
          85 kB
          Michael Osipov
        2. screenshot-3.png
          81 kB
          Michael Osipov
        3. screenshot-2.png
          160 kB
          Michael Osipov
        4. screenshot-1.png
          204 kB
          Michael Osipov

        Issue Links

          Activity

            People

              michael-o Michael Osipov
              michael-o Michael Osipov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: