mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Handle * prefixes properly
This commit is contained in:
@@ -19,7 +19,7 @@ module.exports =
|
||||
# TODO: this could be more language specific. Use the actual comment char.
|
||||
linePrefix = block.match(/^\s*[\/#*-]*\s*/g)[0]
|
||||
blockLines = block.split('\n')
|
||||
blockLines = (blockLine.replace(new RegExp('^'+linePrefix), '') for blockLine in blockLines) if linePrefix
|
||||
blockLines = (blockLine.replace(new RegExp('^' + linePrefix.replace('*', '\\*')), '') for blockLine in blockLines) if linePrefix
|
||||
|
||||
lines = []
|
||||
currentLine = []
|
||||
|
||||
@@ -147,3 +147,20 @@ describe "Autoflow package", ->
|
||||
// enim eu orci tincidunt adipiscing aliquam ligula.
|
||||
'''
|
||||
expect(autoflow.reflow(text, wrapColumn: 80)).toEqual res
|
||||
|
||||
it 'properly handles * prefix', ->
|
||||
text = '''
|
||||
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus gravida
|
||||
et enim eu orci tincidunt adipiscing
|
||||
aliquam ligula.
|
||||
|
||||
* soidjfiojsoidj foi
|
||||
'''
|
||||
|
||||
res = '''
|
||||
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus gravida et
|
||||
* enim eu orci tincidunt adipiscing aliquam ligula.
|
||||
|
||||
* soidjfiojsoidj foi
|
||||
'''
|
||||
expect(autoflow.reflow(text, wrapColumn: 80)).toEqual res
|
||||
|
||||
Reference in New Issue
Block a user