Description
Currently transcluded items with height/width properties generate HTML using the old width and width attributes. These attributes are quite limited as they only support units of pixels and percent. Modern pages generally use their CSS equivalents as they allow use of the entire set of units supported by CSS.
Steps to reproduce
- Embed an image and specify a width using a CSS unit. This will result in silent failure (no image will be present in the resulting HTML)
Discussion
I believe the best way to implement this would be to simply translate MoinMoin's width and height attributes into style="width:$WIDTH;height:$HEIGHT" in the HTML output. You'd obviously need to filter the values to ensure no JavaScript sneaks in. Hence, the code,
{{attachment:hi.png|Hello world!|width=1in height=2in}}
Would be mapped to a tag with the attribute, style="width:1in; height:2in"
This "just filter javascript out" is not easily possible. Just do some google search for this kind of problem and you'll see.
As far as I can tell the only way javascript can be introduced is in expression() values and url()s. Perhaps I'm missing something. Either way, /(\d+)[(in)(cm)(px)%(pt)(em)...]/ might be a good enough first approximation. It would certainly be better than what we have now.
Plan
Add support for CSS attributes to formatter/text_html.py.
- Priority:
- Assigned to:
- Status: