help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

I reached limit of 'html-tag-alist' in html-mode. Need advice for templa


From: Oleksandr Gavenko
Subject: I reached limit of 'html-tag-alist' in html-mode. Need advice for template engine.
Date: Sun, 13 Jan 2013 17:17:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

To quickly insert HTML template I use standard html-mode command sgml-tag (C-c
C-t). I modify standard template by own code:

  (setq my-html-template
        '("html"
          (nil
           "\n<head>" \n
           "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" 
(read-input "Charset: ") "\">" \n
           "<title>" (setq str (read-input "Title: ")) "</title>\n"
           "</head>\n"
           "<body>\n<h1>" str "</h1>"
           "\n<address>" \n
           "<a href=\"mailto:"; user-mail-address "\">" (user-full-name) "</a>" 
\n
           "</address>" \n
           "</body>\n"
           ))
        )

  (setq sgml-set-face t)                  ; for highlighting in sgml
  (eval-after-load 'sgml-mode
    '(progn
       (unless (featurep 'psgml)
         (setq html-tag-alist
               (cons
                my-html-template
                (my-filter
                 (lambda (item) (not (equal (car item) "html")))
                 html-tag-alist)))
         (add-to-list 'html-tag-alist '("script" (\n) ("type" 
"text/javascript") ))
         (add-to-list 'html-tag-alist '("style" (\n) ("type" "text/css") ))
         )))

But seems that I can't insert such code:

  <!DOCTYPE html>
  <html>
    ...
  </html>

So I start look to Emacs general templating engine.

Simple search shown that most feature rich is yasnippet:

  http://www.emacswiki.org/emacs/CategoryTemplates

I try this package before but it was hard to extend by own snippet. And I
dislike file naming convention (tag == file name) - it was very US/ASCII
specific.

Next thing that was interesting is SRecode which already in Emacs and use sane
syntax and can use Semantic info for completion.

But SRecode have no HTML templates implementation...

-- 
Best regards!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]