Skip to content

Commit

Permalink
Merge pull request #1652 from RogerHaase/1648-pagetitle
Browse files Browse the repository at this point in the history
add PageTitle macro that looks like H1 but not shown in TOC; fixes #1648
  • Loading branch information
RogerHaase authored Mar 24, 2024
2 parents b235340 + ed8f65f commit ab2353c
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 6 deletions.
15 changes: 15 additions & 0 deletions src/moin/help/help-en/MoinWikiMacros.data
Original file line number Diff line number Diff line change
Expand Up @@ -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:'''

{{{
<<PageTitle(My Page Title)>>
}}}

'''Result'''

<<PageTitle(My Page Title)>>


=== RandomItem ===

'''Markup:'''
Expand Down
11 changes: 6 additions & 5 deletions src/moin/help/help-en/MoinWikiMacros.meta
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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",
Expand Down
17 changes: 17 additions & 0 deletions src/moin/macros/PageTitle.py
Original file line number Diff line number Diff line change
@@ -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.
<<PageTitle(My Page Title)>>
"""

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
1 change: 1 addition & 0 deletions src/moin/static/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
8 changes: 8 additions & 0 deletions src/moin/themes/basic/static/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
7 changes: 7 additions & 0 deletions src/moin/themes/basic/static/custom-less/theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/moin/themes/topside/static/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit ab2353c

Please sign in to comment.