Skip to content

Commit

Permalink
Add support for pandoc-citeproc
Browse files Browse the repository at this point in the history
  • Loading branch information
notZaki committed Jul 24, 2020
1 parent 204770c commit 9b0af81
Show file tree
Hide file tree
Showing 5 changed files with 230 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/apply_citeproc.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function find_files_by_ext(startdir, ext = [""])
foundfiles = String[]
for (root, dirs, files) in walkdir(startdir)
for file in files
if last(splitext(file)) ext
push!(foundfiles, joinpath(root, file))
end
end
end
return normpath.(foundfiles)
end

find_files_by_ext(startdir, ext::AbstractString) = find_files_by_ext(startdir, [ext])

function apply_citeproc(startdir)
bib = first(find_files_by_ext(startdir, ".bib"))
csl = first(find_files_by_ext(startdir, ".csl"))
html = find_files_by_ext(startdir, ".html")
for file in html
run(`pandoc $file -o $file --bibliography $bib --csl $csl --metadata link-citations=true --filter pandoc-citeproc -f markdown --to html `)
end
return
end
3 changes: 3 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ makedocs(
assets = String[],
)

include("apply_citeproc.jl")
apply_citeproc("./build")

deploydocs(; repo = "github.com/notZaki/Perfusion.jl")
34 changes: 34 additions & 0 deletions docs/src/cite/bib.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@article{Brix2004,
abstract = {The purpose of this study was to quantify microcirculation and microvasculature in breast lesions by pharmacokinetic analysis of Gd-DTPA-enhanced MRI series. Strongly T1-weighted MR images were acquired in 18 patients with breast lesions using a saturation-recovery-TurboFLASH sequence. Concentration-time courses were determined for blood, pectoral muscle, and breast masses and subsequently analyzed by a two-compartment model to estimate plasma flow and the capillary transfer coefficient per unit of plasma volume (F/VP, KPS/VP) as well as fractional volumes of the plasma and interstitial space (fP, fI). Tissue parameters determined for pectoral muscle (fP = 0.04 +/- 0.01, fI = 0.09 +/- 0.01, F/VP = 2.4 +/- 1.3 min(-1), and KPS/VP = 1.2 +/- 0.5 min(-1)) and 10 histologically proven carcinomas (fP = 0.20 +/- 0.07, fI = 0.34 +/- 0.16, F/VP = 2.4 +/- 0.7 min(-1), and KPS/VP = 0.86 +/- 0.62 min(-1)) agreed reasonable well with literature data. Best separation between malignant and benign lesions was obtained by the ratio KPS/F (0.35 +/- 0.17 vs. 1.23 +/- 0.65). The functional imaging technique presented appears promising to quantitatively characterize tumor pathophysiology. Its impact on diagnosis and therapy management of breast tumors, however, has to be evaluated in larger patient studies.},
author = {Brix, Gunnar and Kiessling, Fabian and Lucht, Robert and Darai, Susanne and Wasser, Klaus and Delorme, Stefan and Griebel, J{\"{u}}rgen},
doi = {10.1002/mrm.20161},
file = {:C$\backslash$:/Users/zaki/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Brix et al. - 2004 - Microcirculation and microvasculature in breast tumors Pharmacokinetic analysis of dynamic MR image series.pdf:pdf},
isbn = {0740-3194 (Print)$\backslash$r0740-3194 (Linking)},
issn = {07403194},
journal = {Magnetic Resonance in Medicine},
keywords = {Blood flow,Breast tumors,Capillary permeability,Contrast media,Dynamic MRI},
number = {2},
pages = {420--429},
pmid = {15282828},
title = {{Microcirculation and microvasculature in breast tumors: Pharmacokinetic analysis of dynamic MR image series}},
volume = {52},
year = {2004}
}
@article{Tofts1999,
abstract = {We describe a standard set of quantity names and symbols related to the estimation of kinetic parameters from dynamic contrast-enhanced T(1)-weighted magnetic resonance imaging data, using diffusable agents such as gadopentetate dimeglumine (Gd-DTPA). These include a) the volume transfer constant K(trans) (min(-1)); b) the volume of extravascular extracellular space (EES) per unit volume of tissue v(e) (0 {\textless} v(e) {\textless} 1); and c) the flux rate constant between EES and plasma k(ep) (min(-1)). The rate constant is the ratio of the transfer constant to the EES (k(ep) = K(trans)/v(e)). Under flow-limited conditions K(trans) equals the blood plasma flow per unit volume of tissue; under permeability-limited conditions K(trans) equals the permeability surface area product per unit volume of tissue. We relate these quantities to previously published work from our groups; our future publications will refer to these standardized terms, and we propose that these be adopted as international standards.},
author = {Tofts, Paul S and Brix, Gunnar and Buckley, David L and Evelhoch, Jeffrey L and Henderson, Elizabeth and Knopp, Michael V and Larsson, Henrik B.W. and Lee, Ting-Yim and Mayr, Nina A and Parker, Geoffrey J.M. and Port, Ruediger E and Taylor, June and Weisskoff, Robert M},
doi = {10.1002/(SICI)1522-2586(199909)10:3<223::AID-JMRI2>3.0.CO;2-S},
file = {:C$\backslash$:/Users/zaki/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Tofts et al. - 1999 - Estimating kinetic parameters from dynamic contrast-enhanced t1-weighted MRI of a diffusable tracer Standardized q.pdf:pdf},
isbn = {1053-1807 (Print)$\backslash$n1053-1807 (Linking)},
issn = {1053-1807},
journal = {Journal of Magnetic Resonance Imaging},
keywords = {Extravascular extracellular space,Gd-DTPA,Perfusion,Permeability,Rate constant,Transfer constant},
month = {sep},
number = {3},
pages = {223--232},
pmid = {10508281},
title = {{Estimating kinetic parameters from dynamic contrast-enhanced t1-weighted MRI of a diffusable tracer: Standardized quantities and symbols}},
url = {http://doi.wiley.com/10.1002/{\%}28SICI{\%}291522-2586{\%}28199909{\%}2910{\%}3A3{\%}3C223{\%}3A{\%}3AAID-JMRI2{\%}3E3.0.CO{\%}3B2-S},
volume = {10},
year = {1999}
}
160 changes: 160 additions & 0 deletions docs/src/cite/csl.csl
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-US">
<!-- This style was edited with the Visual CSL Editor (http://steveridout.com/csl/visualEditor/) -->
<info>
<title>Magnetic Resonance in Medicine</title>
<id>http://www.zotero.org/styles/magnetic-resonance-in-medicine</id>
<link href="http://www.zotero.org/styles/magnetic-resonance-in-medicine" rel="self"/>
<link href="http://www.zotero.org/styles/council-of-science-editors" rel="template"/>
<link href="http://onlinelibrary.wiley.com/journal/10.1002/(ISSN)1522-2594/homepage/ForAuthors.html" rel="documentation"/>
<author>
<name>Andrew Priest</name>
</author>
<category citation-format="numeric"/>
<category field="science"/>
<issn>0740-3194</issn>
<eissn>1522-2594</eissn>
<summary>Magnetic Resonance in Medicine style</summary>
<updated>2014-08-28T01:36:46+00:00</updated>
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
<macro name="editor">
<names variable="editor">
<name name-as-sort-order="all" sort-separator=" " initialize-with="" delimiter=", " delimiter-precedes-last="always"/>
<label form="long" prefix=", " suffix="."/>
</names>
</macro>
<macro name="anon">
<text term="anonymous" form="short" text-case="capitalize-first" strip-periods="true"/>
</macro>
<macro name="author">
<group suffix=".">
<names variable="author">
<name name-as-sort-order="all" sort-separator=" " initialize-with="" delimiter=", " delimiter-precedes-last="always"/>
<label form="short" prefix=" " strip-periods="true"/>
<substitute>
<names variable="editor"/>
<text macro="anon"/>
</substitute>
</names>
</group>
</macro>
<macro name="access">
<group>
<choose>
<if variable="DOI">
<text variable="DOI" prefix="doi: " suffix="."/>
</if>
</choose>
</group>
</macro>
<macro name="title">
<group delimiter=" ">
<text variable="title"/>
<choose>
<if type="thesis" match="any">
<text variable="genre" form="long" prefix="[" suffix="]"/>
</if>
</choose>
</group>
</macro>
<macro name="publisher">
<group delimiter=": ">
<text variable="publisher-place"/>
<text variable="publisher"/>
</group>
</macro>
<macro name="issued">
<date variable="issued" delimiter=" ">
<date-part name="year"/>
</date>
</macro>
<macro name="pages">
<label variable="page" form="short" suffix=" "/>
<text variable="page"/>
</macro>
<macro name="journal">
<text variable="container-title" form="short" text-case="Capitalize-all"/>
</macro>
<macro name="edition">
<choose>
<if is-numeric="edition">
<group delimiter=" ">
<number variable="edition" form="ordinal"/>
<text term="edition" form="short"/>
</group>
</if>
<else>
<text variable="edition" suffix="."/>
</else>
</choose>
</macro>
<!-- Citation: added by ANP, copying from Vancouver -->
<citation collapse="citation-number">
<sort>
<key variable="citation-number"/>
</sort>
<layout prefix="(" suffix=")" delimiter=",">
<text variable="citation-number"/>
</layout>
</citation>
<bibliography hanging-indent="false" et-al-min="11" et-al-use-first="3">
<layout>
<text variable="citation-number" suffix=". "/>
<text macro="author"/>
<choose>
<if type="bill book graphic legal_case legislation motion_picture report song thesis" match="any">
<group prefix=" " suffix="." delimiter=" ">
<text macro="title" suffix="."/>
<text macro="edition"/>
<text macro="editor" prefix="(" suffix=")"/>
</group>
<text prefix=" " macro="publisher"/>
<group suffix="." prefix="; " delimiter=" ">
<date variable="issued">
<date-part name="year"/>
</date>
<text macro="pages"/>
</group>
</if>
<else-if type="chapter paper-conference" match="any">
<text macro="title" prefix=" " suffix="."/>
<group prefix=" " delimiter=" ">
<text term="in" text-case="capitalize-first" suffix=":"/>
<text macro="editor"/>
<text variable="container-title" suffix="."/>
<text variable="volume" prefix="Vol. " suffix="."/>
<text macro="edition"/>
<text variable="collection-title" suffix="."/>
<group suffix=".">
<text macro="publisher"/>
<group suffix="." prefix="; " delimiter=". ">
<date variable="issued">
<date-part name="year"/>
</date>
<text macro="pages"/>
</group>
</group>
</group>
</else-if>
<else>
<group suffix=".">
<text macro="title" prefix=" "/>
<text macro="editor" prefix=" "/>
</group>
<group prefix=" " suffix=".">
<text macro="journal"/>
<group delimiter=";" prefix=" ">
<text macro="issued"/>
<group>
<text variable="volume"/>
</group>
</group>
<text variable="page" prefix=":"/>
</group>
</else>
</choose>
<text prefix=" " macro="access"/>
</layout>
</bibliography>
</style>
10 changes: 10 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# Perfusion.jl

Testing citation [@Brix2004].
Now an empty sentence.
Now we have two references [@Tofts1999; @Brix2004].

```@index
```

```@autodocs
Modules = [Perfusion]
```

### References

```@raw html
<div id="refs"></div>
```

0 comments on commit 9b0af81

Please sign in to comment.