emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [ox, patch] #+SUBTITLE


From: Rasmus
Subject: Re: [O] [ox, patch] #+SUBTITLE
Date: Sun, 29 Mar 2015 13:50:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Hi,

I've added a patch that address the code problems, but not the
documentation issues, as the solution is still unclear.

Nicolas Goaziou <address@hidden> writes:

>> But de facto KEYWORDS and DESCRIPTION were also only supported in some
>> backends.  I think it's more convenient to have these type of keywords in
>> one place.  But I don't feel strongly about this.
>
> I would like to keep a clear and somewhat future-proof rule about this:
>
>  1. A keyword a user can expect to find in all back-ends where it makes
>     sense should be defined in "ox.el". To put it differently, it can be
>     considered as a bug if a back-end could /simply/ support a keyword
>     in this category but doesn't. Keywords in this category are to be
>     documented in (info "(org)Export settings").
>
>  2. Other keywords are defined in their respective back-end, and
>     documented in their respective chapter in the manual.
>
> As a non-trivial example, consider :email. You can expect it to produce
> something sensible in any back-end. Yet, "ox-icalendar" doesn't use it.
> It still belongs to first category.
>
> If we support SUBTITLE everywhere it makes sense, it might be worth
> adding it to the first category. Actually, considering the rule above,
> I even lean towards adding it to that category. WDYT?

I think it's hard to make a clear-cut rule.  I think keywords that are
well-supported by Org-core should be there.  From a user perspective, I
think it should be close to TITLE.  Further, putting it there also signal
to external writers, e.g. ox-reveal, that they should now try to support
it.  I think SUBTITLE, KEYWORD, and DESCRIPTION is within the same
category and should be treated the same.

We could add a subsection with "text document properties" which are
keywords that are supported by the set: {ox-html, ox-ascii, ox-odt,
ox-latex}.  These would be sort of 1½ class citizens.

We can't support SUBTITLE everywhere, 'cause it simply does not make sense
(only in "text document producers" IMO).

The support of SUBTITLE is:

    W/Emacs: support is 6/9
    W/Contrib: support is 8/20
             - BTW: ox-groff seems to have some support for subtitles, but
               I'm not sure how this works, so I haven't tried to unify
               it.
             - I guess it could be added to ox-rss could support it.  Atom
               seems to support subtitle, but it does not seem rss 2.0 has
               it in its definition...  I don't know the details of RSS
               well.
    W/"the wild": for all I know the limit of the fraction is zero.

> Also, I'm going to implement the `parse-object' and `parse-element'
> behaviour we discussed in another thread, and remove
> `org-element-document-properties' (and the relative
> `org-export-document-properties') altogether. This will remove a useless
> distinction among keywords: two categories are enough.

I think this sounds very cool.  It will allow us to remove a lot of
"low-level" details from file with additional parsed keywords.

> As a side-effect, however, `org-element-context' will not show objects
> when called on TITLE and al, but that might be a good thing actually
> (there are objects in there only during export and only if considered
> export back-end makes use of them).

As mentioned, it's fine with me and nobody else complained so I think
there's no need to worry.

>>>   (and formatted-subtitle ...)
>>
>> Can you explain why (and ⋯) should be used here?
>
> It makes more obvious you are expecting a return value. `when' is
> preferred for side effects. However, this is not a hard rule, since

Thanks for the example.

—Rasmus

-- 
Don't panic!!!
>From 1c2241e4d39a619b6123cb4e69c60dcec42534ee Mon Sep 17 00:00:00 2001
From: Rasmus <address@hidden>
Date: Sun, 1 Mar 2015 22:09:19 +0100
Subject: [PATCH] ox: Add SUBTITLE property in some backends

* ox-ascii.el (org-ascii-template--document-title)
 (org-ascii-template--document-title)
 ox-deck.el (org-deck-title-slide-template)
 ox-s5.el (org-s5-title-slide-template)
 ox-html.el (org-html--build-meta-info, org-html-format-spec)
 (org-html--build-meta-info, org-html-format-spec)
 (org-html--build-meta-info, org-html-format-spec)
 ox-org.el (org), (org-org-keyword): Use SUBTITLE.
* ox-beamer.el (org-beamer-template)
  ox-html (org-html-template)
  ox-latex.el (org-latex-template)
  ox-org (org-org-template): Insert SUBTITLE.
* ox-html (org-html-preamble-format) (org-html-postamble-format):
  Update docstring.
* ox-html (org-html-style-default): Add .subtitle style and
  change .title style.
* ox-texinfo.el (org-texinfo-template): Interpret subtitle.
* org.texi (Export settings): Document SUBTITLE.
* ORG-NEWS: Add entry on SUBTITLE.

The patch adds a #+SUBTITLE keyword to ox-ascii, ox-latex, ox-html and
ox-odt.
---
 contrib/lisp/ox-deck.el |  7 +++++++
 contrib/lisp/ox-s5.el   |  7 +++++++
 doc/org.texi            | 11 ++++++++++-
 etc/ORG-NEWS            |  3 +++
 lisp/ox-ascii.el        | 22 +++++++++++++++++-----
 lisp/ox-beamer.el       | 20 +++++++++++++++++++-
 lisp/ox-html.el         | 37 +++++++++++++++++++++++++++++++------
 lisp/ox-latex.el        | 49 ++++++++++++++++++++++++++++++++++++++++++++-----
 lisp/ox-odt.el          | 32 +++++++++++++++++++++++++++++---
 lisp/ox-texinfo.el      | 10 +++++++---
 10 files changed, 174 insertions(+), 24 deletions(-)

diff --git a/contrib/lisp/ox-deck.el b/contrib/lisp/ox-deck.el
index 0ebde41..9dbd6ca 100644
--- a/contrib/lisp/ox-deck.el
+++ b/contrib/lisp/ox-deck.el
@@ -38,6 +38,12 @@
 ;; See ox.el and ox-html.el for more details on how this exporter
 ;; works (it is derived from ox-html.)
 
+;; TODOs
+;; ------
+;; The title page is formatted using format-spec.  This is error prone
+;; when details are missing and may insert empty tags, like <h2></h2>,
+;; for missing values.
+
 (require 'ox-html)
 (eval-when-compile (require 'cl))
 
@@ -259,6 +265,7 @@ Defaults to styles for the title page."
 
 (defcustom org-deck-title-slide-template
   "<h1>%t</h1>
+<h2>%s</h2>
 <h2>%a</h2>
 <h2>%e</h2>
 <h2>%d</h2>"
diff --git a/contrib/lisp/ox-s5.el b/contrib/lisp/ox-s5.el
index b003919..503bfd0 100644
--- a/contrib/lisp/ox-s5.el
+++ b/contrib/lisp/ox-s5.el
@@ -48,6 +48,12 @@
 ;; in an Org mode buffer.  See ox.el and ox-html.el for more details
 ;; on how this exporter works.
 
+;; TODOs
+;; ------
+;; The title page is formatted using format-spec.  This is error prone
+;; when details are missing and may insert empty tags, like <h2></h2>,
+;; for missing values.
+
 (require 'ox-html)
 (eval-when-compile (require 'cl))
 
@@ -174,6 +180,7 @@ or an empty string."
 
 (defcustom org-s5-title-slide-template
   "<h1>%t</h1>
+<h2>%s</h2>
 <h2>%a</h2>
 <h3>%e</h3>
 <h4>%d</h4>"
diff --git a/doc/org.texi b/doc/org.texi
index 18e5169..1f14093 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10713,6 +10713,12 @@ default value is @code{:export:}.  Within a subtree 
tagged with
 below).  When headlines are selectively exported with @code{:export:}
 anywhere in a file, text before the first headline is ignored.
 
address@hidden SUBTITLE
address@hidden #+SUBTITLE
+The document subtitle.  The keyword is supported by @LaTeX{}-backends,
+HTML backends, ASCII backends, the Texinfo backend, and the ODT backend.  You
+can use several such keywords for long subtitles.
+
 @item EXCLUDE_TAGS
 @cindex #+EXCLUDE_TAGS
 @vindex org-export-exclude-tags
@@ -11601,6 +11607,7 @@ p.author            @r{author information, including 
email}
 p.date              @r{publishing date}
 p.creator           @r{creator info, about org mode version}
 .title              @r{document title}
+.subtitle           @r{document subtitle}
 .todo               @r{TODO keywords, all not-done states}
 .done               @r{the DONE keywords, all states that count as done}
 .WAITING            @r{each TODO keyword also uses a class named after itself}
@@ -13176,7 +13183,6 @@ to define your own class in @code{org-texinfo-classes}, 
which see.  Set
 @subsubheading Title and copyright page
 
 @cindex #+TEXINFO_PRINTED_TITLE
address@hidden #+SUBTITLE
 The default template includes a title page for hard copy output.  The title
 and author displayed on this page are extracted from, respectively,
 @code{#+TITLE} and @code{#+AUTHOR} keywords (@pxref{Export settings}).  It is
@@ -13982,6 +13988,7 @@ however, override everything.
 @item @code{:beamer-frame-default-options} @tab 
@code{org-beamer-frame-default-options}
 @item @code{:beamer-outline-frame-options} @tab 
@code{org-beamer-outline-frame-options}
 @item @code{:beamer-outline-frame-title}   @tab 
@code{org-beamer-outline-frame-title}
address@hidden @code{:org-beamer-subtitle-format}   @tab 
@code{org-beamer-subtitle-format}
 @end multitable
 
 @subsubheading HTML specific properties
@@ -14066,6 +14073,8 @@ however, override everything.
 @item @code{:latex-listings}                   @tab @code{org-latex-listings}
 @item @code{:latex-minted-langs}               @tab 
@code{org-latex-minted-langs}
 @item @code{:latex-minted-options}             @tab 
@code{org-latex-minted-options}
address@hidden @code{:latex-subtitle-format}            @tab 
@code{org-latex-subtitle-format}
address@hidden @code{:latex-subtitle-separate}          @tab 
@code{org-latex-subtitle-separate}
 @item @code{:latex-table-scientific-notation}  @tab 
@code{org-latex-table-scientific-notation}
 @item @code{:latex-tables-booktabs}            @tab 
@code{org-latex-tables-booktabs}
 @item @code{:latex-tables-centered}            @tab 
@code{org-latex-tables-centered}
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 28e8394..b37650b 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -327,6 +327,9 @@ leading spaces within table cells.
 *** New MathJax configuration options.
 Org uses the MathJax CDN by default.  See the manual and the docstring
 of ~org-html-mathjax-options~ for details.
+*** New ~#+SUBTITLE~ keyword
+Org can now typeset a subtitle in some backends.  See the manual for
+details.
 ** Miscellaneous
 *** Strip all meta data from ITEM special property
 ITEM special property does not contain TODO, priority or tags anymore.
diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el
index 42495e2..5f11485 100644
--- a/lisp/ox-ascii.el
+++ b/lisp/ox-ascii.el
@@ -119,7 +119,8 @@
                                       org-ascii-filter-comment-spacing)
                   (:filter-section . org-ascii-filter-headline-blank-lines))
   :options-alist
-  '((:ascii-bullets nil nil org-ascii-bullets)
+  '((:subtitle "SUBTITLE" nil nil space)
+    (:ascii-bullets nil nil org-ascii-bullets)
     (:ascii-caption-above nil nil org-ascii-caption-above)
     (:ascii-charset nil nil org-ascii-charset)
     (:ascii-global-margin nil nil org-ascii-global-margin)
@@ -967,9 +968,15 @@ INFO is a plist used as a communication channel."
         ;; Links in the title will not be resolved later, so we make
         ;; sure their path is located right after them.
         (info (org-combine-plists info '(:ascii-links-to-notes nil)))
-        (title (if (plist-get info :with-title)
-                   (org-export-data (plist-get info :title) info)
-                 ""))
+        (with-title (plist-get info :with-title))
+        (title (org-export-data
+                (when with-title (plist-get info :title)) info))
+        (subtitle (org-export-data
+                   (when with-title
+                     (org-element-parse-secondary-string
+                      (plist-get info :subtitle)
+                      (org-element-restriction 'keyword)))
+                   info))
         (author (and (plist-get info :with-author)
                      (let ((auth (plist-get info :author)))
                        (and auth (org-export-data auth info)))))
@@ -1012,8 +1019,12 @@ INFO is a plist used as a communication channel."
       (let* ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))
             ;; Format TITLE.  It may be filled if it is too wide,
             ;; that is wider than the two thirds of the total width.
-            (title-len (min (length title) (/ (* 2 text-width) 3)))
+            (title-len (min (max (length title)
+                                 (length subtitle))
+                            (/ (* 2 text-width) 3)))
             (formatted-title (org-ascii--fill-string title title-len info))
+            (formatted-subtitle (when (org-string-nw-p subtitle)
+                                  (org-ascii--fill-string subtitle title-len 
info)))
             (line
              (make-string
               (min (+ (max title-len
@@ -1025,6 +1036,7 @@ INFO is a plist used as a communication channel."
         (concat line "\n"
                 (unless utf8p "\n")
                 (upcase formatted-title)
+                (and formatted-subtitle (concat "\n" formatted-subtitle))
                 (cond
                  ((and (org-string-nw-p author) (org-string-nw-p email))
                   (concat "\n\n" author "\n" email))
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index 5d0b55d..b9b3e8c 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -133,6 +133,16 @@ You might want to put e.g. \"allowframebreaks=0.9\" here."
   :type '(string :tag "Outline frame options"))
 
 
+(defcustom org-beamer-subtitle-format "\\subtitle{%s}"
+  "Format string used for transcoded subtitle.
+The format string should have at most one \"%s\"-expression,
+which is replaced with the subtitle."
+  :group 'org-export-beamer
+  :version "25.1"
+  :package-version '(Org . "8.3")
+  :type '(string :tag "Format string"))
+
+
 
 ;;; Internal Variables
 
@@ -233,6 +243,7 @@ Return overlay specification, as a string, or nil."
   :options-alist
   '((:headline-levels nil "H" org-beamer-frame-level)
     (:latex-class "LATEX_CLASS" nil "beamer" t)
+    (:beamer-subtitle-format nil nil org-beamer-subtitle-format)
     (:beamer-column-view-format "COLUMNS" nil org-beamer-column-view-format)
     (:beamer-theme "BEAMER_THEME" nil org-beamer-theme)
     (:beamer-color-theme "BEAMER_COLOR_THEME" nil nil t)
@@ -810,7 +821,12 @@ information."
   "Return complete document string after Beamer conversion.
 CONTENTS is the transcoded contents string.  INFO is a plist
 holding export options."
-  (let ((title (org-export-data (plist-get info :title) info)))
+  (let ((title (org-export-data (plist-get info :title) info))
+       (subtitle (org-export-data
+                  (org-element-parse-secondary-string
+                   (plist-get info :subtitle)
+                   (org-element-restriction 'keyword))
+                  info)))
     (concat
      ;; 1. Time-stamp.
      (and (plist-get info :time-stamp-file)
@@ -877,6 +893,8 @@ holding export options."
        (format "\\date{%s}\n" (org-export-data date info)))
      ;; 7. Title
      (format "\\title{%s}\n" title)
+     (when (org-string-nw-p subtitle)
+       (concat (format (plist-get info :beamer-subtitle-format) subtitle) 
"\n"))
      ;; 8. Beamer-header
      (let ((beamer-header (plist-get info :beamer-header)))
        (when beamer-header
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 7ed73f6..29cf9a4 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -108,7 +108,8 @@
              (if a (org-html-export-to-html t s v b)
                (org-open-file (org-html-export-to-html nil s v b)))))))
   :options-alist
-  '((:html-doctype "HTML_DOCTYPE" nil org-html-doctype)
+  '((:subtitle "SUBTITLE" nil nil space)
+    (:html-doctype "HTML_DOCTYPE" nil org-html-doctype)
     (:html-container "HTML_CONTAINER" nil org-html-container-element)
     (:html-html5-fancy nil "html5-fancy" org-html-html5-fancy)
     (:html-link-use-abs-url nil "html-link-use-abs-url" 
org-html-link-use-abs-url)
@@ -270,7 +271,12 @@ for the JavaScript code in this tag.
 (defconst org-html-style-default
   "<style type=\"text/css\">
  <!--/*--><![CDATA[/*><!--*/
-  .title  { text-align: center; }
+  .title  { text-align: center;
+             margin-bottom: .2em; }
+  .subtitle { text-align: center;
+              font-size: medium;
+              font-weight: bold;
+              margin-top:0; }
   .todo   { font-family: monospace; color: red; }
   .done   { font-family: monospace; color: green; }
   .priority { font-family: monospace; color: orange; }
@@ -1209,6 +1215,7 @@ The second element of each list is a format string to 
format the
 postamble itself.  This format string can contain these elements:
 
   %t stands for the title.
+  %s stands for the subtitle.
   %a stands for the author's name.
   %e stands for the author's email.
   %d stands for the date.
@@ -1273,6 +1280,7 @@ The second element of each list is a format string to 
format the
 preamble itself.  This format string can contain these elements:
 
   %t stands for the title.
+  %s stands for the subtitle.
   %a stands for the author's name.
   %e stands for the author's email.
   %d stands for the date.
@@ -1725,6 +1733,10 @@ INFO is a plist used as a communication channel."
   "Return format specification for elements that can be
 used in the preamble or postamble."
   `((?t . ,(org-export-data (plist-get info :title) info))
+    (?s . ,(org-export-data (org-element-parse-secondary-string
+                            (plist-get info :subtitle)
+                            (org-element-restriction 'keyword))
+                           info))
     (?d . ,(org-export-data (org-export-get-date info) info))
     (?T . ,(format-time-string
            (plist-get info :html-metadata-timestamp-format)))
@@ -1865,10 +1877,23 @@ holding export options."
      (format "<%s id=\"%s\">\n" (nth 1 div) (nth 2 div)))
    ;; Document title.
    (when (plist-get info :with-title)
-     (let ((title (org-export-data
-                  (or (plist-get info :title) "") info)))
-       (when (org-string-nw-p title)
-        (format "<h1 class=\"title\">%s</h1>\n" title))))
+     (let ((title (plist-get info :title))
+          (subtitle (org-element-parse-secondary-string
+                     (plist-get info :subtitle)
+                     (org-element-restriction 'keyword))))
+       (when title
+        (format
+         (if (plist-get info :html-html5-fancy)
+             "<header>\n<h1 class=\"title\">%s</h1>\n%s</header>"
+           "<h1 class=\"title\">%s%s</h1>\n")
+         (org-export-data title info)
+         (if subtitle
+             (format
+              (if (plist-get info :html-html5-fancy)
+                  "<p class=\"subtitle\">%s</p>\n"
+                "\n<br>\n<span class=\"subtitle\">%s</span>\n")
+              (org-export-data subtitle info))
+           "")))))
    contents
    (format "</%s>\n" (nth 1 (assq 'content (plist-get info :html-divs))))
    ;; Postamble.
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 51ba042..6b99162 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -108,6 +108,7 @@
     (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
     (:latex-header "LATEX_HEADER" nil nil newline)
     (:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline)
+    (:subtitle "SUBTITLE" nil nil space)
     ;; Other variables.
     (:latex-active-timestamp-format nil nil org-latex-active-timestamp-format)
     (:latex-caption-above nil nil org-latex-caption-above)
@@ -133,6 +134,8 @@
     (:latex-listings-options nil nil org-latex-listings-options)
     (:latex-minted-langs nil nil org-latex-minted-langs)
     (:latex-minted-options nil nil org-latex-minted-options)
+    (:latex-subtitle-format nil nil org-latex-subtitle-format)
+    (:latex-subtitle-separate nil nil org-latex-subtitle-separate)
     (:latex-table-scientific-notation nil nil 
org-latex-table-scientific-notation)
     (:latex-tables-booktabs nil nil org-latex-tables-booktabs)
     (:latex-tables-centered nil nil org-latex-tables-centered)
@@ -386,6 +389,7 @@ This format string may contain these elements:
 
   %a for AUTHOR keyword
   %t for TITLE keyword
+  %s for SUBTITLE keyword
   %k for KEYWORDS line
   %d for DESCRIPTION line
   %c for CREATOR line
@@ -401,6 +405,22 @@ precedence over this variable."
   :group 'org-export-latex
   :type '(string :tag "Format string"))
 
+(defcustom org-latex-subtitle-format "\\\\\\smallskip\n\\large %s"
+  "Format string used for transcoded subtitle.
+The format string should have at most one \"%s\"-expression,
+which is replaced with the subtitle."
+  :group 'org-export-latex
+  :version "25.1"
+  :package-version '(Org . "8.3")
+  :type '(string :tag "Format string"))
+
+(defcustom org-latex-subtitle-separate nil
+  "Non-nil means the subtitle is not typeset as part of title."
+  :group 'org-export-latex
+  :version "25.1"
+  :package-version '(Org . "8.3")
+  :type 'boolean)
+
 (defcustom org-latex-toc-command "\\tableofcontents\n\n"
   "LaTeX command to set the table of contents, list of figures, etc.
 This command only applies to the table of contents generated with
@@ -417,6 +437,7 @@ This format string may contain these elements:
 
   %a for AUTHOR keyword
   %t for TITLE keyword
+  %s for SUBTITLE keyword
   %k for KEYWORDS line
   %d for DESCRIPTION line
   %c for CREATOR line
@@ -1225,9 +1246,14 @@ INFO is a plist used as a communication channel."
                        verbatim))
        (language (let ((lang (plist-get info :language)))
                    (or (cdr (assoc lang org-latex-babel-language-alist))
-                       lang))))
-    `((?a . ,(org-export-data (plist-get info :author) info))
-      (?t . ,(org-export-data (plist-get info :title)  info))
+                       lang ""))))
+    `((?a . ,(or (org-export-data (plist-get info :author) info) ""))
+      (?t . ,(or (org-export-data (plist-get info :title)  info) ""))
+      (?s . ,(or (org-export-data
+                 (org-element-parse-secondary-string
+                  (plist-get info :subtitle)
+                  (org-element-restriction 'keyword))
+                 info) ""))
       (?k . ,(org-export-data (org-latex--wrap-latex-math-block
                               (org-element-parse-secondary-string
                                (plist-get info :keywords) objects)
@@ -1295,8 +1321,21 @@ holding export options."
      ;; Date.
      (let ((date (and (plist-get info :with-date) (org-export-get-date info))))
        (format "\\date{%s}\n" (org-export-data date info)))
-     ;; Title
-     (format "\\title{%s}\n" title)
+     ;; Title and subtitle.
+     (let* ((subtitle
+            (org-element-parse-secondary-string
+             (plist-get info :subtitle)
+             (org-element-restriction 'keyword)))
+           (formatted-subtitle
+            (when subtitle
+              (format (plist-get info :latex-subtitle-format)
+                      (org-export-data subtitle info))))
+           (separate (plist-get info :latex-subtitle-separate)))
+       (concat
+       (format "\\title{%s%s}\n" title
+               (if separate "" formatted-subtitle))
+       (when (and separate subtitle) formatted-subtitle)))
+
      ;; Hyperref options.
      (let ((template (plist-get info :latex-hyperref-template)))
        (and (stringp template)
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 02d3f44..5923d4a 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -96,7 +96,8 @@
              (if a (org-odt-export-to-odt t s v)
                (org-open-file (org-odt-export-to-odt nil s v) 'system))))))
   :options-alist
-  '((:odt-styles-file "ODT_STYLES_FILE" nil nil t)
+  '((:subtitle "SUBTITLE" nil nil space)
+    (:odt-styles-file "ODT_STYLES_FILE" nil nil t)
     ;; Other variables.
     (:odt-content-template-file nil nil org-odt-content-template-file)
     (:odt-display-outline-level nil nil org-odt-display-outline-level)
@@ -1326,6 +1327,11 @@ CONTENTS is the transcoded contents string.  RAW-DATA is 
the
 original parsed data.  INFO is a plist holding export options."
   ;; Write meta file.
   (let ((title (org-export-data (plist-get info :title) info))
+       (subtitle (org-export-data
+                  (org-element-parse-secondary-string
+                   (plist-get info :subtitle)
+                   (org-element-restriction 'keyword))
+                  info))
        (author (let ((author (plist-get info :author)))
                  (if (not author) "" (org-export-data author info))))
        (email (plist-get info :email))
@@ -1363,6 +1369,10 @@ original parsed data.  INFO is a plist holding export 
options."
       (format "<meta:keyword>%s</meta:keyword>\n" keywords)
       (format "<dc:subject>%s</dc:subject>\n" description)
       (format "<dc:title>%s</dc:title>\n" title)
+      (when (org-string-nw-p subtitle)
+       (format
+        "<meta:user-defined meta:name=\"subtitle\">%s</meta:user-defined>"
+        subtitle))
       "\n"
       "  </office:meta>\n" "</office:document-meta>")
      nil (concat org-odt-zip-dir "meta.xml"))
@@ -1508,6 +1518,12 @@ original parsed data.  INFO is a plist holding export 
options."
       (insert
        (let* ((title (and (plist-get info :with-title)
                          (org-export-data (plist-get info :title) info)))
+             (subtitle (when title
+                         (org-export-data
+                          (org-element-parse-secondary-string
+                           (plist-get info :subtitle)
+                           (org-element-restriction 'keyword))
+                          info)))
              (author (and (plist-get info :with-author)
                           (let ((auth (plist-get info :author)))
                             (and auth (org-export-data auth info)))))
@@ -1519,10 +1535,20 @@ original parsed data.  INFO is a plist holding export 
options."
          ;; Title.
          (when (org-string-nw-p title)
            (concat
-            (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
+            (format "\n<text:p text:style-name=\"%s\">%s</text:p>\n"
                     "OrgTitle" (format "\n<text:title>%s</text:title>" title))
             ;; Separator.
-            "\n<text:p text:style-name=\"OrgTitle\"/>"))
+            "\n<text:p text:style-name=\"OrgTitle\"/>\n"
+            ;; Subtitle.
+            (when (org-string-nw-p subtitle)
+              (concat
+               (format "<text:p 
text:style-name=\"OrgSubtitle\">\n%s\n</text:p>\n"
+                       (concat
+                        "<text:user-defined style:data-style-name=\"N0\" 
text:name=\"subtitle\">\n"
+                        subtitle
+                        "</text:user-defined>\n"))
+               ;; Separator.
+               "<text:p text:style-name=\"OrgSubtitle\"/>"))))
          (cond
           ((and author (not email))
            ;; Author only.
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 140e217..e2708c7 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -570,9 +570,13 @@ holding export options."
        (concat
        (format "@title %s\n" (or (plist-get info :texinfo-printed-title) title 
""))
        (let ((subtitle (plist-get info :subtitle)))
-         (and subtitle
-              (org-element-normalize-string
-               (replace-regexp-in-string "^" "@subtitle " subtitle))))))
+         (when subtitle
+           (format "@subtitle %s\n"
+                   (org-export-data
+                    (org-element-parse-secondary-string
+                     subtitle
+                     (org-element-restriction 'keyword))
+                    info))))))
      (when (plist-get info :with-author)
        (concat
        ;; Primary author.
-- 
2.3.4


reply via email to

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