...
 
Commits (2)
......@@ -24,7 +24,7 @@ def main():
'mgcomm>=0.2.0'],
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=['Development Status :: 1 - Planning',
classifiers=['Development Status :: 2 - Pre-Alpha',
'Environment :: Console',
'Environment :: Console :: Curses',
'Intended Audience :: End Users/Desktop',
......
......@@ -103,7 +103,7 @@ def _create_default_blocks(cfg):
'default',
name='Next tasks',
filter='status:pending',
fmt=' {description}<sr beg=" "><m name=warning>{priority}</m></sr><sr beg=" "><m name=info>{tags}</m></sr>', # pylint: disable=line-too-long
fmt=' {description}<sr left=" "><m name=warning>{priority}</m></sr><sr left=" "><m name=info>{tags}</m></sr>', # pylint: disable=line-too-long
sort='priority,urgency-',
height='70%')
......
......@@ -57,18 +57,18 @@ class _M:
@attr.s
class _Sr:
'''Elements surround: <sr beg=[ end=]>'''
beg = attr.ib('')
end = attr.ib('')
'''Elements surround: <sr left=[ right=]>'''
left = attr.ib('')
right = attr.ib('')
__tagname__ = 'sr'
def process(self, data):
if isinstance(data, str):
return '{0}{1}{2}'.format(self.beg, data, self.end)
return '{0}{1}{2}'.format(self.left, data, self.right)
if isinstance(data, list):
return [self.beg] + data + [self.end]
return [self.beg, data, self.end]
return [self.left] + data + [self.right]
return [self.left, data, self.right]
_tag_types = (_M, _Sr)
......
......@@ -15,7 +15,7 @@ import twc.markup as markup
('foo <m name="highlight">bar baz</m> blah',
['foo ', ('highlight', 'bar baz'), ' blah']),
('foo <sr beg=, end=?>bar </sr> baz', ['foo ', ',bar ?', ' baz'])
('foo <sr left=, right=?>bar </sr> baz', ['foo ', ',bar ?', ' baz'])
])
def test_markup(fmt, expected):
p = markup.Parser()
......@@ -46,17 +46,17 @@ def test_empty(fmt):
@pytest.mark.parametrize('fmt,expected', [
('<sr beg=[ end=]><sr beg=[ end=]><m>foo</m></sr></sr>',
('<sr left=[ right=]><sr left=[ right=]><m>foo</m></sr></sr>',
['[', '[', ('text', 'foo'), ']', ']']),
('<m><sr beg=[ end=]>foo</sr></m> bar', [('text', '[foo]'), ' bar']),
('<m><sr left=[ right=]>foo</sr></m> bar', [('text', '[foo]'), ' bar']),
('<m><m><sr beg=[ end=]>foo</sr></m> bar</m>',
('<m><m><sr left=[ right=]>foo</sr></m> bar</m>',
[('text', '[foo]'), ('text', ' bar')]),
('<sr beg=[ end=]><m>foo</m></sr>', ['[', ('text', 'foo'), ']']),
('<sr left=[ right=]><m>foo</m></sr>', ['[', ('text', 'foo'), ']']),
('<sr><m name=out><sr beg=; end=;><m name=in>foo</m></sr></m></sr>',
('<sr><m name=out><sr left=; right=;><m name=in>foo</m></sr></m></sr>',
['', ('out', [';', ('in', 'foo'), ';']), ''])
])
def test_nested(fmt, expected):
......