emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Juan Pechiar <juan@pechiar.com>
To: Uriel Avalos <amscopub-mail@yahoo.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Change DOCTYPE declaration?
Date: Wed, 17 Nov 2010 19:45:06 -0200	[thread overview]
Message-ID: <20101117214505.GH2450@soloJazz.com> (raw)
In-Reply-To: <20101117152308.63473cd6amscopub-mail@yahoo.com@dove.localdomain>

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?

  parent reply	other threads:[~2010-11-17 21:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20101117130409.773797d2amscopub-mail@yahoo.com@dove.localdomain>
2010-11-17 18:34 ` Change DOCTYPE declaration? 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 [this message]
     [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
2010-11-17 18:04 Uriel Avalos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101117214505.GH2450@soloJazz.com \
    --to=juan@pechiar.com \
    --cc=amscopub-mail@yahoo.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).