emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: No title in org-export-as-odt
@ 2012-09-24  6:03 Miguel Ruiz
  2012-09-24  6:42 ` Nick Dokos
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Miguel Ruiz @ 2012-09-24  6:03 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

 
> Miguel Ruiz <rbenit68@yahoo.es>
> writes:
> 
> > Any hint to get rid of the title in a org-export-as-odt
> session?
> 
> I don't think you can


org-odt-format-preamble function says:

...
(when title
       (concat
    (org-odt-format-stylized-paragraph
     'title (org-odt-format-tags
         '("<text:title>" . "</text:title>") title))
    ;; separator
    "<text:p text:style-name=\"OrgTitle\"/>"))
...

So I only need to find a way to assign nil to title variable inside the document.

Also I might define a new option with org-export-inbuffer-options-extra, but the elaboration of the function is beyond my knowledge.

I would appreciate any idea.


> 
> > #+OPTIONS: title:nil author:nil timestamp:nil 
> toc:nil
>          
>    ^^^^^^^^^
> 
> This option is not supported.
> 
> -- 
>  Bastien
> 
>

Thanks.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: No title in org-export-as-odt
  2012-09-24  6:03 No title in org-export-as-odt Miguel Ruiz
@ 2012-09-24  6:42 ` Nick Dokos
  2012-09-24 12:10 ` Giovanni Ridolfi
  2014-01-27  6:31 ` Brady Trainor
  2 siblings, 0 replies; 11+ messages in thread
From: Nick Dokos @ 2012-09-24  6:42 UTC (permalink / raw)
  To: Miguel Ruiz; +Cc: emacs-orgmode

Miguel Ruiz <rbenit68@yahoo.es> wrote:

> Hi,
> 
>  
> > Miguel Ruiz <rbenit68@yahoo.es>
> > writes:
> > 
> > > Any hint to get rid of the title in a org-export-as-odt
> > session?
> > 
> > I don't think you can
> 
> 
> org-odt-format-preamble function says:
> 
> ...
> (when title
>        (concat
>     (org-odt-format-stylized-paragraph
>      'title (org-odt-format-tags
>          '("<text:title>" . "</text:title>") title))
>     ;; separator
>     "<text:p text:style-name=\"OrgTitle\"/>"))
> ...
> 
> So I only need to find a way to assign nil to title variable inside the document.
> 

I don't think you can unless you change the code. The title is set in org-lparse.el::org-do-lparse
like this:

,----
|          ...
| 	 (title       (org-xml-encode-org-text-skip-links
| 		       (or (and subtree-p (org-export-get-title-from-subtree))
| 			   (plist-get opt-plist :title)
| 			   (and (not body-only)
| 				(not
| 				 (plist-get opt-plist :skip-before-1st-heading))
| 				(org-export-grab-title-from-buffer))
| 			   (and buffer-file-name
| 				(file-name-sans-extension
| 				 (file-name-nondirectory buffer-file-name)))
| 			   "UNTITLED")))
|         ...
`----

so even if you arrange for the opt-plist to set :title to nil,
the buffer-file-name will override it.

Nick

> Also I might define a new option with org-export-inbuffer-options-extra, but the elaboration of the function is beyond my knowledge.
> 
> I would appreciate any idea.
> 
> 
> > 
> > > #+OPTIONS: title:nil author:nil timestamp:nil 
> > toc:nil
> >          
> >    ^^^^^^^^^
> > 
> > This option is not supported.
> > 
> > -- 
> >  Bastien
> > 
> >
> 
> Thanks.
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: No title in org-export-as-odt
  2012-09-24  6:03 No title in org-export-as-odt Miguel Ruiz
  2012-09-24  6:42 ` Nick Dokos
@ 2012-09-24 12:10 ` Giovanni Ridolfi
  2014-01-27  6:31 ` Brady Trainor
  2 siblings, 0 replies; 11+ messages in thread
From: Giovanni Ridolfi @ 2012-09-24 12:10 UTC (permalink / raw)
  To: Miguel Ruiz, emacs-orgmode

Da: Miguel Ruiz <rbenit68@yahoo.es>
Inviato: Lunedì 24 Settembre 2012 8:03

>> Bastien 
>>> Miguel Ruiz <rbenit68@yahoo.es> writes:
> >>
>>> Any hint to get rid of the title in a org-export-as-odt
>>> session?
>> 
>> I don't think you can
>
> org-odt-format-preamble function says:
>
> ...
> (when title
>      (concat
>  (org-odt-format-stylized-paragraph
>  'title (org-odt-format-tags
>    >     '("<text:title>" . "</text:title>") title))
>    ;; separator
>    "<text:p text:style-name=\"OrgTitle\"/>"))

> So I only need to find a way to assign nil to title variable inside the document.
#+TITLE:   <- leave a blank space here?

the new  HTML exporter works.

> I would appreciate any idea.

HTH,
Giovanni /shooting in the dark.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: No title in org-export-as-odt
  2012-09-24  6:03 No title in org-export-as-odt Miguel Ruiz
  2012-09-24  6:42 ` Nick Dokos
  2012-09-24 12:10 ` Giovanni Ridolfi
@ 2014-01-27  6:31 ` Brady Trainor
  2014-01-27 10:35   ` Bastien
  2014-01-27 14:23   ` Jambunathan K
  2 siblings, 2 replies; 11+ messages in thread
From: Brady Trainor @ 2014-01-27  6:31 UTC (permalink / raw)
  To: emacs-orgmode

Miguel Ruiz <rbenit68 <at> yahoo.es> writes:

> > > Any hint to get rid of the title in a org-export-as-odt
> > session?

I had the same problem. I noticed a lot of new lines, `\n', so I tried to
remove more than "just title". For my solution, I changed insert to ignore. 


      ;; Preamble - Title, Author, Date etc.
      (ignore 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
changed insert to ignore
       (let* ((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)))))
	      (email (plist-get info :email))
	      ;; Switch on or off above vars based on user settings
	      (author (and (plist-get info :with-author) (or author email)))
	      (email (and (plist-get info :with-email) email)))
	 (concat
	  ;; Title.
	  (when title
	    (concat
	     (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
		     "OrgTitle" (format "\n<text:title>%s</text:title>" title))
	     ;; Separator.
	     "\n<text:p text:style-name=\"OrgTitle\"/>"))



This was in .emacs.d/elpa/org-[...]/ox-odt.el, that is, org export to odt.
Also, not sure if it was necessary, but I deleted ox-odt.elc, the compiled
version. 


Brady 


> 
> org-odt-format-preamble function says:
> 
> ...
> (when title
>        (concat
>     (org-odt-format-stylized-paragraph
>      'title (org-odt-format-tags
>          '("<text:title>" . "</text:title>") title))
>     ;; separator
>     "<text:p text:style-name=\"OrgTitle\"/>"))
> ...
> 
> So I only need to find a way to assign nil to title variable inside the
document.
> 
> Also I might define a new option with org-export-inbuffer-options-extra,
but the elaboration of the
> function is beyond my knowledge.
> 
> I would appreciate any idea.
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: No title in org-export-as-odt
  2014-01-27  6:31 ` Brady Trainor
@ 2014-01-27 10:35   ` Bastien
  2014-03-28  6:05     ` [PATCH] " Brady Trainor
  2014-01-27 14:23   ` Jambunathan K
  1 sibling, 1 reply; 11+ messages in thread
From: Bastien @ 2014-01-27 10:35 UTC (permalink / raw)
  To: Brady Trainor; +Cc: emacs-orgmode

Hi Brady,

Brady Trainor <algebrat@uw.edu> writes:

> Miguel Ruiz <rbenit68 <at> yahoo.es> writes:
>
>> > > Any hint to get rid of the title in a org-export-as-odt
>> > session?
>
> I had the same problem. I noticed a lot of new lines, `\n', so I tried to
> remove more than "just title". For my solution, I changed insert to
> ignore. 

Can you provide your change in the form of a patch?

1. ~$ git clone git://orgmode.org/org-mode.git
2. cd org-mode/lisp/
3. edit ox-odt.el by adding your change
4. in Emacs, hit `C-x v =' from the file to create the patch
5. save the patch buffer to ox-odt.el.patch
5. send ox-odt.el.patch to the list, using [PATCH] in the subject line

Thanks in advance!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: No title in org-export-as-odt
  2014-01-27  6:31 ` Brady Trainor
  2014-01-27 10:35   ` Bastien
@ 2014-01-27 14:23   ` Jambunathan K
  1 sibling, 0 replies; 11+ messages in thread
From: Jambunathan K @ 2014-01-27 14:23 UTC (permalink / raw)
  Cc: emacs-orgmode

Brady Trainor <algebrat@uw.edu> writes:

> Miguel Ruiz <rbenit68 <at> yahoo.es> writes:
>
>> > > Any hint to get rid of the title in a org-export-as-odt

If you are seeing `org-export-as-odt' then you are using old Org (<
8.0).  Old exporters are no longer maintained.  So you upgrade to the
latest Org (org > 8.0) via M-x list-packages.

Btw, I have a provided a fix as part of my ELPA package[fn:1].  If

   #+TITLE:

is made of just whitespaces, the exported document will no longer have
the corresponding fieldnames.

[fn:1] http://lists.gnu.org/archive/html/emacs-orgmode/2014-01/msg01312.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] No title in org-export-as-odt
  2014-01-27 10:35   ` Bastien
@ 2014-03-28  6:05     ` Brady Trainor
  2014-04-16 14:38       ` Bastien
  0 siblings, 1 reply; 11+ messages in thread
From: Brady Trainor @ 2014-03-28  6:05 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg <at> gnu.org> writes:

> Brady Trainor <algebrat <at> uw.edu> writes:
> 
> > For my solution, I changed insert to ignore. 
> 
> Can you provide your change in the form of a patch?
> 

> 4. in Emacs, hit `C-x v =' from the file to create the patch


I wanted to return to this and attempt it, here is my first patch ever: 


diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index da2ca3f..8c7f0fe 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -1491,7 +1491,7 @@ original parsed data.  INFO is a plist holding export 
options."
       (goto-char (match-beginning 0))

       ;; Preamble - Title, Author, Date etc.
-      (insert
+      (ignore
        (let* ((title (org-export-data (plist-get info :title) info))
           (author (and (plist-get info :with-author)
                (let ((auth (plist-get info :author)))


I installed a fresh version of org-mode from Elpa or Melpa before doing 
this. (I am just now looking a little into the maint branch.)

In the long-long run, when I go to insert the code, I wonder why we don't 
make removing the title an option in ox.el. Otherwise, I might've 
considered figuring out how to expose the above ad-hoc solution as a 
variable in the customize group. I don't know what the use cases are for 
the title. So, a temporary solution might go, org-odt-export-preamble off 
and on.

(ETA: then, perhaps the individual exporters should be focused on, before 
considering pulling variables back to ox.el.) 

Thank you always for org-mode,

Brady

P.S., so... I went ahead and tried the exposed variable fix, and that is 
below: (This was my first shot at making a Emacs customizable variable, 
blindly with no RTFM, and... I don't think it works as is.) 

diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index da2ca3f..c2b4609 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -351,6 +351,16 @@ the entity.  See `org-odt--enumerate'.")
   :group 'org-export)


+;;;; Insert Preamble (Title, Author...)
+
+(defcustom org-odt-insert-preamble 'nil
+  "Choose whether title and author preamble appears in export."
+  :group 'org-export-odt
+  :version "24.1"
+  :type 'boolean
+  )
+
+
 ;;;; Debugging

 (defcustom org-odt-prettify-xml nil
@@ -1491,6 +1501,7 @@ original parsed data.  INFO is a plist holding export 
options."
       (goto-char (match-beginning 0))

       ;; Preamble - Title, Author, Date etc.
+      (if org-odt-insert-preamble
       (insert
        (let* ((title (org-export-data (plist-get info :title) info))
           (author (and (plist-get info :with-author)
@@ -1543,7 +1554,7 @@ original parsed data.  INFO is a plist holding export 
options."
                (org-odt--format-timestamp (car date))
              (org-export-data (plist-get info :date) info)))
            ;; Separator
-           "<text:p text:style-name=\"OrgSubtitle\"/>"))))))
+           "<text:p text:style-name=\"OrgSubtitle\"/>")))))))
       ;; Table of Contents
       (let* ((with-toc (plist-get info :with-toc))
          (depth (and with-toc (if (wholenump with-toc)

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] No title in org-export-as-odt
  2014-03-28  6:05     ` [PATCH] " Brady Trainor
@ 2014-04-16 14:38       ` Bastien
  0 siblings, 0 replies; 11+ messages in thread
From: Bastien @ 2014-04-16 14:38 UTC (permalink / raw)
  To: Brady Trainor; +Cc: emacs-orgmode

Hi Brady,

Brady Trainor <algebrat@uw.edu> writes:

> I wanted to return to this and attempt it, here is my first patch ever: 

Thanks,

> diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
> index da2ca3f..8c7f0fe 100644
> --- a/lisp/ox-odt.el
> +++ b/lisp/ox-odt.el
> @@ -1491,7 +1491,7 @@ original parsed data.  INFO is a plist holding export 
> options."
>        (goto-char (match-beginning 0))
>
>        ;; Preamble - Title, Author, Date etc.
> -      (insert
> +      (ignore
>         (let* ((title (org-export-data (plist-get info :title) info))
>            (author (and (plist-get info :with-author)
>                 (let ((auth (plist-get info :author)))

The way not to insert a title is simply to add an empty title like this:

#+TITLE:

Otherwise, Org falls back on the file name.

> I installed a fresh version of org-mode from Elpa or Melpa before doing 
> this. (I am just now looking a little into the maint branch.)
>
> In the long-long run, when I go to insert the code, I wonder why we don't 
> make removing the title an option in ox.el.

This could be done with a new `org-export-with-title' option but I
would rather stick to the current way of doing it (an empty value
for #+TITLE:).

Thanks anyway for the patches,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: No title in org-export-as-odt
  2012-09-23 16:56 Miguel Ruiz
  2012-09-23 18:09 ` Bastien
@ 2014-03-28  9:11 ` Nicolas Goaziou
  1 sibling, 0 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2014-03-28  9:11 UTC (permalink / raw)
  To: Miguel Ruiz; +Cc: emacs-orgmode

Hello,

Miguel Ruiz <rbenit68@yahoo.es> writes:

> If I try
>
> #+TITLE:

This should remove the title line. Thank you for reporting it.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: No title in org-export-as-odt
  2012-09-23 16:56 Miguel Ruiz
@ 2012-09-23 18:09 ` Bastien
  2014-03-28  9:11 ` Nicolas Goaziou
  1 sibling, 0 replies; 11+ messages in thread
From: Bastien @ 2012-09-23 18:09 UTC (permalink / raw)
  To: Miguel Ruiz; +Cc: emacs-orgmode

Hi Miguel,

Miguel Ruiz <rbenit68@yahoo.es> writes:

> Any hint to get rid of the title in a org-export-as-odt session?

I don't think you can

> #+OPTIONS: title:nil author:nil timestamp:nil  toc:nil
             ^^^^^^^^^

This option is not supported.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 11+ messages in thread

* No title in org-export-as-odt
@ 2012-09-23 16:56 Miguel Ruiz
  2012-09-23 18:09 ` Bastien
  2014-03-28  9:11 ` Nicolas Goaziou
  0 siblings, 2 replies; 11+ messages in thread
From: Miguel Ruiz @ 2012-09-23 16:56 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Any hint to get rid of the title in a org-export-as-odt session?

I've tried 

#+OPTIONS: title:nil author:nil timestamp:nil  toc:nil
#+LANGUAGE: es

* HELLO

and I get the filename as odt file title.

If I try

#+TITLE:
#+OPTIONS: title:nil author:nil timestamp:nil  toc:nil
#+LANGUAGE: es

* HELLO

I get an empty line,  OrgTitle-styled.

Run out of ideas.

TIA


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-04-16 16:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-24  6:03 No title in org-export-as-odt Miguel Ruiz
2012-09-24  6:42 ` Nick Dokos
2012-09-24 12:10 ` Giovanni Ridolfi
2014-01-27  6:31 ` Brady Trainor
2014-01-27 10:35   ` Bastien
2014-03-28  6:05     ` [PATCH] " Brady Trainor
2014-04-16 14:38       ` Bastien
2014-01-27 14:23   ` Jambunathan K
  -- strict thread matches above, loose matches on Subject: below --
2012-09-23 16:56 Miguel Ruiz
2012-09-23 18:09 ` Bastien
2014-03-28  9:11 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).