emacs-elpa-diffs
[Top][All Lists]
Advanced

[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



reply via email to

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