[Python-modules-commits] [pymarkups] 01/06: Import pymarkups_1.0.0.orig.tar.gz
Dmitry Shachnev
mitya57 at moszumanska.debian.org
Sun Dec 13 19:07:42 UTC 2015
This is an automated email from the git hooks/post-receive script.
mitya57 pushed a commit to branch master
in repository pymarkups.
commit 02474b813a50f551cf542a96b74e84bddc66f968
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date: Sun Dec 13 21:01:12 2015 +0300
Import pymarkups_1.0.0.orig.tar.gz
---
.gitignore | 6 ++
.travis.yml | 10 ++
Markups.egg-info/PKG-INFO | 54 +++++++----
Markups.egg-info/SOURCES.txt | 10 +-
PKG-INFO | 54 +++++++----
README.rst | 43 ++++++---
changelog | 9 ++
docs/changelog.rst | 2 +-
docs/conf.py | 212 -----------------------------------------
docs/index.rst | 2 +-
docs/standard_markups.rst | 6 +-
examples/example-template.html | 13 ---
markups/__init__.py | 2 +-
markups/common.py | 2 +-
markups/markdown.py | 2 +-
markups/textile.py | 6 +-
markups/web.py | 99 -------------------
setup.cfg | 4 +-
setup.py | 46 ++-------
tests/data/page.html | 15 ---
tests/data/page.rst | 4 -
tests/data/template.html | 15 ---
tests/test_markdown.py | 8 +-
tests/test_public_api.py | 7 +-
tests/test_web.py | 58 -----------
25 files changed, 162 insertions(+), 527 deletions(-)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..29bcbe8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+build
+dist
+MANIFEST
+Markups.egg-info
+__pycache__
+*.pyc
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..06a0a65
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,10 @@
+sudo: false
+language: python
+python:
+ - "2.7"
+ - "3.2"
+ - "3.3"
+ - "3.4"
+ - "3.5"
+install: pip install Markdown docutils textile
+script: python -m unittest discover -s tests -v
diff --git a/Markups.egg-info/PKG-INFO b/Markups.egg-info/PKG-INFO
index 59c3891..8085107 100644
--- a/Markups.egg-info/PKG-INFO
+++ b/Markups.egg-info/PKG-INFO
@@ -1,29 +1,51 @@
Metadata-Version: 1.1
Name: Markups
-Version: 0.6.3
+Version: 1.0.0
Summary: A wrapper around various text markups
-Home-page: https://github.com/mitya57/pymarkups
+Home-page: https://github.com/retext-project/pymarkups
Author: Dmitry Shachnev
Author-email: mitya57 at gmail.com
License: BSD
-Description: This module provides a wrapper around the various text markup languages,
- such as Markdown_ and reStructuredText_ (these two are supported by default).
+Description:
+ .. image:: https://api.travis-ci.org/retext-project/pymarkups.svg
+ :target: https://travis-ci.org/retext-project/pymarkups
+ :alt: Travis CI status
+
+ This module provides a wrapper around various text markup languages.
+
+ Available by default are Markdown_, reStructuredText_ and Textile_, but you
+ can easily add your own markups.
Usage example:
- >>> markup = markups.get_markup_for_file_name("myfile.rst")
- >>> markup.name
- 'reStructuredText'
- >>> markup.attributes[markups.SYNTAX_DOCUMENTATION]
- 'http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html'
- >>> text = "Hello, world!\n=============\n\nThis is an example **reStructuredText** document."
- >>> markup.get_document_title(text)
- 'Hello, world!'
- >>> markup.get_document_body(text)
- '<p>This is an example <strong>reStructuredText</strong> document.</p>\n'
+ .. code:: python
+
+ >>> import markups
+ >>> markup = markups.get_markup_for_file_name("myfile.rst")
+ >>> markup.name
+ 'reStructuredText'
+ >>> markup.attributes[markups.common.SYNTAX_DOCUMENTATION]
+ 'http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html'
+ >>> text = """
+ ... Hello, world!
+ ... =============
+ ...
+ ... This is an example **reStructuredText** document.
+ ... """
+ >>> markup.get_document_title(text)
+ 'Hello, world!'
+ >>> markup.get_document_body(text)
+ '<p>This is an example <strong>reStructuredText</strong> document.</p>\n'
.. _Markdown: http://daringfireball.net/projects/markdown/
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
+ .. _Textile: https://en.wikipedia.org/wiki/Textile_(markup_language)
+
+ The release version can be downloaded from PyPI_. The source code is hosted on
+ GitHub_.
+
+ .. _PyPI: http://pypi.python.org/pypi/Markups
+ .. _GitHub: https://github.com/retext-project/pymarkups
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
@@ -31,14 +53,12 @@ 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.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.0
-Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Text Processing :: Markup
Classifier: Topic :: Text Processing :: General
Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/Markups.egg-info/SOURCES.txt b/Markups.egg-info/SOURCES.txt
index 11be23a..52886cc 100644
--- a/Markups.egg-info/SOURCES.txt
+++ b/Markups.egg-info/SOURCES.txt
@@ -1,3 +1,5 @@
+.gitignore
+.travis.yml
LICENSE
MANIFEST.in
README.rst
@@ -14,7 +16,6 @@ docs/index.rst
docs/interface.rst
docs/overview.rst
docs/standard_markups.rst
-examples/example-template.html
markups/__init__.py
markups/abstract.py
markups/common.py
@@ -22,13 +23,8 @@ markups/markdown.py
markups/mdx_mathjax.py
markups/restructuredtext.py
markups/textile.py
-markups/web.py
tests/__init__.py
tests/test_markdown.py
tests/test_public_api.py
tests/test_restructuredtext.py
-tests/test_textile.py
-tests/test_web.py
-tests/data/page.html
-tests/data/page.rst
-tests/data/template.html
\ No newline at end of file
+tests/test_textile.py
\ No newline at end of file
diff --git a/PKG-INFO b/PKG-INFO
index 59c3891..8085107 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,29 +1,51 @@
Metadata-Version: 1.1
Name: Markups
-Version: 0.6.3
+Version: 1.0.0
Summary: A wrapper around various text markups
-Home-page: https://github.com/mitya57/pymarkups
+Home-page: https://github.com/retext-project/pymarkups
Author: Dmitry Shachnev
Author-email: mitya57 at gmail.com
License: BSD
-Description: This module provides a wrapper around the various text markup languages,
- such as Markdown_ and reStructuredText_ (these two are supported by default).
+Description:
+ .. image:: https://api.travis-ci.org/retext-project/pymarkups.svg
+ :target: https://travis-ci.org/retext-project/pymarkups
+ :alt: Travis CI status
+
+ This module provides a wrapper around various text markup languages.
+
+ Available by default are Markdown_, reStructuredText_ and Textile_, but you
+ can easily add your own markups.
Usage example:
- >>> markup = markups.get_markup_for_file_name("myfile.rst")
- >>> markup.name
- 'reStructuredText'
- >>> markup.attributes[markups.SYNTAX_DOCUMENTATION]
- 'http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html'
- >>> text = "Hello, world!\n=============\n\nThis is an example **reStructuredText** document."
- >>> markup.get_document_title(text)
- 'Hello, world!'
- >>> markup.get_document_body(text)
- '<p>This is an example <strong>reStructuredText</strong> document.</p>\n'
+ .. code:: python
+
+ >>> import markups
+ >>> markup = markups.get_markup_for_file_name("myfile.rst")
+ >>> markup.name
+ 'reStructuredText'
+ >>> markup.attributes[markups.common.SYNTAX_DOCUMENTATION]
+ 'http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html'
+ >>> text = """
+ ... Hello, world!
+ ... =============
+ ...
+ ... This is an example **reStructuredText** document.
+ ... """
+ >>> markup.get_document_title(text)
+ 'Hello, world!'
+ >>> markup.get_document_body(text)
+ '<p>This is an example <strong>reStructuredText</strong> document.</p>\n'
.. _Markdown: http://daringfireball.net/projects/markdown/
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
+ .. _Textile: https://en.wikipedia.org/wiki/Textile_(markup_language)
+
+ The release version can be downloaded from PyPI_. The source code is hosted on
+ GitHub_.
+
+ .. _PyPI: http://pypi.python.org/pypi/Markups
+ .. _GitHub: https://github.com/retext-project/pymarkups
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
@@ -31,14 +53,12 @@ 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.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.0
-Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Text Processing :: Markup
Classifier: Topic :: Text Processing :: General
Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/README.rst b/README.rst
index d8ab3ea..d27f40b 100644
--- a/README.rst
+++ b/README.rst
@@ -1,22 +1,39 @@
-This module provides a wrapper around the various text markup languages,
-such as Markdown_ and reStructuredText_ (these two are supported by default).
+.. image:: https://api.travis-ci.org/retext-project/pymarkups.svg
+ :target: https://travis-ci.org/retext-project/pymarkups
+ :alt: Travis CI status
+
+This module provides a wrapper around various text markup languages.
+
+Available by default are Markdown_, reStructuredText_ and Textile_, but you
+can easily add your own markups.
Usage example:
->>> markup = markups.get_markup_for_file_name("myfile.rst")
->>> markup.name
-'reStructuredText'
->>> markup.attributes[markups.common.SYNTAX_DOCUMENTATION]
-'http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html'
->>> text = "Hello, world!\n=============\n\nThis is an example **reStructuredText** document."
->>> markup.get_document_title(text)
-'Hello, world!'
->>> markup.get_document_body(text)
-'<p>This is an example <strong>reStructuredText</strong> document.</p>\n'
+.. code:: python
+
+ >>> import markups
+ >>> markup = markups.get_markup_for_file_name("myfile.rst")
+ >>> markup.name
+ 'reStructuredText'
+ >>> markup.attributes[markups.common.SYNTAX_DOCUMENTATION]
+ 'http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html'
+ >>> text = """
+ ... Hello, world!
+ ... =============
+ ...
+ ... This is an example **reStructuredText** document.
+ ... """
+ >>> markup.get_document_title(text)
+ 'Hello, world!'
+ >>> markup.get_document_body(text)
+ '<p>This is an example <strong>reStructuredText</strong> document.</p>\n'
.. _Markdown: http://daringfireball.net/projects/markdown/
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
+.. _Textile: https://en.wikipedia.org/wiki/Textile_(markup_language)
-The release version can be downloaded from PyPI_.
+The release version can be downloaded from PyPI_. The source code is hosted on
+GitHub_.
.. _PyPI: http://pypi.python.org/pypi/Markups
+.. _GitHub: https://github.com/retext-project/pymarkups
diff --git a/changelog b/changelog
index 8fe9961..a01ca6c 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,12 @@
+Version 1.0, 2015-12-13
+=======================
+
+* Web module removed, as ReText no longer needs it.
+* Textile markup updated to work with the latest version of Python-Textile
+ module.
+* The setup script now uses setuptools when it is available.
+* Testsuite and documentation improvements.
+
Version 0.6.3, 2015-06-16
=========================
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 1437e30..59a172d 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -6,6 +6,6 @@ This changelog only lists the most important changes that
happened in Python-Markups. Please see the `Git log`_ for
the full list of changes.
-.. _`Git log`: https://github.com/mitya57/pymarkups/commits/master
+.. _`Git log`: https://github.com/retext-project/pymarkups/commits/master
.. include:: ../changelog
diff --git a/docs/conf.py b/docs/conf.py
index 4d33786..f52be3b 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,17 +1,4 @@
#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-#
-# Python-Markups documentation build configuration file, created by
-# sphinx-quickstart on Mon Jul 21 14:51:00 2014.
-#
-# This file is execfile()d with the current directory set to its
-# containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
import sys
import os
@@ -23,9 +10,6 @@ sys.path.insert(0, os.path.abspath('..'))
# -- General configuration ------------------------------------------------
-# If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
-
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
@@ -39,9 +23,6 @@ templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
-# The encoding of source files.
-#source_encoding = 'utf-8-sig'
-
# The master toctree document.
master_doc = 'index'
@@ -59,204 +40,11 @@ version = '%d.%d' % __version_tuple__[:2]
# The full version, including alpha/beta/rc tags.
release = '%d.%d.%d' % __version_tuple__
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#language = None
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-#today = ''
-# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-exclude_patterns = ['_build']
-
-# The reST default role (used for this markup: `text`) to use for all
-# documents.
-#default_role = None
-
-# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function::).
-#add_module_names = True
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-#show_authors = False
-
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
-# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
-
-# If true, keep warnings as "system message" paragraphs in the built documents.
-#keep_warnings = False
-
-
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'nature'
-
-# Theme options are theme-specific and customize the look and feel of a theme
-# further. For a list of options available for each theme, see the
-# documentation.
-#html_theme_options = {}
-
-# Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
-
-# The name for this set of Sphinx documents. If None, it defaults to
-# "<project> v<release> documentation".
-#html_title = None
-
-# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
-
-# The name of an image file (relative to this directory) to place at the top
-# of the sidebar.
-#html_logo = None
-
-# The name of an image file (within the static path) to use as favicon of the
-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-#html_favicon = None
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-#html_static_path = []
-
-# Add any extra paths that contain custom files (such as robots.txt or
-# .htaccess) here, relative to this directory. These files are copied
-# directly to the root of the documentation.
-#html_extra_path = []
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-#html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-#html_additional_pages = {}
-
-# If false, no module index is generated.
-#html_domain_indices = True
-
-# If false, no index is generated.
-#html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-#html_split_index = False
-
-# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
-
-# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
-
-# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a <link> tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
-
-# This is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = None
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'Python-Markupsdoc'
-
-
-# -- Options for LaTeX output ---------------------------------------------
-
-latex_elements = {
-# The paper size ('letterpaper' or 'a4paper').
-#'papersize': 'letterpaper',
-
-# The font size ('10pt', '11pt' or '12pt').
-#'pointsize': '10pt',
-
-# Additional stuff for the LaTeX preamble.
-#'preamble': '',
-}
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title,
-# author, documentclass [howto, manual, or own class]).
-latex_documents = [
- ('index', 'Python-Markups.tex', u'Python-Markups Documentation',
- u'Dmitry Shachnev', 'manual'),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#latex_use_parts = False
-
-# If true, show page references after internal links.
-#latex_show_pagerefs = False
-
-# If true, show URL addresses after external links.
-#latex_show_urls = False
-
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
-
-# If false, no module index is generated.
-#latex_domain_indices = True
-
-
-# -- Options for manual page output ---------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
-man_pages = [
- ('index', 'python-markups', u'Python-Markups Documentation',
- [u'Dmitry Shachnev'], 1)
-]
-
-# If true, show URL addresses after external links.
-#man_show_urls = False
-
-
-# -- Options for Texinfo output -------------------------------------------
-
-# Grouping the document tree into Texinfo files. List of tuples
-# (source start file, target name, title, author,
-# dir menu entry, description, category)
-texinfo_documents = [
- ('index', 'Python-Markups', u'Python-Markups Documentation',
- u'Dmitry Shachnev', 'Python-Markups', 'One line description of project.',
- 'Miscellaneous'),
-]
-
-# Documents to append as an appendix to all manuals.
-#texinfo_appendices = []
-
-# If false, no module index is generated.
-#texinfo_domain_indices = True
-
-# How to display URL addresses: 'footnote', 'no', or 'inline'.
-#texinfo_show_urls = 'footnote'
-
-# If true, do not generate a @detailmenu in the "Top" node's menu.
-#texinfo_no_detailmenu = False
diff --git a/docs/index.rst b/docs/index.rst
index 28b4ce7..e567b68 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -34,6 +34,6 @@ Links
* You can get the source tarball from PyPI_.
* It is also packaged in Debian_.
-.. _GitHub: https://github.com/mitya57/pymarkups
+.. _GitHub: https://github.com/retext-project/pymarkups
.. _PyPI: https://pypi.python.org/pypi/Markups
.. _Debian: https://packages.debian.org/sid/source/pymarkups
diff --git a/docs/standard_markups.rst b/docs/standard_markups.rst
index 8d021ee..1a60b39 100644
--- a/docs/standard_markups.rst
+++ b/docs/standard_markups.rst
@@ -48,7 +48,7 @@ supported as well.
.. _Markdown: http://daringfireball.net/projects/markdown/
.. _Python-Markdown: https://pythonhosted.org/Markdown/
-.. _MathJax: http://www.mathjax.org/
+.. _MathJax: https://www.mathjax.org/
.. _`Python-Markdown extensions`: http://pythonhosted.org/Markdown/extensions/
.. _`Python-Markdown Extra`: http://pythonhosted.org/Markdown/extensions/extra.html
@@ -75,7 +75,7 @@ module.
The file extension associated with Textile markup is ``.textile``.
-.. _Textile: http://en.wikipedia.org/wiki/Textile_(markup_language)
-.. _python-textile: https://github.com/sebix/python-textile
+.. _Textile: https://en.wikipedia.org/wiki/Textile_(markup_language)
+.. _python-textile: https://github.com/textile/python-textile
.. autoclass:: markups.TextileMarkup
diff --git a/examples/example-template.html b/examples/example-template.html
deleted file mode 100644
index 2194e5e..0000000
--- a/examples/example-template.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<html>
-<head>
-<meta http-equiv="content-type" content="text/html; charset=utf-8">
-<meta name="generator" content="%GENERATOR%">
-<title>%PAGENAME%</title>
-</head>
-<body>
-%CONTENT%
-<hr>
-<p>Generated by %APPINFO% from %MARKUPNAME% source.<br>
-Generation time: %TIME%.</p>
-</body>
-</html>
diff --git a/markups/__init__.py b/markups/__init__.py
index 9f0bd91..ecc73fa 100644
--- a/markups/__init__.py
+++ b/markups/__init__.py
@@ -10,7 +10,7 @@ from markups.markdown import MarkdownMarkup
from markups.restructuredtext import ReStructuredTextMarkup
from markups.textile import TextileMarkup
-__version_tuple__ = (0, 6, 3)
+__version_tuple__ = (1, 0, 0)
__version__ = '.'.join(map(str, __version_tuple__))
builtin_markups = [MarkdownMarkup, ReStructuredTextMarkup, TextileMarkup]
diff --git a/markups/common.py b/markups/common.py
index e5947f6..e1f789d 100644
--- a/markups/common.py
+++ b/markups/common.py
@@ -6,7 +6,7 @@ import os.path
# Some common constants and functions
(LANGUAGE_HOME_PAGE, MODULE_HOME_PAGE, SYNTAX_DOCUMENTATION) = range(3)
-CONFIGURATION_DIR = (os.environ.get('XDG_CONFIG_HOME') or
+CONFIGURATION_DIR = (os.getenv('XDG_CONFIG_HOME') or os.getenv('APPDATA') or
os.path.expanduser('~/.config'))
MATHJAX_LOCAL_URL = 'file:///usr/share/javascript/mathjax/MathJax.js'
MATHJAX_WEB_URL = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js'
diff --git a/markups/markdown.py b/markups/markdown.py
index 68e9058..06184cb 100644
--- a/markups/markdown.py
+++ b/markups/markdown.py
@@ -49,7 +49,7 @@ class MarkdownMarkup(AbstractMarkup):
import markdown
except ImportError:
return False
- return markdown.version_info >= (2, 6)
+ return hasattr(markdown, 'version_info') and markdown.version_info >= (2, 6)
def _load_extensions_list_from_file(self, filename):
try:
diff --git a/markups/textile.py b/markups/textile.py
index 111dca4..f489c1a 100644
--- a/markups/textile.py
+++ b/markups/textile.py
@@ -14,7 +14,7 @@ class TextileMarkup(AbstractMarkup):
name = 'Textile'
attributes = {
common.LANGUAGE_HOME_PAGE: 'http://en.wikipedia.org/wiki/Textile_(markup_language)',
- common.MODULE_HOME_PAGE: 'https://github.com/sebix/python-textile',
+ common.MODULE_HOME_PAGE: 'https://github.com/textile/python-textile',
common.SYNTAX_DOCUMENTATION: 'http://movabletype.org/documentation/author/textile-2-syntax.html'
}
@@ -31,8 +31,8 @@ class TextileMarkup(AbstractMarkup):
def __init__(self, filename=None):
AbstractMarkup.__init__(self, filename)
- from textile import Textile
+ from textile.core import Textile
self.parser = Textile()
def get_document_body(self, text):
- return self.parser.textile(text)
+ return self.parser.parse(text)
diff --git a/markups/web.py b/markups/web.py
deleted file mode 100644
index 3d53454..0000000
--- a/markups/web.py
+++ /dev/null
@@ -1,99 +0,0 @@
-# python-markups, web module
-# License: BSD
-# Copyright: (C) Dmitry Shachnev, 2012
-
-import os
-import markups
-import sys
-import warnings
-from email.utils import formatdate
-
-if sys.version_info[0] < 3:
- raise ImportError('Python 3.x is required.')
-
-warnings.warn('Web module is deprecated and will be removed soon.',
- DeprecationWarning)
-
-__version__ = markups.__version__
-site = 'https://github.com/mitya57/pymarkups'
-
-APP_NAME, APP_VERSION, APP_SITE = range(3)
-default_app_data = ('python-markups', __version__, site)
-
-class WebUpdateError(IOError):
- pass
-
-class WebLibrary(object):
- def __init__(self, working_dir='.', app_data=default_app_data):
- """Construct a new WebLibrary object"""
- self.working_dir = working_dir
- if app_data[APP_SITE]:
- self.app_info = '<a href="' + app_data[APP_SITE] + '">' \
- + app_data[APP_NAME] + '</a>'
- else:
- self.app_info = app_data[APP_NAME]
- if app_data[APP_VERSION]:
- self.generator_info = app_data[APP_NAME] + ' ' + app_data[APP_VERSION]
- else:
- self.generator_info = app_data[APP_NAME]
-
- def update_all(self):
- """Process all documents in the directory"""
- def is_supported_file(path):
- filename = os.path.join(self.working_dir, path)
- if not os.path.isfile(filename):
- return False
- return (markups.get_markup_for_file_name(filename) is not None)
-
- self._init_template()
- for fname in filter(is_supported_file, os.listdir(self.working_dir)):
- self._process_page(fname)
-
- def update(self, filename):
- """Process one file in the directory"""
- self._init_template()
- if os.path.exists(os.path.join(self.working_dir, filename)):
- self._process_page(filename)
- else:
- raise WebUpdateError('File not found.')
-
- def _init_template(self):
- templatefile = open(os.path.join(self.working_dir, 'template.html'))
- self.template = templatefile.read()
- templatefile.close()
- self.template = self.template.replace('%GENERATOR%', self.generator_info)
- self.template = self.template.replace('%APPINFO%', self.app_info)
-
- def _process_page(self, fname):
- inputfile = os.path.join(self.working_dir, fname)
- markup = markups.get_markup_for_file_name(inputfile)
- if not markup:
- raise WebUpdateError('No suitable markup found.')
- bn, ext = os.path.splitext(fname)
- html = pagename = ''
- inputfile = open(inputfile, 'r')
- text = inputfile.read()
- inputfile.close()
- markup.enable_cache = True
- html = markup.get_document_body(text).rstrip()
- pagename = markup.get_document_title(text)
- javascript = markup.get_javascript(text, webenv=True)
- if not pagename:
- pagename = bn
- if html or bn == 'index':
- content = self.template
- content = content.replace('%CONTENT%', html)
- content = content.replace('%PAGENAME%', pagename)
- content = content.replace('%SOURCEFILENAME%', fname)
- content = content.replace('%EXTRAHEADERS%', javascript)
- content = content.replace('%HTMLDIR%', '.')
- content = content.replace('%MARKUPNAME%', markup.name)
- content = content.replace('%TIME%', formatdate(usegmt=True))
- content = content.replace(' href="'+bn+'.html"', '')
- content = content.replace('%\\', '%')
- htmldir = os.path.join(self.working_dir, 'html')
- if not os.path.exists(htmldir):
- os.mkdir(htmldir)
- outputfile = open(os.path.join(htmldir, bn+'.html'), 'w')
- outputfile.write(content)
- outputfile.close()
diff --git a/setup.cfg b/setup.cfg
index a669c45..6bc2ff3 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
[egg_info]
-tag_svn_revision = 0
-tag_build =
tag_date = 0
+tag_build =
+tag_svn_revision = 0
diff --git a/setup.py b/setup.py
index 48c8feb..9baaa40 100755
--- a/setup.py
+++ b/setup.py
@@ -1,53 +1,27 @@
#!/usr/bin/env python3
import sys
-from distutils.core import setup, Command
-from markups import __version__ as version
-
-try:
- from sphinx.setup_command import BuildDoc
-except ImportError:
- BuildDoc = None
-
try:
- from setuptools.command.upload_docs import upload_docs
+ from setuptools import setup, Command
except ImportError:
- upload_docs = None
-
-long_description = \
-"""This module provides a wrapper around the various text markup languages,
-such as Markdown_ and reStructuredText_ (these two are supported by default).
-
-Usage example:
-
->>> markup = markups.get_markup_for_file_name("myfile.rst")
->>> markup.name
-'reStructuredText'
->>> markup.attributes[markups.SYNTAX_DOCUMENTATION]
-'http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html'
->>> text = "Hello, world!\\n=============\\n\\nThis is an example **reStructuredText** document."
->>> markup.get_document_title(text)
-'Hello, world!'
->>> markup.get_document_body(text)
-'<p>This is an example <strong>reStructuredText</strong> document.</p>\\n'
+ from distutils.core import setup, Command
+from markups import __version__ as version
+from os.path import dirname, join
-.. _Markdown: http://daringfireball.net/projects/markdown/
-.. _reStructuredText: http://docutils.sourceforge.net/rst.html
-"""
+with open(join(dirname(__file__), 'README.rst')) as readme_file:
+ long_description = '\n' + readme_file.read()
classifiers = ['Development Status :: 4 - Beta',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.0',
- 'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
'Topic :: Text Processing :: Markup',
'Topic :: Text Processing :: General',
'Topic :: Software Development :: Libraries :: Python Modules'
@@ -68,10 +42,6 @@ class run_tests(Command):
cmdclass = {}
if sys.version_info[0] >= 3:
cmdclass['test'] = run_tests
-if BuildDoc:
- cmdclass['build_sphinx'] = BuildDoc
-if upload_docs:
- cmdclass['upload_docs'] = upload_docs
setup_args = {
'name': 'Markups',
@@ -80,7 +50,7 @@ setup_args = {
'long_description': long_description,
'author': 'Dmitry Shachnev',
'author_email': 'mitya57 at gmail.com',
- 'url': 'https://github.com/mitya57/pymarkups',
+ 'url': 'https://github.com/retext-project/pymarkups',
'packages': ['markups'],
'license': 'BSD',
'cmdclass': cmdclass,
diff --git a/tests/data/page.html b/tests/data/page.html
deleted file mode 100644
index 9893b2a..0000000
--- a/tests/data/page.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<html><head>
-<title>Hello, world!</title>
-</head><body>
-<div id="content-test">
-<p>This is an example <strong>reStructuredText</strong> document.</p>
-</div>
-<pre id="headers-test">
-SOURCEFILENAME: page.rst
-HTMLDIR: .
-MARKUPNAME: reStructuredText
-GENERATOR: test 1.0
-APPINFO: <a href="http://example.com/">test</a>
-</pre>
-</body>
-</html>
diff --git a/tests/data/page.rst b/tests/data/page.rst
deleted file mode 100644
index e799932..0000000
--- a/tests/data/page.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-Hello, world!
-=============
-
-This is an example **reStructuredText** document.
diff --git a/tests/data/template.html b/tests/data/template.html
deleted file mode 100644
index 09f36b7..0000000
--- a/tests/data/template.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<html><head>
-<title>%PAGENAME%</title>
-</head><body>
-<div id="content-test">
-%CONTENT%
-</div>
-<pre id="headers-test">
-SOURCEFILENAME: %SOURCEFILENAME%
-HTMLDIR: %HTMLDIR%
-MARKUPNAME: %MARKUPNAME%
-GENERATOR: %GENERATOR%
-APPINFO: %APPINFO%
-</pre>
-</body>
-</html>
diff --git a/tests/test_markdown.py b/tests/test_markdown.py
index e68da00..c0d1d1e 100644
--- a/tests/test_markdown.py
+++ b/tests/test_markdown.py
@@ -181,19 +181,19 @@ class MarkdownTest(unittest.TestCase):
def test_remove_extra(self):
markup = MarkdownMarkup(extensions=['remove_extra'])
html = markup.get_document_body(tables_source)
- self.assertNotIn(html, '<table>')
+ self.assertNotIn('<table>', html)
def test_remove_extra_document_extension(self):
markup = MarkdownMarkup(extensions=[])
html = markup.get_document_body(
'Required-Extensions: remove_extra\n\n' +
tables_source)
- self.assertNotIn(html, '<table>')
+ self.assertNotIn('<table>', html)
def test_remove_extra_removes_mathjax(self):
- markup = MarkdownMarkup()
+ markup = MarkdownMarkup(extensions=['remove_extra'])
html = markup.get_document_body('$$1$$')
- self.assertNotIn(html, 'math/tex')
+ self.assertNotIn('math/tex', html)
def test_meta(self):
markup = MarkdownMarkup()
... 86 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pymarkups.git
More information about the Python-modules-commits
mailing list