On Sat, May 9, 2009 at 10:04 AM, David Huynh <dfhuynh(a)alum.mit.edu> wrote:
> Looking at the HTML source, I see
> <div ex:role="coder" ex:coderClass="Color"
> id="party-colors">
> <span ex:color="red">Republican</span>
> <span ex:color="blue">Democratic</span><p/>
> <span ex:case="others" ex:color="#aaa">Other
> parties</span>
> <span ex:case="mixed" ex:color="#eee">Many
> parties</span>
> <span ex:case="missing" ex:color="#444">No party</span>
> </div>
> I think the <p/> is causing problem. Could you remove it and see if that
> helps?
That was exactly the problem! Thank you so much, as that's one I would have
never spotted myself!
FYI, here's what happened: Since I just cut/paste the HTML from view-source
on the presidents example on simile-widgets.org, the newlines got
interpreted as paragraphs by the wiki-engine in Xwiki. So, I removed the
extra newline in Exhibit.Presidents2, and it now works in IE! This is a
"gotcha" I frequently hit in Xwiki, although I find the ability to mashup
HTML and wikitext in an active document quite useful.
Now both the "standalone"
http://nielsmayer.com/xwiki/bin/view/Exhibit/Presidents2
and locally-hosted-exhibit
http://nielsmayer.com/xwiki/bin/view/Exhibit/Presidents
work in IE! Thanks again and also thanks for Exhibit which is just all
around great!
The updated XAR (zip format) of "Presidents2" example is here:
http://nielsmayer.com/xwiki/bin/download/Exhibit/Presidents2/Exhibit.Presid…
Length Date Time Name
-------- ---- ---- ----
94080 05-09-09 10:30 Exhibit/Presidents2.xml
2226 05-09-09 10:30 Exhibit/PresidentsSchemaJSON.xml
29379 05-09-09 10:30 Exhibit/PresidentsJSON.xml
544 05-09-09 10:30 package.xml
-------- -------
126229 4 files
Niels
http://nielsmayer.com
PS: After sending the announcement yesterday, I realized there was one issue
that makes this example not quite standalone. Exhibit.PresidentsPkg.xar
contains a hard-coded google-maps key that you receive when registering your
site <http://code.google.com/apis/maps/signup.html>. You'll need to change
"gmapkey" setting in object XWiki.JavaScriptExtension[2] on document
"Exhibit.Presidents2":
> params: { bundle: true, authenticated: false, autoCreate: false, safe:
> false, gmapkey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", views: "timeline,map" }
Until this is changed, you'll get a dialog box from google saying you need
to register. When you click away the dialog box, it should load the
interface even if not correctly registered.
PPS: What does this Exhibit parameter setting do, and what is the correct
value:
namespace: "http://simile.mit.edu/2006/11/exhibit#",
(also in object XWiki.JavaScriptExtension[2] on document
"Exhibit.Presidents2)
Hi,
I have completed sending loging / logout observation events and trying to
write integration test for the task. I have written a test case similar to
the attached file. I want to clear few things about it. As well as I got few
issues while trying to run.
*Question 1* - I think this test should check my observation event sending -
Please comment on if there is any mistake on groovy script added to
createPage() content.
*Question 2 *- On running the selinium tests
Test is named LoginObservationTest
After writing the test case, For first time run, I went to
/enterprise/distribution-test/selenium-tests directory and run the following
command as in tutorial
mvn install -Dpattern=LoginObservationTest
It showed an error saying
java.lang.RuntimeException: Firefox couldn't be found in the path!
Please add the directory containing 'firefox-bin' to your PATH environment
variable, or explicitly specify a path to Firefox like this:
*firefox /blah/blah/firefox-bin
Then I have linked the firefox folder as it was suggested in this
http://willbryant.net/software/2008/05/26/selenium_rc_firefox_2_on_ubuntu_h…
But in my case I have firefox-3.0.10 and inside that I had firefox binary
not a file named firefox-bin
Then I linked to path like this.
sudo ln /usr/lib/firefox-3.0.10/firefox /usr/lib/firefox/firefox-bin
Now I get an exception like this when I run the command to test my selenium
test :(
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.xpn.xwiki.it.selenium.AllTests
09:59:44,591 INFO [org.mortbay.util.Credential] Checking Resource aliases
09:59:44,602 INFO
[org.openqa.selenium.server.SeleniumDriverResourceHandler] Command request:
getNewBrowserSession[*firefox, http://localhost:8080, ] on session null
09:59:44,603 INFO [org.openqa.selenium.server.BrowserSessionFactory]
creating new remote session
09:59:44,936 INFO [org.openqa.selenium.server.BrowserSessionFactory]
Allocated session 775dad4fbed24b0e98a86c0652ec136c for http://localhost:8080,
launching...
09:59:45,092 INFO
[org.openqa.selenium.server.browserlaunchers.FirefoxCustomProfileLauncher]
Preparing Firefox profile...
Could not read application.ini
10:00:05,235 WARN [org.mortbay.http.HttpConnection] POST
/selenium-server/driver/ HTTP/1.1
java.lang.RuntimeException: Timed out waiting for profile to be created!
Kindly tell me some tips to solve this.
Thank you,
-Tharindu
Marius Dumitru Florea wrote:
> We should keep the buttons and let the user choose whether he wants to
> use the tool bar, the menu bar or both, by changing the configuration.
> By default we put table features in the menu. But in some cases we'll
> have to drop the menu and use only the tool bar with a few features in
> order to have a compact editor. In this case the user might want to have
> the insert table button on the tool bar.
+1. We must not forget that the editor is supposed to be generic, and
that shortly we'll want it to be reusable outside XWiki. Thus,
"customizability" is a key objective.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
Devs,
This is to let you know that I've started working on a very simple and
lightweight ComponentManager implementation that I'd like to use for 2
use cases:
1) External users who want for ex to use some xwiki components without
using the plexus would be able to use it with no additional
dependencies (it'll be in our xwiki-component module)
2) Our unit/integration tests could use it and this will allow us to
have component mocks and thus prevent duplicating for ex
MockDocumentAccessBridge 10 times and allow the test to control the
component mock behavior using jmock
I'm planning to finish it over the week end.
Please let me know quickly if you see an issue with 1) or 2).
Thanks
-Vincent
Hi devs,
The real full qualified name of a document is wiki:Space.Page. I think
we sould always use only this form for technical purposes like storing
in database or old API which does not support DocumentName.
pros:
- don't need to take care of the context, the information is always right.
- if everything is stored in only one form it's way easier to compare
things and do requests
cons:
- old code which does not support this document name form will fail.
This could hardly be a good arguments since this form is a officially
valid document name but i can't see anything else.
Among others, the last use case which make me send this proposal is
http://jira.xwiki.org/jira/browse/XWIKI-3754. IMO getLinkedPages
return and the link table should only contains fully qualified links,
especially since theses lists are supposed to contains uniques
documents and we need to know the 3 parts of the document name to make
sure of that . Note that a document could contain a link to a document
in another wiki or even a link to the same document but written in its
full form so a code which support only local form is wrong anyway.
WDYT ?
Here is my +1. The pros are basically the same that make us introduce
DocumentName to not manipulate String anymore in code.
--
Thomas Mortagne
Hi Devs,
ComponentManager interface at the moment doesn't use generics and we have to
manually cast the results into corresponding types. But with new notion of
using Class objects for roles (for lookup) I think it would be very easier
to generify this interface.
Here is my +1.
Thanks.
- Asiri
On Wed, May 6, 2009 at 16:24, vmassol <platform-notifications(a)xwiki.org> wrote:
> Author: vmassol
> Date: 2009-05-06 16:24:58 +0200 (Wed, 06 May 2009)
> New Revision: 19431
>
> Added:
> Â platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/java/org/xwiki/rendering/HTMLMacroTest.java
> Â platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/java/org/xwiki/rendering/MockDocumentAccessBridge.java
> Â platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/java/org/xwiki/rendering/MockDocumentNameSerializer.java
> Modified:
> Â platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/pom.xml
> Â platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/main/java/org/xwiki/rendering/internal/macro/html/HTMLMacro.java
> Log:
> XWIKI-3764: Modify behavior of HTML macro when it's set to contain wiki syntax
>
> * Fixed regression where non inline content in inline context was allowed to go through
>
> Merged from trunk (rev 19430)
>
>
> Modified: platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/pom.xml
> ===================================================================
> --- platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/pom.xml   2009-05-06 14:23:02 UTC (rev 19430)
> +++ platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/pom.xml   2009-05-06 14:24:58 UTC (rev 19431)
> @@ -42,6 +42,19 @@
> Â Â Â <groupId>org.wikimodel</groupId>
> Â Â Â <artifactId>org.wikimodel.wem</artifactId>
> Â Â </dependency>
> + Â Â <!-- Testing dependencies -->
> + Â Â <dependency>
> + Â Â Â <groupId>org.xwiki.platform</groupId>
> + Â Â Â <artifactId>xwiki-core-shared-tests</artifactId>
> + Â Â Â <version>${pom.version}</version>
> + Â Â Â <scope>test</scope>
> + Â Â </dependency>
This dependency is already in xwiki-core-rendering-macros-parent
> + Â Â <dependency>
> + Â Â Â <groupId>jmock</groupId>
> + Â Â Â <artifactId>jmock</artifactId>
> + Â Â Â <version>1.1.0</version>
> + Â Â Â <scope>test</scope>
> + Â Â </dependency>
> Â </dependencies>
> Â <build>
> Â Â <plugins>
> @@ -49,9 +62,9 @@
> Â Â Â Â <groupId>org.apache.maven.plugins</groupId>
> Â Â Â Â <artifactId>maven-surefire-plugin</artifactId>
> Â Â Â Â <configuration>
> - Â Â Â Â Â <includes>
> - Â Â Â Â Â Â <include>**/RenderingTests.java</include>
> - Â Â Â Â Â </includes>
> + Â Â Â Â Â <excludes>
> + Â Â Â Â Â Â <exclude>**/Mock*.java</exclude>
> + Â Â Â Â Â </excludes>
> Â Â Â Â </configuration>
> Â Â Â </plugin>
> Â Â Â <plugin>
>
> Modified: platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/main/java/org/xwiki/rendering/internal/macro/html/HTMLMacro.java
> ===================================================================
> --- platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/main/java/org/xwiki/rendering/internal/macro/html/HTMLMacro.java     2009-05-06 14:23:02 UTC (rev 19430)
> +++ platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/main/java/org/xwiki/rendering/internal/macro/html/HTMLMacro.java     2009-05-06 14:24:58 UTC (rev 19431)
> @@ -26,6 +26,8 @@
>
> Â import org.apache.commons.lang.StringUtils;
> Â import org.w3c.dom.Document;
> +import org.w3c.dom.Element;
> +import org.w3c.dom.Node;
> Â import org.xwiki.bridge.DocumentAccessBridge;
> Â import org.xwiki.bridge.DocumentNameSerializer;
> Â import org.xwiki.component.annotation.Component;
> @@ -193,8 +195,9 @@
> Â Â Â * @param isInline true if the content is inline and thus if we need to remove the top level paragraph
> Â Â Â * Â Â Â Â element created by the cleaner
> Â Â Â * @return the cleaned HTML as a string representing valid XHTML
> + Â Â * @throws MacroExecutionException if the macro is inline and the content is not inline HTML
> Â Â Â */
> - Â Â private String cleanHTML(String content, boolean isInline)
> + Â Â private String cleanHTML(String content, boolean isInline) throws MacroExecutionException
> Â Â {
> Â Â Â Â String cleanedContent = content;
>
> @@ -216,9 +219,20 @@
> Â Â Â Â // HTML envelope when rendered. We remove it so that the HTML <head> tag isn't output.
> Â Â Â Â HTMLUtils.stripHTMLEnvelope(document);
>
> - Â Â Â Â // If in inline mode remove the top level paragraph if there's one.
> + Â Â Â Â // If in inline mode verify we have inline HTML content and remove the top level paragraph if there's one
> Â Â Â Â if (isInline) {
> - Â Â Â Â Â Â HTMLUtils.stripFirstElementInside(document, HTMLConstants.TAG_HTML, HTMLConstants.TAG_P);
> + Â Â Â Â Â Â // TODO: Improve this since when're inside a table cell or a list item we can allow non inline items too
> + Â Â Â Â Â Â Element root = document.getDocumentElement();
> + Â Â Â Â Â Â if (root.getChildNodes().getLength() == 1 && root.getFirstChild().getNodeType() == Node.ELEMENT_NODE
> + Â Â Â Â Â Â Â Â && root.getFirstChild().getNodeName().equalsIgnoreCase("p"))
> + Â Â Â Â Â Â {
> + Â Â Â Â Â Â Â Â HTMLUtils.stripFirstElementInside(document, HTMLConstants.TAG_HTML, HTMLConstants.TAG_P);
> + Â Â Â Â Â Â } else {
> + Â Â Â Â Â Â Â Â throw new MacroExecutionException(
> + Â Â Â Â Â Â Â Â Â Â "When using the HTML macro inline, you can only use inline HTML content."
> + Â Â Â Â Â Â Â Â Â Â Â Â + " Block HTML content (such as tables) cannot be displayed."
> + Â Â Â Â Â Â Â Â Â Â Â Â + " Try leaving an empty line before and after the HTML macro.");
> + Â Â Â Â Â Â }
> Â Â Â Â }
>
> Â Â Â Â // Don't print the XML declaration nor the XHTML DocType.
>
> Added: platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/java/org/xwiki/rendering/HTMLMacroTest.java
> ===================================================================
> --- platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/java/org/xwiki/rendering/HTMLMacroTest.java                 (rev 0)
> +++ platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/java/org/xwiki/rendering/HTMLMacroTest.java     2009-05-06 14:24:58 UTC (rev 19431)
> @@ -0,0 +1,69 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.rendering;
> +
> +import org.xwiki.rendering.internal.macro.html.HTMLMacro;
> +import org.xwiki.rendering.macro.Macro;
> +import org.xwiki.rendering.macro.MacroExecutionException;
> +import org.xwiki.rendering.macro.html.HTMLMacroParameters;
> +import org.xwiki.rendering.scaffolding.MockDocumentNameSerializer;
> +import org.xwiki.rendering.transformation.MacroTransformationContext;
> +import org.xwiki.test.AbstractXWikiComponentTestCase;
> +
> +/**
> + * Unit tests for {@link HTMLMacro} that cannot be performed using the Rendering Test framework.
> + *
> + * @version $Id: $
> + * @since 1.8.3
> + */
> +public class HTMLMacroTest extends AbstractXWikiComponentTestCase
> +{
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â *
> + Â Â * @see com.xpn.xwiki.test.AbstractXWikiComponentTestCase#setUp()
> + Â Â */
> + Â Â @Override
> + Â Â protected void setUp() throws Exception
> + Â Â {
> + Â Â Â Â super.setUp();
> + Â Â Â Â getComponentManager().registerComponent(MockDocumentAccessBridge.getComponentDescriptor());
> + Â Â Â Â getComponentManager().registerComponent(MockDocumentNameSerializer.getComponentDescriptor());
> + Â Â }
> +
> + Â Â /**
> + Â Â * Verify that inline HTML macros with non inline content generate an exception.
> + Â Â */
> + Â Â public void testHTMLMacroWhenNonInlineContentInInlineContext() throws Exception
> + Â Â {
> + Â Â Â Â HTMLMacro macro = (HTMLMacro) getComponentManager().lookup(Macro.class.getName(), "html");
> + Â Â Â Â HTMLMacroParameters parameters = new HTMLMacroParameters();
> + Â Â Â Â MacroTransformationContext context = new MacroTransformationContext();
> + Â Â Â Â context.setInline(true);
> + Â Â Â Â try {
> + Â Â Â Â Â Â macro.execute(parameters, "<ul><li>item</li></ul>", context);
> + Â Â Â Â Â Â fail("Should have thrown an exception here");
> + Â Â Â Â } catch (MacroExecutionException expected) {
> + Â Â Â Â Â Â assertEquals("When using the HTML macro inline, you can only use inline HTML content. Block HTML "
> + Â Â Â Â Â Â Â Â + "content (such as tables) cannot be displayed. Try leaving an empty line before and after the "
> + Â Â Â Â Â Â Â Â + "HTML macro.", expected.getMessage());
> + Â Â Â Â }
> + Â Â }
> +}
>
> Added: platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/java/org/xwiki/rendering/MockDocumentAccessBridge.java
> ===================================================================
> --- platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/java/org/xwiki/rendering/MockDocumentAccessBridge.java               (rev 0)
> +++ platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/java/org/xwiki/rendering/MockDocumentAccessBridge.java   2009-05-06 14:24:58 UTC (rev 19431)
> @@ -0,0 +1,271 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.rendering;
> +
> +import java.util.Map;
> +
> +import org.xwiki.bridge.DocumentAccessBridge;
> +import org.xwiki.bridge.DocumentModelBridge;
> +import org.xwiki.bridge.DocumentName;
> +import org.xwiki.component.descriptor.ComponentDescriptor;
> +import org.xwiki.component.descriptor.DefaultComponentDescriptor;
> +
> +/**
> + * Mock {@link DocumentAccessBridge} implementation used for testing, since we don't want to pull any dependency on the
> + * Model/Skin/etc for the Rendering module's unit tests.
> + *
> + * @version $Id: $
> + * @since 1.8.3
> + */
> +public class MockDocumentAccessBridge implements DocumentAccessBridge
> +{
> + Â Â /**
> + Â Â * Create and return a descriptor for this component.
> + Â Â *
> + Â Â * @return the descriptor of the component.
> + Â Â */
> + Â Â public static ComponentDescriptor getComponentDescriptor()
> + Â Â {
> + Â Â Â Â DefaultComponentDescriptor componentDescriptor = new DefaultComponentDescriptor();
> +
> + Â Â Â Â componentDescriptor.setRole(DocumentAccessBridge.class);
> + Â Â Â Â componentDescriptor.setImplementation(MockDocumentAccessBridge.class.getName());
> +
> + Â Â Â Â return componentDescriptor;
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public String getDocumentContent(String documentName) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public String getDocumentContent(String documentName, String language) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public boolean exists(String documentName)
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public String getURL(String documentName, String action, String queryString, String anchor)
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public String getAttachmentURL(String documentName, String attachmentName)
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public String getProperty(String documentName, String className, int objectNumber, String propertyName)
> + Â Â Â Â throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public String getProperty(String documentName, String className, String propertyName) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public String getProperty(String documentName, String propertyName) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public String getPropertyType(String className, String propertyName) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public boolean isPropertyCustomMapped(String className, String propertyName) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public void setProperty(String documentName, String className, String propertyName, Object propertyValue)
> + Â Â Â Â throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public byte[] getAttachmentContent(String documentName, String attachmentName) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public boolean hasProgrammingRights()
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public String getDocumentContentForDefaultLanguage(String arg0) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public boolean isDocumentViewable(String arg0)
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public String getCurrentUser()
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public String getDefaultEncoding()
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public String getDocumentSyntaxId(String arg0) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public boolean isDocumentEditable(String arg0)
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public void setAttachmentContent(String arg0, String arg1, byte[] arg2) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public void setDocumentContent(String arg0, String arg1, String arg2, boolean arg3) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public void setDocumentSyntaxId(String arg0, String arg1) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public DocumentModelBridge getDocument(String documentName) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public DocumentName getDocumentName(String documentName)
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public DocumentName getCurrentDocumentName()
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public void popDocumentFromContext(Map<String, Object> backupObjects)
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â */
> + Â Â public void pushDocumentInContext(Map<String, Object> backupObjects, String documentName) throws Exception
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +}
>
> Added: platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/java/org/xwiki/rendering/MockDocumentNameSerializer.java
> ===================================================================
> --- platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/java/org/xwiki/rendering/MockDocumentNameSerializer.java              (rev 0)
> +++ platform/core/branches/xwiki-core-1.8/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-html/src/test/java/org/xwiki/rendering/MockDocumentNameSerializer.java  2009-05-06 14:24:58 UTC (rev 19431)
> @@ -0,0 +1,61 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.rendering;
> +
> +import org.xwiki.bridge.DocumentAccessBridge;
> +import org.xwiki.bridge.DocumentName;
> +import org.xwiki.bridge.DocumentNameSerializer;
> +import org.xwiki.component.descriptor.ComponentDescriptor;
> +import org.xwiki.component.descriptor.DefaultComponentDescriptor;
> +
> +/**
> + * Mock {@link DocumentAccessBridge} implementation used for testing, since we don't want to pull any dependency on the
> + * Model/Skin/etc for the Rendering module's unit tests.
> + *
> + * @version $Id: MockDocumentNameSerializer.java 19152 2009-04-27 21:02:41Z tmortagne $
> + * @since 1.9M2
> + */
> +public class MockDocumentNameSerializer implements DocumentNameSerializer
> +{
> + Â Â /**
> + Â Â * Create and return a descriptor for this component.
> + Â Â *
> + Â Â * @return the descriptor of the component.
> + Â Â */
> + Â Â public static ComponentDescriptor getComponentDescriptor()
> + Â Â {
> + Â Â Â Â DefaultComponentDescriptor componentDescriptor = new DefaultComponentDescriptor();
> +
> + Â Â Â Â componentDescriptor.setRole(DocumentNameSerializer.class);
> + Â Â Â Â componentDescriptor.setImplementation(MockDocumentNameSerializer.class.getName());
> +
> + Â Â Â Â return componentDescriptor;
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â *
> + Â Â * @see org.xwiki.bridge.DocumentNameSerializer#serialize(org.xwiki.bridge.DocumentName)
> + Â Â */
> + Â Â public String serialize(DocumentName documentName)
> + Â Â {
> + Â Â Â Â throw new RuntimeException("Not implemented");
> + Â Â }
> +}
>
> _______________________________________________
> notifications mailing list
> notifications(a)xwiki.org
> http://lists.xwiki.org/mailman/listinfo/notifications
>
--
Thomas Mortagne
Hi,
After discussing with Thomas we've reached the conclusion that we
should change the way the HTML macro handle its content when wiki=true.
For ex take the following input:
{{velocity}}
...
{{html wiki="true"}}
<form>
$xwiki.includeForm("XWiki.MyClassSheet")
<br />
<p>
<input type="submit" name="submit" value="Create this new
Workpackage" />
</p>
</form>
{{/html}}
...
{{/velocity}}
And assume that MyClassSheet has some $doc.display() velocity code
which thus generate {{html}} macros.
Current Result
============
Right now here's what happens:
1) velocity macro is executed and $xwiki.includeForm executes
2) MyClassSheet generate {{html}} macro content thus yielding:
{{html wiki="true"}}
<form>
{{html}}...<someTag>...</someTag>{{/html}}
</form>
{{/html}}
3) After velocity has finished executing the velocity macro calls the
wiki parser on the result and thus the top level HTML macro executes
4) since wiki=true the content is given to a SAX parser and each XML
tag content is given to the wiki parser. Thus "{{html}}...", "..." and
"{{/html}}" will be parser by the wiki parser separately (because
<someTag> is valid XML), thus generating non expected content as a
result.
Proposed change
==============
Modify the HTML behavior so that the wiki parser executes first
(instead of the SAX parser) and render the result using a special
renderer that prints the special symbols and text as is.
When run on our example this would give (same steps 1) and 2)):
3) wiki parser executes and generate XDOM. Render it using the special
renderer
Note that this means that if in HTML your write content that has a
meaning in some wiki syntax you'll need to escape it. For example if
you have:
{{html wiki=true}}
<!--hello-->
{{/html}}
you'll get some strikethrough. So you'll need to write instead:
{{html wiki=true}}
<!~-~-hello~-~->
{{/html}}
WDYT?
Here's my +1
Thanks
-Vincent