Skip to content
Myr

Trim trailing white space throughout the project

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Many editors clean up trailing white space on save. By removing it all in one go, it helps keep future diffs cleaner by avoiding spurious white space changes on unrelated lines.

authored by Jon Dufresne · committed by Jon Dufresne · parent b9932a0 · Browse files · 6 files+55 added−55 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+55 added−55 removed

  • tests:+1 added−1 removed
  • other:+54 added−54 removed

6 files+55 added−55 removed

modified:docs/_themes/jinja/static/jinja.css_t+25 added-25 removed
10 unmodified lines
11{% set page_width = '940px' %}12{% set sidebar_width = '220px' %}13{% set font_family = 'Georgia, serif' %}14{% set header_font_family = 'Crimson Text, ' ~ font_family %}15 1516@import url("basic.css");17 1718/* -- page layout ----------------------------------------------------------- */19 1920body {21 font-family: {{ font_family }};22 font-size: 17px;23 background-color: white;
22 unmodified lines
4647hr {48 border: 1px solid #B1B4B6;49}50 5051div.body {52 background-color: #ffffff;53 color: #3E4349;54 padding: 0 30px 0 30px;
2 unmodified lines
57img.floatingflask {58 padding: 0 0 10px 10px;59 float: right;60}61 6162div.footer {63 width: {{ page_width }};64 margin: 20px auto 30px auto;65 font-size: 14px;
7 unmodified lines
7374div.related {75 display: none;76}77 7778div.sphinxsidebar a {79 color: #444;80 text-decoration: none;81 border-bottom: 1px dotted #999;
1 unmodified line
8384div.sphinxsidebar a:hover {85 border-bottom: 1px solid #999;86}87 8788div.sphinxsidebar {89 font-size: 15px;90 line-height: 1.5;91}
6 unmodified lines
98 padding: 0 0 20px 0;99 margin: 0;100 text-align: center;101}102 102103div.sphinxsidebar h3,104div.sphinxsidebar h4 {105 font-family: {{ font_family }};106 color: #444;
5 unmodified lines
112113div.sphinxsidebar h4 {114 font-size: 20px;115}116 116117div.sphinxsidebar h3 a {118 color: #444;119}120
2 unmodified lines
123div.sphinxsidebar p.logo a:hover,124div.sphinxsidebar h3 a:hover {125 border: none;126}127 127128div.sphinxsidebar p {129 color: #555;130 margin: 10px 0;131}
2 unmodified lines
134 margin: 10px 0;135 padding: 0;136 color: #000;137}138 138139div.sphinxsidebar input {140 border: 1px solid #ccc;141 font-family: {{ font_family }};142 font-size: 14px;
1 unmodified line
144145div.sphinxsidebar form.search input[name="q"] {146 width: 130px;147}148 148149/* -- body styles ----------------------------------------------------------- */150 150151a {152 color: #aa0000;153 text-decoration: underline;154}155 155156a:hover {157 color: #dd0000;158 text-decoration: underline;159}160 160161div.body h1,162div.body h2,163div.body h3,164div.body h4,
4 unmodified lines
169 margin: 30px 0px 10px 0px;170 padding: 0;171 color: black;172}173 173174div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }175div.body h2 { font-size: 180%; }176div.body h3 { font-size: 150%; }177div.body h4 { font-size: 130%; }178div.body h5 { font-size: 100%; }179div.body h6 { font-size: 100%; }180 180181a.headerlink {182 color: #ddd;183 padding: 0 4px;184 text-decoration: none;185}186 186187a.headerlink:hover {188 color: #444;189 background: #eaeaea;190}191 191192div.body p, div.body dd, div.body li {193 line-height: 1.4em;194}195
38 unmodified lines
234div.note {235 background-color: #eee;236 border: 1px solid #ccc;237}238 238239div.seealso {240 background-color: #ffc;241 border: 1px solid #ff6;242}243 243244div.topic {245 background-color: #eee;246}247 247248p.admonition-title {249 display: inline;250}251 251252p.admonition-title:after {253 content: ":";254}255
85 unmodified lines
341ul, ol {342 margin: 10px 0 10px 30px;343 padding: 0;344}345 345346pre {347 background: #eee;348 padding: 7px 30px;349 margin: 15px -30px;
8 unmodified lines
358dl dl pre {359 margin-left: -90px;360 padding-left: 90px;361}362 362363tt {364 background-color: #E8EFF0;365 color: #222;366 /* padding: 1px 2px; */
30 unmodified lines
modified:docs/api.rst+3 added-3 removed
17 unmodified lines
18:class:`Template` class, an environment is created automatically for you,19albeit a shared one.2021Most applications will create one :class:`Environment` object on application22initialization and use that to load templates. In some cases however, it's 22initialization and use that to load templates. In some cases however, it's23useful to have multiple environments side by side, if different configurations24are in use.2526The simplest way to configure Jinja2 to load templates for your application
185 unmodified lines
212213 For a more complex example you can provide a hint. For example214 the :func:`first` filter creates an undefined object that way::215216 return environment.undefined('no first item, sequence was empty') 216 return environment.undefined('no first item, sequence was empty')217218 If it the `name` or `obj` is known (for example because an attribute219 was accessed) it should be passed to the undefined object, even if220 a custom `hint` is provided. This gives undefined objects the
616 unmodified lines
837 for i in xrange(2, int(math.ceil(math.sqrt(n))) + 1):838 if n % i == 0:839 return False840 return True841 841842843You can register it on the template environment by updating the844:attr:`~Environment.tests` dict on the environment::845846 environment.tests['prime'] = is_prime
86 unmodified lines
modified:docs/intro.rst+1 added-1 removed
60 unmodified lines
61which will install the package via `distribute` in development mode. This also62has the advantage that the C extensions are compiled.6364.. _download page: https://pypi.org/project/Jinja2/65.. _distribute: https://pypi.org/project/distribute/ 65.. _distribute: https://pypi.org/project/distribute/66.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools67.. _easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall68.. _pip: https://pypi.org/project/pip/69.. _git: https://git-scm.org/
36 unmodified lines
modified:ext/django2jinja/django2jinja.py+14 added-14 removed
31 unmodified lines
3233 writer = Writer()34 writer.node_handlers[MyNode] = write_my_node35 convert_templates('/path/to/output/folder', writer=writer)36 3637 Here is an example hos to automatically translate your django38 variables to jinja2::39 3940 import re41 # List of tuple (Match pattern, Replace pattern, Exclusion pattern)42 4243 var_re = ((re.compile(r"(u|user)\.is_authenticated"), r"\1.is_authenticated()", None),44 (re.compile(r"\.non_field_errors"), r".non_field_errors()", None),45 (re.compile(r"\.label_tag"), r".label_tag()", None),46 (re.compile(r"\.as_dl"), r".as_dl()", None),47 (re.compile(r"\.as_table"), r".as_table()", None),48 (re.compile(r"\.as_widget"), r".as_widget()", None),49 (re.compile(r"\.as_hidden"), r".as_hidden()", None),50 5051 (re.compile(r"\.get_([0-9_\w]+)_url"), r".get_\1_url()", None),52 (re.compile(r"\.url"), r".url()", re.compile(r"(form|calendar).url")),53 (re.compile(r"\.get_([0-9_\w]+)_display"), r".get_\1_display()", None),54 (re.compile(r"loop\.counter"), r"loop.index", None),55 (re.compile(r"loop\.revcounter"), r"loop.revindex", None),56 (re.compile(r"request\.GET\.([0-9_\w]+)"), r"request.GET.get('\1', '')", None),57 (re.compile(r"request\.get_host"), r"request.get_host()", None),58 5859 (re.compile(r"\.all(?!_)"), r".all()", None),60 (re.compile(r"\.all\.0"), r".all()[0]", None),61 (re.compile(r"\.([0-9])($|\s+)"), r"[\1]\2", None),62 (re.compile(r"\.items"), r".items()", None),63 )64 writer = Writer(var_re=var_re)65 6566 For details about the writing process have a look at the module code.6768 :copyright: (c) 2009 by the Jinja Team.69 :license: BSD.
243 unmodified lines
313 def translate_variable_name(self, var):314 """Performs variable name translation."""315 if self.in_loop and var == 'forloop' or var.startswith('forloop.'):316 var = var[3:]317 317318 for reg, rep, unless in self.var_re:319 no_unless = unless and unless.search(var) or True320 if reg.search(var) and no_unless:321 var = reg.sub(rep, var)
102 unmodified lines
424 writer.write('if ')425 join_with = 'and'426 if node.link_type == core_tags.IfNode.LinkTypes.or_:427 join_with = 'or'428 428429 for idx, (ifnot, expr) in enumerate(node.bool_exprs):430 if idx:431 writer.write(' %s ' % join_with)432 if ifnot:
300 unmodified lines
733 name not in writer._filters_warned:734 writer._filters_warned.add(name)735 writer.warn('Filter %s probably doesn\'t exist in Jinja' %736 name)737 737738 if not node.vars_to_resolve:739 # No argument, pass the request740 writer.start_variable()741 writer.write('request|')742 writer.write(name)743 writer.end_variable()744 return 745 744 return745746 first_var = node.vars_to_resolve[0]747 args = node.vars_to_resolve[1:]748 writer.start_variable()749 749750 # Copied from Writer.filters()751 writer.node(first_var)752 752753 writer.write('|')754 writer.write(name)755 if args:756 writer.write('(')
4 unmodified lines
761 writer.node(var)762 else:763 writer.literal(var.literal)764 writer.write(')')765 writer.end_variable() 765 writer.end_variable()766767# get rid of node now, it shouldn't be used normally768del node
modified:scripts/pylintrc+11 added-11 removed
1# lint Python modules using external checkers.2# 2#3# This is the main checker controlling the other ones and the reports4# generation. It is itself both a raw checker and an astng checker in order5# to:6# * handle message activation / deactivation at the module level7# * handle some basic but necessary stats'data (number of classes, methods...)8# 8#9[MASTER]1011# Specify a configuration file.12#rcfile=
78 unmodified lines
91# * unused variables / imports92# * undefined variables93# * redefinition of variable from builtins or from an outer scope94# * use of variable before assignment95# 95#96[VARIABLES]9798# Tells whether we should check for unused import in __init__ files.99init-import=no
6 unmodified lines
106additional-builtins=107108109# try to find bugs in the code using type inference110# 110#111[TYPECHECK]112113# Tells whether missing members accessed in mixin class should be ignored. A114# mixin class is detected if its name ends with "mixin" (case insensitive).
16 unmodified lines
131# * required module attributes132# * dangerous default values as arguments133# * redefinition of function / method / class134# * uses of the global statement135# 135#136[BASIC]137138# Required attributes for module, separated by a comma139required-attributes=
42 unmodified lines
182183# checks for sign of poor/misdesign:184# * number of methods, attributes, local variables...185# * size, complexity of functions, methods186# 186#187[DESIGN]188189# Maximum number of arguments for function / method190max-args=12
27 unmodified lines
218# * external modules dependencies219# * relative / wildcard imports220# * cyclic imports221# * uses of deprecated modules222# 222#223[IMPORTS]224225# Deprecated modules which should not be used, separated by a comma226deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
17 unmodified lines
244# * access only to existent members via self245# * attributes not defined in the __init__ method246# * supported interfaces implementation247# * unreachable code248# 248#249[CLASSES]250251# List of interface methods to ignore, separated by a comma. This is used for252# instance to not check methods defines in Zope's Interface base class.
5 unmodified lines
258259# checks for similarities and duplicated code. This computation may be260# memory / CPU intensive, so you should disable it if you experiments some261# problems.262# 262#263[SIMILARITIES]264265# Minimum lines number of a similarity.266min-similarity-lines=10
7 unmodified lines
274275# checks for:276# * warning notes in the code like FIXME, XXX277# * PEP 263: source code with non ascii character but no encoding declaration278# 278#279[MISCELLANEOUS]280281# List of note tags to take in consideration, separated by a comma.282notes=FIXME,XXX,TODO
3 unmodified lines
286# * unauthorized constructions287# * strict indentation288# * line length289# * use of <> instead of !=290# 290#291[FORMAT]292293# Maximum number of characters on a single line.294max-line-length=90
7 unmodified lines
modified:tests/test_api.py+1 added-1 removed
66 unmodified lines
67 assert c.next() == item68 c.next()69 assert c.current == 270 c.reset()71 assert c.current == 1 71 assert c.current == 17273 def test_expressions(self, env):74 expr = env.compile_expression("foo")75 assert expr() is None
265 unmodified lines