You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by br...@apache.org on 2015/08/28 21:24:58 UTC

svn commit: r1698394 - in /jspwiki/trunk: ./ jspwiki-war/src/main/java/org/apache/wiki/ jspwiki-war/src/main/java/org/apache/wiki/parser/ jspwiki-war/src/main/scripts/moo-extend/ jspwiki-war/src/main/scripts/wiki-edit/ jspwiki-war/src/main/scripts/wiki...

Author: brushed
Date: Fri Aug 28 19:24:58 2015
New Revision: 1698394

URL: http://svn.apache.org/r1698394
Log:
2.10.2-svn-35 [JSPWIKI-912] Haddock Template: fixing the position of headers
         below the fixed navigation bar, when returning from a section edit.

Modified:
    jspwiki/trunk/ChangeLog
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
    jspwiki/trunk/jspwiki-war/src/main/scripts/moo-extend/Textarea.js
    jspwiki/trunk/jspwiki-war/src/main/scripts/wiki-edit/Snipe.js
    jspwiki/trunk/jspwiki-war/src/main/scripts/wiki-edit/Wiki.Snips.js
    jspwiki/trunk/jspwiki-war/src/main/scripts/wiki/Wiki.js
    jspwiki/trunk/jspwiki-war/src/main/styles/haddock/default/Template.Edit.less

Modified: jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/jspwiki/trunk/ChangeLog?rev=1698394&r1=1698393&r2=1698394&view=diff
==============================================================================
--- jspwiki/trunk/ChangeLog (original)
+++ jspwiki/trunk/ChangeLog Fri Aug 28 19:24:58 2015
@@ -1,3 +1,11 @@
+2015-08-28  Dirk Frederickx (brushed AT apache DOT org)
+
+       * 2.10.2-svn-35 
+       
+       * [JSPWIKI-912] Haddock Template: fixing the position of headers
+         below the fixed navigation bar, when returning from a section edit.
+
+
 2015-08-23  Dirk Frederickx (brushed AT apache DOT org)
 
        * 2.10.2-svn-34  WYSIWYG improvements

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java?rev=1698394&r1=1698393&r2=1698394&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java Fri Aug 28 19:24:58 2015
@@ -72,7 +72,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "34";
+    public static final String     BUILD         = "35";
 
     /**
      *  This is the generic version string you should use when printing out the version.  It is of 

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java?rev=1698394&r1=1698393&r2=1698394&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java Fri Aug 28 19:24:58 2015
@@ -14,7 +14,7 @@
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
-    under the License.  
+    under the License.
  */
 package org.apache.wiki.parser;
 
