mirror of
https://github.com/Such-Software/adaptive-multi-protocol-gateway.git
synced 2026-10-17 07:31:32 +02:00
Add Micron renderer and AMPGateway site target
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import unittest
|
||||
|
||||
from ampg.renderers import render_gemtext
|
||||
from ampg.renderers import render_gemtext, render_micron
|
||||
|
||||
|
||||
class GemtextRendererTest(unittest.TestCase):
|
||||
@@ -31,6 +31,27 @@ class GemtextRendererTest(unittest.TestCase):
|
||||
self.assertIn("=> logo.png Image: Logo", gemtext)
|
||||
self.assertNotIn("ignored", gemtext)
|
||||
|
||||
def test_converts_basic_html_to_micron(self):
|
||||
html = """
|
||||
<html>
|
||||
<body>
|
||||
<h1>Hello</h1>
|
||||
<p>Read the <a href="about.html">about page</a>.</p>
|
||||
<script>ignored()</script>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
micron = render_micron(
|
||||
html,
|
||||
rewrite_link=lambda href: href.replace(".html", ".mu"),
|
||||
)
|
||||
|
||||
self.assertIn("# Hello", micron)
|
||||
self.assertIn("Read the about page.", micron)
|
||||
self.assertIn("=> about.mu about page", micron)
|
||||
self.assertNotIn("ignored", micron)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user