all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* table.el downcase HTML tags
@ 2006-05-30 17:13 Tak Ota
  2006-05-30 19:23 ` Mathias Dahl
  2006-05-31  8:00 ` Kim F. Storm
  0 siblings, 2 replies; 13+ messages in thread
From: Tak Ota @ 2006-05-30 17:13 UTC (permalink / raw)
  Cc: carsten.dominik

This has been requested for many times that HTML tags that table.el
generates to be downcased to be compatible with XHTML standard.  If no
one objects could someone check the following change into the
repository.  Thanks.

-Tak

2006-05-30  Takaaki Ota  <Takaaki.Ota@am.sony.com>

	* textmodes/table.el: Convert all HTML tags to lower case for
	XHTML compatibility.


bash-3.1$ diff ../../../../d/pub/emacs/pure/emacs/lisp/textmodes/table.el table.el
9c9
< ;; Revised: Sat Aug 06 2005 19:42:54 (CEST)
---
> ;; Revised: Tue May 30 2006 10:01:43 (PDT)
3107c3107
< 	      (format "<TABLE %s>\n" table-html-table-attribute)
---
> 	      (format "<table %s>\n" table-html-table-attribute)
3110c3110
< 		  (format "  <CAPTION>%s</CAPTION>\n" caption)
---
> 		  (format "  <caption>%s</caption>\n" caption)
3134c3134
<       (insert "</TABLE>\n"))
---
>       (insert "</table>\n"))
3155c3155
< 	(insert "  <TR>\n"))
---
> 	(insert "  <tr>\n"))
3163c3163
< 	(insert "  </TR>\n"))
---
> 	(insert "  </tr>\n"))
3210c3210
< 				   "TH" "TD"))))
---
> 				   "th" "td"))))
3269c3269
< 	    (insert "<BR />")
---
> 	    (insert "<br />")

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

* Re: table.el downcase HTML tags
  2006-05-30 17:13 table.el downcase HTML tags Tak Ota
@ 2006-05-30 19:23 ` Mathias Dahl
  2006-05-30 19:58   ` Lennart Borgman
  2006-05-31 14:19   ` Carsten Dominik
  2006-05-31  8:00 ` Kim F. Storm
  1 sibling, 2 replies; 13+ messages in thread
From: Mathias Dahl @ 2006-05-30 19:23 UTC (permalink / raw)
  Cc: carsten.dominik, emacs-devel

> This has been requested for many times that HTML tags that table.el
> generates to be downcased to be compatible with XHTML standard.  If no
> one objects could someone check the following change into the
> repository.  Thanks.
>
> <             (format "<TABLE %s>\n" table-html-table-attribute)

Why not making it configurable? I don't care about the case in this
case (haha!) but I am sure some do.

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

* Re: table.el downcase HTML tags
  2006-05-30 19:23 ` Mathias Dahl
@ 2006-05-30 19:58   ` Lennart Borgman
  2006-05-30 20:18     ` Ted Zlatanov
  2006-05-30 21:00     ` Kevin Rodgers
  2006-05-31 14:19   ` Carsten Dominik
  1 sibling, 2 replies; 13+ messages in thread
From: Lennart Borgman @ 2006-05-30 19:58 UTC (permalink / raw)
  Cc: emacs-devel, Tak Ota, carsten.dominik

Mathias Dahl wrote:
>> This has been requested for many times that HTML tags that table.el
>> generates to be downcased to be compatible with XHTML standard.  If no
>> one objects could someone check the following change into the
>> repository.  Thanks.
>>
>> <             (format "<TABLE %s>\n" table-html-table-attribute)
>
> Why not making it configurable? I don't care about the case in this
> case (haha!) but I am sure some do.
I do not know of any case where uppercase tags is useful. Are there 
really any such cases?

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

* Re: table.el downcase HTML tags
  2006-05-30 19:58   ` Lennart Borgman
@ 2006-05-30 20:18     ` Ted Zlatanov
  2006-05-30 22:08       ` Stuart D. Herring
  2006-05-31  7:52       ` Kim F. Storm
  2006-05-30 21:00     ` Kevin Rodgers
  1 sibling, 2 replies; 13+ messages in thread
