Hi Marius,
On Oct 29, 2008, at 5:23 PM, mflorea (SVN) wrote:
> Author: mflorea
> Date: 2008-10-29 17:23:28 +0100 (Wed, 29 Oct 2008)
> New Revision: 13895
>
> Modified:
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/plugin/Config.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/plugin/Plugin.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/plugin/PluginFactory.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/plugin/PluginFactoryManager.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/plugin/PluginManager.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/plugin/UIExtension.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/ui/cmd/CommandListener.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/ui/cmd/CommandListenerCollection.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/ui/cmd/CommandManager.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/ui/cmd/SourcesCommandEvents.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/ui/cmd/internal/AbstractCommandManager.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/util/DOMUtils.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/util/Document.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/util/internal/IEDOMUtils.java
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/
> client/util/internal/MozillaDOMUtils.java
> Log:
> * more javadoc
> * ability to import DOM nodes (the current GWT support for this is
> broken); this is needed for the FormatInline command that I'm writing.
One remark: I hope that you're putting these comments in the code as
otherwise it'll be imposible to remember why you're doing extra work
in the code in 6 months time.
It's very important that anything not standard/normal is fully
documented with a reference on the web to the reason and even better
with a link too on the issue in the project issue tracer that
references the pb so that when it's fixed we can remove our cruft.
Thanks
-Vincent
Hi,
I had proposed to use the ^ character as attachment delimiter.
Ex: wiki:Space.Page^attachment
However I've just realized while implementing it that it's an "unwise"
character in an URI
(source: http://www.ietf.org/rfc/rfc2396.txt)
unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"
Allowed punctuations characters are:
mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
BTW the following are reserved:
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ","
Note that we use ":" for wiki delimiter but that's okay since we're
using an opaque URI and thus reserved chars, unreserved chars and
escaped chars are authorized.
I think it would be better to choose amongst one the valid chars for
the attachment to prevent future problems.
Of course this means we'll have to make that character forbidden in a
page name. Actually we could also decide that it's character forbidden
in an attachment (and use lastIndexOf() instead of indexOf() to
separate the page name from the attachment name). Or we could double
it once again...
I propose we use the @ symbol since it's not a char used often in page
names.
For example:
attach:wiki:Space.Page@my.doc
This raises the discussion of the full FQN we'd like to have when we
support nested spaces too. For example:
(wiki name) "::" (space name) [ "." (space name)]* "::" (page name)
["@" (attachment name)]?
Now what about referencing objects and properties using a URI too? Do
we want that? What would be the use? Right now I don't see a use and
using an API to access them seems fine to me.
Alternative view
============
We could also only specify the attachment name in the uri and use link
parameters to specify the document where it's located as in:
[[image:my.png>>document="wiki:Space.Page"]]
This sounds reasonable to me too. I think the real question is whether
we need a textual representation of an attachment FQN or not.
WDYT?
Thanks
-Vincent
Hi Vincent,
Ok, will revert those changes.
Btw, why I tried to use static methods instead of separate classes is
because those classes seemed to be doing very little. I mean those classes
were utilized like,
<code>
new TagRemoveFilter().doFilter(document);
new UnderlineLinkFilter().filter(document);
new XWikiSyntaxEscapeFilter().doFilter(document);
new ImageTagFilter().doFilter(document);
new PinLiFilter().doFilter(document);
new EmptyLinkFilter().doFilter(document);
</code>
That's all. Something didn't look right to me. And also it seems to clutter
the functionality into a lots of tiny classes.
Thanks.
- Asiri
Hi Asiri,
I don't like this "core" package. It's very artificial IMO. The core
should be the main package.
Also, I'd put the HTMLFilter interface in the filters package.
Re the plural "filters" vs "filter" we need to decide. In the
rendering module we've decided to use the singular form everywhere. In
xwiki-core the majority is also singular. So I'd propose the use
always the singular form. WDYT?
Thanks
-Vincent
On Oct 28, 2008, at 5:50 PM, asiri (SVN) wrote:
> Author: asiri
> Date: 2008-10-28 17:50:32 +0100 (Tue, 28 Oct 2008)
> New Revision: 13873
>
> Added:
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/core/
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/core/HTMLFilter.java
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/
> Removed:
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filter/
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/HTMLFilter.java
> Modified:
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/OfficeImporterPlugin.java
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/EmptyLinkFilter.java
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/ImageTagFilter.java
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/PinLiFilter.java
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/TagRemoveFilter.java
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/UnderlineLinkFilter.java
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/XWikiSyntaxEscapeFilter.java
> sandbox/xwiki-plugin-officeimporter/src/test/java/com/xpn/xwiki/
> plugin/officeconverter/CleanHTMLTest.java
> Log:
> Introduced a new package for core interfaces of the plugin. Renames
> the .filter package to .filters
>
> Modified: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/
> xwiki/plugin/officeimporter/OfficeImporterPlugin.java
> ===================================================================
> --- sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/OfficeImporterPlugin.java 2008-10-28 16:46:15
> UTC (rev 13872)
> +++ sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/OfficeImporterPlugin.java 2008-10-28 16:50:32
> UTC (rev 13873)
> @@ -57,12 +57,12 @@
> import com.xpn.xwiki.doc.XWikiDocument;
> import com.xpn.xwiki.plugin.XWikiDefaultPlugin;
> import com.xpn.xwiki.plugin.XWikiPluginInterface;
> -import com.xpn.xwiki.plugin.officeimporter.filter.EmptyLinkFilter;
> -import com.xpn.xwiki.plugin.officeimporter.filter.ImageTagFilter;
> -import com.xpn.xwiki.plugin.officeimporter.filter.PinLiFilter;
> -import com.xpn.xwiki.plugin.officeimporter.filter.TagRemoveFilter;
> -import
> com.xpn.xwiki.plugin.officeimporter.filter.UnderlineLinkFilter;
> -import
> com.xpn.xwiki.plugin.officeimporter.filter.XWikiSyntaxEscapeFilter;
> +import com.xpn.xwiki.plugin.officeimporter.filters.EmptyLinkFilter;
> +import com.xpn.xwiki.plugin.officeimporter.filters.ImageTagFilter;
> +import com.xpn.xwiki.plugin.officeimporter.filters.PinLiFilter;
> +import com.xpn.xwiki.plugin.officeimporter.filters.TagRemoveFilter;
> +import
> com.xpn.xwiki.plugin.officeimporter.filters.UnderlineLinkFilter;
> +import
> com.xpn.xwiki.plugin.officeimporter.filters.XWikiSyntaxEscapeFilter;
> import com.xpn.xwiki.plugin.officeimporter.utils.ImporterException;
> import com.xpn.xwiki.plugin.officeimporter.utils.DocumentType;
> import com.xpn.xwiki.web.Utils;
> @@ -500,12 +500,12 @@
> }
> Document document = htmlCleaner.clean(new
> StringReader(inputHTML));
>
> - new TagRemoveFilter().filter(document);
> + new TagRemoveFilter().doFilter(document);
> new UnderlineLinkFilter().filter(document);
> - new XWikiSyntaxEscapeFilter().filter(document);
> - new ImageTagFilter().filter(document);
> - new PinLiFilter().filter(document);
> - new EmptyLinkFilter().filter(document);
> + new XWikiSyntaxEscapeFilter().doFilter(document);
> + new ImageTagFilter().doFilter(document);
> + new PinLiFilter().doFilter(document);
> + new EmptyLinkFilter().doFilter(document);
>
> XMLUtils.stripHTMLEnvelope(document);
> String cleanedHTML = XMLUtils.toString(document);
>
> Copied: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/
> xwiki/plugin/officeimporter/core/HTMLFilter.java (from rev 13871,
> sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filter/HTMLFilter.java)
> ===================================================================
> --- sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/core/HTMLFilter.java
> (rev 0)
> +++ sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/core/HTMLFilter.java 2008-10-28 16:50:32 UTC
> (rev 13873)
> @@ -0,0 +1,38 @@
> +/*
> + * 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 com.xpn.xwiki.plugin.officeimporter.core;
> +
> +import org.w3c.dom.Document;
> +
> +/**
> + * The filter to clean the html. This Filter only can handle the
> {@link Document}.
> + *
> + * @version $Id$
> + * @since 1.6M1
> + */
> +public interface HTMLFilter
> +{
> + /**
> + * Do some clean action to the html code stored in {@link
> Document}.
> + *
> + * @param element the {@link Document} with html code
> + */
> + void doFilter(Document document);
> +}
>
>
> Property changes on: sandbox/xwiki-plugin-officeimporter/src/main/
> java/com/xpn/xwiki/plugin/officeimporter/core/HTMLFilter.java
> ___________________________________________________________________
> Name: svn:keywords
> + Id
> Name: svn:mergeinfo
> +
>
> Copied: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/
> xwiki/plugin/officeimporter/filters (from rev 13871, sandbox/xwiki-
> plugin-officeimporter/src/main/java/com/xpn/xwiki/plugin/
> officeimporter/filter)
>
> Modified: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/
> xwiki/plugin/officeimporter/filters/EmptyLinkFilter.java
> ===================================================================
> --- sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filter/EmptyLinkFilter.java 2008-10-28
> 16:45:05 UTC (rev 13871)
> +++ sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/EmptyLinkFilter.java 2008-10-28
> 16:50:32 UTC (rev 13873)
> @@ -17,13 +17,15 @@
> * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> */
> -package com.xpn.xwiki.plugin.officeimporter.filter;
> +package com.xpn.xwiki.plugin.officeimporter.filters;
>
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> import org.w3c.dom.Node;
> import org.w3c.dom.NodeList;
>
> +import com.xpn.xwiki.plugin.officeimporter.core.HTMLFilter;
> +
> /**
> * Only for convert2html.<br/> As the xwiki 1.0 xhtml render now
> don't handle the empty link very well, so need to
> * remove the empty link from the html. <br/> If a label of the link
> is empty, it's a empty link, {@code <a />} or
> @@ -36,7 +38,7 @@
> public class EmptyLinkFilter implements HTMLFilter
> {
>
> - public void filter(Document document)
> + public void doFilter(Document document)
> {
> Element root = document.getDocumentElement();
> NodeList links = root.getElementsByTagName("a");
>
> Deleted: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/
> xwiki/plugin/officeimporter/filters/HTMLFilter.java
> ===================================================================
> --- sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filter/HTMLFilter.java 2008-10-28 16:45:05 UTC
> (rev 13871)
> +++ sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/HTMLFilter.java 2008-10-28 16:50:32
> UTC (rev 13873)
> @@ -1,38 +0,0 @@
> -/*
> - * 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 com.xpn.xwiki.plugin.officeimporter.filter;
> -
> -import org.w3c.dom.Document;
> -
> -/**
> - * The filter to clean the html. This Filter only can handle the
> {@link Document}.
> - *
> - * @version $Id$
> - * @since 1.6M1
> - */
> -public interface HTMLFilter
> -{
> - /**
> - * Do some clean action to the html code stored in {@link
> Document}.
> - *
> - * @param element the {@link Document} with html code
> - */
> - void filter(Document document);
> -}
>
> Modified: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/
> xwiki/plugin/officeimporter/filters/ImageTagFilter.java
> ===================================================================
> --- sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filter/ImageTagFilter.java 2008-10-28 16:45:05
> UTC (rev 13871)
> +++ sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/ImageTagFilter.java 2008-10-28
> 16:50:32 UTC (rev 13873)
> @@ -17,7 +17,7 @@
> * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> */
> -package com.xpn.xwiki.plugin.officeimporter.filter;
> +package com.xpn.xwiki.plugin.officeimporter.filters;
>
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> @@ -26,6 +26,8 @@
> import org.w3c.dom.NodeList;
> import org.w3c.dom.Text;
>
> +import com.xpn.xwiki.plugin.officeimporter.core.HTMLFilter;
> +
> /**
> * Only for convert2html<br/> This is only for the html rendering in
> xwiki syntax 1.0, as it can't find the image's src
> * in img tag. Replace the {@code <img>} tag to {image}. Handled
> attribute: src, width, height, alt, align.
> @@ -36,7 +38,7 @@
> public class ImageTagFilter implements HTMLFilter
> {
>
> - public void filter(Document document)
> + public void doFilter(Document document)
> {
> Element root = document.getDocumentElement();
> NodeList imgs = root.getElementsByTagName("img");
>
> Modified: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/
> xwiki/plugin/officeimporter/filters/PinLiFilter.java
> ===================================================================
> --- sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filter/PinLiFilter.java 2008-10-28 16:45:05
> UTC (rev 13871)
> +++ sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/PinLiFilter.java 2008-10-28 16:50:32
> UTC (rev 13873)
> @@ -17,13 +17,15 @@
> * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> */
> -package com.xpn.xwiki.plugin.officeimporter.filter;
> +package com.xpn.xwiki.plugin.officeimporter.filters;
>
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> import org.w3c.dom.Node;
> import org.w3c.dom.NodeList;
>
> +import com.xpn.xwiki.plugin.officeimporter.core.HTMLFilter;
> +
> /**
> * Only for convert2html<br/>As the xwiki 1.0 xhtml render don't
> display the first p tag just followed to list tag
> * appropriately, need to remove the first {@code <p>} tag in the
> {@code <li>} tag.
> @@ -34,7 +36,7 @@
> public class PinLiFilter implements HTMLFilter
> {
>
> - public void filter(Document document)
> + public void doFilter(Document document)
> {
> Element root = document.getDocumentElement();
> NodeList lists = root.getElementsByTagName("li");
>
> Modified: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/
> xwiki/plugin/officeimporter/filters/TagRemoveFilter.java
> ===================================================================
> --- sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filter/TagRemoveFilter.java 2008-10-28
> 16:45:05 UTC (rev 13871)
> +++ sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/TagRemoveFilter.java 2008-10-28
> 16:50:32 UTC (rev 13873)
> @@ -17,13 +17,15 @@
> * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> */
> -package com.xpn.xwiki.plugin.officeimporter.filter;
> +package com.xpn.xwiki.plugin.officeimporter.filters;
>
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> import org.w3c.dom.Node;
> import org.w3c.dom.NodeList;
>
> +import com.xpn.xwiki.plugin.officeimporter.core.HTMLFilter;
> +
> /**
> * Remove some tag from html, such as style, script. The tag and all
> the contents under the tag will be removed.
> *
> @@ -34,7 +36,7 @@
> {
> private final String[] toRemovedTags = {"style", "script"};
>
> - public void filter(Document document)
> + public void doFilter(Document document)
> {
> Element root = document.getDocumentElement();
> for (String tag : toRemovedTags) {
>
> Modified: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/
> xwiki/plugin/officeimporter/filters/UnderlineLinkFilter.java
> ===================================================================
> --- sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filter/UnderlineLinkFilter.java 2008-10-28
> 16:45:05 UTC (rev 13871)
> +++ sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/UnderlineLinkFilter.java 2008-10-28
> 16:50:32 UTC (rev 13873)
> @@ -17,7 +17,7 @@
> * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> */
> -package com.xpn.xwiki.plugin.officeimporter.filter;
> +package com.xpn.xwiki.plugin.officeimporter.filters;
>
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
>
> Modified: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/
> xwiki/plugin/officeimporter/filters/XWikiSyntaxEscapeFilter.java
> ===================================================================
> --- sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filter/XWikiSyntaxEscapeFilter.java 2008-10-28
> 16:45:05 UTC (rev 13871)
> +++ sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
> plugin/officeimporter/filters/XWikiSyntaxEscapeFilter.java
> 2008-10-28 16:50:32 UTC (rev 13873)
> @@ -17,7 +17,7 @@
> * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> */
> -package com.xpn.xwiki.plugin.officeimporter.filter;
> +package com.xpn.xwiki.plugin.officeimporter.filters;
>
> import java.util.ArrayList;
> import java.util.List;
> @@ -28,6 +28,8 @@
> import org.w3c.dom.NodeList;
> import org.w3c.dom.Text;
>
> +import com.xpn.xwiki.plugin.officeimporter.core.HTMLFilter;
> +
> /**
> * Only for convert2html<br/> Change the html content conflicting
> with xwiki syntax to escape. Such as replace {@code [}
> * to {@code \]}
> @@ -66,7 +68,7 @@
> // escapeChars.add("k");
> }
>
> - public void filter(Document document)
> + public void doFilter(Document document)
> {
> Element root = document.getDocumentElement();
> cleanNode(root);
>
> Modified: sandbox/xwiki-plugin-officeimporter/src/test/java/com/xpn/
> xwiki/plugin/officeconverter/CleanHTMLTest.java
> ===================================================================
> --- sandbox/xwiki-plugin-officeimporter/src/test/java/com/xpn/xwiki/
> plugin/officeconverter/CleanHTMLTest.java 2008-10-28 16:46:15 UTC
> (rev 13872)
> +++ sandbox/xwiki-plugin-officeimporter/src/test/java/com/xpn/xwiki/
> plugin/officeconverter/CleanHTMLTest.java 2008-10-28 16:50:32 UTC
> (rev 13873)
> @@ -27,13 +27,13 @@
> import org.xwiki.xml.XMLUtils;
> import org.xwiki.xml.html.HTMLCleaner;
>
> -import com.xpn.xwiki.plugin.officeimporter.filter.EmptyLinkFilter;
> -import com.xpn.xwiki.plugin.officeimporter.filter.HTMLFilter;
> -import com.xpn.xwiki.plugin.officeimporter.filter.ImageTagFilter;
> -import com.xpn.xwiki.plugin.officeimporter.filter.PinLiFilter;
> -import com.xpn.xwiki.plugin.officeimporter.filter.TagRemoveFilter;
> -import
> com.xpn.xwiki.plugin.officeimporter.filter.UnderlineLinkFilter;
> -import
> com.xpn.xwiki.plugin.officeimporter.filter.XWikiSyntaxEscapeFilter;
> +import com.xpn.xwiki.plugin.officeimporter.core.HTMLFilter;
> +import com.xpn.xwiki.plugin.officeimporter.filters.EmptyLinkFilter;
> +import com.xpn.xwiki.plugin.officeimporter.filters.ImageTagFilter;
> +import com.xpn.xwiki.plugin.officeimporter.filters.PinLiFilter;
> +import com.xpn.xwiki.plugin.officeimporter.filters.TagRemoveFilter;
> +import
> com.xpn.xwiki.plugin.officeimporter.filters.UnderlineLinkFilter;
> +import
> com.xpn.xwiki.plugin.officeimporter.filters.XWikiSyntaxEscapeFilter;
> import com.xpn.xwiki.plugin.officeimporter.utils.ImporterException;
> import com.xpn.xwiki.test.AbstractXWikiComponentTestCase;
>
> @@ -122,12 +122,12 @@
> {
> Document document = cleaner.clean(new StringReader(input));
>
> - new TagRemoveFilter().filter(document);
> + new TagRemoveFilter().doFilter(document);
> new UnderlineLinkFilter().filter(document);
> - new XWikiSyntaxEscapeFilter().filter(document);
> - new ImageTagFilter().filter(document);
> - new PinLiFilter().filter(document);
> - new EmptyLinkFilter().filter(document);
> + new XWikiSyntaxEscapeFilter().doFilter(document);
> + new ImageTagFilter().doFilter(document);
> + new PinLiFilter().doFilter(document);
> + new EmptyLinkFilter().doFilter(document);
>
> XMLUtils.stripHTMLEnvelope(document);
> String actual = XMLUtils.toString(document);
>
> _______________________________________________
> notifications mailing list
> notifications(a)xwiki.org
> http://lists.xwiki.org/mailman/listinfo/notifications
Hi,
In the current implementation of the new WYSIWYG editor, the following
behavior occurs :
1. Type a word (say, "Test")
2. Highlight that word and make it a level 1 title
3. Put the caret at the beginning of the selection ("|Test" where "|" is
the caret) and hit <return>
1. *Text on the second line is now a Level 1 title, as expected*
4. Go back to the previous line (using the <arrow up> key for
instance)
5. Start typing on the top line: the text uses the level 1 title style
(it does the same thing with other styles, such as bold or italics)
After talking with our project managers I think this should not happen: when
the user goes back to the previous line and starts typing, the text should
use the "normal" style (that is, no style at all) rather than the style that
was previously set on that line. In other words, styles should be applied to
words and content but not to lines themselves.
So in the end we would have :
| *(normal text, no style selected)*
LEVEL 1 TITLE
instead of
| *(level one title selected)*
LEVEL ONE TITLE
When the users hits <return> after writing LEVEL ONE TITLE.
Here's my informal +1 for this proposal.
Guillaume
--
Guillaume Lerouge
Product Manager - XWiki
Skype ID : wikibc
http://blog.xwiki.com/
I'm proposing to implement a new property type: A foreign key,
analogous to the concept in relational databases. Together with custom
mapping, a property like this would make it possible to use Xwiki as a
frontend for a relational database, while making full use of the wikis
capabilities(configurability, history, etc).
The implementation would look similar to the existing "Database list"
on the outside, but it would make a lot more use of the databases
features. If A links to B, and someone deletes B the reference in A
would either be set to null, or the delete would be stopped, depending
on the configuration. It would also make it possible to adress
associated objects directly in hql.
The basic functionality can be emulated using DBList(adding a property
to one object by choosing from existing instances of another class),
but this is not useful if one wants to have "real" foreign key
behaviour in the wiki and the underlying DB. If there is a demand for
this I will be happy to contribute a patch once I am done, and I will
try make the code nice enough to submit. Otherwise I will probably
just make it as a hack to meet the exact need that I have...
Thomas
Hi,
There are 2 features I need to finish implementing for the new
rendering and I have some doubts.
1) Parameters for links
Problem
=======
We decided to use the (% param=value %)[[link]] notation. However this
is raising some issues.
First the user needs to close the parameter list so that it doesn't
affect other elements coming after.
For example:
(% rel="_blank" %)[[link]](%%) hello
is different from:
(% rel="_blank" %)[[link]] hello
In the second case the rel="_blank" applied to both the link, the
space and the word "hello".
However if we consider the params to only apply the link then we
cannot set params anymore that span more than the link.
For example: (% style="color:red" %)[[link]] and some text(%%)
Note that technically the params currently generate a <span> element
with the params as attributes. Thus right now using rel="_blank" is
set on the span and not on the <a> element which means it doesn't work.
Solutions
=======
a) Add again the notion of parameters inside the link syntax:
[[label>>reference>>>param=value...]] (or using some other separator)
b) Use a different syntax for link parameters, for ex: {% param=value
%}[[link]] (but I really don't like it)
c) Force the params in the (% %)[[link]] notation to always apply only
to the link and thus force users to use a space if they want to start
a styled portion of text beginning with a link:
(% param=value %) [[link]] something else %)
As much as I hate having to recode what I've removed, I think the best
solution is a).
2) Syntax for images
Problem
=======
We had decided to use the following syntax:
image:wiki:Space.Page^my.png (note: not sure we agreed about the use
of ^ but that's a detail - I couldn't find the email where we
discussed that)
The question is how do we set parameters for images. For example: alt,
title, width, height, etc?
We have the exact same problem as for links but it's even worse since
we don't have the ability to define the parameters inside the image
syntax since the image syntax is too limited.
Solutions
=======
a) Use a different syntax such as:
!!label>>image>>>param=value...!!
(note that there are several wikis using the !! notation for images,
including confluence)
Ex:
!!my.png!!
!!my image>>my.png!!
!!wiki:Space.Page^my.png>>>width=100 height=200!!
b) Decide not to have a syntax for images and instead use an image
macro.
Ex:
{{image name="my.png" document="wiki:Space.Page" width="100"
height="200"/}}
Note that there's one problem with not having a syntax for images in
the grammar: it makes it harder to convert from one syntax for
another. For example people using wikimodel wouldn't be able to
convert from xwiki to another syntax easily and viceversa. In XWiki
itself we would need to have some extra handling code to handle the
fact that the image is a macro to convert it to another syntax but
that's possible (not the easiest but possible).
WDYT for 1) and 2)?
My choice:
1) a)
For 2) I'd prefer to have a syntax for images (for the conversion
between syntaxes issue and for the fact that the syntax wouldn't be
complete - We've added tables in the syntax so it would be a pity not
to have a syntax for images IMO). There's only possibility though:
that we add {{image...}} in the syntax, so it would generate an
onImage() event in XWiki and we would just convert it internally to an
image macro. Ideally I'd still prefer a clean syntax but that'd be my
second choice.
Thanks
-Vincent
vmassol (SVN) wrote:
> Author: vmassol
> Date: 2008-10-28 09:19:23 +0100 (Tue, 28 Oct 2008)
> New Revision: 13864
>
> Added:
> platform/core/trunk/xwiki-rendering/src/test/java/org/xwiki/rendering/block/XMLBlockTest.java
> Modified:
> platform/core/trunk/xwiki-rendering/src/main/java/org/xwiki/rendering/block/XMLBlock.java
> Log:
> XWIKI-2785: The order in which XML attributes are printed when converted to XWiki syntax is not fixed
>
> + public void testAttributeOrder()
> + {
> + Map<String, String> attributes = new HashMap<String, String>();
> + attributes.put("aaa", "value1");
> + attributes.put("bbb", "value2");
> + XMLBlock block = new XMLBlock("element", attributes);
> +
> + Iterator<String> it = attributes.keySet().iterator();
> + Iterator<String> newIt = block.getAttributes().keySet().iterator();
> + while (it.hasNext()) {
> + assertEquals(newIt.next(), it.next());
> + }
> + }
I'm not sure this test is enough, since the order for two attributes
could happen to be the same. Why not add 10 attributes (aN = vN, where N
goes from 0 to 9)?
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
Hello,
I realize that entering the following in a wiki document using syntax
xwiki/2.0 :
{{html}}
<script type="text/javascript">
//<![CDATA[
alert("Hello, World")
// ]]>
</script>
{{/html}}
Results in html as :
<!--startmacro:html|-||-|
<script type="text/javascript">
//<![CDATA[
alert("Hello, World")
// ]]>
</script>
--><!--stopmacro-->
So the script tag is not rendered at all, thus the javascript not
interpreted. Is this expected ? Is there a way to embed JS in a html block ?
Regards,
Jerome.