This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: shorthand versions of common tags


Jirka Kosek <jirka@kosek.cz> writes:

>> Many of the docbook tags that have HTML equivalents seem painfully
>> verbose.  (Examples: <emphasis role="bold">, <listitem>). I was
>> wondering if it would be useful to create a wrapper stylesheet called
>> something like shorthand.xsl that would create aliases for these
>> tages. This file would simply define <li> as <listitem>, <i> or <b>
>> as <emphasis>, and so on. It would take the stylesheet to call as a
>> param, so it could work for html, chunk, fo and whatever else.

I recommend to go for Architectural Forms.

>> I'm not exactly sure how to implement this, but I'm sure it wouldn't
>> be too difficult and I could probably work it out.

Just write your customization layer.

> I think that this is not desirable. In my editor (Emacs+PSGML) there is
> no difference between typing <li> and <listitem>. In almost every editor
> you can define some short-cuts, bind macros to hot-keys and so on. IMHO
> the latter is a good way to make typing DocBook easier.

As a proof of concept I wrote these tempo template some time ago:

(require 'tempo)

(tempo-define-template "emphasis"
		       '("<emphasis>" r "</emphasis>" p))
(tempo-define-template "filename"
		       '("<filename>" r "</filename>" p))
(tempo-define-template "function"
		       '((if (y-or-n-p "Emacs Lisp? ")
                             "<function role=\"elisp\">"
                           "<function>") r "</function>"
                             p))
(tempo-define-template "wordasword"
		       '("<wordasword>" r "</wordasword>" p))

(tempo-define-template "para"
		       '(& "<para>" > n r n "</para>" > p))

(tempo-define-template "programlisting"
		       '(& "\
<programlisting format=\"linespecific\">
<![ CDATA [" n p n
"]]>
</programlisting>" n))

(tempo-define-template "varlistentry"
                       '(& > "\
<varlistentry>" n>
"<term>" r "</term>" n>
"<listitem>" n>
"<para>" n
r n
"</para>" n>
"</listitem>" n>
"</varlistentry>" % >))

(tempo-define-template "step"
      '(& "<step>" > n "<para>" > r "</para>" > n "</step>" > p))

(define-derived-mode ke-docbook-mode sgml-mode "DocBk"
  "Major mode for editing DocBook files.
Run `ke-docbook-mode-hook'.\n
\\{ke-spec-mode-map}"
  (run-hooks 'ke-docbook-mode-hook))

(define-key ke-docbook-mode-map "\C-cp" 'tempo-template-para)
(define-key ke-docbook-mode-map "\C-c\C-ce" 'tempo-template-emphasis)
(define-key ke-docbook-mode-map "\C-c\C-cf" 'tempo-template-filename)
(define-key ke-docbook-mode-map "\C-c\C-cp" 'tempo-template-programlisting)
(define-key ke-docbook-mode-map "\C-c\C-cs" 'tempo-template-step)

(easy-menu-define ke-docbook-menu ke-docbook-mode-map "DocBook Menu"
                  '("DocBk"
                    ["Emphasis" tempo-template-emphasis t]
                    ["Filename" tempo-template-filename t]
                    ["Function" tempo-template-function t]
                    ["WordAsWord" tempo-template-wordasword t]
                    "---"
                    ["Para" tempo-template-para t]
                    ["ProgramListing" tempo-template-programlisting t]
                    ["Step" tempo-template-step t]
                    ))


-- 
ke@suse.de (work) / keichwa@gmx.net (home):              |
http://www.suse.de/~ke/                                  |      ,__o
Free Translation Project:                                |    _-\_<,
http://www.iro.umontreal.ca/contrib/po/HTML/             |   (*)/'(*)

------------------------------------------------------------------
To unsubscribe from this elist send a message with the single word
"unsubscribe" in the body to: docbook-apps-request@lists.oasis-open.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]