Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
73 lines (53 loc) · 1.92 KB

File metadata and controls

73 lines (53 loc) · 1.92 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
#
# SPDX-License-Identifier: MIT
import sys
import mistune
import mistune.renderers
print(sys.argv[1])
with open(sys.argv[1], "r") as source_file:
source = source_file.read()
html = mistune.create_markdown()
print()
print("HTML")
print("=====================================")
print("From the <a href=\"\">GitHub release page</a>:\n<blockquote>")
print(html(source))
print("</blockquote>")
class AdafruitBBCodeRenderer(mistune.renderers.BaseRenderer):
def placeholder(self):
return ''
def paragraph(self, text):
return text + "\n\n"
def block_text(self, text):
return text
def text(self, text):
return text
def link(self, link, title, text):
return "[url={}]{}[/url]".format(link, title)
def autolink(self, link, is_email):
if not is_email:
return "[url={}]{}[/url]".format(link, link)
return link
def heading(self, text, level):
return "[b][size=150]{}[/size][/b]\n".format(text)
def codespan(self, text):
return "[color=#E74C3C][size=95]{}[/size][/color]".format(text)
def list_item(self, text, level):
return "[*]{}[/*]\n".format(text.strip())
def list(self, text, ordered, level, start=None):
ordered_indicator = "=" if ordered else ""
return "[list{}]\n{}[/list]".format(ordered_indicator, text)
def double_emphasis(self, text):
return "[b]{}[/b]".format(text)
def emphasis(self, text):
return "[b]{}[/b]".format(text)
def strong(self, text):
return "[i]{}[/i]".format(text)
bbcode = mistune.create_markdown(renderer=AdafruitBBCodeRenderer())
print()
print("BBCode")
print("=====================================")
print("From the [url=]GitHub release page[/url]:\n[quote]")
print(bbcode(source))
print("[/quote]")
Morty Proxy This is a proxified and sanitized view of the page, visit original site.