1
0
Fork 0
forked from github/pelican
Commit graph

53 commits

Author SHA1 Message Date
derwinlu
623eb0a4c0 Fix more python 3.6 regex DeprecationWarning's 2017-03-29 10:19:47 +02:00
Tim Wienk
4917b8618a Fix setting None metadata from FILENAME_METADATA matches.
This is relevant when using optional items in the expression. E.g. if an
optional captured group is not matched, the result of
`match.groupdict()` contains the captured group with value `None`.
2017-03-15 17:07:31 +01:00
John
6f9f0def0f Fix #1325 and add test_find_empty_alt 2016-11-17 23:29:19 +00:00
Bernhard Scheirle
27d67f04cb Update unittest to match the new Markdown output format 2016-11-02 21:19:41 +01:00
Bernhard Scheirle
9e399e7a05 Updates test cases to use MARKDOWN 2016-11-02 21:11:42 +01:00
Will Thompson
85a860d5dd test_readers: test reading empty Markdown files 2016-08-16 07:13:41 +01:00
Robert Utter
3f2d89c9d6 Makes DEFAULT_DATE accept string dates; fixes #1464 2016-05-24 17:22:27 +03:00
Justin Mayer
14694c8357 Make Flake8 happy
Note to self: pre-commit hooks really are helpful
2016-02-19 13:29:41 -08:00
Justin Mayer
123fd0b65a Fix Typogrify test issue caused by Pygments update 2016-02-19 13:21:26 -08:00
Kernc
510961bbb9 Avoid Markdown 2.6 deprecations; make MD_EXTENSIONS a dict
* Make MD_EXTENSIONS setting a dict and add tests for this change;
* Short extension names ('extra', 'meta') are deprecated
  https://pythonhosted.org/Markdown/release-2.6.html#shortened-extension-names-deprecated
* Extension config as part of extension name is deprecated
  https://pythonhosted.org/Markdown/release-2.6.html#extension-configuration-as-part-of-extension-name-deprecated
2015-11-30 18:12:28 +01:00
Justin Mayer
880ba20a98 Merge pull request #1850 from ingwinlu/deprecation_warnings
Make Pelican Python 3.5 compatible
2015-11-03 07:22:12 -08:00
derwinlu
2d84c04add Make ReaderTest py2 and py3 compatible 2015-10-22 09:45:17 +02:00
Simon StJG
d333ed12c6 Fix quote escaping in read html attributes.
* Wrap HTML attributes in quotes according to their content.  If it contains a double quote use single quotes, otherwise escape with double quotes.
* Add escape_html utility to ensure quote entities are converted identically across Python versions.

Fixes #1260
2015-10-14 21:03:01 +01:00
Jesús Fernández
7f795ed558 Remove duplicate tags and authors in metadata 2015-08-26 12:07:38 +02:00
derwinlu
8993c55e6e fulfil pep8 standard 2015-08-17 13:34:32 +02:00
derwinlu
5389543a39 improve URLWrapper comparison
* speed up via reduced slugify calls (only call when needed)
* fix __repr__ to not contain str, should call repr on name
* add test_urlwrappers and move URLWrappers tests there
  * add new equality test
* cleanup header

additionally:
* Content is now decorated with python_2_unicode_compatible
  instead of treating __str__ differently
* better formatting for test_article_metadata_key_lowercase
  to actually output the conflict instead of a non descriptive
  error
2015-06-27 19:13:50 +02:00
Zack Weinberg
c918380802 Support semicolon-separated author/tag lists.
Idea borrowed from Docutils.  This allows one to write author lists in
lastname,firstname format.  The code change also means that readers with
fancy metadata that can natively represent lists (e.g. Docutils itself,
or MD-Yaml) don't have to merge 'em back together for process_metadata's
sake.
2015-06-04 17:31:20 -04:00
winlu
2e590d0e86 maintain test_readers
* move all metadata tests to use a single function call (assertDictHasSubset)
* add tests for assertDictHasSubset
* correct some tests that iterated over metadata instead of expected metadata, resulting in metadata that was expected to be there but was not
* correct resulting broken tests
* add additional tests for EXTRA_PATH_METADATA
* make MdReaderTest fail if Markdown is not available instead of skipping each method individually
2015-04-07 12:06:18 +02:00
John Mastro
0949fa62ec Tell smartypants to also process " entities
This is necessary because Docutils has already replaced double quotes
with " HTML entities by the time the typogrify filter is applied.
2015-02-12 16:27:30 -08:00
Barry Steyn
a0ecab901f Allows Typogrify to ignore user specified tags. Refs #1407
Typogrify interferes with certain sections of the output that it should not touch (see #1407 for more details).
This feature adds a setting called TYPOGRIFY_IGNORE_LIST which is a list of tag for Typogrify to ignore.

The following was updated:

 1. readers.py - if TYPOGRIFY_IGNORE_TAGS is present, then use it
 2. settings.ps - default TYPOGRIFY_IGNORE_TAGS to []
 3. contents/article_with_code_block.rst - an article with a code block for typogrify to ignore
 4. updated tests
 5. updated documentation
2014-07-28 15:17:12 -07:00
Daan Debie
00434d4bb6 Reader name now accessible for articles and pages 2014-07-15 00:29:52 +02:00
Ondrej Grover
3f6b130d6e Fix #1198, enable custom locale in template rendering, fixes links
reverts getpelican/pelican@ddcccfeaa9

If one used a locale that made use of unicode characters (like fr_FR.UTF-8)
the files on disk would be in correct locale while links would be to C.

Uses a SafeDatetime class that works with unicode format strigns
by using custom strftime to prevent ascii decoding errors with Python2.

Also added unicode decoding for the calendar module to fix period
archives.
2014-06-26 00:00:19 -04:00
Deniz Turgut
bf9316bb7e Remove AsciiDocReader from core. Fixes #1355 2014-06-14 02:17:43 -04:00
Ondrej Grover
b8db970455 Fix RstReader authors metadata processing
The reader would return a list of authors already, but
METADATA_PROCESSORS['authors'] expects a string.
Added a test case for this (only the HTMLReader had it).
2014-05-25 09:12:35 +02:00
James Lee
22484983e9 Handle list metadata as list of string in MarkdownReader 2014-04-19 03:45:48 +09:00
Justin Mayer
8ec958fb35 Merge pull request #1293 from jeanlauliac/typogrify-summary
Apply Typogrify to article summary
2014-03-30 12:08:05 -07:00
Jean Lauliac
91d576eb45 Apply typogrify on article summary as well 2014-03-24 14:59:03 -04:00
Ben Bridts
05d357e98e Split multiple authors on ',' 2014-02-18 17:56:57 +01:00
Anatoly Bubenkov
2c25e488c4 multiple authors implemented 2014-02-14 03:21:06 +01:00
Florian Jacob
4b2fcb09a4 Added a new ''modified:' metadata tag to be able to specify the
publication time and date and the last modified time and date
independently.

This makes it possible to access the last updated date with {{ article.locale_modified }} in templates.
Additionally, an already delivered feed entry can be corrected by changing the modified date and time, as it is used for atom:update
/ rss pubDate field now.
2013-11-10 00:14:55 +01:00
Mark Lee
35375b19ff Log a warning when the HTML reader encounters a nonconformant meta tag
Instead of throwing an exception and skipping the HTML file, log a
warning with a message which makes it more obvious as to what happened.
2013-11-08 14:37:07 -08:00
Simon Conseil
a49b744e95 Fix tests with latest versions of smartypants.
smartypants is now py3 compatible but the default settings for double quotes has
been changed (http://pythonhosted.org/smartypants/changes.html).

This commit:
- update the typogrify test (change quotes, and add more test casesi: caps word,
  ellipsis)
- install typogrify on travis
- uses upstream version of smartypants in tox instead of dmdm's fork for py3
2013-09-26 22:47:55 +02:00
Alexis Métaireau
aae56fee39 exception.message was removed in py 3.X 2013-08-17 01:12:39 +02:00
Alexis Métaireau
73b37989f7 update the readers tests 2013-08-17 01:02:07 +02:00
Alexis Metaireau
2be674c909 Merge pull request #903 from dominiqueplante/readers.read_file-throwsexception
Add unit test for the case for handing unhandled extension
2013-08-16 15:34:49 -07:00
Simon Conseil
4bc4b1500c Refactor readers and remove MARKUP
Add a `Readers` class which contains a dict of file extensions / `Reader`
instances. This dict can be overwritten with a `READERS` settings, for instance
to avoid processing *.html files:

    READERS = {'html': None}

Or to add a custom reader for the `foo` extension:

    READERS = {'foo': FooReader}

This dict is no storing the Reader classes as it was done before with
`EXTENSIONS`. It stores the instances of the Reader classes to avoid instancing
for each file reading.
2013-08-06 23:42:41 +02:00
Kyle Machulis
39dd4a0255 Changed meta tag "contents" attribute to "content", to conform to HTML spec. Fixes #918 2013-06-16 10:56:50 -07:00
W. Trevor King
06121eda76 test_readers: Update to new readers.read_file 2013-06-12 15:02:31 -04:00
W. Trevor King
8ff34e6c5d Replace settings.get(key) with settings[key] for default settings
If a setting exists in DEFAULT_CONFIG, assume it will be there
(instead of checking and/or providing a local default).  The earlier
code was split between the two idioms, which was confusing.
2013-06-02 14:24:27 -04:00
W. Trevor King
c8e7d95b34 tests.support: Use kwargs overrides in get_settings()
This avoids harcoding test-specific overrides, and makes it easy to
setup a settings dictionary based on DEFAULT_CONFIG for testing.
Because you can trust Pelican to use settings based on DEFAULT_CONFIG,
you are free to go about using:

  settings[my_key]

instead of:

  settings.get(my_key, some_fallback)

or:

  if my_key in settings:
      ...

if you know that `my_key` is in DEFAULT_CONFIG.
2013-06-02 14:24:27 -04:00
W. Trevor King
c6de4430a0 tests/test_readers.py: Remove redundant 'expected' check in AdReaderTest
AdReaderTest.test_article_with_asc_extension() has had duplicate
checks on the expected metadata since it was created by 49f481e3 (Add
asciidoc reader support, 2013-10-28).  This commit removes the
duplicate entry.
2013-06-02 09:58:27 -07:00
Dominique Plante
7a3bc410d0 Add test for the case where we try to read a file with an unhandled extension 2013-05-23 21:53:46 -07:00
Justin Mayer
71150430a9 Merge pull request #885 from avaris/markdown-summary-footnote
Markdown summary should not include content footnote
2013-05-13 15:36:39 -07:00
Deniz Turgut
75f214103e Markdown summary should not include content footnote
Markdown instance carries state for subsequent uses. Content
and summary parsing is done with the same instance. Since
footnotes are processed with an extension and stored as state,
content footnote is duplicated for summary.

This PR adds a ``.reset()`` call before summary parsing to clear
the state. It also adds a test case with footnotes.
2013-05-10 03:50:33 -04:00
Simon Conseil
5ffadd2283 Add DOCUTILS_SETTINGS to allow to customize the docutils Publisher. 2013-04-23 12:28:30 +02:00
Emily Strickland
08f27e0134 Accept mdown file extension for Markdown files.
This extension is sometimes used for Markdown files and is the default
for a few editors, such as Sublime Text.
2013-04-17 21:14:52 -07:00
Deniz Turgut
bc4bd773a0 remove unittest2 and fix various warnings in py3 2013-04-13 16:36:05 -04:00
Deniz Turgut
0548b62441 fix for issue #761: handle unicode correctly in summary for Markdown 2013-04-03 19:38:42 -04:00
Colin Dunklau
edbac49f2b Nitpicking - tempdir naming, also backslashes are bad
Tempdirs should have useful prefixes to aid in collecting information
    about failed tests.
Implicit concatenation is better than backslash line continuation.
2013-03-26 11:51:33 -05:00
Alexis Métaireau
5aeca4826c Use comments in tests, not docstrings. 2013-03-10 22:42:46 -07:00