Skip to content

Commit

Permalink
Re #6897. Made missing image finding more complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfpeterson committed Apr 24, 2013
1 parent d5ecd3f commit 835eda3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Code/Mantid/docs/qtassistant/checkmissingimg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import os
import re

from mediawiki import IMG_NOT_FOUND

def getHtml(htmldir):
"""
Recursively find all html files in the supplied directory.
Expand All @@ -28,7 +30,8 @@ def processHtml(htmldir, filename):
text = handle.read()
handle.close()

# determine all the requested images
##### determine all the requested images
# that aren't set to IMG_NOT_FOUND
candidates = re.findall(r"img(.+)/>", text, flags=re.MULTILINE)
if len(candidates) <= 0:
return []
Expand All @@ -44,6 +47,20 @@ def processHtml(htmldir, filename):
if end <= start:
continue
options.append(candidate[:end])
# that are set to IMG_NOT_FOUND
if IMG_NOT_FOUND in text:
candidates = []
index = 0
while index >= 0:
index = text.find(IMG_NOT_FOUND, index)
end = text.find("</figure>")
if end < index or index < 0:
break
figs = re.findall(r'Missing image:\s+(.+)</figcaption>',
text[index:end])
candidates.extend(figs)
index += len(IMG_NOT_FOUND)
options.extend(candidates)

# add them to the list of missing images if not found
results = []
Expand Down
Binary file modified Code/Mantid/docs/qtassistant/images/ImageNotFound.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 835eda3

Please sign in to comment.