[xwiki-devs] [Office Importer] Shall we allow height & width attributes of <img> tags under 'strict' filtering mode?
Hi Devs, First of all, sorry about the long email subject :) Our style filter is working quite nicely and users so far like it very much :). Still, word documents sometimes contain really really (I mean really) huge images embedded in them. In such cases since our style filter rips off height & width attributes of <img> tags, images run way off the page boundaries (looks very ugly). Following are the only attributes currently allowed with our style filter: a --> href, name img --> alt, src td --> colspan, rowspan I think we have to add height & width attributes into this set (under img tag) because heights & widths are not actually styling attributes (IMO). Note: We are discussing about cleaning OO generated html content that comes from a word document, not about general html cleaning. WDYT? Thanks. - Asiri
On Apr 16, 2009, at 4:55 PM, Asiri Rathnayake wrote:
Hi Devs,
First of all, sorry about the long email subject :)
Our style filter is working quite nicely and users so far like it very much :). Still, word documents sometimes contain really really (I mean really) huge images embedded in them. In such cases since our style filter rips off height & width attributes of <img> tags, images run way off the page boundaries (looks very ugly).
Following are the only attributes currently allowed with our style filter:
a --> href, name img --> alt, src td --> colspan, rowspan
I think we have to add height & width attributes into this set (under img tag) because heights & widths are not actually styling attributes (IMO).
Note: We are discussing about cleaning OO generated html content that comes from a word document, not about general html cleaning.
WDYT?
The only problem is that I think you have width and height always specified even they're not needed in the HTML generated by OO so this means extra cluttering for nothing in most cases. -Vincent
Asiri Rathnayake wrote:
Hi Devs,
First of all, sorry about the long email subject :)
Our style filter is working quite nicely and users so far like it very much :). Still, word documents sometimes contain really really (I mean really) huge images embedded in them. In such cases since our style filter rips off height & width attributes of <img> tags, images run way off the page boundaries (looks very ugly).
Following are the only attributes currently allowed with our style filter:
a --> href, name img --> alt, src td --> colspan, rowspan
I think we have to add height & width attributes into this set (under img tag) because heights & widths are not actually styling attributes (IMO).
Why were you removing those in the first place? (it's perfectly XHTML valid) and they're quite important attributes of an image, because of this size issue.
Note: We are discussing about cleaning OO generated html content that comes from a word document, not about general html cleaning.
WDYT?
Thanks.
- Asiri _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hi Anca,
a --> href, name
img --> alt, src td --> colspan, rowspan
I think we have to add height & width attributes into this set (under img tag) because heights & widths are not actually styling attributes (IMO).
Why were you removing those in the first place?
We wanted to keep the generated wiki content as clean as possible (it's not about valid / invalid xhtml). This means avoid (%%) elements in xwiki 2.0 syntax whenever we can. and they're quite important attributes of an image, because of this size
issue.
Thus we need to add them back ;) - Asiri
Hi, On Thu, Apr 16, 2009 at 5:09 PM, Asiri Rathnayake < [email protected]> wrote:
Hi Anca,
a --> href, name
img --> alt, src td --> colspan, rowspan
I think we have to add height & width attributes into this set (under img tag) because heights & widths are not actually styling attributes (IMO).
Why were you removing those in the first place?
We wanted to keep the generated wiki content as clean as possible (it's not about valid / invalid xhtml). This means avoid (%%) elements in xwiki 2.0 syntax whenever we can.
and they're quite important attributes of an image, because of this size
issue.
Thus we need to add them back ;)
Well, there's another option that might work. If we want to do both things: 1. Remove as many style attributes as we can in filtered mode to keep the wiki syntax output clean 2. While preventing huge images to be displayed on the screen we could add a post-treatment filter on images: if a given image is, say, wider than 800px / higher than 600px its max dimension gets resized to that height / width. This way we keep the syntax clean & uncluttered while outputting an image that will display well on most screens / most configuration. WDYT? Guillaume
- Asiri _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Guillaume Lerouge Product Manager - XWiki Skype ID : wikibc http://guillaumelerouge.com/
On Apr 16, 2009, at 5:18 PM, Guillaume Lerouge wrote:
Hi,
On Thu, Apr 16, 2009 at 5:09 PM, Asiri Rathnayake < [email protected]> wrote:
Hi Anca,
a --> href, name
img --> alt, src td --> colspan, rowspan
I think we have to add height & width attributes into this set (under img tag) because heights & widths are not actually styling attributes (IMO).
Why were you removing those in the first place?
We wanted to keep the generated wiki content as clean as possible (it's not about valid / invalid xhtml). This means avoid (%%) elements in xwiki 2.0 syntax whenever we can.
and they're quite important attributes of an image, because of this size
issue.
Thus we need to add them back ;)
Well, there's another option that might work. If we want to do both things:
1. Remove as many style attributes as we can in filtered mode to keep the wiki syntax output clean 2. While preventing huge images to be displayed on the screen
we could add a post-treatment filter on images: if a given image is, say, wider than 800px / higher than 600px its max dimension gets resized to that height / width. This way we keep the syntax clean & uncluttered while outputting an image that will display well on most screens / most configuration.
I'd prefer instead to leave the width/height params only when they are required but I don't think it's very easy to do since you need to know the image native width/height (same problem with your suggestion). -Vincent
WDYT?
Guillaume
- Asiri
Vincent Massol wrote:
On Apr 16, 2009, at 5:18 PM, Guillaume Lerouge wrote:
Hi,
On Thu, Apr 16, 2009 at 5:09 PM, Asiri Rathnayake < [email protected]> wrote:
Hi Anca,
a --> href, name
img --> alt, src td --> colspan, rowspan
I think we have to add height & width attributes into this set (under img tag) because heights & widths are not actually styling attributes (IMO). Why were you removing those in the first place?
We wanted to keep the generated wiki content as clean as possible (it's not about valid / invalid xhtml). This means avoid (%%) elements in xwiki 2.0 syntax whenever we can.
and they're quite important attributes of an image, because of this size
issue.
Thus we need to add them back ;) Well, there's another option that might work. If we want to do both things:
1. Remove as many style attributes as we can in filtered mode to keep the wiki syntax output clean 2. While preventing huge images to be displayed on the screen
we could add a post-treatment filter on images: if a given image is, say, wider than 800px / higher than 600px its max dimension gets resized to that height / width. This way we keep the syntax clean & uncluttered while outputting an image that will display well on most screens / most configuration.
I'd prefer instead to leave the width/height params only when they are required but I don't think it's very easy to do since you need to know the image native width/height (same problem with your suggestion).
Apache xmlgraphics allows to retrieve these without loading all the image in memory. -- Sergiu Dumitriu http://purl.org/net/sergiu/
On Thu, Apr 16, 2009 at 9:35 PM, Sergiu Dumitriu <[email protected]> wrote:
Vincent Massol wrote:
On Apr 16, 2009, at 5:18 PM, Guillaume Lerouge wrote:
Hi,
On Thu, Apr 16, 2009 at 5:09 PM, Asiri Rathnayake < [email protected]> wrote:
Hi Anca,
a --> href, name
img --> alt, src td --> colspan, rowspan
I think we have to add height & width attributes into this set (under img tag) because heights & widths are not actually styling attributes (IMO). Why were you removing those in the first place?
We wanted to keep the generated wiki content as clean as possible (it's not about valid / invalid xhtml). This means avoid (%%) elements in xwiki 2.0 syntax whenever we can.
and they're quite important attributes of an image, because of this size
issue.
Thus we need to add them back ;) Well, there's another option that might work. If we want to do both things:
1. Remove as many style attributes as we can in filtered mode to keep the wiki syntax output clean 2. While preventing huge images to be displayed on the screen
we could add a post-treatment filter on images: if a given image is, say, wider than 800px / higher than 600px its max dimension gets resized to that height / width. This way we keep the syntax clean & uncluttered while outputting an image that will display well on most screens / most configuration.
I'd prefer instead to leave the width/height params only when they are required but I don't think it's very easy to do since you need to know the image native width/height (same problem with your suggestion).
Apache xmlgraphics allows to retrieve these without loading all the image in memory.
I think you are referring to http://xmlgraphics.apache.org/commons/image-loader.html However I don't like mixing up image loading and html cleaning code together. I mean currently html filters are designed to manipulate html documents, they should not worry about reading images and finding out their dimensions. What we can do is allow height & width attributes and do a post filtering operation (on XDOM) that rips off the height & width attributes where they are not necessary. I'm going to add heigh & width attributes into the allowed attributes list for the moment and later I will work on filtering the xdom by ripping off these attributes where necessary (by sing xmlgraphics). I will mention this on the JIRA and keep it open until it's done. Thanks. - Asiri
Asiri Rathnayake wrote:
On Thu, Apr 16, 2009 at 9:35 PM, Sergiu Dumitriu <[email protected]> wrote:
Vincent Massol wrote:
On Apr 16, 2009, at 5:18 PM, Guillaume Lerouge wrote:
Hi,
On Thu, Apr 16, 2009 at 5:09 PM, Asiri Rathnayake < [email protected]> wrote:
Hi Anca,
a --> href, name > img --> alt, src > td --> colspan, rowspan > > I think we have to add height & width attributes into this set > (under img > tag) because heights & widths are not actually styling attributes (IMO). Why were you removing those in the first place? We wanted to keep the generated wiki content as clean as possible (it's not about valid / invalid xhtml). This means avoid (%%) elements in xwiki 2.0 syntax whenever we can.
and they're quite important attributes of an image, because of this size
issue. Thus we need to add them back ;) Well, there's another option that might work. If we want to do both things:
1. Remove as many style attributes as we can in filtered mode to keep the wiki syntax output clean 2. While preventing huge images to be displayed on the screen
we could add a post-treatment filter on images: if a given image is, say, wider than 800px / higher than 600px its max dimension gets resized to that height / width. This way we keep the syntax clean & uncluttered while outputting an image that will display well on most screens / most configuration. I'd prefer instead to leave the width/height params only when they are required but I don't think it's very easy to do since you need to know the image native width/height (same problem with your suggestion). Apache xmlgraphics allows to retrieve these without loading all the image in memory.
I think you are referring to http://xmlgraphics.apache.org/commons/image-loader.html
However I don't like mixing up image loading and html cleaning code together. I mean currently html filters are designed to manipulate html documents, they should not worry about reading images and finding out their dimensions.
Yes, I was just pointing that it is not very hard to obtain this information, not that we should do this. It is a time and memory consuming effort with little benefits, so I agree that we should just leave the attributes in place, at least for the moment.
What we can do is allow height & width attributes and do a post filtering operation (on XDOM) that rips off the height & width attributes where they are not necessary.
I'm going to add heigh & width attributes into the allowed attributes list for the moment and later I will work on filtering the xdom by ripping off these attributes where necessary (by sing xmlgraphics). I will mention this on the JIRA and keep it open until it's done.
-- Sergiu Dumitriu http://purl.org/net/sergiu/
participants (5)
-
Anca Paula Luca -
Asiri Rathnayake -
Guillaume Lerouge -
Sergiu Dumitriu -
Vincent Massol