@@ -81,7 +81,7 @@ import org.jdom2.Verifier;
  *  @since  2.4
  */
 public class JSPWikiMarkupParser extends MarkupParser {
-	
+
     /** Name of the outlink image; relative path to the JSPWiki directory. */
     private static final String OUTLINK_IMAGE = "images/out.png";
 
@@ -192,7 +192,7 @@ public class JSPWikiMarkupParser extends
     private int                    m_rowNum              = 1;
 
     private Heading                m_lastHeading         = null;
-    
+
     /**
      *  This list contains all IANA registered URI protocol
      *  types as of September 2004 + a few well-known extra types.
@@ -247,7 +247,7 @@ public class JSPWikiMarkupParser extends
 
     /**
      *  Creates a markup parser.
-     *  
+     *
      *  @param context The WikiContext which controls the parsing
      *  @param in Where the data is read from.
      */
@@ -506,6 +506,7 @@ public class JSPWikiMarkupParser extends
             case EDIT:
                 el = createAnchor( EDIT, m_context.getURL(WikiContext.EDIT,link), text, "" );
                 el.setAttribute("title", MessageFormat.format( rb.getString( "markupparser.link.create" ), link ) );
+
                 break;
 
             case EMPTY:
@@ -744,7 +745,7 @@ public class JSPWikiMarkupParser extends
     /**
      *  Writes HTML for error message.  Does not add it to the document, you
      *  have to do it yourself.
-     *  
+     *
      *  @param error The error string.
      *  @return An Element containing the error.
      */
@@ -913,20 +914,20 @@ public class JSPWikiMarkupParser extends
                 //  If the following is an XML entity reference (&#.*;) we'll
                 //  leave it as it is; otherwise we'll replace it with an &amp;
                 //
-                
+
                 boolean isEntity = false;
                 StringBuilder entityBuf = new StringBuilder();
-                
+
                 if( i < buf.length() -1 )
                 {
                     for( int j = i; j < buf.length(); j++ )
                     {
                         char ch2 = buf.charAt(j);
-                        
+
                         if( Character.isLetterOrDigit( ch2 ) || (ch2 == '#' && j == i+1) || ch2 == ';' || ch2 == '&' )
                         {
                             entityBuf.append(ch2);
-                            
+
                             if( ch2 == ';' )
                             {
                                 isEntity = true;
@@ -939,17 +940,17 @@ public class JSPWikiMarkupParser extends
                         }
                     }
                 }
-                
-                if( isEntity ) 
+
+                if( isEntity )
                 {
                     tmpBuf.append( entityBuf );
                     i = i + entityBuf.length() - 1;
                 }
-                else 
+                else
                 {
                     tmpBuf.append("&amp;");
                 }
-                
+
             }
             else
             {
@@ -1124,7 +1125,7 @@ public class JSPWikiMarkupParser extends
         title = MarkupParser.wikifyLink( title );
 
         hd.m_titleSection = m_engine.encodeName(title);
-        
+
         if( m_titleSectionCounter.containsKey( hd.m_titleSection ) )
         {
             Integer count = m_titleSectionCounter.get( hd.m_titleSection );
@@ -1141,7 +1142,7 @@ public class JSPWikiMarkupParser extends
                            "-"+hd.m_titleSection;
         hd.m_titleAnchor = hd.m_titleAnchor.replace( '%', '_' );
         hd.m_titleAnchor = hd.m_titleAnchor.replace( '/', '_' );
-        
+
         return hd.m_titleAnchor;
     }
 
@@ -1169,8 +1170,8 @@ public class JSPWikiMarkupParser extends
     }
 
     /**
-     *  Returns XHTML for the heading. 
-     *  
+     *  Returns XHTML for the heading.
+     *
      *  @param level The level of the heading.  @see Heading
      *  @param title the title for the heading
      *  @param hd a List to which heading should be added
@@ -1204,7 +1205,7 @@ public class JSPWikiMarkupParser extends
             throw new InternalWikiException("Illegal heading type "+level);
         }
 
-        
+
         return el;
     }
 
@@ -1426,14 +1427,14 @@ public class JSPWikiMarkupParser extends
     {
         addElement( new ProcessingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, "") );
     }
-    
+
     /**
      *  Gobbles up all hyperlinks that are encased in square brackets.
      */
     private Element handleHyperlinks( String linktext, int pos )
     {
         ResourceBundle rb = Preferences.getBundle( m_context, InternationalizationManager.CORE_BUNDLE );
-        
+
         StringBuilder sb = new StringBuilder(linktext.length()+80);
 
         if( isAccessRule( linktext ) )
@@ -1926,7 +1927,7 @@ public class JSPWikiMarkupParser extends
         callHeadingListenerChain( hd );
 
         m_lastHeading = hd;
-        
+
         if( el != null ) pushElement(el);
 
         return el;
@@ -2375,7 +2376,7 @@ public class JSPWikiMarkupParser extends
             //
             //  Check if there is an attempt to do something nasty
             //
-            
+
             try
             {
                 style = StringEscapeUtils.unescapeHtml(style);
@@ -2629,7 +2630,7 @@ public class JSPWikiMarkupParser extends
             }
 
             int skip = IGNORE;
-            
+
             //
             //  Do the actual parsing and catch any errors.
             //
@@ -2640,10 +2641,10 @@ public class JSPWikiMarkupParser extends
             catch( IllegalDataException e )
             {
                 log.info("Page "+m_context.getPage().getName()+" contains data which cannot be added to DOM tree: "+e.getMessage());
-                
+
                 makeError("Error: "+cleanupSuspectData(e.getMessage()) );
             }
-            
+
             //
             //   The idea is as follows:  If the handler method returns
             //   an element (el != null), it is assumed that it has been
@@ -2678,24 +2679,24 @@ public class JSPWikiMarkupParser extends
     private String cleanupSuspectData( String s )
     {
         StringBuilder sb = new StringBuilder( s.length() );
-        
+
         for( int i = 0; i < s.length(); i++ )
         {
             char c = s.charAt(i);
-            
+
             if( Verifier.isXMLCharacter( c ) ) sb.append( c );
             else sb.append( "0x"+Integer.toString(c,16).toUpperCase() );
         }
-        
+
         return sb.toString();
     }
-    
+
     /** The token is a plain character. */
     protected static final int CHARACTER = 0;
-    
+
     /** The token is a wikimarkup element. */
     protected static final int ELEMENT   = 1;
-    
+
     /** The token is to be ignored. */
     protected static final int IGNORE    = 2;
 
@@ -2733,9 +2734,9 @@ public class JSPWikiMarkupParser extends
             //
 
             // FIXME: This is not really very fast
-            
+
             closeHeadings();
-              
+
             popElement("dl"); // Close definition lists.
             if( m_istable )
             {
@@ -2894,7 +2895,7 @@ public class JSPWikiMarkupParser extends
     /**
      *  Parses the entire document from the Reader given in the constructor or
      *  set by {@link #setInputReader(Reader)}.
-     *  
+     *
      *  @return A WikiDocument, ready to be passed to the renderer.
      *  @throws IOException If parsing cannot be accomplished.
      */

Modified: jspwiki/trunk/jspwiki-war/src/main/scripts/moo-extend/Textarea.js
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/scripts/moo-extend/Textarea.js?rev=1698394&r1=1698393&r2=1698394&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/scripts/moo-extend/Textarea.js (original)
+++ jspwiki/trunk/jspwiki-war/src/main/scripts/moo-extend/Textarea.js Fri Aug 28 19:24:58 2015
@@ -159,7 +159,7 @@ var Textarea = new Class({
             //textarea.focus();
 
         }
-        ta.fireEvent("change");
+        //ta.fireEvent("change");
         return this;
     },
 

Modified: jspwiki/trunk/jspwiki-war/src/main/scripts/wiki-edit/Snipe.js
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/scripts/wiki-edit/Snipe.js?rev=1698394&r1=1698393&r2=1698394&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/scripts/wiki-edit/Snipe.js (original)
+++ jspwiki/trunk/jspwiki-war/src/main/scripts/wiki-edit/Snipe.js Fri Aug 28 19:24:58 2015
@@ -219,7 +219,7 @@ var Snipe = new Class({
         Set/Reset some of the options of the snip-editor.
 
     Arguments:
-        item - snippets|tabcompletion|directsnips|smartpairs|autosuggest
+        item - snippets|directsnips|autosuggest|tabcompletion|smartpair
         value - new value
     Returns
         this Snipe object
@@ -403,7 +403,7 @@ var Snipe = new Class({
     "delete": function(e, txta, caret) {
 
         var tab = this.options.tab;
-            console.log("delete key");
+        //console.log("delete key");
 
         if( caret.thin && !txta.getTillEnd().indexOf(tab) /*index==0*/ ){
 
@@ -442,8 +442,7 @@ var Snipe = new Class({
                 txta.setSelectionRange(caret.start - cmd.length, caret.start)
                     .setSelection("");
 
-                //now invoke the corresponding actions
-                self.commands.action( cmd );
+                return self.commands.action( cmd );
             }
 
         }
@@ -710,8 +709,7 @@ var Snipe = new Class({
             caret = txta.getSelectionRange(),
             s, p;
 
-        //console.log("Snipe.action "+cmd+" ("+args+") snipText=["+snip.text+"] snipParms=["+snip.parms+"] ");
-        console.log("Snipe:action() "+cmd+" ["+args+"]");
+        //console.log("Snipe:action() "+cmd+" ["+args+"]");
 
         if( snip = self.snippets.get(cmd) ){
 

Modified: jspwiki/trunk/jspwiki-war/src/main/scripts/wiki-edit/Wiki.Snips.js
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/scripts/wiki-edit/Wiki.Snips.js?rev=1698394&r1=1698393&r2=1698394&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/scripts/wiki-edit/Wiki.Snips.js (original)
+++ jspwiki/trunk/jspwiki-war/src/main/scripts/wiki-edit/Wiki.Snips.js Fri Aug 28 19:24:58 2015
@@ -199,12 +199,13 @@ Wiki.Snips = {
         autosuggest: { event: 'config' },
         tabcompletion: { event: 'config' },
         previewcolumn: { event: 'config' },
+        wysiwyg: { event: 'config' },
 
 
         // Simple shortcuts
         br: {
             key: "shift+enter",
-            snippet: "\\\\ "
+            snippet: "\\\\\n"
         },
         hr: "\n----\n",
         lorem: "This is is just some sample. Don’t even bother reading it; you will just waste your time. Why do you keep reading? Do I have to use Lorem Ipsum to stop you? OK, here goes: Lorem ipsum dolor sit amet, consectetur adipi sicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Still reading? Gosh, you’re impossible. I’ll stop here to spare you.",
@@ -212,21 +213,21 @@ Wiki.Snips = {
 
 
         // simple inline tab completion commands
-        bold:   { key:'b', snippet: "__{bold}__ " },
-        italic: { key:'i', snippet: "''{italic}'' " },
+        bold:   { key: "b", snippet: "__{bold}__ " },
+        italic: { key: "i", snippet: "''{italic}'' " },
 
-        mono:   "\\{\\{{monospaced text}}} ",
+        mono:   { key: "m", snippet: "\\{\\{{monospaced text}}} " },
         sub:    "%%sub {subscript text}/% ",
         sup:    "%%sup {superscript text}/% ",
         strike: "%%strike {strikethrough text}/% ",
 
         // simple block tab completion commands
-        quote:  "\n%%quote \n{.}\n/%\n",
+        quote:  "\n%%quote \n{Quoted text}\n/%\n",
         dl:     "\n;{term}:{definition-text} ",
         pre:    "\n\\{\\{\\{\n{some preformatted block}\n}}}\n",
         code:   "\n%%prettify \n\\{\\{\\{\n{/* some code block */}\n}}}\n/%\n",
-        table:  "\n||heading-1||heading-2\n| cell11   | cell12\n| cell21   | cell22\n",
-        //xflow:  "\n%%xflow\n{wide content}\n/%\n ",
+        table:  "\n||{heading-1} ||heading-2\n|cell11     |cell12\n|cell21     |cell22\n",
+        t: { synonym: "table" },
 
         me: { alias: 'sign'},
         sign: function(){
@@ -660,9 +661,9 @@ Wiki.Snips = {
             selectInline: [Dialog.Selection, {
                 cssClass: ".dialog-horizontal",
                 body:{
-                    "__bold__":"<b>bold</b>",
-                    "''italic''":"<i>italic</i>",
-                    "{{mono}}":"<tt>mono</tt>",
+                    "__{bold}__":"<b>bold</b>",
+                    "''{italic}''":"<i>italic</i>",
+                    "\\{\\{{monospaced text}}} ":"<tt>mono</tt>",
                     "[description|{link}|options]":"<span class='icon-link'/>",
                     "[{Image src='${image.jpg}'}]":"<span class='icon-picture'/>"
                 }

Modified: jspwiki/trunk/jspwiki-war/src/main/scripts/wiki/Wiki.js
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/scripts/wiki/Wiki.js?rev=1698394&r1=1698393&r2=1698394&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/scripts/wiki/Wiki.js (original)
+++ jspwiki/trunk/jspwiki-war/src/main/scripts/wiki/Wiki.js Fri Aug 28 19:24:58 2015
@@ -203,8 +203,7 @@ var Wiki = {
         }
 
         //console.log( "section", document.referrer, document.referrer.match( /\&section=(\d+)$/ ) );
-        //FFS : refactor -- why not use the standard #section-ID funtionalities
-        wiki.srcollTo( ( document.referrer.match( /\&section=(\d+)$/ ) || [,-1])[1] );
+        wiki.scrollTo( ( document.referrer.match( /\&section=(\d+)$/ ) || [,-1])[1] );
 
         // initialize all registered behaviors
         wiki.update();
@@ -373,19 +372,17 @@ var Wiki = {
     },
 
     /*
-    Function: srcollTo
+    Function: scrollTo
         Scrolls the page to the section previously being edited - if any
         Section counting starts at 1??
     */
-    srcollTo: function( index ){
+    scrollTo: function( index ){
 
         //console.log("Scroll to section ", index, ", Number of sections:", this.getSections().length );
-        var element = this.getSections()[index], pos;
+        var element = this.getSections()[index];
 
         if( element ){
-            pos = element.getPosition();
-            //console.log("SCROLL TO ", element,pos );
-            window.scrollTo(pos.x, pos.y);
+            location.replace( "#" + element.get("id") );
         }
 
     },
@@ -495,7 +492,9 @@ var Wiki = {
 
     getXHRPreview: function( getContent, previewElement ){
 
-        var wiki = this, loading = "loading";
+        var wiki = this,
+            loading = "loading",
+            preview = function(p){ previewElement.removeClass(loading).set("text", p);};
 
         return (function(){
 
@@ -507,10 +506,10 @@ var Wiki = {
                     htmlPageText: getContent()
                 },
                 onSuccess: function(responseText){
-                    previewElement.removeClass(loading).set("text", responseText.trim() );
+                    preview( responseText.trim() );
                 },
                 onFailure: function(e){
-                    putPreview("Sorry, HTML to Wiki Markup conversion failed :=() ",e);
+                    preview( "Sorry, HTML to Wiki Markup conversion failed :=() " + e );
                 }
             }).send();
 

Modified: jspwiki/trunk/jspwiki-war/src/main/styles/haddock/default/Template.Edit.less
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/styles/haddock/default/Template.Edit.less?rev=1698394&r1=1698393&r2=1698394&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/styles/haddock/default/Template.Edit.less (original)
+++ jspwiki/trunk/jspwiki-war/src/main/styles/haddock/default/Template.Edit.less Fri Aug 28 19:24:58 2015
@@ -62,10 +62,11 @@ textarea { white-space: pre-wrap; }
     padding: 0 0 .5em @grid-gutter-width/2; //cannot use margin here, as width=50%
     overflow: scroll;
     -ms-overflow-style: -ms-autohiding-scrollbar;
+    border: 2px dashed transparent;
 
     &.loading {
         //FFS: walking ant animation ?
-        border: 2px dashed red !important;
+        border: 2px dashed red;
     }
 }