emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Change DOCTYPE declaration?


From: Uriel Avalos
Subject: Re: [Orgmode] Change DOCTYPE declaration?
Date: Thu, 18 Nov 2010 10:51:40 -0500

On Thu, 18 Nov 2010 10:35:50 -0500
Uriel Avalos <address@hidden> wrote:

> On Wed, 17 Nov 2010 19:45:06 -0200
> Juan Pechiar <address@hidden> 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 <address@hidden> 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.
> address@hidden
> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]