martor 1.7.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- martor/__init__.py +4 -0
- martor/admin.py +10 -0
- martor/api.py +54 -0
- martor/extensions/__init__.py +0 -0
- martor/extensions/del_ins.py +51 -0
- martor/extensions/emoji.py +691 -0
- martor/extensions/escape_html.py +17 -0
- martor/extensions/mdx_add_id.py +37 -0
- martor/extensions/mdx_video.py +166 -0
- martor/extensions/mention.py +62 -0
- martor/extensions/urlize.py +93 -0
- martor/fields.py +16 -0
- martor/locale/en/LC_MESSAGES/django.mo +0 -0
- martor/locale/en/LC_MESSAGES/django.po +205 -0
- martor/locale/id/LC_MESSAGES/django.mo +0 -0
- martor/locale/id/LC_MESSAGES/django.po +219 -0
- martor/locale/tr/LC_MESSAGES/django.mo +0 -0
- martor/locale/tr/LC_MESSAGES/django.po +218 -0
- martor/models.py +10 -0
- martor/settings.py +235 -0
- martor/static/dicts/README.md +7 -0
- martor/static/dicts/en_US.aff +201 -0
- martor/static/dicts/en_US.dic +62120 -0
- martor/static/martor/css/martor-admin.css +173 -0
- martor/static/martor/css/martor-admin.min.css +9 -0
- martor/static/martor/css/martor.bootstrap.css +313 -0
- martor/static/martor/css/martor.bootstrap.min.css +9 -0
- martor/static/martor/css/martor.semantic.css +261 -0
- martor/static/martor/css/martor.semantic.min.css +9 -0
- martor/static/martor/js/martor.bootstrap.js +878 -0
- martor/static/martor/js/martor.bootstrap.min.js +9 -0
- martor/static/martor/js/martor.semantic.js +874 -0
- martor/static/martor/js/martor.semantic.min.js +9 -0
- martor/static/plugins/css/ace.min.css +1 -0
- martor/static/plugins/css/bootstrap.min.css +6 -0
- martor/static/plugins/css/highlight.min.css +1 -0
- martor/static/plugins/css/semantic.min.css +372 -0
- martor/static/plugins/fonts/brand-icons.eot +0 -0
- martor/static/plugins/fonts/brand-icons.svg +1008 -0
- martor/static/plugins/fonts/brand-icons.ttf +0 -0
- martor/static/plugins/fonts/brand-icons.woff +0 -0
- martor/static/plugins/fonts/brand-icons.woff2 +0 -0
- martor/static/plugins/fonts/icons.eot +0 -0
- martor/static/plugins/fonts/icons.svg +450 -0
- martor/static/plugins/fonts/icons.ttf +0 -0
- martor/static/plugins/fonts/icons.woff +0 -0
- martor/static/plugins/fonts/icons.woff2 +0 -0
- martor/static/plugins/fonts/outline-icons.eot +0 -0
- martor/static/plugins/fonts/outline-icons.svg +366 -0
- martor/static/plugins/fonts/outline-icons.ttf +0 -0
- martor/static/plugins/fonts/outline-icons.woff +0 -0
- martor/static/plugins/fonts/outline-icons.woff2 +0 -0
- martor/static/plugins/images/commonmark.png +0 -0
- martor/static/plugins/images/flags.png +0 -0
- martor/static/plugins/images/heart.png +0 -0
- martor/static/plugins/js/ace.js +27 -0
- martor/static/plugins/js/bootstrap.min.js +6 -0
- martor/static/plugins/js/emojis.min.js +2 -0
- martor/static/plugins/js/ext-language_tools.js +13 -0
- martor/static/plugins/js/highlight.min.js +3 -0
- martor/static/plugins/js/jquery.min.js +2 -0
- martor/static/plugins/js/jquery.slim.min.js +2 -0
- martor/static/plugins/js/mode-markdown.js +13 -0
- martor/static/plugins/js/semantic.min.js +11 -0
- martor/static/plugins/js/snippets/markdown.js +12 -0
- martor/static/plugins/js/spellcheck.js +159 -0
- martor/static/plugins/js/theme-github.js +13 -0
- martor/static/plugins/js/typo.js +998 -0
- martor/templates/martor/bootstrap/editor.html +45 -0
- martor/templates/martor/bootstrap/emoji.html +28 -0
- martor/templates/martor/bootstrap/guide.html +207 -0
- martor/templates/martor/bootstrap/toolbar.html +147 -0
- martor/templates/martor/semantic/editor.html +24 -0
- martor/templates/martor/semantic/emoji.html +14 -0
- martor/templates/martor/semantic/guide.html +192 -0
- martor/templates/martor/semantic/toolbar.html +104 -0
- martor/templatetags/__init__.py +0 -0
- martor/templatetags/martortags.py +21 -0
- martor/tests/__init__.py +0 -0
- martor/tests/models.py +11 -0
- martor/tests/templates/test_form_view.html +27 -0
- martor/tests/tests.py +230 -0
- martor/tests/urls.py +8 -0
- martor/tests/views.py +9 -0
- martor/urls.py +9 -0
- martor/utils.py +77 -0
- martor/views.py +82 -0
- martor/widgets.py +142 -0
- martor-1.7.2.dist-info/METADATA +445 -0
- martor-1.7.2.dist-info/RECORD +92 -0
- martor-1.7.2.dist-info/WHEEL +4 -0
- martor-1.7.2.dist-info/licenses/LICENSE +674 -0
martor/__init__.py
ADDED
martor/admin.py
ADDED
martor/api.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import base64
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
import requests
|
|
5
|
+
|
|
6
|
+
from .settings import MARTOR_IMGUR_API_KEY, MARTOR_IMGUR_CLIENT_ID
|
|
7
|
+
|
|
8
|
+
requests.packages.urllib3.disable_warnings()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def imgur_uploader(image):
|
|
12
|
+
"""
|
|
13
|
+
Basic imgur uploader return as json data.
|
|
14
|
+
:param `image` is from `request.FILES['markdown-image-upload']`
|
|
15
|
+
:return json response
|
|
16
|
+
"""
|
|
17
|
+
api_url = "https://api.imgur.com/3/upload.json"
|
|
18
|
+
headers = {"Authorization": "Client-ID " + MARTOR_IMGUR_CLIENT_ID}
|
|
19
|
+
response = requests.post(
|
|
20
|
+
api_url,
|
|
21
|
+
headers=headers,
|
|
22
|
+
data={
|
|
23
|
+
"key": MARTOR_IMGUR_API_KEY,
|
|
24
|
+
"image": base64.b64encode(image.read()),
|
|
25
|
+
"type": "base64",
|
|
26
|
+
"name": image.name,
|
|
27
|
+
},
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
if response.status_code == 200:
|
|
31
|
+
response_data = json.loads(response.content.decode("utf-8"))
|
|
32
|
+
return json.dumps(
|
|
33
|
+
{
|
|
34
|
+
"status": response_data["status"],
|
|
35
|
+
"link": response_data["data"]["link"],
|
|
36
|
+
"name": response_data["data"]["name"],
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
elif response.status_code == 415:
|
|
41
|
+
# Unsupported File type
|
|
42
|
+
return json.dumps(
|
|
43
|
+
{
|
|
44
|
+
"status": response.status_code,
|
|
45
|
+
"error": response.reason,
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
return json.dumps(
|
|
50
|
+
{
|
|
51
|
+
"status": response.status_code,
|
|
52
|
+
"error": response.content.decode("utf-8"),
|
|
53
|
+
}
|
|
54
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Del/Ins Extension for Python-Markdown
|
|
3
|
+
=====================================
|
|
4
|
+
Wraps the inline content with ins/del tags.
|
|
5
|
+
|
|
6
|
+
Usage
|
|
7
|
+
-----
|
|
8
|
+
>>> import markdown
|
|
9
|
+
>>> src = '''This is ++added content + + and this is ~~deleted content~~'''
|
|
10
|
+
>>> html = markdown.markdown(src, ['del_ins'])
|
|
11
|
+
>>> print(html)
|
|
12
|
+
<p>This is <ins>added content</ins> and this is <del>deleted content</del>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
Dependencies
|
|
16
|
+
------------
|
|
17
|
+
* [Markdown 2.0+](http://www.freewisdom.org/projects/python-markdown/)
|
|
18
|
+
|
|
19
|
+
Copyright
|
|
20
|
+
---------
|
|
21
|
+
2011, 2012 [The active archives contributors](http://activearchives.org/)
|
|
22
|
+
All rights reserved.
|
|
23
|
+
This software is released under the modified BSD License.
|
|
24
|
+
See LICENSE.md for details.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
import markdown
|
|
28
|
+
from markdown.inlinepatterns import SimpleTagPattern
|
|
29
|
+
|
|
30
|
+
DEL_RE = r"(\~\~)(.+?)(\~\~)"
|
|
31
|
+
INS_RE = r"(\+\+)(.+?)(\+\+)"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class DelInsExtension(markdown.extensions.Extension):
|
|
35
|
+
"""Adds del_ins extension to Markdown class."""
|
|
36
|
+
|
|
37
|
+
def extendMarkdown(self, md: markdown.core.Markdown, *args):
|
|
38
|
+
del_tag = SimpleTagPattern(DEL_RE, "del")
|
|
39
|
+
ins_tag = SimpleTagPattern(INS_RE, "ins")
|
|
40
|
+
md.inlinePatterns.register(del_tag, "del", 10)
|
|
41
|
+
md.inlinePatterns.register(ins_tag, "ins", 11)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def makeExtension(*args, **kwargs):
|
|
45
|
+
return DelInsExtension(*args, **kwargs)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if __name__ == "__main__":
|
|
49
|
+
import doctest
|
|
50
|
+
|
|
51
|
+
doctest.testmod()
|