Skip to content

Instantly share code, notes, and snippets.

@torus
Created March 3, 2011 02:57
Show Gist options
  • Save torus/852237 to your computer and use it in GitHub Desktop.
Save torus/852237 to your computer and use it in GitHub Desktop.
yahtml for XHTML
diff -r 127a36f4cd6a yahtml.el
--- a/yahtml.el Mon Sep 28 12:48:28 2009 +0900
+++ b/yahtml.el Wed Mar 02 16:55:11 2011 -1000
@@ -880,7 +880,9 @@
(if (string= form "") (setq form yahtml-last-form))
(setq yahtml-last-form form)
(if yahtml-prefer-upcases (setq form (upcase form)))
- (insert (format "<%s%s>" form (yahtml-addin form)))
+ (insert (format "<%s%s%s>" form (yahtml-addin form)
+ (if (and yahtml-need-single-closer
+ (cdr (assoc form yahtml-form-table))) "" " /")))
;;(indent-relative-maybe)
(if (cdr (assoc form yahtml-form-table))
(save-excursion (insert (format "</%s>" form))))
@@ -1641,8 +1643,9 @@
(insert (format "<%s%s%s>"
cmd
(yahtml-addin cmd)
- (if (and yahtml-need-single-closer
- (assoc cmd '(("br")("hr"))))
+ (if yahtml-need-single-closer
+ ;; (and yahtml-need-single-closer
+ ;; (assoc cmd '(("br")("hr"))))
" /" "")))
(if (assoc cmd yahtml-env-table)
(save-excursion (insert (format "</%s>" cmd)))))
@torus
Copy link
Author

torus commented Mar 3, 2011

(setq yahtml-need-single-closer t)

と設定しておくと、空タグは <tag/> の形で出力するようになります。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment