Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CodeMirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Moritz Aurel Pascal Schubotz
CodeMirror
Commits
34d8dc43
Commit
34d8dc43
authored
9 years ago
by
Marijn Haverbeke
Browse files
Options
Downloads
Patches
Plain Diff
[smarty mode] Prevent outer mode from getting confused by Smarty tags
Issue #3186
parent
40b5625b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mode/smarty/smarty.js
+17
-6
17 additions, 6 deletions
mode/smarty/smarty.js
with
17 additions
and
6 deletions
mode/smarty/smarty.js
+
17
−
6
View file @
34d8dc43
...
...
@@ -47,10 +47,17 @@
}
function
tokenTop
(
stream
,
state
)
{
if
(
stream
.
match
(
leftDelimiter
,
true
))
{
var
string
=
stream
.
string
;
for
(
var
scan
=
stream
.
pos
;;)
{
var
nextMatch
=
string
.
indexOf
(
leftDelimiter
,
scan
);
scan
=
nextMatch
+
leftDelimiter
.
length
;
if
(
nextMatch
==
-
1
||
!
doesNotCount
(
stream
,
nextMatch
+
leftDelimiter
.
length
))
break
;
}
if
(
nextMatch
==
stream
.
pos
)
{
stream
.
match
(
leftDelimiter
);
if
(
stream
.
eat
(
"
*
"
))
{
return
chain
(
stream
,
state
,
tokenBlock
(
"
comment
"
,
"
*
"
+
rightDelimiter
));
}
else
if
(
!
doesNotCount
(
stream
))
{
}
else
{
state
.
depth
++
;
state
.
tokenize
=
tokenSmarty
;
last
=
"
startTag
"
;
...
...
@@ -58,11 +65,9 @@
}
}
if
(
nextMatch
>
-
1
)
stream
.
string
=
string
.
slice
(
0
,
nextMatch
);
var
token
=
baseMode
.
token
(
stream
,
state
.
base
);
var
text
=
stream
.
current
();
var
found
=
text
.
indexOf
(
leftDelimiter
);
if
(
found
>
-
1
&&
!
doesNotCount
(
stream
,
stream
.
start
+
found
+
1
))
stream
.
backUp
(
text
.
length
-
found
);
if
(
nextMatch
>
-
1
)
stream
.
string
=
string
;
return
token
;
}
...
...
@@ -205,6 +210,12 @@
state
.
last
=
last
;
return
style
;
},
indent
:
function
(
state
,
text
)
{
if
(
state
.
tokenize
==
tokenTop
&&
baseMode
.
indent
)
return
baseMode
.
indent
(
state
.
base
,
text
);
else
return
CodeMirror
.
Pass
;
},
blockCommentStart
:
leftDelimiter
+
"
*
"
,
blockCommentEnd
:
"
*
"
+
rightDelimiter
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment