[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/jinja2-mode ab077df663 24/57: Support whitespace tag synta
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/jinja2-mode ab077df663 24/57: Support whitespace tag syntax |
Date: |
Mon, 17 Jan 2022 05:58:24 -0500 (EST) |
branch: elpa/jinja2-mode
commit ab077df663374c8d66b5c059c1f3d231ca3c74da
Author: Florian Mounier <florian.mounier@kozea.fr>
Commit: Florian Mounier <florian.mounier@kozea.fr>
Support whitespace tag syntax
---
jinja2-mode.el | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/jinja2-mode.el b/jinja2-mode.el
index 1df1a1d3bc..50e8457a33 100644
--- a/jinja2-mode.el
+++ b/jinja2-mode.el
@@ -78,6 +78,7 @@
(if (search-backward-regexp
(rx-to-string
`(and "{%"
+ (? "-")
(* whitespace)
(? (group
"end"))
@@ -88,6 +89,7 @@
(group
(*? anything))
(* whitespace)
+ (? "-")
"%}")) nil t)
(if (match-string 1) ;; End tag, going on
(let ((matches (jinja2-find-open-tag)))
@@ -195,7 +197,7 @@
)
word-end)) (0 font-lock-builtin-face))
- (,(rx (or "{%" "%}")) (0 font-lock-function-name-face t))
+ (,(rx (or "{%" "%}" "{%-" "-%}")) (0 font-lock-function-name-face t))
(,(rx (or "{{" "}}")) (0 font-lock-type-face t))
(,(rx "{#"
(* whitespace)
@@ -229,11 +231,11 @@
"Return indent column based on previous lines"
(let ((indent-width sgml-basic-offset) (default (sgml-indent-line-num)))
(forward-line -1)
- (if (looking-at "^[ \t]*{% *end") ; Don't indent after end
+ (if (looking-at "^[ \t]*{%-? *end") ; Don't indent after end
(current-indentation)
- (if (looking-at (concat "^[ \t]*{% *.*?{% *end" (regexp-opt
(jinja2-indenting-keywords))))
+ (if (looking-at (concat "^[ \t]*{%-? *.*?{% *end" (regexp-opt
(jinja2-indenting-keywords))))
(current-indentation)
- (if (looking-at (concat "^[ \t]*{% *" (regexp-opt
(jinja2-indenting-keywords)))) ; Check start tag
+ (if (looking-at (concat "^[ \t]*{%-? *" (regexp-opt
(jinja2-indenting-keywords)))) ; Check start tag
(+ (current-indentation) indent-width)
(if (looking-at "^[ \t]*<") ; Assume sgml block trust sgml
default
@@ -247,13 +249,13 @@
(if (bobp) ; Check begining of buffer
0
(let ((indent-width sgml-basic-offset) (default (sgml-indent-line-num)))
- (if (looking-at "^[ \t]*{% *e\\(nd\\|lse\\|lif\\)") ; Check close tag
+ (if (looking-at "^[ \t]*{%-? *e\\(nd\\|lse\\|lif\\)") ; Check close tag
(save-excursion
(forward-line -1)
(if
(and
- (looking-at (concat "^[ \t]*{% *" (regexp-opt
(jinja2-indenting-keywords))))
- (not (looking-at (concat "^[ \t]*{% *.*?{% *end" (regexp-opt
(jinja2-indenting-keywords))))))
+ (looking-at (concat "^[ \t]*{%-? *" (regexp-opt
(jinja2-indenting-keywords))))
+ (not (looking-at (concat "^[ \t]*{%-? *.*?{% *end" (regexp-opt
(jinja2-indenting-keywords))))))
(current-indentation)
(- (current-indentation) indent-width)))
(if (looking-at "^[ \t]*</") ; Assume sgml end block trust sgml
- [nongnu] elpa/jinja2-mode 2dc43224b2 09/57: Now kw are function and user can define user kw list, (continued)
- [nongnu] elpa/jinja2-mode 2dc43224b2 09/57: Now kw are function and user can define user kw list, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode c2d801ad8e 21/57: fix indentation bug, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode a6e6574441 37/57: Consider quote as quote, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode 97dacbedac 15/57: Add indent on insert tags, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode 40c5ef2efa 23/57: Fuck tab, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode 159558e0bb 54/57: Indent on save only when enabled, default disabled, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode b3e564bfef 40/57: Fix uncomment, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode 487b95f0d4 20/57: Merge pull request #1 from amirouche/master, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode 757e3fa162 25/57: Add defcustom for kw and fun, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode 985c538160 28/57: Add comment command, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode ab077df663 24/57: Support whitespace tag syntax,
ELPA Syncer <=
- [nongnu] elpa/jinja2-mode f98adc4211 34/57: Merge pull request #5 from davidmiller/patch-1, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode bc2f7ddcb5 41/57: Fix indent, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode 69171a2baa 26/57: Switch back to sgml-mode, seems to fix #3, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode 66d20afc30 13/57: Change indent func to recursive, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode bcca3fe63b 17/57: renamed jinja2 -> jinja2-mode so that require 'jinja2-mode works, ELPA Syncer, 2022/01/17
- [nongnu] elpa/jinja2-mode 83eaa513b5 19/57: looks like the indentation at 4 is now possible inside jinja2 blocks, ELPA Syncer, 2022/01/17