emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Uriel Avalos <amscopub-mail@yahoo.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Change DOCTYPE declaration?
Date: Thu, 18 Nov 2010 10:51:40 -0500	[thread overview]
Message-ID: <351.54683650962$1290095713@news.gmane.org> (raw)
In-Reply-To: <20101118103550.33442d0eamscopub-mail@yahoo.com@dove.localdomain>

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

  parent reply	other threads:[~2010-11-18 15:52 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
     [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 [this message]
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='351.54683650962$1290095713@news.gmane.org' \
    --to=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).