Junichi Uekawa <[EMAIL PROTECTED]> writes:

> Hi,
>
>> > When title contains some lisp code, it is evaluated after the
>> > content is evaluated. However, when editing the file (C-cC-l), the
>> > title will initially show 'Invalid Lisp Code' error.
>>
>> Hmm, I hadn't considered this use case before.  Do you use the <lisp>
>> tag for #title on every page, or just some of them?  Do you expect
>> the <lisp> tag to be evaluated when publishing, or left verbatim (but
>> with the angle brackets escaped)?
>
> I expect <lisp> tag to be evaluated.  I use it so that it is possible
> to configure the values for the page in one place. '#title' seems to
> be evaluated last, and thus putting the setq in the #title has never
> worked. This is why <lisp> to do the setq is on the second line.
>
> Try the following for a more lively example:
> ---
> #title Meeting number <lisp>number</lisp>: 
> <lisp>year</lisp>-<lisp>month</lisp>-<lisp>day</lisp>
> <lisp>(progn (setq year 2007 month 12 date 15 number 10) "" )</lisp>
>
> This is meeting number  <lisp>number</lisp> ....
> You are expected to turn in your entry form by <lisp>(- date 2)</lisp>

My suggestion is to do something like this:

 - Make a header file that looks like this (call it
   meeting-header.html):

_____
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
  <head>
    <title><lisp>
  (format "Meeting number %s: %s-%s-%s"
          (muse-publishing-directive "number")
          (muse-publishing-directive "month")
          (muse-publishing-directive "year")
          (muse-publishing-directive "day"))
  </lisp></title>
[...other header stuff...]
  </head>
  <body>
    <h1><lisp>
  (format "Meeting number %s: %s-%s-%s"
          (muse-publishing-directive "number")
          (muse-publishing-directive "month")
          (muse-publishing-directive "year")
          (muse-publishing-directive "day"))
  </lisp></h1>

<p>This is meeting number
<lisp>(muse-publishing-directive "number")</lisp>
</p>
<p>You are expected to turn in your entry form by
<lisp>(- (string-to-number (muse-publishing-directive "date")) 2)</lisp>
</p>
_____

 - Make meeting files that look like this:

_____
#year 2007
#month 12
#date 15
#number 10

[contents of meeting]
_____

 - Derive a "meeting" style like this in your Muse configuration:

(muse-derive-style "meeting" "xhtml"
                   :header "/path/to/meeting-header.html")

 - Use this style when publishing meetings.

(setq muse-project-alist
      '(("Meetings" ("/path/to/meetings")
         (:base "meeting" :path "/path/to/meeting-output-dir"))))

This has several advantages.

 1. The #title line isn't long.
 2. The order of operation when evaluating <lisp> tags is clear.
 3. You don't have to insert a standard template in each file.
    The content of meetings can be only that which actually changes
    between meetings.
 4. If you decide you want the meeting boilerplate to look different,
    you only have to change one file rather than many.

For now, I've addressed the problem upstream by making Muse not
interpret <lisp> tags in #title lines or comments when coloring the
buffer.  The reason for this is that the alternative -- modifying the
publishing process to support evaluating <lisp> tags in #title lines --
would be time-consuming when publishing, because Muse would have to
examine every directive for <lisp> tags.

What do you think?

-- 
       Michael Olson -- FSF Associate Member #652     |
 http://mwolson.org/ -- Jabber: mwolson_at_hcoop.net  |  /` |\ | | |
            Sysadmin -- Hobbies: Lisp, GP2X, HCoop    | |_] | \| |_|
Projects: Emacs, Muse, ERC, EMMS, ErBot, DVC, Planner |

Attachment: pgp89uv9lu970.pgp
Description: PGP signature

Reply via email to