citeproc-ruby 1.1.11 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc9a3e8d561ec467452e803f9781681b1f8dc8256d5b3988de6c2241731e4237
4
- data.tar.gz: 85c1299b18260716902c6fac5becac9187640d0636bc854d731b615256618d3a
3
+ metadata.gz: d9f9a8160c37669047e06dbeb5659056f96da25971415f2137aba6dd897f2b36
4
+ data.tar.gz: 5b896f34ed9b437a08e7fe00fa0b1de64d8f7195a83f1d53591512411be46a83
5
5
  SHA512:
6
- metadata.gz: d9949d9d910c903a47151312c4ff25ee4a6d7e4f84ec39dbe64bd488a94930851461dc6a099a398dbe8bc377c17073644c02752a1b91fc23409f4f189b3a48c5
7
- data.tar.gz: b855d066b7b75b9f6b729d789bd598e3fd09ab179b483a1847b7ba34b456269fc294629f4b0658f73a78bcda4372448a0c025f344b7b2e351b1394ac8af08dd6
6
+ metadata.gz: f65a5e51302e839f5ec13ba8a5a2fd743127305a70a1f94c4cfbc457157ba3eb3382e883475a710f04abad8f18f11296713c4b5c7235271fb2f31b9297e8dc15
7
+ data.tar.gz: 3fc95092334d3f3a10bb6e626d98c4d6e4d4fdd875c95cb6189b7394d65a61b0ca6d2ab367cced0cfb78c93c38920562706c727c5a8d263c1e4dfbeb2ef6e0af
@@ -0,0 +1,27 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ pull_request:
7
+ branches:
8
+ - master
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ env:
13
+ RUBYOPT: W2
14
+ BUNDLE_WITHOUT: debug:extra
15
+ strategy:
16
+ matrix:
17
+ ruby-version:
18
+ - 3.0
19
+ - 2.7
20
+ - 2.6
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby-version }}
26
+ bundler-cache: true
27
+ - run: bundle exec rake
data/Gemfile CHANGED
@@ -29,5 +29,4 @@ end
29
29
 
30
30
  group :coverage do
31
31
  gem 'simplecov', require: false
32
- gem 'coveralls', require: false if ENV['CI']
33
32
  end
data/README.md CHANGED
@@ -1,15 +1,11 @@
1
1
  CiteProc-Ruby
2
2
  =============
3
3
  CiteProc-Ruby is a [Citation Style Language](http://citationstyles.org/) (CSL)
4
- 1.0.1 cite processor written in pure Ruby. This Ruby gem contains the
4
+ 1.0.2 cite processor written in pure Ruby. This Ruby gem contains the
5
5
  processor's rendering engine only; for more documentation on the whole
6
6
  cite processor, please refer to the documentation of the
7
7
  [citeproc](https://rubygems.org/gems/citeproc) gem instead.
8
8
 
9
- [![Build Status](https://secure.travis-ci.org/inukshuk/citeproc-ruby.png)](http://travis-ci.org/inukshuk/citeproc-ruby)
10
- [![Coverage Status](https://coveralls.io/repos/github/inukshuk/citeproc-ruby/badge.svg?branch=master)](https://coveralls.io/github/inukshuk/citeproc-ruby?branch=master)
11
- [![Code Climate](https://codeclimate.com/github/inukshuk/citeproc-ruby/badges/gpa.svg)](https://codeclimate.com/github/inukshuk/citeproc-ruby)
12
-
13
9
  Quickstart
14
10
  ----------
15
11
  Install CiteProc-Ruby and all official CSL styles (optional).
data/Rakefile CHANGED
@@ -39,14 +39,6 @@ Cucumber::Rake::Task.new(:cucumber) do |t|
39
39
  t.profile = 'default'
40
40
  end
41
41
 
42
- begin
43
- require 'coveralls/rake/task'
44
- Coveralls::RakeTask.new
45
- task :test_with_coveralls => [:spec, :cucumber, 'coveralls:push']
46
- rescue LoadError => e
47
- # ignore
48
- end
49
-
50
42
  task :release do |t|
51
43
  system "gem build citeproc-ruby.gemspec"
52
44
  system "git tag #{CiteProc::Ruby::VERSION}"
data/cucumber.yml CHANGED
@@ -1 +1 @@
1
- default: --format progress --require features --color
1
+ default: --format progress --require features --color --publish-quiet
@@ -198,7 +198,7 @@ module CiteProc
198
198
  end
199
199
 
200
200
  def split_closing_quotes(string)
201
- string.split(/([#{close_inner_quote}#{close_quote}]+)$/, 2)
201
+ string.split(/((#{Regexp.quote(close_inner_quote)}|#{Regexp.quote(close_quote)})+)$/, 2)
202
202
  end
203
203
 
204
204
  def apply_quotes
@@ -36,6 +36,8 @@ module CiteProc
36
36
  else
37
37
  @config = Html.defaults.merge(config)
38
38
  end
39
+
40
+ @css = nil
39
41
  end
40
42
 
41
43
  def bibliography(bibliography)
@@ -0,0 +1,136 @@
1
+ module CiteProc
2
+ module Ruby
3
+ module Formats
4
+
5
+ class Latex < Format
6
+
7
+ @defaults = {
8
+ :italic => 'emph', # em
9
+ :bold => 'textbf', # strong
10
+ :container => '', # inner container
11
+ :display => '' # display container
12
+ }
13
+
14
+ @vertical_align = Hash.new { |_,k| k }
15
+ @vertical_align['sup'] = 'super'
16
+
17
+ class << self
18
+ attr_reader :defaults
19
+ end
20
+
21
+ attr_reader :config
22
+
23
+ def initialize(config = nil)
24
+ if config.nil?
25
+ @config = Latex.defaults.dup
26
+ else
27
+ @config = Latex.defaults.merge(config)
28
+ end
29
+ end
30
+
31
+ def bibliography(bibliography)
32
+ bibliography.header = "\\begin{enumerate}"
33
+ bibliography.footer = "\\end{enumerate}"
34
+
35
+ bibliography.prefix = "\\item "
36
+ bibliography.suffix = ""
37
+
38
+ bibliography.connector = "\n"
39
+ bibliography
40
+ end
41
+
42
+ def apply_font_style
43
+ if options[:'font-style'] == 'italic'
44
+ output.replace content_tag(config[:italic], output)
45
+ end
46
+ end
47
+
48
+ def apply_font_variant
49
+ end
50
+
51
+ def apply_font_weight
52
+ if options[:'font-weight'] == 'bold'
53
+ output.replace content_tag(config[:bold], output)
54
+ end
55
+ end
56
+
57
+ def apply_text_decoration
58
+ end
59
+
60
+ def apply_vertical_align
61
+ end
62
+
63
+ def apply_display
64
+ output.replace(
65
+ content_tag(config[:display], output)
66
+ )
67
+ end
68
+
69
+ def escape_quotes?
70
+ false
71
+ end
72
+
73
+ protected
74
+
75
+ def finalize!
76
+ # TODO find a better solution for this (strip tags?)
77
+ # For now make sure not to double encode entities
78
+ # by matching spaces before or after.
79
+ output.gsub!(/[$&#^_%~]/) do |c|
80
+ case c
81
+ # TODO: when "\\" then '\backslash{}'
82
+ when "^" then '\^{}'
83
+ when '~' then '\~{}'
84
+ else "\\#{c}"
85
+ end
86
+ end
87
+ end
88
+
89
+ def cleanup!
90
+ super
91
+ end
92
+
93
+ private
94
+
95
+ def content_tag(name, content, options = nil)
96
+ opening_tag(name, options) << content << closing_tag(name)
97
+ end
98
+
99
+ def style_for(options)
100
+ return unless options && !options.empty?
101
+ options.map { |*kv| kv.join(': ') }.join('; ')
102
+ end
103
+
104
+ def attribute_assignments(options)
105
+ return unless options
106
+
107
+ options = options.select { |_, v| !v.nil? }
108
+
109
+ return unless !options.empty?
110
+
111
+ ' ' << options.map { |k, v| [k, v.inspect].join('=') }.join(' ')
112
+ end
113
+
114
+ def opening_tag(name, options = nil)
115
+ if options && options.key?('style')
116
+ options['style'] = style_for(options['style'])
117
+ end
118
+
119
+ if name == ''
120
+ ''
121
+ else
122
+ "\\#{name}{"
123
+ end
124
+ end
125
+
126
+ def closing_tag(name)
127
+ if name == ''
128
+ ''
129
+ else
130
+ '}'
131
+ end
132
+ end
133
+ end
134
+ end
135
+ end
136
+ end
@@ -32,6 +32,7 @@ module CiteProc
32
32
 
33
33
  def initialize
34
34
  @history, @authors = History.new(self, 3), []
35
+ reset
35
36
  end
36
37
 
37
38
  def store!(item, node)
@@ -1,5 +1,5 @@
1
1
  module CiteProc
2
2
  module Ruby
3
- VERSION = '1.1.11'
3
+ VERSION = '2.0.0'
4
4
  end
5
5
  end
data/lib/citeproc/ruby.rb CHANGED
@@ -9,6 +9,7 @@ require 'citeproc/ruby/format'
9
9
 
10
10
  require 'citeproc/ruby/formats/default'
11
11
  require 'citeproc/ruby/formats/html'
12
+ require 'citeproc/ruby/formats/latex'
12
13
 
13
14
  require 'citeproc/ruby/renderer'
14
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citeproc-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.11
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-20 00:00:00.000000000 Z
11
+ date: 2022-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: citeproc
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '1.5'
39
+ version: '2.0'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.5'
46
+ version: '2.0'
47
47
  description: |
48
48
  CiteProc-Ruby is a Citation Style Language (CSL) 1.0.1 compatible cite
49
49
  processor implementation written in pure Ruby.
@@ -55,6 +55,7 @@ extra_rdoc_files: []
55
55
  files:
56
56
  - ".codeclimate.yml"
57
57
  - ".document"
58
+ - ".github/workflows/ci.yml"
58
59
  - ".yardopts"
59
60
  - AGPL
60
61
  - BSDL
@@ -67,6 +68,7 @@ files:
67
68
  - lib/citeproc/ruby/format.rb
68
69
  - lib/citeproc/ruby/formats/default.rb
69
70
  - lib/citeproc/ruby/formats/html.rb
71
+ - lib/citeproc/ruby/formats/latex.rb
70
72
  - lib/citeproc/ruby/renderer.rb
71
73
  - lib/citeproc/ruby/renderer/choose.rb
72
74
  - lib/citeproc/ruby/renderer/date.rb
@@ -87,8 +89,9 @@ files:
87
89
  homepage: https://github.com/inukshuk/citeproc-ruby
88
90
  licenses:
89
91
  - AGPL-3.0
92
+ - BSD-2-Clause
90
93
  metadata: {}
91
- post_install_message:
94
+ post_install_message:
92
95
  rdoc_options: []
93
96
  require_paths:
94
97
  - lib
@@ -103,8 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
106
  - !ruby/object:Gem::Version
104
107
  version: '0'
105
108
  requirements: []
106
- rubygems_version: 3.1.2
107
- signing_key:
109
+ rubygems_version: 3.2.15
110
+ signing_key:
108
111
  specification_version: 4
109
112
  summary: A Citation Style Language (CSL) cite processor
110
113
  test_files: []