Comments (16)
from asciidoctor-bibliography.
@pela9 apologies for the late response. Indeed it is something that we should allow.
@paolobrasolin would you have time to look into this? Thanks!
from asciidoctor-bibliography.
I've found a workaround. The problem arises because having inline macros of the standard form (e.g., xref:Anderson98[Anderson & Lebiere, 1998]
inside footnotes gives Asciidoctor difficulties: nesting of square brackets seems to be a parsing challenge (or something). This is the form of xref asciidoctor-bibliography uses, though, to establish the citations' links to the bibliography.
asciidoctor-bibtex had no trouble when citations were in footnotes; that's because it used the double-angle-bracket form of xref instead (e.g., <<Anderson04,Anderson et al., 2004>>
). Asciidoctor has no parsing-difficulties when it finds this kind in footnotes, because it introduces no square brackets.
I've just finished writing and testing (somewhat) a patch of asciidoctor-bibliography that uses this double-angle-bracket form of the citation xrefs. On my test-file, it worked beautifully: It also did something that asciidoctor-bibtex could NOT do, which is support citations in quote-attributions in a quote-block style attribute-list (see User Manual https://asciidoctor.org/docs/user-manual/#quote ).
The question is, then, whether there is any reason not to use this double-angle-bracket form of xrefs: is there some situation(s) in which it is not as robust as the style that uses square brackets?
It actually takes very little code change to do this (all in citation.rb). I could set up a PR if you're interested in testing it.
from asciidoctor-bibliography.
Some more notes:
Asciidoctor can handle nested builltin inline macros, but it seems that asciidoctor-bibliography (and asciidoctor-bibtex) can't handle a nested cite:[...] macro inside another, e.g.
footnote:[abc cite:[KEY] def] is parsed as: "footnote:[abc cite:[KEY]" + "def]"
(I actually use asciidoctor-bibtex and found initially the same problem there, which I have reported also on its issue list. I use asciidoctor for translation to docbook only, haven't checked if there is the same problem with other output formats).
from asciidoctor-bibliography.
Yes, good point. Asciidoctor does fine with nested square brackets when it's from an inline macro it recognizes and processes. The cite:[]
"macro" though, is a cow from someone else's field. Not seeing it as a macro, Asciidoctor figures the footnote has ended, once it sees the first ]
. Thus the parsing-anomalies.
from asciidoctor-bibliography.
Actually that's a bit over-simplified: When asciidoctor-bibliography is in use, Asciidoctor never has to parse a cite:[]
"macro", because the extension has actually replaced all those--with Asciidoctor xref macros--by the time Asciidoctor starts parsing. However, as mentioned, asciidoctor-bibliography is replacing the cite:[]
"macros" with xref:target[]
macros--which end with square brackets too. When Asciidoctor sees that ]
, it says, "End of footnote."
from asciidoctor-bibliography.
I'm not really sure, though, why that should be: Asciidoctor should, it seems, be able to parse the square-bracket version of the xref macro, since as you say, it can handle others OK. All I know is that it likes the double-angle-bracket form much better, inside footnotes.
from asciidoctor-bibliography.
The only way you can get one of the square-bracket xrefs to work inside a footnote, is to escape the closing square-bracket:
xref:bibliography-default-Anderson98[Anderson & Lebiere, 1998\]
That works fine in a footnote in Asciidoctor. But of course, a bibliography extension cannot do that all the time, because outside of a footnote (or another macro?) the xref doesn't work at all!
from asciidoctor-bibliography.
Perhaps when asciidoctor-bibtex started out, it was using the square-bracket xrefs.
from asciidoctor-bibliography.
And you are correct that in the DocBook conversion, a non-escaped-end-bracket xref:targetID[citation-text]
in a footnote will get parsed as a link--but its closing square bracket and the rest of the footnote (including the created </link>
endtag) get pushed out of the footnote. However, it's even worse with the HTML conversion: there, the xref doesn't get processed at all, but remains in its current form--except that those same bits get pushed out of the footnote.
from asciidoctor-bibliography.
You can see my initial offering, in PR #81. There's an issue Travis-CI uncovered which I've followed up with a comment, and will look into further.
from asciidoctor-bibliography.
Travis-CI has, now, no substantive complaint in PR #81: only two "errors", both amounting to, "We expected the square-bracketed xrefs, and you gave us angle-bracketed instead!!" But that's the whole point of the exercise ;)
from asciidoctor-bibliography.
Let me add, that IMHO this is a dandy bibliography extension. And this (two-line) emendation would make it, well, just terrific!
from asciidoctor-bibliography.
Another workaround I found is referencing the citation to make it appear in the bibliography and to reference it via an xref link to display it properly in the footnote:
:dumb_variable: cite[kent_beck_manifesto_2001]
Bla footnote:[Agile Manifesto (<<bibliography-default-kent_beck_manifesto_2001, Beck and al., 2001>>)] blah.
from asciidoctor-bibliography.
Thanks everybody for your initiative and thoughtful inputs.
I'm gonna recap the situation:
asciidoctor-bibliography
citations do not work in footnotes (thanks @pela9 for reporting this),- this is caused by the fact that
xref
s do not work in footnotes even in vanillaasciidoctor
, - which in turn is caused by a non-trivial problem with the
asciidoctor
parser, see asciidoctor/asciidoctor#61.
At least three solutions exist.
- Quoting the closing bracket of the citation macro within the footnote as suggested in asciidoctor/asciidoctor#3251 (comment); this is too disruptive and needs much smarter parsing to work, as already stated.
- Citing a key, tossing it away and manually writing the citation text as shown by @oncletom above; this is useful, but just as a manual workaround.
- Letting
asciidoctor-bibliography
use the double angled bracket form while interpolating the cross-references as suggested by @andrewcarver. This is the winner IMO: it's using proper features of vanillaasciidoctor
and after some testing I see no evidence of failure.
I'll clean up @andrewcarver's #81 (which implements 3) and merge it.
from asciidoctor-bibliography.
Just released v0.9.2 including this fix.
from asciidoctor-bibliography.
Related Issues (20)
- Bug with custom attributes when translating to DocBook HOT 3
- Question: own styles HOT 1
- :bibliography-database: not set via asciidoctor-epub3 for included documents HOT 6
- Bib entry with identical author and year HOT 18
- Minor APA format issue HOT 4
- Converting directly with Ruby HOT 2
- Variable interpolation breaks include
- anomalies when using Asciidoctor's ifeval::[] and asciidoctor-bibliography HOT 3
- Errors with asciidoctor-pdf HOT 2
- Numbered bibliography
- Comparison with asciidoc-bib and asciidoctor-bibtex
- A problem building Nokogiri, when installing on Windows HOT 7
- Migrate to GitHub Actions from Travis
- Change default branch to main HOT 1
- Asciidoc-bibliography messes with section levels after include
- Feature request: Styling per bibliography
- Citations get parsed within inline source code environment HOT 2
- Multi-Citation of more than two keys not working HOT 5
- [enhancement] nocite macro for bibliography entry without expicit citation HOT 1
- Incompatibility with asciidoctor version >= 2.0 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asciidoctor-bibliography.