vmassol (SVN) wrote:
Author: vmassol
Date: 2009-08-08 02:04:58 +0200 (Sat, 08 Aug 2009)
New Revision: 22419
Added:
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/event/EventsChainingRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/plain/PlainTextChainingRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/AnnotatedXHTMLBlockRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/AnnotatedXHTMLChainingRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/AnnotatedXHTMLImageRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/AnnotatedXHTMLLinkRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/AnnotatedXHTMLRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/AnnotatedXHTMLRendererFactory.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/XHTMLChainingRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xwiki/XWikiSyntaxChainingRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/listener/chaining/EmptyBlockChainingListener.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/test/java/org/xwiki/rendering/listener/chaining/EmptyBlockChainingListenerTest.java
Removed:
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/chaining/
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/renderer/printer/MonitoringWikiPrinter.java
Modified:
platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/api/Document.java
platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/api/XWiki.java
platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
platform/core/trunk/xwiki-core/src/test/java/com/xpn/xwiki/doc/XWikiDocumentRenderingTest.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/pom.xml
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/parser/DefaultSyntaxFactory.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/AbstractBlockRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/AbstractPrintRendererFactory.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/event/EventRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/plain/PlainTextRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/DefaultXHTMLImageRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/DefaultXHTMLLinkRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/XHTMLBlockRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/XHTMLMacroRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/XHTMLRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xwiki/XWikiSyntaxRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/parser/Syntax.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/parser/SyntaxType.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/renderer/printer/XHTMLWikiPrinter.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/renderer/xhtml/XHTMLImageRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/renderer/xhtml/XHTMLLinkRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/resources/META-INF/components.txt
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/test/java/org/xwiki/rendering/listener/chaining/LookaheadChainingListenerTest.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/test/java/org/xwiki/rendering/parser/SyntaxTest.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-box/src/test/resources/macrobox5.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-box/src/test/resources/macrobox6.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-chart/src/test/resources/macrochart1.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-chart/src/test/resources/macrochart2.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-chart/src/test/resources/macrochart3.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-chart/src/test/resources/macrochart4.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/main/java/org/xwiki/rendering/internal/parser/pygments/PygmentsParser.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/test/resources/macrocode7.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/main/java/org/xwiki/rendering/internal/macro/html/HTMLMacroXHTMLChainingRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/main/java/org/xwiki/rendering/internal/macro/html/HTMLMacroXHTMLRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/main/java/org/xwiki/rendering/internal/macro/html/HTMLMacroXHTMLRendererFactory.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/resources/macrohtml1.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/resources/macrohtml10.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/resources/macrohtml11.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/resources/macrohtml13.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/resources/macrohtml14.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/resources/macrohtml15.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/resources/macrohtml16.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/resources/macrohtml2.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/resources/macrohtml8.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/resources/macrohtml9.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-id/src/test/resources/macroid1.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-id/src/test/resources/macroid2.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-rss/src/test/resources/macrorss1.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-rss/src/test/resources/macrorss2.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-toc/src/test/resources/macrotoc8.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-toc/src/test/resources/macrotoc9.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/test/resources/macrovelocity1.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/test/resources/macrovelocity4.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/test/resources/macrovelocity5.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/test/resources/macrovelocity6.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/test/resources/macrovelocity7.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-velocity/src/test/resources/macrovelocity8.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/java/org/xwiki/rendering/internal/parser/DefaultSyntaxFactoryTest.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/escape/escape10.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/escape/escape15.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/escape/escape16.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/escape/escape17.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/escape/escape7.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/image/image1.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/image/image2.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/image/image3.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/image/image4.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links1.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links10.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links12.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links13.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links14.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links15.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links16.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links17.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links18.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links2.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links20.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links21.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links3.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links4.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links5.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links6.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links7.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links8.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/link/links9.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro1.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro10.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro11.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro12.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro13.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro14.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro5.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro6.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro7.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro8.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/macros/macro9.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/paragraph/paragraph4.test
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/resources/section/section10.test
platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/xwiki.js
platform/web/trunk/standard/src/main/webapp/templates/wysiwyginput.vm
platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/server/DefaultWysiwygService.java
platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/server/converter/internal/DefaultHTMLConverter.java
Log:
XWIKI-4028: Use a XHTML renderer that doesn't add round-trip comments when viewing a
wiki page in view mode in ordre to improve performances
+ various refactorings (SyntaxType improvement and others)
[snip]
Modified: platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/xwiki.js
===================================================================
--- platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/xwiki.js 2009-08-07
19:35:57 UTC (rev 22418)
+++ platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/xwiki.js 2009-08-08
00:04:58 UTC (rev 22419)
@@ -363,39 +363,23 @@
// Section count starts at one, not zero.
var sectioncount = 1;
- // We can't use element.select() since it does not allow to retrieve
comment nodes.
- var nodes = $("xwikicontent").childNodes;
- // We don't have to use a macro depth variable since multiple macro levels
will generate only one comment.
- var withinmacro = false;
-
- for (var i = 0; i < nodes.length; i++) {
- var node = $(nodes[i]);
+
+ // For all non-generated headers, add a SPAN and A element in order to be able
to edit the section.
+
$('xwikicontent').select('h1:not([class~=wikigeneratedheader])',
+ 'h2:not([class~=wikigeneratedheader])').each(function(header) {
Moving the dom injection in a named method + using "invoke"
(
http://www.prototypejs.org/api/enumerable/invoke) instead of "each"
might perform better on documents with a lot of non-generated headers.
See
http://www.prototypejs.org/api/enumerable/each
- // Deactivate "edit section" links insertion when we are in
content generated by a macro.
- // Examples: include macro, velocity macro.
- if (node.nodeName == "#comment") {
- if (node.data.match(/^startmacro/) != null) {
- withinmacro = true;
- } else if (node.data == "stopmacro") {
- withinmacro = false;
- }
- }
+ var editspan = document.createElement("SPAN");
+ var editlink = document.createElement("A");
- // Insert "edit section" links after level 1 and level 2
headings.
- if (withinmacro == 0 && (node.nodeName == "H1" ||
node.nodeName == "H2")) {
- var editspan = document.createElement("SPAN");
- var editlink = document.createElement("A");
-
- editlink.href = window.docediturl + "?section=" +
sectioncount;
- editlink.style.textDecoration = "none";
- editlink.innerHTML = "$msg.get('edit')";
- editspan.className = "edit_section";
+ editlink.href = window.docediturl + "?section=" + sectioncount;
+ editlink.style.textDecoration = "none";
+ editlink.innerHTML = "$msg.get('edit')";
+ editspan.className = "edit_section";
There is an easier way of doing this, using prototype :
var editlink = new Element("link", { "href": window.docediturl +
"?section=" + sectioncount,
"style" :
"text-decoration:none",
"class" : "edit_section" }
).update("$msg.get('edit')");
- editspan.appendChild(editlink);
- node.insert( { 'after': editspan } );
- sectioncount++;
- }
- }
+ editspan.appendChild(editlink);
+ header.insert( { 'after': editspan } );
+ sectioncount++;
+ });
}
},
[snip]
_______________________________________________
notifications mailing list
notifications(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/notifications