Remove video format hack#4
Merged
srid merged 3 commits intosrid:masterfrom Jul 18, 2023
Merged
Conversation
srid
added a commit
that referenced
this pull request
Apr 29, 2026
The "tag" attribute on a B.Div is a directive used by groupRawHtmlBlocks (in RawHtmlGroup) to override the rendered element name. The directive's key was scattered as a string literal across three sites — the producer in RawHtmlGroup and two consumers (getTag, dropTagAttr) buried in a where-clause inside rpBlock'. Promote the protocol to first-class names in Render.Internal: - tagDirectiveKey :: Text — the single source of truth for the key. - divTag :: Text -> B.Attr -> Text — formerly the local getTag. - stripTagDirective :: B.Attr -> B.Attr — formerly the local dropTagAttr. RawHtmlGroup now imports tagDirectiveKey when constructing the Div, and the Div arm of rpBlock' calls divTag/stripTagDirective directly. The where-clause in rpBlock' loses two helpers and Map import; everything else is unchanged. Addresses Hickey #2 (named protocol over implicit convention) and Lowy #2/#4 (extract tagDirectiveKey + named helper for dropTagAttr).
srid
added a commit
that referenced
this pull request
Apr 29, 2026
…ent (#16) * fix(rawhtml): group orphan opener/closer raw-HTML blocks CommonMark "type 6" HTML blocks end at the next blank line, so markdown like <details> **bold** content </details> reaches the renderer as three blocks: an opener `RawBlock` carrying `"<details>\n"`, a `Para`, and a closer `RawBlock` with `"</details>\n"`. The current rawNode wraps each raw blob in its own `<rawhtml>` element to keep xmlhtml from mangling the bytes; the side effect is that the `<details>` open and close tags get trapped inside their wrappers and the markdown paragraph ends up a sibling of the (empty) details element rather than its child. New `Heist.Extra.Splices.Pandoc.RawHtmlGroup.groupRawHtmlBlocks` pass walks the AST (via `Text.Pandoc.Walk`, so nested block lists are covered too) and rewrites those orphan triplets into a `B.Div` carrying the tag in its `"tag"` attribute. The `Div` arm of `rpBlock'` already turns that into the named element. It now also strips the `"tag"` directive before serialising attributes so the override doesn't leak as a literal `tag="…"` attribute on the rendered element. Tests: 12 unit tests pin the parser and grouping behaviour (issue example, empty group, orphan open/close, consecutive pairs, same-tag nesting via depth counting, self-closing rejection, balanced-in-one-block rejection, case-insensitive matching, attribute tolerance, hyphenated custom-element names, mismatched-tag orphan), plus an end-to-end integration test through `renderPandocWith` that asserts the markdown paragraph lands inside `<details>` with no `<rawhtml>` wrapper. Closes srid/emanote#433. * fix(police): hlint — use isAsciiLower/isAsciiUpper/isDigit, eta-reduce raw helper * refactor(hickey): closerTag — require explicit '>' so a malformed </tag (no '>') doesn't silently match * refactor(hickey+lowy): hoist tag-directive helpers into Render.Internal The "tag" attribute on a B.Div is a directive used by groupRawHtmlBlocks (in RawHtmlGroup) to override the rendered element name. The directive's key was scattered as a string literal across three sites — the producer in RawHtmlGroup and two consumers (getTag, dropTagAttr) buried in a where-clause inside rpBlock'. Promote the protocol to first-class names in Render.Internal: - tagDirectiveKey :: Text — the single source of truth for the key. - divTag :: Text -> B.Attr -> Text — formerly the local getTag. - stripTagDirective :: B.Attr -> B.Attr — formerly the local dropTagAttr. RawHtmlGroup now imports tagDirectiveKey when constructing the Div, and the Div arm of rpBlock' calls divTag/stripTagDirective directly. The where-clause in rpBlock' loses two helpers and Map import; everything else is unchanged. Addresses Hickey #2 (named protocol over implicit convention) and Lowy #2/#4 (extract tagDirectiveKey + named helper for dropTagAttr). * docs(lowy): RawHtmlGroup header — volatility axis + internal-API status * refactor(police): elegance — extract shared parseTagAfterPrefix helper openerTag and closerTag both stripped a prefix, parsed a tag-name span, and verified that nothing but whitespace followed the closing '>'. The opener has one extra check (reject self-closing); other than that the two parsers were the same shape. Extract the shared work into one parseTagAfterPrefix and let openerTag layer the void-element rejection on top. * refactor(police): rehome tag-directive helpers in RawHtmlGroup, drop unused defaultTag The tag-directive scheme (key + resolver + stripper) was sitting in Render.Internal — a module whose docstring scopes it to "pure helpers extracted from Render.hs", i.e. table rendering. The producer of the directive is RawHtmlGroup, and the volatility lives there: any future change to the wire format starts at the module that decides what shape to emit. Move the three helpers to RawHtmlGroup (the producer) and have Render import from there. Render.Internal is back to its original table-helpers scope. While moving, also drop the unused defaultTag parameter on divTag — every call site passes "div"; bake it in. Switch divTag from Map.fromList+Map.lookup to plain Data.List.lookup since attr lists are flat assoc lists with no duplicates in practice (no behaviour change for real input). Save a Map allocation per Div on the rendering hot path. * docs(police): clean up stale getTag refs and trim oversized docstrings - RenderSpec: comment said 'getTag' but the helper was renamed to divTag. - RawHtmlGroup module docstring: trim the Public-surface paragraph from three sentences to one — the rest narrated cabal config that is one grep away. - RawHtmlGroupSpec: drop the 'Block helpers' header comment that narrated what the next three lines obviously are.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Video embedding is now supported in emanote. I suppose this is no longer needed. Or is it used by some other project or should be kept for backwards compatibility reasons?