diff options
| author | Simen Heggestøyl | 2015-03-17 23:11:55 +0100 |
|---|---|---|
| committer | Simen Heggestøyl | 2015-03-17 23:11:55 +0100 |
| commit | 7ec63a3afa52213b7b3cd3ecc0717c6e6504dc43 (patch) | |
| tree | 95c16839d95d2bb7f291771c46178bb63b82dec3 | |
| parent | 62fde9ee0fe62c8285c61b01444e8e59d1654685 (diff) | |
| download | emacs-7ec63a3afa52213b7b3cd3ecc0717c6e6504dc43.tar.gz emacs-7ec63a3afa52213b7b3cd3ecc0717c6e6504dc43.zip | |
Update CSS property list
* textmodes/css-mode.el (css-extract-keyword-list): Remove function in
favor of manual extraction.
(css-extract-parse-val-grammar): Remove function in favor of
manual extraction.
(css-extract-props-and-vals): Remove function in favor of manual
extraction.
(css-at-ids): Update list of CSS at-rule ids.
(css-property-ids): Update list of CSS properties.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/textmodes/css-mode.el | 210 |
2 files changed, 105 insertions, 113 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 973322691b0..25571bab9c5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -13,6 +13,14 @@ | |||
| 13 | (css-completion-at-point): New function providing completion for | 13 | (css-completion-at-point): New function providing completion for |
| 14 | `css-mode'. | 14 | `css-mode'. |
| 15 | (css-mode): Add support for completion. | 15 | (css-mode): Add support for completion. |
| 16 | (css-extract-keyword-list): Remove function in favor of manual | ||
| 17 | extraction. | ||
| 18 | (css-extract-parse-val-grammar): Remove function in favor of | ||
| 19 | manual extraction. | ||
| 20 | (css-extract-props-and-vals): Remove function in favor of manual | ||
| 21 | extraction. | ||
| 22 | (css-at-ids): Update list of CSS at-rule ids. | ||
| 23 | (css-property-ids): Update list of CSS properties. | ||
| 16 | 24 | ||
| 17 | 2015-03-17 Bozhidar Batsov <bozhidar@batsov.com> | 25 | 2015-03-17 Bozhidar Batsov <bozhidar@batsov.com> |
| 18 | 26 | ||
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 555122b1b42..e3578f9e03a 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el | |||
| @@ -38,89 +38,6 @@ | |||
| 38 | "Cascading Style Sheets (CSS) editing mode." | 38 | "Cascading Style Sheets (CSS) editing mode." |
| 39 | :group 'languages) | 39 | :group 'languages) |
| 40 | 40 | ||
| 41 | |||
| 42 | (defun css-extract-keyword-list (res) | ||
| 43 | (with-temp-buffer | ||
| 44 | (url-insert-file-contents "http://www.w3.org/TR/REC-CSS2/css2.txt") | ||
| 45 | (goto-char (point-max)) | ||
| 46 | (search-backward "Appendix H. Index") | ||
| 47 | (forward-line) | ||
| 48 | (delete-region (point-min) (point)) | ||
| 49 | (let ((result nil) | ||
| 50 | keys) | ||
| 51 | (dolist (re res) | ||
| 52 | (goto-char (point-min)) | ||
| 53 | (setq keys nil) | ||
| 54 | (while (re-search-forward (cdr re) nil t) | ||
| 55 | (push (match-string 1) keys)) | ||
| 56 | (push (cons (car re) (sort keys 'string-lessp)) result)) | ||
| 57 | (nreverse result)))) | ||
| 58 | |||
| 59 | (defun css-extract-parse-val-grammar (string env) | ||
| 60 | (let ((start 0) | ||
| 61 | (elems ()) | ||
| 62 | name) | ||
| 63 | (while (string-match | ||
| 64 | (concat "\\(?:" | ||
| 65 | (concat "<a [^>]+><span [^>]+>\\(?:" | ||
| 66 | "<\\([^&]+\\)>\\|'\\([^']+\\)'" | ||
| 67 | "\\)</span></a>") | ||
| 68 | "\\|" "\\(\\[\\)" | ||
| 69 | "\\|" "\\(]\\)" | ||
| 70 | "\\|" "\\(||\\)" | ||
| 71 | "\\|" "\\(|\\)" | ||
| 72 | "\\|" "\\([*+?]\\)" | ||
| 73 | "\\|" "\\({[^}]+}\\)" | ||
| 74 | "\\|" "\\(\\w+\\(?:-\\w+\\)*\\)" | ||
| 75 | "\\)[ \t\n]*") | ||
| 76 | string start) | ||
| 77 | ;; (assert (eq start (match-beginning 0))) | ||
| 78 | (setq start (match-end 0)) | ||
| 79 | (cond | ||
| 80 | ;; Reference to a type of value. | ||
| 81 | ((setq name (match-string-no-properties 1 string)) | ||
| 82 | (push (intern name) elems)) | ||
| 83 | ;; Reference to another property's values. | ||
| 84 | ((setq name (match-string-no-properties 2 string)) | ||
| 85 | (setq elems (delete-dups (append (cdr (assoc name env)) elems)))) | ||
| 86 | ;; A literal | ||
| 87 | ((setq name (match-string-no-properties 9 string)) | ||
| 88 | (push name elems)) | ||
| 89 | ;; We just ignore the rest. I.e. we ignore the structure because | ||
| 90 | ;; it's too difficult to exploit anyway (it would allow us to only | ||
| 91 | ;; complete top/center/bottom after one of left/center/right and | ||
| 92 | ;; vice-versa). | ||
| 93 | (t nil))) | ||
| 94 | elems)) | ||
| 95 | |||
| 96 | |||
| 97 | (defun css-extract-props-and-vals () | ||
| 98 | (with-temp-buffer | ||
| 99 | (url-insert-file-contents "http://www.w3.org/TR/CSS21/propidx.html") | ||
| 100 | (goto-char (point-min)) | ||
| 101 | (let ((props ())) | ||
| 102 | (while (re-search-forward "#propdef-\\([^\"]+\\)\"><span class=\"propinst-\\1 xref\">'\\1'</span></a>" nil t) | ||
| 103 | (let ((prop (match-string-no-properties 1))) | ||
| 104 | (save-excursion | ||
| 105 | (goto-char (match-end 0)) | ||
| 106 | (search-forward "<td>") | ||
| 107 | (let ((vals-string (buffer-substring (point) | ||
| 108 | (progn | ||
| 109 | (re-search-forward "[ \t\n]+|[ \t\n]+<a href=\"cascade.html#value-def-inherit\" class=\"noxref\"><span class=\"value-inst-inherit\">inherit</span></a>") | ||
| 110 | (match-beginning 0))))) | ||
| 111 | ;; | ||
| 112 | (push (cons prop (css-extract-parse-val-grammar vals-string props)) | ||
| 113 | props))))) | ||
| 114 | props))) | ||
| 115 | |||
| 116 | ;; Extraction was done with: | ||
| 117 | ;; (css-extract-keyword-list | ||
| 118 | ;; '((pseudo . "^ +\\* :\\([^ \n,]+\\)") | ||
| 119 | ;; (at . "^ +\\* @\\([^ \n,]+\\)") | ||
| 120 | ;; (descriptor . "^ +\\* '\\([^ '\n]+\\)' (descriptor)") | ||
| 121 | ;; (media . "^ +\\* '\\([^ '\n]+\\)' media group") | ||
| 122 | ;; (property . "^ +\\* '\\([^ '\n]+\\)',"))) | ||
| 123 | |||
| 124 | (defconst css-pseudo-class-ids | 41 | (defconst css-pseudo-class-ids |
| 125 | '("active" "checked" "disabled" "empty" "enabled" "first" | 42 | '("active" "checked" "disabled" "empty" "enabled" "first" |
| 126 | "first-child" "first-of-type" "focus" "hover" "indeterminate" "lang" | 43 | "first-child" "first-of-type" "focus" "hover" "indeterminate" "lang" |
| @@ -134,7 +51,7 @@ | |||
| 134 | "Identifiers for pseudo-elements.") | 51 | "Identifiers for pseudo-elements.") |
| 135 | 52 | ||
| 136 | (defconst css-at-ids | 53 | (defconst css-at-ids |
| 137 | '("charset" "font-face" "import" "media" "page") | 54 | '("charset" "font-face" "import" "media" "namespace" "page") |
| 138 | "Identifiers that appear in the form @foo.") | 55 | "Identifiers that appear in the form @foo.") |
| 139 | 56 | ||
| 140 | (defconst css-descriptor-ids | 57 | (defconst css-descriptor-ids |
| @@ -150,36 +67,103 @@ | |||
| 150 | "Identifiers for types of media.") | 67 | "Identifiers for types of media.") |
| 151 | 68 | ||
| 152 | (defconst css-property-ids | 69 | (defconst css-property-ids |
| 153 | '("azimuth" "background" "background-attachment" "background-color" | 70 | '(;; CSS 2.1 properties (http://www.w3.org/TR/CSS21/propidx.html). |
| 154 | "background-image" "background-position" "background-repeat" "block" | 71 | ;; |
| 155 | "border" "border-bottom" "border-bottom-color" "border-bottom-style" | 72 | ;; Properties duplicated by any of the CSS3 modules below have |
| 156 | "border-bottom-width" "border-collapse" "border-color" "border-left" | 73 | ;; been removed. |
| 157 | "border-left-color" "border-left-style" "border-left-width" "border-right" | 74 | "azimuth" "border-collapse" "border-spacing" "bottom" |
| 75 | "caption-side" "clear" "clip" "content" "counter-increment" | ||
| 76 | "counter-reset" "cue" "cue-after" "cue-before" "direction" "display" | ||
| 77 | "elevation" "empty-cells" "float" "height" "left" "line-height" | ||
| 78 | "list-style" "list-style-image" "list-style-position" | ||
| 79 | "list-style-type" "margin" "margin-bottom" "margin-left" | ||
| 80 | "margin-right" "margin-top" "max-height" "max-width" "min-height" | ||
| 81 | "min-width" "orphans" "overflow" "padding" "padding-bottom" | ||
| 82 | "padding-left" "padding-right" "padding-top" "page-break-after" | ||
| 83 | "page-break-before" "page-break-inside" "pause" "pause-after" | ||
| 84 | "pause-before" "pitch" "pitch-range" "play-during" "position" | ||
| 85 | "quotes" "richness" "right" "speak" "speak-header" "speak-numeral" | ||
| 86 | "speak-punctuation" "speech-rate" "stress" "table-layout" "top" | ||
| 87 | "unicode-bidi" "vertical-align" "visibility" "voice-family" "volume" | ||
| 88 | "widows" "width" "z-index" | ||
| 89 | |||
| 90 | ;; CSS Animations | ||
| 91 | ;; (http://www.w3.org/TR/css3-animations/#property-index) | ||
| 92 | "animation" "animation-delay" "animation-direction" | ||
| 93 | "animation-duration" "animation-fill-mode" | ||
| 94 | "animation-iteration-count" "animation-name" | ||
| 95 | "animation-play-state" "animation-timing-function" | ||
| 96 | |||
| 97 | ;; CSS Backgrounds and Borders Module Level 3 | ||
| 98 | ;; (http://www.w3.org/TR/css3-background/#property-index) | ||
| 99 | "background" "background-attachment" "background-clip" | ||
| 100 | "background-color" "background-image" "background-origin" | ||
| 101 | "background-position" "background-repeat" "background-size" | ||
| 102 | "border" "border-bottom" "border-bottom-color" | ||
| 103 | "border-bottom-left-radius" "border-bottom-right-radius" | ||
| 104 | "border-bottom-style" "border-bottom-width" "border-color" | ||
| 105 | "border-image" "border-image-outset" "border-image-repeat" | ||
| 106 | "border-image-slice" "border-image-source" "border-image-width" | ||
| 107 | "border-left" "border-left-color" "border-left-style" | ||
| 108 | "border-left-width" "border-radius" "border-right" | ||
| 158 | "border-right-color" "border-right-style" "border-right-width" | 109 | "border-right-color" "border-right-style" "border-right-width" |
| 159 | "border-spacing" "border-style" "border-top" "border-top-color" | 110 | "border-style" "border-top" "border-top-color" |
| 160 | "border-top-style" "border-top-width" "border-width" "bottom" | 111 | "border-top-left-radius" "border-top-right-radius" |
| 161 | "caption-side" "clear" "clip" "color" "compact" "content" | 112 | "border-top-style" "border-top-width" "border-width" "box-shadow" |
| 162 | "counter-increment" "counter-reset" "cue" "cue-after" "cue-before" | 113 | |
| 163 | "cursor" "dashed" "direction" "display" "dotted" "double" "elevation" | 114 | ;; CSS Basic User Interface Module Level 3 (CSS3 UI) |
| 164 | "empty-cells" "float" "font" "font-family" "font-size" "font-size-adjust" | 115 | ;; (http://www.w3.org/TR/css3-ui/#property-index) |
| 165 | "font-stretch" "font-style" "font-variant" "font-weight" "groove" "height" | 116 | "box-sizing" "caret-color" "cursor" "nav-down" "nav-left" |
| 166 | "hidden" "inline" "inline-table" "inset" "left" "letter-spacing" | 117 | "nav-right" "nav-up" "outline" "outline-color" "outline-offset" |
| 167 | "line-height" "list-item" "list-style" "list-style-image" | 118 | "outline-style" "outline-width" "resize" "text-overflow" |
| 168 | "list-style-position" "list-style-type" "margin" "margin-bottom" | 119 | |
| 169 | "margin-left" "margin-right" "margin-top" "marker-offset" "marks" | 120 | ;; CSS Color Module Level 3 |
| 170 | "max-height" "max-width" "min-height" "min-width" "orphans" "outline" | 121 | ;; (http://www.w3.org/TR/css3-color/#property) |
| 171 | "outline-color" "outline-style" "outline-width" "outset" "overflow" | 122 | "color" "opacity" |
| 172 | "padding" "padding-bottom" "padding-left" "padding-right" "padding-top" | 123 | |
| 173 | "page" "page-break-after" "page-break-before" "page-break-inside" "pause" | 124 | ;; CSS Flexible Box Layout Module Level 1 |
| 174 | "pause-after" "pause-before" "pitch" "pitch-range" "play-during" "position" | 125 | ;; (http://www.w3.org/TR/css-flexbox-1/#property-index) |
| 175 | "quotes" "richness" "ridge" "right" "run-in" "size" "solid" "speak" | 126 | "align-content" "align-items" "align-self" "flex" "flex-basis" |
| 176 | "speak-header" "speak-numeral" "speak-punctuation" "speech-rate" "stress" | 127 | "flex-direction" "flex-flow" "flex-grow" "flex-shrink" "flex-wrap" |
| 177 | "table" "table-caption" "table-cell" "table-column" "table-column-group" | 128 | "justify-content" "order" |
| 178 | "table-footer-group" "table-header-group" "table-layout" "table-row" | 129 | |
| 179 | "table-row-group" "text-align" "text-decoration" "text-indent" | 130 | ;; CSS Fonts Module Level 3 |
| 180 | "text-shadow" "text-transform" "top" "unicode-bidi" "vertical-align" | 131 | ;; (http://www.w3.org/TR/css3-fonts/#property-index) |
| 181 | "visibility" "voice-family" "volume" "white-space" "widows" "width" | 132 | "font" "font-family" "font-feature-settings" "font-kerning" |
| 182 | "word-spacing" "z-index") | 133 | "font-language-override" "font-size" "font-size-adjust" |
| 134 | "font-stretch" "font-style" "font-synthesis" "font-variant" | ||
| 135 | "font-variant-alternates" "font-variant-caps" | ||
| 136 | "font-variant-east-asian" "font-variant-ligatures" | ||
| 137 | "font-variant-numeric" "font-variant-position" "font-weight" | ||
| 138 | |||
| 139 | ;; CSS Text Decoration Module Level 3 | ||
| 140 | ;; (http://dev.w3.org/csswg/css-text-decor-3/#property-index) | ||
| 141 | "text-decoration" "text-decoration-color" "text-decoration-line" | ||
| 142 | "text-decoration-skip" "text-decoration-style" "text-emphasis" | ||
| 143 | "text-emphasis-color" "text-emphasis-position" "text-emphasis-style" | ||
| 144 | "text-shadow" "text-underline-position" | ||
| 145 | |||
| 146 | ;; CSS Text Module Level 3 | ||
| 147 | ;; (http://www.w3.org/TR/css3-text/#property-index) | ||
| 148 | "hanging-punctuation" "hyphens" "letter-spacing" "line-break" | ||
| 149 | "overflow-wrap" "tab-size" "text-align" "text-align-last" | ||
| 150 | "text-indent" "text-justify" "text-transform" "white-space" | ||
| 151 | "word-break" "word-spacing" "word-wrap" | ||
| 152 | |||
| 153 | ;; CSS Transforms Module Level 1 | ||
| 154 | ;; (http://www.w3.org/TR/css3-2d-transforms/#property-index) | ||
| 155 | "backface-visibility" "perspective" "perspective-origin" | ||
| 156 | "transform" "transform-origin" "transform-style" | ||
| 157 | |||
| 158 | ;; CSS Transitions | ||
| 159 | ;; (http://www.w3.org/TR/css3-transitions/#property-index) | ||
| 160 | "transition" "transition-delay" "transition-duration" | ||
| 161 | "transition-property" "transition-timing-function" | ||
| 162 | |||
| 163 | ;; Filter Effects Module Level 1 | ||
| 164 | ;; (http://www.w3.org/TR/filter-effects/#property-index) | ||
| 165 | "color-interpolation-filters" "filter" "flood-color" | ||
| 166 | "flood-opacity" "lighting-color") | ||
| 183 | "Identifiers for properties.") | 167 | "Identifiers for properties.") |
| 184 | 168 | ||
| 185 | (defcustom css-electric-keys '(?\} ?\;) ;; '() | 169 | (defcustom css-electric-keys '(?\} ?\;) ;; '() |