Skip to content

Commit

Permalink
- Only run soup if tidy says the file is ok
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@11121 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Feb 14, 2012
1 parent 3c93052 commit 302790f
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions Examples/GenerateDoc.mos
Expand Up @@ -247,20 +247,21 @@ for filepath in sorted(glob.glob('*.html')):
# sys.stdout.write(tag) # not much point in writing the tags to stdout
sys.stderr.write(tag)
pid = sub.call(['tidy', '-modify', '-quiet', filepath])
with open(filepath,'r') as html_file:
soup = BeautifulSoup(html_file)
for a in soup.findAll('a'):
try:
a['href'] = linkreplace(a['href'])
except:
pass
for img in soup.findAll('img'):
if pid <> 2 then
with open(filepath,'r') as html_file:
soup = BeautifulSoup(html_file)
for a in soup.findAll('a'):
try:
img['src'] = linkreplace(img['src'])
a['href'] = linkreplace(a['href'])
except:
pass
with open(filepath,'w') as html_file:
html_file.write(soup.__str__())
for img in soup.findAll('img'):
try:
img['src'] = linkreplace(img['src'])
except:
pass
with open(filepath,'w') as html_file:
html_file.write(soup.__str__())
");

writeFile("FindFiles.sh","#!/bin/bash
Expand Down

0 comments on commit 302790f

Please sign in to comment.