unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stuart D. Herring" <herring@lanl.gov>
Cc: emacs-devel@gnu.org
Subject: Re: table.el downcase HTML tags
Date: Tue, 30 May 2006 15:08:51 -0700 (PDT)	[thread overview]
Message-ID: <37314.128.165.123.132.1149026931.squirrel@webmail.lanl.gov> (raw)
In-Reply-To: <g69irnnxo4q.fsf@CN1374059D0130.kendall.corp.akamai.com>

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

  reply	other threads:[~2006-05-30 22:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37314.128.165.123.132.1149026931.squirrel@webmail.lanl.gov \
    --to=herring@lanl.gov \
    --cc=emacs-devel@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.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).