Commit d4da1b05 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

download bibtex from HAL

parent d3d13fd0
Pipeline #16187 passed with stage
in 20 seconds
......@@ -2,5 +2,4 @@ FROM pandoc/core
ENTRYPOINT []
RUN apk --no-cache add make py3-pip \
&& pip install panflute
RUN apk --no-cache add make py3-requests
......@@ -4,8 +4,8 @@ DEST="/net/cubitus/projects/Partage_GEPETTO/Public/articles"
all: ${OUTPUTS}
public/%.html: %.md template.html *.bib
pandoc -s -F ./cite.py --template template.html -o $@ $<
public/%.html: %.md template.html
pandoc -s -F ./bibtex.py --template template.html -o $@ $<
clean:
rm -f ${OUTPUTS}
......
#!/usr/bin/env python3
"""
Pandoc filter to include a raw bibtex entry from HAL
"""
import json
import sys
import requests
def bibtex():
doc = json.load(sys.stdin)
if 'hal' in doc['meta']:
r = requests.get(f'{doc["meta"]["hal"]["c"][0]["c"]}/bibtex')
r.raise_for_status()
content = r.content.decode()
doc['meta']['bibtex'] = {'t': 'MetaBlocks', 'c': [{'t': 'CodeBlock', 'c': [['', ['bibtex'], []], content]}]}
json.dump(doc, sys.stdout)
if __name__ == '__main__':
bibtex()
#!/usr/bin/env python3
"""
Pandoc filter to include a raw bib citation
"""
from panflute import run_filter, CodeBlock
from panflute.elements import builtin2meta
def action(elem, doc):
pass
def prepare(doc):
filename = doc.get_metadata('cite')
if filename is not None:
with open(filename) as f:
code = CodeBlock(f.read(), classes=['bibtex'])
doc.metadata.content["citefile"] = builtin2meta(code)
def main(doc=None):
return run_filter(action, prepare=prepare, doc=doc)
if __name__ == '__main__':
main()
@unpublished{debeunne:hal-03351438,
TITLE = {{CosySLAM: tracking contact features using visual-inertial object-level SLAM for locomotion}},
AUTHOR = {Debeunne, C{\'e}sar and Fourmy, M{\'e}d{\'e}ric and Labb{\'e}, Yann and L{\'e}ziart, Pierre-Alexandre and Saurel, Guilhem and Sol{\`a}, Joan and Mansard, Nicolas},
URL = {https://hal.archives-ouvertes.fr/hal-03351438},
NOTE = {working paper or preprint},
HAL_LOCAL_REFERENCE = {Rapport LAAS n{\textdegree} 21255},
YEAR = {2021},
MONTH = Sep,
PDF = {https://hal.archives-ouvertes.fr/hal-03351438/file/CosySLAM_ICRA_2022.pdf},
HAL_ID = {hal-03351438},
HAL_VERSION = {v1},
}
......@@ -14,7 +14,6 @@ org:
- ^2^ Artificial and Natural Intelligence Toulouse Institute, Toulouse
- ^3^ Intitut de Robòtica i Informàtica Industrial, Barcelona
- ^4^ Inria, École normale supérieure, CNRS, PSL Research University, Paris
cite: cosyslam.bib
hal: https://hal.archives-ouvertes.fr/hal-03351438v1
peertube: https://peertube.laas.fr/videos/embed/0a3efab5-c388-413f-801b-275741a0ee63
...
......
......@@ -58,14 +58,12 @@
<div class="row align-items-center">
<div class="col">
$if(hal)$
<a role="button" class="btn btn-outline-primary" href="$hal$">HAL <i class="bi-share"></i></a>
<a role="button" class="btn btn-outline-primary" href="$hal$/document">Paper <i class="bi-file-pdf"></i></a>
$endif$
$if(code)$
<a role="button" class="btn btn-outline-primary" href="$code$">Code <i class="bi-github"></i></a>
$endif$
$if(cite)$
$if(hal)$
<a role="button" class="btn btn-outline-primary" href="$hal$">HAL <i class="bi-share"></i></a>
<a role="button" class="btn btn-outline-primary" href="$hal$/document">Paper <i class="bi-file-pdf"></i></a>
<button type="button" class="btn btn-outline-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
Cite <i class="bi-book"></i>
</button>
......@@ -79,7 +77,7 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body bg-light">
$citefile$
$bibtex$
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment