diff --git a/PageRevision.md b/PageRevision.md new file mode 100644 index 0000000..613e4e6 --- /dev/null +++ b/PageRevision.md @@ -0,0 +1,11 @@ +PageRevisionMacro +================= + +Show the current page name and revision number on a moinmoin wiki page + + +Usage on a MoinMoin wiki page +----------------------------- + +Adding this macro `<>` to the page will output +'SomeWikiPage, revision 123' diff --git a/PageRevision.py b/PageRevision.py new file mode 100644 index 0000000..1b363cf --- /dev/null +++ b/PageRevision.py @@ -0,0 +1,26 @@ +# -*- coding: iso-8859-1 -*- +u''' + MoinMoin - PageRevision macro Version 0.1 + Displays the revision number of the current MoinMoin page + + <> + + Repository for the macro: + https://git.cpi.imtek.uni-freiburg.de/holgi/PageRevisionMacro + + @copyright: 2018 by Holger Frey + @license: Beerware license + +''' + +from MoinMoin import wikiutil + + +def macro_PageRevision(macro): + request = macro.request + _ = request.getText + + revision = request.page.current_rev() or '' + html = '%s, revision %s' % (request.page.page_name, str(revision)) + + return macro.formatter.rawHTML(html) diff --git a/README.md b/README.md index 7975adc..b9d40c4 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,22 @@ -YouTubeVideoMacro -================= +MoinMoin Macros +================ -A macro for the MoinMoin wiki for displaying embedded YouTube videos. +A collection of macros for the [MoinMoin][moin] wiki software. -There is already a [YouTube macrco][ytm] available on the website of the -[MoinMoin wiki][moin] software. Unfortunately the last update was in 2011. -While it still works with the current MoinMoin version, the embedding relies -on old [YouTube][yt] apis and still requires Flash. -To simply embed single videos on an wiki page, this new plugin was written. -Although it has not the same features as the old one, it can be used to displaying -a single video on a wiki page. +Available Macros +---------------- + + - [YouTubeVideo](YouTubeVideo,md): + Embed a single YouTube video on a wiki page + - [PageRevision](PageRevision.md): + show the full page name and revision number of a wiki page Installation ------------ -To install the macro, copy the file `YoutubeVideo.py` into the `/path_to_wiki_instance/data/plugin/macro` directory. This method will -propably survive a MoinMoin or Python upgrade. Make shure, that the file has +To install a macro, copy the python file (`.py`) into the +`/path_to_wiki_instance/data/plugin/macro` directory. This method should +survive a MoinMoin or Python upgrade. Make shure, that the file has the right ownership and permissions. - - -Usage ------ - -On a MoinMoin wiki page, you can embed a video by calling the macro with a -YouTube video id: - - <> - -Optionally you can also provide a width and / or height parameter for the -video: - - <> - - -Remark ------- - -To respect user privacy (insofar this is possible with embedded content), the -domain `https://www.youtube-nocookie.com/` is used and related videos will not -be displayed at the end of the video. - - - -[ytm]: https://moinmo.in/MacroMarket/YouTube -[moin]: https://moinmo.in/ -[yt]: https://www.youtube.com/ diff --git a/YouToubeVideo.md b/YouToubeVideo.md new file mode 100644 index 0000000..3544fa1 --- /dev/null +++ b/YouToubeVideo.md @@ -0,0 +1,50 @@ +YouTubeVideoMacro +================= + +A macro for the MoinMoin wiki for displaying embedded YouTube videos. + +There is already a [YouTube macrco][ytm] available on the website of the +[MoinMoin wiki][moin] software. Unfortunately the last update was in 2011. +While it still works with the current MoinMoin version, the embedding relies +on old [YouTube][yt] apis and still requires Flash. + +To simply embed single videos on an wiki page, this new plugin was written. +Although it has not the same features as the old one, it can be used to displaying +a single video on a wiki page. + + +Installation +------------ + +To install the macro, copy the file `YoutubeVideo.py` into the +`/path_to_wiki_instance/data/plugin/macro` directory. This method should +survive a MoinMoin or Python upgrade. Make shure, that the file has +the right ownership and permissions. + + +Usage +----- + +On a MoinMoin wiki page, you can embed a video by calling the macro with a +YouTube video id: + + <> + +Optionally you can also provide a width and / or height parameter for the +video: + + <> + + +Remark +------ + +To respect user privacy (insofar this is possible with embedded content), the +domain `https://www.youtube-nocookie.com/` is used and related videos will not +be displayed at the end of the video. + + + +[ytm]: https://moinmo.in/MacroMarket/YouTube +[moin]: https://moinmo.in/ +[yt]: https://www.youtube.com/