feat: implement custom comment syntax

This commit is contained in:
Tim Grelka
2024-12-07 09:32:56 +01:00
parent 63a8418ae9
commit 19135655ca
4 changed files with 29 additions and 27 deletions
-6
View File
@@ -1,6 +0,0 @@
def main():
print("Hello from 50ohm-de!")
if __name__ == "__main__":
main()
+8
View File
@@ -0,0 +1,8 @@
import sys
import mistletoe
from fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
if __name__ == "__main__":
with open(sys.argv[1]) as fin, open(sys.argv[2], "w") as fout:
fout.write(mistletoe.markdown(fin, FiftyOhmHtmlRenderer))
+21
View File
@@ -0,0 +1,21 @@
from mistletoe import HtmlRenderer
from mistletoe.block_token import BlockToken
class FiftyOhmHtmlRenderer(HtmlRenderer):
def __init__(self):
super().__init__(Comment)
def render_comment():
return None
class Comment(BlockToken):
@staticmethod
def start(line):
return line.startswith("%")
@classmethod
def read(cls, lines):
next(lines)
return None
-21
View File
@@ -1,21 +0,0 @@
This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024) (preloaded format=latex 2024.12.1) 6 DEC 2024 13:03
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**
! Emergency stop.
<*>
End of file on the terminal!
Here is how much of TeX's memory you used:
3 strings out of 473331
100 string characters out of 5719795
390236 words of memory out of 5000000
23237 multiletter control sequences out of 15000+600000
558069 words of font info for 36 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
0i,0n,0p,6b,6s stack positions out of 10000i,1000n,20000p,200000b,200000s
No pages of output.