The mn2pdf Ruby gem is a wrapper around the Java mn2pdf which converts Metanorma XML files into native PDFs.
This gem is used to provide mn2pdf.jar with mirrored version numbers, to allow Ruby code to easily refer to the desired mn2pdf version as dependencies.
require 'mn2pdf'
Mn2pdf.convert(sample_xml_path, output_pdf_path, sample_xsl_path, options = "")The options are any options trailing in the mn2pdf Java executable, e.g. --split-by-language.
Update lib/mn2pdf/version.rb to the desired version of mn2pdf.
Run rake to download the bin/mn2pdf.jar file:
rm -f bin/mn2pdf.jar
rake bin/mn2pdf.jarThen release the gem with rake release.
The gem version (VERSION) can be more granular than the mn2pdf JAR version (MN2PDF_JAR_VERSION) because the Ruby wrapper may need API changes that don’t require a new JAR.
-
When
VERSION == MN2PDF_JAR_VERSION: a synchronized release, both update together -
When
VERSIONis a patch release (e.g., 2.50.1) butMN2PDF_JAR_VERSIONis 2.50: the Ruby API changed but no new JAR is needed
The release-tag.yml workflow handles this automatically when triggered by the mn2pdf Java repository.