Sha256: b285f1c5d7d1dcfa623e0da197e188964dc571fa18e3def7871def871d7ed75b
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
# coding: utf-8 require "asciidoctor-bibliography" TEST_BIBTEX_DATABASE = <<~BIBTEX.freeze @article{Erdos65, title = {Some very hard sums}, journal={Difficult Maths Today}, author={Paul Erdős and Arend Heyting and Luitzen Egbertus Brouwer}, year={1965}, pages={30} } @article{Einstein35, title={Can quantum-mechanical description of physical reality be considered complete?}, author={Einstein, Albert and Podolsky, Boris and Rosen, Nathan}, journal={Physical review}, volume={47}, number={10}, pages={777}, year={1935}, publisher={APS} } BIBTEX def init_bibliographer(options) bibliographer = AsciidoctorBibliography::Bibliographer.new bibliographer.options = AsciidoctorBibliography::Options.new. merge("bibliography-hyperlinks" => "false").merge(options) bibliographer.database = AsciidoctorBibliography::Database.new. concat(::BibTeX.parse(TEST_BIBTEX_DATABASE).to_citeproc) bibliographer end def formatted_citation(macro, options: {}) bibliographer = init_bibliographer options macro.gsub(AsciidoctorBibliography::Citation::REGEXP) do citation = AsciidoctorBibliography::Citation.new(*Regexp.last_match.captures) bibliographer.add_citation(citation) citation.render bibliographer end.gsub(/^{empty}/, "") end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
asciidoctor-bibliography-0.4.0 | spec/citation_helper.rb |