From: Ted Zlatanov @ 2006-05-30 20:18 UTC (permalink / raw)


On 30 May 2006, lennart.borgman.073@student.lu.se wrote:

> I do not know of any case where uppercase tags is useful. Are there
> really any such cases?

Old, badly written parsers may look for "TABLE" and break with
"table".  Generally, why break old behavior if it can be left in as an
option?

For table.el, why not define something like this:

(defcustom table-uppercase-html-tags nil
  "*All generated HTML tags are in uppercase when this is set."
  :tag "Uppercase HTML tags"
  :type 'boolean
  :group 'table)

(defun table--generate-source-html-tag (tag-symbol text &optional options)
  (let ((tag-symbol (if table-uppercase-html-tags
		       (upcase tag-symbol)
		     tag-symbol)))
    (format "<%s %s> %s </%s>" tag-symbol options text tag-symbol)))

This would also simplify a lot of the table.el code that generates HTML :)

Ted

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

* Re: table.el downcase HTML tags
  2006-05-30 19:58   ` Lennart Borgman
  2006-05-30 20:18     ` Ted Zlatanov
@ 2006-05-30 21:00     ` Kevin Rodgers
  1 sibling, 0 replies; 13+ messages in thread
From: Kevin Rodgers @ 2006-05-30 21:00 UTC (permalink / raw)


Lennart Borgman wrote:
> Mathias Dahl wrote:
>>> This has been requested for many times that HTML tags that table.el
>>> generates to be downcased to be compatible with XHTML standard.  If no
>>> one objects could someone check the following change into the
>>> repository.  Thanks.
>>>
>>> <             (format "<TABLE %s>\n" table-html-table-attribute)
>>
>> Why not making it configurable? I don't care about the case in this
>> case (haha!) but I am sure some do.
> I do not know of any case where uppercase tags is useful. Are there 
> really any such cases?

No, because HTML is a case-insensitive SGML application:

See http://www.w3.org/TR/html4/

	HTML 4 is an SGML application conforming to International
	Standard ISO 8879 -- Standard Generalized Markup Language
	[ISO8879].

See http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.1

	Element names are always case-insensitive.

See http://www.w3.org/TR/html4/sgml/sgmldecl.html

	                  NAMECASE GENERAL YES
	                           ENTITY  NO

Note however, that clause 9.3 of ISO 8879 states that

	The upper-case form of each character in a name, name token,
	number, or number token, as specified by the "NAMECASE"
	parameter of the SGML declaration, is substituted for the
	character actually entered.

so the uppercase names are actually canonical in HTML, whereas the
lowercase names are mandatory in XHTML which is a (case-sensitive)
XML application.

-- 
Kevin

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

* Re: table.el downcase HTML tags
  2006-05-30 20:18     ` Ted Zlatanov
@ 2006-05-30 22:08       ` Stuart D. Herring
  2006-05-30 22:42         ` Lennart Borgman
  2006-05-31 14:33         ` Ted Zlatanov
  2006-05-31  7:52       ` Kim F. Storm
  1 sibling, 2 replies; 13+ messages in thread
From: Stuart D. Herring @ 2006-05-30 22:08 UTC (permalink / raw)
  Cc: emacs-devel

[Sorry if this is a resend; mail client broke.]

> (defun table--generate-source-html-tag (tag-symbol text &optional options)
>   (let ((tag-symbol (if table-uppercase-html-tags
> 		       (upcase tag-symbol)
> 		     tag-symbol)))
>     (format "<%s %s> %s </%s>" tag-symbol options text tag-symbol)))
>
> This would also simplify a lot of the table.el code that generates HTML :)

The resulting HTML would be ugly and somewhat incorrect:

(table--generate-source-html-tag "a" "")
 => "<a nil>  </a>"

I'd use

(defun table--generate-source-html-tag (tag &optional body attrs)
  (when table-uppercase-html-tags (setq tag (upcase tag)))
  (concat "<" tag (if attrs " ") attrs
          (if body (concat ">" body "</" tag) "/") ">"))

giving

(table--generate-source-html-tag "a" "b" "c=d")
 => "<a c=d>b</a>"
(table--generate-source-html-tag "a")
 => "<a/>"

I removed the spaces around the body because they could break things and
are trivial to include in the argument.  I'd really be tempted to make
attrs an alist, but that might be overengineering the problem.  The
XML-style empty tags might be undesirable, but they're optional:

(table--generate-source-html-tag "a" "")
 => "<a></a>"

Hope it helps,
Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.

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

* Re: table.el downcase HTML tags
  2006-05-30 22:08       ` Stuart D. Herring
@ 2006-05-30 22:42         ` Lennart Borgman
  2006-05-31 14:33         ` Ted Zlatanov
  1 sibling, 0 replies; 13+ messages in thread
From: Lennart Borgman @ 2006-05-30 22:42 UTC (permalink / raw)
  Cc: Ted Zlatanov, emacs-devel

Stuart D. Herring wrote:
> I'd use
>
> (defun table--generate-source-html-tag (tag &optional body attrs)
>   (when table-uppercase-html-tags (setq tag (upcase tag)))
>   (concat "<" tag (if attrs " ") attrs
>           (if body (concat ">" body "</" tag) "/") ">"))
>
> giving
>
> (table--generate-source-html-tag "a" "b" "c=d")
>  => "<a c=d>b</a>"
> (table--generate-source-html-tag "a")
>  => "<a/>"
>
> I removed the spaces around the body because they could break things and
> are trivial to include in the argument.  I'd really be tempted to make
> attrs an alist, but that might be overengineering the problem.  The
> XML-style empty tags might be undesirable, but they're optional:
>   

Option values should be surrounded by "". An alist should be better to 
avoid problems with this.

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

* Re: table.el downcase HTML tags
  2006-05-30 20:18     ` Ted Zlatanov
  2006-05-30 22:08       ` Stuart D. Herring
@ 2006-05-31  7:52       ` Kim F. Storm
  2006-05-31 14:26         ` Ted Zlatanov
  1 sibling, 1 reply; 13+ messages in thread
From: Kim F. Storm @ 2006-05-31  7:52 UTC (permalink / raw)
  Cc: emacs-devel

Ted Zlatanov <tzz@lifelogs.com> writes:

> On 30 May 2006, lennart.borgman.073@student.lu.se wrote:
>
> Old, badly written parsers may look for "TABLE" and break with
> "table".  

This is not a reason for us to output badly written HTML...

>           Generally, why break old behavior if it can be left in as an
> option?

table.el is new in emacs 22.x, so we still are free to change it,
without considering what those changes might break.

If Tak thinks this change is good, he's the one to judge it.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: table.el downcase HTML tags
  2006-05-30 17:13 table.el downcase HTML tags Tak Ota
  2006-05-30 19:23 ` Mathias Dahl
@ 2006-05-31  8:00 ` Kim F. Storm
  1 sibling, 0 replies; 13+ messages in thread
From: Kim F. Storm @ 2006-05-31  8:00 UTC (permalink / raw)
  Cc: carsten.dominik, emacs-devel

Tak Ota <Takaaki.Ota@am.sony.com> writes:

> This has been requested for many times that HTML tags that table.el
> generates to be downcased to be compatible with XHTML standard.  If no
> one objects could someone check the following change into the
> repository.  Thanks.

Done.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: table.el downcase HTML tags
  2006-05-30 19:23 ` Mathias Dahl
  2006-05-30 19:58   ` Lennart Borgman
@ 2006-05-31 14:19   ` Carsten Dominik
  1 sibling, 0 replies; 13+ messages in thread
From: Carsten Dominik @ 2006-05-31 14:19 UTC (permalink / raw)
  Cc: Tak Ota, emacs-devel

No,  this should not be configurable.  What a waste of resources.

- Carsten

On May 30, 2006, at 21:23, Mathias Dahl wrote:

>> This has been requested for many times that HTML tags that table.el
>> generates to be downcased to be compatible with XHTML standard.  If no
>> one objects could someone check the following change into the
>> repository.  Thanks.
>>
>> <             (format "<TABLE %s>\n" table-html-table-attribute)
>
> Why not making it configurable? I don't care about the case in this
> case (haha!) but I am sure some do.
>
>

--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477

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

* Re: table.el downcase HTML tags
  2006-05-31  7:52       ` Kim F. Storm
@ 2006-05-31 14:26         ` Ted Zlatanov
  2006-05-31 15:10           ` Kim F. Storm
  0 siblings, 1 reply; 13+ messages in thread
From: Ted Zlatanov @ 2006-05-31 14:26 UTC (permalink / raw)


On 31 May 2006, storm@cua.dk wrote:

> Ted Zlatanov <tzz@lifelogs.com> writes:
>
>> On 30 May 2006, lennart.borgman.073@student.lu.se wrote:
>>
>> Old, badly written parsers may look for "TABLE" and break with
>> "table".  
>
> This is not a reason for us to output badly written HTML...

I'm sure it's not badly written, in fact (as pointed out) it's "more"
valid to output uppercase tags with HTML 4.0 and earlier.

I simply offered an option to preserve the old behavior, which also
(IMHO) would simplify the code.

>> Generally, why break old behavior if it can be left in as an
>> option?
>
> table.el is new in emacs 22.x, so we still are free to change it,
> without considering what those changes might break.
>
> If Tak thinks this change is good, he's the one to judge it.

Sure.

Ted

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

* Re: table.el downcase HTML tags
  2006-05-30 22:08       ` Stuart D. Herring
  2006-05-30 22:42         ` Lennart Borgman
@ 2006-05-31 14:33         ` Ted Zlatanov
  1 sibling, 0 replies; 13+ messages in thread
From: Ted Zlatanov @ 2006-05-31 14:33 UTC (permalink / raw)


On 30 May 2006, herring@lanl.gov wrote:

> I'd use
>
> (defun table--generate-source-html-tag (tag &optional body attrs)
> (when table-uppercase-html-tags (setq tag (upcase tag)))
> (concat "<" tag (if attrs " ") attrs
> (if body (concat ">" body "</" tag) "/") ">"))
>
> giving
>
> (table--generate-source-html-tag "a" "b" "c=d")
> => "<a c=d>b</a>"
> (table--generate-source-html-tag "a")
> => "<a/>"

Sure, that works :)

> I removed the spaces around the body because they could break things and
> are trivial to include in the argument.  I'd really be tempted to make
> attrs an alist, but that might be overengineering the problem.  The
> XML-style empty tags might be undesirable, but they're optional:
>
> (table--generate-source-html-tag "a" "")
> => "<a></a>"

Actually all this and more is covered by sgml-mode's sgml-tag (and
friends).  Perhaps they should be used here instead of reinventing the
wheel.

Ted

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

* Re: table.el downcase HTML tags
  2006-05-31 14:26         ` Ted Zlatanov
@ 2006-05-31 15:10           ` Kim F. Storm
  0 siblings, 0 replies; 13+ messages in thread
From: Kim F. Storm @ 2006-05-31 15:10 UTC (permalink / raw)
  Cc: emacs-devel

Ted Zlatanov <tzz@lifelogs.com> writes:

> I simply offered an option to preserve the old behavior, which also
> (IMHO) would simplify the code.

But table.el already used a mixture of lower and uppercase tags, so
making all of them lowercase does not make things worse.

A more thorough cleanup (if needed), should wait until after the release.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

end of thread, other threads:[~2006-05-31 15:10 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-30 17:13 table.el downcase HTML tags Tak Ota
2006-05-30 19:23 ` Mathias Dahl
2006-05-30 19:58   ` Lennart Borgman
2006-05-30 20:18     ` Ted Zlatanov
2006-05-30 22:08       ` Stuart D. Herring
2006-05-30 22:42         ` Lennart Borgman
2006-05-31 14:33         ` Ted Zlatanov
2006-05-31  7:52       ` Kim F. Storm
2006-05-31 14:26         ` Ted Zlatanov
2006-05-31 15:10           ` Kim F. Storm
2006-05-30 21:00     ` Kevin Rodgers
2006-05-31 14:19   ` Carsten Dominik
2006-05-31  8:00 ` Kim F. Storm

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.