-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add version warning extension (#1523)
- Loading branch information
Showing
29 changed files
with
117 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,3 +200,4 @@ FakesAssemblies/ | |
project.lock.json | ||
**/sample/**/wwwroot/lib/ | ||
**/samples/**/wwwroot/lib/ | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc2 | ||
|
||
Bundling and Minification | ||
========================= | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Add the ability to specify the version for a specific page. | ||
This allows you to put metadata at the top of your document:: | ||
:version: 2.3 | ||
This version should be the version of the project that this page or API targets. | ||
If you configure ``versionwarning_node`` to True (default), | ||
then it will generate an in-page warning for out of date versions. | ||
If you configure ``versionwarning_console`` to True (default), | ||
then it will output a warning on the console. | ||
""" | ||
|
||
|
||
from collections import defaultdict | ||
|
||
from sphinx.util.console import red, bold | ||
from docutils import nodes | ||
|
||
|
||
def process_meta(app, doctree, fromdocname): | ||
env = app.builder.env | ||
env.page_to_version = defaultdict(set) | ||
env.version_to_page = defaultdict(set) | ||
|
||
# index metadata | ||
for pagename, metadata in iter(env.metadata.items()): | ||
if 'version' in metadata: | ||
version = metadata['version'] | ||
env.page_to_version[pagename] = version | ||
env.version_to_page[version].add(pagename) | ||
|
||
if fromdocname == pagename: | ||
|
||
# Alert on outdated version | ||
current_version = env.config['version'] | ||
if version != current_version: | ||
text = 'This page documents version {old} and has not yet been updated for version {new}'.format( | ||
old=version, | ||
new=current_version, | ||
) | ||
|
||
if app.config['versionwarning_node']: | ||
prose = nodes.paragraph(text, text) | ||
warning = nodes.warning(prose, prose) | ||
doctree.insert(0, warning) | ||
if app.config['versionwarning_console']: | ||
app.warn(bold('[Version Warning: %s] ' % pagename) + red(text)) | ||
|
||
|
||
def setup(app): | ||
app.connect('doctree-resolved', process_meta) | ||
app.add_config_value('versionwarning_node', True, 'html') | ||
app.add_config_value('versionwarning_console', True, 'html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
Managing Application State | ||
========================== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc2 | ||
|
||
.. _fundamentals-dependency-injection: | ||
|
||
Dependency Injection | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
Working with Multiple Environments | ||
================================== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
Error Handling | ||
============== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
OWIN | ||
==== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc2 | ||
|
||
Routing | ||
======= | ||
By `Steve Smith`_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
Servers | ||
======= | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
Migrating HTTP Modules to Middleware | ||
==================================== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
Migrating from ASP.NET Web API | ||
============================== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
.. _dependency-injection-controllers: | ||
|
||
Dependency Injection and Controllers | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
Testing Controller Logic | ||
======================== | ||
By `Steve Smith`_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc2 | ||
|
||
Partial Views | ||
============= | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
View Components | ||
================ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
Working with Forms | ||
==================== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
Working with a Distributed Cache | ||
================================ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc2 | ||
|
||
In Memory Caching | ||
================= | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
Response Caching | ||
================ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-beta8 | ||
|
||
.. _security-authentication-2fa: | ||
|
||
Two-factor authentication with SMS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc1 | ||
|
||
Integration Testing | ||
=================== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
:version: 1.0.0-rc2 | ||
|
||
Unit Testing | ||
============ | ||
|
||
|