mirror of
https://github.com/vale981/ablog
synced 2025-03-05 09:11:38 -05:00
Merge pull request #39 from rayalan/auto-orphan
Define an auto-orphan option
This commit is contained in:
commit
b1fce2b012
3 changed files with 14 additions and 3 deletions
|
@ -82,6 +82,7 @@ CONFIG = [
|
||||||
('post_date_format_short', '%d %B', True),
|
('post_date_format_short', '%d %B', True),
|
||||||
('post_auto_image', 0, True),
|
('post_auto_image', 0, True),
|
||||||
('post_auto_excerpt', 1, True),
|
('post_auto_excerpt', 1, True),
|
||||||
|
('post_auto_orphan', True, True),
|
||||||
('post_redirect_refresh', 5, True),
|
('post_redirect_refresh', 5, True),
|
||||||
('post_always_section', False, True),
|
('post_always_section', False, True),
|
||||||
|
|
||||||
|
|
|
@ -216,10 +216,14 @@ def process_posts(app, doctree):
|
||||||
if not post_nodes:
|
if not post_nodes:
|
||||||
return
|
return
|
||||||
post_date_format = app.config['post_date_format']
|
post_date_format = app.config['post_date_format']
|
||||||
|
should_auto_orphan = app.config['post_auto_orphan']
|
||||||
docname = env.docname
|
docname = env.docname
|
||||||
|
|
||||||
|
if should_auto_orphan:
|
||||||
# mark the post as 'orphan' so that
|
# mark the post as 'orphan' so that
|
||||||
# "document isn't included in any toctree" warning is not issued
|
# "document isn't included in any toctree" warning is not issued
|
||||||
|
# We do not simply assign to should_auto_orphan because if auto-orphan
|
||||||
|
# is false, we still want to respect the per-post :rst:dir`orphan` setting
|
||||||
app.env.metadata[docname]['orphan'] = True
|
app.env.metadata[docname]['orphan'] = True
|
||||||
|
|
||||||
blog = Blog(app)
|
blog = Blog(app)
|
||||||
|
|
|
@ -124,6 +124,12 @@ blog_authors = {
|
||||||
# is ``False``.
|
# is ``False``.
|
||||||
#post_always_section = False
|
#post_always_section = False
|
||||||
|
|
||||||
|
# When ``False``, the :rst:dir:`orphan` directive is not automatically set
|
||||||
|
# for each post. Without this directive, Sphinx will warn about posts that
|
||||||
|
# are not explicitly referenced via another document. :rst:dir:`orphan` can
|
||||||
|
# be set on a per-post basis as well if this is false. Default is ``True``.
|
||||||
|
#post_auto_orphan = True
|
||||||
|
|
||||||
# -- ABlog Sidebars -------------------------------------------------------
|
# -- ABlog Sidebars -------------------------------------------------------
|
||||||
|
|
||||||
# There are seven sidebars you can include in your HTML output.
|
# There are seven sidebars you can include in your HTML output.
|
||||||
|
|
Loading…
Add table
Reference in a new issue