citeproc-ruby 1.1.10 → 1.1.14
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/.github/workflows/ci.yml +27 -0
- data/BSDL +1 -1
- data/Gemfile +0 -1
- data/README.md +5 -6
- data/Rakefile +0 -8
- data/cucumber.yml +1 -1
- data/lib/citeproc/ruby.rb +1 -0
- data/lib/citeproc/ruby/format.rb +1 -1
- data/lib/citeproc/ruby/formats/html.rb +2 -0
- data/lib/citeproc/ruby/formats/latex.rb +136 -0
- data/lib/citeproc/ruby/renderer/format.rb +1 -0
- data/lib/citeproc/ruby/renderer/state.rb +1 -0
- data/lib/citeproc/ruby/version.rb +1 -1
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f885d244ee289274bb2700d93d79cd89a119af0c321c47c51a7d88b35ec939f
|
4
|
+
data.tar.gz: 37b23e801ccb908fd9f21e3d51ebf4a2192c1ffd9c6bb6913d84ca595d5f762d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83caf56e7dbe0b966a8fc52f403510ab49fdd1e4e94b71194b5ed22669b8262b1ef9f7349f4a1ff2ee2b2ec22ce8582b5f8711d234095b75180e80824c9088b1
|
7
|
+
data.tar.gz: 5fa630c2ffaafbded4fa551faaefb7d0731a4a1240f0716510074e626618f1fa1a91b7537b52bad1351ab29f5346c4e6de5804beeabec4692e469c3bae7863bd
|
@@ -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/BSDL
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
CiteProc-Ruby. A Ruby CSL cite processor.
|
2
2
|
|
3
3
|
Copyright 2012 President and Fellows of Harvard College.
|
4
|
-
Copyright 2009-
|
4
|
+
Copyright 2009-2020 Sylvester Keil. All rights reserved.
|
5
5
|
|
6
6
|
Redistribution and use in source and binary forms, with or without
|
7
7
|
modification, are permitted provided that the following conditions are met:
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -6,11 +6,6 @@ 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
|
-
[](http://travis-ci.org/inukshuk/citeproc-ruby)
|
10
|
-
[](https://coveralls.io/github/inukshuk/citeproc-ruby?branch=master)
|
11
|
-
[](https://gemnasium.com/github.com/inukshuk/citeproc-ruby)
|
12
|
-
[](https://codeclimate.com/github/inukshuk/citeproc-ruby)
|
13
|
-
|
14
9
|
Quickstart
|
15
10
|
----------
|
16
11
|
Install CiteProc-Ruby and all official CSL styles (optional).
|
@@ -76,6 +71,10 @@ Start rendering you references with any CSL style!
|
|
76
71
|
# You can also render citations on the fly.
|
77
72
|
cp.render :citation, id: 'knuth', locator: '23'
|
78
73
|
#-> (Knuth, 1968, p. 23)
|
74
|
+
|
75
|
+
# Pass an array if you want to render multiple citations:
|
76
|
+
cp.render :citation, [{ id: 'knuth' }, { id: 'perez' }]
|
77
|
+
#-> (Knuth, 1968; Perez, 1989)
|
79
78
|
|
80
79
|
Documentation
|
81
80
|
-------------
|
@@ -147,7 +146,7 @@ this project as part of [Google Summer of Code](https://developers.google.com/op
|
|
147
146
|
|
148
147
|
Copyright
|
149
148
|
---------
|
150
|
-
Copyright 2009-
|
149
|
+
Copyright 2009-2020 Sylvester Keil. All rights reserved.
|
151
150
|
|
152
151
|
Copyright 2012 President and Fellows of Harvard College.
|
153
152
|
|
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
|
data/lib/citeproc/ruby.rb
CHANGED
data/lib/citeproc/ruby/format.rb
CHANGED
@@ -198,7 +198,7 @@ module CiteProc
|
|
198
198
|
end
|
199
199
|
|
200
200
|
def split_closing_quotes(string)
|
201
|
-
string.split(/(
|
201
|
+
string.split(/((#{Regexp.quote(close_inner_quote)}|#{Regexp.quote(close_quote)})+)$/, 2)
|
202
202
|
end
|
203
203
|
|
204
204
|
def apply_quotes
|
@@ -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
|
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.
|
4
|
+
version: 1.1.14
|
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:
|
11
|
+
date: 2021-08-06 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.
|
39
|
+
version: '1.6'
|
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.
|
46
|
+
version: '1.6'
|
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,9 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
106
|
- !ruby/object:Gem::Version
|
104
107
|
version: '0'
|
105
108
|
requirements: []
|
106
|
-
|
107
|
-
|
108
|
-
signing_key:
|
109
|
+
rubygems_version: 3.2.15
|
110
|
+
signing_key:
|
109
111
|
specification_version: 4
|
110
112
|
summary: A Citation Style Language (CSL) cite processor
|
111
113
|
test_files: []
|