mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Add wrap flag to text languages
This commit is contained in:
@@ -222,6 +222,7 @@ module Linguist
|
||||
raise(ArgumentError, "#{@name} is missing lexer")
|
||||
|
||||
@ace_mode = attributes[:ace_mode]
|
||||
@wrap = attributes[:wrap] || false
|
||||
|
||||
# Set legacy search term
|
||||
@search_term = attributes[:search_term] || default_alias_name
|
||||
@@ -312,6 +313,11 @@ module Linguist
|
||||
# Returns a String name or nil
|
||||
attr_reader :ace_mode
|
||||
|
||||
# Public: Should language lines be wrapped
|
||||
#
|
||||
# Returns true or false
|
||||
attr_reader :wrap
|
||||
|
||||
# Public: Get extensions
|
||||
#
|
||||
# Examples
|
||||
@@ -462,6 +468,7 @@ module Linguist
|
||||
:aliases => options['aliases'],
|
||||
:lexer => options['lexer'],
|
||||
:ace_mode => options['ace_mode'],
|
||||
:wrap => options['wrap'],
|
||||
:group_name => options['group'],
|
||||
:searchable => options.key?('searchable') ? options['searchable'] : true,
|
||||
:search_term => options['search_term'],
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
# aliases - An Array of additional aliases (implicitly
|
||||
# includes name.downcase)
|
||||
# ace_mode - A String name of Ace Mode (if available)
|
||||
# wrap - Boolean wrap to enable line wrapping (default: false)
|
||||
# extension - An Array of associated extensions
|
||||
# primary_extension - A String for the main extension associated with
|
||||
# the language. Must be unique. Used when a Language is picked
|
||||
@@ -741,6 +742,7 @@ Markdown:
|
||||
type: markup
|
||||
lexer: Text only
|
||||
ace_mode: markdown
|
||||
wrap: true
|
||||
primary_extension: .md
|
||||
extensions:
|
||||
- .markdown
|
||||
@@ -1188,6 +1190,7 @@ Textile:
|
||||
type: markup
|
||||
lexer: Text only
|
||||
ace_mode: textile
|
||||
wrap: true
|
||||
primary_extension: .textile
|
||||
extensions:
|
||||
- .textile
|
||||
@@ -1332,6 +1335,7 @@ ooc:
|
||||
|
||||
reStructuredText:
|
||||
type: markup
|
||||
wrap: true
|
||||
search_term: rst
|
||||
aliases:
|
||||
- rst
|
||||
|
||||
@@ -286,6 +286,11 @@ class TestLanguage < Test::Unit::TestCase
|
||||
assert !Language.ace_modes.include?(Language['FORTRAN'])
|
||||
end
|
||||
|
||||
def test_wrap
|
||||
assert_equal false, Language['C'].wrap
|
||||
assert_equal true, Language['Markdown'].wrap
|
||||
end
|
||||
|
||||
def test_extensions
|
||||
assert Language['Perl'].extensions.include?('.pl')
|
||||
assert Language['Python'].extensions.include?('.py')
|
||||
|
||||
Reference in New Issue
Block a user