add formatter macros for \begin{macrocode}
This commit is contained in:
parent
205dc4eeac
commit
adb168d453
2 changed files with 25 additions and 1 deletions
|
@ -29,7 +29,9 @@ def get_default_macros(tex_flavour: TeXFlavour):
|
|||
make_simple_macro('repodirty', FormatterProperty.repo_dirty),
|
||||
make_simple_macro('sourcename', FormatterProperty.source_file_name),
|
||||
ConfigEndMacro(),
|
||||
ConfigBeginMacro()
|
||||
ConfigBeginMacro(),
|
||||
MacroCodeBeginMacro(),
|
||||
MacroCodeBeginMacro(),
|
||||
]
|
||||
tex2 = [
|
||||
ArgumentMacro(
|
||||
|
|
|
@ -138,6 +138,28 @@ class ConfigEndMacro(SingleLineMacro):
|
|||
return []
|
||||
|
||||
|
||||
class MacroCodeBeginMacro(SingleLineMacro):
|
||||
def __init__(self):
|
||||
super(MacroCodeBeginMacro, self).__init__(r'\begin{macrocode}')
|
||||
|
||||
def apply(self, line: str, formatter) -> Union[str, List[str]]:
|
||||
if not formatter.mode == FormatterMode.meta:
|
||||
raise NotImplementedError
|
||||
formatter.mode = FormatterMode.macrocode
|
||||
return r'% \begin{macrocode}'
|
||||
|
||||
|
||||
class MacroCodeEndMacro(SingleLineMacro):
|
||||
def __init__(self):
|
||||
super(MacroCodeEndMacro, self).__init__(r'\end{macrocode}')
|
||||
|
||||
def apply(self, line: str, formatter) -> Union[str, List[str]]:
|
||||
if not formatter.mode == FormatterMode.macrocode:
|
||||
raise NotImplementedError
|
||||
formatter.mode = FormatterMode.meta
|
||||
return r'% \end{macrocode}'
|
||||
|
||||
|
||||
class ArgumentMacro(Macro):
|
||||
def __init__(
|
||||
self,
|
||||
|
|
Loading…
Reference in a new issue