Re: [O] [patch, ox] suppress title
Hello, ** Rasmus [2015-02-12 01:47:06 +0100]: > Nicolas Goaziou writes: > >> Rasmus writes: >> >>> Nicolas Goaziou writes: >>> Could you also add a test in `test-org-export/handle-options'? >>> >>> How would I make this test proper? >> >> You can't, my bad. It is obviously handled at the back-end level. > > OK pushed without that then. e6fcc853. Please consider the attached small patch for org.texi P.S. It would be nice to test not only changes in *.el files but also test building process. --- WBR, Vladimir Lomov -- The only thing worse than X Windows: (X Windows) - X diff --git a/doc/org.texi b/doc/org.texi index 406579b..f02fca8 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -10818,7 +10818,6 @@ Toggle inclusion of TODO keywords into exported text @item |: @vindex org-export-with-tables Toggle inclusion of tables (@code{org-export-with-tables}). -@end table @item title: @vindex org-export-with-titles
Re: [O] [patch, ox] suppress title
Nicolas Goaziou writes: > Rasmus writes: > >> Nicolas Goaziou writes: >> >>> Could you also add a test in `test-org-export/handle-options'? >> >> How would I make this test proper? > > You can't, my bad. It is obviously handled at the back-end level. OK pushed without that then. e6fcc853. —Rasmus -- Slowly unravels in a ball of yarn and the devil collects it
Re: [O] [patch, ox] suppress title
Rasmus writes: > Nicolas Goaziou writes: > >> Could you also add a test in `test-org-export/handle-options'? > > How would I make this test proper? You can't, my bad. It is obviously handled at the back-end level. Regards,
Re: [O] [patch, ox] suppress title
Nicolas Goaziou writes: > Could you also add a test in `test-org-export/handle-options'? How would I make this test proper? I can't use org-test-default-backend since it only loads the transcoder functions, not the template which is where I disable the title. I can think of the following or writing a mini template that just check :with-title, but that feels like cheating... ;; Test title. (should (equal "" (org-test-with-temp-text "#+TITLE: foo" (org-export-as (org-export-create-backend :transcoders '((title. org-org-identity) (template . org-org-template))) nil nil nil '(:with-title nil :with-creator nil :with-author nil :with-date nil :time-stamp-file nil) (should (equal "#+TITLE: foo" (org-trim (org-test-with-temp-text "#+TITLE: foo" (org-export-as (org-export-create-backend :transcoders '((title. org-org-identity) (template . org-org-template))) nil nil nil '(:with-title t :with-creator nil :with-author nil :with-date nil :time-stamp-file nil)) -- With monopolies the cake is a lie!
Re: [O] [patch, ox] suppress title
Hello, Rasmus writes: > Sometime when requiring custom formatting of the header for a document, it > would be nice to be able to use #+TITLE without triggering the insertion > of the tile (e.g. \maketitle in latex and title in ox-html). For > instance, one might have special org-html-preamble code. This patch adds > an "#+OPTIONS: title:{nil,t}" option. Nice, thanks. The usual nitpicking follows. > - (let ((subtitle1 (plist-get attr :subtitle1)) > + (let ((title (if (plist-get info :with-title) > + title "")) Nitpick: (title (if (plist-get info :with-title) title "")) or (title (if (plist-get info :with-title) title "")) or (title (if (plist-get info :with-title) title "")) > +(make-obsolete-variable 'org-koma-letter-use-title > + 'Org-export-with-title Typo. > + (cond ((null (plist-get info :with-title)) nil) Nitpick: (not (plist-get info :with-title)) This is considered as a boolean, not as a list. > - (cond ((string= "" title) nil) > + (cond ((null (plist-get info :with-title)) nil) See above. > (defcustom org-export-time-stamp-file t >"Non-nil means insert a time stamp into the exported file. > The time stamp shows when the file was created. This option can > diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el > index 79b5c69..4a74ab3 100644 > --- a/testing/lisp/test-ox.el > +++ b/testing/lisp/test-ox.el > @@ -111,7 +111,7 @@ variable, and communication channel under `info'." > (org-export--parse-option-keyword > "H:1 num:t \\n:t timestamp:t arch:t author:t creator:t d:t email:t > *:t e:t ::t f:t pri:t -:t ^:t toc:t |:t tags:t tasks:t <:t todo:t inline:nil > - stat:t") > + stat:t title:t") > '(:headline-levels >1 :preserve-breaks t :section-numbers t :time-stamp-file t >:with-archived-trees t :with-author t :with-creator t :with-drawers t > @@ -119,7 +119,7 @@ variable, and communication channel under `info'." >:with-footnotes t :with-inlinetasks nil :with-priority t >:with-special-strings t :with-statistics-cookies t > :with-sub-superscript t >:with-toc t :with-tables t :with-tags t :with-tasks t :with-timestamps > t > - :with-todo-keywords t))) > + :with-title t :with-todo-keywords t))) >;; Test some special values. >(should > (equal Could you also add a test in `test-org-export/handle-options'? This also requires a proper ORG-NEWS entry. Regards, -- Nicolas Goaziou
[O] [patch, ox] suppress title
Hi, Sometime when requiring custom formatting of the header for a document, it would be nice to be able to use #+TITLE without triggering the insertion of the tile (e.g. \maketitle in latex and title in ox-html). For instance, one might have special org-html-preamble code. This patch adds an "#+OPTIONS: title:{nil,t}" option. Any objections? Thanks, Rasmus -- If you can mix business and politics wonderful things can happen! >From 94a3415fecb3976edc4fa3d4a5078a33774326ae Mon Sep 17 00:00:00 2001 From: Rasmus Date: Wed, 11 Feb 2015 00:09:39 +0100 Subject: [PATCH] ox: Optional export of title * ox.el (org-export-with-title): New variable. * ox (org-export-options-alist), ox-ascii.el (org-ascii-template--document-title), ox-beamer.el (org-beamer-template), ox-html.el (org-html-template), ox-latex.el (org-latex-template), ox-man.el (org-man-template), ox-odt.el (org-odt-template), ox-org.el (org-org-template), ox-publish.el (org-publish-project-alist), ox-texinfo.el (org-texinfo-template), ox-groff.el (org-groff--mt-head): Use new variable. * ox-koma-letter.el (org-koma-letter-use-title): Mark obsolete. * test-ox.el (test-org-export/parse-option-keyword): Add :with-title. This is useful in e.g. ox-html where title can be set via `org-html-preamble-template' or when using the {{{title}}}-macro. --- contrib/lisp/ox-groff.el | 4 +++- contrib/lisp/ox-koma-letter.el | 14 +++--- lisp/ox-ascii.el | 4 +++- lisp/ox-beamer.el | 3 ++- lisp/ox-html.el| 7 --- lisp/ox-latex.el | 3 ++- lisp/ox-man.el | 3 ++- lisp/ox-odt.el | 3 ++- lisp/ox-org.el | 3 ++- lisp/ox-publish.el | 3 ++- lisp/ox-texinfo.el | 11 ++- lisp/ox.el | 10 ++ testing/lisp/test-ox.el| 4 ++-- 13 files changed, 43 insertions(+), 29 deletions(-) diff --git a/contrib/lisp/ox-groff.el b/contrib/lisp/ox-groff.el index b618395..31b4e0f 100644 --- a/contrib/lisp/ox-groff.el +++ b/contrib/lisp/ox-groff.el @@ -563,7 +563,9 @@ See `org-groff-text-markup-alist' for details." (t (format ".AF \"%s\" \n" (or org-groff-organization "") ;; 2. Title - (let ((subtitle1 (plist-get attr :subtitle1)) + (let ((title (if (plist-get info :with-title) + title "")) + (subtitle1 (plist-get attr :subtitle1)) (subtitle2 (plist-get attr :subtitle2))) (cond diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el index de40fe6..ed556a8 100644 --- a/contrib/lisp/ox-koma-letter.el +++ b/contrib/lisp/ox-koma-letter.el @@ -338,16 +338,6 @@ This option can also be set with the OPTIONS keyword, e.g.: :group 'org-export-koma-letter :type 'boolean) -(defcustom org-koma-letter-use-title t - "Non-nil means use a title in the letter if present. -This option can also be set with the OPTIONS keyword, -e.g. \"title:nil\". - -See also `org-koma-letter-prefer-subject' for the handling of -title versus subject." - :group 'org-export-koma-letter - :type 'boolean) - (defcustom org-koma-letter-default-class "default-koma-letter" "Default class for `org-koma-letter'. The value must be a member of `org-latex-classes'." @@ -383,6 +373,9 @@ was not present." (defvar org-koma-letter-special-contents nil "Holds special content temporarily.") +(make-obsolete-variable 'org-koma-letter-use-title + 'Org-export-with-title + "25.1" 'set) ;;; Define Back-End @@ -418,7 +411,6 @@ was not present." (:with-phone nil "phone" org-koma-letter-use-phone) (:with-place nil "place" org-koma-letter-use-place) (:with-subject nil "subject" org-koma-letter-subject-format) -(:with-title nil "title" org-koma-letter-use-title) (:with-title-as-subject nil "title-subject" org-koma-letter-prefer-subject) ;; Special properties non-nil when a setting happened in buffer. ;; They are used to prioritize in-buffer settings over "lco" diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index f7bc319..c4b34cb 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -969,7 +969,9 @@ 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 (org-export-data (plist-get info :title) info)) + (title (if (plist-get info :with-title) + (org-export-data (plist-get info :title) info) + "")) (author (and (plist-get info :with-author) (let ((auth (plist-get info :author))) (and auth (org-export-data auth info) diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el index f53b359..1d23746 100644 --- a/lisp/ox-beamer.el +++ b/lisp/ox-beamer.el @@ -877,7 +877,8 @@ holding export options." "\\begin{document}\n\n" ;; 10. Title command. (org-element-normalize-string - (cond ((string=