From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: [ox, patch] Add #+SUBTITLE Date: Sat, 21 Mar 2015 00:23:55 +0100 Message-ID: <87a8z7z20k.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YZ6Gv-0003LX-DY for emacs-orgmode@gnu.org; Fri, 20 Mar 2015 19:24:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YZ6Gr-0006Fe-S6 for emacs-orgmode@gnu.org; Fri, 20 Mar 2015 19:24:09 -0400 Received: from plane.gmane.org ([80.91.229.3]:34446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YZ6Gr-0006FT-Gs for emacs-orgmode@gnu.org; Fri, 20 Mar 2015 19:24:05 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YZ6Gp-0008B8-3n for emacs-orgmode@gnu.org; Sat, 21 Mar 2015 00:24:03 +0100 Received: from 46.166.188.240 ([46.166.188.240]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 21 Mar 2015 00:24:03 +0100 Received: from rasmus by 46.166.188.240 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 21 Mar 2015 00:24:03 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, This patch adds #+SUBTITLE to a couple of backends. This property is already supported in ox-texinfo and e.g. beamer.cls has a subtitles macro, but ox-beamer.el has no #+SUBTITLE. I have used subtitles in e.g. applications for research funds. The value-added is twofold: - It adds a consistent way to have subtitle across backends. I'm explicitly assuming this is nice, but perhaps this is false. - Currently, it is, I believe, impossible to hack-up a subtitle in at least ox-odt.el. It's not documented yet as I want make sure that it's not an undesirable feature before progressing further. WDTY? —Rasmus -- The right to be left alone is a human right --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ox-Add-SUBTITLE-property-in-some-backends.patch >From 4b9ce6f4d260360847bf63f3bab9f98004bc7469 Mon Sep 17 00:00:00 2001 From: Rasmus 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 style for SUBTITLE. --- contrib/lisp/ox-deck.el | 2 ++ contrib/lisp/ox-s5.el | 2 ++ lisp/ox-ascii.el | 23 ++++++++++++++++++----- lisp/ox-beamer.el | 10 +++++++++- lisp/ox-html.el | 26 ++++++++++++++++++++------ lisp/ox-latex.el | 35 +++++++++++++++++++++++++++++++++-- lisp/ox-odt.el | 32 +++++++++++++++++++++++++++++--- lisp/ox-org.el | 9 +++++++-- 8 files changed, 120 insertions(+), 19 deletions(-) diff --git a/contrib/lisp/ox-deck.el b/contrib/lisp/ox-deck.el index 0ebde41..a76384b 100644 --- a/contrib/lisp/ox-deck.el +++ b/contrib/lisp/ox-deck.el @@ -259,6 +259,7 @@ Defaults to styles for the title page." (defcustom org-deck-title-slide-template "

%t

+

%s

%a

%e

%d

" @@ -446,6 +447,7 @@ holding export options." ;; title page (format "<%s id='title-slide' class='slide'>" (plist-get info :html-container)) + ;; TODO: format-spec isn't great for missing details. (format-spec org-deck-title-slide-template (org-html-format-spec info)) (format "" (plist-get info :html-container)) ;; toc page diff --git a/contrib/lisp/ox-s5.el b/contrib/lisp/ox-s5.el index b003919..8b28692 100644 --- a/contrib/lisp/ox-s5.el +++ b/contrib/lisp/ox-s5.el @@ -174,6 +174,7 @@ or an empty string." (defcustom org-s5-title-slide-template "

%t

+

%s

%a

%e

%d

" @@ -329,6 +330,7 @@ holding export options." ;; title page (format "<%s id='title-slide' class='slide'>" (plist-get info :html-container)) + ;; TODO: format-spec isn't great for missing details. (format-spec org-s5-title-slide-template (org-html-format-spec info)) (format "" (plist-get info :html-container)) ;; table of contents. diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index 5711b53..4f6ecbe 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -121,7 +121,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) @@ -969,9 +970,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 + (or (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))))) @@ -1014,8 +1021,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 @@ -1027,6 +1038,8 @@ INFO is a plist used as a communication channel." (concat line "\n" (unless utf8p "\n") (upcase formatted-title) + (when formatted-subtitle + (concat "\n" formatted-subtitle)) (cond ((and (org-string-nw-p author) (org-string-nw-p email)) (concat (if utf8p "\n\n\n" "\n\n") author "\n" email)) diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el index 7c42c74..193ed96 100644 --- a/lisp/ox-beamer.el +++ b/lisp/ox-beamer.el @@ -233,6 +233,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) + (:latex-subtitle-format nil nil "\\subtitle{%s}") (: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) @@ -798,7 +799,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 + (or (plist-get info :subtitle) "") + (org-element-restriction 'keyword)) + info))) (concat ;; 1. Time-stamp. (and (plist-get info :time-stamp-file) @@ -865,6 +871,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) + (format (plist-get info :latex-subtitle-format) subtitle)) ;; 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 92fe3d9..2e4692c 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) @@ -271,7 +272,7 @@ for the JavaScript code in this tag. (defconst org-html-style-default "