diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-07-21 04:15:45 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2021-07-21 04:16:17 -0600 |
| commit | 77e46719294323ef50fa802a893d27ee2f3e065d (patch) | |
| tree | 13c4d4b09da2d43ec71c4803069998ed1edfb598 | |
| parent | b9b75b2d0b9991f6d8b32fbed2dd5d7235ff79c7 (diff) | |
patch Prawn to preserve leading null character when running on Ruby 3
| -rw-r--r-- | lib/asciidoctor/pdf/ext/prawn.rb | 1 | ||||
| -rw-r--r-- | lib/asciidoctor/pdf/ext/prawn/formatted_text/arranger.rb | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/asciidoctor/pdf/ext/prawn.rb b/lib/asciidoctor/pdf/ext/prawn.rb index 8f01dc1f..b1f3540e 100644 --- a/lib/asciidoctor/pdf/ext/prawn.rb +++ b/lib/asciidoctor/pdf/ext/prawn.rb @@ -4,6 +4,7 @@ require_relative 'prawn/font_metric_cache' require_relative 'prawn/font/afm' require_relative 'prawn/images' +require_relative 'prawn/formatted_text/arranger' require_relative 'prawn/formatted_text/box' require_relative 'prawn/formatted_text/fragment' require_relative 'prawn/extensions' diff --git a/lib/asciidoctor/pdf/ext/prawn/formatted_text/arranger.rb b/lib/asciidoctor/pdf/ext/prawn/formatted_text/arranger.rb new file mode 100644 index 00000000..7d613985 --- /dev/null +++ b/lib/asciidoctor/pdf/ext/prawn/formatted_text/arranger.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +Prawn::Text::Formatted::Arranger.prepend (Module.new do + def initialize *_args + super + @dummy_text = ?\u0000 + end + + def next_string + if (string = super) == @dummy_text + def string.lstrip!; end + end + string + end +end) |
