Support other extensions than ".md"

Close #13.
This commit is contained in:
Seongjae Lee
2015-09-12 01:58:59 -07:00
parent b5f7ba7b75
commit bd19c270b3
2 changed files with 10 additions and 2 deletions
+3 -2
View File
@@ -17,7 +17,7 @@ class NotationalVelocityView extends SelectListView
@skipPopulateList = false
@prevCursorPosition = 0
@documentsLoaded = false
@docQuery = new DocQuery(@rootDirectory, {recursive: true})
@docQuery = new DocQuery(@rootDirectory, {recursive: true, extensions: atom.config.get('nvatom.extensions')})
@docQuery.on "ready", () =>
@documentsLoaded = true
@setLoading()
@@ -92,7 +92,8 @@ class NotationalVelocityView extends SelectListView
item = @getSelectedItem()
filePath = null
sanitizedQuery = @getFilterQuery().replace(/\s+$/, '')
calculatedPath = path.join(@rootDirectory, sanitizedQuery + '.md')
extension = if atom.config.get('nvatom.extensions').length then atom.config.get('nvatom.extensions')[0] else '.md'
calculatedPath = path.join(@rootDirectory, sanitizedQuery + extension)
if item?
filePath = item.filePath
else if fs.existsSync(calculatedPath)
+7
View File
@@ -9,6 +9,13 @@ module.exports =
description: 'The directory to archive notes'
type: 'string'
default: path.join(process.env.ATOM_HOME, 'nvatom-notes')
extensions:
title: 'Extensions'
description: 'The first extension will be used for newly created notes.'
type: 'array'
default: ['.md', '.txt']
items:
type: 'string'
enableLunrPipeline:
title: 'Enable Lunr Pipeline'
description: 'Lunr pipeline preprocesses query to make search faster. However, it will skip searching some of stop words such as "an" or "be".'