doc: wikiparser: Sort imagedata properties

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2020-08-25 23:51:46 -07:00 committed by James Valleroy
parent cafbdaab19
commit 5f947ba1e7
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -224,7 +224,8 @@ class EmbeddedAttachment(EmbeddedLink):
target = escape(self.target)
xml = '<inlinemediaobject><imageobject>'
xml += f'<imagedata fileref="{target}"'
xml += '<imagedata '
props = {'fileref': target}
if self.params:
params = self.params.split(',')
for param in params:
@ -232,7 +233,10 @@ class EmbeddedAttachment(EmbeddedLink):
if prop == 'height':
prop = 'depth'
xml += ' ' + prop + '="' + value + '"'
props[prop] = value
props = [f'{prop}="{value}"' for prop, value in sorted(props.items())]
xml += ' '.join(props)
xml += '/>'
xml += '</imageobject>'