[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 8e7e76b 355/433: Move html-js and html-css classes from mm
From: |
Dmitry Gutov |
Subject: |
[elpa] master 8e7e76b 355/433: Move html-js and html-css classes from mmm-erb to mmm-sample |
Date: |
Thu, 15 Mar 2018 19:44:35 -0400 (EDT) |
branch: master
commit 8e7e76be93b40f3d4d325664ab32a0c31a517511
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Move html-js and html-css classes from mmm-erb to mmm-sample
* Overwrite JS and CSS classes that were already there.
* Disregard type and language attributes. The latter is obsolete, the
former is
made optional in HTML5. If we're ever going to dispatch to appropriate
submode
based on attribute value, we can add them back.
* No submode regions for inline code in on* attributes, the added
functionality
is not worth the slowdown (font-lock and indentation are largely unused),
and
such attributes are bad practice anyway.
---
mmm-auto.el | 2 +-
mmm-erb.el | 30 ---------------------
mmm-mason.el | 2 +-
mmm-sample.el | 86 +++++++++++++++++++++++++++++++++--------------------------
4 files changed, 50 insertions(+), 70 deletions(-)
diff --git a/mmm-auto.el b/mmm-auto.el
index 1fd9609..0925ac5 100644
--- a/mmm-auto.el
+++ b/mmm-auto.el
@@ -67,7 +67,7 @@
(defvar mmm-autoloaded-classes
'((mason "mmm-mason" nil)
(myghty "mmm-myghty" nil)
- (embedded-css "mmm-sample" nil)
+ (html-css "mmm-sample" nil)
(html-js "mmm-sample" nil)
(here-doc "mmm-sample" nil)
(embperl "mmm-sample" nil)
diff --git a/mmm-erb.el b/mmm-erb.el
index c850ba4..fb85b9a 100644
--- a/mmm-erb.el
+++ b/mmm-erb.el
@@ -61,36 +61,6 @@
(require 'mmm-vars)
(require 'mmm-region)
-(mmm-add-group
- 'html-js
- '((js-script-cdata
- :submode js-mode
- :face mmm-code-submode-face
- :front "<script[^>]*>[ \t\n]*\\(//\\)?<!\\[CDATA\\[[ \t]*\n?"
- :back "[ \t]*\\(//\\)?]]>[ \t\n]*</script>")
- (js-script
- :submode js-mode
- :face mmm-code-submode-face
- :front "<script[^>]*>[ \t]*\n?"
- :back "[ \t]*</script>"
- :insert ((?j js-tag nil @ "<script type=\"text/javascript\">\n"
- @ "" _ "" @ "\n</script>" @)))))
-
-(mmm-add-group
- 'html-css
- '((css-cdata
- :submode css-mode
- :face mmm-code-submode-face
- :front "<style[^>]*>[ \t\n]*\\(//\\)?<!\\[CDATA\\[[ \t]*\n?"
- :back "[ \t]*\\(//\\)?]]>[ \t\n]*</style>")
- (css
- :submode css-mode
- :face mmm-code-submode-face
- :front "<style[^>]*>[ \t]*\n?"
- :back "[ \t]*</style>"
- :insert ((?c css-tag nil @ "<style type=\"text/css\">\n"
- @ "" _ "" @ "\n</style>" @)))))
-
(mmm-add-classes
'((erb :submode ruby-mode :front "<%[#=]?" :back "-?%>"
:match-face (("<%#" . mmm-comment-submode-face)
diff --git a/mmm-mason.el b/mmm-mason.el
index 5d76c90..41111bd 100644
--- a/mmm-mason.el
+++ b/mmm-mason.el
@@ -173,4 +173,4 @@ Saves the name of the tag matched.")
(provide 'mmm-mason)
-;;; mmm-mason.el ends here
\ No newline at end of file
+;;; mmm-mason.el ends here
diff --git a/mmm-sample.el b/mmm-sample.el
index cda15e2..63c574e 100644
--- a/mmm-sample.el
+++ b/mmm-sample.el
@@ -27,7 +27,11 @@
;;; Commentary:
;; This file contains several sample submode classes for use with MMM
-;; Mode. For a more detailed and useful example, see `mmm-mason.el'.
+;; Mode. For a more detailed, advanced example, see `mmm-mason.el'.
+
+;; In order to use any of classes defined here, just require `mmm-auto' and
+;; add the respective (major mode -> class <- file extension) associations
+;; with `mmm-add-mode-ext-class'.
;;; Code:
@@ -35,41 +39,60 @@
(require 'mmm-auto)
(require 'mmm-vars)
-;;{{{ CSS embedded in HTML
+;;{{{ <Perl> in httpd.conf
;; This is the simplest example. Many applications will need no more
;; than a simple regexp.
+;;
+;; Usage: (mmm-add-mode-ext-class 'apache-generic-mode nil 'httpd-conf-perl)
+
(mmm-add-classes
- '((embedded-css
- :submode css
- :face mmm-declaration-submode-face
+ '((httpd-conf-perl
+ :submode perl
:delimiter-mode nil
- :front "<style[^>]*>"
- :back "</style>")))
+ :front "<Perl>"
+ :back "</Perl>")))
;;}}}
-;;{{{ Javascript in HTML
+;;{{{ JavaScript in HTML
+
+;; We use two classes here, both for code in a <script> tag, one wrapped in
+;; CDATA, another not. And another class to group them together.
+;;
+;; Usage: (mmm-add-mode-ext-class 'html-mode nil 'html-js)
-;; We use two classes here, one for code in a <script> tag and another
-;; for code embedded as a property of an HTML tag, then another class
-;; to group them together.
(mmm-add-group
'html-js
- '((js-tag
- :submode javascript
+ '((js-script-cdata
+ :submode js-mode
:face mmm-code-submode-face
- :delimiter-mode nil
- :front
"<script\[^>\]*\\(language=\"javascript\\([0-9.]*\\)\"\\|type=\"text/javascript\"\\)\[^>\]*>"
- :back"</script>"
- :insert ((?j js-tag nil @ "<script language=\"JavaScript\">"
- @ "\n" _ "\n" @ "</script>" @))
- )
- (js-inline
- :submode javascript
+ :front "<script[^>]*>[ \t\n]*\\(//\\)?<!\\[CDATA\\[[ \t]*\n?"
+ :back "[ \t]*\\(//\\)?]]>[ \t\n]*</script>")
+ (js-script
+ :submode js-mode
:face mmm-code-submode-face
- :delimiter-mode nil
- :front "on\\w+=\""
- :back "\"")))
+ :front "<script[^>]*>[ \t]*\n?"
+ :back "[ \t]*</script>"
+ :insert ((?j js-tag nil @ "<script type=\"text/javascript\">\n"
+ @ "" _ "" @ "\n</script>" @)))))
+
+;;}}}
+;;{{{ CSS in HTML
+
+(mmm-add-group
+ 'html-css
+ '((css-cdata
+ :submode css-mode
+ :face mmm-code-submode-face
+ :front "<style[^>]*>[ \t\n]*\\(//\\)?<!\\[CDATA\\[[ \t]*\n?"
+ :back "[ \t]*\\(//\\)?]]>[ \t\n]*</style>")
+ (css
+ :submode css-mode
+ :face mmm-code-submode-face
+ :front "<style[^>]*>[ \t]*\n?"
+ :back "[ \t]*</style>"
+ :insert ((?c css-tag nil @ "<style type=\"text/css\">\n"
+ @ "" _ "" @ "\n</style>" @)))))
;;}}}
;;{{{ Here-documents
@@ -157,7 +180,7 @@ and MODE is a major mode function symbol.")
("[$" . mmm-special-submode-face))
:insert ((?p embperl "Region Type (Character): " @ "[" str
@ " " _ " " @ str "]" @)
- (?+ embperl+ ?p . "+")
+ (?+ embperl+ ?p . "+")
(?- embperl- ?p . "-")
(?! embperl! ?p . "!")
(?* embperl* ?p . "*")
@@ -291,19 +314,6 @@ and MODE is a major mode function symbol.")
:back "]>")))
;;}}}
-;;{{{ <Perl> in httpd.conf
-
-(mmm-add-classes
- '((httpd-conf-perl
- :submode perl
- :delimiter-mode nil
- :front "<Perl>"
- :back "</Perl>")))
-
-;; Suggested Use:
-;; (mmm-add-mode-ext-class 'apache-generic-mode nil 'httpd-conf-perl)
-
-;;}}}
;;{{{ PHP in HTML
(mmm-add-group 'html-php
- [elpa] master 53bd8b4 319/433: Remove duplicate entries, (continued)
- [elpa] master 53bd8b4 319/433: Remove duplicate entries, Dmitry Gutov, 2018/03/15
- [elpa] master 5f276a1 307/433: Update instructions and docstrings, Dmitry Gutov, 2018/03/15
- [elpa] master a0b1ecc 320/433: Merge pull request #16 from dgutov/c++-mode, Dmitry Gutov, 2018/03/15
- [elpa] master a5a24df 322/433: Fix the timer error: "Selecting deleted buffer", Dmitry Gutov, 2018/03/15
- [elpa] master 0b30852 244/433: * mmm-vars.el (mmm-c-derived-modes): Added php-mode., Dmitry Gutov, 2018/03/15
- [elpa] master 34c3a19 212/433: Updated mode preferences to check fboundp when regions are created., Dmitry Gutov, 2018/03/15
- [elpa] master 46185e0 232/433: Made C indentation style variables buffer-local., Dmitry Gutov, 2018/03/15
- [elpa] master fee1b52 211/433: Added file with Emacs-related macros from Alan Shutko., Dmitry Gutov, 2018/03/15
- [elpa] master 3c68c28 235/433: * mmm-sample.el (httpd-conf-perl): Added submode class from Rob, Dmitry Gutov, 2018/03/15
- [elpa] master c8cfb89 346/433: * mmm-noweb.el: Qualify the "doesn't work" statement., Dmitry Gutov, 2018/03/15
- [elpa] master 8e7e76b 355/433: Move html-js and html-css classes from mmm-erb to mmm-sample,
Dmitry Gutov <=
- [elpa] master 4c51cd9 315/433: Merge pull request #13 from dgutov/master, Dmitry Gutov, 2018/03/15
- [elpa] master 23be0d3 272/433: * mmm-vars.el (mmm-save-local-variables): Updated cc-mode local, Dmitry Gutov, 2018/03/15
- [elpa] master 423ead2 353/433: Say goodbye to Emacs 19, Dmitry Gutov, 2018/03/15
- [elpa] master 5bff562 304/433: Add a few docstrings to make checkdoc happier., Dmitry Gutov, 2018/03/15
- [elpa] master 3710268 350/433: Some compatibiliy tweaks, Dmitry Gutov, 2018/03/15
- [elpa] master dddd397 245/433: * .cvsignore: Add semantic.cache., Dmitry Gutov, 2018/03/15
- [elpa] master eb8c964 359/433: Add "Maintainer" and some copyright headers, Dmitry Gutov, 2018/03/15
- [elpa] master cc0e3d9 382/433: Merge pull request #35 from knu/fix-html-php, Dmitry Gutov, 2018/03/15
- [elpa] master 389fc1b 246/433: Updated revision date., Dmitry Gutov, 2018/03/15
- [elpa] master 1742b06 362/433: Add mmm-erb.el to lisp_LISP, Dmitry Gutov, 2018/03/15