Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-4127

Improve Rendering API

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • Major
    • 2.0 M3
    • 2.0 M2
    • {Unused} Rendering 2.0
    • None
    • Unknown

    Description

      From the mailing list:
      http://markmail.org/thread/ywyfwlr7ozdaxjv6

      1) Modify PrintRendererFactory

      a) There's now one factory component per Renderer type with the following interface:

      public interface PrintRendererFactory
      {
      /**

      • @return the Syntax supported by the Renderer type
      • @since 2.0M3
        */
        Syntax getSyntax();

      /**

      • @param printer the printer to use to output renderer data
      • @return a new Renderer instance (stateful)
      • @since 2.0M3
        */
        PrintRenderer createRenderer(WikiPrinter printer);
        }

      b) The getAvailableSynatxes() doesn't exist anymore. It's been moved to SyntaxFactory, see below.

      2) Modify SyntaxFactory

      a) Remove getAvailableSyntaxes() since there are different types of syntaxes: Parser syntaxes, Renderer syntaxes and even amongst Parser/Renderer there will be different types of them: streaming, block. Thus the new strategy is for client code to directly ask for syntaxes by looking up the objects against the CM. getAvailableSyntaxes() has been deprecated.

      3) Introduce BlockRenderer

      @ComponentRole
      public interface BlockRenderer
      {
      /**

      • @param block the block to render in the target syntax
      • @param printer the object where to output the result of the rendering
        */
        void render(Block block, WikiPrinter printer);

      /**

      • @param blocks the list of blocks to render in the target syntax
      • @param printer the object where to output the result of the rendering
      • @todo remove this API once we introduce the notion of BlockCollection
        */
        void render(Collection<Block> blocks, WikiPrinter printer);
        }

      Goals:
      a) Have 2 types of Renderers (as we'll have 2 types of Parsers in the future): Stream and Block
      b) reduce code duplication since using the BlockRenderer will simplify the client code

      4) Introduce Converter

      @ComponentRole
      public interface Converter
      {
      void convert(Reader source, Syntax sourceSyntax, Syntax targetSyntax, WikiPrinter printer)
      throws ConversionException;
      }

      Goal: Simplify client code when the need is pure conversion.

      5) Move Renderer's implementation classes (components now) in the internal package

      They're now components and thus we can move them in the internal package.

      Attachments

        Activity

          People

            vmassol Vincent Massol
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: