Code Monkey home page Code Monkey logo

asciidoctor-bibtex's Introduction

Asciidoctor

Asciidoctor is a fast, open source, Ruby-based text processor for parsing AsciiDoc® into a document model and converting it to output formats such as HTML 5, DocBook 5, manual pages, PDF, EPUB 3, and other formats.

Asciidoctor also has an ecosystem of extensions, converters, build plugins, and tools to help you author and publish content written in AsciiDoc. You can find the documentation for these projects at https://docs.asciidoctor.org.

In addition to running on Ruby, Asciidoctor can be executed on a JVM using AsciidoctorJ or in any JavaScript environment using Asciidoctor.js.

This document is also available in the following languages:
简体中文 | Deutsch | Français | 日本語

Latest Release library (API) docs Build Status (GitHub Actions) Project Chat (Zulip)

Sponsors

We want to recognize our sponsors for their commitment to improving the state of technical documentation by supporting this project. Thank you sponsors! Without your generous support, Asciidoctor would not be possible.

You can support this project by becoming a sponsor through OpenCollective.

AsciiDoc Processing and Built-in Converters

AsciiDoc is the language.
Asciidoctor is the processor.

Asciidoctor reads the AsciiDoc source, as shown in the panel on the left in the image below, and converts it to publishable formats, such as HTML 5, as shown rendered in the panel on the right.

Preview of AsciiDoc source and corresponding rendered HTML

Asciidoctor provides built-in converters for three output formats by default: HTML 5, DocBook 5, and man page (short for manual page). Additional converters, such as PDF and EPUB 3, are provided by separate gems. Asciidoctor also provides an out-of-the-box HTML experience complete with a default stylesheet and built-in integrations like Font Awesome (for icons), highlight.js, Rouge, and Pygments (for source highlighting), and MathJax (for STEM processing).

Asciidoctor Ecosystem

Although Asciidoctor is written in Ruby, it does not mean you need Ruby to use it. Asciidoctor can be executed on a JVM using AsciidoctorJ or in any JavaScript environment (including the browser) using Asciidoctor.js.

Installing an Asciidoctor processor is just the beginning of your publishing experience. Asciidoctor gives you access to a ecosystem of extensions and tools, ranging from add-on converters, to extended syntax, to build plugins, to integrated writing and preview environments:

Asciidoctor is the successor to AsciiDoc.py. If you’re using AsciiDoc.py, see Migrate from AsciiDoc.py to learn how to upgrade to Asciidoctor.

Requirements

Asciidoctor works on Linux, macOS and Windows and requires one of the following implementations of Ruby:

  • CRuby (aka MRI) 2.7 - 3.3

  • JRuby 9.2 - 9.4

  • TruffleRuby (GraalVM)

🔥

If you’re using a non-English Windows environment, you may bump into an Encoding::UndefinedConversionError when invoking Asciidoctor. To solve this issue, we recommend overriding the default external and internal character encodings to utf-8. You can do so by setting the RUBYOPT environment variable as follows:

RUBYOPT="-E utf-8:utf-8"

Once you make this change, all your Unicode headaches should be behind you.

If you’re using an IDE like Eclipse, make sure you set the encoding to UTF-8 there as well. Asciidoctor is optimized to work with UTF-8 as the default encoding.

Installation

Asciidoctor is packaged and distributed to RubyGems.org as a RubyGem (aka gem) named asciidoctor. The asciidoctor gem can be installed on all major operating systems using Ruby packaging tools (gem or bundle). Asciidoctor is also distributed as a Docker image, as a package for numerous Linux distributions, and as a package for macOS (via Homebrew and MacPorts).

Linux package managers

The version of Asciidoctor installed by the package manager may not match the latest release of Asciidoctor. Consult the package repository for your distribution to find out which version is packaged per distribution release.

If you want to use a version of Asciidoctor that’s newer than what is installed by the package manager, see the gem installation instructions.

apk (Alpine Linux)

To install the gem on Alpine Linux, open a terminal and type:

$ sudo apk add asciidoctor

pacman (Arch Linux)

To install the gem on Arch-based distributions, open a terminal and type:

$ sudo pacman -S asciidoctor

APT

On Debian and Debian-based distributions such as Ubuntu, use APT to install Asciidoctor. To install the package, open a terminal and type:

$ sudo apt-get install -y asciidoctor

DNF

On RPM-based Linux distributions, such as Fedora, CentOS, and RHEL, use the DNF package manager to install Asciidoctor. To install the package, open a terminal and type:

$ sudo dnf install -y asciidoctor

macOS

Homebrew

You can use Homebrew, the macOS package manager, to install Asciidoctor. If you don’t have Homebrew on your computer, complete the installation instructions first.

Once Homebrew is installed, you’re ready to install the asciidoctor gem. Open a terminal and type:

$ brew install asciidoctor

Homebrew installs the asciidoctor gem into an exclusive prefix that’s independent of system gems.

MacPorts

You can also use MacPorts, another package manager for macOS, to install Asciidoctor. If you don’t have MacPorts on your computer, complete the installation instructions first.

Once MacPorts is installed, you’re ready to install the asciidoctor gem via the Asciidoctor port. Open a terminal and type:

$ sudo port install asciidoctor

Windows

To use Asciidoctor with Windows, you have two options.

Chocolatey

When you already use chocolatey on your machine, you can use:

choco install ruby

Rubyinstaller

Or you use the Rubyinstaller, download the package for your Windows Version and after the installation go ahead with gem installation instructions.

gem install

Before installing Asciidoctor using gem install, you should set up RVM (or similar) to install Ruby in your home directory (i.e., user space). Then, you can safely use the gem command to install or update the Asciidoctor gem, or any other gem for that matter. When using RVM, gems are installed in a location isolated from the system. (You should never use the gem command to install system-wide gems).

Once you’ve installed Ruby using RVM, and you have activated it using rvm use 3.0, open a terminal and type:

$ gem install asciidoctor

If you want to install a pre-release version (e.g., a release candidate), use:

$ gem install asciidoctor --pre

Bundler

  1. Create a Gemfile in the root folder of your project (or the current directory)

  2. Add the asciidoctor gem to your Gemfile as follows:

    source 'https://rubygems.org'
    gem 'asciidoctor'
    # or specify the version explicitly
    # gem 'asciidoctor', '2.0.22'
  3. Save the Gemfile

  4. Open a terminal and install the gem using:

    $ bundle

To upgrade the gem, specify the new version in the Gemfile and run bundle again. Using bundle update (without specifying a gem) is not recommended as it will also update other gems, which may not be the desired result.

Upgrade

If you installed Asciidoctor using a package manager, your operating system is probably configured to automatically update packages, in which case you don’t need to update the gem manually.

apk (Alpine Linux)

To upgrade the gem, use:

$ sudo apk add -u asciidoctor

APT

To upgrade the gem, use:

$ sudo apt-get upgrade -y asciidoctor

DNF

To upgrade the gem, use:

$ sudo dnf update -y asciidoctor

Homebrew (macOS)

To upgrade the gem, use:

$ brew update
$ brew upgrade asciidoctor

MacPorts (macOS)

To upgrade the gem, use:

$ sudo port selfupdate
$ sudo port upgrade asciidoctor

gem install

If you previously installed Asciidoctor using the gem command, you’ll need to manually upgrade Asciidoctor when a new version is released. You can upgrade the gem by typing:

$ gem install asciidoctor

When you install a new version of the gem using gem install, you end up with multiple versions installed. Use the following command to remove the old versions:

$ gem cleanup asciidoctor

Usage

If the Asciidoctor gem installed successfully, the asciidoctor command line interface (CLI) will be available on your PATH. To verify it’s available, run the following in your terminal:

$ asciidoctor --version

You should see information about the Asciidoctor version and your Ruby environment printed in the terminal.

Asciidoctor 2.0.22 [https://asciidoctor.org]
Runtime Environment (ruby 3.0.1p64 [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

Command line interface (CLI)

The asciidoctor command allows you to invoke Asciidoctor from the command line (i.e., a terminal).

The following command converts the file README.adoc to HTML and saves the result to the file README.html in the same directory. The name of the generated HTML file is derived from the source file by changing its file extension to .html.

$ asciidoctor README.adoc

You can control the Asciidoctor processor by adding various flags and switches, which you can learn about using:

$ asciidoctor --help

For instance, to write the file to a different directory, use:

$ asciidoctor -D output README.adoc

The asciidoctor man page provides a complete reference of the command line interface.

Refer to the following resources to learn more about how to use the asciidoctor command.

Ruby API

Asciidoctor also provides an API. The API is intended for integration with other Ruby software, such as Rails, GitHub, and GitLab, as well as other languages, such as Java (via AsciidoctorJ) and JavaScript (via Asciidoctor.js).

To use Asciidoctor in your application, you first need to require the gem:

require 'asciidoctor'

You can then convert an AsciiDoc source file to an HTML file using:

Asciidoctor.convert_file 'README.adoc', to_file: true, safe: :safe
⚠️
When using Asciidoctor via the API, the default safe mode is :secure. In secure mode, several core features are disabled, including the include directive. If you want to enable these features, you’ll need to explicitly set the safe mode to :server (recommended) or :safe.

You can also convert an AsciiDoc string to embeddable HTML (for inserting in an HTML page) using:

content = '_Zen_ in the art of writing https://asciidoctor.org[AsciiDoc].'
Asciidoctor.convert content, safe: :safe

If you want the full HTML document, enable the header_footer option as follows:

content = '_Zen_ in the art of writing https://asciidoctor.org[AsciiDoc].'
html = Asciidoctor.convert content, header_footer: true, safe: :safe

If you need access to the parsed document, you can split the conversion into discrete steps:

content = '_Zen_ in the art of writing https://asciidoctor.org[AsciiDoc].'
document = Asciidoctor.load content, header_footer: true, safe: :safe
puts document.doctitle
html = document.convert

Keep in mind that if you don’t like the output Asciidoctor produces, you can change it! Asciidoctor supports custom converters that can handle converting from the parsed document to the generated output.

One easy way to customize the output piecemeal is by using the template converter. The template converter allows you to supply a Tilt-supported template file to handle converting any node in the document.

However you go about it, you can have 100% control over the output. For more information about how to use the API or to customize the output, see:

Contributing

New contributors are always welcome! If you discover errors or omissions in the source code, documentation, or website content, please don’t hesitate to submit an issue or open a pull request with a fix.

Here are some ways you can contribute:

  • by using prerelease (alpha, beta or preview) versions

  • by reporting bugs

  • by suggesting new features

  • by writing or editing documentation

  • by writing code with tests — No patch is too small.

    • fix typos

    • add comments

    • clean up inconsistent whitespace

    • write tests!

  • by refactoring code

  • by fixing issues

  • by reviewing patches

The Contributing guide provides information on how to create, style, and submit issues, feature requests, code, and documentation to Asciidoctor.

Getting Help

Asciidoctor is developed to help you easily write and publish your content. But we can’t do it without your input. If you need assistance or want to provide feedback, please follow the links to the resources listed on the Get Help page in the docs. Here’s a quick summary:

Project chat (Zulip)

https://chat.asciidoctor.org

Discussion list (archived)

https://discuss.asciidoctor.org

Social media (Twitter)

Follow @asciidoctor or search the #asciidoctor hashtag

Further information and documentation about Asciidoctor can be found on the project’s website.

Home | News | Docs

The Asciidoctor organization on GitHub hosts the project’s source code, issue tracker, and sub-projects.

Code of Conduct

The core Asciidoctor project is governed by the Code of Conduct for the Asciidoctor community of projects. By participating, you’re agreeing to honor this code. Let’s work together to make this a welcoming, professional, inclusive, and safe environment for everyone.

Versioning and Release Policy

This project adheres to semantic versioning (major.minor.patch). Typically, patch releases are only made for the current minor release. However, exceptions are made on a case-by-case basis to address security vulnerabilities and other high-priority issues.

Copyright © 2012-present Dan Allen, Sarah White, Ryan Waldron, and the individual contributors to Asciidoctor. Use of this software is granted under the terms of the MIT License.

See the LICENSE for the full license text.

Authors

Asciidoctor is led by Dan Allen and Sarah White and has received contributions from many individuals in Asciidoctor’s awesome community. The project was initiated in 2012 by Ryan Waldron based on a prototype written by Nick Hengeveld for the Git website.

AsciiDoc.py was started and maintained by Stuart Rackham from 2002 to 2013 and has received contributions from many individuals in the AsciiDoc.py community.

Trademarks

AsciiDoc® and AsciiDoc Language™ are trademarks of the Eclipse Foundation, Inc.

Changelog

Refer to the CHANGELOG for a complete list of changes in older releases.

asciidoctor-bibtex's People

Contributors

anneloreegger avatar danabr avatar fiech avatar jeksterslab avatar languitar avatar michel-kraemer avatar mojavelinux avatar programfan avatar tribut avatar tschaume avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asciidoctor-bibtex's Issues

Problem with asciidoctor-bitex after update to Asciidoc 2.0.1

asciidoctor-bibtex extension crashes after update to asciidoctor 2.0.1. It seems to be related to scanning citations in tables. This is the stacktrace I get:

/home/pela/.gem/ruby/2.3.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:103:in block in process': tor: FAILED: /home/pela/svnroot/QAG/dcs-make/sample/sample.txt: Failed to load AsciiDoc document - undefined method lines'sciidoctor::Table::Cell:0x0000000601aa66d8> (NoMethodError)
Did you mean? lineno
Did you mean? lineno
from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:98:in each' from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:98:in process
from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/lib/asciidoctor/document.rb:557:in []' from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/lib/asciidoctor/document.rb:557:in block in parse'
from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/lib/asciidoctor/document.rb:556:in each' from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/lib/asciidoctor/document.rb:556:in parse'
from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/lib/asciidoctor.rb:1301:in load' from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/lib/asciidoctor.rb:1410:in convert'
from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/lib/asciidoctor.rb:1518:in block in convert_file' from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/lib/asciidoctor.rb:1518:in open'
from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/lib/asciidoctor.rb:1518:in convert_file' from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/lib/asciidoctor/cli/invoker.rb:126:in block in invoke!'
from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/lib/asciidoctor/cli/invoker.rb:109:in each' from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/lib/asciidoctor/cli/invoker.rb:109:in invoke!'
from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.1/bin/asciidoctor:15:in <top (required)>' from /home/pela/bin/asciidoctor:23:in load'
from /home/pela/bin/asciidoctor:23:in `

'
make: *** [/home/pela/svnroot/internal-tools/asciidoc-templates/asciidoc.mk:165: sample.xml] Error 1

intollerant to not finding a citation

If a citation is unknown then this message is thrown and the progress stops:
"

Unknown reference: cite-key
Failed to render cite-key: can't dup NilClass

"
I think it might be better to just throw a warning. In bibtex, by default, a '?' is placed in the location . When asciidoctor-bibtex works in a chain with other tools it can get hindering. Probably the best might be to add an option to stop or not to stop on errors.

\url not interpreted

Hello,
I stumbled over a similar one:

@misc{berinato2007,
  title = {The {{Rise}} of {{Anti Forensics}}.},
  timestamp = {2016-09-12T11:08:23Z},
  urldate = {2016-08-25},
  howpublished = {\url{http://www.csoonline.com/article/2122329/investigations-forensics/the-rise-of-anti-forensics.html}},
  journal = {CSO Online},
  author = {Berinato, Scott},
  month = aug,
  year = {2007}
}

which is rendered as follows:

S. Berinato, “The Rise of Anti Forensics.,” CSO Online. \urlhttp://www.csoonline.com/article/2122329/investigations-forensics/the-rise-of-anti-forensics.html, Aug-2007.

Please note "\url...".

Implement as Treeprocessor

As the asciidoctor-mathematical inline stem suggests, it is possible to implement the inline cite or citenp using a Treeprocessor. This enables the following features:

  1. cite macros can cross then multiple lines.
  2. attributes are then be parsed correctly and directly by asciidoctor.

Refactor

The code base has changed a lot since the fork from asciidoc-bib. So we need to refactor the whole code base to reflect current design.

Fail on error

If you reference an id that is not in the bib file, it outputs an "unknown reference" warning (good) but I would prefer it to stop the build as well. Is this possible?
Context: My documents build in Jenkins and I want to do as many automatic checks as possible.

Error when downloading libraries using gem-maven-plugin

The dependant gem rubysl-json:2.0.2 is no longer available in RubyGems (https://rubygems.org/gems/rubysl-json) and this causes an error when trying to integrate asciidoctor-bibtex into a maven project:

rubygems:namae:gem:0.8.2 -> rubygems:rubysl:gem:2.0.8 -> rubygems:rubysl-json:gem:[2.0,2.99999]: No versions available for rubygems:rubysl-json:gem:[2.0,2.99999] within specified range 

The issue is originated by the namae:0.8.2 gem, and adding a new versions does not fix the resolution issue.

I'm not a ruby guy, so I'm just wondering if it's possible to update the dependencies of bibtex to newer versions that are available.

Thanks,

Indent too small when more than 9 references in bibliography

Please see the attached image and compare 9. and 10.
I am not sure if this is a bug of asciidoctor-bibtex or asciidoctor-fopub? What do you think?

   asciidoctor -b docbook -r asciidoctor-diagram -r asciidoctor-bibtex -a data-uri! "$@"
   asciidoctor-fopub/fopub   -t ./docbook-xsl  "$XmlFileName" 

What can be done?
screenshot - 170916 - 00 24 29

Implement bibtex output for direct latex integration

Instead of processing citations and embed the output into resultant asciidoc content, direct converting citations and bibliography to corredponding bibtex equivalents will enable superb integration with asciidoctor-latex. Then standard latex facilities can be utilized to produce even better documents.

[Discussion] Locator (aka page[s]) property for citations

This will be a long one, but please bare with me. I really like this plugin, because it allows me to use bibtex-functionality directly with asciidoc, but I'd like to discuss the matter of the presentation of the locator information in citations.

During my book production, I stumbled upon the problem of locator, or page(s) localization, i.e., the "p. X" and "pp. X-Y" suffix for other languages/locales, as well as the "pp. X sq." or "pp. X sqq." part behind an inline citation.

After going through the code, I found that "p." and "pp." are handled manually after the actual citation text is retrieved from the CiteProc ruby processor.

However I found that the CiteProc ruby processor actually supports a locator parameter, which then gets used to generate the "p. X" and "pp. X-Y" suffix, as seen in the last example in the Readme of https://github.com/inukshuk/citeproc-ruby. This also has the additional benefit of changing the "p." and "pp." to their respective counterparts as defined in the locale definition file of the csl-style, now that the processor gets intialized with the locale parameter.

So, I started working on way to generate this via the means of the locator-property of the render functionality, and here is what I came up with. I commented out the manual construction of the pp-part and linked the cite.pages content to the locator-property of the render function, as can be seen here: Link to commit. This works pretty well, as far as I can see. The decision of how to display the citation with or without locator info is left to the CiteProc processor, which can also deal with empty pages-informations. Also with the bibtex-locale, the p. and pp. get's changed according to the csl-locale-definition.

There is however a caveat and my first questions:

  1. I - for now - got rid of any special consideration for the citenp macro. However I am not really sure what the actual goal of this macro is supposed to be, to be honest. I have also noticed some really strange bugs with the citenp macro where in certain situations manually parantheses disappeared or the first letter of the citation was not converted to a link to the bibliography entry. So my question is: What is this macro exactly supposed to to and do we need it?
  2. For the citation style, I now left everything to the CiteProc processor and the csl-style to decide. So, for example IEEE style does not show any pages, but I think this simply is due to the style. Would it not be better if we would stay in accordance with the style, and ask the user to define their own custom style if they wanted to deviate from the style? (This would also answer question 1).

Additionally to the localization of the locator string (p. and pp.), I wanted a way to get the "sq." and "sqq." in the locator information. This was not possible due to the cite-macro only working with a format similar to cite:[cite_key(6)] or cite:[cite_key(6-8)], but not something like cite:[cite_key(6 sq.)]

In LaTeX this is done rather straight forward by using something like \cite[6\psq]{cite_key} or \cite[6\psqq]{cite_key}, where \psq and \psqq default to a non-breaking space and a localized string (sq., sqq. in English, f. and ff. in German, for example). This is not controlled by the csl-locale-definition, so I chose to open up the regexp-string in citationutils.rb. This however did produce bugs when using multiple citations with pages in one cite-macro, so I later changed it to a more specific version as seen here.

This basically allows the user to write anything they like, e.g. cite:[cite_key(6&#160;sqq.)]. The CiteProc processor still does it's job as expected, so the citation will be something like (Author, Year, pp. 6 sqq.) (for the din-1505-2 style in this case).

Here my question is: Are there compelling reasons to not use this less constrained version, where the user can put any string in the citation and let the CiteProc decide how to handle this?

Looking forward to a productive discussion.

Refactor processor

The Processor class shall focus on retriving citation, building citation output and reference outputs. Other parts such as handling arguments and include files shall be moved to specific utils. So the processor is reusable for both asciidoc and asciidoctor.

Problem with asciidoctor-bibtex-cite-in-prose after update to Asciidoc 1.5.6

When calling

asciidoctor  --require "/here/other_modules/asciidoctor-bibtex-cite-in-prose/lib/asciidoctor-bibtex.rb"  -a bibtex-file=library.bib -a bibtex-style=apa -a bibtex-order=appearance -a bibtex-format=asciidoc --backend html5  -a imagesdir=html_images  -a stylesheet=my.css  -a stylesdir=html_libs  -a linkcss  -a docinfo1  -a pagenums  -a nofooter  -a lang=en  --doctype article "test.adoc.txt" --out-file="test.adoc.html"

I got

/here/other_modules/asciidoctor-bibtex-cite-in-prose/lib/asciidoctor-bibtex/bibextension.rb:55:in `<class:BibliographyBlockMacro>': undefined method `positional_attributes' for AsciidoctorBibtex::Asciidoctor::BibliographyBlockMacro:Class (NoMethodError)
	from /here/other_modules/asciidoctor-bibtex-cite-in-prose/lib/asciidoctor-bibtex/bibextension.rb:52:in `<module:Asciidoctor>'
	from /here/other_modules/asciidoctor-bibtex-cite-in-prose/lib/asciidoctor-bibtex/bibextension.rb:21:in `<module:AsciidoctorBibtex>'
	from /here/other_modules/asciidoctor-bibtex-cite-in-prose/lib/asciidoctor-bibtex/bibextension.rb:20:in `<top (required)>'
	from /here/other_modules/asciidoctor-bibtex-cite-in-prose/lib/asciidoctor-bibtex/asciidoctor.rb:2:in `require_relative'
	from /here/other_modules/asciidoctor-bibtex-cite-in-prose/lib/asciidoctor-bibtex/asciidoctor.rb:2:in `<top (required)>'
	from /here/other_modules/asciidoctor-bibtex-cite-in-prose/lib/asciidoctor-bibtex.rb:11:in `require_relative'
	from /here/other_modules/asciidoctor-bibtex-cite-in-prose/lib/asciidoctor-bibtex.rb:11:in `<top (required)>'
	from /Users/sei/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Users/sei/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Users/sei/.rvm/gems/ruby-2.2.2/gems/asciidoctor-1.5.6/lib/asciidoctor/cli/options.rb:230:in `block in parse!'
	from /Users/sei/.rvm/gems/ruby-2.2.2/gems/asciidoctor-1.5.6/lib/asciidoctor/cli/options.rb:228:in `each'
	from /Users/sei/.rvm/gems/ruby-2.2.2/gems/asciidoctor-1.5.6/lib/asciidoctor/cli/options.rb:228:in `parse!'
	from /Users/sei/.rvm/gems/ruby-2.2.2/gems/asciidoctor-1.5.6/lib/asciidoctor/cli/options.rb:33:in `parse!'
	from /Users/sei/.rvm/gems/ruby-2.2.2/gems/asciidoctor-1.5.6/lib/asciidoctor/cli/invoker.rb:22:in `initialize'
	from /Users/sei/.rvm/gems/ruby-2.2.2/gems/asciidoctor-1.5.6/bin/asciidoctor:12:in `new'
	from /Users/sei/.rvm/gems/ruby-2.2.2/gems/asciidoctor-1.5.6/bin/asciidoctor:12:in `<top (required)>'
	from /Users/sei/.rvm/gems/ruby-2.2.2/bin/asciidoctor:23:in `load'
	from /Users/sei/.rvm/gems/ruby-2.2.2/bin/asciidoctor:23:in `<main>'
	from /Users/sei/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
	from /Users/sei/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'

    at checkExecSyncError (child_process.js:588:13)
    at execSync (child_process.js:628:13)
    at /here/gulpfile.js:1111:5
    at Stream.modifyFile (/here/node_modules/gulp-tap/lib/tap.js:69:11)
    at Stream.stream.write (/here/node_modules/through/index.js:26:11)
    at Newer.ondata (_stream_readable.js:628:20)
    at emitOne (events.js:115:13)
    at Newer.emit (events.js:210:7)
    at addChunk (_stream_readable.js:252:12)
    at readableAddChunk (_stream_readable.js:239:11)

Bug concerning nested lists with version 2.6.0

Given the following input (which asciidoctor without asciidoctor-bibtex accepts)

FIRST ITEM ::
* This is a nested bullet1
* This is a nested bullet2
SECOND ITEM ::
1. This is a nested enumerated item
2. This is a nested enumerated item2

With asciidoctor-bibtex loaded it throws an error. Using the --trace option I get a stacktrace with last line:

/pela/.gem/ruby/2.6.0/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor- 
bibtex/extensions.rb:114:in  `block in process': asciidoctor: FAILED: 
/home/pela/svnroot/QAG/dcs-make/sample/sample.txt: 
Failed to load AsciiDoc document - undefined method `empty?' for nil:NilClass 
(NoMethodError)

So it seems there is a missing null test somewhere in this code?

comparison of Array with Array failed (again)

So, have run into this error again:

asciidoctor: FAILED: C:/Users/char/repos/DPBoK/_OG-full-pdf.adoc: Failed to load AsciiDoc document - comparison of Array with Array failed Use --trace for backtrace

Here is the stack trace:

C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/citations.rb:28:in `sort_by': asciidoctor: FAILED: C:/Users/char/repos/DPBoK/_OG-full-pdf.adoc: Failed to load AsciiDoc document - comparison of Array with Array failed (ArgumentError)
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/citations.rb:28:in `sorted_cites'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/processor.rb:189:in `sorted_cites'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/processor.rb:162:in `make_citation'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/processor.rb:66:in `block in complete_citation'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/processor.rb:56:in `each'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/processor.rb:56:in `each_with_index'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/processor.rb:56:in `complete_citation'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:119:in `block (3 levels) in process'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:118:in `each'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:118:in `block (2 levels) in process'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:117:in `each'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:117:in `block in process'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:109:in `each'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:109:in `process'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.8/lib/asciidoctor/document.rb:577:in `[]'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.8/lib/asciidoctor/document.rb:577:in `block in parse'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.8/lib/asciidoctor/document.rb:576:in `each'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.8/lib/asciidoctor/document.rb:576:in `parse'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.8/lib/asciidoctor.rb:1367:in `load'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.8/lib/asciidoctor.rb:1479:in `convert'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.8/lib/asciidoctor.rb:1595:in `block in convert_file'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.8/lib/asciidoctor.rb:1595:in `open'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.8/lib/asciidoctor.rb:1595:in `convert_file'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.8/lib/asciidoctor/cli/invoker.rb:129:in `block in invoke!'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.8/lib/asciidoctor/cli/invoker.rb:112:in `each'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.8/lib/asciidoctor/cli/invoker.rb:112:in `invoke!'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/asciidoctor-pdf-1.5.0.alpha.16/bin/asciidoctor-pdf:31:in `<top (required)>'
        from C:/Ruby24-x64/bin/asciidoctor-pdf:23:in `load'
        from C:/Ruby24-x64/bin/asciidoctor-pdf:23:in `<main>'

Error was reproducible across at least four machines, PCs and Macs. One of the PCs represented a completely fresh build of the the toolchain.

This is across a very large and complex document and is an extremely difficult and troubling error to isolate. We narrowed the error to particular citations and in particular the authors' names, but the error itself shifts over time. Last week, we had to replace 4 authors' names with "xx" and then the error would go away, e.g.:

@book{Landis2011,
address = {Walnut Creek, California},
author = {Landis, Sean},
publisher = {Artima, Inc},
title = {{Agile Hiring}},
year = {2011}
}

would not work but

@book{Landis2011,
address = {Walnut Creek, California},
author = {xx},
publisher = {Artima, Inc},
title = {{Agile Hiring by Sean Landis}},
year = {2011}
}

would.

This week, we are able to restore 2 of those authors' names (but not 3) without error. Very puzzling.

Because of the elusive nature of this error, I apologize but cannot put together a minimum viable demonstration, nor can we share here the repository.

Aware of previous issue. I ran into this a couple years ago. It was similarly elusive back then, with the only fix being modifying one particular, arbitrary citation.

Charlie

Internal Refactoring

TODO:

  • Drop asciidoc to asciidoc support
  • Drop commandline programs (not useful anymore since we are a true extension)
  • Spliting bibtex filter from bibextension.rb
  • cleanup code base.

Build failed

# gem install asciidoctor-bibtex
Building native extensions.  This could take a while...
ERROR:  Error installing asciidoctor-bibtex:
	ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/unicode-0.4.4.2/ext/unicode
/usr/bin/ruby2.3 -r ./siteconf20170130-4217-o7hums.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/unicode-0.4.4.2 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/unicode-0.4.4.2/gem_make.out

cite: macro does not work in tables

cite: does not work in table cells- the cite:[REF1] is not processed and appears unmodified in the output.
(Note: Started a new issue based on the discussion in issue 31.)
Reponse from 0xDiddi, copied from issue 31:
"I just reproduced your error though, and can add that other inline macros (I tested links) work inside table cells, so it seems that one is on asciidoctor-bibtex.

But notable: most blocks in asciidoctor can be reproduced by annotating an open block, only pass-through and table blocks can not.
This leads me to believe that they are handled specially within asciidoctor, so there may be something going on there as well that causes this.

EDIT: I just tested my own inline macro inside a table, and (apart from the error above) it is being processed and produces output. So I conclude that tables generally process all inline macros, not just built-in ones."

Error when loading asciidoctor-bibtex with latest asciidoctor 1.5.6

asciidoctor: WARNING: gem 'thread_safe' is not installed. This gem is recommended when registering custom converters.
--
  | /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'asciidoctor-bibtex'. (Bundler::GemRequireError)
  | Gem Load Error is: undefined method `positional_attributes' for AsciidoctorBibtex::Asciidoctor::BibliographyBlockMacro:Class
  | Did you mean?  positional_attrs
  | name_positional_attributes
  | Backtrace for gem load error is:
  | /var/lib/gems/2.3.0/gems/asciidoctor-bibtex-0.3.0/lib/asciidoctor-bibtex/bibextension.rb:55:in `<class:BibliographyBlockMacro>'
  | /var/lib/gems/2.3.0/gems/asciidoctor-bibtex-0.3.0/lib/asciidoctor-bibtex/bibextension.rb:52:in `<module:Asciidoctor>'
  | /var/lib/gems/2.3.0/gems/asciidoctor-bibtex-0.3.0/lib/asciidoctor-bibtex/bibextension.rb:21:in `<module:AsciidoctorBibtex>'
  | /var/lib/gems/2.3.0/gems/asciidoctor-bibtex-0.3.0/lib/asciidoctor-bibtex/bibextension.rb:20:in `<top (required)>'
  | /var/lib/gems/2.3.0/gems/asciidoctor-bibtex-0.3.0/lib/asciidoctor-bibtex/asciidoctor.rb:2:in `require_relative'
  | /var/lib/gems/2.3.0/gems/asciidoctor-bibtex-0.3.0/lib/asciidoctor-bibtex/asciidoctor.rb:2:in `<top (required)>'
  | /var/lib/gems/2.3.0/gems/asciidoctor-bibtex-0.3.0/lib/asciidoctor-bibtex.rb:11:in `require_relative'
  | /var/lib/gems/2.3.0/gems/asciidoctor-bibtex-0.3.0/lib/asciidoctor-bibtex.rb:11:in `<top (required)>'
  | /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:91:in `require'
  | /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:91:in `block (2 levels) in require'
  | /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:86:in `each'
  | /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:86:in `block in require'
  | /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:75:in `each'
  | /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:75:in `require'
  | /usr/lib/ruby/vendor_ruby/bundler.rb:106:in `require'
  | /var/lib/gems/2.3.0/gems/jekyll-3.5.0/lib/jekyll/plugin_manager.rb:49:in `require_from_bundler'
  | /var/lib/gems/2.3.0/gems/jekyll-3.5.0/exe/jekyll:9:in `<top (required)>'
  | /usr/local/bin/jekyll:22:in `load'
  | /usr/local/bin/jekyll:22:in `<main>'
  | Bundler Error Backtrace:
  | from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:90:in `block (2 levels) in require'
  | from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:86:in `each'
  | from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:86:in `block in require'
  | from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:75:in `each'
  | from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:75:in `require'
  | from /usr/lib/ruby/vendor_ruby/bundler.rb:106:in `require'
  | from /var/lib/gems/2.3.0/gems/jekyll-3.5.0/lib/jekyll/plugin_manager.rb:49:in `require_from_bundler'
  | from /var/lib/gems/2.3.0/gems/jekyll-3.5.0/exe/jekyll:9:in `<top (required)>'
  | from /usr/local/bin/jekyll:22:in `load'
  | from /usr/local/bin/jekyll:22:in `<main>'

\textemdash is not replaced

Zoteros output:

@article{guo2009,
  title = {Validation and Verification of Computer Forensic Software tools\textemdash{}{{Searching Function}}},
  volume = {6},
  issn = {17422876},
  doi = {10.1016/j.diin.2009.06.015},
  language = {en},
  timestamp = {2016-06-13T16:44:17Z},
  urldate = {2016-06-13},
  journal = {Digital Investigation},
  author = {Guo, Yinghua and Slay, Jill and Beckett, Jason},
  month = sep,
  year = {2009},
  pages = {S12--S22}
}

How it is rendered

  1. Y. Guo, J. Slay, and J. Beckett, “Validation and Verification of Computer Forensic
    Software tools\textemdashSearching Function,” Digital Investigation, vol. 6, pp.
    S12–S22, Sep. 2009.

Please note the \textemdash

Feature request: Customizing numbering

Is there a way to customize the inline citation as well as the reference list:

Example:

The document cite:[doc-a] should be...

[bibliography]
== References
bibliography::[]

The document /1/ should be...

References
/1/ BMW; "A dummy document"; 12345; 2019-09-01

The current situation is:

The document [1] should be...

References

  1. BMW; "A dummy document"; 12345; 2019-09-01

JavaScript compatibility

Hi,

I'm working on the Asciidoctor Browser extension (which uses Asciidoctor.js) and I got the following question:

Hi, Does the live preview support asciidoctor-bibtex? My bibliographies don't show up, but perhaps I need to configure something? Gavin

As far as I understand, "asciidoctor-bibtex" uses https://github.com/inukshuk/bibtex-ruby so it may not be an easy task to compile/port this library to JavaScript.

Anyway if you think it's possible to compile this library to JavaScript using Opal I can get you set-up 😉

Thanks!

Note citations rendered in main text?

I am just trying out asciidoctor-bibtex, and it looks like a very promising project. I am just wondering why citations in note styles are not rendered in footnotes, but end up in the main text. Is this a bug, a design choice, or am I making something wrong?

Support for biblatex

Is it planned to support using \printbibliography instead of \bibliographywhen using bibliography::[]? With biblatex, using \bibliography outside of the preamble is a syntax error.
If you tell me how you would want it to work, I'll submit a PR for this.

Problem with asciidoctor-bibtex with asciidoctor 2.0.2

asciidoctor-bibtex crashes on several input files with latest asciidoctor 2.0.2. I will report this issue also in the asciidoctor archive in case this is an regression in the asciidoctor program. The stacktrace I get with asciidoctor --trace is:

RUBYLIB=/home/pela/svnroot/internal-tools/asciidoc-templates/db2ltx \
        asciidoctor -a docinfo=shared,private -a templatesdir=/home/pela/svnroot/internal-tools/asciidoc-templates -r asciidoctor-diagram -a blockdiag=/usr/bin/blockdiag -a dot=/usr/bin/dot -r asciidoctor-bibtex --verbose --trace  -b docbook -o makeguide.xml makeguide.adoc
/home/pela/.gem/ruby/2.3.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:113:in `gsub!': asciidoctor: FAILED: /home/pela/svnroot/QAG/dcs-make/makeguide.adoc: Failed to load AsciiDoc document - can't modify frozen String (RuntimeError)
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:113:in `block (2 levels) in process'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:112:in `each'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:112:in `block in process'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:109:in `each'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-bibtex-0.3.1/lib/asciidoctor-bibtex/bibextension.rb:109:in `process'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/lib/asciidoctor/document.rb:557:in `[]'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/lib/asciidoctor/document.rb:557:in `block in parse'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/lib/asciidoctor/document.rb:556:in `each'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/lib/asciidoctor/document.rb:556:in `parse'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/lib/asciidoctor.rb:1301:in `load'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/lib/asciidoctor.rb:1410:in `convert'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/lib/asciidoctor.rb:1518:in `block in convert_file'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/lib/asciidoctor.rb:1518:in `open'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/lib/asciidoctor.rb:1518:in `convert_file'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/lib/asciidoctor/cli/invoker.rb:126:in `block in invoke!'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/lib/asciidoctor/cli/invoker.rb:109:in `each'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/lib/asciidoctor/cli/invoker.rb:109:in `invoke!'
        from /home/pela/.gem/ruby/2.3.0/gems/asciidoctor-2.0.2/bin/asciidoctor:15:in `<top (required)>'
        from /home/pela/bin/asciidoctor:23:in `load'
        from /home/pela/bin/asciidoctor:23:in `<main>'

Regression in version 0.4.0

The latest version 0.4.0 of asciidoctor-bibtex fixed the crash with asciidoctor version >= 2.0, but introduces a regression failure. The produced reference table is OK, but he inline macros "cite:[]" are not processed in DocBook translation but left verbatim in the DocBook output.

Unicode is not the default language (LANG=en_US.UTF-8)

This has been a problem with asciidoc-bib also, if there are citation with non US-ASCII letters it nags about invalid byte sequence in US-ASCII (ArgumentError). One can avoid this by doing like export LANG=en_US.UTF-8 && asciidoc-bibtex ... but it might be better to switch to UTF-8 inside the code.

Citation in block titles

In the discussion of #17 it was mentioned that citations in block titles can be implemented. Well I would like to see this feature.

I'm using v0.3.1, thanks!

Fix ownership

@mojavelinux, I transfered this extension to asciidoctor.org. Although I can still commit directly to this repo, I can no longer change project settings. Would you please fix that (possibly by fixing the ownership)? Thanks.

how to run the tests

Can someone provide hints/directsions for how to run the tests? I am willing to contribute documentation once we get them to run. EDIT: Note that I am a beginner in ruby, so some of what is unclear to me might be easy for others.

Some problems I ran into, as well as suggestions for improvement:

  1. Running bundle install throws an error because the Gemfile is missing. Adding this very simple Gemfile should fix the isse:
source "http://www.rubygems.org"
gemspec
  1. I think some development dependencies should be added to the gemspec file. Specifically, rake and rspec need to be installed in order to be able to run the rakefile's spec task. I guess these lines should be added to asciidoctor-bibtex.gemspec:
  s.add_development_dependency "bundler", "~> 2.0"
  s.add_development_dependency "rake", "~> 12.0"
  s.add_development_dependency "rspec", "~> 3.0"
  1. Naming convention of test files. By default, the rake spec task looks for files named *_spec.rb. Since the tests in this repo are using a different naming convention, a different pattern needs to be specified in the Rakefile:
t.pattern = "test/*_test.rb"
  1. LoadErrors. When I then run bundle exec rake spec, then rspec suceeds in finding the test cases, but it throws a lot of load errors. Further investigation of the test_helpers.rb file suggests that simplecov and minitests are used in addition to rspec. That's when I gave up and started writing this ticket.

Citations are being ignored if they are in sidebar, quotes

Citation are being ignored if they reside in a sidebar or quote. For the quote, this:
[quote.epigraph, 'Arthur C. Clarke cite:[Clarke_2001_1968]', 2001: A Space Odyssey]
does not get translated, so a quotation cannot get its source identified.

Citations text malformed if used with asciidoctor-latex

I want to write a document with both formulas and references, so I am using asciidoctor-bibtex and asciidoctor-latex together. I am compiling using

asciidoctor-latex -r asciidoctor-bibtex -a stylesheet=asciidoctor.css -a stylesdir=styles/ -b html "mydoc.adoc"

This mostly works fine, but the citations text, instead of having the usual style [1] show the "code" of my reference with extra square brackets, e.g. [[sutton2011reinforcement]].

My document is something like:

:last-update-label!:
:xrefstyle: short
:source-highlighter: coderay
:bibtex-file: references.bib
:bibtex-style: ieee
= Title

This is a reference I want to cite cite:[sutton2011reinforcement], and this is an equation I want to show:
\[
P(A) = \frac{50}{20}
\]

== Bibliography
bibliography::[]

Am I using the two packages the wrong way? Are they even compatible? Can I work around the issue?

Thanks for the support!

Show date consulted

Is there a way to show the date a source is consulted in the bibliography using asciidoctor-bibtex?

Release 0.3.0

It has been a long time from the last release. Several fixes and enhancements have been made and it is a good time to make a new release.

Support Citation in Figure Caption

Please support citations inside figure captions.

Background: I am using asciidoctor for scientific writing. In this context, it is quite usual for figure captions to include citations, e.g., when the figure has been taken from another, related work.

Example:

= Example
:bibtex-file: ./example.bib
:bibtex-style: apa

Example to demonstrate an issue with asciidoctor-bibtex 
where citations do not work within figure captions 
even though they are working correctly in the main body, 
as evident in this citation cite:[mycitation].

.Example figure from cite:[mycitation].
image::./figure.jpg[]


== Bibliography

bibliography::[]

See attached .zip file for a fully working minimal example:
asciidoctor-bibtex-issue.zip

Re-branding the extension

As suggested by Dan Allen, this extension is so different from asciidoc-bib that it does not fit the "fork" concept any more. So re-branding it as "inspired by asciidoc-bib" and add a history section in readme to reflect that this extension began as a fork of asciidoc-bib, but went on a different way.

Allow for localized CLS styles

Background: I want to localize the automated labels, e.g. "Ed." for the editor to the German "Hrsg.".

It may be a misunderstanding on my part, but per the Readme:

Attribute Name Description Valid Values Default Value
bibtex-style Reference formatting style any style supported by csl-styles ieee

I had a look at the CLS website, particularly the Localization section: https://citationstyles.org/authors/#/localization

In the linked page, there are a lot of localization options listed: https://github.com/citation-style-language/locales/wiki

Altough, when I'm trying to use one of the options, e,g. and i.e. "de-DE", I get the following error, when I'm trying to compile via asciidoctor -r asciidoctor-bibtex test.adoc:

asciidoctor: FAILED: REDACTED/test.adoc: Failed to load AsciiDoc document - failed to extract CSL data from "de-DE": No such file or directory @ rb_sysopen - de-DE

My minimum NOT working example:

File test.adoc:

= Title
:bibtex-file: bibliography.bib
:bibtex-style: de-DE

This is a sample text cite:[cite_id].

bibliography::[]

File bibliography.bib:

@book{cite_id,
   year={2018},
   title={Book Title},
   editor={John Editor},
}

Am I misinterpreting something?

Support setting bibtex attributes in documents

Currently, bibtex attributes can only be set via the command-line. It would be nice to set them in the documents.

Since asciidoctor-bibtex is implemented as a preprocess step, we can not get the attribute settings from document object. We may have to use regex to parse them, which may slow down the process.

Anyway, we can implement it first and support the CLI > document > internal priority convention.

Rename source files

Ruby source files should be named in lowercase. Individual words in the class name should be separated by underscores.

  • Processor.rb → processor.rb
  • StringUtils.rb → string_utils.rb
  • CitationMacro.rb → citation_macro.rb
  • ...

Also, test files should use the _test.rb suffix instead of prefix:

  • test_Processor.rb → processor_test.rb
  • test_PathUtils.rb → path_utils_test.rb

Please rename the source files accordingly.

Broken text formatting in lists

Since upgrading to asciidoctor 2.0.10 I am getting broken formatting of text in lists if my adoc file is processed with asciidoctor-bibtex.

Minimal example of source file:

= Test

* Item1, `code`
* Item2, *bold*
* Item3, _I_~sub~

If compiled as
asciidoctor -r asciidoctor-bibtex test.adoc

gives

Test

    Item1, <code>code</code>

    Item2, <strong>bold</strong>

    Item3, <em>I</em><sub>sub</sub>

If I compile it without bibtex as
asciidoctor test.adoc
it gives a correct html with appropriately formatted list items.

My versions:

$ gem list
asciidoctor (2.0.10, 1.5.8)
asciidoctor-bibtex (0.5.1)
$ asciidoctor -v
Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-gnu]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

Is this a bug?

comparison of Array with Array failed

I have been encountering a consistent yet difficult to isolate error of

Failed to load AsciiDoc document - comparison of Array with Array failed
Use --trace for backtrace

I cannot create a minimum working example; all such examples work fine. But in my book project with 250+ citations, the error has halted my production. It can be reproduced on both MacOS and Ubuntu. The error seems to be dependent on the location or existence of particular citations in the *.adoc file, and/or their ordering in the *.bib file, which makes no sense. Sometimes, I can prevent the error by including a dummy cite "cite:[x]" early in the build, but this does not work consistently. Can anyone provide at least some troubleshooting steps?

Thanks

Trace is:

/Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/citations.rb:28:in sort_by': asciidoctor: FAILED: /Users/Char/repos/aitm/aitm-instructor.adoc: Failed to load AsciiDoc document - comparison of Array with Array failed (ArgumentError) from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/citations.rb:28:in sorted_cites'
from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/processor.rb:292:in sorted_cites' from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/processor.rb:265:in make_citation'
from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/processor.rb:169:in block in complete_citation' from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/processor.rb:159:in each'
from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/processor.rb:159:in each_with_index' from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/processor.rb:159:in complete_citation'
from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/bibextension.rb:87:in block (3 levels) in process' from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/bibextension.rb:86:in each'
from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/bibextension.rb:86:in block (2 levels) in process' from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/bibextension.rb:85:in each'
from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/bibextension.rb:85:in block in process' from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/bibextension.rb:77:in each'
from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-bibtex-0.2.0/lib/asciidoctor-bibtex/bibextension.rb:77:in process' from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-1.5.5/lib/asciidoctor/document.rb:479:in []'
from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-1.5.5/lib/asciidoctor/document.rb:479:in block in parse' from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-1.5.5/lib/asciidoctor/document.rb:478:in each'
from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-1.5.5/lib/asciidoctor/document.rb:478:in parse' from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-1.5.5/lib/asciidoctor.rb:1347:in load'
from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-1.5.5/lib/asciidoctor.rb:1465:in convert' from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-1.5.5/lib/asciidoctor/cli/invoker.rb:95:in block in invoke!'
from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-1.5.5/lib/asciidoctor/cli/invoker.rb:87:in each' from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-1.5.5/lib/asciidoctor/cli/invoker.rb:87:in invoke!'
from /Users/Char/.chefdk/gem/ruby/2.1.0/gems/asciidoctor-1.5.5/bin/asciidoctor:14:in <top (required)>' from /Users/Char/.chefdk/gem/ruby/2.1.0/bin/asciidoctor:22:in load'
from /Users/Char/.chefdk/gem/ruby/2.1.0/bin/asciidoctor:22:in `

'

citation in footnote

The extension don't seem to handle citations inside footnotes or table cells.

Bug: - is not allowed in bibtex references

- is not supported in bibtex references

eg

@book{raviart-thomas-t1983,                                                                                                                                     
 title={Introduction à  l'analyse numérique des équations aux dérivées partielles},                                                                           
 author={Raviart P.A. and Thomas J.M.},                                                                                                                       
 publisher={Masson},                                                                                                                                          
 year={1983}                                                                                                                                                  
 } 

I have to change the reference to

@book{raviartthomast1983,                                                                                                                                     
 title={Introduction à  l'analyse numérique des équations aux dérivées partielles},                                                                           
 author={Raviart P.A. and Thomas J.M.},                                                                                                                       
 publisher={Masson},                                                                                                                                          
 year={1983}                                                                                                                                                  
 } 

I have tons of these references

I have also : and . as separators

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.