Skip to content

Layout: tag a Preformatted block that holds code as P > Code #663

Open

Description

@Tim81

Problem

Preformatted (#591, v2.4) tags each drawn piece of a block as a P, as a paragraph is tagged. A preformatted
block need not be code, so P is right for the element as defined. When the block is code, ISO 14289-1 7.2 asks for
"the most semantically appropriate tag", and a P alone falls short in a PDF/UA-1 or PDF/A-2a file. No validator
checks this, so the gap is invisible to veraPDF.

What the specifications say

Read for the #591 design, from the held copies:

  • Code is an inline-level structure type in ISO 32000-1 (Table 338) and is in the PDF 1.7 namespace only
    (ISO 32000-2 Annex M).
  • ISO/TS 32005 Table 5 lets Code be a child of Document, Sect, Div or P and hold content items directly,
    but not hold a P.
  • ISO 14289-2 8.2.5.32 requires computer code to be enclosed in Code.

So the shape is P > Code: one Code child per drawn piece, holding that piece's MCID.

Scope

  • An opt-in member on Preformatted that says the text is code (name decided in the brief), default off, so
    documents that do not set it keep their bytes.
  • With it set and tagging on: P > Code per piece; untagged output unchanged.
  • Docs in the boundary pattern; CHANGELOG entry.

Acceptance

  • A tagged block with the opt-in has a P element whose child is Code holding the MCID, per piece; without it
    the structure is the same as in v2.4 (pinned bytes).
  • veraPDF ua1 and 2a pass on a block with the opt-in.

Activity

  1. Tim81 commented on Nov 29, 2026

    @Tim81
    OwnerAuthor

    The ISO audit (docs/conformance-v2.4.md) has skipped tests that wait on this issue; the fix removes their skip and makes them pass.

    • Iso14289_1_7_2_ACodeBlockIsAPHoldingACode (group G3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions