coleslaw-org/coleslaw

Suggestion: A plug-in entry point to process the page text (:body).

dertuxmalwieder opened this issue · 11 comments

I'd like to write a Coleslaw plug-in to allow embedding YouTube videos with a tag or something. However, the (documented?) plug-in API does not seem to provide an easy access to the page contents before rendering. (Or am I missing something?)

@dertuxmalwieder If I'm understanding you correctly you want something like Writing [[Youtube:vdwx7e]] in your post and having it expand into the embedded iframe. If so that seems to be something that should be handled at the 'text processor' (3bmd, docutils) more than by hooks.

You understand me correctly. Hooks would allow user-defined shortcodes though. Maybe add a hook which will be passed to the text processor?

The feature/plugin is something think would be very useful, but I think that Coleslaw's current plugin extension points already provides what we need. Btw 3bmd already has a youtube plugin!

How can I use that from Coleslaw?

@dertuxmalwieder You would write a plugin that just loads the 3bmd-youtube system

Hmm ... it would be nice to document how to extend 3bmd in minor ways at some point seeing as we rely on it so heavily. I can't write up such an article until Christmas (end of teaching semester) but it would be fun to do so over the holidays!

Sounds easy. Now the 3bmd docs don't tell much about how to load an extension. Meh.

I should probably take a weekend off for that. :D

@dertuxmalwieder The whole plugin is

3bmd-youtube.lisp

(eval-when (:compile-toplevel :load-toplevel)
  (ql:quickload '3bmd-youtube))

(defpackage #:coleslaw-3bmd-youtube
  (:use #:cl))

(in-package #:coleslaw-3bmd-youtube)

(defun enable ()
  )

Afterwards, if you want to embed the best video in the world you can write !yt[3SW6BD7YR6o] in your post and it will be expanded to <p><iframe ...>... Do you want to submit the plugin?

Your plug-in, your copyright. :-) But thank you!

Tested the plugin and found out that enable had to do something besides loading the system. Anyhow with this I think the issue has been address. Thanks!

Thanks for the plug-in!