aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_apis.py
Commit message (Collapse)AuthorAgeFilesLines
* Move isBlockLevel to class. (#693)Waylan Limberg2018-07-311-3/+4
| | | | | Allows users and/or extensions to alter the list of block level elements. The old implementation remains with a DeprecationWarning. Fixes #575.
* Deprecate md_globals from extension API. (#697)Waylan Limberg2018-07-311-2/+2
| | | | | | In the past, most of the config was defined using globals. Today all of the config is held on the class instance. Therefore, the `md_globals` parameter is no longer necessary.
* Refactor options testsWaylan Limberg2018-07-311-0/+12
|
* Fix double escaping of amp in attributes (#670)Isaac Muse2018-07-291-0/+9
| | | | | | | | | | Serializer should only escape & in attributes if not part of & Better regex avoid Unicode and `_` in amp detection. In general, we don't want to escape already escaped content, but with code content, we want literal representations of escaped content, so have code content explicitly escape its content before placing in AtomicStrings. Closes #669.
* Consistent copyright headers.Waylan Limberg2018-07-271-2/+20
| | | | Fixes #435.
* Replace homegrown OrderedDict with purpose-built Registry. (#688)Waylan Limberg2018-07-271-147/+212
| | | | | | | | | | | | | | | | | | | All processors and patterns now get "registered" to a Registry. Each item is given a name (string) and a priority. The name is for later reference and the priority can be either an integer or float and is used to sort. Priority is sorted from highest to lowest. A Registry instance is a list-like iterable with the items auto-sorted by priority. If two items have the same priority, then they are listed in the order there were "registered". Registering a new item with the same name as an already registered item replaces the old item with the new item (however, the new item is sorted by its newly assigned priority). To remove an item, "deregister" it by name or index. A backwards compatible shim is included so that existing simple extensions should continue to work. DeprecationWarnings will be raised for any code which calls the old API. Fixes #418.
* Improve serializer test coverageWaylan Limberg2018-07-241-6/+64
| | | | | | | | | Should be 100% coverage now. The ProcessingInstruction needed to be imported directly from ElementTree as PY27 was using a PIProxy which resulted in a bug. Interestingly, PY3 worked fine. Also removed the encoding code as it was not used. Besides it was only ever accessable from a private function.
* Simplify namespace support in serializer.Waylan Limberg2018-07-241-0/+29
| | | | Fixes #679.
* Simplify output_formats to html and xhtml.Waylan Limberg2018-01-251-3/+3
| | | | | | | | | | | We started with the numbers before HTML5 was a thing and we thought there might be an XHTML2. Today, we know that all we have are HTML style tags and XHTML style tags. Nothing else really matters in the real world. Note that if '(x)html1' '(x)html4' or '(x)html5' are passed in, the number is stripped/ignored. Users shouldn't need to change their code for this.
* Flexible inline (#629)Isaac Muse2018-01-171-5/+5
| | | | Add new InlineProcessor class that handles inline processing much better and allows for more flexibility. This adds new InlineProcessors that no longer utilize unnecessary pretext and posttext captures. New class can accept the buffer that is being worked on and manually process the text without regex and return new replacement bounds. This helps us to handle links in a better way and handle nested brackets and logic that is too much for regular expression. The refactor also allows image links to have links/paths with spaces like links. Ref #551, #613, #590, #161.
* Improve test coverage.Waylan Limberg2018-01-131-2/+56
|
* Refactor Extension loading (#627)Waylan Limberg2018-01-121-43/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecated naming support is removed: * Removed special treatment for modules in `markdown.extensions` * Removed support for `mdx_` prefixes. Support for Entry Point names added: Support for "short names" are now implemented with entry points. Therefore all the users who call extension names as `toc` will not get errors as the builtin extensions all have entry points defined which match the old "short names" for modules in `markdown.extensions`. The benefit is that any extension can offer the same support without requiring the user to manually copy a file to that location on the file system (way to many extension authors have included such instructions in their installation documentation). The one odd thing about this is that we have been issuing a DeprecationWarning for short names and now they are fully supported again. But I think it's the right thing to do. Support for using dot notation is not removed. After all, it was never deprecated. And we shouldn't "force" entry points. There are plenty of reasons why users may not want that and not all of them can be resolved by using class instances instead. All of the following ways to load an extension are valid: # Class instance from markdown.extensions.toc import TocExtension markdown.markdown(src, extensions=[TocExtension()] # Entry point name markdown.markdown(src, extensions=['toc']) # Dot notation with class markdown.markdown(src, extensions=['markdown.extensions.toc:TocExtension']) # Dot notation without class markdown.markdown(src, extensions=['markdown.extensions.toc'])
* Removed deprecated safe_mode.Waylan Limberg2018-01-111-34/+2
|
* Removed support for deprecated config in ext name.Waylan Limberg2018-01-111-7/+0
|
* Feature ancestry (#598)Isaac Muse2017-11-231-0/+52
| | | | | Ancestry exclusion for inline patterns. Adds the ability for an inline pattern to define a list of ancestor tag names that should be avoided. If a pattern would create a descendant of one of the listed tag names, the pattern will not match. Fixes #596.
* Tables: Improvements (#530)Isaac Muse2017-01-191-0/+12
| | | | | | | Tables now handle escaped pipes when testing, in table borders, and in the inline content. To achieve properly, a bug had to be fixed related to appending escaped chars to the Markdown class. Now appended chars only appear in the current instance. Lastly the first backtick in a table can be escaped rounding out the last corner case.
* Only log warnings from commandline script.Waylan Limberg2015-01-311-3/+2
| | | | | | | | | I need to remember this is a lib first and not configure logging from within the lib. Also, from the script we are now actually displaying deprecation warnings. For some reason I don't understnad deprecation warnings are hidden by default in Python. And who remembers to run Python with the `-Wd` flag every time they upgrade a lib just to make sure there's no new deprecations? Fixes #384.
* PendingDeprecationWarning (v2.5) => DeprecationWarning (v2.6)Waylan Limberg2014-12-301-6/+6
|
* Completed flake8 cleanup.Waylan Limberg2014-11-201-101/+203
| | | | | I've decided to go with longer lines in the tests. Also fixed a couple errors with the previous cleanup.
* Fix the lost tail issue in inlineprocessors.facelessuser2014-09-261-0/+14
| | | | | | See #253. Prior to this patch, if any inline processors returned an element with a tail, the tail would end up empty. This resolves that issue and will allow for #253 to be fixed. Thanks to @facelessuser for the work on this.
* Added a temp workwround for deprecated short ext names.Waylan Limberg2014-09-251-9/+6
| | | | | | | | | | | | As we chnaged the order in import trys for short names extensions (no dot syntax), an extra test was added to the import code for the occassion when a naming conflict exists. For example, if PyTables is installed (module name is tables) and the user tries to use the short name 'tables' instead of 'markdown.extensions.tables'. Fixes #341. Of course, this code will get ripped out when the old behavior is fully deprecated.
* Fixed TOC Option parsing.Waylan Limberg2014-09-251-1/+14
| | | | | | The new option parser assumes bool values if the default is bool or None. As the "title" option is not a bool value, it should default to an empty string rather than None. Fixes #347.
* Mark special treatment of extension names as PendingDeprecationWaylan Limberg2014-08-291-5/+15
| | | | | | | | | | | | | | | | | The builtin extensions will no longer get special treatment and have the path ("markdown.extensions.") appended . The same applies for "mdx_" extensions. All names extension must provide the full path. Fixes #336. Also deprecating support for passing in extension config settings as part of the string name. The extension_configs keyword should be used instead. Fixes #335. Also raising PendingDeprecationWarnings for positional args or the "config" keyword on the Extension Class. Pass each setting as a seperate keyword instead. Docs and tests are updated. Still need to update extension API docs.
* More updates to test configs.Waylan Limberg2014-08-291-2/+2
| | | | | | | | | | | | | | The last few extensions were updated to accept dicts/**kwargs as configs and more tests were updated. Also updated extra to actually accept configs. Note that extra requires an extra level of dicts. First you need to indicate tha the settings are for extra, then, which extension extra wraps. I'm not crazy abount this, bit not sur ehow else to do it without making all the configs a global attribute on the Markdown class to that any extention can access any other extensions config settings. I don't think we wnat to do that. Also updated extra to use dot notation for the sub-extensions.
* All extension tests now use python dot notation.Waylan Limberg2014-08-291-8/+10
| | | | | | | | | | All named extensions now use python dot notation in the tests - including all builtin extensions (eg: 'extra' => 'markdown.extensions.extra'). This is in anticipation of #336. Note there are a few tests (in the error tests) that will still need updating, but not till we make the change as they will test for the new error message.
* Allow named extensions to specify the Class NameWaylan Limberg2014-08-271-2/+15
| | | | | | | | | | | | | | | | | | If you were to import the class like this: from path.to.module import SomeExtensionClass Then the named extension would be the string: "path.to.module:SomeExtensionClass" This should simplify loading extensions from the command line or template filters -- expecially when multiple extensions are defined in a single python module. The docs still need updating. I'm waiting to update the docs after implementing #335 and #336 as that will require a major refactor of that section of the docs anyway.
* Refactored extension importing.Waylan Limberg2014-08-271-8/+17
| | | | | | | | | | | | | We now use importlib which means we no longer support Python 2.6. Also, this refactor properly imports third party extensions which reside at the root of PYTHONPATH. Previously, either `markdown.extensions.` or `mdx_` would be appended to any extension name that did not contain a dot, which required third party extensions to either be in submodules or use the old `mdx_` naming convention. This commit is also in preperation for #336. It will now be much easier to deprecate (and later remove) support for the old ways of handling extension names.
* Fixed a bug in markdown.util.parseBoolValueWaylan Limberg2014-08-251-0/+5
| | | | | A couple scenarios with "None" were previously not accounted for. Also updated tests which guives us 100% for markdown/util.py
* Add test of unsafe HTML in stash with safe_mode='excape'Waylan Limberg2014-08-251-0/+20
| | | | This should give us 100% coverage of postprocessors.py.
* Added `--extension_configs` option to the CLI.Waylan Limberg2014-08-221-0/+141
| | | | | | | | | | The `--extension_configs` option must point to a YAML or JSON file. The contents of the file must parse to a Python Dict which will be passed to the `extension_configs` keyword of the `markdown.Markdown` class. Also added tests for all of the CLI option parsing options and updated documentation.
* No assertIs in Python 2.6. Fixes #294Waylan Limberg2014-04-201-1/+1
|
* Add tests for the previous two commitsDmitry Shachnev2013-09-251-0/+13
|
* Allow extensions to register serializersWaylan Limberg2013-08-071-0/+18
| | | | | | | | | Setting output_format must happen after extensions are loaded. Only in that way can an extension register a serializer so that it will then be available to be used with the output_format keyword. A test has been added to avoid this regression from happening again in the future. Fixes #238, partially reverses commit 41cc055 and provides a better fix for
* Serializers now preserve case of tags.Waylan Limberg2013-08-071-0/+32
| | | | | | | It is up to the markdown code (and extension authors to make sure tags are of the correct case (there may be cases were an extension might need to mix cases - which should be preserved). Fixes #237. Thanks for the report @eichin.
* Remove some unused importsDmitry Shachnev2013-03-231-1/+0
|
* Testing framework now runs on Python 2 & 3 unmodified.Waylan Limberg2012-12-141-21/+27
|
* Don't import from doctest, it's no longer usedDmitry Shachnev2012-08-261-1/+0
|
* Fixed #112 and cleaned up error reporting when loading extensions.Waylan Limberg2012-07-121-3/+3
|
* Fixed #85. Odict now handles link errors correctly.Waylan Limberg2012-03-191-0/+8
| | | | Also added a test. Thanks for the report.
* It is spelled 'serializers' not 'searializers'.Waylan Limberg2012-01-201-7/+7
|
* TestCase.assert_ and TestCase.failUnless are depreciated in Python 3 in ↵Waylan Limberg2011-07-281-3/+3
| | | | favor of testCase.assertTrue. Might as well be using the right method in our tests.
* Skip the UnidoceDecodeError API test in Python 3.x as all input should be ↵Waylan Limberg2011-07-281-2/+3
| | | | unicode anyway.
* All API tests now utilize our own searializers.Waylan Limberg2011-07-271-3/+5
|
* Fixed a few failing API tests. ElementTree is only available from ↵Waylan Limberg2011-06-211-5/+5
| | | | markdown.util.etree not markdown.etree. This may be a backward incompatable change for some extensions.
* Added our own xhtml searializer. We no longer use a xml searializer to ↵Waylan Limberg2011-06-161-6/+6
| | | | output xhtml. This fixes #9 among other bugs. The test suite even had bad tests that should have been failing. They also have been corrected.
* Update tests for logging changes. No more message function.Waylan Limberg2011-04-281-21/+6
|
* Fixed Ticket 74. AtomicStrings should now be ackowledged (and preserved) in ↵Waylan Limberg2010-11-041-0/+45
| | | | all instances. This was a real pain to debug, but an easy fix once I found it. Thanks to obs for the report.
* Fixed previous two commits. cElementTree cannot use ElementTree nodes in the ↵Waylan Limberg2010-10-311-2/+6
| | | | tree, but it still uses ElementTree Comment assinged to a node's tag to test for Comment nodes. Also no longer considering Commet nodes to be block level.
* Fixed Ticket 80. Added support for ElementTree Comments to be included by ↵Waylan Limberg2010-10-291-0/+36
| | | | third party extensions when using cElementTree.
* Fixed Ticket 71. Wrapper functions no longer do there own thing with ↵Waylan Limberg2010-08-291-2/+2
| | | | extensions. All behavior is now within the class.