Skip to content

Commit

Permalink
Re #6897. More formatting of image metadata in qt-assistant.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfpeterson committed Apr 30, 2013
1 parent 4207472 commit 7c070c2
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions Code/Mantid/docs/qtassistant/mediawiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,27 @@ def formatImgHtml(raw):
#print "IMG:", img

# get the other bits of meta-data
align = None
alt = None
caption = None
width = None
height = None
for item in components[1:]:
item_low = item.lower()
if item_low == "thumb":
pass
elif item.endswith('px'):
pass
elif item_low == "right" or item_low == "center":
pass
item = item[:-2]
if item.startswith('x'):
height = int(item[1:])
elif 'x' in item:
(width, height) = item.split('x')
width = int(width)
height = int(height)
else:
width = int(item)
elif item_low == "right" or item_low == "center" or item_low == "left":
align = item_low
elif item_low.startswith("alt"):
alt = '='.join(item.split('=')[1:])
else:
Expand All @@ -51,6 +62,12 @@ def formatImgHtml(raw):
html += "<img src='img/" + img + "'"
if alt is not None:
html += " alt='%s'" % alt
if align is not None:
html += " align='%s'" % align
if width is not None:
html += " width='%d'" % width
if height is not None:
html += " height='%d'" % height
html += "/>"
if caption is not None:
html += "\n<figcaption>%s</figcaption>\n" % caption
Expand Down

0 comments on commit 7c070c2

Please sign in to comment.