[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/engine ...

Christian Bauer christian at hibernate.org
Mon Apr 2 14:25:07 EDT 2007


  User: cbauer  
  Date: 07/04/02 14:25:07

  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/core/engine   
                        WikiLinkResolver.java WikiTextParser.java
                        WikiTextRenderer.java
  Log:
  Totally overengineered but definitely cool system/user/instance wiki preferences architecture
  
  Revision  Changes    Path
  1.2       +2 -2      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiLinkResolver.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: WikiLinkResolver.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiLinkResolver.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- WikiLinkResolver.java	22 Mar 2007 12:47:50 -0000	1.1
  +++ WikiLinkResolver.java	2 Apr 2007 18:25:07 -0000	1.2
  @@ -63,7 +63,7 @@
        * </p><p>
        * Note that cross-namespace linking should be supported, so in addition to <tt>[=>Target Name]</tt>,
        * links can be entered by the user as <tt>[=>Target Area|Target Name]</tt>. To resolve these link
  -     * texts, use <tt>REGEX_WIKILINK_CROSSAREA</tt> on the original <tt>GROUP1</tt>, which produces
  +     * texts, use <tt>REGEX_WIKILINK_CROSSAREA</tt> on the original <tt>GROUP2</tt>, which produces
        * two groups. Ignore the given <tt>currentAreaNumber</tt> parameter and resolve in the target namespace entered by
        * the user on the link tag.
        * </p><p>
  @@ -105,7 +105,7 @@
   
   
       /**
  -     * Resolve the given <tt>linkText</tt> to an instance of <tt>WikiLink</tt> and put it in the <tt>link</tt> map.
  +     * Resolve the given <tt>linkText</tt> to an instance of <tt>WikiLink</tt> and put it in the <tt>links</tt> map.
        * <p>
        * The <tt>WikiLink</tt> objects are used during rendering, the rules are as follows:
        * <ul>
  
  
  
  1.2       +7 -7      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: WikiTextParser.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- WikiTextParser.java	22 Mar 2007 12:47:50 -0000	1.1
  +++ WikiTextParser.java	2 Apr 2007 18:25:07 -0000	1.2
  @@ -9,10 +9,7 @@
   import org.jboss.seam.Component;
   import antlr.ANTLRException;
   
  -import java.util.Map;
  -import java.util.ArrayList;
  -import java.util.List;
  -import java.util.HashMap;
  +import java.util.*;
   import java.io.StringReader;
   
   /**
  @@ -24,7 +21,7 @@
    * the <tt>currentDocument</tt>'s content, this change should be flushed to the datastore after calling
    * the parser.
    * </p><p>
  - * After parsing, all links to attachments and all external engine are pushed onto the renderer, where they
  + * After parsing, all links to attachments and all external links are pushed onto the renderer, where they
    * can be used to render an attachment list or similar.
    *
    * @author Christian Bauer
  @@ -40,6 +37,7 @@
       private Map<String, WikiLink> resolvedLinks = new HashMap<String, WikiLink>();
       private List<WikiLink> attachments = new ArrayList<WikiLink>();
       private List<WikiLink> externalLinks = new ArrayList<WikiLink>();
  +    private Set<String> macroNames = new HashSet<String>();
   
       public WikiTextParser(String wikiText, WikiTextRenderer renderer) {
           super(new SeamTextLexer(new StringReader(wikiText)));
  @@ -83,7 +81,7 @@
   
               renderer.setAttachmentLinks(attachments);
               renderer.setExternalLinks(externalLinks);
  -
  +            renderer.setMacroNames(macroNames);
   
           }
           catch (ANTLRException re) {
  @@ -129,7 +127,9 @@
   
       protected String macroInclude(String macroName) {
           // Filter out any dangerous characters
  -        return renderer.renderMacro(macroName.replaceAll("[^\\p{Alnum}]+", ""));
  +        String filteredName = macroName.replaceAll("[^\\p{Alnum}]+", "");
  +        macroNames.add(filteredName);
  +        return renderer.renderMacro(filteredName);
       }
   
   
  
  
  
  1.2       +2 -0      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextRenderer.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: WikiTextRenderer.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextRenderer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- WikiTextRenderer.java	22 Mar 2007 12:47:50 -0000	1.1
  +++ WikiTextRenderer.java	2 Apr 2007 18:25:07 -0000	1.2
  @@ -1,6 +1,7 @@
   package org.jboss.seam.wiki.core.engine;
   
   import java.util.List;
  +import java.util.Set;
   
   /**
    * Called by the WikiTextParser to render [A Link=>Target] and [<=MacroName].
  @@ -16,6 +17,7 @@
   
       public void setAttachmentLinks(List<WikiLink> attachmentLinks);
       public void setExternalLinks(List<WikiLink> externalLinks);
  +    public void setMacroNames(Set<String> macroNames);
   
       public String renderMacro(String macroName);
   
  
  
  



More information about the jboss-cvs-commits mailing list