using creole's Image syntax for transclusions of other types

14 views
Skip to first unread message

Jim Garrison

unread,
Sep 17, 2010, 3:15:06 AM9/17/10
to creole...@googlegroups.com
At Wikiotics we plan to soon add support for both audio and video
documents on our wiki. Ideally, we'd like to allow an audio or a video
element to be included in a wiki page though creole markup.

My immediate thought was to define a few macros using creoleparser's
macro system, but after thinking for a while, I realized I would much
rather have audio and video elements be referenced using the existing
syntax currently used for image elements. If the target of the link is
an audio or video wiki resource, a <video> or <audio> element will be
used instead of <img>.

Has anybody else implemented audio and video elements on a creole wiki?
Does anyone have thoughts on this idea?

I noticed that Wikipedia, for one, uses the same syntax for both video
and image transclusions.

Assuming we determine that moving forward is a going idea, I intend to
create a fork of creoleparser where we can experiment. This effort will
ultimately lead to a patch if it seems that such a patch would be accepted.

Regards,
Jim

Stephen Day

unread,
Sep 17, 2010, 1:59:01 PM9/17/10
to creoleparser
Hi Jim,

I'm not aware of a Creole implementation that supports this. I have,
however, thought about how to support it (actually, I was considering
using the <object> element, but that was before HTML5 started to gain
major traction).

The obvious challenge for creoleparser is knowing which element to use
(img, video, audio, object?) as the markup would be the same for all
(double curly braces). I supposed a start would be to just use the
file extension of the target to make this determination, and default
to img if none is present. Going further, there could be an explicit
syntax introduced, eg. {{target|alt|type=video}}.

I think it would be a nice enhancement.

Regards,
Stephen

Jim Garrison

unread,
Sep 24, 2010, 2:09:01 PM9/24/10
to creole...@googlegroups.com
Hi Stephen,

On 09/17/2010 10:59 AM, Stephen Day wrote:
> I'm not aware of a Creole implementation that supports this. I have,
> however, thought about how to support it (actually, I was considering
> using the <object> element, but that was before HTML5 started to gain
> major traction).

I asked in #creole on Freenode, and Radomir Dopieralski mentioned that
MoinMoin actually supports this syntax for arbitrary transclusions:
http://moinmo.in/HelpOnLinking#Embedding

> The obvious challenge for creoleparser is knowing which element to use
> (img, video, audio, object?) as the markup would be the same for all
> (double curly braces). I supposed a start would be to just use the
> file extension of the target to make this determination, and default
> to img if none is present. Going further, there could be an explicit
> syntax introduced, eg. {{target|alt|type=video}}.

I think in most cases, a wiki engine will have access to the target and
will be able to decide for itself what type it is. Some wikis will do
this by looking at the file extension; others will look up the resource
in question before knowing what type it is. The proposed explicit
syntax may be useful for some wikis that actually don't know what a
resource represents, but I cannot at the moment think of any use-case
where this would be true.

I think the most flexible way to implement this feature would be to make
a user-definable function (or an easily subclassable class) that takes a
few parameters and returns a genshi Markup object. By default, this
function would return an <img> tag always; or it could default to a
function that instead returns an <audio> or <video> tag if the file
extension is recognized as such.

- Jim

Jim Garrison

unread,
Sep 21, 2010, 12:57:14 AM9/21/10
to creole...@googlegroups.com
Hi Stephen,

On 09/17/2010 10:59 AM, Stephen Day wrote:

> I'm not aware of a Creole implementation that supports this. I have,
> however, thought about how to support it (actually, I was considering
> using the <object> element, but that was before HTML5 started to gain
> major traction).

I asked in #creole on Freenode, and Radomir Dopieralski mentioned that


MoinMoin actually supports this syntax for arbitrary transclusions:
http://moinmo.in/HelpOnLinking#Embedding

> The obvious challenge for creoleparser is knowing which element to use


> (img, video, audio, object?) as the markup would be the same for all
> (double curly braces). I supposed a start would be to just use the
> file extension of the target to make this determination, and default
> to img if none is present. Going further, there could be an explicit
> syntax introduced, eg. {{target|alt|type=video}}.

I think in most cases, a wiki engine will have access to the target and

Reply all
Reply to author
Forward
0 new messages