Skip to content

New version of rule for <munder> #613

Description

@TimArborealis

In default.yaml there is a rule for speaking <munder>. In cases where there are nested <munder>s, such as the following,

<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML">
          <munder>
            <mrow>
              <munder>
                <mrow>
                  <mn>2</mn>
                  <mo>,</mo>
                  <mn>7</mn>
                  <mo>,</mo>
                  <mn>12</mn>
                  <mo>,</mo>
                  <mn>17</mn>
                  <mo>,</mo>
                  <mo>…</mo>
                  <mo>,</mo>
                  <mn>n</mn>
                  <mo>+</mo>
                  <mn>5</mn>
                </mrow>
                <mo>⏟</mo>
              </munder>
            </mrow>
            <mi mathvariant="normal">N</mi>
          </munder>
        </math>

the speaking is exceedingly verbose. In this case it would read "quantity quantity, 2 comma 7 [...] plus 5, with bottom brace below, with N below".

In Swedish, I have modified this rule so that it says the equivalent of "commented expression, 2 comma 7 [...] plus 5, with comment below, N, end comment". The bottom brace will be spoken only in navigation.

The new Swedish rule looks like this (translated into English here):

- name: default
  tag: munder
  match: "."
  replace:
  - with:
      variables:
      # true if the comment contains ⏟ or ︸ (also if inside mrow or surrounded by whitespace)
      - HasBrace: "contains(normalize-space(string(*[2])), '⏟') or contains(normalize-space(string(*[2])), '︸')"
      replace:
      - test:
          if: "$HasBrace"
          then:
            # The base is always read
            - x: "*[1]"
            - pause: short
            # Read the brace (good for navigation) but no framing phrases
            - x: "*[2]"
          else:
            # Frame phrase in the beginning if the base is not leaf
            - test:
                if: "not(IsNode(*[1], 'leaf'))"
                then: [T: "commented expression"]
            - x: "*[1]"
            - pause: short
            - T: "with comment below"
            - pause: short
            - x: "*[2]"
            - pause: short
            - T: "end comment"

If others agree that this is a better solution, I would suggest substituting the English rule for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionRequires discussion to decide next stepsrulesPertains to Rules

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions