1
0
Fork 0
forked from github/pelican
Commit graph

203 commits

Author SHA1 Message Date
tehkonst
ab035795bc fix slug for feed urls
Conflicts:

	pelican/contents.py
2013-03-10 23:41:02 -07:00
W. Trevor King
33c60a78cd pelican/utils: Add split_all() and rework static URL generation
I think the conversion from native paths to URLs is best put off until
we are actually trying to generate the URL.  The old handling
(introduced in 2692586, Fixes #645 - Making cross-content linking
windows compatible, 2012-12-19) converted the path at StaticContent
initialization, which left you with a bogus StaticContent.src.

Once we drop the 'static' subdirectory, we will be able to drop the
`dest` and `url` parts from the StaticGenerator.generate_context()
handling, which will leave things looking a good deal cleaner than
they do now.
2013-03-10 23:21:38 -07:00
W. Trevor King
49bf80ec39 contents: Convert StaticContent to Static, a Page subclass
Static needs a lot of the same handling as other pages, so make it a
subclass of Page.  The rename from StaticContent to Static makes for
cleaner configuration settings (STATIC_URL instead of
STATICCONTENT_URL).

All currently generated Static instances override the save_as
attribute explicitly on initialization, but it isn't hard to imagine
wanting to adjust STATIC file output based on metadata (e.g. extracted
from their source filename).  With this union, the framework for
manipulating URLs and filenames is shared between all source file
types.
2013-03-10 23:19:56 -07:00
Alexis Métaireau
964f7d96d6 endswith can take a list as an argument ;) 2013-03-06 11:46:17 -08:00
W. Trevor King
3f26f9af5b generators: Teach Generator.get_files to handle non-directory input
This makes it easier for StaticGenerator to walk FILES_TO_COPY, where
the input may be a directory or a bare filename.

Non-traversable file types (e.g. everything but directories and
symlinks to directories) are not checked against the exclude list.
The user-level effect of this is that explicit entries in STATIC_PATHS
or FILES_TO_COPY will override a hypothetical STATIC_EXCLUDES setting,
which seems like a reasonable approach.

I also removed the Python 2.5 compatibility check for `followlinks` in
os.walk, since Pelican is now Python >=2.7.
2013-03-06 08:38:45 -05:00
Irfan Ahmad
2692586abe Fixes #645 - Making cross-content linking windows compatible 2013-03-06 00:04:44 -08:00
nfletton
4a63695ae2 Fixed pagination link error when <DIRECT_TEMPLATE_NAME>_SAVE_AS setting used.
The unit test for this scenario was passing as it was testing for an incorrect 'page_name' variable being set.
2013-03-03 22:11:09 -08:00
Alexis Métaireau
3e364bb8a4 Don't overwrite output_path. Fix #750 2013-03-03 21:00:52 -08:00
Alexis Métaireau
519dcdbcb3 Manual pass on sources for better standards. 2013-03-03 20:12:31 -08:00
Chris Streeter
de44644700 Add a pages_generator_finalized signal.
I wrote a plugin that I'd like to also be able to run on pages in
addition to articles. Adding this signal will let me update the content
when a page is finished being generated.
2013-02-10 12:42:54 -08:00
Bruno Binet
d9855ae346 Merge pull request #662 from wking/rich-urlwrapper-comparisons
contents: Add rich comparisons to URLWrapper for easy sorting
2013-01-21 13:30:02 -08:00
W. Trevor King
004adfa5cc content: Convert Path.filename to .source_path
Making everything consistent is a bit awkward, since this is a
commonly used attribute, but I've done my best.

Reasons for not consolidating on `filename`:

* It is often used for the "basename" (last component in the path).
  Using `source_path` makes it clear that this attribute can contain
  multiple components.

Reasons for not consolidating on `filepath`:

* It is barely used in the Pelican source, and therefore easy to
  change.
* `path` is more Pythonic.  The only place `filepath` ever show up in
  the documentation for `os`, `os.path`, and `shutil` is in the
  `os.path.relpath` documentation [1].

Reasons for not consolidating on `path`:

* The Page elements have both a source (this attribute) and a
  destination (.save_as).  To avoid confusion for developers not aware
  of this, make it painfully obvious that this attribute is for the
  source.  Explicit is better than implicit ;).

Where I was touching the line, I also updated the string formatting in
StaticGenerator.generate_output to use the forward compatible
'{}'.format() syntax.

[1]: http://docs.python.org/2/library/os.path.html#os.path.relpath
2013-01-18 07:57:35 -05:00
W. Trevor King
61f05672e6 content: Convert StaticContent.filepath to .filename
For reasons that are unclear to me, StaticContent introduces the
`filepath` attribute rather than using the existing (and semantically
equivalent) Page.filename.  This has caused confusion before [1], and
it's probably a good idea to merge the two.

While I was touching the line, I also updated the string formatting in
StaticGenerator.generate_output to use the forward compatible
'{}'.format() syntax.

[1]: https://github.com/getpelican/pelican/issues/162#issuecomment-3000363
2013-01-18 07:40:42 -05:00
W. Trevor King
2c434ebac1 contents: Add rich comparisons to URLWrapper for easy sorting
There have been earlier attempts to sort categories and authors
[1,2,3], but they either sorted based on the object id [3], or only
sorted the main author and categories list.

This patch uses rich comparisons (keyed off URLWrapper.name, but
easily adjustable in subclasses) to make the objects sortable without
specifying a key for each sort.  For example, now

  {% for tag, articles in tags|sort %}

works as expected in a Jinja template.

The functools.total_ordering decorator fills in the missing rich
comparisons [4,5].

[1]: 877d454c8f
[2]: 7f36e0ed20
[3]: d0ec18f4db
[4]: http://docs.python.org/2/library/functools.html#functools.total_ordering
[5]: http://docs.python.org/3/library/functools.html#functools.total_ordering
2013-01-15 22:51:53 -05:00
Alexis Métaireau
149ca493e0 Annotate py3k code when needed. 2013-01-11 18:55:04 +01:00
Dirk Makowski
71995d5e1b Port pelican to python 3.
Stays compatible with 2.x series, thanks to an unified codebase.
2013-01-11 03:20:09 +01:00
Bruno Binet
a0504aeabe add support for relative cross-site links 2012-12-01 21:32:02 +01:00
Bruno Binet
c74abe579b Don't rewrite URLs
Remove the code that was appending ../static in front of some URLs, and add a
way to do cross-content linking.
2012-12-01 21:30:50 +01:00
Bruno Binet
fa82e19c1f change default value for DEFAULT_DATE to None
(was 'fs' => guess from file mtime)
2012-11-28 00:29:51 +01:00
Bruno Binet
801bc755b5 Merge branch 'pr/558'
Conflicts:
	docs/settings.rst
	pelican/signals.py
2012-11-23 15:32:17 +01:00
Alexis Métaireau
587184c778 trim the blocks when generating templates. 2012-11-21 16:38:27 +01:00
Simon
09c893f3a3 Add a new signal generator_init, invoked at the end of Generator.__init__. 2012-11-20 23:42:31 +01:00
Erik Hetzner
6d745f32c0 add preread signal 2012-11-14 22:12:46 -08:00
Bruno Binet
c787e02dcc Merge branch 'pr/555'
Conflicts:
	pelican/contents.py
2012-11-13 01:23:31 +01:00
jawher
1b81f8b830 Move SITEURL check for feed generation from generators.py to settings.py 2012-11-12 23:01:17 +01:00
jawher
93905e828d Split long if condition in 2 lines 2012-11-12 23:01:17 +01:00
jawher
c7d87feec3 Reverted FEED_ATOM and FEED_RSS to their original behaviour and added FEED_ALL_ATOM and FEED_ALL_RSS
FEED_(ATOM|RSS) generated feeds include the version in the default language of a translated article,
whereas FEED_ALL(ATOM|RSS) would include *really* all posts, regardless of their language.
2012-11-12 23:01:16 +01:00
jawher
593acfc37a Remove comment 2012-11-12 23:01:16 +01:00
jawher
721a422e5e The all Atom and RSS feed generators should include all articles, regardless of the article's language or the site's. Fixes #550. 2012-11-12 23:01:16 +01:00
Simon
4cfb0cd24e Move Webassets in a plugin 2012-11-07 00:17:50 +01:00
Simon
d0f5875f66 remove the LessCSSGenerator and the related config option 2012-11-05 21:51:27 +01:00
Alexis Métaireau
bfc963a065 We pass lists, not dicst! 2012-10-30 18:57:06 +01:00
Bruno Binet
54eee3f28a update TemplatePagesGenerator:
* bugfix: now supports custom path for path where to find the content files
* TEMPLATE_PAGES settings is now of the form:
    { 'jinja2/src/file.html': 'dest/file.html' }
