summaryrefslogtreecommitdiff
path: root/markdown/extensions/headerid.py
Commit message (Collapse)AuthorAgeFilesLines
* 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-13/+9
| | | | | | | | | | 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.
* Change `set.append` -> `set.add` in `headerid.unique`Waylan Limberg2013-02-221-2/+2
| | | | | | | | | Fixes #195. This was getting missed because the HeadrerId extension's reset method was resetting the IDs to a list. However, some third party extensions may want to call the unique function and it should work as documented. Interestingly, the TOC extension was using it and passing in a list as well. All fixed now. Also added a test of the `unique` function directly so we shouldn't repeat this in the future.
* nl2br and attr_list compatability.Waylan Limberg2013-02-061-2/+2
| | | | | | Fixes #177. When using both extensions, breaks (`<br>`) must have a linebreak (`\n`) after them before attr_list is run. This patch reorders the treeprocessors so that happens ('attr_list' runs after 'prettify' not before). Also had to alter headerid extension so it runs after 'prettify' or it would run before 'attr_list' if loaded before 'attr_list' by user.
* Fixed #165. Switched the order of treeprocessors when attr_list and headerid ↵Waylan Limberg2012-12-131-3/+7
| | | | extensions are used togeather. While this means headerid may alter IDs defined in attr_lists for uniqueness, automaticaly generated ids will not contain unparsed attr_lists. This is the lesser of two evils - and actually generates a more valid output (all IDs will be unique)
* Fix all pyflakes unused-import/unused-variable warningsDmitry Shachnev2012-11-091-2/+0
|
* Fixed unicode breakage.Erik van Zijst2012-08-141-1/+1
| | | | | | | | | | | | | | | | slugify() requires unicode, not a str instance. This causes the extension to crash: File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/__init__.py" in markdown 386. return md.convert(text) File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/__init__.py" in convert 287. newRoot = treeprocessor.run(root) File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/extensions/headerid.py" in run 140. id = slugify(''.join(itertext(elem)), sep) File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/extensions/headerid.py" in slugify 93. value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore') TypeError: must be unicode, not str
* Fixed #106. Replaced all references to freewisdom.org (except for Yuri's ↵Waylan Limberg2012-06-281-2/+2
| | | | homepage).
* Fix #99. Account for empty header IDs when ensuring uniqueness.Waylan Limberg2012-05-241-1/+1
|
* Added doctests to fabfile and edited them to pass in all supported versions ↵Waylan Limberg2011-08-021-12/+16
| | | | of python. Note: one test (meta) is still failing on Python 3 due to unicode strings.
* Fix a minor Python 3 incompatability in the headerid extension's slugify ↵Waylan Limberg2011-07-281-1/+1
| | | | function. The url is being encoded (with errors ignored) as an easy means of removing non-ascii chars, but we have to re-encode it *before* running the regex on it, not after.
* Refactored HeaderId extension to no longer include defining ids. It only ↵Waylan Limberg2011-06-301-77/+75
| | | | autogenerates ids. If you want to define your own, use the attr_list extension. Also expanded HeaderId extension to use the same algorithm as the TOC extension (which is better) for slugifying the header text. Added config settings to override the default word separator and the slugify callable. Closes #16 as the reported bug is for a removed feature.
* Added "." to the characters that may be included in implicit heading ids.David Chambers2011-06-051-1/+1
|
* Extension.getConfigs returns a dict and is used by the extensions that use ↵Waylan Limberg2011-05-041-4/+4
| | | | configs. No more self.config['name'][0] weirdness anymore.
* Corrected behavior of headerid extension to match default behavior when ↵Waylan Limberg2011-04-281-1/+4
| | | | "Weve got a problem header". We log a warning - not raise an exception.
* sane logging. remove sys.exit() calls (libraries should never ever call ↵Craig de Stigter2011-04-181-3/+1
| | | | 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)
* Made the HeaderId extension's word separator configurable to allow, forDavid Chambers2011-01-221-2/+3
| | | | example, hyphens to be used rather than underscores.
* Updated regular expression to accept periods in heading ids.David Chambers2011-01-091-1/+1
|
* 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-1/+1
|
* Break cyclic import of markdown. This allows people to embed markdownToshio Kuratomi2010-07-051-2/+3
| | | | if they desire.
* Fix for undefined variables that need to be importedToshio Kuratomi2010-07-051-1/+1
|
* Fixed ticket 25. Added reset to HeaderID extension. Reset now resets the ↵Waylan Limberg2009-03-131-5/+8
| | | | duplicate id counter.
* Updated headerid extension for recent refactors (both BlockParser and package).Waylan Limberg2008-11-201-80/+100
|
* Moved markdown_extensions/ to markdown/extensions. Markdown is now one ↵Waylan Limberg2008-11-201-0/+172
package instead of two.