Skip to content

Commit f7587f0

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents c7a8305 + d8db51a commit f7587f0

File tree

276 files changed

+5831
-4165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+5831
-4165
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/_build
2-
/_exts
2+
*.pyc

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cache:
99
- $HOME/.cache/pip
1010
- _build
1111

12-
install: pip install sphinx==1.1.3
12+
install: pip install sphinx~=1.3 git+https://github.com/fabpot/sphinx-php.git
1313

1414
script: sphinx-build -nW -b html -d _build/doctrees . _build/html
1515

_exts

Lines changed: 0 additions & 1 deletion
This file was deleted.

_theme/_exts/symfonycom/__init__.py

Whitespace-only changes.
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
from sphinx.highlighting import lexers, PygmentsBridge
2+
from pygments.style import Style
3+
from pygments.formatters import HtmlFormatter
4+
from pygments.token import Keyword, Name, Comment, String, Error, \
5+
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
6+
7+
from sphinx.writers.html import HTMLTranslator
8+
from docutils import nodes
9+
from sphinx.locale import admonitionlabels, lazy_gettext
10+
11+
customadmonitionlabels = admonitionlabels
12+
l_ = lazy_gettext
13+
customadmonitionlabels['best-practice'] = l_('Best Practice')
14+
15+
def _getType(path):
16+
return path[:path.find('/')]
17+
18+
def _isIndex(path):
19+
return 'index' in path
20+
21+
class SensioHTMLTranslator(HTMLTranslator):
22+
def __init__(self, builder, *args, **kwds):
23+
HTMLTranslator.__init__(self, builder, *args, **kwds)
24+
builder.templates.environment.filters['get_type'] = _getType
25+
builder.templates.environment.tests['index'] = _isIndex
26+
self.highlightlinenothreshold = 0
27+
28+
def visit_literal(self, node):
29+
self.body.append(self.starttag(node, 'tt', '', CLASS='docutils literal'))
30+
self.body.append('<code>')
31+
32+
def depart_literal(self, node):
33+
self.body.append('</code>')
34+
self.body.append('</tt>')
35+
36+
def visit_admonition(self, node, name=''):
37+
self.body.append(self.starttag(node, 'div', CLASS=('admonition-wrapper')))
38+
self.body.append('<div class="' + name + '"></div>')
39+
self.body.append('<div class="admonition admonition-' + name + '">')
40+
if name and name != 'seealso':
41+
node.insert(0, nodes.title(name, customadmonitionlabels[name]))
42+
self.set_first_last(node)
43+
44+
def depart_admonition(self, node=None):
45+
self.body.append('</div></div>\n')
46+
47+
def visit_sidebar(self, node):
48+
self.body.append(self.starttag(node, 'div', CLASS=('admonition-wrapper')))
49+
self.body.append('<div class="sidebar"></div>')
50+
self.body.append('<div class="admonition admonition-sidebar">')
51+
self.set_first_last(node)
52+
self.in_sidebar = 1
53+
54+
def depart_sidebar(self, node):
55+
self.body.append('</div></div>\n')
56+
self.in_sidebar = None
57+
58+
# overriden to add a new highlight div around each block
59+
def visit_literal_block(self, node):
60+
if node.rawsource != node.astext():
61+
# most probably a parsed-literal block -- don't highlight
62+
return BaseTranslator.visit_literal_block(self, node)
63+
lang = self.highlightlang
64+
linenos = node.rawsource.count('\n') >= \
65+
self.highlightlinenothreshold - 1
66+
highlight_args = node.get('highlight_args', {})
67+
if node.has_key('language'):
68+
# code-block directives
69+
lang = node['language']
70+
highlight_args['force'] = True
71+
if node.has_key('linenos'):
72+
linenos = node['linenos']
73+
def warner(msg):
74+
self.builder.warn(msg, (self.builder.current_docname, node.line))
75+
highlighted = self.highlighter.highlight_block(
76+
node.rawsource, lang, warn=warner, linenos=linenos,
77+
**highlight_args)
78+
starttag = self.starttag(node, 'div', suffix='',
79+
CLASS='highlight-%s' % lang)
80+
self.body.append('<div class="literal-block">' + starttag + highlighted + '</div></div>\n')
81+
raise nodes.SkipNode
82+
83+
class SensioStyle(Style):
84+
background_color = "#000000"
85+
default_style = ""
86+
87+
styles = {
88+
# No corresponding class for the following:
89+
#Text: "", # class: ''
90+
Whitespace: "underline #f8f8f8", # class: 'w'
91+
Error: "#a40000 border:#ef2929", # class: 'err'
92+
Other: "#ffffff", # class 'x'
93+
94+
Comment: "italic #B729D9", # class: 'c'
95+
Comment.Single: "italic #B729D9", # class: 'c1'
96+
Comment.Multiline: "italic #B729D9", # class: 'cm'
97+
Comment.Preproc: "noitalic #aaa", # class: 'cp'
98+
99+
Keyword: "#FF8400", # class: 'k'
100+
Keyword.Constant: "#FF8400", # class: 'kc'
101+
Keyword.Declaration: "#FF8400", # class: 'kd'
102+
Keyword.Namespace: "#FF8400", # class: 'kn'
103+
Keyword.Pseudo: "#FF8400", # class: 'kp'
104+
Keyword.Reserved: "#FF8400", # class: 'kr'
105+
Keyword.Type: "#FF8400", # class: 'kt'
106+
107+
Operator: "#E0882F", # class: 'o'
108+
Operator.Word: "#E0882F", # class: 'ow' - like keywords
109+
110+
Punctuation: "#999999", # class: 'p'
111+
112+
# because special names such as Name.Class, Name.Function, etc.
113+
# are not recognized as such later in the parsing, we choose them
114+
# to look the same as ordinary variables.
115+
Name: "#ffffff", # class: 'n'
116+
Name.Attribute: "#ffffff", # class: 'na' - to be revised
117+
Name.Builtin: "#ffffff", # class: 'nb'
118+
Name.Builtin.Pseudo: "#3465a4", # class: 'bp'
119+
Name.Class: "#ffffff", # class: 'nc' - to be revised
120+
Name.Constant: "#ffffff", # class: 'no' - to be revised
121+
Name.Decorator: "#888", # class: 'nd' - to be revised
122+
Name.Entity: "#ce5c00", # class: 'ni'
123+
Name.Exception: "#cc0000", # class: 'ne'
124+
Name.Function: "#ffffff", # class: 'nf'
125+
Name.Property: "#ffffff", # class: 'py'
126+
Name.Label: "#f57900", # class: 'nl'
127+
Name.Namespace: "#ffffff", # class: 'nn' - to be revised
128+
Name.Other: "#ffffff", # class: 'nx'
129+
Name.Tag: "#cccccc", # class: 'nt' - like a keyword
130+
Name.Variable: "#ffffff", # class: 'nv' - to be revised
131+
Name.Variable.Class: "#ffffff", # class: 'vc' - to be revised
132+
Name.Variable.Global: "#ffffff", # class: 'vg' - to be revised
133+
Name.Variable.Instance: "#ffffff", # class: 'vi' - to be revised
134+
135+
Number: "#1299DA", # class: 'm'
136+
137+
Literal: "#ffffff", # class: 'l'
138+
Literal.Date: "#ffffff", # class: 'ld'
139+
140+
String: "#56DB3A", # class: 's'
141+
String.Backtick: "#56DB3A", # class: 'sb'
142+
String.Char: "#56DB3A", # class: 'sc'
143+
String.Doc: "italic #B729D9", # class: 'sd' - like a comment
144+
String.Double: "#56DB3A", # class: 's2'
145+
String.Escape: "#56DB3A", # class: 'se'
146+
String.Heredoc: "#56DB3A", # class: 'sh'
147+
String.Interpol: "#56DB3A", # class: 'si'
148+
String.Other: "#56DB3A", # class: 'sx'
149+
String.Regex: "#56DB3A", # class: 'sr'
150+
String.Single: "#56DB3A", # class: 's1'
151+
String.Symbol: "#56DB3A", # class: 'ss'
152+
153+
Generic: "#ffffff", # class: 'g'
154+
Generic.Deleted: "#a40000", # class: 'gd'
155+
Generic.Emph: "italic #ffffff", # class: 'ge'
156+
Generic.Error: "#ef2929", # class: 'gr'
157+
Generic.Heading: "#000080", # class: 'gh'
158+
Generic.Inserted: "#00A000", # class: 'gi'
159+
Generic.Output: "#888", # class: 'go'
160+
Generic.Prompt: "#745334", # class: 'gp'
161+
Generic.Strong: "bold #ffffff", # class: 'gs'
162+
Generic.Subheading: "bold #800080", # class: 'gu'
163+
Generic.Traceback: "bold #a40000", # class: 'gt'
164+
}
165+
166+
def setup(app):
167+
app.set_translator('html', SensioHTMLTranslator)