* update doc
2012-10-30 09:56:10 +01:00
Bruno Binet
e0e1b3eecf rename STATIC_PAGES to TEMPLATE_PAGES 2012-10-30 09:56:10 +01:00
Tarek Ziade
7127676f71 added a static pages generator
Conflicts:
	pelican/__init__.py
	pelican/generators.py
	pelican/settings.py
2012-10-30 09:56:08 +01:00
Martin Brochhaus
47c972e21a Added USE_FOLDER_AS_CATEGORY setting.
This allows users to organize their files in ways where the subfolder name
would not make a good category name (i.e. /2012/09/). Set this to ``False``
and the subfolder will no longer be used as a standard category,
`DEFAULT_CATEGORY` will be used instead.
2012-10-28 20:43:45 +01:00
Brendan Wholihan
f7a2f8ea47 Removed AUTHOR defaulting to OS User /John Doe, so both a blank or undefined (None) author is possible.
Reverted templates back to checking author object, since a None object is possible. Name could be checked for blank if required
ATOM spec states an author element should be provided, so passes a blank name if not specified
Updated unit test
2012-10-26 18:20:05 +01:00
Alexis Métaireau
93c04cd79f merge with master 2012-10-25 13:20:27 +02:00
Bruno Binet
0856b72c3c cosmetics
lines should be < 80 chars
2012-10-22 23:05:18 +02:00
jawher
a11726783e TRANSLATION_FEED is now split into TRANSLATION_FEED_ATOM and TRANSLATION_FEED_RSS to match the other feed configuration keys
Incidentally, Pelican can now generate RSS translation feeds.
2012-10-22 22:52:06 +02:00
Brendan Wholihan
94877e033b So that Authors display and output can be disabled for single user sites, allow the AUTHOR setting to be set to an empty string ''.
An author is needed, but was defaults to OS user, or 'John Doe'. If a blank author is provided, it generated authors/.html file, and templates display just "by "
Updated generators.py and templates to ignore Authors objects which have a blank name
2012-10-18 19:55:00 +01:00
FELD Boris
22f3c40385 Add a new signal article_generator_finalized, called at the end of ArticleGenerator.generate_context 2012-10-13 19:17:16 +02:00
Alexis Métaireau
17dc36aad6 merge upstream 2012-10-12 23:22:55 +02:00
epatters
ac67587b79 BUG: Typogrify not applied to pages. 2012-10-12 23:01:50 +02:00
Wladislaw Merezhko
3a6196ccd1 Add two new parameters for creating pdf
* PDF_STYLE - name of custom style to use when generating pdf
* PDF_STYLE_PATH - path where custom style is located
2012-10-12 23:01:50 +02:00
Dirk Makowski
5e45aaab78 Patch to allow relative ASSET_URL
Previously, webassets' ASSET_URL always was absolute.
This patch allows a relative ASSET_URL, depending on Pelican's
RELATIVE_URLS setting.

Hint for templates:
-------------------
Current version of webassets seem to remove any relative
paths at the beginning of the URL. So, if RELATIVE_URLS
is on, ASSET_URL will start with 'theme/', regardless if we
set assets_url here to './theme/' or to 'theme/'.
XXX However, this breaks the ASSET_URL if user navigates to
a sub-URL, e.g. if he clicks on a category. To workaround this
issue, I use
    <link rel="stylesheet" href="{{ SITEURL }}/{{ ASSET_URL }}">
instead of
    <link rel="stylesheet" href="{{ ASSET_URL }}">

Maybe this hint is worth to be included in the documentation.
I have it also written as comments in the source.
2012-10-12 23:01:50 +02:00
Wladislaw Merezhko
b9c0f07f57 Fixing pdf generation issue 2012-10-12 23:01:49 +02:00
Alexis Metaireau
48625964f1 Merge pull request #510 from nrocco/sourcegen
New source file .text generator
2012-10-12 13:57:18 -07:00
Nico Di Rocco
a7dd21ffaf Added a new setting OUTPUT_SOURCES_EXTENSION
Using this configurable setting users can control what extension will be
appended to filenames by the SourcesGenerator.

The default is to use the ``.text`` extension.
2012-09-28 14:59:05 +02:00
Alexis Metaireau
32429d3091 Merge pull request #488 from dmdm/relative_urls_for_webassets
Patch to allow relative ASSET_URL
2012-09-25 15:03:00 -07:00