Skip to content

\grammarterm{} not converted to italics in code blocks #10

@lefticus

Description

@lefticus

Problem

Grammar terms using the \grammarterm{} macro are not being italicized in code blocks, appearing as plain text instead of indicating they're placeholder grammar elements.

Location

File: n4950/except.md
Line: 82

Current Behavior

if (condition)
  goto lab;

The word "condition" appears as plain text, not distinguished as a grammar placeholder.

Expected Behavior

if (*condition*)
  goto lab;

The grammar term should be italicized to indicate it's a placeholder, not a literal identifier.

Source Context

File: cplusplus-draft/source/exceptions.tex
Line: 120

if (@\grammarterm{condition}@)
  goto lab;

The @\grammarterm{condition}@ syntax (using @ delimiters) embeds a grammar term within a code block. This should be converted to *condition* in markdown.

Impact

  • Severity: MAJOR
  • Grammar placeholders are indistinguishable from regular code
  • Makes it unclear that "condition" is meant to be replaced with an actual condition
  • Reduces the instructional value of the code example
  • This is likely a systematic issue affecting all code blocks with embedded grammar terms

Root Cause

The code block filter (cpp-code-blocks.lua) is not properly handling @\grammarterm{...}@ sequences within code blocks. It should:

  1. Detect the @...\grammarterm{...}...@ pattern
  2. Convert it to *...* markdown italic syntax
  3. This requires processing the code content for these patterns before outputting

Reproduction

  1. Open n4950/except.md
  2. Navigate to line 82
  3. Observe "condition" is not italicized
  4. Compare with the source showing it should be a grammar term

Related Files

  • src/cpp_std_converter/filters/cpp-code-blocks.lua - Code block processing
  • Need to add handling for @\grammarterm{...}@ within code content

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmajorMajor priority issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions