emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Change DOCTYPE declaration?
@ 2010-11-17 18:04 Uriel Avalos
  0 siblings, 0 replies; 8+ messages in thread
From: Uriel Avalos @ 2010-11-17 18:04 UTC (permalink / raw)
  To: emacs-orgmode

How do I change the doctype declaration?

Is there an export option or variable I can set? I tried searching for the variable. Perhaps I'm using a version of orgmode that's too old?

The only thing I could find was org-export-html-xml-declaration but that's not the same thing.

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

* Re: Change DOCTYPE declaration?
       [not found] <20101117130409.773797d2amscopub-mail@yahoo.com@dove.localdomain>
@ 2010-11-17 18:34 ` Juan Pechiar
  2010-11-17 20:23   ` Uriel Avalos
       [not found]   ` <20101117152308.63473cd6amscopub-mail@yahoo.com@dove.localdomain>
  0 siblings, 2 replies; 8+ messages in thread
From: Juan Pechiar @ 2010-11-17 18:34 UTC (permalink / raw)
  To: Uriel Avalos; +Cc: emacs-orgmode

Hi,

The DOCTYPE declaration is hardcoded inside org-html.el

You may change it by defining a hook and modifying the generated HTML.
Have a look at the following message, where they get rid of the
declaration:

http://lists.gnu.org/archive/html/emacs-orgmode/2010-06/msg00063.html

you may add some 'insert' there with your own declaration.

Regards,
.j.

On Wed, Nov 17, 2010 at 01:04:09PM -0500, Uriel Avalos wrote:
> How do I change the doctype declaration?
>
> Is there an export option or variable I can set? I tried searching
> for the variable. Perhaps I'm using a version of orgmode that's too
> old?
>
> The only thing I could find was org-export-html-xml-declaration but
> that's not the same thing.

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

* Re: Change DOCTYPE declaration?
  2010-11-17 18:34 ` Juan Pechiar
@ 2010-11-17 20:23   ` Uriel Avalos
       [not found]   ` <20101117152308.63473cd6amscopub-mail@yahoo.com@dove.localdomain>
  1 sibling, 0 replies; 8+ messages in thread
From: Uriel Avalos @ 2010-11-17 20:23 UTC (permalink / raw)
  To: emacs-orgmode

Thanks for the reply. After some monkeying around, I found I could do this:

(add-hook 'org-export-html-final-hook
          (lambda ()
           (let ((kill-whole-line t))
            (goto-char (point-min))
	    (next-line)
            (kill-line 2)
	    (insert "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n")
	    )
	   )
	  )

To undo it, I can call this:

(setq org-export-html-final-hook nil)

However, one question, the above sets the doctype GLOBALLY. Is there a way to do set this automagically per file? (I.e., some kind of file-specific export option)


On Wed, 17 Nov 2010 16:34:27 -0200
Juan Pechiar <juan@pechiar.com> wrote:

> Hi,
> 
> The DOCTYPE declaration is hardcoded inside org-html.el
> 
> You may change it by defining a hook and modifying the generated HTML.
> Have a look at the following message, where they get rid of the
> declaration:
> 
> http://lists.gnu.org/archive/html/emacs-orgmode/2010-06/msg00063.html
> 
> you may add some 'insert' there with your own declaration.
> 
> Regards,
> .j.
> 
> On Wed, Nov 17, 2010 at 01:04:09PM -0500, Uriel Avalos wrote:
> > How do I change the doctype declaration?
> >
> > Is there an export option or variable I can set? I tried searching
> > for the variable. Perhaps I'm using a version of orgmode that's too
> > old?
> >
> > The only thing I could find was org-export-html-xml-declaration but
> > that's not the same thing.

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

* Re: Change DOCTYPE declaration?
       [not found]   ` <20101117152308.63473cd6amscopub-mail@yahoo.com@dove.localdomain>
@ 2010-11-17 21:45     ` Juan Pechiar
       [not found]       ` <27942.1290032705@gamaville.americas.hpqcorp.net>
                         ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Juan Pechiar @ 2010-11-17 21:45 UTC (permalink / raw)
  To: Uriel Avalos; +Cc: emacs-orgmode

Yo can set variables on a per-file basis.

Check EXPORT OPTIONS on the manual. You can set variables there (but
not add hooks), so maybe something like this works:

#+begin_src emacs-lisp

;; in your .emacs file:

(add-hook 'org-export-html-final-hook
          (lambda ()
           (if ( (boundp 'uriel-change-doctype) )

           (let ((kill-whole-line t))
            (goto-char (point-min))
	    (next-line)
            (kill-line 2)
	    (insert "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n")
	    )
	   )
	  )

	  )

#+end_src

So the hook body will only execute if uriel-change-doctype is bound to
some value.

Then, on your document, include

#+BIND uriel-change-doctype t

Not tested, good luck!

.j.


On Wed, Nov 17, 2010 at 03:23:08PM -0500, Uriel Avalos wrote:
> Thanks for the reply. After some monkeying around, I found I could do this:
>
> (add-hook 'org-export-html-final-hook
>           (lambda ()
>            (let ((kill-whole-line t))
>             (goto-char (point-min))
> 	    (next-line)
>             (kill-line 2)
> 	    (insert "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n")
> 	    )
> 	   )
> 	  )
>
> To undo it, I can call this:
>
> (setq org-export-html-final-hook nil)
>
> However, one question, the above sets the doctype GLOBALLY. Is there
> a way to do set this automagically per file? (I.e., some kind of
> file-specific export option)
>
> Juan Pechiar <juan@pechiar.com> wrote:
>
> > The DOCTYPE declaration is hardcoded inside org-html.el
> >
> > You may change it by defining a hook and modifying the generated HTML.
> > Have a look at the following message, where they get rid of the
> > declaration:
> >
> > http://lists.gnu.org/archive/html/emacs-orgmode/2010-06/msg00063.html
> >
> > you may add some 'insert' there with your own declaration.
> >
> > On Wed, Nov 17, 2010 at 01:04:09PM -0500, Uriel Avalos wrote:
> > > How do I change the doctype declaration?

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

* Re: Change DOCTYPE declaration?
       [not found]       ` <27942.1290032705@gamaville.americas.hpqcorp.net>
