first stab at text consumer

This commit is contained in:
Joshua Taillon
2018-08-30 23:32:41 -04:00
parent 511f0e157d
commit 3c074d9e36
5 changed files with 153 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import re
from .parsers import TextDocumentParser
class ConsumerDeclaration:
MATCHING_FILES = re.compile("^.*\.(txt|md)$")
@classmethod
def handle(cls, sender, **kwargs):
return cls.test
@classmethod
def test(cls, doc):
if cls.MATCHING_FILES.match(doc.lower()):
return {
"parser": TextDocumentParser,
"weight": 10
}
return None