7 from time
import strftime
20 self._fout.write(
'<'+self.
_tag)
22 for key
in self.
_args:
23 self._fout.write(
' '+key+
'="'+self.
_args[key]+
'"')
27 self._fout.write(
'</'+self.
_tag+
'>')
30 header =
'''<!DOCTYPE html> 32 <meta charset="UTF-8"> 33 <title>NOvA'''+(
' PROPOSED ' if config.PROPOSED
else ' ')+
'''blessed plots</title> 35 <style type="text/css"> 37 a:visited{color:black} 43 display: inline-block; 45 border: 2px solid gray; 46 background-color: white; 53 display: inline-block; 54 border: 2px solid gray; 55 background-color: white; 71 document.getElementById("showbutton").hidden = false; 72 document.getElementById("hidebutton").hidden = true; 74 cs = document.getElementsByClassName("caption") 75 for(var i = 0; i < cs.length; i++){ 82 document.getElementById("hidebutton").hidden = false; 83 document.getElementById("showbutton").hidden = true; 85 cs = document.getElementsByClassName("caption") 86 for(var i = 0; i < cs.length; i++){ 92 <script type="text/x-mathjax-config"> 93 MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$']]}}); 95 <script type="text/javascript" 96 src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> 100 <body bgcolor="'''+(
'#ffffcc' if config.PROPOSED
else '#f0f0f0')+
'''"> 104 <div style="position:fixed;right:0;top:0"> 105 <button type="button" title="Hide" onclick="Hide()" id="hidebutton">Hide captions</button> 106 <button type="button" title="Show" onclick="Show()" hidden id="showbutton">Show captions</button> 110 disclaimer =
'These plots <b>are not yet blessed</b>. Please review them and send comments to the authors. You may only show them publicly once they have passed the review period and migrated to the main blessed plots page.' 113 return '\n<hr>\n<a href="https://cdcvs.fnal.gov/redmine/projects/novaart/wiki/Where_to_Find_Graphics_for_NOvA_Public_Presentations">Other sources of images</a>\n\n<hr>\nLast updated '+strftime(
'%Y-%m-%d %H:%M:%S %Z')+
'\n</body></html>' 117 thumb =
'plots/'+
str(deets[
'id'])+
'/thumbs/'+f[
'base']+
'_thumb.png' 119 with
Tag(fout,
'span', {
'class':
'plot'}):
120 fout.write(
'<img src="'+thumb+
'"><br>\n')
121 for ext
in f[
'exts']:
122 with
Tag(fout,
'a', {
'href':
'plots/'+
str(deets[
'id'])+
'/'+f[
'base']+
'.'+ext}):
123 fout.write(
'['+ext+
']')
126 with
Tag(fout,
'div', {
'class':
'caption'}):
127 fout.write(f[
'caption'])
132 page_cfg = json.load(
file(config.BLESSED_PLOTS))
133 doc_deets = json.load(
file(config.WEB_PATH + config.JSON_FILENAME))
135 allNos = [d[
'id']
for d
in doc_deets]
136 allCatNos = [[n
for n
in page[
'docs']]
for page
in page_cfg]
137 allCatNos =
sum(allCatNos, [])
138 new = [n
for n
in allNos
if n
not in allCatNos]
142 page_cfg = [{
'category':
'New / uncategorized',
144 'caption':
'Plots that have not yet been categorized. Please edit Utilities/BlessedPlots/'+(
'BlessedPlotsProposed.json' if config.PROPOSED
else 'BlessedPlots.json')+
' to do so.'}] + page_cfg
147 fout_main =
open(config.WEB_PATH +
'/index.html',
'w')
148 fout_main.write(header)
149 with
Tag(fout_main,
'h1'):
150 fout_main.write(
'NOvA <em>PROPOSED</em> blessed plots' if config.PROPOSED
else 'NOvA blessed plots')
153 with
Tag(fout_main,
'p'):
154 fout_main.write(disclaimer)
156 for page
in page_cfg:
157 cat = page[
'category']
158 safe_cat = cat.replace(
' ',
'_').replace(
'/',
'and')
160 with
Tag(fout_main,
'span', {
'class':
'sublink'}):
161 with
Tag(fout_main,
'h3'):
162 with
Tag(fout_main,
'a', {
'href': safe_cat+
'.html'}):
165 with
Tag(fout_main,
'table'):
166 with
Tag(fout_main,
'tr'):
168 with
Tag(fout_main,
'td', {
'valign':
'top'}):
171 thumb = config.WEB_PATH+
"plots/"+page[
'thumb'];
172 if os.path.isfile(thumb) :
173 height = subprocess.check_output(
"identify -format %h "+thumb, shell=
True)
175 print "Warning: thumbnail " + thumb +
" is missing" 177 fout_main.write(
'<img src="plots/'+page[
'thumb']+
'" width="200px" height="'+
str(
int(height)/2)+
'px">')
178 if 'caption' in page:
179 with
Tag(fout_main,
'td', {
'valign':
'top'}):
180 fout_main.write(page[
'caption'])
182 fout_main.write(
'\n')
184 fout_sub =
open(config.WEB_PATH +
'/' + safe_cat+
'.html',
'w')
185 fout_sub.write(header)
186 fout_sub.write(header2)
187 with
Tag(fout_sub,
'h1'): fout_sub.write(cat)
190 with
Tag(fout_sub,
'p'):
191 fout_sub.write(disclaimer)
193 for docNo
in page[
'docs']:
194 deets = [d
for d
in doc_deets
if d[
'id'] == docNo]
196 print 'No info for doc', docNo,
'skipping' 198 assert len(deets) == 1
201 with
Tag(fout_sub,
'h2'):
202 with
Tag(fout_sub,
'a', {
'href': deets[
'url']}):
203 fout_sub.write(
'docdb '+
str(docNo))
204 fout_sub.write(
' - '+deets[
'title'])
210 auths = [(a[
'firstname']
or '')+
' '+(a[
'lastname']
or '').
encode(
'ascii',
'ignore')
for a
in deets[
'authors']]
211 fout_sub.write(
', '.join(auths))
214 for f
in deets[
'files']:
def __exit__(self, a, b, c)
ps_atom_t encode(std::string const &)
def AddFile(fout, deets, f)
def __init__(self, fout, tag, args={})
procfile open("FD_BRL_v0.txt")