From ed8f65f6e10943d12832a320dc0ed4eaa9e5d795 Mon Sep 17 00:00:00 2001 From: RogerHaase Date: Sat, 23 Mar 2024 12:33:04 -0700 Subject: [PATCH] add PageTitle macro that looks like H1 but not shown in TOC; fixes #1648 --- src/moin/help/help-en/MoinWikiMacros.data | 15 +++++++++++++++ src/moin/help/help-en/MoinWikiMacros.meta | 11 ++++++----- src/moin/macros/PageTitle.py | 17 +++++++++++++++++ src/moin/static/css/common.css | 1 + src/moin/themes/basic/static/css/theme.css | 8 ++++++++ .../themes/basic/static/custom-less/theme.less | 7 +++++++ src/moin/themes/topside/static/css/theme.css | 3 ++- 7 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 src/moin/macros/PageTitle.py diff --git a/src/moin/help/help-en/MoinWikiMacros.data b/src/moin/help/help-en/MoinWikiMacros.data index 75c0f7062..eedc4f3fc 100644 --- a/src/moin/help/help-en/MoinWikiMacros.data +++ b/src/moin/help/help-en/MoinWikiMacros.data @@ -476,6 +476,21 @@ The MonthCalendar macro is for those who need a calendar wiki integration or wan For more details see [[/MonthCalendar]] +=== PageTitle === + +Create a H1 look-alike that will not be included in TableOfContents. + +'''Markup:''' + +{{{ +<> +}}} + +'''Result''' + +<> + + === RandomItem === '''Markup:''' diff --git a/src/moin/help/help-en/MoinWikiMacros.meta b/src/moin/help/help-en/MoinWikiMacros.meta index 50fec5d76..4f201f5cd 100644 --- a/src/moin/help/help-en/MoinWikiMacros.meta +++ b/src/moin/help/help-en/MoinWikiMacros.meta @@ -3,7 +3,7 @@ "address": "127.0.0.1", "comment": "", "contenttype": "text/x.moin.wiki;charset=utf-8", - "dataid": "b76be52a5dab426ebf4b859e4b8902a6", + "dataid": "f1524f1f521a4600b3cb55caa557b558", "externallinks": [ "https://fontawesome.com/search?o=r&m=free", "https://moinmo.in/HelpOnMacros/Include" @@ -18,16 +18,17 @@ "help-common/logo.png" ], "itemtype": "default", - "mtime": 1709067921, + "language": "en", + "mtime": 1710879680, "name": [ "MoinWikiMacros" ], "name_old": [], "namespace": "help-en", "rev_number": 1, - "revid": "a9b8fd2812294048bc9ad128bb066323", - "sha1": "78bda38d7b68fd70c5a4b2723fe465f9c987f1a5", - "size": 13401, + "revid": "d61a54ba4e924b418d421b6b27c74616", + "sha1": "f3443067aeb6adf5ef47ec171052bfb01b0855d3", + "size": 13603, "summary": "", "tags": [ "macros", diff --git a/src/moin/macros/PageTitle.py b/src/moin/macros/PageTitle.py new file mode 100644 index 000000000..f6b5b6439 --- /dev/null +++ b/src/moin/macros/PageTitle.py @@ -0,0 +1,17 @@ +# Copyright: 2024 MoinMoin:RogerHaase +# License: GNU GPL v2 (or any later version), see LICENSE.txt for details. + +""" +Create a H1 look-alike that will not be included in TableOfContents. + +<> +""" + +from moin.utils.tree import html +from moin.macros._base import MacroBlockBase + + +class Macro(MacroBlockBase): + def macro(self, content, arguments, page_url, alternative): + ret = html.div(attrib={html.class_: "moin-pagetitle"}, children=arguments[0]) + return ret diff --git a/src/moin/static/css/common.css b/src/moin/static/css/common.css index 5e560891f..90f62cbd3 100644 --- a/src/moin/static/css/common.css +++ b/src/moin/static/css/common.css @@ -436,6 +436,7 @@ h6 { border-bottom: 3px solid var(--border); } /* trickery for use in help pages, look-alike h1 and h2 that will not appear in TOC */ .h1 { font-size: 2em; margin: .67em 0; border-bottom: 5px solid var(--border); padding-bottom: 5px; } .h2 { font-size: 1.5em; margin: .75em 0; padding-bottom: 4px; border-bottom: 3px solid var(--border); } +.moin-pagetitle { font-weight: bold; font-size: 2em; margin: .67em 0; border-bottom: 5px solid var(--border); padding-bottom: 5px; } /* heading permalinks */ .moin-permalink { opacity: .2; padding-left: .3em; } diff --git a/src/moin/themes/basic/static/css/theme.css b/src/moin/themes/basic/static/css/theme.css index 24c442af9..a425c8e47 100644 --- a/src/moin/themes/basic/static/css/theme.css +++ b/src/moin/themes/basic/static/css/theme.css @@ -5915,6 +5915,14 @@ h1 { h2 { font-size: 1.5em; } +.moin-pagetitle { + font-size: 1.75em; + font-weight: normal; + padding-left: 0.5em; + background-color: #E9EAEC; + border-radius: 7px; + border-bottom: 1px solid #90ADC6; +} .btn-primary { background-color: #90ADC6; } diff --git a/src/moin/themes/basic/static/custom-less/theme.less b/src/moin/themes/basic/static/custom-less/theme.less index 6fb0979e7..d9f9c7dea 100644 --- a/src/moin/themes/basic/static/custom-less/theme.less +++ b/src/moin/themes/basic/static/custom-less/theme.less @@ -31,6 +31,13 @@ h1, h2, h3, h4, h5, h6 { h1 { font-size: 1.75em; } h2 { font-size: 1.5em; } +.moin-pagetitle { font-size: 1.75em; + font-weight: normal; + padding-left: 0.5em; + background-color: @theme-col-2; + border-radius: 7px; + border-bottom: 1px solid @theme-col-1; +} .btn-primary { background-color: @theme-col-1; diff --git a/src/moin/themes/topside/static/css/theme.css b/src/moin/themes/topside/static/css/theme.css index 569baad1b..b686fdfbb 100644 --- a/src/moin/themes/topside/static/css/theme.css +++ b/src/moin/themes/topside/static/css/theme.css @@ -6,7 +6,8 @@ body { font-size: 1em; margin: 0; font-family: "Helvetica Neue", Helvetica, Aria html { font-size: 1em; min-height: 100%; position: relative; } #moin-footer { position: absolute; bottom: 0; } #moin-content { padding-bottom: 8em; } -h1 { text-align: center; } +h1, +.moin-pagetitle { text-align: center; } a { text-decoration: none; color: #1409B9; } a:hover { text-decoration: underline; }