You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2021/11/15 14:24:00 UTC

[jspwiki] 10/14: JSPWIKI-1159: Allow referral plugins to display their results using columns

This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 68c80afd267612e573868d3273b6575041823c28
Author: Juan Pablo Santos Rodríguez <ju...@gmail.com>
AuthorDate: Mon Nov 15 15:18:08 2021 +0100

    JSPWIKI-1159: Allow referral plugins to display their results using columns
---
 .../apache/wiki/plugin/AbstractReferralPlugin.java | 166 ++++++++++-----------
 .../org/apache/wiki/plugin/PageViewPlugin.java     |   4 +-
 .../apache/wiki/plugin/ReferredPagesPlugin.java    |  70 ++++++---
 .../apache/wiki/plugin/ReferringPagesPlugin.java   |  29 ++--
 .../wiki/plugin/ReferringUndefinedPagesPlugin.java |   2 +-
 .../apache/wiki/plugin/UndefinedPagesPlugin.java   |   4 +-
 .../org/apache/wiki/plugin/UnusedPagesPlugin.java  |   3 +-
 7 files changed, 139 insertions(+), 139 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/AbstractReferralPlugin.java b/jspwiki-main/src/main/java/org/apache/wiki/plugin/AbstractReferralPlugin.java
index 41a5991..8a010dc 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/AbstractReferralPlugin.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/AbstractReferralPlugin.java
@@ -72,6 +72,7 @@ import java.util.stream.Collectors;
  *  <li><b>include</b> -  a regular expression of pages to include in the list. </li>
  *  <li><b>show</b> - value is either "pages" (default) or "count".  When "count" is specified, shows only the count
  *      of pages which match. (since 2.8)</li>
+ *  <li><b>columns</b> - How many columns should the output be displayed on.</li>
  *  <li><b>showLastModified</b> - When show=count, shows also the last modified date. (since 2.8)</li>
  *  <li><b>sortOrder</b> - specifies the sort order for the resulting list.  Options are
  *  'human', 'java', 'locale' or a <code>RuleBasedCollator</code> rule string. (since 2.8.3)</li>
@@ -115,28 +116,32 @@ public abstract class AbstractReferralPlugin implements Plugin {
     /** Parameter name for showing the last modification count.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_LASTMODIFIED     = "showLastModified";
 
+    /** Parameter name for setting the number of columns that will be displayed by the plugin.  Value is <tt>{@value}</tt>. Available since 2.11.0. */
+    public static final String PARAM_COLUMNS          = "columns";
+
     /** Parameter name for specifying the sort order.  Value is <tt>{@value}</tt>. */
     protected static final String PARAM_SORTORDER        = "sortOrder";
     protected static final String PARAM_SORTORDER_HUMAN  = "human";
     protected static final String PARAM_SORTORDER_JAVA   = "java";
     protected static final String PARAM_SORTORDER_LOCALE = "locale";
 
-    protected           int      m_maxwidth = Integer.MAX_VALUE;
-    protected           String   m_before = ""; // null not blank
-    protected           String   m_separator = ""; // null not blank
-    protected           String   m_after = "\\\\";
+    protected int m_maxwidth = Integer.MAX_VALUE;
+    protected String m_before = ""; // null not blank
+    protected String m_separator = ""; // null not blank
+    protected String m_after = "\\\\";
+    protected int items = 0;
 
-    protected           Pattern[]  m_exclude;
-    protected           Pattern[]  m_include;
-    protected           PageSorter m_sorter;
+    protected Pattern[]  m_exclude;
+    protected Pattern[]  m_include;
+    protected PageSorter m_sorter;
 
-    protected           String m_show = "pages";
-    protected           boolean m_lastModified;
+    protected String m_show = "pages";
+    protected boolean m_lastModified;
     // the last modified date of the page that has been last modified:
-    protected           Date m_dateLastModified = new Date(0);
-    protected           SimpleDateFormat m_dateFormat;
+    protected Date m_dateLastModified = new Date(0);
+    protected SimpleDateFormat m_dateFormat;
 
-    protected           Engine m_engine;
+    protected Engine m_engine;
 
     /**
      * @param context the wiki context
@@ -144,16 +149,16 @@ public abstract class AbstractReferralPlugin implements Plugin {
      * @throws PluginException if any of the plugin parameters are malformed
      */
     // FIXME: The compiled pattern strings should really be cached somehow.
-    public void initialize( final Context context, final Map<String, String> params ) throws PluginException {
+    public void initialize( final Context context, final Map< String, String > params ) throws PluginException {
         m_dateFormat = Preferences.getDateFormat( context, TimeFormat.DATETIME );
         m_engine = context.getEngine();
         m_maxwidth = TextUtil.parseIntParameter( params.get( PARAM_MAXWIDTH ), Integer.MAX_VALUE );
-        if( m_maxwidth < 0 ) m_maxwidth = 0;
+        if( m_maxwidth < 0 ) {
+            m_maxwidth = 0;
+        }
 
         String s = params.get( PARAM_SEPARATOR );
-
-        if( s != null )
-        {
+        if( s != null ) {
             m_separator = TextUtil.replaceEntities( s );
             // pre-2.1.145 there was a separator at the end of the list
             // if they set the parameters, we use the new format of
@@ -162,89 +167,63 @@ public abstract class AbstractReferralPlugin implements Plugin {
         }
 
         s = params.get( PARAM_BEFORE );
-
-        if( s != null )
-        {
+        if( s != null ) {
             m_before = s;
         }
 
         s = params.get( PARAM_AFTER );
-
-        if( s != null )
-        {
+        if( s != null ) {
             m_after = s;
         }
 
-        s = params.get( PARAM_EXCLUDE );
+        s = params.get( PARAM_COLUMNS );
+        if( s!= null ) {
+            items = TextUtil.parseIntParameter( s, 0 );
+        }
 
-        if( s != null )
-        {
-            try
-            {
+        s = params.get( PARAM_EXCLUDE );
+        if ( s != null ) {
+            try {
                 final PatternCompiler pc = new GlobCompiler();
-
                 final String[] ptrns = StringUtils.split( s, "," );
-
-                m_exclude = new Pattern[ptrns.length];
-
-                for( int i = 0; i < ptrns.length; i++ )
-                {
-                    m_exclude[i] = pc.compile( ptrns[i] );
+                m_exclude = new Pattern[ ptrns.length ];
+                for ( int i = 0; i < ptrns.length; i++ ) {
+                    m_exclude[ i ] = pc.compile( ptrns[ i ] );
                 }
-            }
-            catch( final MalformedPatternException e )
-            {
-                throw new PluginException("Exclude-parameter has a malformed pattern: "+e.getMessage());
+            } catch ( final MalformedPatternException e ) {
+                throw new PluginException( "Exclude-parameter has a malformed pattern: " + e.getMessage() );
             }
         }
 
         // TODO: Cut-n-paste, refactor
         s = params.get( PARAM_INCLUDE );
-
-        if( s != null )
-        {
-            try
-            {
+        if ( s != null ) {
+            try {
                 final PatternCompiler pc = new GlobCompiler();
-
                 final String[] ptrns = StringUtils.split( s, "," );
-
-                m_include = new Pattern[ptrns.length];
-
-                for( int i = 0; i < ptrns.length; i++ )
-                {
-                    m_include[i] = pc.compile( ptrns[i] );
+                m_include = new Pattern[ ptrns.length ];
+                for ( int i = 0; i < ptrns.length; i++ ) {
+                    m_include[ i ] = pc.compile( ptrns[ i ] );
                 }
-            }
-            catch( final MalformedPatternException e )
-            {
-                throw new PluginException("Include-parameter has a malformed pattern: "+e.getMessage());
+            } catch ( final MalformedPatternException e ) {
+                throw new PluginException( "Include-parameter has a malformed pattern: " + e.getMessage() );
             }
         }
 
         // log.debug( "Requested maximum width is "+m_maxwidth );
         s = params.get(PARAM_SHOW);
-
-        if( s != null )
-        {
-            if( s.equalsIgnoreCase( "count" ) )
-            {
+        if ( s != null ) {
+            if ( s.equalsIgnoreCase( "count" ) ) {
                 m_show = "count";
             }
         }
 
         s = params.get( PARAM_LASTMODIFIED );
-
-        if( s != null )
-        {
-            if( s.equalsIgnoreCase( "true" ) )
-            {
-                if( m_show.equals( "count" ) )
-                {
+        if ( s != null ) {
+            if ( s.equalsIgnoreCase( "true" ) ) {
+                if ( m_show.equals( "count" ) ) {
                     m_lastModified = true;
-                }
-                else
-                {
+                } else {
                     throw new PluginException( "showLastModified=true is only valid if show=count is also specified" );
                 }
             }
@@ -255,8 +234,8 @@ public abstract class AbstractReferralPlugin implements Plugin {
 
     protected List< Page > filterWikiPageCollection( final Collection< Page > pages ) {
         final List< String > pageNames = filterCollection( pages.stream()
-                                                          .map( page -> page.getName() )
-                                                          .collect( Collectors.toList() ) );
+                                                                .map( Page::getName )
+                                                                .collect( Collectors.toList() ) );
         return pages.stream()
                     .filter( wikiPage -> pageNames.contains( wikiPage.getName() ) )
                     .collect( Collectors.toList() );
@@ -268,12 +247,9 @@ public abstract class AbstractReferralPlugin implements Plugin {
      *  @param c The collection to filter.
      *  @return A filtered collection.
      */
-    protected List< String > filterCollection( final Collection< String > c )
-    {
+    protected List< String > filterCollection( final Collection< String > c ) {
         final ArrayList< String > result = new ArrayList<>();
-
         final PatternMatcher pm = new Perl5Matcher();
-
         for( final String pageName : c ) {
             //
             //  If include parameter exists, then by default we include only those
@@ -303,7 +279,6 @@ public abstract class AbstractReferralPlugin implements Plugin {
 
             if( includeThis ) {
                 result.add( pageName );
-                //
                 //  if we want to show the last modified date of the most recently change page, we keep a "high watermark" here:
                 final Page page;
                 if( m_lastModified ) {
@@ -355,30 +330,29 @@ public abstract class AbstractReferralPlugin implements Plugin {
         final Iterator< String > it = links.iterator();
         int count = 0;
 
-        //
         //  The output will be B Item[1] A S B Item[2] A S B Item[3] A
-        //
-        while( it.hasNext() && ( (count < numItems) || ( numItems == ALL_ITEMS ) ) )
-        {
+        while( it.hasNext() && ( (count < numItems) || ( numItems == ALL_ITEMS ) ) ) {
             final String value = it.next();
-
-            if( count > 0 )
-            {
+            if( count > 0 ) {
                 output.append( m_after );
-                output.append( m_separator );
+                output.append( separator );
             }
 
             output.append( m_before );
 
             // Make a Wiki markup link. See TranslatorReader.
-            output.append( "[" ).append( m_engine.getManager( RenderingManager.class ).beautifyTitle( value ) ).append( "|" ).append( value ).append( "]" );
+            output.append( "[" )
+                  .append( m_engine.getManager( RenderingManager.class ).beautifyTitle( value ) )
+                  .append( "|" )
+                  .append( value )
+                  .append( "]" );
             count++;
         }
 
-        //
         //  Output final item - if there have been none, no "after" is printed
-        //
-        if( count > 0 ) output.append( m_after );
+        if( count > 0 ) {
+            output.append( m_after );
+        }
 
         return output.toString();
     }
@@ -397,8 +371,8 @@ public abstract class AbstractReferralPlugin implements Plugin {
         final RenderingManager mgr = m_engine.getManager( RenderingManager.class );
 
         try {
-            final MarkupParser parser = mgr.getParser(context, wikitext);
-            parser.addLinkTransmutator( new CutMutator(m_maxwidth) );
+            final MarkupParser parser = mgr.getParser( context, wikitext );
+            parser.addLinkTransmutator( new CutMutator( m_maxwidth ) );
             parser.enableImageInlining( false );
 
             final WikiDocument doc = parser.parse();
@@ -410,6 +384,16 @@ public abstract class AbstractReferralPlugin implements Plugin {
         return result;
     }
 
+    protected String applyColumnsStyle( final String result ) {
+        if( items > 1 ) {
+            return "<div style=\"columns:" + items + ";" +
+                                "-moz-columns:" + items + ";" +
+                                "-webkit-columns:" + items + ";" + "\">"
+                    + result + "</div>";
+        }
+        return result;
+    }
+
     /**
      *  A simple class that just cuts a String to a maximum
      *  length, adding three dots after the cutpoint.
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/PageViewPlugin.java b/jspwiki-main/src/main/java/org/apache/wiki/plugin/PageViewPlugin.java
index 057767b..d438103 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/PageViewPlugin.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/PageViewPlugin.java
@@ -428,7 +428,7 @@ public class PageViewPlugin extends AbstractReferralPlugin implements Plugin, In
                             // did we specify what pages to exclude?
                             if( use && null != exclude ) {
                                 for( int n = 0; use && n < exclude.length; n++ ) {
-                                    use &= !matcher.matches( name, exclude[ n ] );
+                                    use = !matcher.matches( name, exclude[ n ] );
                                 }
                             }
 
@@ -610,7 +610,7 @@ public class PageViewPlugin extends AbstractReferralPlugin implements Plugin, In
         }
 
         /**
-         * @return String String representation of the count.
+         * @return String representation of the count.
          */
         @Override
         public String toString()
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/ReferredPagesPlugin.java b/jspwiki-main/src/main/java/org/apache/wiki/plugin/ReferredPagesPlugin.java
index 25c7e4a..8493a5f 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/ReferredPagesPlugin.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/ReferredPagesPlugin.java
@@ -59,24 +59,25 @@ import java.util.Map;
 public class ReferredPagesPlugin implements Plugin {
 
     private static final Logger log = LogManager.getLogger( ReferredPagesPlugin.class );
-    private Engine         m_engine;
-    private int            m_depth;
-    private final HashSet<String> m_exists  = new HashSet<>();
-    private final StringBuffer   m_result  = new StringBuffer(1024);
+    private Engine m_engine;
+    private int m_depth;
+    private final HashSet< String > m_exists  = new HashSet<>();
+    private final StringBuffer m_result  = new StringBuffer( 1024 );
     private final PatternMatcher m_matcher = new Perl5Matcher();
-    private Pattern        m_includePattern;
-    private Pattern        m_excludePattern;
-    private boolean m_formatCompact  = true;
+    private Pattern m_includePattern;
+    private Pattern m_excludePattern;
+    private int items = 0;
+    private boolean m_formatCompact = true;
     private boolean m_formatSort;
 
     /** The parameter name for the root page to start from.  Value is <tt>{@value}</tt>. */
-    public static final String PARAM_ROOT    = "page";
+    public static final String PARAM_ROOT = "page";
 
     /** The parameter name for the depth.  Value is <tt>{@value}</tt>. */
-    public static final String PARAM_DEPTH   = "depth";
+    public static final String PARAM_DEPTH = "depth";
 
     /** The parameter name for the type of the references.  Value is <tt>{@value}</tt>. */
-    public static final String PARAM_TYPE    = "type";
+    public static final String PARAM_TYPE = "type";
 
     /** The parameter name for the included pages.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_INCLUDE = "include";
@@ -85,19 +86,22 @@ public class ReferredPagesPlugin implements Plugin {
     public static final String PARAM_EXCLUDE = "exclude";
 
     /** The parameter name for the format.  Value is <tt>{@value}</tt>. */
-    public static final String PARAM_FORMAT  = "format";
+    public static final String PARAM_FORMAT = "format";
+
+    /** Parameter name for setting the number of columns that will be displayed by the plugin.  Value is <tt>{@value}</tt>. Available since 2.11.0. */
+    public static final String PARAM_COLUMNS = "columns";
 
     /** The minimum depth. Value is <tt>{@value}</tt>. */
-    public static final int    MIN_DEPTH = 1;
+    public static final int MIN_DEPTH = 1;
 
     /** The maximum depth. Value is <tt>{@value}</tt>. */
-    public static final int    MAX_DEPTH = 8;
+    public static final int MAX_DEPTH = 8;
 
     /**
      *  {@inheritDoc}
      */
     @Override
-    public String execute( final Context context, final Map<String, String> params ) throws PluginException {
+    public String execute( final Context context, final Map< String, String > params ) throws PluginException {
         m_engine = context.getEngine();
         final Page page = context.getPage();
         if( page == null ) {
@@ -122,18 +126,30 @@ public class ReferredPagesPlugin implements Plugin {
         }
 
         m_depth = TextUtil.parseIntParameter( params.get( PARAM_DEPTH ), MIN_DEPTH );
-        if( m_depth > MAX_DEPTH )  m_depth = MAX_DEPTH;
+        if( m_depth > MAX_DEPTH ) {
+            m_depth = MAX_DEPTH;
+        }
 
         String includePattern = params.get(PARAM_INCLUDE);
-        if( includePattern == null ) includePattern = ".*";
+        if( includePattern == null ) {
+            includePattern = ".*";
+        }
 
         String excludePattern = params.get(PARAM_EXCLUDE);
-        if( excludePattern == null ) excludePattern = "^$";
+        if( excludePattern == null ) {
+            excludePattern = "^$";
+        }
+
+        final String columns = params.get( PARAM_COLUMNS );
+        if( columns != null ) {
+            items = TextUtil.parseIntParameter( columns, 0 );
+        }
 
         log.debug( "Fetching referred pages for "+ rootname +
                    " with a depth of "+ m_depth +
                    " with include pattern of "+ includePattern +
-                   " with exclude pattern of "+ excludePattern );
+                   " with exclude pattern of "+ excludePattern +
+                   " with " + columns + " items" );
 
         //
         // do the actual work
@@ -144,7 +160,15 @@ public class ReferredPagesPlugin implements Plugin {
                              "] format[" + ( m_formatCompact ? "compact" : "full" ) +
                              ( m_formatSort ? " sort" : "" ) + "]";
 
-        m_result.append( "<div class=\"ReferredPagesPlugin\">\n" );
+        if( items > 1 ) {
+            m_result.append( "<div class=\"ReferredPagesPlugin\" style=\"" )
+                    .append( "columns:" ).append( columns ).append( ";" )
+                    .append( "moz-columns:" ).append( columns ).append( ";" )
+                    .append( "webkit-columns:" ).append( columns ).append( ";" )
+                    .append( "\">\n" );
+        } else {
+            m_result.append( "<div class=\"ReferredPagesPlugin\">\n" );
+        }
         m_result.append( "<a class=\"wikipage\" href=\"" )
                 .append( href ).append( "\" title=\"" )
                 .append( TextUtil.replaceEntities( title ) )
@@ -181,7 +205,6 @@ public class ReferredPagesPlugin implements Plugin {
         return m_result.toString() ;
     }
 
-
     /**
      * Retrieves a list of all referred pages. Is called recursively depending on the depth parameter.
      */
@@ -201,10 +224,9 @@ public class ReferredPagesPlugin implements Plugin {
         handleLinks( context, allPages, ++depth, pagename );
     }
 
-    private void handleLinks( final Context context, final Collection<String> links, final int depth, final String pagename) {
+    private void handleLinks( final Context context, final Collection<String> links, final int depth, final String pagename ) {
         boolean isUL = false;
-        final HashSet< String > localLinkSet = new HashSet<>();  // needed to skip multiple
-        // links to the same page
+        final HashSet< String > localLinkSet = new HashSet<>();  // needed to skip multiple links to the same page
         localLinkSet.add( pagename );
 
         final ArrayList< String > allLinks = new ArrayList<>();
@@ -221,7 +243,7 @@ public class ReferredPagesPlugin implements Plugin {
             localLinkSet.add( link );
 
             if( !m_engine.getManager( PageManager.class ).wikiPageExists( link ) ) {
-                continue; // hide links to non existing pages
+                continue; // hide links to non-existing pages
             }
             if(  m_matcher.matches( link , m_excludePattern ) ) {
                 continue;
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/ReferringPagesPlugin.java b/jspwiki-main/src/main/java/org/apache/wiki/plugin/ReferringPagesPlugin.java
index a2af465..3a3766e 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/ReferringPagesPlugin.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/ReferringPagesPlugin.java
@@ -80,7 +80,6 @@ public class ReferringPagesPlugin extends AbstractReferralPlugin {
         }
 
         final Page page = context.getEngine().getManager( PageManager.class ).getPage( pageName );
-
         if( page != null ) {
             Collection< String > links  = refmgr.findReferrers( page.getName() );
             String wikitext;
@@ -91,23 +90,22 @@ public class ReferringPagesPlugin extends AbstractReferralPlugin {
 
             String extras = TextUtil.replaceEntities( params.get( PARAM_EXTRAS ) );
             if( extras == null ) {
-                extras = rb.getString("referringpagesplugin.more");
+                extras = rb.getString( "referringpagesplugin.more" );
             }
 
             if( log.isDebugEnabled() ) {
-                log.debug( "Fetching referring pages for " + page.getName() + " with a max of "+items);
+                log.debug( "Fetching referring pages for {} with a max of {}", page.getName(), items );
             }
 
             if( links != null && links.size() > 0 ) {
                 links = filterAndSortCollection( links );
                 wikitext = wikitizeCollection( links, m_separator, items );
 
-                result.append( makeHTML( context, wikitext ) );
+                result.append( applyColumnsStyle( makeHTML( context, wikitext ) ) );
 
-                if( items < links.size() && items > 0 )
-                {
-                    final Object[] args = { "" + ( links.size() - items) };
-                    extras = MessageFormat.format(extras, args);
+                if( items < links.size() && items > 0 ) {
+                    final Object[] args = { "" + ( links.size() - items ) };
+                    extras = MessageFormat.format( extras, args );
 
                     result.append( "<br />" )
                           .append( "<a class='morelink' href='" )
@@ -119,20 +117,15 @@ public class ReferringPagesPlugin extends AbstractReferralPlugin {
                 }
             }
 
-            //
             // If nothing was left after filtering or during search
-            //
             if( links == null || links.size() == 0 ) {
                 wikitext = rb.getString( "referringpagesplugin.nobody" );
-
                 result.append( makeHTML( context, wikitext ) );
-            } else {
-                if( m_show.equals( PARAM_SHOW_VALUE_COUNT ) ) {
-                    result = new StringBuilder();
-                    result.append( links.size() );
-                    if( m_lastModified ) {
-                        result.append( " (" ).append( m_dateFormat.format( m_dateLastModified ) ).append( ")" );
-                    }
+            } else  if( m_show.equals( PARAM_SHOW_VALUE_COUNT ) ) {
+                result = new StringBuilder();
+                result.append( links.size() );
+                if( m_lastModified ) {
+                    result.append( " (" ).append( m_dateFormat.format( m_dateLastModified ) ).append( ")" );
                 }
             }
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/ReferringUndefinedPagesPlugin.java b/jspwiki-main/src/main/java/org/apache/wiki/plugin/ReferringUndefinedPagesPlugin.java
index aca7ede..0cd11de 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/ReferringUndefinedPagesPlugin.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/ReferringUndefinedPagesPlugin.java
@@ -77,7 +77,7 @@ public class ReferringUndefinedPagesPlugin extends AbstractReferralPlugin {
 
         final String wikitext = wikitizeCollection( result, m_separator, items );
         final StringBuilder resultHTML = new StringBuilder();
-        resultHTML.append( makeHTML( context, wikitext ) );
+        resultHTML.append( applyColumnsStyle( makeHTML( context, wikitext ) ) );
 
         // add the more.... text
         if( items < result.size() && items > 0 ) {
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/UndefinedPagesPlugin.java b/jspwiki-main/src/main/java/org/apache/wiki/plugin/UndefinedPagesPlugin.java
index 8196fba..877cef1 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/UndefinedPagesPlugin.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/UndefinedPagesPlugin.java
@@ -55,11 +55,11 @@ public class UndefinedPagesPlugin extends AbstractReferralPlugin {
         final String wikitext;
         if( m_show.equals( PARAM_SHOW_VALUE_COUNT ) ) {
             wikitext = "" + links.size();
+            return makeHTML( context, wikitext );
         } else {
             wikitext = wikitizeCollection( links, m_separator, ALL_ITEMS );
+            return applyColumnsStyle( makeHTML( context, wikitext ) );
         }
-        
-        return makeHTML( context, wikitext );
     }
 
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/UnusedPagesPlugin.java b/jspwiki-main/src/main/java/org/apache/wiki/plugin/UnusedPagesPlugin.java
index 094eeea..b751646 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/UnusedPagesPlugin.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/UnusedPagesPlugin.java
@@ -65,10 +65,11 @@ public class UnusedPagesPlugin extends AbstractReferralPlugin {
             if( m_lastModified && links.size() != 0 ) {
                 wikitext = links.size() + " (" + m_dateFormat.format( m_dateLastModified ) + ")";
             }
+            return makeHTML( context, wikitext );
         } else {
             wikitext = wikitizeCollection( links, m_separator, ALL_ITEMS );
+            return applyColumnsStyle( makeHTML( context, wikitext ) );
         }
-        return makeHTML( context, wikitext );
     }
 
 }