1. Steve Spigarelli
  2. pygments-main

Commits

Tim Hatch  committed 6c50402

Support stripped heredocs for (ba)sh (#526)

  • Participants
  • Parent commits a90307c
  • Branches default

Comments (0)

Files changed (2)

File pygments/lexers/other.py

View file
  • Ignore whitespace
             (r'\\[\w\W]', String.Escape),
             (r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Text, Operator)),
             (r'[\[\]{}()=]', Operator),
-            (r'<<\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
+            (r'<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
             (r'&&|\|\|', Operator),
         ],
         'data': [

File tests/examplefiles/stripheredoc.sh

View file
  • Ignore whitespace
+cat <<-EOF
+  Hello world $PATH
+  EOF