emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[NEW] planner-publish.el with planner-xml (only for MUSE!) (was (Re: [em


From: Peter K . Lee
Subject: [NEW] planner-publish.el with planner-xml (only for MUSE!) (was (Re: [emacs-wiki-discuss] Muse now supports nested sections))
Date: Wed, 20 Jul 2005 11:11:37 -0400
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/22.0.50 (gnu/linux)

"Michael Olson" <address@hidden> writes:

> "Peter K.Lee" <address@hidden> writes:
>
>> However, once I realized that muse (in current form) does not handle
>> nested tags nicely, I scrapped the idea and went straight with what
>> I wanted, which was to generate HTML div tags in nested fashion for
>> publishing.
>
> I was having similar problems with the DocBook publishing style, so I
> implemented a general methodology for nested sections in Muse.  To see
> them in action, take a look at muse-docbook.el, the
> `muse-docbook-markup-strings' customizable option.
>
> In particular:
>
>  - section, section-end -- Level 1 header/section
>  - subsection, subsection-end -- Level 2 header/section
>  - subsubsection, subsubsection-end -- Level 3 header/section
>  - section-other, section-other-end -- Level 4 and up header/section
>  - section-close -- Closing tag for nested sections
>
> I've tried to implement this functionality on all known publishing
> styles, even LaTeX and TexInfo.  The new section-close string came in
> especially handy for marking up DocBook sections.
>
>> I'll take a crack at generating XML output from planner specifically
>> at first, and I guess we can take it from there.
>>
>> Any other recommendations?
>
> What you might want to do is make a new planner-specific publishing
> style, and call it something like planner-xml.  I'm going to try to
> take an initial stab at a Muse XML publishing style tomorrow, and
> hopefully planner-xml could just derive from that, much like the
> journal style derives from the html style in muse-journal.el.

I've been hacking this up for the last several days, but I think it
may merit some feedback so that we can move in the proper direction
with the XML generation support for planner (and eventually for muse).

The approach I took was similar to what you suggest above, except I
took ALL of planner publishing with me.

So, all planner publishing has been moved into planner-publish.el, and
I've derived "planner-html" style from muse "html" and defined a new
style "planner-xml", since there is no muse "xml" style at the moment.

I haven't had a chance to cough up "planner-xhtml" yet, but I figure
that would be relatively easy once the basics are moved over.

In any case, instead of the relatively 'hackish' way publishing was
implemented inside planner to use muse, I've created a full muse style
extension for planner similar to other styles inside muse (muse-html,
muse-docbook, etc.)

While at this, I integrated the 'planner-sectionalize' capabilities
into the :before style extension for planner-html and planner-xml.

I'm not sure how this will play with more general tag nesting
capability you integrated into muse, but at the moment, there should
be no conflict (since I overwrite the heading with sectional tags
before the generic muse heading handling code gets a chance).

As an addition to the sectionalization, I added a simple alist such
as:

'(("* Tasks" . "tasks")
  ("* Notes" . "notes"))

which uses the mapping to generate section tags in the form of:

<tasks>
  ...
</tasks>

<notes>
 ...
</notes>

In essence, what I attempted to do was have planner-publish use the
Muse's style regexp & markup function extensions to generate XML
representation of planner, and have the rest of extensions, tag &
strings to convert it into HTML/XHTML/... where having NO particular
tag handling extension means we will have XML representation of data.

Did that make sense?

Please take a look and play with it when you get a chance.  I have
couple of things inside that may be useful in writing up generic muse
"xml" style.

For now, planner-html seems to generate nice looking markup.

You can expect something like...  (yep, the id stuff is in now)

<div id="tasks" class="section">
     <div class="task">...</div>
     ...
</div>
<div id="notes" class="section">
     <div class="note">...</div>
     ...
</div>

With CSS, you should be able to convert tasks into tables, lists,
whatever, add scrollbars with fixed height, place it anywhere on the
page, etc.

Similar with notes, I borrowed Sacha's code that puts notes together
into groups.

On the contrary, planner-xml generates proper markup with some
glitches.

<?xml version="1.0" encoding="iso-8859-1"?>
<page type="planner">
        <title>MovingToWestLosAngeles</title>
        <author>Peter K. Lee</author>
        <maintainer></maintainer>
<!-- Page published by Emacs Muse begins here -->
<tasks><title level="1">Tasks</title>
  <section><title level="2">Apartment</title>
    <task id="" priority="B" status="open" link="2005.07.20" 
plan="HACKMovingToWestLosAngeles" date="2005.07.20">search for apartments <link 
type="url" href="MovingToWestLosAngeles.xml#1">(1)</link></task>
    <task id="" priority="B" status="open" link="" 
plan="HACKMovingToWestLosAngeles" date="">check out the night environment <link 
type="url" href="MovingToWestLosAngeles.xml#2">(2)</link></task>
  </section>
  <section><title level="2">Utilities</title>
    <task id="" priority="B" status="open" link="" 
plan="HACKMovingToWestLosAngeles" date="">cancel USI water/sewer</task>
    <task id="" priority="B" status="open" link="" 
plan="HACKMovingToWestLosAngeles" date="">cancel SCE electricity</task>
  </section>
</tasks>
<section><title level="1">Description</title>
  I am planning on making a move closer to work for both me and Helen.
</section>
<notes><title level="1">Notes</title>
  <note anchor="3" timestamp="" link="" categories=""><title level="2">Subject: 
hello (<link type="url" href="2005.07.20.xml#1">2005.07.20#1</link>)</title>
  <content>
a sample note
<link type="url" href="MovingToWestLosAngeles.xml">MovingToWestLosAngeles</link>
  </content>
  </note>
  <note anchor="2" timestamp="" link="" categories=""><title level="2">check 
out the night environment</title>
  <content>
make sure the neighborhood is safe.
  </content>
  </note>
  <note anchor="1" timestamp="" link="" categories=""><title level="2">search 
for apartments</title>
  <content>
  It appears that Culver City would be a good mid-point living area for
  both me and Helen.
  </content>
  </note>
</notes>
<!-- Page published by Emacs Muse ends here -->
</page>

You can notice above the string HACK inside plan attribute.  That's
because muse seems to ignore that the string is inside an attribute,
and attempts to change the camelcase term into a link markup.  So I
just made it so it won't do that for now.  I'm not too sure how to
make it get around that...

Also, links get marked up as part of task description string.  I'm not
sure if that's a desired behavior, but I couldn't think of a way to 
get around that.  Currently, I have it marking it up as <link
type="url" ...> but I just made that up for now as a substitute for a
proper muse "xml" Style extension.

Well, let's give it a whirl!

Cheers,

-Peter

-- 
B 01110011 01100001 01101001 01101110 01110100
----------------------------------------------
Managing Member @ CORENOVA,LLC. M:919-641-6314
- let them be, just evolve.     O:919-641-6314
----------------------------------------------
56 69 73 69 74  75 73  61 74: www.corenova.com

CORENOVA> ./freedom. intoxicating. <RET>

Attachment: planner-publish.el
Description: muse style extensions for planner


reply via email to

[Prev in Thread] Current Thread [Next in Thread]