idml 0.8.0 → 0.8.1

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: bdf6a3aba5bbe199af39e5addabae082b795dfef1583dd14f33a9d7415086ead
4
- data.tar.gz: eb1a78bd1a11fdc7500543b903b4d927114a96a70fea97a7e8b4c62db813451e
3
+ metadata.gz: 987636748becfcad9dafe0f703801848e6c4e1bffa12a59b7cd0034424b3628a
4
+ data.tar.gz: bcd103a17bab68ca38a9cd2534aa97f937aa10f560c79283bd5e1efd585be22e
5
5
  SHA512:
6
- metadata.gz: e47ca1b121cd27336a516f8b0cb863d5ad03edbdc43455bfa3efcb41807865a1dae4aec35ccbf380e003dc383d9f0d3704b42e23efa0d56c6925f316b68030c1
7
- data.tar.gz: 3ac803ec48c5a0e2a2e3eec6f17845993a2a3194ddb8046bd5e8ea7225fcd8709abef22817684c12c51814b26a6ca9d3e07f2b4a735b519b9cb3d99e9eaaec5c
6
+ metadata.gz: d7eb62a48b163312832120f0d475b4b7ced9b1364c457677135026f1e75b84d36d53faa834c7ec36ecd87b4e9daacd727c0f1e75639a87919b98f507c56fde01
7
+ data.tar.gz: 470a0a62f1855b42369f0a81f099982a89a50f4070ad981a23d66693f6724e3fdf8c04441fb274c702871163e94c96804a27b4d7651ec5eea5de83cd435c791d
@@ -1,9 +1,10 @@
1
1
  # TODO PDF 115: Bullet and numbered list rendering
2
2
 
3
- ## Status: DONE for inline marker emission. Hanging-indent layout
4
- (bullet in a left gutter with wrapped lines indented to align with
5
- text after marker) is a follow-up currently the marker sits inline
6
- before the first run's text.
3
+ ## Status: DONE markers are prepended inline AND a hanging indent
4
+ (18pt) is applied so wrapped lines align with text after the marker.
5
+ The indent is approximate (fixed width) since tab-stop measurement
6
+ requires font metrics at style-resolution time; future refinement
7
+ would measure the actual marker width.
7
8
 
8
9
  ## Problem
9
10
 
@@ -249,9 +249,12 @@ module Idml
249
249
  end
250
250
  private_class_method :alignment_for
251
251
 
252
+ HANGING_INDENT_WIDTH = 18.0
253
+
252
254
  # Prepends the list marker (bullet glyph or numbered expression)
253
255
  # to the paragraph's first run when the paragraph is part of
254
- # a list. Mutates the first run's text in place.
256
+ # a list. Also applies a hanging indent so wrapped lines align
257
+ # with the text after the marker, not with the marker itself.
255
258
  def self.prepend_list_marker(paragraph)
256
259
  marker = ListMarker.marker_for(paragraph)
257
260
  return unless marker
@@ -259,9 +262,21 @@ module Idml
259
262
 
260
263
  first_run = paragraph.runs.first
261
264
  first_run.text = "#{marker}#{first_run.text}"
265
+ apply_hanging_indent(paragraph)
262
266
  end
263
267
  private_class_method :prepend_list_marker
264
268
 
269
+ # Adjusts left_indent and first_line_indent for a hanging
270
+ # indent effect: first line starts at the original left edge
271
+ # (with the marker), wrapped lines indent by HANGING_INDENT_WIDTH.
272
+ def self.apply_hanging_indent(paragraph)
273
+ current_left = paragraph.left_indent || 0
274
+ current_first = paragraph.first_line_indent || 0
275
+ paragraph.left_indent = current_left + HANGING_INDENT_WIDTH
276
+ paragraph.first_line_indent = current_first - HANGING_INDENT_WIDTH
277
+ end
278
+ private_class_method :apply_hanging_indent
279
+
265
280
  # Concatenate runs into a single block. Used when the renderer
266
281
  # can't handle per-run styling (e.g., no font metrics available).
267
282
  def self.concatenate(runs)
data/lib/idml/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Idml
4
- VERSION = "0.8.0"
4
+ VERSION = "0.8.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-08-10 00:00:00.000000000 Z
11
+ date: 2026-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal