From 5e04c120d0e6b310a27aea4a6962e52653e6491f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 6 Jan 2022 12:04:30 +0100 Subject: [PATCH] css, m.htmlsanity: use a
for .m-figure-description. I can't read, apparently. Thought that the "flow content" on MDN doesn't allow any block elements, only inline, but it does. So there's no need to put a stupid there and then try to make a block element out of it via CSS again. --- css/m-components.css | 1 - css/m-dark+documentation.compiled.css | 1 - css/m-dark.compiled.css | 1 - css/m-light+documentation.compiled.css | 1 - css/m-light.compiled.css | 1 - doc/css/components-test.rst | 51 ++++++++++++++------------ doc/css/components.rst | 27 +++++++------- plugins/m/htmlsanity.py | 4 +- plugins/m/test/components/page.html | 4 +- plugins/m/test/dot/page-240.html | 4 +- plugins/m/test/dot/page.html | 4 +- plugins/m/test/images/page.html | 4 +- 12 files changed, 52 insertions(+), 51 deletions(-) diff --git a/css/m-components.css b/css/m-components.css index 651426f7..8186f05e 100644 --- a/css/m-components.css +++ b/css/m-components.css @@ -653,7 +653,6 @@ figure.m-figure figcaption a, .m-code-figure figcaption a, .m-console-figure fig ignoring everything after that. So it has to be all inside
. See also https://github.com/mosra/m.css/issues/117 for details. */ figure.m-figure figcaption .m-figure-description { - display: block; margin-top: 0.5rem; font-weight: normal; font-size: 1rem; diff --git a/css/m-dark+documentation.compiled.css b/css/m-dark+documentation.compiled.css index 838942f4..79e29e74 100644 --- a/css/m-dark+documentation.compiled.css +++ b/css/m-dark+documentation.compiled.css @@ -902,7 +902,6 @@ figure.m-figure figcaption a, .m-code-figure figcaption a, .m-console-figure fig text-decoration: none; } figure.m-figure figcaption .m-figure-description { - display: block; margin-top: 0.5rem; font-weight: normal; font-size: 1rem; diff --git a/css/m-dark.compiled.css b/css/m-dark.compiled.css index 94396a52..b8d735ab 100644 --- a/css/m-dark.compiled.css +++ b/css/m-dark.compiled.css @@ -902,7 +902,6 @@ figure.m-figure figcaption a, .m-code-figure figcaption a, .m-console-figure fig text-decoration: none; } figure.m-figure figcaption .m-figure-description { - display: block; margin-top: 0.5rem; font-weight: normal; font-size: 1rem; diff --git a/css/m-light+documentation.compiled.css b/css/m-light+documentation.compiled.css index d773c9c3..23ecea71 100644 --- a/css/m-light+documentation.compiled.css +++ b/css/m-light+documentation.compiled.css @@ -902,7 +902,6 @@ figure.m-figure figcaption a, .m-code-figure figcaption a, .m-console-figure fig text-decoration: none; } figure.m-figure figcaption .m-figure-description { - display: block; margin-top: 0.5rem; font-weight: normal; font-size: 1rem; diff --git a/css/m-light.compiled.css b/css/m-light.compiled.css index 31afd8fb..18db62f0 100644 --- a/css/m-light.compiled.css +++ b/css/m-light.compiled.css @@ -902,7 +902,6 @@ figure.m-figure figcaption a, .m-code-figure figcaption a, .m-console-figure fig text-decoration: none; } figure.m-figure figcaption .m-figure-description { - display: block; margin-top: 0.5rem; font-weight: normal; font-size: 1rem; diff --git a/doc/css/components-test.rst b/doc/css/components-test.rst index b2fb15d0..eae94e99 100644 --- a/doc/css/components-test.rst +++ b/doc/css/components-test.rst @@ -1013,8 +1013,9 @@ Figure, centered:
A Ship - Photo © - The Author +
+ Photo © The Author +
@@ -1026,8 +1027,9 @@ Figure, centered, image link, flat:
A Ship - Photo © - The Author +
+ Photo © The Author +
@@ -1049,10 +1051,11 @@ unnecessary wrapping of the text:
A Somewhat Lengthy Caption For A Photo - The Photo Displayed Above Was Kindly - Taken And Allowed To Be Used On This Page By - The Author. All Rights - Reserved. +
+ The Photo Displayed Above Was Kindly Taken And Allowed To Be Used On + This Page By The Author. All + Rights Reserved. +
@@ -1065,10 +1068,11 @@ leaking of the image outside of the page:
A Somewhat Lengthy Caption For A Photo - The Photo Displayed Above Was Kindly - Taken And Allowed To Be Used On This Page By - The Author. All Rights - Reserved. +
+ The Photo Displayed Above Was Kindly Taken And Allowed To Be Used On + This Page By The Author. All + Rights Reserved. +
@@ -1081,10 +1085,11 @@ instead of extending the border and there should be proper padding on bottom):
A Somewhat Lengthy Caption For A Photo - The Photo Displayed Above Was Kindly - Taken And Allowed To Be Used On This Page By - The Author. All Rights - Reserved. +
+ The Photo Displayed Above Was Kindly Taken And Allowed To Be Used On + This Page By The Author. All + Rights Reserved. +
@@ -1105,7 +1110,7 @@ Figures of varying colors:
Default figure - Text. +
Text.
@@ -1114,7 +1119,7 @@ Figures of varying colors:
Primary figure - Text. +
Text.
@@ -1123,7 +1128,7 @@ Figures of varying colors:
Success figure - Text. +
Text.
@@ -1132,7 +1137,7 @@ Figures of varying colors:
Warning figure - Text. +
Text.
@@ -1143,7 +1148,7 @@ Figures of varying colors:
Danger figure - Text. +
Text.
@@ -1152,7 +1157,7 @@ Figures of varying colors:
Info figure - Text. +
Text.
@@ -1161,7 +1166,7 @@ Figures of varying colors:
Dim figure - Text. +
Text.
diff --git a/doc/css/components.rst b/doc/css/components.rst index 64f1bf10..63b4cd9a 100644 --- a/doc/css/components.rst +++ b/doc/css/components.rst @@ -665,7 +665,7 @@ Use the HTML5 :html:`
` tag together with :css:`.m-figure` to style it. As with plain image, it's by default centered, slightly rounded and has a border around the caption and description. The caption is expected to be in the :html:`
` element. Inside it, there can optionally be a longer -description wrapped in a :css:`.m-figure-description` element. The +description wrapped in a :css:`div.m-figure-description` element. The :css:`.m-fullwidth` class works here too and you can also wrap the :html:`` / :html:`` element in an :html:`` tag to make it clickable. @@ -685,9 +685,9 @@ staying unaffected) by adding one of the `CSS color classes <#colors>`_ to the Ship
A Ship - +
Photo © The Author - +
@@ -697,9 +697,9 @@ staying unaffected) by adding one of the `CSS color classes <#colors>`_ to the Ship
A Ship - +
Photo © The Author - +
@@ -708,15 +708,16 @@ staying unaffected) by adding one of the `CSS color classes <#colors>`_ to the While a description *could* be put also after a :html:`
` such as in the following snippet, CSS styling used by m.css causes Firefox to display only the :html:`
`, ignoring everything after. Thus it's - recommended to always nest the description in a :css:`.m-figure-description` - element inside. See also :gh:`mosra/m.css#117` for more information. + recommended to always nest the description in a + :css:`div.m-figure-description` element inside. See also + :gh:`mosra/m.css#117` for more information. .. code:: html
Ship
A Ship
- Photo © The Author +
Photo © The Author
.. note-info:: @@ -1157,7 +1158,7 @@ assigned caption and description. It behaves the same as `image figures`_, the figure width being defined by the math equation size. Create a :html:`
` element and put :html:`` as a first child. The remaining content of the figure can be -:html:`
` with optional :css:`.m-figure-description` same as with +:html:`
` with optional :css:`div.m-figure-description` same as with `image figures <#figures>`_. Add the :css:`.m-flat` class to the :html:`
` to remove the outer border and equation background, `CSS color classes`_ on the :html:`
` affect the figure, on the @@ -1174,7 +1175,7 @@ as a first child. The remaining content of the figure can be
Theorem - A Pythagorean one. +
A Pythagorean one.
@@ -1204,7 +1205,7 @@ as a first child. The remaining content of the figure can be
Theorem - A Pythagorean one. +
A Pythagorean one.
@@ -1345,7 +1346,7 @@ right after.
Impenetrable logic - No. +
No.
@@ -1381,7 +1382,7 @@ right after.
Impenetrable logic - No. +
No.
diff --git a/plugins/m/htmlsanity.py b/plugins/m/htmlsanity.py index bfb40487..ce6d6ab1 100644 --- a/plugins/m/htmlsanity.py +++ b/plugins/m/htmlsanity.py @@ -465,7 +465,7 @@ class SaneHtmlTranslator(HTMLTranslator): def depart_figure(self, node): # See depart_caption() below for details if self.in_figure_caption_with_description: - self.body.append('\n
\n') + self.body.append('\n
\n') self.in_figure_caption_with_description = False self.body.append('\n') @@ -484,7 +484,7 @@ class SaneHtmlTranslator(HTMLTranslator): # such, figure out a way to query if there are useful nodes. Can't # check for just nodes.legend, as there can be arbitrary other stuff. if 'classes' in node.parent and 'm-figure' in node.parent['classes'] and node.next_node(descend=False, siblings=True) is not None: - self.body.append(self.starttag(node, 'span', CLASS='m-figure-description')) + self.body.append(self.starttag(node, 'div', CLASS='m-figure-description')) self.in_figure_caption_with_description = True else: self.body.append('\n') diff --git a/plugins/m/test/components/page.html b/plugins/m/test/components/page.html index e3435e66..c5cf8767 100644 --- a/plugins/m/test/components/page.html +++ b/plugins/m/test/components/page.html @@ -64,9 +64,9 @@ snippet

Math figure contents.

-
Caption +
Caption

Graph figure contents.

- +
diff --git a/plugins/m/test/dot/page-240.html b/plugins/m/test/dot/page-240.html index d00a0c77..3f14d8db 100644 --- a/plugins/m/test/dot/page-240.html +++ b/plugins/m/test/dot/page-240.html @@ -232,9 +232,9 @@ and the arrowheads, nothing else. Non-default font size should be preserved.

-
This is a title. +
This is a title.

This is a description.

- +
diff --git a/plugins/m/test/dot/page.html b/plugins/m/test/dot/page.html index 1e85bff2..32c7f6ab 100644 --- a/plugins/m/test/dot/page.html +++ b/plugins/m/test/dot/page.html @@ -232,9 +232,9 @@ and the arrowheads, nothing else. Non-default font size should be preserved.

-
This is a title. +
This is a title.

This is a description.

- +
diff --git a/plugins/m/test/images/page.html b/plugins/m/test/images/page.html index bbb6e452..a91ee47b 100644 --- a/plugins/m/test/images/page.html +++ b/plugins/m/test/images/page.html @@ -44,8 +44,8 @@

Figure:

-
A Ship -Yes. +
A Ship
+Yes.

Figure with link, scale and only a caption:

-- 2.30.2