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

Make it easier to write wiki-based rendering macros that are editable inline

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 10.10
    • Rendering
    • None
    • Unknown

    Description

      In order to write useful wiki macros you need to use a scripting macro (such as Velocity or Groovy) and the most common approach is to simply "print" the wiki macro output. Unfortunately this means that the macro markers for the nested script macro will appear in the annotated XHTML (which is the input for the WYSIWYG editor) and thus you won't be able to edit the wiki macro inline. See CKEDITOR-253 .

      The only way to fix this ATM is to:

      • either return the list of rendering Blocks instead of printing, but this is not easy and you're forced to use Groovy in order to create the Blocks
      • or write the macro in Java

      Here are some ideas from tmortagne:

      • add support for "returning" a String besides a list of Blocks. We would parse the string with the syntax of the wiki macro document
      • introduce some marker which is used to indicate what to extract from the final XDOM. That could allow to easily indicate that you only want to return this specific part of the result of the execution of the wiki macro. Something like:
        (% macro=result %)
        (((
          stuff to actually return
        )))
        
      • some property in the wiki macro xobject indicating that the top level Block should be removed from the result, or the number of top level blocks to remove from the result

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated: