Broken Python syntax highlighting when raw strings are encountered
Summary
Syntax highlighting fails after a Python raw string is encountered. All the subsequent code is wrongly displayed as a string.
Steps to reproduce
- Add a Python file that contains a raw string in a repository.
- Open it with the viewer from GitLab.
- Observe that the highlighting is broken after the raw string.
Example Project
https://gitlab.com/albertosottile/python_syntax_highlighting/-/blob/master/example.py
What is the current bug behavior?
All the code after the raw string closing is wrongly shown as a string.
What is the expected correct behavior?
The viewer should display the actual Python syntax highlighting.
Output of checks
This bug happens on GitLab.com (see project) as well as in our EE installation.
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Ubuntu 18.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.6.5p114 Gem Version: 2.7.10 Bundler Version:1.17.3 Rake Version: 12.3.3 Redis Version: 5.0.7 Git Version: 2.26.2 Sidekiq Version:5.2.7 Go Version: unknown GitLab information Version: 12.10.0-ee Revision: 58d798bed62 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 10.12 URL: https://gitlab.zhinst.com HTTP Clone URL: https://gitlab.zhinst.com/some-group/some-project.git SSH Clone URL: git@gitlab.zhinst.com:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: yes Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 12.2.0 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab subtasks ... Checking GitLab Shell ... GitLab Shell: ... GitLab Shell version >= 12.2.0 ? ... OK (12.2.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Gitaly ... Gitaly: ... default ... OK Checking Gitaly ... Finished Checking Sidekiq ... Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1 Checking Sidekiq ... Finished Checking Incoming Email ... Incoming Email: ... Reply by email is disabled in config/gitlab.yml Checking Incoming Email ... Finished Checking LDAP ... LDAP: ... Server: ldapmain not verifying SSL hostname of LDAPS server 'zdom0:389' LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) User output sanitized. Found 100 users of 100 limit. Checking LDAP ... Finished Checking GitLab App ... Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 5/1 ... yes 44/2 ... yes 23/3 ... yes 6/4 ... yes 11/5 ... yes 14/8 ... yes 14/9 ... yes 11/14 ... yes 3/16 ... yes 21/17 ... yes 23/19 ... yes 24/20 ... yes 24/22 ... yes 24/23 ... yes 24/24 ... yes 24/26 ... yes 24/27 ... yes 24/29 ... yes 24/30 ... yes 24/32 ... yes 24/33 ... yes 24/36 ... yes 24/37 ... yes 24/43 ... yes 26/44 ... yes 24/46 ... yes 24/47 ... yes 24/48 ... yes 24/49 ... yes 24/50 ... yes 29/51 ... yes 24/52 ... yes 30/53 ... yes 6/56 ... yes 23/59 ... yes 30/61 ... yes 30/62 ... yes 6/64 ... yes 23/65 ... yes 23/66 ... yes 23/67 ... yes 5/68 ... yes 24/69 ... yes 10/70 ... yes 24/71 ... yes 42/72 ... yes 24/74 ... yes 2/75 ... yes 44/78 ... yes 2/81 ... yes 23/84 ... yes 10/85 ... yes 44/86 ... yes 24/87 ... yes 24/88 ... yes 27/89 ... yes 23/90 ... yes 47/93 ... yes 47/94 ... yes 47/95 ... yes 47/96 ... yes 48/98 ... yes 3/100 ... yes 44/101 ... yes 23/104 ... yes 50/105 ... yes 3/106 ... yes 3/107 ... yes 52/108 ... yes 3/109 ... yes 54/114 ... yes 54/115 ... yes 23/120 ... yes 54/125 ... yes 54/126 ... yes 3/127 ... yes 3/128 ... yes 3/129 ... yes 44/130 ... yes 24/131 ... yes 24/132 ... yes 3/134 ... yes 42/135 ... yes 52/136 ... yes 21/137 ... yes 24/138 ... yes 9/139 ... yes 19/140 ... yes 23/141 ... yes 2/142 ... yes 44/143 ... yes 23/144 ... yes 50/145 ... yes 64/146 ... yes 50/149 ... yes 2/150 ... yes 2/151 ... yes 71/152 ... yes 75/153 ... yes 75/154 ... yes 80/158 ... yes 44/160 ... yes 71/162 ... yes 42/163 ... yes 2/164 ... yes Redis version >= 4.0.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.5) Git version >= 2.22.0 ? ... yes (2.26.2) Git user has default SSH configuration? ... yes Active users: ... 56 Is authorized keys file accessible? ... yes Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled) Checking GitLab App ... Finished Checking GitLab subtasks ... Finished