[Top][All Lists]

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

Re: [Orgmode] Re: Custom docbook stylesheets.

From: Dale Smith
Subject: Re: [Orgmode] Re: Custom docbook stylesheets.
Date: Mon, 22 Jun 2009 15:05:11 -0400
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/22.1 (gnu/linux)

Dale Smith <address@hidden> writes:

>>>> The current org-export-docbook-xslt-proc-command is a format string,
>>>> with a fixed order of arguments (the fo filename and then the input
>>>> docbook filname).  Thats probably good enough for most (all?) xslt
>>>> processors, but things may be more limited when it comes to also
>>>> specifying the stylesheet.  Do we need to have some kind of special
>>>> markers in the format string for where the different options go?
>>>> Something like $i $o and $s (for in, out, and stysheet)?
>> I thought about doing something similar to make the commands easier to
>> set, but stopped pursuing that after seeing the format string style
>> worked fine.  I am not sure if any other Emacs modes/packages have done
>> something like this, i.e. using (semi)named arguments.
> Well, it took me a while, but it found it.  It's the format-spec
> function. (Actually, http://edward.oconnor.cx/2009/06/format-spec
> clued me in.)
> I'll have a go at it today and see if I can send in a patch.

Ok.  This works for me.  Docs are not updated.  That would push me
over the 10 line limit. ;^)

Now we can easily add other options, like %s for stylesheets or
whatever.  Maybe something like %p to set parameters. (As in the
--stringparam option to xsltproc).

What would be cool is a way to allow the user to *add* custom spec
chars to the default set. (hint hint)


diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el
index 8a89675..37851da 100644
--- a/lisp/org-docbook.el
+++ b/lisp/org-docbook.el
@@ -77,6 +77,7 @@
 (require 'org)
 (require 'org-exp)
 (require 'org-html)
+(require 'format-spec)
 ;;; Variables:
@@ -330,10 +331,10 @@ in a window.  A non-interactive call will only return the 
   "Export as DocBook XML file, and generate PDF file."
   (interactive "P")
   (if (or (not org-export-docbook-xslt-proc-command)
-         (not (string-match "%s.+%s" org-export-docbook-xslt-proc-command)))
+         (not (string-match "%[io].+%[io]" 
       (error "XSLT processor command is not set correctly"))
   (if (or (not org-export-docbook-xsl-fo-proc-command)
-         (not (string-match "%s.+%s" org-export-docbook-xsl-fo-proc-command)))
+         (not (string-match "%[io].+%[io]" 
       (error "XSL-FO processor command is not set correctly"))
   (message "Exporting to PDF...")
   (let* ((wconfig (current-window-configuration))
@@ -345,10 +346,10 @@ in a window.  A non-interactive call will only return the 
         (pdffile (concat base ".pdf")))
     (and (file-exists-p pdffile) (delete-file pdffile))
     (message "Processing DocBook XML file...")
-    (shell-command (format org-export-docbook-xslt-proc-command
-                          fofile (shell-quote-argument filename)))
-    (shell-command (format org-export-docbook-xsl-fo-proc-command
-                          fofile pdffile))
+    (shell-command (format-spec org-export-docbook-xslt-proc-command
+                               (format-spec-make ?o fofile ?i 
(shell-quote-argument filename))))
+    (shell-command (format-spec org-export-docbook-xsl-fo-proc-command
+                               (format-spec-make ?i fofile ?o pdffile)))
     (message "Processing DocBook file...done")
     (if (not (file-exists-p pdffile))
        (error "PDF file was not produced")

Dale P. Smith
216-447-4059 x2018
216-447-8951 FAX

(Company mandated disclaimer follows...)

The information in this e-mail and any attachments is intended solely
for use by the recipient(s) to whom this e-mail is addressed and may
contain confidential and/or privileged information which is exempt
from disclosure.  If you are not an intended recipient, or an employee
or agent responsible for delivering this message to the intended
recipient, you are hereby notified that you have received this e-mail
and any attachments in error and that dissemination, distribution,
review or copying of this e-mail and its attachments is strictly
prohibited.  If you have received this e-mail in error, please notify
the sender immediately and delete all electronic and paper copies of
this e-mail as well as any attachments.
Thank you.


reply via email to

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