Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: accept promela files #22

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/helpers/file_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module FileHelper
extend MimeCheckHelpers

def known_extension?(extn)
allow_extensions = %w(pdf ps csv xls xlsx pas cpp c cs csv h hpp java py js html coffee scss yaml yml xml json ts r rb rmd rnw rhtml rpres tex vb sql txt md jack hack asm hdl tst out cmp vm sh bat dat ipynb css png bmp tiff tif jpeg jpg gif zip gz tar wav ogg mp3 mp4 webm aac pcm aiff flac wma alac)
allow_extensions = %w(pdf ps csv xls xlsx pas cpp c cs csv h hpp java py js html coffee scss yaml yml xml json ts r rb rmd rnw rhtml rpres tex vb sql txt md jack hack asm hdl tst out cmp vm sh bat dat ipynb css png bmp tiff tif jpeg jpg gif zip gz tar wav ogg mp3 mp4 webm aac pcm aiff flac wma alac pml)

# Allow empty or nil extensions for blobs otherwise check that it matches the allowed list
extn.nil? || extn.empty? || allow_extensions.include?(extn)
Expand Down
4 changes: 3 additions & 1 deletion app/models/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1019,10 +1019,12 @@ def self.pygments_lang(extn)
elsif ['xml'].include?(extn) then 'xml'
elsif ['sql'].include?(extn) then 'sql'
elsif ['vb'].include?(extn) then 'vbnet'
elsif ['txt', 'md', 'rmd', 'rpres', 'hdl', 'asm', 'jack', 'hack', 'tst', 'cmp', 'vm', 'sh', 'bat', 'dat', 'csv'].include?(extn) then 'text'
elsif ['txt', 'md', 'rmd', 'rpres', 'hdl', 'asm', 'jack', 'hack', 'tst', 'cmp', 'vm', 'sh', 'bat', 'dat', 'csv', 'pml'].include?(extn) then 'text'
elsif ['tex', 'rnw'].include?(extn) then 'tex'
elsif ['py'].include?(extn) then 'python'
elsif ['r'].include?(extn) then 'r'
# requres unreleased pygments v2.18 https://pygments.org/docs/lexers/#pygments.lexers.c_like.PromelaLexer
# elsif ['pml'].include?(extn) then 'promela'
else extn
end
end
Expand Down