asciidoctor-bibliography 0.0.1.dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +50 -0
- data/Gemfile +21 -0
- data/Gemfile.lock +41 -0
- data/LICENSE.txt +21 -0
- data/README.adoc +101 -0
- data/SYNTAX.adoc +117 -0
- data/asciidoctor-bibliography.gemspec +37 -0
- data/deprecated/asciidoctor-bibliography/asciidoctor/bibliographer_postprocessor.rb +23 -0
- data/deprecated/asciidoctor-bibliography/asciidoctor/bibliography_block_macro.rb +77 -0
- data/deprecated/asciidoctor-bibliography/asciidoctor/citation_processor.rb +144 -0
- data/deprecated/asciidoctor-bibliography/asciidoctor/cite_inline_macro.rb +30 -0
- data/deprecated/asciidoctor-bibliography/citationdata.rb +23 -0
- data/deprecated/asciidoctor-bibliography/citations.rb +45 -0
- data/deprecated/asciidoctor-bibliography/citationutils.rb +67 -0
- data/deprecated/asciidoctor-bibliography/extensions.rb +64 -0
- data/deprecated/asciidoctor-bibliography/filehandlers.rb +32 -0
- data/deprecated/asciidoctor-bibliography/index.rb +31 -0
- data/deprecated/asciidoctor-bibliography/processor.rb +208 -0
- data/deprecated/asciidoctor-bibliography/processorutils.rb +34 -0
- data/deprecated/asciidoctor-bibliography/styles.rb +27 -0
- data/lib/asciidoctor-bibliography.rb +3 -0
- data/lib/asciidoctor-bibliography/asciidoctor.rb +17 -0
- data/lib/asciidoctor-bibliography/asciidoctor/bibliographer_preprocessor.rb +68 -0
- data/lib/asciidoctor-bibliography/bibliographer.rb +31 -0
- data/lib/asciidoctor-bibliography/citation.rb +73 -0
- data/lib/asciidoctor-bibliography/database.rb +20 -0
- data/lib/asciidoctor-bibliography/databases/bibtex.rb +43 -0
- data/lib/asciidoctor-bibliography/formatters/csl.rb +12 -0
- data/lib/asciidoctor-bibliography/formatters/tex.rb +164 -0
- data/lib/asciidoctor-bibliography/helpers.rb +40 -0
- data/lib/asciidoctor-bibliography/index.rb +43 -0
- data/lib/asciidoctor-bibliography/version.rb +3 -0
- data/samples/.byebug_history +245 -0
- data/samples/biblio.bib +31 -0
- data/samples/latex_macros_in_bibtex/reference.bib +16 -0
- data/samples/latex_macros_in_bibtex/sample.adoc +13 -0
- data/samples/sample-authoryear.adoc +72 -0
- data/samples/sample-authoryear.html +550 -0
- data/samples/sample-numbers.adoc +72 -0
- data/samples/sample-numbers.html +550 -0
- metadata +187 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 864d555fbe79431ffb94b5124072822f100119a7
|
4
|
+
data.tar.gz: e6c24a670ebf6b0ee35db0abd0829a33d74b0d48
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ca771ffe5c26c93f734adf5378a952708f231206562d840719a2271f30b9cd9445b1c93e497696cb4e8688d2d05ff0f24c60a975764ddab2a6ca972f713ee049
|
7
|
+
data.tar.gz: 88a2f80a67c5e7fe03aeacd2a0e25c4cb8a251a2226d6be0b3cb5a57b955ea7972b7fa46337290872da18fba888071d5ca1edff08a1b413938c1a9b8f5ebb119
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
.ruby-version
|
47
|
+
.ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/Gemfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
git_source(:github) {|repo_name| "https://github.com/riboseinc/asciidoctor-bibliography" }
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
# gem 'asciidoctor'
|
8
|
+
|
9
|
+
# gem 'bibtex-ruby'
|
10
|
+
# gem 'latex-decode'
|
11
|
+
|
12
|
+
# gem 'byebug'
|
13
|
+
|
14
|
+
# gem 'citeproc-ruby'
|
15
|
+
# gem 'csl-styles'
|
16
|
+
|
17
|
+
|
18
|
+
# s.add_runtime_dependency('bibliography-ruby', "~> 4")
|
19
|
+
# s.add_runtime_dependency('citeproc-ruby')
|
20
|
+
# s.add_runtime_dependency('csl-styles', '~> 1')
|
21
|
+
# s.add_runtime_dependency('latex-decode', '~> 0.2')
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
asciidoctor-bibliography (0.0.1.dev)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
asciidoctor (1.5.6.1)
|
10
|
+
bibtex-ruby (4.4.4)
|
11
|
+
latex-decode (~> 0.0)
|
12
|
+
byebug (9.0.6)
|
13
|
+
citeproc (1.0.5)
|
14
|
+
namae (~> 0.8)
|
15
|
+
citeproc-ruby (1.1.7)
|
16
|
+
citeproc (>= 1.0.4, < 2.0)
|
17
|
+
csl (~> 1.4)
|
18
|
+
csl (1.4.5)
|
19
|
+
namae (~> 0.7)
|
20
|
+
csl-styles (1.0.1.8)
|
21
|
+
csl (~> 1.0)
|
22
|
+
latex-decode (0.2.2)
|
23
|
+
unicode (~> 0.4)
|
24
|
+
namae (0.11.3)
|
25
|
+
unicode (0.4.4.4)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
asciidoctor
|
32
|
+
asciidoctor-bibliography!
|
33
|
+
bibtex-ruby
|
34
|
+
bundler (~> 1.14)
|
35
|
+
byebug
|
36
|
+
citeproc-ruby
|
37
|
+
csl-styles
|
38
|
+
latex-decode
|
39
|
+
|
40
|
+
BUNDLED WITH
|
41
|
+
1.15.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Ribose Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.adoc
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
= Citations in AsciiDoc using asciidoctor-bibliography
|
2
|
+
|
3
|
+
image:https://img.shields.io/gem/v/asciidoctor-bibliography.svg["Gem Version", link="https://rubygems.org/gems/asciidoctor-bibliography"]
|
4
|
+
image:https://img.shields.io/travis/riboseinc/asciidoctor-bibliography/master.svg["Build Status", link="https://travis-ci.org/riboseinc/asciidoctor-bibliography"]
|
5
|
+
image:https://codeclimate.com/github/riboseinc/asciidoctor-bibliography/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/asciidoctor-bibliography"]
|
6
|
+
|
7
|
+
Citations in AsciiDoc using the fantastic http://asciidoctor.org/[asciidoctor].
|
8
|
+
|
9
|
+
== Introduction
|
10
|
+
|
11
|
+
This gem allows you to add BibTex style Citations to AsciiDoc.
|
12
|
+
|
13
|
+
== Installation
|
14
|
+
|
15
|
+
Add this line to your Gemfile:
|
16
|
+
|
17
|
+
[source,ruby]
|
18
|
+
----
|
19
|
+
gem "asciidoctor-bibliography"
|
20
|
+
----
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
[source,sh]
|
25
|
+
----
|
26
|
+
$ bundle install
|
27
|
+
----
|
28
|
+
|
29
|
+
Or install it yourself as:
|
30
|
+
|
31
|
+
[source,sh]
|
32
|
+
----
|
33
|
+
$ gem install asciidoctor-bibliography
|
34
|
+
----
|
35
|
+
|
36
|
+
== Configure
|
37
|
+
|
38
|
+
TODO
|
39
|
+
|
40
|
+
== Usage
|
41
|
+
|
42
|
+
TODO
|
43
|
+
|
44
|
+
== Development
|
45
|
+
|
46
|
+
We follow Sandi Metz's Rules for this gem, you can read the
|
47
|
+
http://robots.thoughtbot.com/post/50655960596/sandi-metz-rules-for-developers[description of the rules here].
|
48
|
+
All new code should follow these rules. If you make
|
49
|
+
changes in a file that already violates these rules, you should fix the
|
50
|
+
violations as part of your contribution.
|
51
|
+
|
52
|
+
=== Setup
|
53
|
+
|
54
|
+
Clone the repository.
|
55
|
+
|
56
|
+
[source,sh]
|
57
|
+
----
|
58
|
+
git clone https://github.com/riboseinc/asciidoctor-bibliography
|
59
|
+
----
|
60
|
+
|
61
|
+
Setup your environment.
|
62
|
+
|
63
|
+
[source,sh]
|
64
|
+
----
|
65
|
+
bin/setup
|
66
|
+
----
|
67
|
+
|
68
|
+
Run the test suite
|
69
|
+
|
70
|
+
[source,sh]
|
71
|
+
----
|
72
|
+
bin/rspec
|
73
|
+
----
|
74
|
+
|
75
|
+
== Contributing
|
76
|
+
|
77
|
+
First, thank you for contributing! We love pull requests from everyone. By
|
78
|
+
participating in this project, you hereby grant
|
79
|
+
https://www.ribose.com[Ribose Inc.] the right to grant or transfer an unlimited
|
80
|
+
number of non exclusive licenses or sub-licenses to third parties, under the
|
81
|
+
copyright covering the contribution to use the contribution by all means.
|
82
|
+
|
83
|
+
Here are a few technical guidelines to follow:
|
84
|
+
|
85
|
+
1. Open an https://github.com/riboseinc/asciidoctor-bibliography/issues[issues] to discuss a new feature.
|
86
|
+
2. Write tests to support your new feature.
|
87
|
+
3. Make sure the entire test suite passes locally and on CI.
|
88
|
+
4. Open a Pull Request.
|
89
|
+
5. https://github.com/thoughtbot/guides/tree/master/protocol/git=write-a-feature[Squash your commits] after receiving feedback.
|
90
|
+
6. Party!
|
91
|
+
|
92
|
+
== Credits
|
93
|
+
|
94
|
+
This gem is developed, maintained and funded by
|
95
|
+
https://www.ribose.com[Ribose Inc.]
|
96
|
+
|
97
|
+
== License
|
98
|
+
|
99
|
+
The gem is available as open source under the terms of the
|
100
|
+
http://opensource.org/licenses/MIT[MIT License].
|
101
|
+
|
data/SYNTAX.adoc
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
= asciidoctor-bibliography Syntax
|
2
|
+
|
3
|
+
We base our syntax off the asciidoctor `footnoteref` command.
|
4
|
+
|
5
|
+
[source,ruby]
|
6
|
+
----
|
7
|
+
footnoteref:[ref,Opinions are my own.]
|
8
|
+
footnoteref:[ref]
|
9
|
+
----
|
10
|
+
|
11
|
+
asciidoctor supports these commands now:
|
12
|
+
|
13
|
+
Attributes:
|
14
|
+
[source,ruby]
|
15
|
+
----
|
16
|
+
video::video_file.mp4[width=640, start=60, end=140, options=autoplay]
|
17
|
+
----
|
18
|
+
|
19
|
+
Options:
|
20
|
+
[source,ruby]
|
21
|
+
----
|
22
|
+
audio::ocean_waves.mp3[options="autoplay,loop"]
|
23
|
+
----
|
24
|
+
|
25
|
+
The "and" syntax:
|
26
|
+
|
27
|
+
[source,ruby]
|
28
|
+
----
|
29
|
+
\ifdef::env-github+backend-html5[HTML5 only.]
|
30
|
+
----
|
31
|
+
|
32
|
+
|
33
|
+
== Proposed Syntax
|
34
|
+
|
35
|
+
=== Basic Usage
|
36
|
+
|
37
|
+
[source,ruby]
|
38
|
+
----
|
39
|
+
# Output => "[1]"
|
40
|
+
cite:[foo]
|
41
|
+
|
42
|
+
# Output => "[1, Page 5]"
|
43
|
+
cite:[foo, page=5]
|
44
|
+
|
45
|
+
# Output => "[1, Page 5; 2, Chapter 21]"
|
46
|
+
cite:[foo, page=5]+[foobar, chapter=21]
|
47
|
+
|
48
|
+
# Output => "[1, 2]"
|
49
|
+
# or => "[1-2]"
|
50
|
+
cite:[foo]+[foobar]
|
51
|
+
|
52
|
+
# Output => "[1, 3]"
|
53
|
+
cite:[foo]+[bar]
|
54
|
+
----
|
55
|
+
|
56
|
+
=== BibTeX-compatible Usage
|
57
|
+
|
58
|
+
[source,ruby]
|
59
|
+
----
|
60
|
+
# BibTeX \citet{goossens93}
|
61
|
+
# Output: "Goossens et al. (1993)"
|
62
|
+
citet:[goossens93]
|
63
|
+
cite:[goossens93]
|
64
|
+
cite:[goossens93, authors=abbrev, format="%authors% (%year%)"]
|
65
|
+
|
66
|
+
# BibTeX \citet{goossens93}
|
67
|
+
# Output "(Goossens et al., 1993)"
|
68
|
+
citep:[goossens93]
|
69
|
+
cite:[goossens93, type=parens]
|
70
|
+
cite:[goossens93, authors=abbrev, format="(%authors%, %year%)"]
|
71
|
+
|
72
|
+
# BibTeX \citet*{goossens93}
|
73
|
+
# Output "Goossens, Mittlebach, and Samarin (1993)"
|
74
|
+
citets:[goossens93]
|
75
|
+
cite:[goossens93, authors=full, type=text]
|
76
|
+
cite:[goossens93, authors=full, format="%authors% (%year%)"]
|
77
|
+
|
78
|
+
# BibTeX \citep*{goossens93}
|
79
|
+
# Output "(Goossens, Mittlebach, and Samarin, 1993)"
|
80
|
+
citeps:[goossens93]
|
81
|
+
cite:[goossens93, authors=full, type=parens]
|
82
|
+
cite:[goossens93, authors=full, format="(%authors%, %year%)"]
|
83
|
+
|
84
|
+
# BibTeX \citeauthor{goossens93}
|
85
|
+
# Output "Goossens et al."
|
86
|
+
citeauthor:[goossens93]
|
87
|
+
cite:[goossens93, only=authors, authors=abbrev]
|
88
|
+
cite:[goossens93, authors=abbrev, format="%authors%"]
|
89
|
+
|
90
|
+
# BibTeX \citeauthor*{goossens93}
|
91
|
+
# Output => "Goossens, Mittlebach, and Samarin"
|
92
|
+
citeauthors:[goossens93]
|
93
|
+
cite:[goossens93, only=authors, authors=full]
|
94
|
+
cite:[goossens93, authors=full, format="%authors%"]
|
95
|
+
|
96
|
+
# BibTeX \citeyear{goossens93}
|
97
|
+
# Output => "1993"
|
98
|
+
citeyear:[goossens93]
|
99
|
+
cite:[goossens93, only=year]
|
100
|
+
cite:[goossens93, format="%year%"]
|
101
|
+
|
102
|
+
# BibTeX \citeyearpar{goossens93}
|
103
|
+
# Output => "(1993)"
|
104
|
+
citeyear:[goossens93]
|
105
|
+
cite:[goossens93, format="(%year%)"]
|
106
|
+
|
107
|
+
# BibTeX \citealt{goossens93}
|
108
|
+
# Output => "Goossens et al. 1993"
|
109
|
+
citealt:[goossens93]
|
110
|
+
cite:[goossens93, authors=abbrev, format="%authors% %year%"]
|
111
|
+
|
112
|
+
# BibTeX \citealp{goossens93}
|
113
|
+
# Output => "Goossens et al., 1993"
|
114
|
+
citealp:[goossens93]
|
115
|
+
cite:[goossens93, authors=abbrev, format="%authors%, %year%"]
|
116
|
+
----
|
117
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "asciidoctor-bibliography/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "asciidoctor-bibliography"
|
9
|
+
spec.version = AsciidoctorBibliography::VERSION
|
10
|
+
spec.authors = ["Ribose Inc."]
|
11
|
+
spec.email = ["open.source@ribose.com"]
|
12
|
+
|
13
|
+
spec.summary = "Bibliographic references for asciidoc"
|
14
|
+
spec.description = <<-END
|
15
|
+
asciidoctor-bibliography adds bibliography support for asciidoc documents by introducing
|
16
|
+
two new macros: `cite:[KEY]` and `bibliography::[]`. Citations are parsed and
|
17
|
+
replaced with formatted inline texts, and reference lists are automatically
|
18
|
+
generated and inserted into where `bibliography::[]` is placed. The
|
19
|
+
references are formatted using styles provided by CSL.
|
20
|
+
END
|
21
|
+
spec.homepage = "https://github.com/riboseinc/asciidoctor-bibliography"
|
22
|
+
spec.license = "MIT"
|
23
|
+
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
spec.files = `git ls-files`.split("\n")
|
26
|
+
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
27
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.0.0")
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
30
|
+
|
31
|
+
spec.add_development_dependency "asciidoctor"
|
32
|
+
spec.add_development_dependency "bibtex-ruby"
|
33
|
+
spec.add_development_dependency "byebug"
|
34
|
+
spec.add_development_dependency "citeproc-ruby"
|
35
|
+
spec.add_development_dependency "csl-styles"
|
36
|
+
spec.add_development_dependency "latex-decode"
|
37
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'asciidoctor'
|
2
|
+
require 'asciidoctor/extensions'
|
3
|
+
|
4
|
+
module AsciidoctorBibliography
|
5
|
+
module Asciidoctor
|
6
|
+
|
7
|
+
class BibliographerPostprocessor < ::Asciidoctor::Extensions::Postprocessor
|
8
|
+
def process document, output
|
9
|
+
puts self
|
10
|
+
# byebug
|
11
|
+
# content = (document.attr 'copyright') || 'Copyright Acme, Inc.'
|
12
|
+
# if document.basebackend? 'html'
|
13
|
+
# replacement = %(<div id="footer-text">\\1<br>\n#{content}\n</div>)
|
14
|
+
# output = output.sub(/<div id="footer-text">(.*?)<\/div>/m, replacement)
|
15
|
+
# elsif document.basebackend? 'docbook'
|
16
|
+
# replacement = %(<simpara>#{content}</simpara>\n\\1)
|
17
|
+
# output = output.sub(/(<\/(?:article|book)>)/, replacement)
|
18
|
+
# end
|
19
|
+
output
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'bibtex'
|
2
|
+
|
3
|
+
require 'asciidoctor'
|
4
|
+
require 'asciidoctor/extensions'
|
5
|
+
require 'asciidoctor/reader'
|
6
|
+
require 'asciidoctor/parser'
|
7
|
+
# require 'bibliography/filters'
|
8
|
+
# require 'latex/decode/base'
|
9
|
+
# require 'latex/decode/maths'
|
10
|
+
# require 'latex/decode/accents'
|
11
|
+
# require 'latex/decode/diacritics'
|
12
|
+
# require 'latex/decode/punctuation'
|
13
|
+
# require 'latex/decode/symbols'
|
14
|
+
# require 'latex/decode/greek'
|
15
|
+
# require_relative 'styles'
|
16
|
+
# require_relative 'filehandlers'
|
17
|
+
|
18
|
+
require 'byebug'
|
19
|
+
|
20
|
+
module AsciidoctorBibliography
|
21
|
+
module Asciidoctor
|
22
|
+
class BibliographyBlockMacro < ::Asciidoctor::Extensions::BlockMacroProcessor
|
23
|
+
use_dsl
|
24
|
+
named :bibliography
|
25
|
+
# positional_attributes :style
|
26
|
+
|
27
|
+
def process parent, target, attrs
|
28
|
+
puts self
|
29
|
+
|
30
|
+
# List of targets to render
|
31
|
+
keys = parent.document.bibliographer.occurrences.map { |o| o[:target] }.uniq
|
32
|
+
|
33
|
+
|
34
|
+
# NOTE: bibliography-file and bibliography-reference-style set by this macro
|
35
|
+
# shall be overridable by document attributes and commandline arguments.
|
36
|
+
# So we respect the convention here.
|
37
|
+
|
38
|
+
# if target and not parent.document.attr? 'bibliography-file'
|
39
|
+
# parent.document.set_attribute 'bibliography-file', target
|
40
|
+
# end
|
41
|
+
|
42
|
+
if parent.document.attr? 'bibliography-database'
|
43
|
+
parent.document.bibliographer.load_database parent.document.attributes['bibliography-database']
|
44
|
+
end
|
45
|
+
|
46
|
+
# if attrs.key? :style and not parent.document.attr? 'bibliography-reference-style'
|
47
|
+
# parent.document.set_attribute 'bibliography-reference-style', attrs[:style]
|
48
|
+
# end
|
49
|
+
|
50
|
+
# index = AsciidoctorBibliography::Index.new parent, target, attrs, SecureRandom.uuid
|
51
|
+
# parent.document.bibliographer.indices << index
|
52
|
+
|
53
|
+
# html = index.placeholder
|
54
|
+
# attrs = {}
|
55
|
+
|
56
|
+
# create_pass_block parent, html, attrs#, subs: nil
|
57
|
+
|
58
|
+
# parent.document.register :links, target
|
59
|
+
# create_anchor parent, text, type: :link, target: target
|
60
|
+
|
61
|
+
# byebug
|
62
|
+
|
63
|
+
# keys.each do |key|
|
64
|
+
# create_paragraph parent, key, {}
|
65
|
+
# end
|
66
|
+
|
67
|
+
# index_block = create_block parent, a
|
68
|
+
create_paragraph index_block, keys.first, {}
|
69
|
+
|
70
|
+
# Asciidoctor::Block.new(parent, :paragraph, :source => '_This_ is a <test>')
|
71
|
+
|
72
|
+
# TODO: unordered list
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|