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

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

[nongnu] elpa/web-mode 38ed4c5759: perl template compatibility


From: ELPA Syncer
Subject: [nongnu] elpa/web-mode 38ed4c5759: perl template compatibility
Date: Fri, 19 Aug 2022 07:59:29 -0400 (EDT)

branch: elpa/web-mode
commit 38ed4c575939083487e8abe59240d0ce4f671c93
Author: fxbois <fxbois@gmail.com>
Commit: fxbois <fxbois@gmail.com>

    perl template compatibility
    
    #1239
---
 issues/1239.perl.html |  7 +++++++
 web-mode.el           | 56 ++++++++++++++++++++++++++++++++++-----------------
 2 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/issues/1239.perl.html b/issues/1239.perl.html
new file mode 100644
index 0000000000..45be193321
--- /dev/null
+++ b/issues/1239.perl.html
@@ -0,0 +1,7 @@
+<div>
+  <TMPL_IF NAME="WHAT">
+       YEAH
+  <TMPL_ELSE>
+       OKAY
+  </TMPL_IF>
+</div>
diff --git a/web-mode.el b/web-mode.el
index 98b56643af..8b4a83a200 100644
--- a/web-mode.el
+++ b/web-mode.el
@@ -2,7 +2,7 @@
 
 ;; Copyright 2011-2022 François-Xavier Bois
 
-;; Version: 17.2.3
+;; Version: 17.3.1
 ;; Author: François-Xavier Bois
 ;; Maintainer: François-Xavier Bois <fxbois@gmail.com>
 ;; Package-Requires: ((emacs "23.1"))
@@ -23,7 +23,7 @@
 
 ;;---- CONSTS 
------------------------------------------------------------------
 
-(defconst web-mode-version "17.2.3"
+(defconst web-mode-version "17.3.1"
   "Web Mode version.")
 
 ;;---- GROUPS 
------------------------------------------------------------------
@@ -981,6 +981,7 @@ Must be used in conjunction with 
web-mode-enable-block-face."
     ("svelte"           . ("svelte"))
     ("template-toolkit" . ())
     ("thymeleaf"        . ())
+    ("perl"             . ())
     ("underscore"       . ("underscore.js"))
     ("velocity"         . ("vtl" "cheetah" "ssp"))
     ("vue"              . ("vuejs" "vue.js"))
@@ -1051,6 +1052,7 @@ Must be used in conjunction with 
web-mode-enable-block-face."
     ("marko"            . "\\.marko\\'")
     ("mason"            . "\\.mas\\'")
     ("mojolicious"      . "\\.epl?\\'")
+    ("perl"             . "\\.\\(ptmpl\\|perl\\.html\\)\\'")
     ("php"              . "\\.\\(p[hs]p\\|ctp\\|inc\\)\\'")
     ("python"           . "\\.pml\\'")
     ("razor"            . "\\.\\(cs\\|vb\\)html\\|\\.razor\\'")
@@ -1398,6 +1400,7 @@ Must be used in conjunction with 
web-mode-enable-block-face."
    '("marko"            . "${")
    '("mason"            . "</?[&%]\\|^%.")
    '("mojolicious"      . "<%\\|^[ \t]*%.")
+   '("perl"             . "</?TMPL_[[:alpha:]]+")
    '("php"              . "<\\?")
    '("python"           . "<\\?")
    '("razor"            . "@.\\|^[ \t]*}")
@@ -2249,7 +2252,7 @@ shouldn't be moved back.)")
 
 (defvar web-mode-engine-tag-font-lock-keywords
   (list
-   '("</?\\([[:alpha:]]+\\(?:Template\\|[:.][[:alpha:]-]+\\)\\)" 1 
'web-mode-block-control-face)
+   
'("</?\\([[:alpha:]]+\\(?:Template\\|[:.][[:alpha:]-]+\\)\\|TMPL_[[:alpha:]]+\\)"
 1 'web-mode-block-control-face)
    '("\\_<\\([[:alpha:]-]+=\\)\\(\"[^\"]*\"\\)"
      (1 'web-mode-block-attr-name-face t t)
      (2 'web-mode-block-attr-value-face t t))
@@ -3571,6 +3574,12 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
                 delim-close "/?>")
           ) ;clip
 
+         ((string= web-mode-engine "perl")
+          (setq closing-string ">"
+                delim-open "</?"
+                delim-close "/?>")
+          ) ;perl
+
          ((string= web-mode-engine "blade")
           (cond
            ((string= tagopen "{{-")
@@ -4274,6 +4283,7 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
                 '("artanis" "anki" "asp" "aspx" "cl-emb" "clip" "closure" 
"ctemplate" "django" "dust"
                   "elixir" "ejs" "erb" "expressionengine" "freemarker" "go" 
"hero" "jsp" "lsp"
                   "mako" "mason" "mojolicious"
+                  "perl"
                   "smarty" "template-toolkit" "web2py" "xoops" "svelte"))
     (save-excursion
       (when delim-open
@@ -4475,6 +4485,10 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
       (setq regexp nil)
       ) ;clip
 
+     ((string= web-mode-engine "perl")
+      (setq regexp nil)
+      ) ;perl
+
      ((and (string= web-mode-engine "asp")
            (string= sub2 "<%"))
       (setq regexp "//\\|/\\*\\|\"\\|''")
@@ -4985,23 +4999,25 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
          )
         ) ;aspx underscore
 
-       ((member web-mode-engine '("jsp" "asp" "clip"))
+       ((member web-mode-engine '("jsp" "asp" "clip" "perl"))
         (cond
-         ((eq (char-after (1- reg-end)) ?\/)
-          )
-         ((looking-at 
"</?\\([[:alpha:]]+\\(?:[:.][[:alpha:]]+\\)\\|[[:alpha:]]+Template\\)")
-          (setq control (match-string-no-properties 1)
-                type (if (eq (aref (match-string-no-properties 0) 1) ?\/) 
'close 'open))
-          (when (not (member control '("h:inputtext" "jsp:usebean" 
"jsp:forward" "struts:property")))
-            (setq controls (append controls (list (cons type control)))))
-          )
-         (t
-          (when (web-mode-block-starts-with "}" reg-beg)
-            (setq controls (append controls (list (cons 'close "{")))))
-          (when (web-mode-block-ends-with "{" reg-beg)
-            (setq controls (append controls (list (cons 'open "{")))))
+          ((eq (char-after (1- reg-end)) ?\/)
+           )
+          ((looking-at "<TMPL_ELSE")
+           (setq controls (append controls (list (cons 'inside "TMPL_IF")))))
+          ((looking-at 
"</?\\([[:alpha:]]+\\(?:[:.][[:alpha:]]+\\)\\|[[:alpha:]]+Template\\|TMPL_[[:alpha:]]+\\)")
+           (setq control (match-string-no-properties 1)
+                 type (if (eq (aref (match-string-no-properties 0) 1) ?\/) 
'close 'open))
+           (when (not (member control '("h:inputtext" "jsp:usebean" 
"jsp:forward" "struts:property")))
+             (setq controls (append controls (list (cons type control)))))
+           )
+          (t
+           (when (web-mode-block-starts-with "}" reg-beg)
+             (setq controls (append controls (list (cons 'close "{")))))
+           (when (web-mode-block-ends-with "{" reg-beg)
+             (setq controls (append controls (list (cons 'open "{")))))
+           )
           )
-         )
         ) ;jsp asp
 
        ((string= web-mode-engine "mako")
@@ -6739,6 +6755,10 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
       (setq keywords web-mode-engine-tag-font-lock-keywords)
       ) ;clip
 
+     ((string= web-mode-engine "perl")
+      (setq keywords web-mode-engine-tag-font-lock-keywords)
+      ) ;perl
+
      ((string= web-mode-engine "aspx")
       (cond
        ((string= sub3 "<%@")



reply via email to

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