diff options
author | Shin Aoyama <smihica@gmail.com> | 2014-08-08 03:13:55 +0900 |
---|---|---|
committer | Shin Aoyama <smihica@gmail.com> | 2014-08-08 03:13:55 +0900 |
commit | ece1701b1e70956802c67d8b56234dc185f6550c (patch) | |
tree | fb1a44eb3304f748c655131f38054f1a27a318e4 | |
parent | fdfa4d71fe42f6410e0617b46ec5de2935d14a5e (diff) | |
parent | 8b88b7d750901dc9f8adffb1bfa08cac5385917a (diff) | |
download | emmet-mode-ece1701b1e70956802c67d8b56234dc185f6550c.tar.lz emmet-mode-ece1701b1e70956802c67d8b56234dc185f6550c.tar.xz emmet-mode-ece1701b1e70956802c67d8b56234dc185f6550c.zip |
Merge pull request #29 from flyingleafe/master
Fixing improper block tags expansion
-rw-r--r-- | conf/preferences.json | 4 | ||||
-rw-r--r-- | emmet-mode.el | 18 | ||||
-rw-r--r-- | src/html-abbrev.el | 14 | ||||
-rw-r--r-- | src/preferences.el | 4 | ||||
-rwxr-xr-x | tools/json2hash | 6 |
5 files changed, 24 insertions, 22 deletions
diff --git a/conf/preferences.json b/conf/preferences.json index 5cb84f7..5e76145 100644 --- a/conf/preferences.json +++ b/conf/preferences.json @@ -35,7 +35,7 @@ "dfn": {"block": false, "selfClosing": false}, "dialog": {"block": false, "selfClosing": false}, "dir": {"block": true, "selfClosing": false}, - "div": {"block": false, "selfClosing": false}, + "div": {"block": true, "selfClosing": false}, "dl": {"block": true, "selfClosing": false}, "dt": {"block": false, "selfClosing": false}, "em": {"block": false, "selfClosing": false}, @@ -83,7 +83,7 @@ "optgroup": {"block": true, "selfClosing": false}, "option": {"block": false, "selfClosing": false, "defaultAttr": {"value": ""}}, "output": {"block": false, "selfClosing": false}, - "p": {"block": false, "selfClosing": false}, + "p": {"block": true, "selfClosing": false}, "param": {"block": false, "selfClosing": true, "defaultAttr": {"name": "", "value": ""}}, "pre": {"block": true, "selfClosing": false}, "progress": {"block": false, "selfClosing": false}, diff --git a/emmet-mode.el b/emmet-mode.el index 1452731..898ec22 100644 --- a/emmet-mode.el +++ b/emmet-mode.el @@ -1977,7 +1977,7 @@ tbl) tbl) (puthash "selfClosing" nil tbl) tbl) tbl) (puthash "div" (let ((tbl (make-hash-table :test 'equal))) -(puthash "block" nil tbl) +(puthash "block" t tbl) (puthash "selfClosing" nil tbl) tbl) tbl) (puthash "dl" (let ((tbl (make-hash-table :test 'equal))) @@ -2206,7 +2206,7 @@ tbl) tbl) (puthash "selfClosing" nil tbl) tbl) tbl) (puthash "p" (let ((tbl (make-hash-table :test 'equal))) -(puthash "block" nil tbl) +(puthash "block" t tbl) (puthash "selfClosing" nil tbl) tbl) tbl) (puthash "param" (let ((tbl (make-hash-table :test 'equal))) @@ -2936,16 +2936,17 @@ tbl)) (self-closing? (and (not (or tag-txt content)) (or (not tag-has-body?) (and settings (gethash "selfClosing" settings))))) - (lf (if (or content-multiline? block-tag?) "\n"))) + (block-indentation? (or content-multiline? (and block-tag? content))) + (lf (if block-indentation? "\n"))) (concat "<" tag-name id classes props (if self-closing? "/>" (concat ">" (if tag-txt - (if (or content-multiline? block-tag?) + (if block-indentation? (emmet-indent tag-txt) tag-txt)) (if content - (if (or content-multiline? block-tag?) + (if block-indentation? (emmet-indent content) content)) lf @@ -2989,15 +2990,16 @@ tbl)) (lambda (prop) (concat ":" (symbol-name (car prop)) " \"" (cadr prop) "\"")))) (content-multiline? (and content (string-match "\n" content))) - (block-tag? (and settings (gethash "block" settings)))) + (block-tag? (and settings (gethash "block" settings))) + (block-indentation? (or content-multiline? (and block-tag? content)))) (concat "[:" tag-name id classes props (if tag-txt (let ((tag-txt-quoted (concat "\"" tag-txt "\""))) - (if (or content-multiline? block-tag?) + (if block-indentation? (emmet-indent tag-txt-quoted) (concat " " tag-txt-quoted)))) (if content - (if (or content-multiline? block-tag?) + (if block-indentation? (emmet-indent content) (concat " " content))) "]"))) diff --git a/src/html-abbrev.el b/src/html-abbrev.el index ccc233e..7dbf842 100644 --- a/src/html-abbrev.el +++ b/src/html-abbrev.el @@ -553,16 +553,17 @@ (self-closing? (and (not (or tag-txt content)) (or (not tag-has-body?) (and settings (gethash "selfClosing" settings))))) - (lf (if (or content-multiline? block-tag?) "\n"))) + (block-indentation? (or content-multiline? (and block-tag? content))) + (lf (if block-indentation? "\n"))) (concat "<" tag-name id classes props (if self-closing? "/>" (concat ">" (if tag-txt - (if (or content-multiline? block-tag?) + (if block-indentation? (emmet-indent tag-txt) tag-txt)) (if content - (if (or content-multiline? block-tag?) + (if block-indentation? (emmet-indent content) content)) lf @@ -606,15 +607,16 @@ (lambda (prop) (concat ":" (symbol-name (car prop)) " \"" (cadr prop) "\"")))) (content-multiline? (and content (string-match "\n" content))) - (block-tag? (and settings (gethash "block" settings)))) + (block-tag? (and settings (gethash "block" settings))) + (block-indentation? (or content-multiline? (and block-tag? content)))) (concat "[:" tag-name id classes props (if tag-txt (let ((tag-txt-quoted (concat "\"" tag-txt "\""))) - (if (or content-multiline? block-tag?) + (if block-indentation? (emmet-indent tag-txt-quoted) (concat " " tag-txt-quoted)))) (if content - (if (or content-multiline? block-tag?) + (if block-indentation? (emmet-indent content) (concat " " content))) "]"))) diff --git a/src/preferences.el b/src/preferences.el index a5f1d6d..c035c0c 100644 --- a/src/preferences.el +++ b/src/preferences.el @@ -1142,7 +1142,7 @@ tbl) tbl) (puthash "selfClosing" nil tbl) tbl) tbl) (puthash "div" (let ((tbl (make-hash-table :test 'equal))) -(puthash "block" nil tbl) +(puthash "block" t tbl) (puthash "selfClosing" nil tbl) tbl) tbl) (puthash "dl" (let ((tbl (make-hash-table :test 'equal))) @@ -1371,7 +1371,7 @@ tbl) tbl) (puthash "selfClosing" nil tbl) tbl) tbl) (puthash "p" (let ((tbl (make-hash-table :test 'equal))) -(puthash "block" nil tbl) +(puthash "block" t tbl) (puthash "selfClosing" nil tbl) tbl) tbl) (puthash "param" (let ((tbl (make-hash-table :test 'equal))) diff --git a/tools/json2hash b/tools/json2hash index 2ac6cdd..ae2505f 100755 --- a/tools/json2hash +++ b/tools/json2hash @@ -1,5 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from __future__ import print_function import json import sys import os @@ -98,7 +99,4 @@ if __name__ == '__main__': try: main() except ApplicationException as e: - if python2: - print >> sys.stderr, e.message - elif python3: - print(e.meesage, file=sys.stderr) + print(e.message, file=sys.stderr) |