This repository has been archived by the owner on Sep 6, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,713 additions
and
490 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 |
---|---|---|
|
@@ -31,3 +31,5 @@ env: | |
- TOXENV=py35-django19 | ||
- TOXENV=py35-django110 | ||
|
||
- TOXENV=docs | ||
|
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,31 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* Utility script to leverage jpsm/SystemJS' power to build the depcache | ||
* for a given package. | ||
* | ||
* This traces the module and extracts the relative paths to all the | ||
* files used. | ||
*/ | ||
|
||
var fs = require('fs'); | ||
var Builder = require('jspm').Builder; | ||
|
||
|
||
var jsapp = process.argv[2]; // 0 is node, 1 is the file | ||
|
||
|
||
var builder = new Builder(); | ||
builder.trace(jsapp).then(function(trace) { | ||
var deps = {} | ||
for( var jsapp in trace ) { | ||
var skip = trace[jsapp] === false; // e.g. with google maps, see #13 | ||
deps[jsapp] = { | ||
name: jsapp, | ||
timestamp: skip ? null : trace[jsapp].timestamp, | ||
path: skip ? null : trace[jsapp].path, | ||
skip: skip | ||
}; | ||
} | ||
process.stdout.write(JSON.stringify(deps, null)); | ||
}); |
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,79 @@ | ||
""" | ||
Taken from djangoproject/django docs. | ||
""" | ||
|
||
""" | ||
Sphinx plugins for Django documentation. | ||
""" | ||
import json | ||
import os | ||
import re | ||
|
||
from docutils import nodes | ||
from docutils.parsers.rst import directives | ||
from sphinx import addnodes | ||
from sphinx.builders.html import StandaloneHTMLBuilder | ||
from sphinx.domains.std import Cmdoption | ||
from sphinx.util.compat import Directive | ||
from sphinx.util.console import bold | ||
from sphinx.util.nodes import set_source_info | ||
from sphinx.writers.html import SmartyPantsHTMLTranslator | ||
|
||
# RE for option descriptions without a '--' prefix | ||
simple_option_desc_re = re.compile( | ||
r'([-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)') | ||
|
||
|
||
def setup(app): | ||
app.add_directive('versionadded', VersionDirective) | ||
app.add_directive('versionchanged', VersionDirective) | ||
return {'parallel_read_safe': True} | ||
|
||
|
||
class VersionDirective(Directive): | ||
has_content = True | ||
required_arguments = 1 | ||
optional_arguments = 1 | ||
final_argument_whitespace = True | ||
option_spec = {} | ||
|
||
def run(self): | ||
if len(self.arguments) > 1: | ||
msg = """Only one argument accepted for directive '{directive_name}::'. | ||
Comments should be provided as content, | ||
not as an extra argument.""".format(directive_name=self.name) | ||
raise self.error(msg) | ||
|
||
env = self.state.document.settings.env | ||
ret = [] | ||
node = addnodes.versionmodified() | ||
ret.append(node) | ||
node['version'] = self.arguments[0] | ||
node['type'] = self.name | ||
if self.content: | ||
self.state.nested_parse(self.content, self.content_offset, node) | ||
env.note_versionchange(node['type'], node['version'], node, self.lineno) | ||
return ret | ||
|
||
|
||
class DjangoHTMLTranslator(SmartyPantsHTMLTranslator): | ||
|
||
version_text = { | ||
'versionchanged': 'Changed in %s', | ||
'versionadded': 'Added in %s', | ||
} | ||
|
||
def visit_versionmodified(self, node): | ||
self.body.append( | ||
self.starttag(node, 'div', CLASS=node['type']) | ||
) | ||
version_text = self.version_text.get(node['type']) | ||
if version_text: | ||
title = "%s%s" % ( | ||
version_text % node['version'], | ||
":" if len(node) else "." | ||
) | ||
self.body.append('<span class="title">%s</span> ' % title) | ||
|
||
def depart_versionmodified(self, node): | ||
self.body.append("</div>\n") |
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 @@ | ||
@import url(djangodocs.css); |
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,4 @@ | ||
/*** versionadded/changes ***/ | ||
div.versionadded, div.versionchanged { } | ||
div.versionadded span.title, div.versionchanged span.title, span.versionmodified { font-weight: bold; } | ||
div.versionadded, div.versionchanged, div.deprecated { color:#555; } |
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,4 @@ | ||
[theme] | ||
inherit = sphinx_rtd_theme | ||
# stylesheet = default.css | ||
# pygments_style = trac |
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,43 @@ | ||
.. _available-settings: | ||
|
||
================== | ||
Available settings | ||
================== | ||
|
||
``SYSTEMJS_ENABLED``: defaults to ``not settings.DEBUG``. If disabled, the loading | ||
of modules will happen in the 'standard' jspm way (transpiling in browser). | ||
|
||
``SYSTEMJS_JSPM_EXECUTABLE``: path to the ``jspm-cli`` executable. Defaults to | ||
``jspm``, which should be available if installed globally with ``npm``. | ||
|
||
``SYSTEMJS_OUTPUT_DIR``: name of the subdirectory within ``settings.STATIC_ROOT``. | ||
Bundled files will end up in this directory, and this is the place the | ||
templatetag will point static files to. | ||
|
||
``SYSTEMJS_PACKAGE_JSON_DIR``: directory containing your ``package.json`` file. | ||
This is automatically guessed from ``BASE_DIR``. You will get an error in the | ||
shell if you need to set it yourself. | ||
|
||
``SYSTEMJS_DEFAULT_JS_EXTENSIONS``: in prior verions of jspm, the ``.js`` extension | ||
for imports was optional. This is being phased out, and matches the | ||
``defaultJSExtensions`` settings in ``config.js``. | ||
|
||
``CACHE_DIR``: directory to keep the dependency cache (when generating | ||
:ref:`minimal <minimal>` bundles) | ||
|
||
|
||
Environment variables | ||
===================== | ||
|
||
``NODE_PATH`` | ||
------------- | ||
|
||
When generating :ref:`minimal <minimal>` bundles, a NodeJS script | ||
(``trace-deps.js``) is called. This script needs to be called from the directory | ||
containing ``package.json``. If Django-SystemJS cannot figure out this directory | ||
by itself, you may need to set the environment variable: | ||
|
||
.. code-block:: sh | ||
export NODE_PATH=/path/to/project/node_modules | ||
Oops, something went wrong.