Muse Tips

Adding new tags to muse

To: muse-el-discuss@gna.org
From: Phillip Lord <phillip.lord@newcastle.ac.uk>
Date: Thu, 12 Apr 2007 14:03:26 +0100

>>>>> "MH" == Markus Hoenicka <markus.hoenicka@mhoenicka.de> writes:

  MH> Hi Phil,

  MH> Quoting Phillip Lord <phillip.lord@newcastle.ac.uk>:

  MH> Another thing that comes to mind is that we need an additional
  MH> tag (<bib> for the sake of brevity?) to specify the location of
  MH> the bibliographic listing, unless we always want it appended at
  MH> the very end.
  >>
  >> Yeah...said that three posts back:-)
  >>

  MH> Sorry about that, it must have slipped my attention.

  MH> Now that we more or less know *what* we want, I'd like to
  MH> discuss *how* we get there. Michael has been so noticeably
  MH> silent that I suspect he's on vacation. Is there anyone else on
  MH> this list who knows the innards of muse sufficiently to get
  MH> started?


I've added some tags in the past. It's not that hard.

So....

(add-to-list 'muse-publish-markup-tags
             '("log" t t t 'ignore))


add the tag at publication level.

(add-to-list 'muse-html-markup-tags
             '("log" t t t phil-muse-log-tag))

adds the function that does stuff when publishing to HTML.

And this function does the actual work. In this case, it puts the
stuff inside the tag into a table with a image in one corner and div
tags which I stylesheet to look right.


(defun phil-muse-log-tag (beg end attrs)
  (phil-muse-table-tag beg end "log" "bigpencil.gif"))

(defun phil-muse-table-tag (beg end class image)
  (save-excursion
    (goto-char beg)
    (muse-insert-markup "<div class=\"" class "\">")
    (muse-insert-markup "<table>")
    (muse-insert-markup "<tr>")
    (muse-insert-markup "<td>")
    (muse-insert-markup "<img src=\"" image "\">" )
    (muse-insert-markup "</td>")
    (muse-insert-markup "<td>")
    (goto-char end)
    (muse-insert-markup "</td>")
    (muse-insert-markup "</tr>")
    (muse-insert-markup "</table>")
    (muse-insert-markup "</div>")))


Obviously, to do this correctly within muse, you need to add to the
relevant muse files and variables directly rather than post-hoc.

The harder part is going to be extending the various tool chains so
that they do different things when citations are in place. I've only
ever added support for HTML generation (which is what I do the
most), so there is no tool support. For citations, as I said, HTML is
actually going to be the hardest publication style to support.

Phil

and Michael Olson writes:

The first place to check is the Muse manual, Chapter 10: Extending
Muse.  In particular, Common Elements -> Markup Tags.  Since different
text will be used for different publishing styles, you'll also want to
consult Common Elements -> Markup Strings -- the idea is to add
several markup strings (which can vary according to each publishing
style) and use them.  "begin-cite" and "end-cite" would be good names
for the new markup strings.

Looking at the `muse-publish-code-tag' function in muse-publish.el
would be a good place to start.  That function uses the 'begin-literal
and 'end-literal markup strings to surround the text.

sub-sahara africa
subrahaman
sahara trip IanKnot rainbow