Uploaded image for project: 'JSPWiki'
  1. JSPWiki
  2. JSPWIKI-570

Cannot use another MarkupParser - hardcoded references to RenderingManager and JSPWikiMarkupParser

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 2.8.2
    • 2.10.2
    • Core & storage
    • None

    Description

      I'm playing a little with JSPWiki and decided to try different markup syntax to learn a bit more. To do so I have to inherit from RenderingManager and implement another MarkupParser. WikiEngine does good job instantiating RenderingManager:

      m_renderingManager  = (RenderingManager)   ClassUtil.getMappedObject(RenderingManager.class.getName());

      but src/webdocs/templates/default/editors/FCK.jsp does it directly:

      RenderingManager renderingManager = new RenderingManager();

      while it should get help from WikiEngine:

      RenderingManager renderingManager = engine.getRenderingManager();

      or (it new instance is required) call getMappetObject itself.

      There are also some problems with JSPWikiMarkupParser:

      • direct calls or references to static members getImagePatterns, isExternalLink, makeError - (not a big problem for me)
      • private members - some of them would be useful for inherited parser (for example no access to build DOM: m_plainTextBuf, pushElement and related, fillBuffer (of course I can copy-and-paste JSPWikiMarkupParser rather than inherit from it)
      • direct instantiation in src/com/ecyrd/jspwiki/plugin/TableOfContents.java
        JSPWikiMarkupParser parser = new JSPWikiMarkupParser( context, ...
                    parser.addHeadingListener( this );
                    parser.parse();
        

        this looks like a bigger problem, because TableOfContents:

        • does its own parsing (so parsing is done two times) and also (ok this is just performance),
        • does this with directly instantiated JSPWikiMarkupParser (so mine is not called what means I can't change header indicators)

      Of course for my purpose I will do required corrections. The question is are you gays going to work on it?, is it also a problem in 3.0 ? Should I prepare and publish a patch?

      Attachments

        Activity

          People

            Unassigned Unassigned
            piotr_tarnowski Piotr Tarnowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: