Skip to content

Commit ab2353c

Browse files
authored
Merge pull request #1652 from RogerHaase/1648-pagetitle
add PageTitle macro that looks like H1 but not shown in TOC; fixes #1648
2 parents b235340 + ed8f65f commit ab2353c

File tree

7 files changed

+56
-6
lines changed

7 files changed

+56
-6
lines changed

src/moin/help/help-en/MoinWikiMacros.data

+15
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,21 @@ The MonthCalendar macro is for those who need a calendar wiki integration or wan
476476
For more details see [[/MonthCalendar]]
477477

478478

479+
=== PageTitle ===
480+
481+
Create a H1 look-alike that will not be included in TableOfContents.
482+
483+
'''Markup:'''
484+
485+
{{{
486+
<<PageTitle(My Page Title)>>
487+
}}}
488+
489+
'''Result'''
490+
491+
<<PageTitle(My Page Title)>>
492+
493+
479494
=== RandomItem ===
480495

481496
'''Markup:'''

src/moin/help/help-en/MoinWikiMacros.meta

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"address": "127.0.0.1",
44
"comment": "",
55
"contenttype": "text/x.moin.wiki;charset=utf-8",
6-
"dataid": "b76be52a5dab426ebf4b859e4b8902a6",
6+
"dataid": "f1524f1f521a4600b3cb55caa557b558",
77
"externallinks": [
88
"https://fontawesome.com/search?o=r&m=free",
99
"https://moinmo.in/HelpOnMacros/Include"
@@ -18,16 +18,17 @@
1818
"help-common/logo.png"
1919
],
2020
"itemtype": "default",
21-
"mtime": 1709067921,
21+
"language": "en",
22+
"mtime": 1710879680,
2223
"name": [
2324
"MoinWikiMacros"
2425
],
2526
"name_old": [],
2627
"namespace": "help-en",
2728
"rev_number": 1,
28-
"revid": "a9b8fd2812294048bc9ad128bb066323",
29-
"sha1": "78bda38d7b68fd70c5a4b2723fe465f9c987f1a5",
30-
"size": 13401,
29+
"revid": "d61a54ba4e924b418d421b6b27c74616",
30+
"sha1": "f3443067aeb6adf5ef47ec171052bfb01b0855d3",
31+
"size": 13603,
3132
"summary": "",
3233
"tags": [
3334
"macros",

src/moin/macros/PageTitle.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright: 2024 MoinMoin:RogerHaase
2+
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
3+
4+
"""
5+
Create a H1 look-alike that will not be included in TableOfContents.
6+
7+
<<PageTitle(My Page Title)>>
8+
"""
9+
10+
from moin.utils.tree import html
11+
from moin.macros._base import MacroBlockBase
12+
13+
14+
class Macro(MacroBlockBase):
15+
def macro(self, content, arguments, page_url, alternative):
16+
ret = html.div(attrib={html.class_: "moin-pagetitle"}, children=arguments[0])
17+
return ret

src/moin/static/css/common.css

+1
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ h6 { border-bottom: 3px solid var(--border); }
436436
/* trickery for use in help pages, look-alike h1 and h2 that will not appear in TOC */
437437
.h1 { font-size: 2em; margin: .67em 0; border-bottom: 5px solid var(--border); padding-bottom: 5px; }
438438
.h2 { font-size: 1.5em; margin: .75em 0; padding-bottom: 4px; border-bottom: 3px solid var(--border); }
439+
.moin-pagetitle { font-weight: bold; font-size: 2em; margin: .67em 0; border-bottom: 5px solid var(--border); padding-bottom: 5px; }
439440

440441
/* heading permalinks */
441442
.moin-permalink { opacity: .2; padding-left: .3em; }

src/moin/themes/basic/static/css/theme.css

+8
Original file line numberDiff line numberDiff line change
@@ -5915,6 +5915,14 @@ h1 {
59155915
h2 {
59165916
font-size: 1.5em;
59175917
}
5918+
.moin-pagetitle {
5919+
font-size: 1.75em;
5920+
font-weight: normal;
5921+
padding-left: 0.5em;
5922+
background-color: #E9EAEC;
5923+
border-radius: 7px;
5924+
border-bottom: 1px solid #90ADC6;
5925+
}
59185926
.btn-primary {
59195927
background-color: #90ADC6;
59205928
}

src/moin/themes/basic/static/custom-less/theme.less

+7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ h1, h2, h3, h4, h5, h6 {
3131

3232
h1 { font-size: 1.75em; }
3333
h2 { font-size: 1.5em; }
34+
.moin-pagetitle { font-size: 1.75em;
35+
font-weight: normal;
36+
padding-left: 0.5em;
37+
background-color: @theme-col-2;
38+
border-radius: 7px;
39+
border-bottom: 1px solid @theme-col-1;
40+
}
3441

3542
.btn-primary {
3643
background-color: @theme-col-1;

src/moin/themes/topside/static/css/theme.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ body { font-size: 1em; margin: 0; font-family: "Helvetica Neue", Helvetica, Aria
66
html { font-size: 1em; min-height: 100%; position: relative; }
77
#moin-footer { position: absolute; bottom: 0; }
88
#moin-content { padding-bottom: 8em; }
9-
h1 { text-align: center; }
9+
h1,
10+
.moin-pagetitle { text-align: center; }
1011

1112
a { text-decoration: none; color: #1409B9; }
1213
a:hover { text-decoration: underline; }

0 commit comments

Comments
 (0)