Skip to content

Commit d14e409

Browse files
committed
Corrected script for html generation
1 parent 7c46d39 commit d14e409

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

bin/cleanHTML.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ def validateLine(line, filNam):
9696
<!-- Custom changes for Modelica -->
9797
<link href="../Resources/www/css/modelicaDoc.css" rel="stylesheet">
9898
99-
</head>
99+
</head>''',
100+
'<body>':
101+
'''
100102
<body>
101103
<div id="navbar" class="navbar navbar-default ">
102104
<div class="container-fluid">
@@ -118,7 +120,7 @@ def validateLine(line, filNam):
118120
<li><a href="{homepage}">Home</a></li>
119121
<li><a href="{library_name}.html">Modelica</a></li>
120122
</ul>
121-
</div>
123+
</div>
122124
</div>
123125
</div>
124126
<div class="page-content">'''.format( \
@@ -197,13 +199,22 @@ def validateLine(line, filNam):
197199
# be nothing else than an address information, i.e., no date.
198200
# Hence, we change this entry.
199201
found = False
200-
for iLin in range(len(lines)-2):
201-
if "<address>" in lines[iLin].strip() and "</address>" in lines[iLin+2].strip():
202-
lines[iLin+1] = '''<p></p>
202+
for iLin in range(len(lines)):
203+
linStr = lines[iLin].strip()
204+
if linStr.startswith('<address>') or \
205+
linStr.startswith('<a href="http://www.3ds.com/">Automatically generated</a>') or \
206+
linStr.startswith('</address>') or \
207+
linStr.startswith('</body>') or \
208+
linStr.startswith('</html>'):
209+
lines[iLin] = '\n'
210+
found = True
211+
212+
lines.append('''
213+
</div> <!-- page-content -->
203214
<footer>
204215
<div class="footer">
205216
<p>
206-
<a href=\"{homepage}\">{homepage}</a>
217+
<a href="{homepage}">{homepage}</a>
207218
</p>
208219
</div>
209220
</footer>
@@ -212,15 +223,15 @@ def validateLine(line, filNam):
212223
================================================== -->
213224
<!-- Placed at the end of the document so the pages load faster -->
214225
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
215-
<script>window.jQuery || document.write('<script src="../Resources/www/js/jquery.min.js"><\/script>')</script>
226+
<script>window.jQuery || document.write('<script src="../Resources/www/js/jquery.min.js"><\\/script>')</script>
216227
<script src="../Resources/www/js/bootstrap.min.js"></script>
217228
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
218229
<script src="../Resources/www/js/ie10-viewport-bug-workaround.js"></script>
219230
220231
</body>
221232
222-
</html>'''.format(homepage = HOMEPAGE)
223-
found = True
233+
</html>'''.format(homepage = HOMEPAGE))
234+
224235
if found:
225236
filObj=open(filNam, 'w')
226237
filObj.writelines(lines)

0 commit comments

Comments
 (0)