We have something like this, we call it include a section (template)
with variables, see
https://www.pmwiki.org/wiki/PmWiki/IncludeOtherPages#includevariable
For example, you can have a hidden section [[#macro]] in the page like
this:
(:if false:)
[[#macro]]
{$$fname}\\
(:video {$$fname}.mp4 poster={$$fname}.jpg:)
[[#macroend]]
(:ifend:)
Then to insert the macro you include it:
(:include #macro fname=MyVideo:)
(:include #macro fname=OtherVideo:)
(:include #macro fname=ThirdVideo:)
The markup in the template can be more complex, you can have more
variables.
The template can also be a separate page, especially if it is included
from more than one page.
(:include Page fname=MyVideo date="May 3, 2020" size=8mb:)
The template section may contain markup expressions, wikistyles or any
other markup (except anchors*). I'd probably try for the caption:
{(asspaced "{$$fname}")}
which would output "My Video" instead of "MyVideo"
See also $MaxIncludes in the documentation.
Petko
*) You can have anchors in the included section but then the directive
needs to specify both the first and the last anchors like (:include
page#anchor#anchorend:)
On 03/05/2020 22:31, Michael Eager wrote:
Does PmWiki have any kind of a macro facility, where a page would
define a macro and use it multiple times on the page?
My use case would be to have a page which contains multiple links to
videos in a table. Using the VideoAttach recipe, each link would have
the file name of the video, the file name of the picture to display
(replacing the video file's extension with .jpg), and the caption,
which is again the file name of the video. That's a lot of tedious
repetition.
_______________________________________________
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users