Skip to content

Commit

Permalink
Scale attribute for graphic
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus Thoden committed Mar 7, 2018
1 parent e43eded commit 8a5092e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions prepare_tei.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,21 @@ def make_figure_elements(list_of_figures, figure_directory):
for img in available_images_long:
available_images.append(os.path.splitext(img)[0])

for figure in list_of_figures:
parent_tag = figure.getparent()
for graphic in list_of_figures:
parent_tag = graphic.getparent()
parent_tag.tag = "figure"

original_string = figure.text
figure.clear()
original_string = graphic.text
graphic.clear()

parts = original_string.split("!")

if len(parts) in range(2,4):
if parts[0] in available_images or parts[0] in available_images_long:
selected_image = parts[0]
logging.info("Found %s in the text. Selected %s as corresponding image." % (parts[0], selected_image))
figure.set("url", "images/" + selected_image)
graphic.set("scale", "50")
graphic.set("url", "images/" + selected_image)
else:
bad_images.append(original_string)

Expand All @@ -205,7 +206,7 @@ def make_figure_elements(list_of_figures, figure_directory):
parent_tag.append(yenda_command)

else:
logging.info("The figure string could not be split by '!': %s" % figure)
logging.info("The figure string could not be split by '!': %s" % etree.tostring(graphic))

return bad_images
# def make_figure_elements ends here
Expand Down

0 comments on commit 8a5092e

Please sign in to comment.