-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
import19 lacks support for UserGroup and WikiDict conversion; fixes #…
…1595 Added 2 macros to display usergroup and wikidict attributes.
- Loading branch information
1 parent
149ea0f
commit 87fba6b
Showing
4 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright: 2024 MoinMoin:RogerHaase | ||
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details. | ||
|
||
""" | ||
Show contents of UserGroup attribute in metadata. | ||
""" | ||
|
||
from moin.macros._base import MacroBlockBase, fail_message | ||
from moin.items import Item | ||
from moin.constants.keys import USERGROUP | ||
from moin.i18n import _ | ||
|
||
|
||
class Macro(MacroBlockBase): | ||
def macro(self, content, arguments, page_url, alternative): | ||
url = str(page_url.path)[1:] | ||
try: | ||
item = Item.create(url) | ||
return item.meta[USERGROUP] | ||
except KeyError: | ||
msg = _('ShowUserGroup macro failed - metadata lacks "usergroup" attribute.') | ||
return fail_message(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright: 2024 MoinMoin:RogerHaase | ||
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details. | ||
|
||
""" | ||
Show contents of WikiDict attribute in metadata. | ||
""" | ||
|
||
from moin.macros._base import MacroBlockBase, fail_message | ||
from moin.items import Item | ||
from moin.constants.keys import WIKIDICT | ||
from moin.i18n import _ | ||
|
||
|
||
class Macro(MacroBlockBase): | ||
def macro(self, content, arguments, page_url, alternative): | ||
url = str(page_url.path)[1:] | ||
try: | ||
item = Item.create(url) | ||
return item.meta[WIKIDICT] | ||
except KeyError: | ||
msg = _('ShowWikiDict macro failed - metadata lacks "wikidict" attribute.') | ||
return fail_message(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters