emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* patch to org.el to produce xhtml:
@ 2006-05-26  2:05 T. V. Raman
  2006-05-27 12:37 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: T. V. Raman @ 2006-05-26  2:05 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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 "\">&lt;"
  ;					  email "&gt;</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 "\">&lt;"
  ;					  email "&gt;</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

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

end of thread, other threads:[~2006-05-27 19:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-26  2:05 patch to org.el to produce xhtml: T. V. Raman
2006-05-27 12:37 ` Carsten Dominik
2006-05-27 19:22   ` T. V. Raman

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