Update.
This commit is contained in:
parent
d5d9c101f0
commit
833d16752a
@ -39,11 +39,12 @@ class row_element(element):
|
|||||||
|
|
||||||
class hline_element(row_element):
|
class hline_element(row_element):
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, command='hline', parent=None):
|
||||||
super().__init__([], parent)
|
super().__init__([], parent)
|
||||||
|
self.command = command
|
||||||
|
|
||||||
def content(self):
|
def content(self):
|
||||||
return '\\hline'
|
return '\\' + self.command
|
||||||
|
|
||||||
|
|
||||||
# instance of hline element
|
# instance of hline element
|
||||||
@ -54,13 +55,13 @@ class tabular(element):
|
|||||||
""" Class representing a latex tabular. """
|
""" Class representing a latex tabular. """
|
||||||
|
|
||||||
templates = {
|
templates = {
|
||||||
'content': """\\begin{{tabular}}{{{columns}}}
|
'content': """\\begin{{{name}}}{{{columns}}}
|
||||||
{inner}
|
{inner}
|
||||||
\\end{{tabular}}"""
|
\\end{{{name}}}"""
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, parent=None, rows=[], columns=None,
|
def __init__(self, parent=None, rows=[], columns=None,
|
||||||
autowrap=False, label=None):
|
autowrap=False, label=None, name='tabular'):
|
||||||
""" Create a tabular with given rows and column specification.
|
""" Create a tabular with given rows and column specification.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
@ -69,13 +70,14 @@ class tabular(element):
|
|||||||
"""
|
"""
|
||||||
super().__init__(parent, label=label)
|
super().__init__(parent, label=label)
|
||||||
self.columns = columns
|
self.columns = columns
|
||||||
|
self.name = name
|
||||||
self.autowrap = autowrap
|
self.autowrap = autowrap
|
||||||
for row in rows:
|
for row in rows:
|
||||||
self.addrow(row)
|
self.addrow(row)
|
||||||
|
|
||||||
def addhline(self):
|
def addhline(self):
|
||||||
""" Add a hline to the current tabular element. """
|
""" Add a hline to the current tabular element. """
|
||||||
self.addrow(hline_element(self), False)
|
self.addrow(hline_element(parent=self), False)
|
||||||
|
|
||||||
def addrow(self, row, wrap=None, fmt=None):
|
def addrow(self, row, wrap=None, fmt=None):
|
||||||
""" Add a row to the tabular.
|
""" Add a row to the tabular.
|
||||||
@ -102,6 +104,7 @@ class tabular(element):
|
|||||||
|
|
||||||
def content(self):
|
def content(self):
|
||||||
return self.fmt().format('content', {
|
return self.fmt().format('content', {
|
||||||
|
'name': self.name,
|
||||||
'columns': self.columns,
|
'columns': self.columns,
|
||||||
'inner': super().content()
|
'inner': super().content()
|
||||||
})
|
})
|
||||||
|
@ -7,15 +7,17 @@ class tikzpicture(element):
|
|||||||
""" Class representing a latex tikzfigure. """
|
""" Class representing a latex tikzfigure. """
|
||||||
|
|
||||||
templates = {
|
templates = {
|
||||||
'content': """\\begin{{tikzpicture}}
|
'options': '[{content}]',
|
||||||
|
'content': """\\begin{{tikzpicture}}{options}
|
||||||
{inner}
|
{inner}
|
||||||
\\end{{tikzpicture}}"""
|
\\end{{tikzpicture}}"""
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, childrens=None, parent=None, label=None):
|
def __init__(self, childrens=None, parent=None, label=None, **kargs):
|
||||||
super().__init__(parent, childrens, label=label)
|
super().__init__(parent, childrens, label=label, **kargs)
|
||||||
|
|
||||||
def content(self):
|
def content(self):
|
||||||
return self.fmt().format('content', {
|
return self.fmt().format('content', {
|
||||||
'inner': super().content()
|
'inner': super().content(),
|
||||||
|
'options': self.format_options(self.options)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user