On Fri, Jul 24, 2015 at 12:34 AM, Ricordisamoa <ricordisamoa(a)openmailbox.org
wrote:
Parsoid's expressiveness seems to convey useless
information, overlook
important details, or duplicate them in different places.
If I want to resize an image, am I supposed to change "data-file-width"
and "data-file-height"? "width" and "height"? Or
"src"?
These are great points, and reports from folks like you will help to
improve our documentation. My goal for Parsoid's DOM[1] is that every bit
of information from the wikitext is represented exactly *once* in the
result.
In your example, `data-file-width` and `data-file-height` represent the
*unscaled* size of the *source* image. Many image scaling operations want
to know this, so we include it in the DOM. It is ignored when you convert
back to wikitext.
The `width` and `height` attributes are what you should modify if you want
to resize an image, just like you would do for any naive html editor.
The `src` attribute is again mostly ignored (sigh); the 'resource'
attribute specifies the url of the unscaled image. Of course if 'resource'
is missing we'll try to make do with `src`; we really try hard to do
something reasonable with whatever we're given.
--scott
[1] There is a tension between "don't repeat yourself" and the use of
Parsoid DOM for read views. Certain attributes (like "alt" and
"title")
get duplicated by default by the PHP parser. So far I think we've been
mostly successful in not letting this sort of thing infect the Parsoid DOM,
but there may be corner cases we accomodate for the sake of ease-of-use for
viewers.
--
(
http://cscott.net)