From: "T. V. Raman" <raman@users.sf.net>
To: emacs-orgmode@gnu.org
Subject: patch to org.el to produce xhtml:
Date: Thu, 25 May 2006 19:05:48 -0700 [thread overview]
Message-ID: <17526.25212.48304.308344@localhost.localdomain> (raw)
[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 5095 bytes --]
I am attaching a partial patch (see below for explanation of
partial)
along with sample files, I hope others here can help finish
this.
Goal: Produce well-formed XHTML.
What I have Fixed:
0) Ensure all tagnames are lower case.
1) Emit correct doctype and xhtml namespace.
2) Emit /> to close meta tags.
3) Emit </li> to close bullets (not all cases covered)
4) Ensured that all attribute values are quoted.
ToDo:
A) Emit closing li tags in all cases.
B) Emit closing </p> to close paragraphs.
C) Ensure that author and date bits on the bottom are wrapped in
a <p class="xxx">...</p>
where xxx is author or date as appropriate.
I'm attaching a bullets.org file, and the final xhtml output I'd
like to produce.
*** org.el 2006/05/26 01:29:49 1.1
--- org.el 2006/05/26 01:57:39
***************
*** 12609,12634 ****
;; File header
(insert (format
! "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"
! \"http://www.w3.org/TR/REC-html40/loose.dtd\">
! <html lang=\"%s\"><head>
<title>%s</title>
! <meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\">
! <meta name=generator content=\"Org-mode\">
! <meta name=generated content=\"%s %s\">
! <meta name=author content=\"%s\">
%s
</head><body>
"
! language (org-html-expand title) (or charset "iso-8859-1")
date time author style))
(insert (or (plist-get opt-plist :preamble) ""))
(when (plist-get opt-plist :auto-preamble)
! (if title (insert (concat "<H1 class=\"title\">"
! (org-html-expand title) "</H1>\n")))
; (if author (insert (concat (nth 1 lang-words) ": " author "\n")))
; (if email (insert (concat "<a href=\"mailto:" email "\"><"
; email "></a>\n")))
--- 12609,12636 ----
;; File header
(insert (format
! "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
! \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
! <html xmlns=\"http://www.w3.org/1999/xhtml\"
! lang=\"%s\" xml:lang=\"%s\">
! <head>
<title>%s</title>
! <meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/>
! <meta name=\"generator\" content=\"Org-mode\"/>
! <meta name=\"generated\" content=\"%s %s\"/>
! <meta name=\"author\" content=\"%s\"/>
%s
</head><body>
"
! language language (org-html-expand title) (or charset "iso-8859-1")
date time author style))
(insert (or (plist-get opt-plist :preamble) ""))
(when (plist-get opt-plist :auto-preamble)
! (if title (insert (concat "<h1 class=\"title\">"
! (org-html-expand title) "</h1>\n")))
; (if author (insert (concat (nth 1 lang-words) ": " author "\n")))
; (if email (insert (concat "<a href=\"mailto:" email "\"><"
; email "></a>\n")))
***************
*** 12639,12645 ****
(if org-export-with-toc
(progn
! (insert (format "<H2>%s</H2>\n" (nth 3 lang-words)))
(insert "<ul>\n")
(setq lines
(mapcar '(lambda (line)
--- 12641,12647 ----
(if org-export-with-toc
(progn
! (insert (format "<h2>%s</h2>\n" (nth 3 lang-words)))
(insert "<ul>\n")
(setq lines
(mapcar '(lambda (line)
***************
*** 12694,12700 ****
(insert
(format
(if todo
! "<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a>\n"
"<li><a href=\"#sec-%d\">%s</a>\n")
head-count txt))
--- 12696,12702 ----
(insert
(format
(if todo
! "<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a></li>\n"
"<li><a href=\"#sec-%d\">%s</a>\n")
head-count txt))
***************
*** 13254,13260 ****
(if (aref levels-open (1- level))
(insert "<li>" title "<p>\n")
(aset levels-open (1- level) t)
! (insert "<ul><li>" title "<p>\n")))
(if org-export-with-section-numbers
(setq title (concat (org-section-number level) " " title)))
(setq level (+ level 1))
--- 13256,13262 ----
(if (aref levels-open (1- level))
(insert "<li>" title "<p>\n")
(aset levels-open (1- level) t)
! (insert "<ul><li>" title "</li>\n")))
(if org-export-with-section-numbers
(setq title (concat (org-section-number level) " " title)))
(setq level (+ level 1))
***************
*** 13272,13280 ****
"")
t t title)))
(if with-toc
! (insert (format "\n<H%d><a name=\"sec-%d\">%s</a></H%d>\n"
level head-count title level))
! (insert (format "\n<H%d>%s</H%d>\n" level title level)))))))
(defun org-html-level-close (&rest args)
"Terminate one level in HTML export."
--- 13274,13282 ----
"")
t t title)))
(if with-toc
! (insert (format "\n<h%d><a name=\"sec-%d\">%s</a></h%d>\n"
level head-count title level))
! (insert (format "\n<h%d>%s</h%d>\n" level title level)))))))
(defun org-html-level-close (&rest args)
"Terminate one level in HTML export."
[-- Attachment #2: input org file --]
[-- Type: application/octet-stream, Size: 250 bytes --]
* HTML Export.
this is to test HTML export and move output to XHTML.
- Bulleted list.
- More bullets.
** Subsection
+ Another list.
+ More things to do.
*** Numbered Lists:
1. First item.
2. Second item.
3. Third and last item.
[-- Attachment #3: desired xhtml output --]
[-- Type: text/html, Size: 2260 bytes --]
[-- Attachment #4: Type: text/plain, Size: 149 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next reply other threads:[~2006-05-26 2:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-26 2:05 T. V. Raman [this message]
2006-05-27 12:37 ` patch to org.el to produce xhtml: Carsten Dominik
2006-05-27 19:22 ` T. V. Raman
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=17526.25212.48304.308344@localhost.localdomain \
--to=raman@users.sf.net \
--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).