asciidoctor-bibliography 0.1 → 0.2.0
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 +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +17 -0
- data/Gemfile +1 -1
- data/Rakefile +3 -3
- data/asciidoctor-bibliography.gemspec +28 -26
- data/lib/asciidoctor-bibliography.rb +4 -1
- data/lib/asciidoctor-bibliography/asciidoctor.rb +3 -9
- data/lib/asciidoctor-bibliography/asciidoctor/bibliographer_preprocessor.rb +43 -15
- data/lib/asciidoctor-bibliography/asciidoctor/document_ext.rb +11 -0
- data/lib/asciidoctor-bibliography/bibliographer.rb +20 -9
- data/lib/asciidoctor-bibliography/citation.rb +74 -51
- data/lib/asciidoctor-bibliography/citation_item.rb +27 -0
- data/lib/asciidoctor-bibliography/database.rb +14 -7
- data/lib/asciidoctor-bibliography/databases/bibtex.rb +5 -4
- data/lib/asciidoctor-bibliography/exceptions.rb +5 -0
- data/lib/asciidoctor-bibliography/formatters/csl.rb +5 -0
- data/lib/asciidoctor-bibliography/formatters/tex.rb +20 -22
- data/lib/asciidoctor-bibliography/helpers.rb +3 -3
- data/lib/asciidoctor-bibliography/index.rb +21 -25
- data/lib/asciidoctor-bibliography/version.rb +1 -1
- data/samples/{biblio.bib → standard/biblio.bib} +0 -0
- data/samples/standard/sample-default.adoc +22 -0
- data/samples/standard/sample-default.html +476 -0
- data/samples/standard/sample-din.adoc +22 -0
- data/samples/standard/sample-din.html +476 -0
- data/samples/standard/sample-ieee.adoc +22 -0
- data/samples/standard/sample-ieee.html +476 -0
- data/samples/tex/biblio.bib +31 -0
- data/samples/{sample-authoryear.adoc → tex/sample-authoryear.adoc} +2 -3
- data/samples/{sample-authoryear.html → tex/sample-authoryear.html} +9 -6
- data/samples/tex/sample-din.adoc +74 -0
- data/samples/tex/sample-din.html +556 -0
- data/samples/{sample-numbers.adoc → tex/sample-numbers.adoc} +4 -0
- data/samples/{sample-numbers.html → tex/sample-numbers.html} +14 -8
- data/samples/tex/sample-ordering.adoc +20 -0
- data/samples/tex/sample-ordering.html +467 -0
- data/spec/citation_item_spec.rb +52 -0
- data/spec/database_spec.rb +39 -0
- data/spec/fixtures/database.bib +31 -0
- data/spec/fixtures/database.bibtex +6 -0
- data/spec/fixtures/database.unk +0 -0
- data/spec/throwaway_spec.rb +6 -0
- metadata +61 -25
- data/deprecated/asciidoctor-bibliography/asciidoctor/bibliographer_postprocessor.rb +0 -23
- data/deprecated/asciidoctor-bibliography/asciidoctor/bibliography_block_macro.rb +0 -77
- data/deprecated/asciidoctor-bibliography/asciidoctor/citation_processor.rb +0 -144
- data/deprecated/asciidoctor-bibliography/asciidoctor/cite_inline_macro.rb +0 -30
- data/deprecated/asciidoctor-bibliography/citationdata.rb +0 -23
- data/deprecated/asciidoctor-bibliography/citations.rb +0 -45
- data/deprecated/asciidoctor-bibliography/citationutils.rb +0 -67
- data/deprecated/asciidoctor-bibliography/extensions.rb +0 -64
- data/deprecated/asciidoctor-bibliography/filehandlers.rb +0 -32
- data/deprecated/asciidoctor-bibliography/index.rb +0 -31
- data/deprecated/asciidoctor-bibliography/processor.rb +0 -208
- data/deprecated/asciidoctor-bibliography/processorutils.rb +0 -34
- data/deprecated/asciidoctor-bibliography/styles.rb +0 -27
@@ -1,34 +0,0 @@
|
|
1
|
-
|
2
|
-
module AsciidoctorBibliography
|
3
|
-
module ProcessorUtils
|
4
|
-
# Used with numeric styles to combine consecutive numbers into ranges
|
5
|
-
# e.g. 1,2,3 -> 1-3, or 1,2,3,6,7,8,9,12 -> 1-3,6-9,12
|
6
|
-
# leave references with page numbers alone
|
7
|
-
def combine_consecutive_numbers str
|
8
|
-
nums = str.split(",").collect(&:strip)
|
9
|
-
res = ""
|
10
|
-
# Loop through ranges
|
11
|
-
start_range = 0
|
12
|
-
while start_range < nums.length do
|
13
|
-
end_range = start_range
|
14
|
-
while (end_range < nums.length-1 and
|
15
|
-
nums[end_range].is_i? and
|
16
|
-
nums[end_range+1].is_i? and
|
17
|
-
nums[end_range+1].to_i == nums[end_range].to_i + 1) do
|
18
|
-
end_range += 1
|
19
|
-
end
|
20
|
-
if end_range - start_range >= 2
|
21
|
-
res += "#{nums[start_range]}-#{nums[end_range]}, "
|
22
|
-
else
|
23
|
-
start_range.upto(end_range) do |i|
|
24
|
-
res += "#{nums[i]}, "
|
25
|
-
end
|
26
|
-
end
|
27
|
-
start_range = end_range + 1
|
28
|
-
end
|
29
|
-
# finish by removing last comma
|
30
|
-
res.gsub(/, $/, '')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# styles.rb
|
3
|
-
# Simple checks on available styles through CSL
|
4
|
-
#
|
5
|
-
|
6
|
-
module AsciidoctorBibliography
|
7
|
-
|
8
|
-
module Styles
|
9
|
-
|
10
|
-
def Styles.available
|
11
|
-
CSL::Style.ls
|
12
|
-
end
|
13
|
-
|
14
|
-
def Styles.default_style
|
15
|
-
'apa'
|
16
|
-
end
|
17
|
-
|
18
|
-
def Styles.valid? style
|
19
|
-
Styles.available.include? style
|
20
|
-
end
|
21
|
-
|
22
|
-
def Styles.is_numeric? style
|
23
|
-
CSL::Style.load(style).citation_format == :numeric
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|