Skip to content
Snippets Groups Projects
Commit 70ba4d13 authored by Jeanine Adkisson's avatar Jeanine Adkisson
Browse files

Merge pull request #272 from rumpelsepp/drupal

Support drupal filename extensions in the php lexer
parents c99543c2 37ebeb86
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -7,7 +7,10 @@ module Rouge
desc "The PHP scripting language (php.net)"
tag 'php'
aliases 'php', 'php3', 'php4', 'php5'
filenames '*.php', '*.php[345]'
filenames '*.php', '*.php[345]',
# Support Drupal file extensions, see:
# https://github.com/gitlabhq/gitlabhq/issues/8900
'*.module', '*.inc', '*.profile', '*.install', '*.test'
mimetypes 'text/x-php'
 
default_options :parent => 'html'
Loading
Loading
@@ -60,6 +63,12 @@ module Rouge
)
end
 
def self.analyze_text(text)
return 1 if text.shebang?('php')
return 0.3 if /<\?(?!xml)/ =~ text
0
end
state :root do
rule /<\?(php|=)?/, Comment::Preproc, :php
rule(/.*?(?=<\?)|.*/m) { delegate parent }
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment