Skip to content

Commit

Permalink
Allow spaces after filter pipes in Jinja lexer (#1385)
Browse files Browse the repository at this point in the history
This commit allows for optional spaces after filter pipes in the Jinja lexer.
  • Loading branch information
shermdog authored and pyrmont committed Jan 7, 2020
1 parent 3ed2f30 commit 81e3b8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rouge/lexers/jinja.rb
Expand Up @@ -57,7 +57,7 @@ def self.word_operators

state :filter do
# Filters are called like variable|foo(arg1, ...)
rule %r/(\|)(\w+)/ do
rule %r/(\|\s*)(\w+)/ do
groups Operator, Name::Function
end
end
Expand Down
4 changes: 3 additions & 1 deletion spec/visual/samples/jinja
Expand Up @@ -12,7 +12,9 @@

{# A comment #}

Hello {{ user.name|capitalize }} !
Hello {{ user.name|capitalize | upper }} !

Cool list filter {{ listx | join(', ') }}

{% if user.admin is true %}
<span>You're an admin !</span>
Expand Down

0 comments on commit 81e3b8d

Please sign in to comment.