Over break, I took the initial work of Clinton Ebadi and Charles Wang
and implemented a <src> tag.  This tag is used to colorize (using
HTML) source code of any language for which Emacs has a mode
available.  The "lang" attribute determines the mode to call on the
region.  Muse will look for the LANG-mode function, call it, and then
call htmlize.  You will need htmlize 1.34 or later for this to work.

If a non-HTML publishing style is used, this will be published the
same as an <example> region.

An example follows.

<src lang="emacs-lisp">
(defun my-erc-remove-trailing-whitespace (proc parsed)
  "Remove trailing whitespace from the current message.
Some IM clients use an OTR plug-in that sends some annoying
trailing space to the screen, so we want to mop that up."
  (let ((msg (erc-response.contents parsed)))
    (when (stringp msg)
      (setf (erc-response.contents parsed)
            (erc-replace-regexp-in-string "[[:space:]]+\\'" "" msg))
      nil)))
(add-hook 'erc-server-PRIVMSG-functions
          'my-erc-remove-trailing-whitespace)
</src>

-- 
Michael Olson -- FSF Associate Member #652 -- http://www.mwolson.org/
Interests: Lisp, text markup, protocols -- Jabber: mwolson_at_hcoop.net
  /` |\ | | | Projects: Emacs, Muse, ERC, EMMS, Planner, ErBot, DVC
 |_] | \| |_| Reclaim your digital rights by eliminating DRM.
      See http://www.defectivebydesign.org/what_is_drm for details.

Attachment: pgpgllUjRYQfW.pgp
Description: PGP signature

_______________________________________________
Muse-el-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/muse-el-discuss

Reply via email to