_theme/_templates/globaltoc.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<div class=submenu>
2+
{% set menu = [
3+
('The Book', 'book/index'),
4+
('The Cookbook', 'cookbook/index'),
5+
('The Components', 'components/index'),
6+
('The Best Practices', 'best_practices/index'),
7+
('The Quick Tour', 'quick_tour/index'),
8+
('Reference', 'reference/index'),
9+
('Index', 'genindex'),
10+
('Contributing', 'contributing/index')
11+
] %}
12+
13+
<ul class="list_submenu list-unstyled">
14+
{% for name, doc in menu %}
15+
<li {% if loop.first %}class="first"{% endif %}>
16+
<a href="{{ pathto(doc) }}">{{ name }}</a>
17+
</li>
18+
{% endfor %}
19+
</ul>
20+
</div>

_theme/_templates/layout.html

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{% extends '!layout.html' %}
2+
3+
{% set css_files = ['http://symfony.com/css/compiled/v5/all.css?v=4'] %}
4+
{# make sure the Sphinx stylesheet isn't loaded #}
5+
{% set style = '' %}
6+
{% set isIndex = pagename is index %}
7+
8+
{% block extrahead %}
9+
{# add JS to support tabs #}
10+
<script src="http://symfony.com/js/v5/all.js?v=4"></script>
11+
12+
{# pygment's styles are still loaded, undo some unwanted styles #}
13+
<style>
14+
.highlight .k, .highlight .gh, .highlight .gp,
15+
.highlight .gu, .highlight .kc, .highlight .kd,
16+
.highlight .kn, .highlight .kr, .highlight .nc,
17+
.highlight .nd, .highlight .ni, .highlight .nl,
18+
.highlight .nn, .highlight .nt, .highlight .ow,
19+
.highlight .se { font-weight: normal; }
20+
21+
.highlight .c, .highlight .cm, .highlight .c1,
22+
.highlight .sd, .highlight .si { font-style: normal; }
23+
24+
.doc { background: none; }
25+
#demo-warning {
26+
border: 3px dashed #c00;
27+
padding: 10px;
28+
margin-bottom: 30px;
29+
}
30+
#demo-warning h4 { font-size: 1.7em;font-weight: bold; }
31+
#demo-warning p { margin-bottom: 0; }
32+
</style>
33+
{% endblock %}
34+
35+
{% block header %}
36+
{# ugly way, now we have 2 body tags, but styles rely on these classes #}
37+
<body class="{{ pagename|get_type }} {% if isIndex %}doc_index{% else %}doc_article{% endif %} doc">
38+
{% endblock %}
39+
40+
{% block content %}
41+
<div class="container"><div id="page-content">
42+
<div class="row">
43+
{%- if render_sidebar %}
44+
<div id="sidebar" class="col-sm-3">
45+
<div id="sidebar-content">
46+
<div id="demo-warning">
47+
<h4>Pull request build</h4>
48+
<p>Each pull request of the Symfony Documentation is automatically deployed and hosted on <a href="https://platform.sh">Platform.sh</a>.<br>
49+
View this page on <a href="https://symfony.com/doc/current/{{ pagename }}">symfony.com</a>.</p>
50+
</div>
51+
52+
{%- include "globaltoc.html" %}
53+
54+
{% if not isIndex %}
55+
{%- include "localtoc.html" %}
56+
{% endif %}
57+
</div>
58+
</div>
59+
{%- endif %}
60+
61+
<div id="main" class="col-sm-9">
62+
<ol class=breadcrumb>
63+
<li><a href="#">Home</a></li>
64+
<li><a href="#">Documentation</a></li>
65+
{% for parent in parents %}
66+
<li><a href="{{ parent.link|e }}">{{ parent.title }}</a></li>
67+
{% endfor %}
68+
<li class=active>{{ title }}</li>
69+
</ol>
70+
71+
<h1 class="content_title">{{ title }}</h1>
72+
73+
<div class=page>
74+
{% block body %}{% endblock %}
75+
</div>
76+
77+
{% if prev and next %}
78+
<div class=navigation>
79+
<a href="{{ prev.link|e }}">« {{ prev.title|striptags|e }}</a>
80+
<span class=separator>|</span>
81+
<a href="{{ next.link|e }}">{{ next.title|striptags|e }} »</a>
82+
</div>
83+
{% endif %}
84+
85+
<div id="license">
86+
<p>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">License</a>.</p>
87+
</div>
88+
</div>
89+
</div>
90+
</div>
91+
{% endblock %}
92+
93+
{# relbar1 is at the top and should not render the quick navigation #}
94+
{% block relbar1 %}{% endblock %}
95+
{% block relbar2 %}{% endblock %}
96+
97+
{# remove "generated by sphinx" footer #}
98+
{% block footer %}{% endblock %}

_theme/_templates/localtoc.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div class="toc">
2+
<h4>{{ _('Table Of Contents') }}</h4>
3+
<div class=toc-content>
4+
{{ toc }}
5+
</div>
6+
</div>

best_practices/business-logic.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ were defined by the PHP community. You can learn more about
333333
use the `PHP-CS-Fixer`_, which is a command-line utility that can fix the
334334
coding standards of an entire codebase in a matter of seconds.
335335

336-
.. _`full definition`: http://en.wikipedia.org/wiki/Business_logic
336+
.. _`full definition`: https://en.wikipedia.org/wiki/Business_logic
337337
.. _`Doctrine project`: http://www.doctrine-project.org/
338338
.. _`fixture class`: https://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html#writing-simple-fixtures
339339
.. _`PSR-1`: http://www.php-fig.org/psr/psr-1/

best_practices/configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,5 @@ that you store them outside the Symfony project and make them available
180180
through environment variables. Learn how to do it in the following article:
181181
:doc:`/cookbook/configuration/external_parameters`
182182

183-
.. _`feature toggles`: http://en.wikipedia.org/wiki/Feature_toggle
183+
.. _`feature toggles`: https://en.wikipedia.org/wiki/Feature_toggle
184184
.. _`constant() function`: http://twig.sensiolabs.org/doc/functions/constant.html

best_practices/creating-the-project.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,4 @@ the Symfony directory structure.
177177
.. _`Get Started`: https://getcomposer.org/doc/00-intro.md
178178
.. _`Composer download page`: https://getcomposer.org/download/
179179
.. _`public checksums repository`: https://github.com/sensiolabs/checksums
180-
.. _`these steps`: http://fabien.potencier.org/article/73/signing-project-releases
180+
.. _`these steps`: http://fabien.potencier.org/signing-project-releases.html

best_practices/forms.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ makes them easier to re-use later.
8585

8686
Add buttons in the templates, not in the form classes or the controllers.
8787

88-
Since Symfony 2.5, you can add buttons as fields on your form. This is a nice
88+
Since Symfony 2.3, you can add buttons as fields on your form. This is a nice
8989
way to simplify the template that renders your form. But if you add the buttons
9090
directly in your form class, this would effectively limit the scope of that form:
9191

best_practices/tests.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,4 @@ for your test fixtures.
121121
.. _`PhpUnit`: https://phpunit.de/
122122
.. _`PhpSpec`: http://www.phpspec.net/
123123
.. _`Mink`: http://mink.behat.org
124-
.. _`smoke testing`: http://en.wikipedia.org/wiki/Smoke_testing_(software)
124+
.. _`smoke testing`: https://en.wikipedia.org/wiki/Smoke_testing_(software)

best_practices/web-assets.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ much more concise:
3030

3131
Keep in mind that ``web/`` is a public directory and that anything stored
3232
here will be publicly accessible, including all the original asset files
33-
(e.g. Sass, LESS and CoffeScript files).
33+
(e.g. Sass, LESS and CoffeeScript files).
3434

3535
Using Assetic
3636
-------------

book/controller.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,8 @@ session.
619619
Flash Messages
620620
~~~~~~~~~~~~~~
621621

622-
You can also store small messages that will be stored on the user's session
623-
for exactly one additional request. This is useful when processing a form:
622+
You can also store small messages that will be stored on the user's session.
623+
This is useful when processing a form:
624624
you want to redirect and have a special message shown on the *next* page.
625625
These types of messages are called "flash" messages.
626626

@@ -675,9 +675,17 @@ the ``notice`` message:
675675
</div>
676676
<?php endforeach ?>
677677

678-
By design, flash messages are meant to live for exactly one request (they're
679-
"gone in a flash"). They're designed to be used across redirects exactly as
680-
you've done in this example.
678+
.. note::
679+
680+
By design, flash messages are meant to be processed exactly once. This means
681+
that they vanish from the session automatically when they are retrieved from
682+
the flash bag by calling the ``get()`` method.
683+
684+
.. tip::
685+
686+
You can use the
687+
:method:`Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface::peek`
688+
method instead to retrieve the message while keeping it in the bag.
681689

682690
.. index::
683691
single: Controller; Response object

0 commit comments

Comments
 (0)