asciidoctor-bibliography 0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.rubocop.yml +17 -0
  4. data/Gemfile +1 -1
  5. data/Rakefile +3 -3
  6. data/asciidoctor-bibliography.gemspec +28 -26
  7. data/lib/asciidoctor-bibliography.rb +4 -1
  8. data/lib/asciidoctor-bibliography/asciidoctor.rb +3 -9
  9. data/lib/asciidoctor-bibliography/asciidoctor/bibliographer_preprocessor.rb +43 -15
  10. data/lib/asciidoctor-bibliography/asciidoctor/document_ext.rb +11 -0
  11. data/lib/asciidoctor-bibliography/bibliographer.rb +20 -9
  12. data/lib/asciidoctor-bibliography/citation.rb +74 -51
  13. data/lib/asciidoctor-bibliography/citation_item.rb +27 -0
  14. data/lib/asciidoctor-bibliography/database.rb +14 -7
  15. data/lib/asciidoctor-bibliography/databases/bibtex.rb +5 -4
  16. data/lib/asciidoctor-bibliography/exceptions.rb +5 -0
  17. data/lib/asciidoctor-bibliography/formatters/csl.rb +5 -0
  18. data/lib/asciidoctor-bibliography/formatters/tex.rb +20 -22
  19. data/lib/asciidoctor-bibliography/helpers.rb +3 -3
  20. data/lib/asciidoctor-bibliography/index.rb +21 -25
  21. data/lib/asciidoctor-bibliography/version.rb +1 -1
  22. data/samples/{biblio.bib → standard/biblio.bib} +0 -0
  23. data/samples/standard/sample-default.adoc +22 -0
  24. data/samples/standard/sample-default.html +476 -0
  25. data/samples/standard/sample-din.adoc +22 -0
  26. data/samples/standard/sample-din.html +476 -0
  27. data/samples/standard/sample-ieee.adoc +22 -0
  28. data/samples/standard/sample-ieee.html +476 -0
  29. data/samples/tex/biblio.bib +31 -0
  30. data/samples/{sample-authoryear.adoc → tex/sample-authoryear.adoc} +2 -3
  31. data/samples/{sample-authoryear.html → tex/sample-authoryear.html} +9 -6
  32. data/samples/tex/sample-din.adoc +74 -0
  33. data/samples/tex/sample-din.html +556 -0
  34. data/samples/{sample-numbers.adoc → tex/sample-numbers.adoc} +4 -0
  35. data/samples/{sample-numbers.html → tex/sample-numbers.html} +14 -8
  36. data/samples/tex/sample-ordering.adoc +20 -0
  37. data/samples/tex/sample-ordering.html +467 -0
  38. data/spec/citation_item_spec.rb +52 -0
  39. data/spec/database_spec.rb +39 -0
  40. data/spec/fixtures/database.bib +31 -0
  41. data/spec/fixtures/database.bibtex +6 -0
  42. data/spec/fixtures/database.unk +0 -0
  43. data/spec/throwaway_spec.rb +6 -0
  44. metadata +61 -25
  45. data/deprecated/asciidoctor-bibliography/asciidoctor/bibliographer_postprocessor.rb +0 -23
  46. data/deprecated/asciidoctor-bibliography/asciidoctor/bibliography_block_macro.rb +0 -77
  47. data/deprecated/asciidoctor-bibliography/asciidoctor/citation_processor.rb +0 -144
  48. data/deprecated/asciidoctor-bibliography/asciidoctor/cite_inline_macro.rb +0 -30
  49. data/deprecated/asciidoctor-bibliography/citationdata.rb +0 -23
  50. data/deprecated/asciidoctor-bibliography/citations.rb +0 -45
  51. data/deprecated/asciidoctor-bibliography/citationutils.rb +0 -67
  52. data/deprecated/asciidoctor-bibliography/extensions.rb +0 -64
  53. data/deprecated/asciidoctor-bibliography/filehandlers.rb +0 -32
  54. data/deprecated/asciidoctor-bibliography/index.rb +0 -31
  55. data/deprecated/asciidoctor-bibliography/processor.rb +0 -208
  56. data/deprecated/asciidoctor-bibliography/processorutils.rb +0 -34
  57. 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
-