Changeset 968 for trunk/UTIL


Ignore:
Timestamp:
May 23, 2013, 9:25:43 AM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON bibweb support for local pdf

Location:
trunk/UTIL/PYTHON/bibweb
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/bibweb/ads.py

    r967 r968  
    1717             title = None,
    1818             retrieve = True,
     19             addpdf = None,
    1920             addlink = None):
    2021
     
    6061          htmlcontent += "<a href='#"+str(year)+"'>"+str(year)+"</a>.  "
    6162        if addlink is not None: htmlcontent += "<br>"+addlink
    62         if embedded: htmlcontent += "<br><br /><hr><br>"
    6363   
    6464    ### YEAR LOOP
     
    8585        cmd = "bib2bib --quiet %s -c '$type=%s' -oc %s -ob %s %s" % (arg)
    8686        os.system(cmd)
    87    
     87
     88        # modify the bib file to insert pdf links
     89        # the trick is to use the line adsurl and expect pdf to have the same name as ADS reference       
     90        #        ... then besides this, it is necessary to link pdfs or rename those
     91        #        ... the online repository is indicated by addpdf
     92        if retrieve:
     93         if addpdf is not None:
     94            bibcontent = ''
     95            for line in open(linkads+'.bib'):
     96                bibcontent += line
     97                if 'adsurl' in line:
     98                    line = line.replace('adsurl','localpdf')
     99                    line = line.replace('http://cdsads.u-strasbg.fr/abs/',addpdf)
     100                    line = line.replace('},','.pdf},')
     101                    line = line.replace('%','_')
     102                    bibcontent += line
     103            bibfile2 = open('temp','w')
     104            print >> bibfile2,bibcontent
     105            bibfile2.close()
     106            os.system('mv temp '+linkads+'.bib')
     107
    88108        # 2. make the html page from the author.bib file
    89109        if customcond is None or len(listyear) > 1:
     
    104124              %s \
    105125              -nf adsurl 'ADS link' \
     126              -nf localpdf 'PDF version' \
    106127              -r -d --revkeys \
    107128              -nofooter --nodoc \
     
    109130              %s" % (arg)
    110131        os.system(cmd)
    111    
     132
    112133        # 3. load page content and delete intermediate HTML file
    113134        htmlfile = open(author+'.html','r')
     
    127148    find = re.compile(r'DOI')
    128149    htmlcontent = find.sub('Journal website',htmlcontent)
    129     find = re.compile(r'.pdf')
    130     htmlcontent = find.sub('PDF version',htmlcontent)
     150
     151    #find = re.compile(r'.pdf')
     152    #htmlcontent = find.sub('PDF version',htmlcontent)
    131153   
    132154    find = re.compile(r'<table>')
     
    134156    find = re.compile(r'<td align="right">')
    135157    htmlcontent = find.sub('<td align="center" width=17% style="font-size: 75%;">',htmlcontent)
    136    
     158
    137159    htmlcontent += '''<hr><p>Generated with
    138160    <a href='https://www.lri.fr/~filliatr/bibtex2html/doc/manual.html'>BibTeX2HTML</a>
  • trunk/UTIL/PYTHON/bibweb/header.html

    r967 r968  
    4444<div id="navigation">
    4545<ul>
    46 <li><a href="index.html">Home</a></li>
    47 <li class="selected"><a href="publications.html">Publications</a></li>
    48 <li><a href="work.html">Work</a></li>
    49 <li><a href="abstracts.html">Abstracts</a></li>
    50 <li><a href="reports.html">Reports</a></li>
    51 <li><a href="model.html">Model</a></li>
    52 <li><a href="links.html">Links</a></li>
    53 <li><a href="teaching.html">Teaching</a></li>
     46<li><a href="../index.html">Home</a></li>
     47<li class="selected"><a href="../pub/pub.html">Publications</a></li>
     48<li><a href="../work.html">Work</a></li>
     49<li><a href="../abstracts.html">Abstracts</a></li>
     50<li><a href="../reports.html">Reports</a></li>
     51<li><a href="../model.html">Model</a></li>
     52<li><a href="../links.html">Links</a></li>
     53<li><a href="../teaching.html">Teaching</a></li>
    5454<li><a href="http://www-mars.lmd.jussieu.fr/mars/access.html">MCD</a></li>
    5555</ul>
  • trunk/UTIL/PYTHON/bibweb/mywebsite.py

    r967 r968  
    77             customcond = ''' -c 'abstract:"devil"' ''',\
    88             linkads = "link.spiga",\
     9             addpdf = "http://dl.dropbox.com/u/11078310/my_papers/ref/",\
    910             title = "<h2>Publications about dust devils</h2>")
    1011
     
    1415             customcond = ''' -c 'abstract:"gravity wave"' ''',\
    1516             linkads = "link.spiga",\
     17             addpdf = "http://dl.dropbox.com/u/11078310/my_papers/ref/",\
    1618             title = "<h2>Publications about gravity waves</h2>")
    1719
     
    2123             customcond = ''' -c 'abstract:"mesoscale"' ''',\
    2224             linkads = "link.spiga",\
     25             addpdf = "http://dl.dropbox.com/u/11078310/my_papers/ref/",\
    2326             title = "<h2>Publications about mesoscale meteorology</h2>")
    2427
     
    2831             customcond = ''' -c 'title:"cloud"' ''',\
    2932             linkads = "link.spiga",\
     33             addpdf = "http://dl.dropbox.com/u/11078310/my_papers/ref/",\
    3034             title = "<h2>Publications about clouds</h2>")
    3135
     
    3539             customcond = ''' -c 'title:"Earth" or title:"terrestrial" or title:"Andes"' ''',\
    3640             linkads = "link.spiga",\
     41             addpdf = "http://dl.dropbox.com/u/11078310/my_papers/ref/",\
    3742             title = "<h2>Publications about the Earth</h2>")
    3843
     
    4247             customcond = ''' -c 'title:"Mars" or title:"martian"' ''',\
    4348             linkads = "link.spiga",\
     49             addpdf = "http://dl.dropbox.com/u/11078310/my_papers/ref/",\
    4450             title = "<h2>Publications about Mars</h2>")
    4551
     
    4955             customcond = ''' -c 'title:"boundary layer" or title:"microscale" or title:"large-eddy simulations"' ''',\
    5056             linkads = "link.spiga",\
     57             addpdf = "http://dl.dropbox.com/u/11078310/my_papers/ref/",\
    5158             title = "<h2>Publications about planetary boundary layer</h2>")
    5259
     
    5663             customcond = ''' -c 'title:"spectrometer"' ''',\
    5764             linkads = "link.spiga",\
     65             addpdf = "http://dl.dropbox.com/u/11078310/my_papers/ref/",\
    5866             title = "<h2>Publications about remote sensing</h2>")
    5967
     
    6371             listyear = [2013,2012,2011,2010,2009,2008,2007],\
    6472             linkads = "link.spiga",\
     73             addpdf = "http://dl.dropbox.com/u/11078310/my_papers/ref/",\
    6574             title = "",\
    6675addlink = '''
     
    7584<a href="pubdd.html">Dust devils</a> /
    7685<a href="pubgw.html">Gravity waves</a>
    77 ''')
     86'''+"<br><br /><hr><br>"+open('inpress.html').read())
Note: See TracChangeset for help on using the changeset viewer.