Re: [xwiki-devs] [xwiki-notifications] r13965 - in sandbox/xwiki-plugin-officeimporter/src: main/java/com/xpn/xwiki/plugin/officeimporter/filter main/java/com/xpn/xwiki/plugin/officeimporter/transformer test/java/com/xpn/xwiki/plugin/officeconverter
On Nov 5, 2008, at 6:32 AM, asiri (SVN) wrote:
Author: asiri Date: 2008-11-05 06:32:43 +0100 (Wed, 05 Nov 2008) New Revision: 13965
Added: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/ plugin/officeimporter/filter/ImgToWikiFilter.java Removed: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/ plugin/officeimporter/filter/ImageTagFilter.java Modified: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/ plugin/officeimporter/transformer/HtmlToXWikiXhtmlTransformer.java sandbox/xwiki-plugin-officeimporter/src/test/java/com/xpn/xwiki/ plugin/officeconverter/HtmlFilterTest.java Log: Renamed the ImageTagFilter as ImgToWikiFilter to make more sense. This filter is only used with xhtml rendering.
Funnily I don't understand what ImgToWikiFilter means whereas ImageTagFilter is very expressive to me (it performs some filtering on image tags). I don't understand what an image to wiki means. Also I don't understand why we need this filter since it converts to XWiki Syntax 1.0 which we're not supporting. Thanks -Vincent [snip]
On Wed, Nov 5, 2008 at 1:58 PM, Vincent Massol <[email protected]> wrote:
On Nov 5, 2008, at 6:32 AM, asiri (SVN) wrote:
Author: asiri Date: 2008-11-05 06:32:43 +0100 (Wed, 05 Nov 2008) New Revision: 13965
Added: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/ plugin/officeimporter/filter/ImgToWikiFilter.java Removed: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/ plugin/officeimporter/filter/ImageTagFilter.java Modified: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/ plugin/officeimporter/transformer/HtmlToXWikiXhtmlTransformer.java sandbox/xwiki-plugin-officeimporter/src/test/java/com/xpn/xwiki/ plugin/officeconverter/HtmlFilterTest.java Log: Renamed the ImageTagFilter as ImgToWikiFilter to make more sense. This filter is only used with xhtml rendering.
Funnily I don't understand what ImgToWikiFilter means whereas ImageTagFilter is very expressive to me (it performs some filtering on image tags). I don't understand what an image to wiki means.
Well, I meant converting <img> tags into corresponding wiki syntax. Which is what it was doing (i didn't touch it, I swear).
Also I don't understand why we need this filter since it converts to XWiki Syntax 1.0 which we're not supporting.
This is required only for xhtml rendering (not xwiki 2.0 import). Because image links such as <img src="foo.jpg"/> which results from Office->Html conversion doesn't mean anything on a wiki page. So, what we do is, 1. Attach foo.jpg into the current document as an attachment. 2. Replace the <img> tag with quivalent wiki syntax to make it work. An alternative would be to keep the <img> tag as it is and change the src attribute to the url of the image attachment. Thanks. - Asiri
Thanks -Vincent
[snip] _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hi Asiri, On Nov 5, 2008, at 9:48 AM, Asiri Rathnayake wrote:
On Wed, Nov 5, 2008 at 1:58 PM, Vincent Massol <[email protected]> wrote:
On Nov 5, 2008, at 6:32 AM, asiri (SVN) wrote:
Author: asiri Date: 2008-11-05 06:32:43 +0100 (Wed, 05 Nov 2008) New Revision: 13965
Added: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/ plugin/officeimporter/filter/ImgToWikiFilter.java Removed: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/ plugin/officeimporter/filter/ImageTagFilter.java Modified: sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/ plugin/officeimporter/transformer/HtmlToXWikiXhtmlTransformer.java sandbox/xwiki-plugin-officeimporter/src/test/java/com/xpn/xwiki/ plugin/officeconverter/HtmlFilterTest.java Log: Renamed the ImageTagFilter as ImgToWikiFilter to make more sense. This filter is only used with xhtml rendering.
Funnily I don't understand what ImgToWikiFilter means whereas ImageTagFilter is very expressive to me (it performs some filtering on image tags). I don't understand what an image to wiki means.
Well, I meant converting <img> tags into corresponding wiki syntax.
This is not wiki syntax it's a mix of XHTML and Wiki Syntax 1.0.
Which is what it was doing (i didn't touch it, I swear).
Also I don't understand why we need this filter since it converts to XWiki Syntax 1.0 which we're not supporting.
This is required only for xhtml rendering (not xwiki 2.0 import).
This is not correct since XHTML is not related to XWiki syntax 1.0 or 2.0. If you define a page as using XHTML 1.0 syntax then this won't work.
Because image links such as <img src="foo.jpg"/> which results from Office-
Html conversion doesn't mean anything on a wiki page.
Right and they should be converted to the following (that's what I was telling you yesterday): <p><!--startimage:foo.jpg--><img src="/xwiki/bin/download/currentdoc/ foo.jpg"/><!--stopimage--> This will work in XHTML 1.0 syntax.
So, what we do is,
1. Attach foo.jpg into the current document as an attachment.
2. Replace the <img> tag with quivalent wiki syntax to make it work.
An alternative would be to keep the <img> tag as it is and change the src attribute to the url of the image attachment.
Yes this is the right way, see above. Thanks -Vincent
This is not correct since XHTML is not related to XWiki syntax 1.0 or 2.0.
If you define a page as using XHTML 1.0 syntax then this won't
work.
I think I just noted a bigger problem. The Office->xhtml imported pages are defined as using xwiki 1.0 syntax. That's why it was working. I think we can get rid of several other filters simply by marking such page as using xhtml 1.0. Although I wonder why it was marked as xwiki 1.0 syntax, it has only complicated things.
Because image links such as <img src="foo.jpg"/> which results from Office-
Html conversion doesn't mean anything on a wiki page.
Right and they should be converted to the following (that's what I was telling you yesterday):
<p><!--startimage:foo.jpg--><img src="/xwiki/bin/download/currentdoc/ foo.jpg"/><!--stopimage-->
This will work in XHTML 1.0 syntax.
So, what we do is,
1. Attach foo.jpg into the current document as an attachment.
2. Replace the <img> tag with quivalent wiki syntax to make it work.
An alternative would be to keep the <img> tag as it is and change the src attribute to the url of the image attachment.
Yes this is the right way, see above.
Right, fixit it now. Thanks. - Asiri
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hi, On Wed, Nov 5, 2008 at 5:09 PM, Asiri Rathnayake <[email protected]> wrote:
This is not correct since XHTML is not related to XWiki syntax 1.0 or 2.0.
If you define a page as using XHTML 1.0 syntax then this won't
work.
I think I just noted a bigger problem. The Office->xhtml imported pages are defined as using xwiki 1.0 syntax. That's why it was working. I think we can get rid of several other filters simply by marking such page as using xhtml 1.0. Although I wonder why it was marked as xwiki 1.0 syntax, it has only complicated things. Becaue the default xwiki syntax is xwiki 1.0 in XE 1.6. However it may be not appropriate.
Because image links such as <img src="foo.jpg"/> which results from Office-
Html conversion doesn't mean anything on a wiki page.
Right and they should be converted to the following (that's what I was telling you yesterday):
<p><!--startimage:foo.jpg--><img src="/xwiki/bin/download/currentdoc/ foo.jpg"/><!--stopimage-->
This will work in XHTML 1.0 syntax.
So, what we do is,
1. Attach foo.jpg into the current document as an attachment.
2. Replace the <img> tag with quivalent wiki syntax to make it work.
An alternative would be to keep the <img> tag as it is and change the src attribute to the url of the image attachment.
Yes this is the right way, see above.
Right, fixit it now.
Thanks.
- Asiri
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thanks Wang Ning
Hi Vincent,
<p><!--startimage:foo.jpg--><img src="/xwiki/bin/download/currentdoc/ foo.jpg"/><!--stopimage-->
Excuse me for not knowing, but what are those two tags <!--startimage:foo.jpg--> & <!--stopimage--> doing there ? One more, In the current implementation of office-importer, after converting office documents into html and before applying any filters, the HtmlCleaner is invoked so as to obtain a Document object (into which filters are applied). And this document (after filters have been applied), can be converted into an xhtml string directly. So the resulting string is xhtml. My question is, do we have to parse this string again using XHTMLRenderer before landing it into a wiki page ? Thanks. - Asiri
On Nov 5, 2008, at 10:58 AM, Asiri Rathnayake wrote:
Hi Vincent,
<p><!--startimage:foo.jpg--><img src="/xwiki/bin/download/currentdoc/ foo.jpg"/><!--stopimage-->
Excuse me for not knowing, but what are those two tags <!--startimage:foo.jpg--> & <!--stopimage--> doing there ?
Have a look at http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-rendering/src/t... These are the tests and it shows the format expected to be received by the XHTML parser (check the parts below ".input|xhtml/1.0" in the test files). So this is what need to be sent so that the XHTML parser will understand it.
One more,
In the current implementation of office-importer, after converting office documents into html and before applying any filters, the HtmlCleaner is invoked so as to obtain a Document object (into which filters are applied). And this document (after filters have been applied), can be converted into an xhtml string directly. So the resulting string is xhtml. My question is, do we have to parse this string again using XHTMLRenderer before landing it into a wiki page ?
Yes you're right. You don't need to use the XHTML parser nor the XHTML renderer, you can store the XML directly in the page (using XMLUtils.toString). Thanks -Vincent
participants (3)
-
Asiri Rathnayake -
Vincent Massol -
Wang Ning