Simon Browne
2 weeks ago
2372 changed files with 401266 additions and 3 deletions
@ -0,0 +1,8 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
# -*- coding: utf-8 -*- |
|||
import re |
|||
import sys |
|||
from icalendar.cli import main |
|||
if __name__ == '__main__': |
|||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
|||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
# -*- coding: utf-8 -*- |
|||
import re |
|||
import sys |
|||
from markdown_it.cli.parse import main |
|||
if __name__ == '__main__': |
|||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
|||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
# -*- coding: utf-8 -*- |
|||
import re |
|||
import sys |
|||
from markdown.__main__ import run |
|||
if __name__ == '__main__': |
|||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
|||
sys.exit(run()) |
@ -0,0 +1,8 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
# -*- coding: utf-8 -*- |
|||
import re |
|||
import sys |
|||
from pelican.__main__ import main |
|||
if __name__ == '__main__': |
|||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
|||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
# -*- coding: utf-8 -*- |
|||
import re |
|||
import sys |
|||
from pelican.tools.pelican_import import main |
|||
if __name__ == '__main__': |
|||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
|||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
# -*- coding: utf-8 -*- |
|||
import re |
|||
import sys |
|||
from pelican.plugins._utils import list_plugins |
|||
if __name__ == '__main__': |
|||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
|||
sys.exit(list_plugins()) |
@ -0,0 +1,8 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
# -*- coding: utf-8 -*- |
|||
import re |
|||
import sys |
|||
from pelican.tools.pelican_quickstart import main |
|||
if __name__ == '__main__': |
|||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
|||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
# -*- coding: utf-8 -*- |
|||
import re |
|||
import sys |
|||
from pelican.tools.pelican_themes import main |
|||
if __name__ == '__main__': |
|||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
|||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
# -*- coding: utf-8 -*- |
|||
import re |
|||
import sys |
|||
from pygments.cmdline import main |
|||
if __name__ == '__main__': |
|||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
|||
sys.exit(main()) |
@ -0,0 +1,23 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
|
|||
# $Id: rst2html.py 4564 2006-05-21 20:44:42Z wiemann $ |
|||
# Author: David Goodger <goodger@python.org> |
|||
# Copyright: This module has been placed in the public domain. |
|||
|
|||
""" |
|||
A minimal front end to the Docutils Publisher, producing HTML. |
|||
""" |
|||
|
|||
try: |
|||
import locale |
|||
locale.setlocale(locale.LC_ALL, '') |
|||
except: |
|||
pass |
|||
|
|||
from docutils.core import publish_cmdline, default_description |
|||
|
|||
|
|||
description = ('Generates (X)HTML documents from standalone reStructuredText ' |
|||
'sources. ' + default_description) |
|||
|
|||
publish_cmdline(writer_name='html', description=description) |
@ -0,0 +1,26 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
|
|||
# $Id: rst2html4.py 7994 2016-12-10 17:41:45Z milde $ |
|||
# Author: David Goodger <goodger@python.org> |
|||
# Copyright: This module has been placed in the public domain. |
|||
|
|||
""" |
|||
A minimal front end to the Docutils Publisher, producing (X)HTML. |
|||
|
|||
The output conforms to XHTML 1.0 transitional |
|||
and almost to HTML 4.01 transitional (except for closing empty tags). |
|||
""" |
|||
|
|||
try: |
|||
import locale |
|||
locale.setlocale(locale.LC_ALL, '') |
|||
except: |
|||
pass |
|||
|
|||
from docutils.core import publish_cmdline, default_description |
|||
|
|||
|
|||
description = ('Generates (X)HTML documents from standalone reStructuredText ' |
|||
'sources. ' + default_description) |
|||
|
|||
publish_cmdline(writer_name='html4', description=description) |
@ -0,0 +1,35 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
# -*- coding: utf8 -*- |
|||
# :Copyright: ยฉ 2015 Gรผnter Milde. |
|||
# :License: Released under the terms of the `2-Clause BSD license`_, in short: |
|||
# |
|||
# Copying and distribution of this file, with or without modification, |
|||
# are permitted in any medium without royalty provided the copyright |
|||
# notice and this notice are preserved. |
|||
# This file is offered as-is, without any warranty. |
|||
# |
|||
# .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause |
|||
# |
|||
# Revision: $Revision: 8410 $ |
|||
# Date: $Date: 2019-11-04 22:14:43 +0100 (Mo, 04. Nov 2019) $ |
|||
|
|||
""" |
|||
A minimal front end to the Docutils Publisher, producing HTML 5 documents. |
|||
|
|||
The output also conforms to XHTML 1.0 transitional |
|||
(except for the doctype declaration). |
|||
""" |
|||
|
|||
try: |
|||
import locale # module missing in Jython |
|||
locale.setlocale(locale.LC_ALL, '') |
|||
except locale.Error: |
|||
pass |
|||
|
|||
from docutils.core import publish_cmdline, default_description |
|||
|
|||
description = (u'Generates HTML 5 documents from standalone ' |
|||
u'reStructuredText sources ' |
|||
+ default_description) |
|||
|
|||
publish_cmdline(writer_name='html5', description=description) |
@ -0,0 +1,26 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
|
|||
# $Id: rst2latex.py 5905 2009-04-16 12:04:49Z milde $ |
|||
# Author: David Goodger <goodger@python.org> |
|||
# Copyright: This module has been placed in the public domain. |
|||
|
|||
""" |
|||
A minimal front end to the Docutils Publisher, producing LaTeX. |
|||
""" |
|||
|
|||
try: |
|||
import locale |
|||
locale.setlocale(locale.LC_ALL, '') |
|||
except: |
|||
pass |
|||
|
|||
from docutils.core import publish_cmdline |
|||
|
|||
description = ('Generates LaTeX documents from standalone reStructuredText ' |
|||
'sources. ' |
|||
'Reads from <source> (default is stdin) and writes to ' |
|||
'<destination> (default is stdout). See ' |
|||
'<http://docutils.sourceforge.net/docs/user/latex.html> for ' |
|||
'the full reference.') |
|||
|
|||
publish_cmdline(writer_name='latex', description=description) |
@ -0,0 +1,26 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
|
|||
# Author: |
|||
# Contact: grubert@users.sf.net |
|||
# Copyright: This module has been placed in the public domain. |
|||
|
|||
""" |
|||
man.py |
|||
====== |
|||
|
|||
This module provides a simple command line interface that uses the |
|||
man page writer to output from ReStructuredText source. |
|||
""" |
|||
|
|||
import locale |
|||
try: |
|||
locale.setlocale(locale.LC_ALL, '') |
|||
except: |
|||
pass |
|||
|
|||
from docutils.core import publish_cmdline, default_description |
|||
from docutils.writers import manpage |
|||
|
|||
description = ("Generates plain unix manual documents. " + default_description) |
|||
|
|||
publish_cmdline(writer=manpage.Writer(), description=description) |
@ -0,0 +1,30 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
|
|||
# $Id: rst2odt.py 5839 2009-01-07 19:09:28Z dkuhlman $ |
|||
# Author: Dave Kuhlman <dkuhlman@rexx.com> |
|||
# Copyright: This module has been placed in the public domain. |
|||
|
|||
""" |
|||
A front end to the Docutils Publisher, producing OpenOffice documents. |
|||
""" |
|||
|
|||
import sys |
|||
try: |
|||
import locale |
|||
locale.setlocale(locale.LC_ALL, '') |
|||
except: |
|||
pass |
|||
|
|||
from docutils.core import publish_cmdline_to_binary, default_description |
|||
from docutils.writers.odf_odt import Writer, Reader |
|||
|
|||
|
|||
description = ('Generates OpenDocument/OpenOffice/ODF documents from ' |
|||
'standalone reStructuredText sources. ' + default_description) |
|||
|
|||
|
|||
writer = Writer() |
|||
reader = Reader() |
|||
output = publish_cmdline_to_binary(reader=reader, writer=writer, |
|||
description=description) |
|||
|
@ -0,0 +1,67 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
|
|||
# $Id: rst2odt_prepstyles.py 8346 2019-08-26 12:11:32Z milde $ |
|||
# Author: Dave Kuhlman <dkuhlman@rexx.com> |
|||
# Copyright: This module has been placed in the public domain. |
|||
|
|||
""" |
|||
Fix a word-processor-generated styles.odt for odtwriter use: Drop page size |
|||
specifications from styles.xml in STYLE_FILE.odt. |
|||
""" |
|||
|
|||
# Author: Michael Schutte <michi@uiae.at> |
|||
|
|||
from __future__ import print_function |
|||
|
|||
from lxml import etree |
|||
import sys |
|||
import zipfile |
|||
from tempfile import mkstemp |
|||
import shutil |
|||
import os |
|||
|
|||
NAMESPACES = { |
|||
"style": "urn:oasis:names:tc:opendocument:xmlns:style:1.0", |
|||
"fo": "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" |
|||
} |
|||
|
|||
|
|||
def prepstyle(filename): |
|||
|
|||
zin = zipfile.ZipFile(filename) |
|||
styles = zin.read("styles.xml") |
|||
|
|||
root = etree.fromstring(styles) |
|||
for el in root.xpath("//style:page-layout-properties", |
|||
namespaces=NAMESPACES): |
|||
for attr in el.attrib: |
|||
if attr.startswith("{%s}" % NAMESPACES["fo"]): |
|||
del el.attrib[attr] |
|||
|
|||
tempname = mkstemp() |
|||
zout = zipfile.ZipFile(os.fdopen(tempname[0], "w"), "w", |
|||
zipfile.ZIP_DEFLATED) |
|||
|
|||
for item in zin.infolist(): |
|||
if item.filename == "styles.xml": |
|||
zout.writestr(item, etree.tostring(root)) |
|||
else: |
|||
zout.writestr(item, zin.read(item.filename)) |
|||
|
|||
zout.close() |
|||
zin.close() |
|||
shutil.move(tempname[1], filename) |
|||
|
|||
|
|||
def main(): |
|||
args = sys.argv[1:] |
|||
if len(args) != 1: |
|||
print(__doc__, file=sys.stderr) |
|||
print("Usage: %s STYLE_FILE.odt\n" % sys.argv[0], file=sys.stderr) |
|||
sys.exit(1) |
|||
filename = args[0] |
|||
prepstyle(filename) |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
main() |
@ -0,0 +1,23 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
|
|||
# $Id: rst2pseudoxml.py 4564 2006-05-21 20:44:42Z wiemann $ |
|||
# Author: David Goodger <goodger@python.org> |
|||
# Copyright: This module has been placed in the public domain. |
|||
|
|||
""" |
|||
A minimal front end to the Docutils Publisher, producing pseudo-XML. |
|||
""" |
|||
|
|||
try: |
|||
import locale |
|||
locale.setlocale(locale.LC_ALL, '') |
|||
except: |
|||
pass |
|||
|
|||
from docutils.core import publish_cmdline, default_description |
|||
|
|||
|
|||
description = ('Generates pseudo-XML from standalone reStructuredText ' |
|||
'sources (for testing purposes). ' + default_description) |
|||
|
|||
publish_cmdline(description=description) |
@ -0,0 +1,24 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
|
|||
# $Id: rst2s5.py 4564 2006-05-21 20:44:42Z wiemann $ |
|||
# Author: Chris Liechti <cliechti@gmx.net> |
|||
# Copyright: This module has been placed in the public domain. |
|||
|
|||
""" |
|||
A minimal front end to the Docutils Publisher, producing HTML slides using |
|||
the S5 template system. |
|||
""" |
|||
|
|||
try: |
|||
import locale |
|||
locale.setlocale(locale.LC_ALL, '') |
|||
except: |
|||
pass |
|||
|
|||
from docutils.core import publish_cmdline, default_description |
|||
|
|||
|
|||
description = ('Generates S5 (X)HTML slideshow documents from standalone ' |
|||
'reStructuredText sources. ' + default_description) |
|||
|
|||
publish_cmdline(writer_name='s5', description=description) |
@ -0,0 +1,27 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
|
|||
# $Id: rst2xetex.py 7847 2015-03-17 17:30:47Z milde $ |
|||
# Author: Guenter Milde |
|||
# Copyright: This module has been placed in the public domain. |
|||
|
|||
""" |
|||
A minimal front end to the Docutils Publisher, producing Lua/XeLaTeX code. |
|||
""" |
|||
|
|||
try: |
|||
import locale |
|||
locale.setlocale(locale.LC_ALL, '') |
|||
except: |
|||
pass |
|||
|
|||
from docutils.core import publish_cmdline |
|||
|
|||
description = ('Generates LaTeX documents from standalone reStructuredText ' |
|||
'sources for compilation with the Unicode-aware TeX variants ' |
|||
'XeLaTeX or LuaLaTeX. ' |
|||
'Reads from <source> (default is stdin) and writes to ' |
|||
'<destination> (default is stdout). See ' |
|||
'<http://docutils.sourceforge.net/docs/user/latex.html> for ' |
|||
'the full reference.') |
|||
|
|||
publish_cmdline(writer_name='xetex', description=description) |
@ -0,0 +1,23 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
|
|||
# $Id: rst2xml.py 4564 2006-05-21 20:44:42Z wiemann $ |
|||
# Author: David Goodger <goodger@python.org> |
|||
# Copyright: This module has been placed in the public domain. |
|||
|
|||
""" |
|||
A minimal front end to the Docutils Publisher, producing Docutils XML. |
|||
""" |
|||
|
|||
try: |
|||
import locale |
|||
locale.setlocale(locale.LC_ALL, '') |
|||
except: |
|||
pass |
|||
|
|||
from docutils.core import publish_cmdline, default_description |
|||
|
|||
|
|||
description = ('Generates Docutils-native XML from standalone ' |
|||
'reStructuredText sources. ' + default_description) |
|||
|
|||
publish_cmdline(writer_name='xml', description=description) |
@ -0,0 +1,25 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
|
|||
# $Id: rstpep2html.py 4564 2006-05-21 20:44:42Z wiemann $ |
|||
# Author: David Goodger <goodger@python.org> |
|||
# Copyright: This module has been placed in the public domain. |
|||
|
|||
""" |
|||
A minimal front end to the Docutils Publisher, producing HTML from PEP |
|||
(Python Enhancement Proposal) documents. |
|||
""" |
|||
|
|||
try: |
|||
import locale |
|||
locale.setlocale(locale.LC_ALL, '') |
|||
except: |
|||
pass |
|||
|
|||
from docutils.core import publish_cmdline, default_description |
|||
|
|||
|
|||
description = ('Generates (X)HTML from reStructuredText-format PEP files. ' |
|||
+ default_description) |
|||
|
|||
publish_cmdline(reader_name='pep', writer_name='pep_html', |
|||
description=description) |
@ -0,0 +1,8 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
# -*- coding: utf-8 -*- |
|||
import re |
|||
import sys |
|||
from unidecode.util import main |
|||
if __name__ == '__main__': |
|||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
|||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
|||
#!/home/simon/Documents/Work/Varia/varia.website/venv/bin/python3 |
|||
# -*- coding: utf-8 -*- |
|||
import re |
|||
import sys |
|||
from watchfiles.cli import cli |
|||
if __name__ == '__main__': |
|||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
|||
sys.exit(cli()) |
@ -0,0 +1 @@ |
|||
pip |
@ -0,0 +1,28 @@ |
|||
Copyright 2007 Pallets |
|||
|
|||
Redistribution and use in source and binary forms, with or without |
|||
modification, are permitted provided that the following conditions are |
|||
met: |
|||
|
|||
1. Redistributions of source code must retain the above copyright |
|||
notice, this list of conditions and the following disclaimer. |
|||
|
|||
2. Redistributions in binary form must reproduce the above copyright |
|||
notice, this list of conditions and the following disclaimer in the |
|||
documentation and/or other materials provided with the distribution. |
|||
|
|||
3. Neither the name of the copyright holder nor the names of its |
|||
contributors may be used to endorse or promote products derived from |
|||
this software without specific prior written permission. |
|||
|
|||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
|||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
|||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
@ -0,0 +1,106 @@ |
|||
Metadata-Version: 2.1 |
|||
Name: Jinja2 |
|||
Version: 2.11.3 |
|||
Summary: A very fast and expressive template engine. |
|||
Home-page: https://palletsprojects.com/p/jinja/ |
|||
Author: Armin Ronacher |
|||
Author-email: armin.ronacher@active-4.com |
|||
Maintainer: Pallets |
|||
Maintainer-email: contact@palletsprojects.com |
|||
License: BSD-3-Clause |
|||
Project-URL: Documentation, https://jinja.palletsprojects.com/ |
|||
Project-URL: Code, https://github.com/pallets/jinja |
|||
Project-URL: Issue tracker, https://github.com/pallets/jinja/issues |
|||
Platform: UNKNOWN |
|||
Classifier: Development Status :: 5 - Production/Stable |
|||
Classifier: Environment :: Web Environment |
|||
Classifier: Intended Audience :: Developers |
|||
Classifier: License :: OSI Approved :: BSD License |
|||
Classifier: Operating System :: OS Independent |
|||
Classifier: Programming Language :: Python |
|||
Classifier: Programming Language :: Python :: 2 |
|||
Classifier: Programming Language :: Python :: 2.7 |
|||
Classifier: Programming Language :: Python :: 3 |
|||
Classifier: Programming Language :: Python :: 3.5 |
|||
Classifier: Programming Language :: Python :: 3.6 |
|||
Classifier: Programming Language :: Python :: 3.7 |
|||
Classifier: Programming Language :: Python :: 3.8 |
|||
Classifier: Programming Language :: Python :: Implementation :: CPython |
|||
Classifier: Programming Language :: Python :: Implementation :: PyPy |
|||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content |
|||
Classifier: Topic :: Software Development :: Libraries :: Python Modules |
|||
Classifier: Topic :: Text Processing :: Markup :: HTML |
|||
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* |
|||
Description-Content-Type: text/x-rst |
|||
Requires-Dist: MarkupSafe (>=0.23) |
|||
Provides-Extra: i18n |
|||
Requires-Dist: Babel (>=0.8) ; extra == 'i18n' |
|||
|
|||
Jinja |
|||
===== |
|||
|
|||
Jinja is a fast, expressive, extensible templating engine. Special |
|||
placeholders in the template allow writing code similar to Python |
|||
syntax. Then the template is passed data to render the final document. |
|||
|
|||
It includes: |
|||
|
|||
- Template inheritance and inclusion. |
|||
- Define and import macros within templates. |
|||
- HTML templates can use autoescaping to prevent XSS from untrusted |
|||
user input. |
|||
- A sandboxed environment can safely render untrusted templates. |
|||
- AsyncIO support for generating templates and calling async |
|||
functions. |
|||
- I18N support with Babel. |
|||
- Templates are compiled to optimized Python code just-in-time and |
|||
cached, or can be compiled ahead-of-time. |
|||
- Exceptions point to the correct line in templates to make debugging |
|||
easier. |
|||
- Extensible filters, tests, functions, and even syntax. |
|||
|
|||
Jinja's philosophy is that while application logic belongs in Python if |
|||
possible, it shouldn't make the template designer's job difficult by |
|||
restricting functionality too much. |
|||
|
|||
|
|||
Installing |
|||
---------- |
|||
|
|||
Install and update using `pip`_: |
|||
|
|||
.. code-block:: text |
|||
|
|||
$ pip install -U Jinja2 |
|||
|
|||
.. _pip: https://pip.pypa.io/en/stable/quickstart/ |
|||
|
|||
|
|||
In A Nutshell |
|||
------------- |
|||
|
|||
.. code-block:: jinja |
|||
|
|||
{% extends "base.html" %} |
|||
{% block title %}Members{% endblock %} |
|||
{% block content %} |
|||
<ul> |
|||
{% for user in users %} |
|||
<li><a href="{{ user.url }}">{{ user.username }}</a></li> |
|||
{% endfor %} |
|||
</ul> |
|||
{% endblock %} |
|||
|
|||
|
|||
Links |
|||
----- |
|||
|
|||
- Website: https://palletsprojects.com/p/jinja/ |
|||
- Documentation: https://jinja.palletsprojects.com/ |
|||
- Releases: https://pypi.org/project/Jinja2/ |
|||
- Code: https://github.com/pallets/jinja |
|||
- Issue tracker: https://github.com/pallets/jinja/issues |
|||
- Test status: https://dev.azure.com/pallets/jinja/_build |
|||
- Official chat: https://discord.gg/t6rrQZH |
|||
|
|||
|
@ -0,0 +1,61 @@ |
|||
Jinja2-2.11.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 |
|||
Jinja2-2.11.3.dist-info/LICENSE.rst,sha256=O0nc7kEF6ze6wQ-vG-JgQI_oXSUrjp3y4JefweCUQ3s,1475 |
|||
Jinja2-2.11.3.dist-info/METADATA,sha256=PscpJ1C3RSp8xcjV3fAuTz13rKbGxmzJXnMQFH-WKhs,3535 |
|||
Jinja2-2.11.3.dist-info/RECORD,, |
|||
Jinja2-2.11.3.dist-info/WHEEL,sha256=Z-nyYpwrcSqxfdux5Mbn_DQ525iP7J2DG3JgGvOYyTQ,110 |
|||
Jinja2-2.11.3.dist-info/entry_points.txt,sha256=Qy_DkVo6Xj_zzOtmErrATe8lHZhOqdjpt3e4JJAGyi8,61 |
|||
Jinja2-2.11.3.dist-info/top_level.txt,sha256=PkeVWtLb3-CqjWi1fO29OCbj55EhX_chhKrCdrVe_zs,7 |
|||
jinja2/__init__.py,sha256=LZUXmxJc2GIchfSAeMWsxCWiQYO-w1-736f2Q3I8ms8,1549 |
|||
jinja2/__pycache__/__init__.cpython-311.pyc,, |
|||
jinja2/__pycache__/_compat.cpython-311.pyc,, |
|||
jinja2/__pycache__/_identifier.cpython-311.pyc,, |
|||
jinja2/__pycache__/asyncfilters.cpython-311.pyc,, |
|||
jinja2/__pycache__/asyncsupport.cpython-311.pyc,, |
|||
jinja2/__pycache__/bccache.cpython-311.pyc,, |
|||
jinja2/__pycache__/compiler.cpython-311.pyc,, |
|||
jinja2/__pycache__/constants.cpython-311.pyc,, |
|||
jinja2/__pycache__/debug.cpython-311.pyc,, |
|||
jinja2/__pycache__/defaults.cpython-311.pyc,, |
|||
jinja2/__pycache__/environment.cpython-311.pyc,, |
|||
jinja2/__pycache__/exceptions.cpython-311.pyc,, |
|||
jinja2/__pycache__/ext.cpython-311.pyc,, |
|||
jinja2/__pycache__/filters.cpython-311.pyc,, |
|||
jinja2/__pycache__/idtracking.cpython-311.pyc,, |
|||
jinja2/__pycache__/lexer.cpython-311.pyc,, |
|||
jinja2/__pycache__/loaders.cpython-311.pyc,, |
|||
jinja2/__pycache__/meta.cpython-311.pyc,, |
|||
jinja2/__pycache__/nativetypes.cpython-311.pyc,, |
|||
jinja2/__pycache__/nodes.cpython-311.pyc,, |
|||
jinja2/__pycache__/optimizer.cpython-311.pyc,, |
|||
jinja2/__pycache__/parser.cpython-311.pyc,, |
|||
jinja2/__pycache__/runtime.cpython-311.pyc,, |
|||
jinja2/__pycache__/sandbox.cpython-311.pyc,, |
|||
jinja2/__pycache__/tests.cpython-311.pyc,, |
|||
jinja2/__pycache__/utils.cpython-311.pyc,, |
|||
jinja2/__pycache__/visitor.cpython-311.pyc,, |
|||
jinja2/_compat.py,sha256=B6Se8HjnXVpzz9-vfHejn-DV2NjaVK-Iewupc5kKlu8,3191 |
|||
jinja2/_identifier.py,sha256=EdgGJKi7O1yvr4yFlvqPNEqV6M1qHyQr8Gt8GmVTKVM,1775 |
|||
jinja2/asyncfilters.py,sha256=XJtYXTxFvcJ5xwk6SaDL4S0oNnT0wPYvXBCSzc482fI,4250 |
|||
jinja2/asyncsupport.py,sha256=ZBFsDLuq3Gtji3Ia87lcyuDbqaHZJRdtShZcqwpFnSQ,7209 |
|||
jinja2/bccache.py,sha256=3Pmp4jo65M9FQuIxdxoDBbEDFwe4acDMQf77nEJfrHA,12139 |
|||
jinja2/compiler.py,sha256=Ta9W1Lit542wItAHXlDcg0sEOsFDMirCdlFPHAurg4o,66284 |
|||
jinja2/constants.py,sha256=RR1sTzNzUmKco6aZicw4JpQpJGCuPuqm1h1YmCNUEFY,1458 |
|||
jinja2/debug.py,sha256=neR7GIGGjZH3_ILJGVUYy3eLQCCaWJMXOb7o0kGInWc,8529 |
|||
jinja2/defaults.py,sha256=85B6YUUCyWPSdrSeVhcqFVuu_bHUAQXeey--FIwSeVQ,1126 |
|||
jinja2/environment.py,sha256=XDSLKc4SqNLMOwTSq3TbWEyA5WyXfuLuVD0wAVjEFwM,50629 |
|||
jinja2/exceptions.py,sha256=VjNLawcmf2ODffqVMCQK1cRmvFaUfQWF4u8ouP3QPcE,5425 |
|||
jinja2/ext.py,sha256=AtwL5O5enT_L3HR9-oBvhGyUTdGoyaqG_ICtnR_EVd4,26441 |
|||
jinja2/filters.py,sha256=9ORilsZrUoydSI9upz8_qGy7gozDWLYoFmlIBFSVRnQ,41439 |
|||
jinja2/idtracking.py,sha256=J3O4VHsrbf3wzwiBc7Cro26kHb6_5kbULeIOzocchIU,9211 |
|||
jinja2/lexer.py,sha256=nUFLRKhhKmmEWkLI65nQePgcQs7qsRdjVYZETMt_v0g,30331 |
|||
jinja2/loaders.py,sha256=C-fST_dmFjgWkp0ZuCkrgICAoOsoSIF28wfAFink0oU,17666 |
|||
jinja2/meta.py,sha256=QjyYhfNRD3QCXjBJpiPl9KgkEkGXJbAkCUq4-Ur10EQ,4131 |
|||
jinja2/nativetypes.py,sha256=Ul__gtVw4xH-0qvUvnCNHedQeNDwmEuyLJztzzSPeRg,2753 |
|||
jinja2/nodes.py,sha256=Mk1oJPVgIjnQw9WOqILvcu3rLepcFZ0ahxQm2mbwDwc,31095 |
|||
jinja2/optimizer.py,sha256=gQLlMYzvQhluhzmAIFA1tXS0cwgWYOjprN-gTRcHVsc,1457 |
|||
jinja2/parser.py,sha256=fcfdqePNTNyvosIvczbytVA332qpsURvYnCGcjDHSkA,35660 |
|||
jinja2/runtime.py,sha256=0y-BRyIEZ9ltByL2Id6GpHe1oDRQAwNeQvI0SKobNMw,30618 |
|||
jinja2/sandbox.py,sha256=knayyUvXsZ-F0mk15mO2-ehK9gsw04UhB8td-iUOtLc,17127 |
|||
jinja2/tests.py,sha256=iO_Y-9Vo60zrVe1lMpSl5sKHqAxe2leZHC08OoZ8K24,4799 |
|||
jinja2/utils.py,sha256=Wy4yC3IByqUWwnKln6SdaixdzgK74P6F5nf-gQZrYnU,22436 |
|||
jinja2/visitor.py,sha256=DUHupl0a4PGp7nxRtZFttUzAi1ccxzqc2hzetPYUz8U,3240 |
@ -0,0 +1,6 @@ |
|||
Wheel-Version: 1.0 |
|||
Generator: bdist_wheel (0.36.2) |
|||
Root-Is-Purelib: true |
|||
Tag: py2-none-any |
|||
Tag: py3-none-any |
|||
|
@ -0,0 +1,3 @@ |
|||
[babel.extractors] |
|||
jinja2 = jinja2.ext:babel_extract [i18n] |
|||
|
@ -0,0 +1 @@ |
|||
jinja2 |
@ -0,0 +1 @@ |
|||
pip |
@ -0,0 +1,29 @@ |
|||
Copyright 2007, 2008 The Python Markdown Project (v. 1.7 and later) |
|||
Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) |
|||
Copyright 2004 Manfred Stienstra (the original version) |
|||
|
|||
All rights reserved. |
|||
|
|||
Redistribution and use in source and binary forms, with or without |
|||
modification, are permitted provided that the following conditions are met: |
|||
|
|||
* Redistributions of source code must retain the above copyright |
|||
notice, this list of conditions and the following disclaimer. |
|||
* Redistributions in binary form must reproduce the above copyright |
|||
notice, this list of conditions and the following disclaimer in the |
|||
documentation and/or other materials provided with the distribution. |
|||
* Neither the name of the Python Markdown Project nor the |
|||
names of its contributors may be used to endorse or promote products |
|||
derived from this software without specific prior written permission. |
|||
|
|||
THIS SOFTWARE IS PROVIDED BY THE PYTHON MARKDOWN PROJECT ''AS IS'' AND ANY |
|||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|||
DISCLAIMED. IN NO EVENT SHALL ANY CONTRIBUTORS TO THE PYTHON MARKDOWN PROJECT |
|||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|||
POSSIBILITY OF SUCH DAMAGE. |
@ -0,0 +1,98 @@ |
|||
Metadata-Version: 2.1 |
|||
Name: Markdown |
|||
Version: 3.3.3 |
|||
Summary: Python implementation of Markdown. |
|||
Home-page: https://Python-Markdown.github.io/ |
|||
Author: Manfred Stienstra, Yuri takhteyev and Waylan limberg |
|||
Author-email: waylan.limberg@icloud.com |
|||
Maintainer: Waylan Limberg |
|||
Maintainer-email: waylan.limberg@icloud.com |
|||
License: BSD License |
|||
Download-URL: http://pypi.python.org/packages/source/M/Markdown/Markdown-3.3.3-py2.py3-none-any.whl |
|||
Project-URL: Documentation, https://Python-Markdown.github.io/ |
|||
Project-URL: GitHub Project, https://github.com/Python-Markdown/markdown |
|||
Project-URL: Issue Tracker, https://github.com/Python-Markdown/markdown/issues |
|||
Platform: UNKNOWN |
|||
Classifier: Development Status :: 5 - Production/Stable |
|||
Classifier: License :: OSI Approved :: BSD License |
|||
Classifier: Operating System :: OS Independent |
|||
Classifier: Programming Language :: Python |
|||
Classifier: Programming Language :: Python :: 3 |
|||
Classifier: Programming Language :: Python :: 3.6 |
|||
Classifier: Programming Language :: Python :: 3.7 |
|||
Classifier: Programming Language :: Python :: 3.8 |
|||
Classifier: Programming Language :: Python :: 3.9 |
|||
Classifier: Programming Language :: Python :: 3 :: Only |
|||
Classifier: Programming Language :: Python :: Implementation :: CPython |
|||
Classifier: Programming Language :: Python :: Implementation :: PyPy |
|||
Classifier: Topic :: Communications :: Email :: Filters |
|||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries |
|||
Classifier: Topic :: Internet :: WWW/HTTP :: Site Management |
|||
Classifier: Topic :: Software Development :: Documentation |
|||
Classifier: Topic :: Software Development :: Libraries :: Python Modules |
|||
Classifier: Topic :: Text Processing :: Filters |
|||
Classifier: Topic :: Text Processing :: Markup :: HTML |
|||
Classifier: Topic :: Text Processing :: Markup :: Markdown |
|||
Requires-Python: >=3.6 |
|||
Description-Content-Type: text/markdown |
|||
Requires-Dist: importlib-metadata ; python_version < "3.8" |
|||
Provides-Extra: testing |
|||
Requires-Dist: coverage ; extra == 'testing' |
|||
Requires-Dist: pyyaml ; extra == 'testing' |
|||
|
|||
[Python-Markdown][] |
|||
=================== |
|||
|
|||
[![Build Status][build-button]][build] |
|||
[![Coverage Status][codecov-button]][codecov] |
|||
[![Latest Version][mdversion-button]][md-pypi] |
|||
[![Python Versions][pyversion-button]][md-pypi] |
|||
[![BSD License][bsdlicense-button]][bsdlicense] |
|||
[![Code of Conduct][codeofconduct-button]][Code of Conduct] |
|||
|
|||
[build-button]: https://github.com/Python-Markdown/markdown/workflows/CI/badge.svg?event=push |
|||
[build]: https://github.com/Python-Markdown/markdown/actions?query=workflow%3ACI+event%3Apush |
|||
[codecov-button]: https://codecov.io/gh/Python-Markdown/markdown/branch/master/graph/badge.svg |
|||
[codecov]: https://codecov.io/gh/Python-Markdown/markdown |
|||
[mdversion-button]: https://img.shields.io/pypi/v/Markdown.svg |
|||
[md-pypi]: https://pypi.org/project/Markdown/ |
|||
[pyversion-button]: https://img.shields.io/pypi/pyversions/Markdown.svg |
|||
[bsdlicense-button]: https://img.shields.io/badge/license-BSD-yellow.svg |
|||
[bsdlicense]: https://opensource.org/licenses/BSD-3-Clause |
|||
[codeofconduct-button]: https://img.shields.io/badge/code%20of%20conduct-contributor%20covenant-green.svg?style=flat-square |
|||
[Code of Conduct]: https://github.com/Python-Markdown/markdown/blob/master/CODE_OF_CONDUCT.md |
|||
|
|||
This is a Python implementation of John Gruber's [Markdown][]. |
|||
It is almost completely compliant with the reference implementation, |
|||
though there are a few known issues. See [Features][] for information |
|||
on what exactly is supported and what is not. Additional features are |
|||
supported by the [Available Extensions][]. |
|||
|
|||
[Python-Markdown]: https://Python-Markdown.github.io/ |
|||
[Markdown]: https://daringfireball.net/projects/markdown/ |
|||
[Features]: https://Python-Markdown.github.io#Features |
|||
[Available Extensions]: https://Python-Markdown.github.io/extensions |
|||
|
|||
Documentation |
|||
------------- |
|||
|
|||
Installation and usage documentation is available in the `docs/` directory |
|||
of the distribution and on the project website at |
|||
<https://Python-Markdown.github.io/>. |
|||
|
|||
See the change log at <https://Python-Markdown.github.io/change_log>. |
|||
|
|||
Support |
|||
------- |
|||
|
|||
You may report bugs, ask for help, and discuss various other issues on the [bug tracker][]. |
|||
|
|||
[bug tracker]: https://github.com/Python-Markdown/markdown/issues |
|||
|
|||
Code of Conduct |
|||
--------------- |
|||
|
|||
Everyone interacting in the Python-Markdown project's codebases, issue trackers, |
|||
and mailing lists is expected to follow the [Code of Conduct]. |
|||
|
|||
|
@ -0,0 +1,77 @@ |
|||
../../../bin/markdown_py,sha256=icHwfLiy95guxpA9KEZf6hKWeFf7XDbdpNSFvUNX8VA,261 |
|||
Markdown-3.3.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 |
|||
Markdown-3.3.3.dist-info/LICENSE.md,sha256=bxGTy2NHGOZcOlN9biXr1hSCDsDvaTz8EiSBEmONZNo,1645 |
|||
Markdown-3.3.3.dist-info/METADATA,sha256=WHalEShUS2T2w0axy9BTbQBrS03UkpFE3vE0Ew4g_dU,4416 |
|||
Markdown-3.3.3.dist-info/RECORD,, |
|||
Markdown-3.3.3.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 |
|||
Markdown-3.3.3.dist-info/WHEEL,sha256=EVRjI69F5qVjm_YgqcTXPnTAv3BfSUr0WVAHuSP3Xoo,92 |
|||
Markdown-3.3.3.dist-info/entry_points.txt,sha256=j4jiKg-iwZGImvi8OzotZePWoFbJJ4GrfzDqH03u3SQ,1103 |
|||
Markdown-3.3.3.dist-info/top_level.txt,sha256=IAxs8x618RXoH1uCqeLLxXsDefJvE_mIibr_M4sOlyk,9 |
|||
markdown/__init__.py,sha256=002-LuHviYzROW2rg_gBGai81nMouUNO9UFj5nSsTSk,2065 |
|||
markdown/__main__.py,sha256=MpVK3zlwQ-4AzDzZmIScPB90PpunMGVgS5KBmJuHYTw,5802 |
|||
markdown/__meta__.py,sha256=7JKFgvYGgDfauq4ZK8nEMnIAbVKOg64uR7D-xt14fM0,1630 |
|||
markdown/__pycache__/__init__.cpython-311.pyc,, |
|||
markdown/__pycache__/__main__.cpython-311.pyc,, |
|||
markdown/__pycache__/__meta__.cpython-311.pyc,, |
|||
markdown/__pycache__/blockparser.cpython-311.pyc,, |
|||
markdown/__pycache__/blockprocessors.cpython-311.pyc,, |
|||
markdown/__pycache__/core.cpython-311.pyc,, |
|||
markdown/__pycache__/htmlparser.cpython-311.pyc,, |
|||
markdown/__pycache__/inlinepatterns.cpython-311.pyc,, |
|||
markdown/__pycache__/pep562.cpython-311.pyc,, |
|||
markdown/__pycache__/postprocessors.cpython-311.pyc,, |
|||
markdown/__pycache__/preprocessors.cpython-311.pyc,, |
|||
markdown/__pycache__/serializers.cpython-311.pyc,, |
|||
markdown/__pycache__/test_tools.cpython-311.pyc,, |
|||
markdown/__pycache__/treeprocessors.cpython-311.pyc,, |
|||
markdown/__pycache__/util.cpython-311.pyc,, |
|||
markdown/blockparser.py,sha256=JpBhOokOoBUGCXolftOc5m1hPcR2y9s9hVd9WSuhHzo,4285 |
|||
markdown/blockprocessors.py,sha256=U7IjfwJ4WWldfWW4Ia1epEWJKk_7g1B6GqJzB8tN4MU,24821 |
|||
markdown/core.py,sha256=4ASA3Wvs4rgk6HBiT3ScKnIyx3oVz86_-5kGe5Vs5nU,15390 |
|||
markdown/extensions/__init__.py,sha256=nw2VtafIf5zHjAcUuykQbaNY6taOmNn7ARn11-Pe080,3661 |
|||
markdown/extensions/__pycache__/__init__.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/abbr.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/admonition.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/attr_list.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/codehilite.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/def_list.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/extra.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/fenced_code.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/footnotes.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/legacy_attrs.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/legacy_em.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/md_in_html.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/meta.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/nl2br.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/sane_lists.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/smarty.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/tables.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/toc.cpython-311.pyc,, |
|||
markdown/extensions/__pycache__/wikilinks.cpython-311.pyc,, |
|||
markdown/extensions/abbr.py,sha256=5TNU5ml6-H1n-fztEkgUphSTvp5yKCXaiPZMrVuRFvo,3186 |
|||
markdown/extensions/admonition.py,sha256=Zn53VydoDM4HtCZdVKT2Zf0Kp3Dbt6E6FJiyU-tCRvc,5534 |
|||
markdown/extensions/attr_list.py,sha256=nhKFY_u6BVyKW2oMUeC4wEjqFNGpDSnNXqaohuF6M7I,5988 |
|||
markdown/extensions/codehilite.py,sha256=AVbP0Ze37v0FRmySXcsJWmGzaulKdL8w_g-HS1gr4Ag,11628 |
|||
markdown/extensions/def_list.py,sha256=p-JT64hKqMkfxlmhETMVRPxjrdnBIPDW8k3S05S-qNM,3634 |
|||
markdown/extensions/extra.py,sha256=udRN8OvSWcq3UwkPygvsFl1RlCVtCJ-ARVg2IwVH6VY,1831 |
|||
markdown/extensions/fenced_code.py,sha256=rrqPzFvxeVJpitoIXy0qMkNe53gJ0PWHoLZS44yIfeM,7305 |
|||
markdown/extensions/footnotes.py,sha256=xvT6etWuTWTHLNHXYQWQGV-35RHTCvH9kBp2xJA6Jdg,15481 |
|||
markdown/extensions/legacy_attrs.py,sha256=2EaVQkxQoNnP8_lMPvGRBdNda8L4weUQroiyEuVdS-w,2547 |
|||
markdown/extensions/legacy_em.py,sha256=18j4L6zdScy9k18y-U2zaIhYsKVTxCaPurjqLFZmWkI,1582 |
|||
markdown/extensions/md_in_html.py,sha256=XD8Mui_u2c5qUyAtkSMyiH9nSB4-t4ACrf67x7HR6Mk,14521 |
|||
markdown/extensions/meta.py,sha256=EUfkzM7l7UpH__Or9K3pl8ldVddwndlCZWA3d712RAE,2331 |
|||
markdown/extensions/nl2br.py,sha256=wAqTNOuf2L1NzlEvEqoID70n9y-aiYaGLkuyQk3CD0w,783 |
|||
markdown/extensions/sane_lists.py,sha256=ZQmCf-247KBexVG0fc62nDvokGkV6W1uavYbieNKSG4,1505 |
|||
markdown/extensions/smarty.py,sha256=0padzkVCNACainKw-Xj1S5UfT0125VCTfNejmrCZItA,10238 |
|||
markdown/extensions/tables.py,sha256=bicFx_wqhnEx6Y_8MJqA56rh71pt5fOe94oiWbvcobY,7685 |
|||
markdown/extensions/toc.py,sha256=9f0QS5K2BE-Rn0RqZ8xZO8s_xX0U8fgKajx6Jl7goiE,13681 |
|||
markdown/extensions/wikilinks.py,sha256=GkgT9BY7b1-qW--dIwFAhC9V20RoeF13b7CFdw_V21Q,2812 |
|||
markdown/htmlparser.py,sha256=gRk_Ai7w7U46Oo2xbhkLdQCjRqFp5Y8wouIJBzvo0Ts,11276 |
|||
markdown/inlinepatterns.py,sha256=cZZdzEWZhVMerELC6KGlgKUi1AEZosOmw_uJNnPscRw,29762 |
|||
markdown/pep562.py,sha256=5UkqT7sb-cQufgbOl_jF-RYUVVHS7VThzlMzR9vrd3I,8917 |
|||
markdown/postprocessors.py,sha256=o5WpNIImALhyRB40k6TQeVao9eRN_8jOz4Oe7s6nYqA,3844 |
|||
markdown/preprocessors.py,sha256=-s8QGHGlX7JAIJTfCivuc-CVwTLWs0IyEU94YUT2IvQ,2742 |
|||
markdown/serializers.py,sha256=_wQl-iJrPSUEQ4Q1owWYqN9qceVh6TOlAOH_i44BKAQ,6540 |
|||
markdown/test_tools.py,sha256=ZnDwyELUmiyYa0oQgQ31phQrWI1-X6KyRuPkPbnXan4,7750 |
|||
markdown/treeprocessors.py,sha256=gSFoKa_ec-9iPzczsOvHxlkPBvhih5AcA4Q45ZrVJeQ,15407 |
|||
markdown/util.py,sha256=CfRNpS13QDxokl7SAqmkAih6IdPoK2OcPOY8_vgUZHI,16063 |
@ -0,0 +1,5 @@ |
|||
Wheel-Version: 1.0 |
|||
Generator: bdist_wheel (0.35.1) |
|||
Root-Is-Purelib: true |
|||
Tag: py3-none-any |
|||
|
@ -0,0 +1,23 @@ |
|||
[console_scripts] |
|||
markdown_py = markdown.__main__:run |
|||
|
|||
[markdown.extensions] |
|||
abbr = markdown.extensions.abbr:AbbrExtension |
|||
admonition = markdown.extensions.admonition:AdmonitionExtension |
|||
attr_list = markdown.extensions.attr_list:AttrListExtension |
|||
codehilite = markdown.extensions.codehilite:CodeHiliteExtension |
|||
def_list = markdown.extensions.def_list:DefListExtension |
|||
extra = markdown.extensions.extra:ExtraExtension |
|||
fenced_code = markdown.extensions.fenced_code:FencedCodeExtension |
|||
footnotes = markdown.extensions.footnotes:FootnoteExtension |
|||
legacy_attrs = markdown.extensions.legacy_attrs:LegacyAttrExtension |
|||
legacy_em = markdown.extensions.legacy_em:LegacyEmExtension |
|||
md_in_html = markdown.extensions.md_in_html:MarkdownInHtmlExtension |
|||
meta = markdown.extensions.meta:MetaExtension |
|||
nl2br = markdown.extensions.nl2br:Nl2BrExtension |
|||
sane_lists = markdown.extensions.sane_lists:SaneListExtension |
|||
smarty = markdown.extensions.smarty:SmartyExtension |
|||
tables = markdown.extensions.tables:TableExtension |
|||
toc = markdown.extensions.toc:TocExtension |
|||
wikilinks = markdown.extensions.wikilinks:WikiLinkExtension |
|||
|
@ -0,0 +1 @@ |
|||
markdown |
@ -0,0 +1,98 @@ |
|||
Metadata-Version: 2.1 |
|||
Name: MarkupSafe |
|||
Version: 2.0.1 |
|||
Summary: Safely add untrusted strings to HTML/XML markup. |
|||
Home-page: https://palletsprojects.com/p/markupsafe/ |
|||
Author: Armin Ronacher |
|||
Author-email: armin.ronacher@active-4.com |
|||
Maintainer: Pallets |
|||
Maintainer-email: contact@palletsprojects.com |
|||
License: BSD-3-Clause |
|||
Project-URL: Donate, https://palletsprojects.com/donate |
|||
Project-URL: Documentation, https://markupsafe.palletsprojects.com/ |
|||
Project-URL: Changes, https://markupsafe.palletsprojects.com/changes/ |
|||
Project-URL: Source Code, https://github.com/pallets/markupsafe/ |
|||
Project-URL: Issue Tracker, https://github.com/pallets/markupsafe/issues/ |
|||
Project-URL: Twitter, https://twitter.com/PalletsTeam |
|||
Project-URL: Chat, https://discord.gg/pallets |
|||
Classifier: Development Status :: 5 - Production/Stable |
|||
Classifier: Environment :: Web Environment |
|||
Classifier: Intended Audience :: Developers |
|||
Classifier: License :: OSI Approved :: BSD License |
|||
Classifier: Operating System :: OS Independent |
|||
Classifier: Programming Language :: Python |
|||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content |
|||
Classifier: Topic :: Text Processing :: Markup :: HTML |
|||
Requires-Python: >=3.6 |
|||
Description-Content-Type: text/x-rst |
|||
License-File: LICENSE.rst |
|||
|
|||
MarkupSafe |
|||
========== |
|||
|
|||
MarkupSafe implements a text object that escapes characters so it is |
|||
safe to use in HTML and XML. Characters that have special meanings are |
|||
replaced so that they display as the actual characters. This mitigates |
|||
injection attacks, meaning untrusted user input can safely be displayed |
|||
on a page. |
|||
|
|||
|
|||
Installing |
|||
---------- |
|||
|
|||
Install and update using `pip`_: |
|||
|
|||
.. code-block:: text |
|||
|
|||
pip install -U MarkupSafe |
|||
|
|||
.. _pip: https://pip.pypa.io/en/stable/quickstart/ |
|||
|
|||
|
|||
Examples |
|||
-------- |
|||
|
|||
.. code-block:: pycon |
|||
|
|||
>>> from markupsafe import Markup, escape |
|||
|
|||
>>> # escape replaces special characters and wraps in Markup |
|||
>>> escape("<script>alert(document.cookie);</script>") |
|||
Markup('<script>alert(document.cookie);</script>') |
|||
|
|||
>>> # wrap in Markup to mark text "safe" and prevent escaping |
|||
>>> Markup("<strong>Hello</strong>") |
|||
Markup('<strong>hello</strong>') |
|||
|
|||
>>> escape(Markup("<strong>Hello</strong>")) |
|||
Markup('<strong>hello</strong>') |
|||
|
|||
>>> # Markup is a str subclass |
|||
>>> # methods and operators escape their arguments |
|||
>>> template = Markup("Hello <em>{name}</em>") |
|||
>>> template.format(name='"World"') |
|||
Markup('Hello <em>"World"</em>') |
|||
|
|||
|
|||
Donate |
|||
------ |
|||
|
|||
The Pallets organization develops and supports MarkupSafe and other |
|||
popular packages. In order to grow the community of contributors and |
|||
users, and allow the maintainers to devote more time to the projects, |
|||
`please donate today`_. |
|||
|
|||
.. _please donate today: https://palletsprojects.com/donate |
|||
|
|||
|
|||
Links |
|||
----- |
|||
|
|||
- Documentation: https://markupsafe.palletsprojects.com/ |
|||
- Changes: https://markupsafe.palletsprojects.com/changes/ |
|||
- PyPI Releases: https://pypi.org/project/MarkupSafe/ |
|||
- Source Code: https://github.com/pallets/markupsafe/ |
|||
- Issue Tracker: https://github.com/pallets/markupsafe/issues/ |
|||
- Website: https://palletsprojects.com/p/markupsafe/ |
|||
- Twitter: https://twitter.com/PalletsTeam |
|||
- Chat: https://discord.gg/pallets |
@ -0,0 +1,34 @@ |
|||
CHANGES.rst |
|||
LICENSE.rst |
|||
MANIFEST.in |
|||
README.rst |
|||
setup.cfg |
|||
setup.py |
|||
tox.ini |
|||
docs/Makefile |
|||
docs/changes.rst |
|||
docs/conf.py |
|||
docs/escaping.rst |
|||
docs/formatting.rst |
|||
docs/html.rst |
|||
docs/index.rst |
|||
docs/license.rst |
|||
docs/make.bat |
|||
requirements/dev.txt |
|||
requirements/docs.txt |
|||
requirements/tests.txt |
|||
requirements/typing.txt |
|||
src/MarkupSafe.egg-info/PKG-INFO |
|||
src/MarkupSafe.egg-info/SOURCES.txt |
|||
src/MarkupSafe.egg-info/dependency_links.txt |
|||
src/MarkupSafe.egg-info/top_level.txt |
|||
src/markupsafe/__init__.py |
|||
src/markupsafe/_native.py |
|||
src/markupsafe/_speedups.c |
|||
src/markupsafe/_speedups.pyi |
|||
src/markupsafe/py.typed |
|||
tests/conftest.py |
|||
tests/test_escape.py |
|||
tests/test_exception_custom_html.py |
|||
tests/test_leak.py |
|||
tests/test_markupsafe.py |
@ -0,0 +1 @@ |
|||
|
@ -0,0 +1,12 @@ |
|||
../markupsafe/__init__.py |
|||
../markupsafe/__pycache__/__init__.cpython-311.pyc |
|||
../markupsafe/__pycache__/_native.cpython-311.pyc |
|||
../markupsafe/_native.py |
|||
../markupsafe/_speedups.c |
|||
../markupsafe/_speedups.cpython-311-x86_64-linux-gnu.so |
|||
../markupsafe/_speedups.pyi |
|||
../markupsafe/py.typed |
|||
PKG-INFO |
|||
SOURCES.txt |
|||
dependency_links.txt |
|||
top_level.txt |
@ -0,0 +1 @@ |
|||
markupsafe |
@ -0,0 +1,110 @@ |
|||
# |
|||
# The Python Imaging Library |
|||
# $Id$ |
|||
# |
|||
# bitmap distribution font (bdf) file parser |
|||
# |
|||
# history: |
|||
# 1996-05-16 fl created (as bdf2pil) |
|||
# 1997-08-25 fl converted to FontFile driver |
|||
# 2001-05-25 fl removed bogus __init__ call |
|||
# 2002-11-20 fl robustification (from Kevin Cazabon, Dmitry Vasiliev) |
|||
# 2003-04-22 fl more robustification (from Graham Dumpleton) |
|||
# |
|||
# Copyright (c) 1997-2003 by Secret Labs AB. |
|||
# Copyright (c) 1997-2003 by Fredrik Lundh. |
|||
# |
|||
# See the README file for information on usage and redistribution. |
|||
# |
|||
|
|||
""" |
|||
Parse X Bitmap Distribution Format (BDF) |
|||
""" |
|||
|
|||
|
|||
from . import FontFile, Image |
|||
|
|||
bdf_slant = { |
|||
"R": "Roman", |
|||
"I": "Italic", |
|||
"O": "Oblique", |
|||
"RI": "Reverse Italic", |
|||
"RO": "Reverse Oblique", |
|||
"OT": "Other", |
|||
} |
|||
|
|||
bdf_spacing = {"P": "Proportional", "M": "Monospaced", "C": "Cell"} |
|||
|
|||
|
|||
def bdf_char(f): |
|||
# skip to STARTCHAR |
|||
while True: |
|||
s = f.readline() |
|||
if not s: |
|||
return None |
|||
if s[:9] == b"STARTCHAR": |
|||
break |
|||
id = s[9:].strip().decode("ascii") |
|||
|
|||
# load symbol properties |
|||
props = {} |
|||
while True: |
|||
s = f.readline() |
|||
if not s or s[:6] == b"BITMAP": |
|||
break |
|||
i = s.find(b" ") |
|||
props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii") |
|||
|
|||
# load bitmap |
|||
bitmap = [] |
|||
while True: |
|||
s = f.readline() |
|||
if not s or s[:7] == b"ENDCHAR": |
|||
break |
|||
bitmap.append(s[:-1]) |
|||
bitmap = b"".join(bitmap) |
|||
|
|||
[x, y, l, d] = [int(p) for p in props["BBX"].split()] |
|||
[dx, dy] = [int(p) for p in props["DWIDTH"].split()] |
|||
|
|||
bbox = (dx, dy), (l, -d - y, x + l, -d), (0, 0, x, y) |
|||
|
|||
try: |
|||
im = Image.frombytes("1", (x, y), bitmap, "hex", "1") |
|||
except ValueError: |
|||
# deal with zero-width characters |
|||
im = Image.new("1", (x, y)) |
|||
|
|||
return id, int(props["ENCODING"]), bbox, im |
|||
|
|||
|
|||
class BdfFontFile(FontFile.FontFile): |
|||
"""Font file plugin for the X11 BDF format.""" |
|||
|
|||
def __init__(self, fp): |
|||
super().__init__() |
|||
|
|||
s = fp.readline() |
|||
if s[:13] != b"STARTFONT 2.1": |
|||
raise SyntaxError("not a valid BDF file") |
|||
|
|||
props = {} |
|||
comments = [] |
|||
|
|||
while True: |
|||
s = fp.readline() |
|||
if not s or s[:13] == b"ENDPROPERTIES": |
|||
break |
|||
i = s.find(b" ") |
|||
props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii") |
|||
if s[:i] in [b"COMMENT", b"COPYRIGHT"]: |
|||
if s.find(b"LogicalFontDescription") < 0: |
|||
comments.append(s[i + 1 : -1].decode("ascii")) |
|||
|
|||
while True: |
|||
c = bdf_char(fp) |
|||
if not c: |
|||
break |
|||
id, ch, (xy, dst, src), im = c |
|||
if 0 <= ch < len(self.glyph): |
|||
self.glyph[ch] = xy, dst, src, im |
@ -0,0 +1,422 @@ |
|||
""" |
|||
Blizzard Mipmap Format (.blp) |
|||
Jerome Leclanche <jerome@leclan.ch> |
|||
|
|||
The contents of this file are hereby released in the public domain (CC0) |
|||
Full text of the CC0 license: |
|||
https://creativecommons.org/publicdomain/zero/1.0/ |
|||
|
|||
BLP1 files, used mostly in Warcraft III, are not fully supported. |
|||
All types of BLP2 files used in World of Warcraft are supported. |
|||
|
|||
The BLP file structure consists of a header, up to 16 mipmaps of the |
|||
texture |
|||
|
|||
Texture sizes must be powers of two, though the two dimensions do |
|||
not have to be equal; 512x256 is valid, but 512x200 is not. |
|||
The first mipmap (mipmap #0) is the full size image; each subsequent |
|||
mipmap halves both dimensions. The final mipmap should be 1x1. |
|||
|
|||
BLP files come in many different flavours: |
|||
* JPEG-compressed (type == 0) - only supported for BLP1. |
|||
* RAW images (type == 1, encoding == 1). Each mipmap is stored as an |
|||
array of 8-bit values, one per pixel, left to right, top to bottom. |
|||
Each value is an index to the palette. |
|||
* DXT-compressed (type == 1, encoding == 2): |
|||
- DXT1 compression is used if alpha_encoding == 0. |
|||
- An additional alpha bit is used if alpha_depth == 1. |
|||
- DXT3 compression is used if alpha_encoding == 1. |
|||
- DXT5 compression is used if alpha_encoding == 7. |
|||
""" |
|||
|
|||
import struct |
|||
from io import BytesIO |
|||
|
|||
from . import Image, ImageFile |
|||
|
|||
BLP_FORMAT_JPEG = 0 |
|||
|
|||
BLP_ENCODING_UNCOMPRESSED = 1 |
|||
BLP_ENCODING_DXT = 2 |
|||
BLP_ENCODING_UNCOMPRESSED_RAW_BGRA = 3 |
|||
|
|||
BLP_ALPHA_ENCODING_DXT1 = 0 |
|||
BLP_ALPHA_ENCODING_DXT3 = 1 |
|||
BLP_ALPHA_ENCODING_DXT5 = 7 |
|||
|
|||
|
|||
def unpack_565(i): |
|||
return (((i >> 11) & 0x1F) << 3, ((i >> 5) & 0x3F) << 2, (i & 0x1F) << 3) |
|||
|
|||
|
|||
def decode_dxt1(data, alpha=False): |
|||
""" |
|||
input: one "row" of data (i.e. will produce 4*width pixels) |
|||
""" |
|||
|
|||
blocks = len(data) // 8 # number of blocks in row |
|||
ret = (bytearray(), bytearray(), bytearray(), bytearray()) |
|||
|
|||
for block in range(blocks): |
|||
# Decode next 8-byte block. |
|||
idx = block * 8 |
|||
color0, color1, bits = struct.unpack_from("<HHI", data, idx) |
|||
|
|||
r0, g0, b0 = unpack_565(color0) |
|||
r1, g1, b1 = unpack_565(color1) |
|||
|
|||
# Decode this block into 4x4 pixels |
|||
# Accumulate the results onto our 4 row accumulators |
|||
for j in range(4): |
|||
for i in range(4): |
|||
# get next control op and generate a pixel |
|||
|
|||
control = bits & 3 |
|||
bits = bits >> 2 |
|||
|
|||
a = 0xFF |
|||
if control == 0: |
|||
r, g, b = r0, g0, b0 |
|||
elif control == 1: |
|||
r, g, b = r1, g1, b1 |
|||
elif control == 2: |
|||
if color0 > color1: |
|||
r = (2 * r0 + r1) // 3 |
|||
g = (2 * g0 + g1) // 3 |
|||
b = (2 * b0 + b1) // 3 |
|||
else: |
|||
r = (r0 + r1) // 2 |
|||
g = (g0 + g1) // 2 |
|||
b = (b0 + b1) // 2 |
|||
elif control == 3: |
|||
if color0 > color1: |
|||
r = (2 * r1 + r0) // 3 |
|||
g = (2 * g1 + g0) // 3 |
|||
b = (2 * b1 + b0) // 3 |
|||
else: |
|||
r, g, b, a = 0, 0, 0, 0 |
|||
|
|||
if alpha: |
|||
ret[j].extend([r, g, b, a]) |
|||
else: |
|||
ret[j].extend([r, g, b]) |
|||
|
|||
return ret |
|||
|
|||
|
|||
def decode_dxt3(data): |
|||
""" |
|||
input: one "row" of data (i.e. will produce 4*width pixels) |
|||
""" |
|||
|
|||
blocks = len(data) // 16 # number of blocks in row |
|||
ret = (bytearray(), bytearray(), bytearray(), bytearray()) |
|||
|
|||
for block in range(blocks): |
|||
idx = block * 16 |
|||
block = data[idx : idx + 16] |
|||
# Decode next 16-byte block. |
|||
bits = struct.unpack_from("<8B", block) |
|||
color0, color1 = struct.unpack_from("<HH", block, 8) |
|||
|
|||
(code,) = struct.unpack_from("<I", block, 12) |
|||
|
|||
r0, g0, b0 = unpack_565(color0) |
|||
r1, g1, b1 = unpack_565(color1) |
|||
|
|||
for j in range(4): |
|||
high = False # Do we want the higher bits? |
|||
for i in range(4): |
|||
alphacode_index = (4 * j + i) // 2 |
|||
a = bits[alphacode_index] |
|||
if high: |
|||
high = False |
|||
a >>= 4 |
|||
else: |
|||
high = True |
|||
a &= 0xF |
|||
a *= 17 # We get a value between 0 and 15 |
|||
|
|||
color_code = (code >> 2 * (4 * j + i)) & 0x03 |
|||
|
|||
if color_code == 0: |
|||
r, g, b = r0, g0, b0 |
|||
elif color_code == 1: |
|||
r, g, b = r1, g1, b1 |
|||
elif color_code == 2: |
|||
r = (2 * r0 + r1) // 3 |
|||
g = (2 * g0 + g1) // 3 |
|||
b = (2 * b0 + b1) // 3 |
|||
elif color_code == 3: |
|||
r = (2 * r1 + r0) // 3 |
|||
g = (2 * g1 + g0) // 3 |
|||
b = (2 * b1 + b0) // 3 |
|||
|
|||
ret[j].extend([r, g, b, a]) |
|||
|
|||
return ret |
|||
|
|||
|
|||
def decode_dxt5(data): |
|||
""" |
|||
input: one "row" of data (i.e. will produce 4 * width pixels) |
|||
""" |
|||
|
|||
blocks = len(data) // 16 # number of blocks in row |
|||
ret = (bytearray(), bytearray(), bytearray(), bytearray()) |
|||
|
|||
for block in range(blocks): |
|||
idx = block * 16 |
|||
block = data[idx : idx + 16] |
|||
# Decode next 16-byte block. |
|||
a0, a1 = struct.unpack_from("<BB", block) |
|||
|
|||
bits = struct.unpack_from("<6B", block, 2) |
|||
alphacode1 = bits[2] | (bits[3] << 8) | (bits[4] << 16) | (bits[5] << 24) |
|||
alphacode2 = bits[0] | (bits[1] << 8) |
|||
|
|||
color0, color1 = struct.unpack_from("<HH", block, 8) |
|||
|
|||
(code,) = struct.unpack_from("<I", block, 12) |
|||
|
|||
r0, g0, b0 = unpack_565(color0) |
|||
r1, g1, b1 = unpack_565(color1) |
|||
|
|||
for j in range(4): |
|||
for i in range(4): |
|||
# get next control op and generate a pixel |
|||
alphacode_index = 3 * (4 * j + i) |
|||
|
|||
if alphacode_index <= 12: |
|||
alphacode = (alphacode2 >> alphacode_index) & 0x07 |
|||
elif alphacode_index == 15: |
|||
alphacode = (alphacode2 >> 15) | ((alphacode1 << 1) & 0x06) |
|||
else: # alphacode_index >= 18 and alphacode_index <= 45 |
|||
alphacode = (alphacode1 >> (alphacode_index - 16)) & 0x07 |
|||
|
|||
if alphacode == 0: |
|||
a = a0 |
|||
elif alphacode == 1: |
|||
a = a1 |
|||
elif a0 > a1: |
|||
a = ((8 - alphacode) * a0 + (alphacode - 1) * a1) // 7 |
|||
elif alphacode == 6: |
|||
a = 0 |
|||
elif alphacode == 7: |
|||
a = 255 |
|||
else: |
|||
a = ((6 - alphacode) * a0 + (alphacode - 1) * a1) // 5 |
|||
|
|||
color_code = (code >> 2 * (4 * j + i)) & 0x03 |
|||
|
|||
if color_code == 0: |
|||
r, g, b = r0, g0, b0 |
|||
elif color_code == 1: |
|||
r, g, b = r1, g1, b1 |
|||
elif color_code == 2: |
|||
r = (2 * r0 + r1) // 3 |
|||
g = (2 * g0 + g1) // 3 |
|||
b = (2 * b0 + b1) // 3 |
|||
elif color_code == 3: |
|||
r = (2 * r1 + r0) // 3 |
|||
g = (2 * g1 + g0) // 3 |
|||
b = (2 * b1 + b0) // 3 |
|||
|
|||
ret[j].extend([r, g, b, a]) |
|||
|
|||
return ret |
|||
|
|||
|
|||
class BLPFormatError(NotImplementedError): |
|||
pass |
|||
|
|||
|
|||
class BlpImageFile(ImageFile.ImageFile): |
|||
""" |
|||
Blizzard Mipmap Format |
|||
""" |
|||
|
|||
format = "BLP" |
|||
format_description = "Blizzard Mipmap Format" |
|||
|
|||
def _open(self): |
|||
self.magic = self.fp.read(4) |
|||
self._read_blp_header() |
|||
|
|||
if self.magic == b"BLP1": |
|||
decoder = "BLP1" |
|||
self.mode = "RGB" |
|||
elif self.magic == b"BLP2": |
|||
decoder = "BLP2" |
|||
self.mode = "RGBA" if self._blp_alpha_depth else "RGB" |
|||
else: |
|||
raise BLPFormatError(f"Bad BLP magic {repr(self.magic)}") |
|||
|
|||
self.tile = [(decoder, (0, 0) + self.size, 0, (self.mode, 0, 1))] |
|||
|
|||
def _read_blp_header(self): |
|||
(self._blp_compression,) = struct.unpack("<i", self.fp.read(4)) |
|||
|
|||
(self._blp_encoding,) = struct.unpack("<b", self.fp.read(1)) |
|||
(self._blp_alpha_depth,) = struct.unpack("<b", self.fp.read(1)) |
|||
(self._blp_alpha_encoding,) = struct.unpack("<b", self.fp.read(1)) |
|||
(self._blp_mips,) = struct.unpack("<b", self.fp.read(1)) |
|||
|
|||
self._size = struct.unpack("<II", self.fp.read(8)) |
|||
|
|||
if self.magic == b"BLP1": |
|||
# Only present for BLP1 |
|||
(self._blp_encoding,) = struct.unpack("<i", self.fp.read(4)) |
|||
(self._blp_subtype,) = struct.unpack("<i", self.fp.read(4)) |
|||
|
|||
self._blp_offsets = struct.unpack("<16I", self.fp.read(16 * 4)) |
|||
self._blp_lengths = struct.unpack("<16I", self.fp.read(16 * 4)) |
|||
|
|||
|
|||
class _BLPBaseDecoder(ImageFile.PyDecoder): |
|||
_pulls_fd = True |
|||
|
|||
def decode(self, buffer): |
|||
try: |
|||
self.fd.seek(0) |
|||
self.magic = self.fd.read(4) |
|||
self._read_blp_header() |
|||
self._load() |
|||
except struct.error as e: |
|||
raise OSError("Truncated Blp file") from e |
|||
return 0, 0 |
|||
|
|||
def _read_palette(self): |
|||
ret = [] |
|||
for i in range(256): |
|||
try: |
|||
b, g, r, a = struct.unpack("<4B", self.fd.read(4)) |
|||
except struct.error: |
|||
break |
|||
ret.append((b, g, r, a)) |
|||
return ret |
|||
|
|||
def _read_blp_header(self): |
|||
(self._blp_compression,) = struct.unpack("<i", self.fd.read(4)) |
|||
|
|||
(self._blp_encoding,) = struct.unpack("<b", self.fd.read(1)) |
|||
(self._blp_alpha_depth,) = struct.unpack("<b", self.fd.read(1)) |
|||
(self._blp_alpha_encoding,) = struct.unpack("<b", self.fd.read(1)) |
|||
(self._blp_mips,) = struct.unpack("<b", self.fd.read(1)) |
|||
|
|||
self.size = struct.unpack("<II", self.fd.read(8)) |
|||
|
|||
if self.magic == b"BLP1": |
|||
# Only present for BLP1 |
|||
(self._blp_encoding,) = struct.unpack("<i", self.fd.read(4)) |
|||
(self._blp_subtype,) = struct.unpack("<i", self.fd.read(4)) |
|||
|
|||
self._blp_offsets = struct.unpack("<16I", self.fd.read(16 * 4)) |
|||
self._blp_lengths = struct.unpack("<16I", self.fd.read(16 * 4)) |
|||
|
|||
|
|||
class BLP1Decoder(_BLPBaseDecoder): |
|||
def _load(self): |
|||
if self._blp_compression == BLP_FORMAT_JPEG: |
|||
self._decode_jpeg_stream() |
|||
|
|||
elif self._blp_compression == 1: |
|||
if self._blp_encoding in (4, 5): |
|||
data = bytearray() |
|||
palette = self._read_palette() |
|||
_data = BytesIO(self.fd.read(self._blp_lengths[0])) |
|||
while True: |
|||
try: |
|||
(offset,) = struct.unpack("<B", _data.read(1)) |
|||
except struct.error: |
|||
break |
|||
b, g, r, a = palette[offset] |
|||
data.extend([r, g, b]) |
|||
|
|||
self.set_as_raw(bytes(data)) |
|||
else: |
|||
raise BLPFormatError( |
|||
f"Unsupported BLP encoding {repr(self._blp_encoding)}" |