@ 2010-11-17 23:02         ` Juan Pechiar
  0 siblings, 0 replies; 8+ messages in thread
From: Juan Pechiar @ 2010-11-17 23:02 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On Wed, Nov 17, 2010 at 05:25:05PM -0500, Nick Dokos wrote:
> #+BIND: uriel-change-doctype t
>
> but a good (if not scalable) solution to the problem.
>
> I have a question however: why is it that hooks can't be set using
> this mechanism?

From my limited understanding, the #+BIND directive is for binding
variables.

For correctly adding a hook you must call add-hook, which adds a
function to the corresponding hook list.

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

* Re: Change DOCTYPE declaration?
  2010-11-17 21:45     ` Juan Pechiar
       [not found]       ` <27942.1290032705@gamaville.americas.hpqcorp.net>
@ 2010-11-18 15:35       ` Uriel Avalos
       [not found]       ` <20101118103550.33442d0eamscopub-mail@yahoo.com@dove.localdomain>
  2 siblings, 0 replies; 8+ messages in thread
From: Uriel Avalos @ 2010-11-18 15:35 UTC (permalink / raw)
  To: emacs-orgmode

On Wed, 17 Nov 2010 19:45:06 -0200
Juan Pechiar <juan@pechiar.com> wrote:

> Yo can set variables on a per-file basis.
> 
> Check EXPORT OPTIONS on the manual. You can set variables there (but
> not add hooks), so maybe something like this works:
> 
> #+begin_src emacs-lisp
> 
> ;; in your .emacs file:
> 
> (add-hook 'org-export-html-final-hook
>           (lambda ()
>            (if ( (boundp 'uriel-change-doctype) )
> 
>            (let ((kill-whole-line t))
>             (goto-char (point-min))
> 	    (next-line)
>             (kill-line 2)
> 	    (insert "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n")
> 	    )
> 	   )
> 	  )
> 
> 	  )
> 
> #+end_src
> 
> So the hook body will only execute if uriel-change-doctype is bound to
> some value.
> 
> Then, on your document, include
> 
> #+BIND uriel-change-doctype t
> 
> Not tested, good luck!
> 
> .j.
> 
> 
> On Wed, Nov 17, 2010 at 03:23:08PM -0500, Uriel Avalos wrote:
> > Thanks for the reply. After some monkeying around, I found I could do this:
> >
> > (add-hook 'org-export-html-final-hook
> >           (lambda ()
> >            (let ((kill-whole-line t))
> >             (goto-char (point-min))
> > 	    (next-line)
> >             (kill-line 2)
> > 	    (insert "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n")
> > 	    )
> > 	   )
> > 	  )
> >
> > To undo it, I can call this:
> >
> > (setq org-export-html-final-hook nil)
> >
> > However, one question, the above sets the doctype GLOBALLY. Is there
> > a way to do set this automagically per file? (I.e., some kind of
> > file-specific export option)
> >
> > Juan Pechiar <juan@pechiar.com> wrote:
> >
> > > The DOCTYPE declaration is hardcoded inside org-html.el
> > >
> > > You may change it by defining a hook and modifying the generated HTML.
> > > Have a look at the following message, where they get rid of the
> > > declaration:
> > >
> > > http://lists.gnu.org/archive/html/emacs-orgmode/2010-06/msg00063.html
> > >
> > > you may add some 'insert' there with your own declaration.
> > >
> > > On Wed, Nov 17, 2010 at 01:04:09PM -0500, Uriel Avalos wrote:
> > > > How do I change the doctype declaration?

Great. It's working like a charm. If uriel-change-doctype is not defined, it leaves the doctype alone. Otherwise, it changes it. (Note that there's a small typo in the code, an extra parentheses before var but it otherwise works very well.) Thanks!

The only problem is that #+BIND is not working. I tried setting org-export-allow-BIND to t and it still does not work. Ideas?

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

* Re: Change DOCTYPE declaration?
       [not found]       ` <20101118103550.33442d0eamscopub-mail@yahoo.com@dove.localdomain>
@ 2010-11-18 15:51         ` Uriel Avalos
  2010-11-18 15:52         ` Juan Pechiar
  1 sibling, 0 replies; 8+ messages in thread
From: Uriel Avalos @ 2010-11-18 15:51 UTC (permalink / raw)
  Cc: emacs-orgmode

On Thu, 18 Nov 2010 10:35:50 -0500
Uriel Avalos <amscopub-mail@yahoo.com> wrote:

> On Wed, 17 Nov 2010 19:45:06 -0200
> Juan Pechiar <juan@pechiar.com> wrote:
> 
> > Yo can set variables on a per-file basis.
> > 
> > Check EXPORT OPTIONS on the manual. You can set variables there (but
> > not add hooks), so maybe something like this works:
> > 
> > #+begin_src emacs-lisp
> > 
> > ;; in your .emacs file:
> > 
> > (add-hook 'org-export-html-final-hook
> >           (lambda ()
> >            (if ( (boundp 'uriel-change-doctype) )
> > 
> >            (let ((kill-whole-line t))
> >             (goto-char (point-min))
> > 	    (next-line)
> >             (kill-line 2)
> > 	    (insert "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n")
> > 	    )
> > 	   )
> > 	  )
> > 
> > 	  )
> > 
> > #+end_src
> > 
> > So the hook body will only execute if uriel-change-doctype is bound to
> > some value.
> > 
> > Then, on your document, include
> > 
> > #+BIND uriel-change-doctype t
> > 
> > Not tested, good luck!
> > 
> > .j.
> > 
> > 
> > On Wed, Nov 17, 2010 at 03:23:08PM -0500, Uriel Avalos wrote:
> > > Thanks for the reply. After some monkeying around, I found I could do this:
> > >
> > > (add-hook 'org-export-html-final-hook
> > >           (lambda ()
> > >            (let ((kill-whole-line t))
> > >             (goto-char (point-min))
> > > 	    (next-line)
> > >             (kill-line 2)
> > > 	    (insert "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n")
> > > 	    )
> > > 	   )
> > > 	  )
> > >
> > > To undo it, I can call this:
> > >
> > > (setq org-export-html-final-hook nil)
> > >
> > > However, one question, the above sets the doctype GLOBALLY. Is there
> > > a way to do set this automagically per file? (I.e., some kind of
> > > file-specific export option)
> > >
> > > Juan Pechiar <juan@pechiar.com> wrote:
> > >
> > > > The DOCTYPE declaration is hardcoded inside org-html.el
> > > >
> > > > You may change it by defining a hook and modifying the generated HTML.
> > > > Have a look at the following message, where they get rid of the
> > > > declaration:
> > > >
> > > > http://lists.gnu.org/archive/html/emacs-orgmode/2010-06/msg00063.html
> > > >
> > > > you may add some 'insert' there with your own declaration.
> > > >
> > > > On Wed, Nov 17, 2010 at 01:04:09PM -0500, Uriel Avalos wrote:
> > > > > How do I change the doctype declaration?
> 
> Great. It's working like a charm. If uriel-change-doctype is not defined, it leaves the doctype alone. Otherwise, it changes it. (Note that there's a small typo in the code, an extra parentheses before var but it otherwise works very well.) Thanks!
> 
> The only problem is that #+BIND is not working. I tried setting org-export-allow-BIND to t and it still does not work. Ideas?
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Nevermind, I forgot the : in #+BIND. DOH! It's working fine now. For the reference, here's what works:

In .emacs:

(add-hook 'org-export-html-final-hook
            (lambda ()
             (if (boundp 'uriel-mathml-doctype)
                 (let ((kill-whole-line t))
                   (goto-char (point-min))
                   (next-line)
                   (kill-line 2)
                   (insert "<!DOCTYPE html PUBLIC
      \"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN\"
      \"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd\">\n")
                   )
               )
             )
            )

Then in the file:

#+BIND: uriel-mathml-doctype t

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

* Re: Change DOCTYPE declaration?
       [not found]       ` <20101118103550.33442d0eamscopub-mail@yahoo.com@dove.localdomain>
  2010-11-18 15:51         ` Uriel Avalos
@ 2010-11-18 15:52         ` Juan Pechiar
  1 sibling, 0 replies; 8+ messages in thread
From: Juan Pechiar @ 2010-11-18 15:52 UTC (permalink / raw)
  To: Uriel Avalos; +Cc: emacs-orgmode

On Thu, Nov 18, 2010 at 10:35:50AM -0500, Uriel Avalos wrote:
> The only problem is that #+BIND is not working. I tried setting
> org-export-allow-BIND to t and it still does not work. Ideas?

Did you C-c C-c over (any of the) option headers?

This is required for org-mode to re-parse all options in the file.

http://orgmode.org/manual/The-very-busy-C_002dc-C_002dc-key.html#The-very-busy-C_002dc-C_002dc-key

.j.

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

end of thread, other threads:[~2010-11-18 15:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-17 18:04 Change DOCTYPE declaration? Uriel Avalos
     [not found] <20101117130409.773797d2amscopub-mail@yahoo.com@dove.localdomain>
2010-11-17 18:34 ` Juan Pechiar
2010-11-17 20:23   ` Uriel Avalos
     [not found]   ` <20101117152308.63473cd6amscopub-mail@yahoo.com@dove.localdomain>
2010-11-17 21:45     ` Juan Pechiar
     [not found]       ` <27942.1290032705@gamaville.americas.hpqcorp.net>
2010-11-17 23:02         ` Juan Pechiar
2010-11-18 15:35       ` Uriel Avalos
     [not found]       ` <20101118103550.33442d0eamscopub-mail@yahoo.com@dove.localdomain>
2010-11-18 15:51         ` Uriel Avalos
2010-11-18 15:52         ` Juan Pechiar

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).