aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/blockprocessors.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove lazy_ol keyword. Use sane_lists extension instead.Waylan Limberg2018-07-311-1/+3
| | | | This was adapted from 11408e50 of the md3 branch.
* Fix double escaping of amp in attributes (#670)Isaac Muse2018-07-291-2/+2
| | | | | | | | | | 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-0/+20
| | | | Fixes #435.
* All Markdown instances are now 'md'. (#691)Waylan Limberg2018-07-271-4/+4
| | | | | | | | | | | | Previously, instances of the Markdown class were represented as any one of 'md', 'md_instance', or 'markdown'. This inconsistency made it difficult when developing extensions, or just maintaining the existing code. Now, all instances are consistently represented as 'md'. The old attributes on class instances still exist, but raise a DeprecationWarning when accessed. Also on classes where the instance was optional, the attribute always exists now and is simply None if no instance was provided (previously the attribute wouldn't exist).
* Replace homegrown OrderedDict with purpose-built Registry. (#688)Waylan Limberg2018-07-271-10/+10
| | | | | | | | | | | | | | | | | | | 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.
* Fix typo.Amal Murali2018-05-071-1/+1
|
* Correct spelling mistakes.Edward Betts2018-01-131-1/+1
|
* fix DeprecationWarning: invalid escape sequenced9pouces2017-07-251-1/+1
|
* Fix hr recursion issue (#535)Isaac Muse2017-01-231-2/+3
| | | | | | | HRProcessor tried to access a member variable after recursively calling itself. In certain situations HRProcessor will try to access its member variable containing its match, but it will not be the same match that call in the stack expected. This is easily fixed by storing the match locally *before* doing any recursive work.
* Updated BlockProcessor to new-style class. Changed subclasses to use super().Kar Epker2015-06-011-4/+4
|
* Changed formatting of regex strings. Fixed flake8 issues.Kar Epker2015-06-011-13/+6
|
* Changed line continuations to satisfy pylint.Kar Epker2015-06-011-10/+13
|
* Fixed parser ignoring value of tab_length.Kar Epker2015-06-011-7/+20
|
* No binary operators at begining of line.Waylan Limberg2015-02-181-4/+4
| | | | | | | Apparently this is a new requirement of flake8. That's the thing about using tox. Every test run reinstalls all dependencies so an updated dependency might instroduce new errors. I could specify a specific version, but I like staying current.
* Use newer ElementTree API to avoid future breakage.Waylan Limberg2015-01-311-1/+1
|
* Flake8 cleanup (mostly whitespace).Waylan Limberg2014-11-201-60/+65
| | | | | | Got all but a couple files in the tests (ran out of time today). Apparently I have been using some bad form for years (although a few things seemed to look better before the update). Anyway, conformant now.
* Mark a few more lines with 'no cover' - missed them the first time through. ↵Waylan Limberg2014-07-111-1/+1
| | | | The rest should have test cases added.
* Marked a bunch of lines as 'no cover'. Coverage at 91%Waylan Limberg2014-07-111-2/+2
|
* Address various depreciated APIs in PythonWaylan Limberg2014-01-081-5/+5
| | | | | This mostly revolves around old APIs for ElementTree, but includes a few others as well. Fixes #254. Thanks for the report.
* Use lead blockprocessor comment as docstringAdam Dinwoodie2013-03-181-10/+12
| | | | | | The lead comment in blockprocessors.py should really be a docstring for consistency with other files. Fix this with the other part of @Arfrever's patch for issue #203.
* Future imports go after the docstringsAdam Dinwoodie2013-03-181-1/+1
| | | | | | | | | A `from __future__ import ...` statement must go after any docstrings; since putting them before the docstring means the docstring loses its magic and just becomes a string literal. That then causes a syntax error if there are further future statements after the false docstring. This fixes issue #203, using the patch provided by @Arfrever.
* Now using universal code for Python 2 & 3.Waylan Limberg2013-02-271-16/+16
| | | | | | | | | | The most notable changes are the use of unicode_literals and absolute_imports. Actually, absolute_imports was the biggest deal as it gives us relative imports. For the first time extensions import markdown relative to themselves. This allows other packages to embed the markdown lib in a subdir of their project and still be able to use our extensions.
* Preserve all blank lines in code blocks.Waylan Limberg2013-02-141-13/+13
| | | | | | | | | | | | Fixes #183. Finally got this working properly. The key was using a regex substitution with non-overlapping matches that removed all whitespace from the begining of *all* blank lines when normalizing whitespace. Once I got that, I could simplfy the EmptyBlockProcessor and easily output one or two blank lines appropriately. A blank block gets two new lines (`'\n\n'`), while a block which starts with a newline gets one.
* Cleaned up fixes for #183Waylan Limberg2013-02-081-1/+1
| | | | | | | | | My previous commit (d5a94c2) broke a few things badly. Unfortunately I failed to run the complete test suite and didn't catch it. A bad regex was crashing the test suite. Also cleaned up a few other odds and ends from previous work on #183. Still loosing a few random empty lines in code blocks though. I suspect this may also fix #188.
* Preserve empty lines in code blocksWaylan Limberg2013-02-061-6/+7
| | | | | | Partial fix for #183. Some lines are still being lost. When the processors are run, one line is lost. When their calling code is comments out (completely skiped) a line is still lost if more than 3 exist in a row. Also need to add some tests for this.
* Fix all pyflakes unused-import/unused-variable warningsDmitry Shachnev2012-11-091-1/+1
|
* Provide more control to list processors subclasses.Waylan Limberg2012-01-241-1/+3
| | | | | This will make it easier for extensions to subclass the list block processors and alter their behavior. Such as the request in issue #64.
* Fixed #47. Improved HRProccessor.\n\nPython's re module does not support ↵Waylan Limberg2011-11-171-18/+19
| | | | atomic grouping, which was slowing the HR regex down if a long HR ended with a non HR char (casing the regex to backtrack). Therefore, we have to simulate atomic grouping. Fortunately, we only need to match end-of-line or end-of-string after the atomic group here, so it was an easy case to simulate. Just remove the '$' from the end of the regex and manualy check using m.end(). The run method was refactored while I was at it, saving us from running the regex twice for each HR.
* Fixed #22. Horizontal rules now work in a few more crazy edge cases. Who ↵Waylan Limberg2011-06-161-1/+1
| | | | actualy useses these? Anyway, we now match markdown.pl.
* Fixed #21. A header and paragraph not seperated by a blank line inside a ↵Waylan Limberg2011-06-151-4/+27
| | | | list item are now parsed correctly. One of those crazy wierd edge cases that no one would ever test for, but is obvious once you see it.
* Fixed #15. Setext Headers now work with any number of - or = characters.Waylan Limberg2011-06-011-1/+1
|
* Made lazy ordered lists a settable option. The previous behavior (on) is the ↵Waylan Limberg2011-04-291-1/+1
| | | | default.
* Merge commit 'refs/merge-requests/13' of ↵Waylan Limberg2011-04-281-1/+16
|\ | | | | | | git://gitorious.org/python-markdown/mainline into merge-requests/13
| * fixed startindex reset in multiple ulRohan Jain2011-04-051-6/+4
| | | | | | | | | | Now the startindex would be reset if continual unordered lists are present (tests are passed).
| * add new list item commentRohan Jain2011-04-031-0/+1
| |
| * custom index support for ol tagRohan Jain2011-04-031-1/+17
| | | | | | | | | | | | | | A ol tag with custom start index can be defined by using a different integer as the first item numbering. Search for `3. Bird` on: http://daringfireball.net/projects/markdown/syntax
* | fix import loop when importing loggerCraig de Stigter2011-04-181-1/+3
| |
* | sane logging. remove sys.exit() calls (libraries should never ever call ↵Craig de Stigter2011-04-181-3/+2
|/ | | | sys.exit()) and raise appropriate exceptions instead. backwards incompatible insofar as custom extensions may need tweaks if they're using old markdown logging (but they shouldn't, it was gross)
* A better implementation of globals as attributes on the Markdown class. This ↵Waylan Limberg2010-07-071-11/+11
| | | | should be more future proof.
* Factored out the building of the various processors and patterns into ↵Waylan Limberg2010-07-071-0/+18
| | | | utility functions called by a build_parser method on the Markdown class. Editing of the processors and patterns now all happen in one file for each type. Additionaly, a subclass of Markdown could potentially override the build_parser method and build a parser for a completely differant markup language without first building the default and then overriding it.
* Moved a bunch of global variables to the instance of the Markdown class.Waylan Limberg2010-07-061-11/+15
|
* Clean up previous commit a little. renamed misc_logging to md_logging and ↵Waylan Limberg2010-07-061-1/+2
| | | | fixed imports. We import logging levels from logging directly and only import message from md_logging.
* Rename misc.py to util.py at the request of upstreamToshio Kuratomi2010-07-051-27/+27
|
* Break cyclic import of markdown. This allows people to embed markdownToshio Kuratomi2010-07-051-29/+29
| | | | if they desire.
* Fix for undefined variables that need to be importedToshio Kuratomi2010-07-051-0/+1
|
* Blockquoted text in the first item of a list is now placed in child p tag of theGerry LaMontagne2010-03-231-25/+3
| | | | blockquote tag. Added lists8.txt and .html for test suite to test condition.
* Fixed ticket 58. The first item of a looselist gets placed in p tags whenGerry LaMontagne2010-03-221-3/+35
| | | | | | it has a sublist. Previously, the test suite erroneously passed this condition because there was an error in the expected '.html' output file. The expected output has been corrected as well.
* Fixed Ticket 57. Lists where the first line of an item is a nested item, now ↵Waylan Limberg2010-03-191-2/+17
| | | | observe rules for using p tags. Thanks to Gerry LaMontagne for the patch.
* Fixed Ticket 53. Nested lists no longer isorder items in certain edge cases. ↵Waylan Limberg2010-03-151-1/+5
| | | | Thanks for the report and preliminary work Gerry LaMontagne.
* Fixed ticket 35. Lists now work when padded with five or more spaces after ↵Waylan Limberg2009-06-171-4/+4
| | | | asterisk. Adjusted regex to eat all (one or more) of the spaces. While it may seem wrong (at least in the loose list case), this is how all other implementations work. And it solves a number of edge cases otherwise not accounted for in the list parser.