yaml-converter 0.2.6 → 0.2.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d525ae6ed455103d46fe7775a861b5c5708b67bcdf84a5291f9a7ff829185ee
4
- data.tar.gz: 6a32719036afe677785e76a0a6a23eadd538ec16cbeb362f1e08f4233837c9d6
3
+ metadata.gz: b44a9bc7b2537efdfcbeb5b12b893b789a555c5d4b5910873840f90fdb53eba7
4
+ data.tar.gz: 6fc8e768b9865a8b344e56a29882bd67dc8f2119a02080fbbde560ce0f67e49e
5
5
  SHA512:
6
- metadata.gz: 38c715ce43f9acee52b0eebb4ffb2b699afed8975e582137e414aa69fd5a39197cddcc49cc4c7b87fdbf42b3ee731f892834f68f900239cd2dc49f63c1548fdc
7
- data.tar.gz: d21a9b9264cd1be6a26ae329d2c23ac2bbc43c864a21f6f6bc0da30c1e8e255524548fb9a733b8655e018a03601b8419fbc615aada6f125d700c8268d88a4e27
6
+ metadata.gz: d12028c2a102713e203c9bd06032f365776dcdf5e21fbb08bfc73d91fb553c0fee46bf19ebd00e597abd459c1b6cd74f6440f66e95322cfbb9bb7f83f73c8ebf
7
+ data.tar.gz: 720caa47609990e9fe8e16ab6c180252ff8160c44d264ed69f693cf931745ca573274d2b3532fa60b771fae44aff29d1cba36605cdbf73cbeef07dc2d18eb0bc
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,55 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [0.2.8] - 2026-11-15
34
+
35
+ - TAG: [v0.2.8][0.2.8t]
36
+ - COVERAGE: 92.49% -- 419/453 lines in 10 files
37
+ - BRANCH COVERAGE: 67.28% -- 109/162 branches in 10 files
38
+ - 73.44% documented
39
+
40
+ ### Changed
41
+
42
+ - [kc] kettle-jem/prepare: updated 45 project files:
43
+ - configuration (2)
44
+ - dependencies (43)
45
+ - [kc] kettle-jem/template: updated 55 project files:
46
+ - code and tests (6)
47
+ - dependencies (8)
48
+ - documentation (4)
49
+ - other (9)
50
+ - workflows (28)
51
+
52
+ ### Fixed
53
+
54
+ - Preserve YAML and notes across PDF pages using HexaPDF Composer, including two-column layouts.
55
+
56
+ ## [0.2.7] - 2026-10-01
57
+
58
+ - TAG: [v0.2.7][0.2.7t]
59
+ - COVERAGE: 92.69% -- 444/479 lines in 10 files
60
+ - BRANCH COVERAGE: 68.42% -- 117/171 branches in 10 files
61
+ - 66.67% documented
62
+
63
+ ### Added
64
+
65
+ - kettle-jem-template-20260913-001 - Templating now also surfaces a review
66
+ entry in `dependency_conflicts.resolve` when a direct development
67
+ dependency doesn't support one or more of this project's declared
68
+ `engines:` and has no template-managed modular home (e.g. `sqlite3` on
69
+ `jruby`). Review each entry and pick a resolution per the project's own
70
+ engine support needs.
71
+
72
+ ### Changed
73
+
74
+ - [kc] kettle-jem/prepare: updated 19 project files:
75
+ - dependencies (19)
76
+ - [kc] kettle-jem/template: updated 44 project files:
77
+ - code and tests (3)
78
+ - dependencies (2)
79
+ - other (3)
80
+ - workflows (36)
81
+
33
82
  ## [0.2.6] - 2026-09-11
34
83
 
35
84
  - TAG: [v0.2.6][0.2.6t]
@@ -234,7 +283,11 @@ Please file a bug if you notice a violation of semantic versioning.
234
283
 
235
284
  ### Security
236
285
 
