mn2pdf 1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/README.adoc +35 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/mn2pdf.jar +0 -0
- data/bin/setup +8 -0
- data/lib/mn2pdf.rb +30 -0
- data/lib/mn2pdf/version.rb +3 -0
- data/mn2pdf.gemspec +33 -0
- metadata +58 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b44dde46852820cf8428e717b878bffa76da13af2b209d4921b6ccfcc4549fae
|
4
|
+
data.tar.gz: 55bb26f971af7e1d5f3806e014afacb9d991308bd320daa6f00c71f01b218ffa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 74a9e91c7a5ae740ec3e1bf7cdec5e0bde5fff881020147a3b0d0b5cd58e49ec9297428e3d22dde84b5aec5abd15a2a9d14ccba86a99e9d43428af09da3b737d
|
7
|
+
data.tar.gz: 10eead98d1f6b838f414d8da6b04e4ae81ff5287b1f7df4e70f606cbaf85c8074af5865315d508c65f96555c8d5280676152bdf503b9e9bc123f23ce2ddc3806
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at ronald.tse@ribose.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/README.adoc
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
= mn2pdf Ruby gem
|
2
|
+
|
3
|
+
image:https://img.shields.io/gem/v/metanorma.svg["Gem Version", link="https://rubygems.org/gems/metanorma"]
|
4
|
+
image:https://github.com/metanorma/mn2pdf-ruby/workflows/ubuntu/badge.svg["Ubuntu Build Status", link="https://github.com/metanorma/mn2pdf-ruby/actions?query=workflow%3Aubuntu"]
|
5
|
+
image:https://github.com/metanorma/mn2pdf-ruby/workflows/macos/badge.svg["OSX Build Status", link="https://github.com/metanorma/mn2pdf-ruby/actions?query=workflow%3Amacos"]
|
6
|
+
image:https://github.com/metanorma/mn2pdf-ruby/workflows/windows/badge.svg["Windows Build Status", link="https://github.com/metanorma/mn2pdf-ruby/actions?query=workflow%3Awindows"]
|
7
|
+
image:https://codeclimate.com/github/metanorma/mn2pdf-ruby/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/mn2pdf-ruby"]
|
8
|
+
image:https://img.shields.io/github/issues-pr-raw/metanorma/mn2pdf-ruby.svg["Pull Requests", link="https://github.com/metanorma/mn2pdf-ruby/pulls"]
|
9
|
+
image:https://img.shields.io/github/commits-since/metanorma/mn2pdf-ruby/latest.svg["Commits since latest",link="https://github.com/metanorma/mn2pdf-ruby/releases"]
|
10
|
+
|
11
|
+
== Purpose
|
12
|
+
|
13
|
+
The mn2pdf Ruby gem is a wrapper around the Java https://github.com/metanorma/mn2pdf[mn2pdf]
|
14
|
+
which converts Metanorma XML files into native PDFs.
|
15
|
+
|
16
|
+
This gem is used to provide mn2pdf.jar with mirrored version numbers, to allow
|
17
|
+
Ruby code to easily refer to the desired mn2pdf version as dependencies.
|
18
|
+
|
19
|
+
== Installation
|
20
|
+
|
21
|
+
[source,ruby]
|
22
|
+
----
|
23
|
+
gem install mn2pdf
|
24
|
+
----
|
25
|
+
|
26
|
+
Or include it in your gemspec.
|
27
|
+
|
28
|
+
== Usage
|
29
|
+
|
30
|
+
[source,ruby]
|
31
|
+
----
|
32
|
+
require 'mn2pdf'
|
33
|
+
Mn2pdf.convert(sample_xml_path, output_pdf_path, sample_xsl_path)
|
34
|
+
----
|
35
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "mn2pdf"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/mn2pdf.jar
ADDED
Binary file
|
data/bin/setup
ADDED
data/lib/mn2pdf.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "open3"
|
2
|
+
require "mn2pdf/version"
|
3
|
+
|
4
|
+
module Mn2pdf
|
5
|
+
MN2PDF_JAR_PATH = File.join(File.dirname(__FILE__), "../bin/mn2pdf.jar")
|
6
|
+
|
7
|
+
def self.help
|
8
|
+
cmd = ["java", "-jar", MN2PDF_JAR_PATH].join(" ")
|
9
|
+
message, error_str, status = Open3.capture3(cmd)
|
10
|
+
|
11
|
+
message
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.convert(url_path, output_path, xsl_stylesheet)
|
15
|
+
return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil?
|
16
|
+
|
17
|
+
puts MN2PDF_JAR_PATH
|
18
|
+
cmd = ["java", "-Xss5m", "-Xmx1024m", "-jar", MN2PDF_JAR_PATH, "--xml-file",
|
19
|
+
url_path, "--xsl-file", xsl_stylesheet, "--pdf-file",
|
20
|
+
output_path].join(" ")
|
21
|
+
|
22
|
+
puts cmd
|
23
|
+
_, error_str, status = Open3.capture3(cmd)
|
24
|
+
|
25
|
+
unless status.success?
|
26
|
+
raise error_str
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/mn2pdf.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative 'lib/mn2pdf/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "mn2pdf"
|
5
|
+
spec.version = Mn2pdf::VERSION
|
6
|
+
spec.authors = ["Ribose Inc."]
|
7
|
+
spec.email = ["open.source@ribose.com"]
|
8
|
+
|
9
|
+
spec.summary = "mn2pdf converts Metanorma XML into PDF."
|
10
|
+
spec.description = <<~DESCRIPTION
|
11
|
+
mn2pdf converts Metanorma XML into PDF.
|
12
|
+
This gem is a wrapper around mn2pdf.jar available from
|
13
|
+
https://github.com/metanorma/mn2pdf, with versions matching the JAR file.
|
14
|
+
DESCRIPTION
|
15
|
+
|
16
|
+
spec.homepage = "https://github.com/metanorma/mn2pdf-ruby"
|
17
|
+
spec.license = "BSD-2-Clause"
|
18
|
+
|
19
|
+
spec.bindir = "bin"
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
spec.files = `git ls-files`.split("\n")
|
22
|
+
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
23
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
24
|
+
|
25
|
+
# Specify which files should be added to the gem when it is released.
|
26
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
28
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mn2pdf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.11'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ribose Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-02 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |
|
14
|
+
mn2pdf converts Metanorma XML into PDF.
|
15
|
+
This gem is a wrapper around mn2pdf.jar available from
|
16
|
+
https://github.com/metanorma/mn2pdf, with versions matching the JAR file.
|
17
|
+
email:
|
18
|
+
- open.source@ribose.com
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- ".gitignore"
|
24
|
+
- ".rspec"
|
25
|
+
- CODE_OF_CONDUCT.md
|
26
|
+
- Gemfile
|
27
|
+
- README.adoc
|
28
|
+
- Rakefile
|
29
|
+
- bin/console
|
30
|
+
- bin/mn2pdf.jar
|
31
|
+
- bin/setup
|
32
|
+
- lib/mn2pdf.rb
|
33
|
+
- lib/mn2pdf/version.rb
|
34
|
+
- mn2pdf.gemspec
|
35
|
+
homepage: https://github.com/metanorma/mn2pdf-ruby
|
36
|
+
licenses:
|
37
|
+
- BSD-2-Clause
|
38
|
+
metadata: {}
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.4.0
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubygems_version: 3.0.3
|
55
|
+
signing_key:
|
56
|
+
specification_version: 4
|
57
|
+
summary: mn2pdf converts Metanorma XML into PDF.
|
58
|
+
test_files: []
|