Skip to content

Conversation

@gmilde
Copy link
Contributor

@gmilde gmilde commented Jan 26, 2026

A series of converter patches involving changes to the internal representation
as "Moinwiki tree elements" to simplify the conversion code.

  • Use moin_page.sub and moin_page.sup for sub- and superscript.
  • Replace visit_xhtml_br() with an entry in simple_tags.
  • Use "html-tag" attribute for HTML tags without matching Moinpage tag.
  • Support the <aside> element.
  • Add supported attributes to HTML inline tags in Markdown output.
  • Use "moin-big" and "moin-small" class values instead of the "font-size" attribute for font-size changes.

Closes #2109.

…ipt.

Simplify the conversion functions by using "Moinpage tree" elements
`<sub>` and `<sup>` instead of `<span baseline-shift="sub"> and
`<span baseline-shift="sub/super"> for subscript and superscript.
Replace `visit_xhtml_br()` with an entry in `simple_tags`.

Add descriptive comments to the ignored tags as a record
of the rationale to ignore them.
…oinpage tag.

Use a more generic element in the Moinpage tree and store the original tag in
the "html-tag" attribute for HTML elements without matching markup syntax
in lightwight markup languages, e.g., `<cite>` → `<emphasis html-tag="cite}">`.

This replaces the storage as class value (`<emphasis class="html-cite}">`).
(Since HTML output restores the original tag, the attribute is only required
in the internal representation. A dedicated attribute simplifies storage and
retrieval.)
"The aside element represents a section of a page that consists of
content that is tangentially related to the content around the aside
element, and which could be considered separate from that content.
Such sections are often represented as sidebars in printed typography."

Use it for reStructuredText "topic" and "sidebar" directives.

Adapt common.css.
Include attributes supported by `html_out.Attributes` (class, id, title, ...)
in the start tag of HTML inline elements.

Now, e.g., `<span class="orange">apple</span>` survives a round-trip.
…e change.

HTML deprecated hard coded style changes already in HMTL 4.1.
(While `<big>` is now obsolete, `<small>` got new semantics.)

Moinwiki markup allows changing the font size with the syntax
`~-smaller-~` and `~+larger+~`.  Up to now, these were internally stored as
`<span font-size="85%">` and `<span font-size="120%">`.

HTML output converted spans with these font-size values to
spans with class values "moin-big" and "moin-small"
with rules for `.moin-big` and `.moin-small` in "common.css".
Other values of the "font-size" attribute were ignored.

This patch changes the input converters to use the class values already in
the internal representation, so that the "font-size" attribute is redundant.
@UlrichB22
Copy link
Collaborator

@gmilde, can you please explain the TODOs that you added in html_in.py here?
Inline TODOs are usually too short to be understandable after some time.

@gmilde
Copy link
Contributor Author

gmilde commented Jan 26, 2026

Can you please explain the TODOs that you added in html_in.py here?

Sure.

indirect_tags:
"kbd": moin_page.span, # user input; TODO: use moin_page.code?

See #2113 for discussion of "monospace" elements.

ignored_tags:
# We do not even process children of these elements, a warning is given.

I don't think we should ignore the content of deprecated tags or alternative content to the "dangerous" tags (<noscript>, ...)

"caption", # TODO support table captions

Table captions are supported in rST (but currently not by Moin). They are not dangerous and could easily be supported for HTML and Markdown and probably also Docbook markup.

"center", # deprecated; TODO map to <div class="center">?

I suggest rendering the content of the deprecated <center> tag, in a <div> centered via the .center rule in common.css.
Mapping deprecated/obsolete tags to a "canonical" replacement is already done for <tt> and <strike>.

"menu", # TODO: map to <ul>?

"The <menu> HTML element is described in the HTML specification as a semantic alternative to <ul>, but treated by browsers ([...]) as no different than <ul>."
-- https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/menu
We can support <menu> at the cost of one code line (entry in indirect_tags).

"noframes", # TODO: ignore but process children?
"noscript", # TODO: ignore but process children?

Moin HTML ignores frames and script. So it should IMO behave similar to a browser and handle the content of the fallback elements <noframes> and
<noscript>.
Implementation is simple: remove the two entries from ignored_tags.

@gmilde
Copy link
Contributor Author

gmilde commented Jan 26, 2026

All tests were fine after the original commit. After merging the recent changes, the "Windows" package test failed -- unfortunately without any error message.

The downloadable log says:
#.2026-01-26T20:10:35.3860809Z ##[error]Could not find a part of the path 'D:\a'.

@UlrichB22
Copy link
Collaborator

Thanks for your additional comments.

All tests were fine after the original commit. After merging the recent changes, the "Windows" package test failed -- unfortunately without any error message.

This is just a sporadic CI failure. The rerun was successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation/policy/conventions for "Moinpage" DOM nodes?

2 participants