237
- [Unreleased]: https://github.com/galtzo-floss/yaml-converter/compare/v0.2.6...HEAD
286
+ [Unreleased]: https://github.com/galtzo-floss/yaml-converter/compare/v0.2.8...HEAD
287
+ [0.2.8]: https://github.com/galtzo-floss/yaml-converter/compare/v0.2.7...v0.2.8
288
+ [0.2.8t]: https://github.com/galtzo-floss/yaml-converter/releases/tag/v0.2.8
289
+ [0.2.7]: https://github.com/galtzo-floss/yaml-converter/compare/v0.2.6...v0.2.7
290
+ [0.2.7t]: https://github.com/galtzo-floss/yaml-converter/releases/tag/v0.2.7
238
291
  [0.2.6]: https://github.com/galtzo-floss/yaml-converter/compare/v0.2.5...v0.2.6
239
292
  [0.2.6t]: https://github.com/galtzo-floss/yaml-converter/releases/tag/v0.2.6
240
293
  [0.2.5]: https://github.com/galtzo-floss/yaml-converter/compare/v0.2.4...v0.2.5
data/README.md CHANGED
@@ -43,7 +43,7 @@ Alternatives (none in Ruby, send a PR if you know of one):
43
43
  | Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
44
44
  |-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
45
45
  | Works with JRuby | [![JRuby 10.0 Compat][💎jruby-10.0i]][🚎jruby-10.0-wf] [![JRuby current Compat][💎jruby-c-i]][🚎10-j-wf] [![JRuby HEAD Compat][💎jruby-headi]][🚎3-hd-wf]|
46
- | Works with Truffle Ruby | [![Truffle Ruby 24.2 Compat][💎truby-24.2i]][🚎truby-24.2-wf] [![Truffle Ruby 25.0 Compat][💎truby-25.0i]][🚎truby-25.0-wf] [![Truffle Ruby 33.0 Compat][💎truby-33.0i]][🚎truby-33.0-wf] [![Truffle Ruby current Compat][💎truby-c-i]][🚎9-t-wf] [![Truffle Ruby HEAD Compat][💎truby-headi]][🚎3-hd-wf]|
46
+ | Works with Truffle Ruby | [![Truffle Ruby 33.0 Compat][💎truby-33.0i]][🚎truby-33.0-wf] [![Truffle Ruby current Compat][💎truby-c-i]][🚎9-t-wf]|
47
47
  | Works with MRI Ruby 4 | [![Ruby current Compat][💎ruby-c-i]][🚎11-c-wf] [![Ruby HEAD Compat][💎ruby-headi]][🚎3-hd-wf]|
48
48
  | Works with MRI Ruby 3 | [![Ruby 3.2 Compat][💎ruby-3.2i]][🚎ruby-3.2-wf] [![Ruby 3.3 Compat][💎ruby-3.3i]][🚎ruby-3.3-wf] [![Ruby 3.4 Compat][💎ruby-3.4i]][🚎ruby-3.4-wf]|
49
49
  | Support & Community | [![Join Me on Daily.dev's RubyFriends][✉️ruby-friends-img]][✉️ruby-friends] [![Get help from RubyForum][✉️ruby-forum-img]][✉️ruby-forum] [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork] [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor] |
@@ -56,11 +56,12 @@ Alternatives (none in Ruby, send a PR if you know of one):
56
56
 
57
57
  ### Compatibility
58
58
 
59
- Compatible with MRI Ruby 3.2.0+, JRuby, and TruffleRuby.
59
+ The gem's declared runtime compatibility floor is MRI Ruby 3.2.0+, with concordant releases of JRuby and TruffleRuby.
60
60
  CI workflows and Appraisals are generated for MRI Ruby 3.2.0+.
61
- This test floor is configured by `ruby.test_minimum` in `.kettle-jem.yml` and
62
- may be higher than the gem's runtime compatibility floor when legacy Rubies are
63
- not practical for the current toolchain.
61
+ The current MRI CI lane runs on Linux and macOS.
62
+ The test floor is configured by `ruby.test_minimum` in `.kettle-jem.yml`.
63
+ When it is higher than the runtime floor, older runtime-compatible Rubies are
64
+ not covered by the generated CI or Appraisal matrix.
64
65
 
65
66
  <a href="https://github.com/kettle-dev"><img alt="kettle-dev Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/kettle-dev/avatar-128px.svg" width="14%" align="right"/></a>
66
67
 
@@ -97,29 +98,12 @@ The _amazing_ test matrix is powered by the kettle-dev stack.
97
98
 
98
99
  ### Enterprise Support
99
100
 
100
- [![Tidelift](https://tidelift.com/badges/package/rubygems/yaml-converter)](https://tidelift.com/subscription/pkg/rubygems-yaml-converter?utm_source=rubygems-yaml-converter&utm_medium=referral&utm_campaign=readme)
101
+ For enterprise support from the maintainer, use [Upwork][👨🏼‍🏫expsup-upwork] or [CodeMentor][👨🏼‍🏫expsup-codementor].
101
102
 
102
- Available as part of the Tidelift Subscription.
103
-
104
- <details markdown="1">
105
- <summary>Need enterprise-level guarantees?</summary>
106
-
107
- The maintainers of this and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
108
-
109
- [![Get help from me on Tidelift][🏙️entsup-tidelift-img]][🏙️entsup-tidelift]
110
-
111
- - 💡Subscribe for support guarantees covering _all_ your FLOSS dependencies
112
- - 💡Tidelift is part of [Sonar][🏙️entsup-tidelift-sonar]
113
- - 💡Tidelift pays maintainers to maintain the software you depend on!<br/>📊`@`Pointy Haired Boss: An [enterprise support][🏙️entsup-tidelift] subscription is "[never gonna let you down][🧮kloc]", and *supports* open source maintainers
114
-
115
- Alternatively:
103
+ Other support channels:
116
104
 
117
105
  - [![Ruby Users Forum][✉️ruby-forum-img]][✉️ruby-forum]
118
106
  - [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]
119
- - [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork]
120
- - [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor]
121
-
122
- </details>
123
107
 
124
108
  ## ✨ Installation
125
109
 
@@ -395,19 +379,18 @@ We welcome both individual and corporate sponsors! We also offer a
395
379
  wide array of funding channels to account for your preferences.
396
380
  Currently, [Open Collective][🖇osc] is our preferred funding platform.
397
381
 
382
+ ### Corporate Sponsorship
383
+
398
384
  **If you're working in a company that's making significant use of galtzo-floss tools we'd
399
385
  appreciate it if you suggest to your company to become a galtzo-floss sponsor.**
400
386
 
387
+ ### Individual Support
388
+
401
389
  You can support the development of galtzo-floss tools via
402
390
  [GitHub Sponsors][🖇sponsor],
403
391
  [Liberapay][⛳liberapay],
404
- [PayPal][🖇paypal],
405
- [Open Collective][🖇osc]
406
- and [Tidelift][🏙️entsup-tidelift].
407
-
408
- | 📍 NOTE |
409
- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
410
- | If doing a sponsorship in the form of donation is problematic for your company <br/> from an accounting standpoint, we'd recommend the use of Tidelift, <br/> where you can get a support-like subscription instead. |
392
+ [Open Collective][🖇osc],
393
+ and [PayPal][🖇paypal].
411
394
 
412
395
  ### Open Collective for Individuals
413
396
 
@@ -622,9 +605,6 @@ Thanks for RTFM. ☺️
622
605
  [👨🏼‍🏫expsup-upwork-img]: https://img.shields.io/badge/UpWork-13544E?style=for-the-badge&logo=Upwork&logoColor=white
623
606
  [👨🏼‍🏫expsup-codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
624
607
  [👨🏼‍🏫expsup-codementor-img]: https://img.shields.io/badge/CodeMentor-Get_Help-1abc9c?style=for-the-badge&logo=CodeMentor&logoColor=white
625
- [🏙️entsup-tidelift]: https://tidelift.com/subscription/pkg/rubygems-yaml-converter?utm_source=rubygems-yaml-converter&utm_medium=referral&utm_campaign=readme
626
- [🏙️entsup-tidelift-img]: https://img.shields.io/badge/Tidelift_and_Sonar-Enterprise_Support-FD3456?style=for-the-badge&logo=sonar&logoColor=white
627
- [🏙️entsup-tidelift-sonar]: https://blog.tidelift.com/tidelift-joins-sonar
628
608
  [💁🏼‍♂️peterboling]: http://www.peterboling.com
629
609
  [🚂railsbling]: http://www.railsbling.com
630
610
  [📜src-gl-img]: https://img.shields.io/badge/GitLab-FBA326?style=for-the-badge&logo=Gitlab&logoColor=orange
@@ -655,8 +635,6 @@ Thanks for RTFM. ☺️
655
635
  [🚎ruby-3.3-wf]: https://github.com/galtzo-floss/yaml-converter/actions/workflows/ruby-3.3.yml
656
636
  [🚎ruby-3.4-wf]: https://github.com/galtzo-floss/yaml-converter/actions/workflows/ruby-3.4.yml
657
637
  [🚎jruby-10.0-wf]: https://github.com/galtzo-floss/yaml-converter/actions/workflows/jruby-10.0.yml
658
- [🚎truby-24.2-wf]: https://github.com/galtzo-floss/yaml-converter/actions/workflows/truffleruby-24.2.yml
659
- [🚎truby-25.0-wf]: https://github.com/galtzo-floss/yaml-converter/actions/workflows/truffleruby-25.0.yml
660
638
  [🚎truby-33.0-wf]: https://github.com/galtzo-floss/yaml-converter/actions/workflows/truffleruby-33.0.yml
661
639
  [🚎2-cov-wf]: https://github.com/galtzo-floss/yaml-converter/actions/workflows/coverage.yml
662
640
  [🚎2-cov-wfi]: https://github.com/galtzo-floss/yaml-converter/actions/workflows/coverage.yml/badge.svg
@@ -683,11 +661,8 @@ Thanks for RTFM. ☺️
683
661
  [💎ruby-3.4i]: https://img.shields.io/badge/Ruby-3.4-CC342D?style=for-the-badge&logo=ruby&logoColor=white
684
662
  [💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge&logo=ruby&logoColor=green
685
663
  [💎ruby-headi]: https://img.shields.io/badge/Ruby-HEAD-CC342D?style=for-the-badge&logo=ruby&logoColor=blue
686
- [💎truby-24.2i]: https://img.shields.io/badge/Truffle_Ruby-24.2-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
687
- [💎truby-25.0i]: https://img.shields.io/badge/Truffle_Ruby-25.0-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
688
664
  [💎truby-33.0i]: https://img.shields.io/badge/Truffle_Ruby-33.0-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
689
665
  [💎truby-c-i]: https://img.shields.io/badge/Truffle_Ruby-current-34BCB1?style=for-the-badge&logo=ruby&logoColor=green
690
- [💎truby-headi]: https://img.shields.io/badge/Truffle_Ruby-HEAD-34BCB1?style=for-the-badge&logo=ruby&logoColor=blue
691
666
  [💎jruby-10.0i]: https://img.shields.io/badge/JRuby-10.0-FBE742?style=for-the-badge&logo=ruby&logoColor=red
692
667
  [💎jruby-c-i]: https://img.shields.io/badge/JRuby-current-FBE742?style=for-the-badge&logo=ruby&logoColor=green
693
668
  [💎jruby-headi]: https://img.shields.io/badge/JRuby-HEAD-FBE742?style=for-the-badge&logo=ruby&logoColor=blue
@@ -717,7 +692,7 @@ Thanks for RTFM. ☺️
717
692
  [📌gitmoji]: https://gitmoji.dev
718
693
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
719
694
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
720
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.479-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
695
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.453-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
721
696
  [🔐security]: https://github.com/galtzo-floss/yaml-converter/blob/main/SECURITY.md
722
697
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
723
698
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -747,5 +722,5 @@ Thanks for RTFM. ☺️
747
722
  | Homepage | https://github.com/galtzo-floss/yaml-converter |
748
723
  | Source | https://github.com/galtzo-floss/yaml-converter |
749
724
  | License | `MIT` |
750
- | Funding | https://github.com/sponsors/pboling, https://ko-fi.com/pboling, https://liberapay.com/pboling/donate, https://opencollective.com/galtzo-floss, https://thanks.dev/u/gh/pboling, https://tidelift.com/funding/github/rubygems/yaml-converter, https://www.buymeacoffee.com/pboling |
725
+ | Funding | https://github.com/sponsors/pboling, https://ko-fi.com/pboling, https://liberapay.com/pboling/donate, https://opencollective.com/galtzo-floss, https://thanks.dev/u/gh/pboling, https://www.buymeacoffee.com/pboling |
751
726
  <!-- kettle-jem:metadata:end -->
data/exe/yaml-convert CHANGED
@@ -71,6 +71,7 @@ if options[:glob]
71
71
  puts parser
72
72
  exit 2
73
73
  end
74
+
74
75
  files = Dir.glob(pattern).select { |p| File.file?(p) }
75
76
  if files.empty?
76
77
  warn "No files matched glob: #{pattern}"
@@ -29,55 +29,73 @@ module Yaml
29
29
  yaml_section = fenced_yaml(markdown)
30
30
  title_lines = header_lines(markdown)
31
31
 
32
- document = HexaPDF::Document.new
33
- page = document.pages.add(page_size(options[:pdf_page_size] || "LETTER"))
34
32
  margin = normalize_margin(options[:pdf_margin] || [36, 36, 36, 36])
35
- content = ContentBox.new(page: page, margin: margin)
36
- canvas = page.canvas
37
-
38
- draw_lines(canvas, title_lines, content: content, size: options[:pdf_title_font_size] || 14, font: "Helvetica", style: :bold)
39
- content.move_down(10) if title_lines.any?
33
+ # Reserve room for the footer even when the requested bottom margin is smaller.
34
+ margin[2] = [margin[2], 50].max
35
+ size = page_size(options[:pdf_page_size] || "LETTER")
36
+ composer = HexaPDF::Composer.new(page_size: size, margin: margin)
37
+ draw_lines(composer, title_lines, font: "Helvetica", font_size: options[:pdf_title_font_size] || 14, font_variant: :bold)
40
38
 
41
39
  if options[:pdf_two_column_notes] && notes.any?
42
- draw_two_column_layout(canvas, yaml_section: yaml_section, notes: notes, content: content, options: options)
40
+ draw_columns(composer, yaml_section, notes, size: size, margin: margin, options: options)
43
41
  else
44
- draw_lines(canvas, yaml_section, content: content, size: options[:pdf_yaml_font_size] || 9, font: "Courier")
45
- content.move_down(10)
46
- draw_lines(canvas, notes.map { |note| "NOTE: #{note}" }, content: content, size: options[:pdf_body_font_size] || 11, font: "Helvetica", style: :italic)
42
+ draw_lines(composer, yaml_section, font: "Courier", font_size: options[:pdf_yaml_font_size] || 9)
43
+ draw_lines(composer, notes.map { |note| "NOTE: #{note}" }, font: "Helvetica", font_size: options[:pdf_body_font_size] || 11, font_variant: :italic)
47
44
  end
48
45
 
49
- draw_page_number(canvas, page: page)
50
- document.write(out_path, optimize: true)
46
+ pages = composer.document.pages.to_a
47
+ pages.each_with_index do |page, index|
48
+ page.canvas.font("Helvetica", size: 9).text("Page #{index + 1} of #{pages.length}", at: [page.box.width - 136, 24])
49
+ end
50
+ composer.write(out_path, optimize: true)
51
51
  true
52
52
  rescue => e
53
53
  warn("hexapdf pdf failed: #{e.class}: #{e.message}")
54
54
  false
55
55
  end
56
56
 
57
- ContentBox = Class.new do
58
- attr_accessor :page, :margin, :left, :right, :top, :bottom, :cursor
59
-
60
- def initialize(page:, margin:)
61
- width = page.box.width
62
- height = page.box.height
63
- @page = page
64
- @margin = margin
65
- @left = margin[3]
66
- @right = width - margin[1]
67
- @top = height - margin[0]
68
- @bottom = margin[2]
69
- @cursor = height - margin[0]
70
- end
71
-
72
- def width
73
- right - left
57
+ # Compose each column independently and overlay its pages on the title document.
58
+ def draw_columns(composer, yaml_section, notes, size:, margin:, options: {})
59
+ page = composer.page
60
+ width = page.box.width
61
+ column_width = (width - margin[1] - margin[3] - 16) / 2.0
62
+ start_page = composer.document.pages.count - 1
63
+ first_top = page.box.height - composer.y
64
+ columns = [
65
+ [yaml_section, [margin[0], width - margin[3] - column_width, margin[2], margin[3]],
66
+ {font: "Courier", font_size: options[:pdf_yaml_font_size] || 9}],
67
+ [notes.map { |note| "NOTE: #{note}" }, [margin[0], margin[1], margin[2], margin[3] + column_width + 16],
68
+ {font: "Helvetica", font_size: options[:pdf_body_font_size] || 11, font_variant: :italic}]
69
+ ]
70
+ columns.each do |lines, column_margin, style|
71
+ column = HexaPDF::Composer.new(skip_page_creation: true)
72
+ column.page_style(:continuation, page_size: size) do |canvas, page_style|
73
+ page_style.frame = page_style.create_frame(canvas.context, column_margin)
74
+ end
75
+ column.page_style(:first, page_size: size, next_style: :continuation) do |canvas, page_style|
76
+ page_style.frame = page_style.create_frame(canvas.context, [first_top, *column_margin[1..]])
77
+ end
78
+ column.new_page(:first)
79
+ draw_lines(column, lines, **style)
80
+ column.document.dispatch_message(:complete_objects)
81
+ column.document.validate
82
+ column.document.pages.each_with_index do |column_page, index|
83
+ composer.new_page while composer.document.pages.count <= start_page + index
84
+ target = composer.document.pages[start_page + index]
85
+ form = column.document.add(column_page.to_form_xobject)
86
+ target.canvas.xobject(composer.document.import(form), at: [0, 0])
87
+ end
74
88
  end
89
+ end
75
90
 
76
- def move_down(amount)
77
- self.cursor -= amount
91
+ def draw_lines(composer, lines, **style)
92
+ variant = style.delete(:font_variant)
93
+ style[:font] = composer.document.fonts.add(style[:font], variant: variant) if variant
94
+ lines.each do |line|
95
+ indent = (style[:font] == "Courier") ? line[/\A */].length * style[:font_size] * 0.6 : 0
96
+ composer.text(line.empty? ? " " : line, text_indent: indent, **style)
78
97
  end
79
98
  end
80
- private_constant :ContentBox
81
99
 
82
100
  def page_size(name)
83
101
  case name.to_s.upcase
@@ -97,65 +115,6 @@ module Yaml
97
115
  values
98
116
  end
99
117
 
100
- def draw_two_column_layout(canvas, yaml_section:, notes:, content:, options: {})
101
- gap = 16
102
- column_width = (content.width - gap) / 2.0
103
- left = content.left
104
- right = content.left + column_width + gap
105
- cursor = content.cursor
106
-
107
- yaml_bottom = draw_lines(canvas, yaml_section, content: content, left: left, cursor: cursor, width: column_width, size: options[:pdf_yaml_font_size] || 9, font: "Courier")
108
- notes_bottom = draw_lines(canvas, notes.map { |note| "NOTE: #{note}" }, content: content, left: right, cursor: cursor, width: column_width, size: options[:pdf_body_font_size] || 11, font: "Helvetica", style: :italic)
109
- content.cursor = [yaml_bottom, notes_bottom].min
110
- end
111
-
112
- def draw_lines(canvas, lines, content:, left: content.left, cursor: content.cursor, width: content.width, size: 11, font: "Helvetica", style: nil)
113
- variant = font_variant(style)
114
- if variant
115
- canvas.font(font, variant: variant, size: size)
116
- else
117
- canvas.font(font, size: size)
118
- end
119
- y = cursor
120
- Array(lines).each do |line|
121
- wrapped_lines(line.to_s, width: width, size: size, font: font).each do |wrapped|
122
- break if y <= content.bottom
123
-
124
- canvas.text(wrapped, at: [left, y])
125
- y -= line_height(size)
126
- end
127
- end
128
- content.cursor = y if left == content.left && width == content.width
129
- y
130
- end
131
-
132
- def wrapped_lines(line, width:, size:, font:)
133
- max_chars = [(width / average_char_width(size, font)).floor, 1].max
134
- return [line] if line.length <= max_chars
135
-
136
- line.scan(/.{1,#{max_chars}}/)
137
- end
138
-
139
- def average_char_width(size, font)
140
- (font == "Courier") ? size * 0.6 : size * 0.5
141
- end
142
-
143
- def font_variant(style)
144
- return :bold if style == :bold
145
- return :italic if style == :italic
146
-
147
- nil
148
- end
149
-
150
- def line_height(size)
151
- size * 1.25
152
- end
153
-
154
- def draw_page_number(canvas, page:)
155
- canvas.font("Helvetica", size: 9)
156
- canvas.text("Page 1 of 1", at: [page.box.width - 136, 36])
157
- end
158
-
159
118
  # Extract leading `# Title lines`.
160
119
  # @param markdown [String]
161
120
  # @return [Array<String>]
@@ -5,7 +5,7 @@ module Yaml
5
5
  # Version namespace for this gem.
6
6
  module Version
7
7
  # Current gem version.
8
- VERSION = "0.2.6"
8
+ VERSION = "0.2.8"
9
9
  end
10
10
  # Current gem version exposed at the traditional constant location.
11
11
  VERSION = Version::VERSION # Traditional Constant Location
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml-converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -100,7 +100,7 @@ dependencies:
100
100
  version: '1.1'
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.1.15
103
+ version: 1.1.17
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
@@ -110,7 +110,7 @@ dependencies:
110
110
  version: '1.1'
111
111
  - - ">="
112
112
  - !ruby/object:Gem::Version
113
- version: 1.1.15
113
+ version: 1.1.17
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: kettle-dev
116
116
  requirement: !ruby/object:Gem::Requirement
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '3.1'
121
121
  - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: 3.1.0
123
+ version: 3.1.29
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ dependencies:
130
130
  version: '3.1'
131
131
  - - ">="
132
132
  - !ruby/object:Gem::Version
133
- version: 3.1.0
133
+ version: 3.1.29
134
134
  - !ruby/object:Gem::Dependency
135
135
  name: bundler-audit
136
136
  requirement: !ruby/object:Gem::Requirement
@@ -188,7 +188,7 @@ dependencies:
188
188
  version: '0.1'
189
189
  - - ">="
190
190
  - !ruby/object:Gem::Version
191
- version: 0.1.3
191
+ version: 0.1.5
192
192
  type: :development
193
193
  prerelease: false
194
194
  version_requirements: !ruby/object:Gem::Requirement
@@ -198,7 +198,7 @@ dependencies:
198
198
  version: '0.1'
199
199
  - - ">="
200
200
  - !ruby/object:Gem::Version
201
- version: 0.1.3
201
+ version: 0.1.5
202
202
  - !ruby/object:Gem::Dependency
203
203
  name: appraisal2
204
204
  requirement: !ruby/object:Gem::Requirement
@@ -208,7 +208,7 @@ dependencies:
208
208
  version: '3.2'
209
209
  - - ">="
210
210
  - !ruby/object:Gem::Version
211
- version: 3.2.3
211
+ version: 3.2.6
212
212
  type: :development
213
213
  prerelease: false
214
214
  version_requirements: !ruby/object:Gem::Requirement
@@ -218,7 +218,7 @@ dependencies:
218
218
  version: '3.2'
219
219
  - - ">="
220
220
  - !ruby/object:Gem::Version
221
- version: 3.2.3
221
+ version: 3.2.6
222
222
  - !ruby/object:Gem::Dependency
223
223
  name: kettle-test
224
224
  requirement: !ruby/object:Gem::Requirement
@@ -228,7 +228,7 @@ dependencies:
228
228
  version: '2.0'
229
229
  - - ">="
230
230
  - !ruby/object:Gem::Version
231
- version: 2.0.21
231
+ version: 2.0.30
232
232
  type: :development
233
233
  prerelease: false
234
234
  version_requirements: !ruby/object:Gem::Requirement
@@ -238,27 +238,27 @@ dependencies:
238
238
  version: '2.0'
239
239
  - - ">="
240
240
  - !ruby/object:Gem::Version
241
- version: 2.0.21
241
+ version: 2.0.30
242
242
  - !ruby/object:Gem::Dependency
243
243
  name: turbo_tests2
244
244
  requirement: !ruby/object:Gem::Requirement
245
245
  requirements:
246
246
  - - "~>"
247
247
  - !ruby/object:Gem::Version
248
- version: '3.2'
248
+ version: '4.0'
249
249
  - - ">="
250
250
  - !ruby/object:Gem::Version
251
- version: 3.2.8
251
+ version: 4.0.2
252
252
  type: :development
253
253
  prerelease: false
254
254
  version_requirements: !ruby/object:Gem::Requirement
255
255
  requirements:
256
256
  - - "~>"
257
257
  - !ruby/object:Gem::Version
258
- version: '3.2'
258
+ version: '4.0'
259
259
  - - ">="
260
260
  - !ruby/object:Gem::Version
261
- version: 3.2.8
261
+ version: 4.0.2
262
262
  - !ruby/object:Gem::Dependency
263
263
  name: ruby-progressbar
264
264
  requirement: !ruby/object:Gem::Requirement
@@ -282,7 +282,7 @@ dependencies:
282
282
  version: '1.0'
283
283
  - - ">="
284
284
  - !ruby/object:Gem::Version
285
- version: 1.0.9
285
+ version: 1.0.10
286
286
  type: :development
287
287
  prerelease: false
288
288
  version_requirements: !ruby/object:Gem::Requirement
@@ -292,7 +292,7 @@ dependencies:
292
292
  version: '1.0'
293
293
  - - ">="
294
294
  - !ruby/object:Gem::Version
295
- version: 1.0.9
295
+ version: 1.0.10
296
296
  - !ruby/object:Gem::Dependency
297
297
  name: gitmoji-regex
298
298
  requirement: !ruby/object:Gem::Requirement
@@ -302,7 +302,7 @@ dependencies:
302
302
  version: '2.0'
303
303
  - - ">="
304
304
  - !ruby/object:Gem::Version
305
- version: 2.0.13
305
+ version: 2.0.16
306
306
  type: :development
307
307
  prerelease: false
308
308
  version_requirements: !ruby/object:Gem::Requirement
@@ -312,7 +312,7 @@ dependencies:
312
312
  version: '2.0'
313
313
  - - ">="
314
314
  - !ruby/object:Gem::Version
315
- version: 2.0.13
315
+ version: 2.0.16
316
316
  description: "\U0001F968 yaml-converter parses YAML files (with inline #note: annotations
317
317
  and validation markers) and emits polished Markdown, HTML, and PDF/DOCX (via pandoc)
318
318
  outputs including a validation status line, fenced YAML blocks, and extracted notes."
@@ -343,10 +343,10 @@ licenses:
343
343
  - MIT
344
344
  metadata:
345
345
  homepage_uri: https://yaml-converter.galtzo.com
346
- source_code_uri: https://github.com/galtzo-floss/yaml-converter/tree/v0.2.6
347
- changelog_uri: https://github.com/galtzo-floss/yaml-converter/blob/v0.2.6/CHANGELOG.md
346
+ source_code_uri: https://github.com/galtzo-floss/yaml-converter/tree/v0.2.8
347
+ changelog_uri: https://github.com/galtzo-floss/yaml-converter/blob/v0.2.8/CHANGELOG.md
348
348
  bug_tracker_uri: https://github.com/galtzo-floss/yaml-converter/issues
349
- documentation_uri: https://www.rubydoc.info/gems/yaml-converter/0.2.6
349
+ documentation_uri: https://www.rubydoc.info/gems/yaml-converter/0.2.8
350
350
  funding_uri: https://github.com/sponsors/pboling
351
351
  wiki_uri: https://github.com/galtzo-floss/yaml-converter/wiki
352
352
  news_uri: https://www.railsbling.com/tags/yaml-converter
@@ -377,7 +377,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
377
377
  - !ruby/object:Gem::Version
378
378
  version: '0'
379
379
  requirements: []
380
- rubygems_version: 4.0.17
380
+ rubygems_version: 4.0.24
381
381
  specification_version: 4
382
382
  summary: "\U0001F968 Convert annotated YAML blueprints into readable Markdown, HTML,
383
383
  PDF, or DOCX with validation status and notes extraction."
metadata.gz.sig CHANGED
Binary file