OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Docbook Editors


On date Friday 2007-06-29 08:57:16 -0300, Fabián Mandelbaum wrote:
> Another possible solution is to use Emacs PSGML instead of NXML mode,
> with PSGML mode you have automatic insertion of the 'skeletons' you
> want when inserting 'complex' elements (like variablelist). It even
> shows you (as a comment) which are the elements the DTD expects after
> the one you've inserted, or the structure expected by it by the DTD.
> 
> http://www.lysator.liu.se/projects/about_psgml.html
> 
> http://www.linkwerk.com/pub/xml/emacs-psgml/
> 
> PSGML is a bit old and looks unmaintained but it works.
> 
> On 6/28/07, John W. Shipman <john@nmt.edu> wrote:
> >On Thu, 28 Jun 2007, Stefano Sabatini wrote:
> >
> >+--
> >| Do someone know if it's possible with emacs NXML mode to see (for
> >| example in the ECB method buffer) the layout of the document edited,
> >| for example the hierarchy of chapters and sections?
> >+--
> >
> >I wrote a little Python script to pull out the id attributes
> >of all sections.  I'd be happy to post it if you like.  It
> >doesn't handle chapters; it assumes the document is an article.
> >
> >+--
> >| And what about the insertion of complex skeletons, like that of a
> >| variablelist? There is already some way to add them with some
> >| shortcuts or is needed to hook into nxml-mode-hook all the various
> >| docbook specific skeleton insertion functions required?
> >+--
> >
> >My solution to this is to put together a collection of little
> >template files and insert them using "C-x i".  For example,
> >if I'm building a variablelist, I have two template files named
> >"varlist" containing the variablelist element, and a file "vle"
> >containing the skeleton of a varlistentry element.  
[...]
> >There's a more detailed discussion in my locally-written nxml
> >documentation:
> >
> >    http://infohost.nmt.edu/tcc/help/pubs/nxml/
> >
> >Scroll down to the section entitled "Toward faster work".

Thanks so much John and Fabián.

Here it is my solution for the variablelist and varlistentry
insertion, implemented using skeleton.el:

(defmacro read-not-empty-string (body)
  `(let ((string (read-string ,body)))
     (if (equal string "")
         nil
       string)))

(defun docbook-insert-variablelist (&optional title)
  "Insert at the current position the skeleton of a docbook variabelist entry.
If the title is specified a slot for the title we'll be also inserted."
  (interactive)
  (let* ((title (if (null title)
                    (read-not-empty-string "title of the variablelist: ")))
         (title-skeleton 
          (if title '((concat "<title>" title "</title>") > \n)
            nil)))
    (skeleton-insert 
     `(nil
       "<variablelist>"
       > \n
       ,@title-skeleton
       > _ \n
       "</variablelist>" > \n
       ))))

(defun docbook-insert-varlistentry()
  (interactive)
  (let ((term (read-not-empty-string "term of the varlistentry: ")))
    (skeleton-insert 
     '(nil
       "<varlistentry>" > \n
       "<term>" term "</term>" > \n
       "<listitem>" > \n
       "<para>" > \n
       _
       \n
       "</para>" > \n
       "</listitem>" > \n
       "</varlistentry>" > \n
       \n))))

I like NXML for its automatic validation feature (while PSGML-mode
requires an external parser, and it doesn't perform "on the fly"
validation as NXML-mode), while NXML seems to lack the completion
features of PSGML (used to fill element skeletons).

Unfortunately both seem to lack tagging feature, to show up the layout
of the document displayed, which is fundamental to me while editing a
complex document, to understand where I am and to easily jump from one
section to another one (but I have still to dig harder from the
emacswiki: http://www.emacswiki.org/cgi-bin/wiki/XmlMode 
).

Kind regards.
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]