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

Add a script service to execute rendering transformations

    XMLWordPrintable

Details

    • New Feature
    • Resolution: Unresolved
    • Major
    • 18.1.0-rc-1
    • 18.0.1
    • Rendering - XWiki
    • None
    • Unit
    • Unknown

    Description

      We already have a script service to parse and render the content. We're missing a script service to execute the rendering transformations. I would like to be able to do something like this:

      #set ($targetSyntax = 'uniast/1.0')
      #set ($xdom = $services.rendering.parse($tdoc.content, $tdoc.syntax))
      #set ($discard = $services.rendering.transform($xdom
        ).withSyntax($tdoc.syntax
        ).withTargetSyntax($targetSyntax
        ).withRestricted(true
        ).withTransformations(['macro']
        ).withContentDocument($tdoc.documentReference
        ).execute())
      #set ($renderedContent = $services.rendering.render($xdom, $targetSyntax))
      

      See https://forum.xwiki.org/t/new-services-rendering-transform-api/18175 .

      Note that this is needed for BlockNote integration, which uses the Edit Module, which allows having a template as the entry point for loading the editor. When loading the editor we need to "convert" the content of the edited document from the source syntax to the syntax supported by BlockNote (UniAst). We need to execute the rendering transformations when performing this conversion.

      Attachments

        Issue Links

          Activity

            People

              mflorea Marius Dumitru Florea
              mflorea Marius Dumitru Florea
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: