emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Valid xhtml and org-html.el
@ 2009-05-04  9:18 Sebastian Rose
  2009-05-04 14:22 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Rose @ 2009-05-04  9:18 UTC (permalink / raw)
  To: emacs-orgmode Mailing List

[-- Attachment #1: Type: text/plain, Size: 1258 bytes --]

Hi,


appended is a patch for org-html.el.


This is what it does:

  1. <col></col> is no valid XHTML. Coltags must be empty. I.e., <col .... />

  2. <colgroup>...</colgroup> tags where missing

  3. A minor fix for the end of the CSS comments. Safari doesn't like
     /*]]>*///-->
     and is right in this case. `//' does not start a comment in CSS.
     Therefore, I changed it to
     /*]]>*/-->
     which is valid and Safari shuts up.

  4. Change `&' in link descriptions to `&amp;' again.
     Not sure if I did it in the right place though, but I guess
     `org-export-html-format-desc' is only called to format link
     descriptions.


Apropos validation:

  I worked a little on org-search.php this weekend. It now works without
  networking by default and is much faster.
  
  Also, you may now use it without a database, just to validate the
  XHTML output. No installation required anymore. In that case, the
  script just scanns the first 10 files (customizable) found and
  displays the parser-errors.
  
  If you use the script with database, wrong links to images are
  detected now. That's nice, when moving files around in your
  org-directories.
  
  Get it here: 
     http://github.com/SebastianRose/org-search.php/tree/master




[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: all-missing-colgroup-branch.patch --]
[-- Type: text/x-diff, Size: 2205 bytes --]

diff --git a/lisp/org-html.el b/lisp/org-html.el
index 5608b50..8e3ed4e 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -123,7 +123,7 @@ not be modified."
                                white-space:nowrap; }
   .org-info-js_search-highlight {background-color:#ffff00; color:#000000;
                                  font-weight:bold; }
-  /*]]>*///-->
+  /*]]>*/-->
 </style>"
   "The default style specification for exported HTML files.
 Please use the variables `org-export-html-style' and
@@ -1353,10 +1353,10 @@ lang=\"%s\" xml:lang=\"%s\">
 
 (defun org-export-html-format-desc (s)
   "Make sure the S is valid as a description in a link."
-  (if (and s (not (get-text-property 1 'org-protected s)))
-      (save-match-data
-	(org-html-do-expand s))
-    s))
+  (save-match-data
+    (if (and s (not (get-text-property 1 'org-protected s)))
+	(org-html-do-expand s)
+      (org-html-protect s))))
 
 (defun org-export-html-format-image (src par-open)
   "Create image tag with source and attributes."
@@ -1492,23 +1492,18 @@ lang=\"%s\" xml:lang=\"%s\">
     (setq html (nreverse html))
     (unless splice
       ;; Put in col tags with the alignment (unfortunately often ignored...)
-      (push (mapconcat
-	     (lambda (x)
-	       (setq gr (pop org-table-colgroup-info))
-	       (format "%s<col align=\"%s\"></col>%s"
-		       (if (memq gr '(:start :startend))
-			   (prog1
-			       (if colgropen "</colgroup>\n<colgroup>" "<colgroup>")
-			     (setq colgropen t))
-			 "")
+      (push (concat
+	     "<colgroup>"
+	     (mapconcat
+	      (lambda (x)
+		(setq gr (pop org-table-colgroup-info))
+		(format "<col align=\"%s\" />"
 		       (if (> (/ (float x) nlines) org-table-number-fraction)
-			   "right" "left")
-		       (if (memq gr '(:end :startend))
-			   (progn (setq colgropen nil) "</colgroup>")
-			 "")))
-	     fnum "")
+			   "right" "left")))
+	      fnum "")
+	     "</colgroup>")
 	    html)
-      (if colgropen (setq html (cons (car html) (cons "</colgroup>" (cdr html)))))
+
       ;; Since the output of HTML table formatter can also be used in
       ;; DocBook document, we want to always include the caption to make
       ;; DocBook XML file valid.

[-- Attachment #3: Type: text/plain, Size: 26 bytes --]



Regards

     Sebastian

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Valid xhtml and org-html.el
  2009-05-04  9:18 Valid xhtml and org-html.el Sebastian Rose
@ 2009-05-04 14:22 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-05-04 14:22 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: emacs-orgmode Mailing List

Hi Sebastian,

On May 4, 2009, at 11:18 AM, Sebastian Rose wrote:

> Hi,
>
>
> appended is a patch for org-html.el.
>
>
> This is what it does:
>
>  1. <col></col> is no valid XHTML. Coltags must be empty. I.e.,  
> <col .... />


applied.

>
>  2. <colgroup>...</colgroup> tags where missing

applied

>
>  3. A minor fix for the end of the CSS comments. Safari doesn't like
>     /*]]>*///-->
>     and is right in this case. `//' does not start a comment in CSS.
>     Therefore, I changed it to
>     /*]]>*/-->
>     which is valid and Safari shuts up.

You changed this only once, it it needed in two places, right?
I changed it in both.

>
>  4. Change `&' in link descriptions to `&amp;' again.
>     Not sure if I did it in the right place though, but I guess
>     `org-export-html-format-desc' is only called to format link
>     descriptions.

I have not yet applied this, can you give me an example
where this is needed?

>
>
> Apropos validation:
>
>  I worked a little on org-search.php this weekend. It now works  
> without
>  networking by default and is much faster.
>
>  Also, you may now use it without a database, just to validate the
>  XHTML output. No installation required anymore. In that case, the
>  script just scanns the first 10 files (customizable) found and
>  displays the parser-errors.
>
>  If you use the script with database, wrong links to images are
>  detected now. That's nice, when moving files around in your
>  org-directories.
>
>  Get it here:
>     http://github.com/SebastianRose/org-search.php/tree/master

I need to find time to check this out definitely.

Thanks.

- Carsten

>
>
>
> diff --git a/lisp/org-html.el b/lisp/org-html.el
> index 5608b50..8e3ed4e 100644
> --- a/lisp/org-html.el
> +++ b/lisp/org-html.el
> @@ -123,7 +123,7 @@ not be modified."
>                                white-space:nowrap; }
>   .org-info-js_search-highlight {background-color:#ffff00;  
> color:#000000;
>                                  font-weight:bold; }
> -  /*]]>*///-->
> +  /*]]>*/-->
> </style>"
>   "The default style specification for exported HTML files.
> Please use the variables `org-export-html-style' and
> @@ -1353,10 +1353,10 @@ lang=\"%s\" xml:lang=\"%s\">
>
> (defun org-export-html-format-desc (s)
>   "Make sure the S is valid as a description in a link."
> -  (if (and s (not (get-text-property 1 'org-protected s)))
> -      (save-match-data
> -	(org-html-do-expand s))
> -    s))
> +  (save-match-data
> +    (if (and s (not (get-text-property 1 'org-protected s)))
> +	(org-html-do-expand s)
> +      (org-html-protect s))))
>
> (defun org-export-html-format-image (src par-open)
>   "Create image tag with source and attributes."
> @@ -1492,23 +1492,18 @@ lang=\"%s\" xml:lang=\"%s\">
>     (setq html (nreverse html))
>     (unless splice
>       ;; Put in col tags with the alignment (unfortunately often  
> ignored...)
> -      (push (mapconcat
> -	     (lambda (x)
> -	       (setq gr (pop org-table-colgroup-info))
> -	       (format "%s<col align=\"%s\"></col>%s"
> -		       (if (memq gr '(:start :startend))
> -			   (prog1
> -			       (if colgropen "</colgroup>\n<colgroup>" "<colgroup>")
> -			     (setq colgropen t))
> -			 "")
> +      (push (concat
> +	     "<colgroup>"
> +	     (mapconcat
> +	      (lambda (x)
> +		(setq gr (pop org-table-colgroup-info))
> +		(format "<col align=\"%s\" />"
> 		       (if (> (/ (float x) nlines) org-table-number-fraction)
> -			   "right" "left")
> -		       (if (memq gr '(:end :startend))
> -			   (progn (setq colgropen nil) "</colgroup>")
> -			 "")))
> -	     fnum "")
> +			   "right" "left")))
> +	      fnum "")
> +	     "</colgroup>")
> 	    html)
> -      (if colgropen (setq html (cons (car html) (cons "</ 
> colgroup>" (cdr html)))))
> +
>       ;; Since the output of HTML table formatter can also be used in
>       ;; DocBook document, we want to always include the caption to  
> make
>       ;; DocBook XML file valid.
>
>
> Regards
>
>     Sebastian
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2009-05-04 14:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-04  9:18 Valid xhtml and org-html.el Sebastian Rose
2009-05-04 14:22 ` Carsten Dominik

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