From 1d571ca47dcc53892afb7a4d39f42be588f02596 Mon Sep 17 00:00:00 2001 From: Pedro Nofuentes Date: Sat, 29 Nov 2014 12:22:06 +0100 Subject: [PATCH 1/5] Changed unordered list to definition list --- components/http_foundation/sessions.rst | 82 ++++++++++++------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/components/http_foundation/sessions.rst b/components/http_foundation/sessions.rst index 27296fc7529..37b89c4254e 100644 --- a/components/http_foundation/sessions.rst +++ b/components/http_foundation/sessions.rst @@ -67,71 +67,71 @@ as follows divided into a couple of groups. Session workflow -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::start`: - Starts the session - do not use ``session_start()``; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::start` + Starts the session - do not use ``session_start()``. -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::migrate`: - Regenerates the session ID - do not use ``session_regenerate_id()``. - This method can optionally change the lifetime of the new cookie that will - be emitted by calling this method; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::migrate` + Regenerates the session ID - do not use ``session_regenerate_id()``. + This method can optionally change the lifetime of the new cookie that will + be emitted by calling this method. -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::invalidate`: - Clears all session data and regenerates session ID. Do not use ``session_destroy()``; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::invalidate` + Clears all session data and regenerates session ID. Do not use ``session_destroy()``. -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getId`: Gets the - session ID. Do not use ``session_id()``; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getId` + Gets the session ID. Do not use ``session_id()``. -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::setId`: Sets the - session ID. Do not use ``session_id()``; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::setId` + Sets the session ID. Do not use ``session_id()``. -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getName`: Gets the - session name. Do not use ``session_name()``; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getName` + Gets the session name. Do not use ``session_name()``. -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::setName`: Sets the - session name. Do not use ``session_name()``. +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::setName` + Sets the session name. Do not use ``session_name()``. Session attributes -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::set`: - Sets an attribute by key; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::set` + Sets an attribute by key. -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::get`: - Gets an attribute by key; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::get` + Gets an attribute by key. -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::all`: - Gets all attributes as an array of key => value; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::all` + Gets all attributes as an array of key => value. -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::has`: - Returns true if the attribute exists; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::has` + Returns true if the attribute exists. -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::replace`: - Sets multiple attributes at once: takes a keyed array and sets each key => value pair; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::replace` + Sets multiple attributes at once: takes a keyed array and sets each key => value pair; -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::remove`: - Deletes an attribute by key; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::remove` + Deletes an attribute by key; -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::clear`: - Clear all attributes. +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::clear` + Clear all attributes. The attributes are stored internally in a "Bag", a PHP object that acts like an array. A few methods exist for "Bag" management: -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::registerBag`: - Registers a :class:`Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface`; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::registerBag` + Registers a :class:`Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface`. -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getBag`: - Gets a :class:`Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface` by - bag name; +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getBag` + Gets a :class:`Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface` by + bag name; -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getFlashBag`: - Gets the :class:`Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface`. - This is just a shortcut for convenience. +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getFlashBag` + Gets the :class:`Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface`. + This is just a shortcut for convenience. Session metadata -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getMetadataBag`: - Gets the :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag` - which contains information about the session. +:method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getMetadataBag` + Gets the :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag` + which contains information about the session. Session Data Management ~~~~~~~~~~~~~~~~~~~~~~~ From 6b68e486fac738daba72b8a333c54046b0b453d5 Mon Sep 17 00:00:00 2001 From: Pedro Nofuentes Date: Sat, 29 Nov 2014 12:52:36 +0100 Subject: [PATCH 2/5] Changed paragraph to heading --- components/http_foundation/sessions.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/http_foundation/sessions.rst b/components/http_foundation/sessions.rst index 37b89c4254e..dcf225bb2a0 100644 --- a/components/http_foundation/sessions.rst +++ b/components/http_foundation/sessions.rst @@ -66,6 +66,7 @@ The :class:`Symfony\\Component\\HttpFoundation\\Session\\Session` has a simple A as follows divided into a couple of groups. Session workflow +................ :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::start` Starts the session - do not use ``session_start()``. @@ -91,6 +92,7 @@ Session workflow Sets the session name. Do not use ``session_name()``. Session attributes +.................. :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::set` Sets an attribute by key. @@ -128,6 +130,7 @@ an array. A few methods exist for "Bag" management: This is just a shortcut for convenience. Session metadata +................ :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getMetadataBag` Gets the :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag` From 3649bdb40dc82231b2259485a070035a67703c60 Mon Sep 17 00:00:00 2001 From: Pedro Nofuentes Date: Sat, 29 Nov 2014 13:35:16 +0100 Subject: [PATCH 3/5] Fixed heading capitalization to follow the standards --- components/http_foundation/sessions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/http_foundation/sessions.rst b/components/http_foundation/sessions.rst index dcf225bb2a0..1e3d262bd1a 100644 --- a/components/http_foundation/sessions.rst +++ b/components/http_foundation/sessions.rst @@ -65,7 +65,7 @@ The :class:`Symfony\\Component\\HttpFoundation\\Session\\Session` class implemen The :class:`Symfony\\Component\\HttpFoundation\\Session\\Session` has a simple API as follows divided into a couple of groups. -Session workflow +Session Workflow ................ :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::start` @@ -91,7 +91,7 @@ Session workflow :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::setName` Sets the session name. Do not use ``session_name()``. -Session attributes +Session Attributes .................. :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::set` @@ -129,7 +129,7 @@ an array. A few methods exist for "Bag" management: Gets the :class:`Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface`. This is just a shortcut for convenience. -Session metadata +Session Metadata ................ :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getMetadataBag` From dda1905c82fbab1dc939882feed56662af34a5f6 Mon Sep 17 00:00:00 2001 From: Pedro Nofuentes Date: Sat, 29 Nov 2014 15:59:09 +0100 Subject: [PATCH 4/5] Changed to definition lists --- book/page_creation.rst | 50 +++++++++------- book/propel.rst | 24 +++++--- book/routing.rst | 11 ++-- book/templating.rst | 21 ++++--- book/testing.rst | 47 +++++++-------- components/http_foundation/introduction.rst | 64 ++++++++++----------- quick_tour/the_architecture.rst | 21 ++++--- quick_tour/the_view.rst | 14 +++-- 8 files changed, 140 insertions(+), 112 deletions(-) diff --git a/book/page_creation.rst b/book/page_creation.rst index 085f98e9cc6..5054b2d02a8 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -488,13 +488,17 @@ you'll know where to find and put different types of files and why. Though entirely flexible, by default, each Symfony :term:`application` has the same basic and recommended directory structure: -* ``app/``: This directory contains the application configuration; +``app/`` + This directory contains the application configuration. -* ``src/``: All the project PHP code is stored under this directory; +``src/`` + All the project PHP code is stored under this directory. -* ``vendor/``: Any vendor libraries are placed here by convention; +``vendor/`` + Any vendor libraries are placed here by convention. -* ``web/``: This is the web root directory and contains any publicly accessible files; +``web/`` + This is the web root directory and contains any publicly accessible files. .. _the-web-directory: @@ -554,11 +558,13 @@ needs to know about your application. You don't even need to worry about these methods when starting - Symfony fills them in for you with sensible defaults. -* ``registerBundles()``: Returns an array of all bundles needed to run the - application (see :ref:`page-creation-bundles`); +``registerBundles()`` + Returns an array of all bundles needed to run the application (see + :ref:`page-creation-bundles`). -* ``registerContainerConfiguration()``: Loads the main application configuration - resource file (see the `Application Configuration`_ section). +``registerContainerConfiguration()`` + Loads the main application configuration resource file (see the + `Application Configuration`_ section). In day-to-day development, you'll mostly use the ``app/`` directory to modify configuration and routing files in the ``app/config/`` directory (see @@ -743,23 +749,27 @@ bundle system follows a set of conventions that help to keep code consistent between all Symfony bundles. Take a look at ``AcmeDemoBundle``, as it contains some of the most common elements of a bundle: -* ``Controller/`` contains the controllers of the bundle (e.g. ``RandomController.php``); +``Controller/`` + Contains the controllers of the bundle (e.g. ``RandomController.php``). -* ``DependencyInjection/`` holds certain dependency injection extension classes, - which may import service configuration, register compiler passes or more - (this directory is not necessary); +``DependencyInjection/`` + Holds certain dependency injection extension classes, which may import service + configuration, register compiler passes or more (this directory is not + necessary). -* ``Resources/config/`` houses configuration, including routing configuration - (e.g. ``routing.yml``); +``Resources/config/`` + Houses configuration, including routing configuration (e.g. ``routing.yml``). -* ``Resources/views/`` holds templates organized by controller name (e.g. - ``Hello/index.html.twig``); +``Resources/views/`` + Holds templates organized by controller name (e.g. ``Hello/index.html.twig``). -* ``Resources/public/`` contains web assets (images, stylesheets, etc) and is - copied or symbolically linked into the project ``web/`` directory via - the ``assets:install`` console command; +``Resources/public/`` + Contains web assets (images, stylesheets, etc) and is copied or symbolically + linked into the project ``web/`` directory via the ``assets:install`` console + command. -* ``Tests/`` holds all tests for the bundle. +``Tests/`` + Holds all tests for the bundle. A bundle can be as small or large as the feature it implements. It contains only the files you need and nothing else. diff --git a/book/propel.rst b/book/propel.rst index 79377a03526..7d5f919593e 100644 --- a/book/propel.rst +++ b/book/propel.rst @@ -467,14 +467,22 @@ To add a hook, just add a new method to the object class:: Propel provides the following hooks: -* ``preInsert()`` code executed before insertion of a new object -* ``postInsert()`` code executed after insertion of a new object -* ``preUpdate()`` code executed before update of an existing object -* ``postUpdate()`` code executed after update of an existing object -* ``preSave()`` code executed before saving an object (new or existing) -* ``postSave()`` code executed after saving an object (new or existing) -* ``preDelete()`` code executed before deleting an object -* ``postDelete()`` code executed after deleting an object +``preInsert()`` + Code executed before insertion of a new object. +``postInsert()`` + Code executed after insertion of a new object. +``preUpdate()`` + Code executed before update of an existing object. +``postUpdate()`` + Code executed after update of an existing object. +``preSave()`` + Code executed before saving an object (new or existing). +``postSave()`` + Code executed after saving an object (new or existing). +``preDelete()`` + Code executed before deleting an object. +``postDelete()`` + Code executed after deleting an object. Behaviors --------- diff --git a/book/routing.rst b/book/routing.rst index dac9fa376e7..8b9525bb682 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -1036,12 +1036,15 @@ As you've seen, each routing parameter or default value is eventually available as an argument in the controller method. Additionally, there are three parameters that are special: each adds a unique piece of functionality inside your application: -* ``_controller``: As you've seen, this parameter is used to determine which - controller is executed when the route is matched; +``_controller`` + As you've seen, this parameter is used to determine which controller is + executed when the route is matched. -* ``_format``: Used to set the request format (:ref:`read more `); +``_format`` + Used to set the request format (:ref:`read more `). -* ``_locale``: Used to set the locale on the request (:ref:`read more `). +``_locale`` + Used to set the locale on the request (:ref:`read more `). .. index:: single: Routing; Controllers diff --git a/book/templating.rst b/book/templating.rst index 9fe541d1ff5..46dfde2e906 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -77,15 +77,18 @@ to web designers and, in several ways, more powerful than PHP templates: Twig defines three types of special syntax: -* ``{{ ... }}``: "Says something": prints a variable or the result of an - expression to the template; - -* ``{% ... %}``: "Does something": a **tag** that controls the logic of the - template; it is used to execute statements such as for-loops for example. - -* ``{# ... #}``: "Comment something": it's the equivalent of the PHP - ``/* comment */`` syntax. It's used to add single or multi-line comments. - The content of the comments isn't included in the rendered pages. +``{{ ... }}`` + "Says something": prints a variable or the result of an expression to the + template. + +``{% ... %}`` + "Does something": a **tag** that controls the logic of the template; it is + used to execute statements such as for-loops for example. + +``{# ... #}`` + "Comment something": it's the equivalent of the PHP ``/* comment */`` syntax. + It's used to add single or multi-line comments. The content of the comments + isn't included in the rendered pages. Twig also contains **filters**, which modify content before being rendered. The following makes the ``title`` variable all uppercase before rendering diff --git a/book/testing.rst b/book/testing.rst index 9876bce5e5d..d757d1c460c 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -525,31 +525,28 @@ selects the last one on the page, and then selects its immediate parent element: Many other methods are also available: -+------------------------+----------------------------------------------------+ -| Method | Description | -+========================+====================================================+ -| ``filter('h1.title')`` | Nodes that match the CSS selector | -+------------------------+----------------------------------------------------+ -| ``filterXpath('h1')`` | Nodes that match the XPath expression | -+------------------------+----------------------------------------------------+ -| ``eq(1)`` | Node for the specified index | -+------------------------+----------------------------------------------------+ -| ``first()`` | First node | -+------------------------+----------------------------------------------------+ -| ``last()`` | Last node | -+------------------------+----------------------------------------------------+ -| ``siblings()`` | Siblings | -+------------------------+----------------------------------------------------+ -| ``nextAll()`` | All following siblings | -+------------------------+----------------------------------------------------+ -| ``previousAll()`` | All preceding siblings | -+------------------------+----------------------------------------------------+ -| ``parents()`` | Returns the parent nodes | -+------------------------+----------------------------------------------------+ -| ``children()`` | Returns children nodes | -+------------------------+----------------------------------------------------+ -| ``reduce($lambda)`` | Nodes for which the callable does not return false | -+------------------------+----------------------------------------------------+ +``filter('h1.title')`` + Nodes that match the CSS selector. +``filterXpath('h1')`` + Nodes that match the XPath expression. +``eq(1)`` + Node for the specified index. +``first()`` + First node. +``last()`` + Last node. +``siblings()`` + Siblings. +``nextAll()`` + All following siblings. +``previousAll()`` + All preceding siblings. +``parents()`` + Returns the parent nodes. +``children()`` + Returns children nodes. +``reduce($lambda)`` + Nodes for which the callable does not return false. Since each of these methods returns a new ``Crawler`` instance, you can narrow down your node selection by chaining the method calls:: diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 059debb6dc6..6475fab2c0a 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -90,47 +90,47 @@ instance (or a sub-class of), which is a data holder class: All :class:`Symfony\\Component\\HttpFoundation\\ParameterBag` instances have methods to retrieve and update its data: -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::all`: Returns - the parameters; +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::all` + Returns the parameters. -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::keys`: Returns - the parameter keys; +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::keys` + Returns the parameter keys. -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::replace`: - Replaces the current parameters by a new set; +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::replace` + Replaces the current parameters by a new set. -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::add`: Adds - parameters; +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::add` + Adds parameters. -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::get`: Returns a - parameter by name; +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::get` + Returns a parameter by name. -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::set`: Sets a - parameter by name; +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::set` + Sets a parameter by name. -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::has`: Returns - ``true`` if the parameter is defined; +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::has` + Returns ``true`` if the parameter is defined. -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::remove`: Removes - a parameter. +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::remove` + Removes a parameter. The :class:`Symfony\\Component\\HttpFoundation\\ParameterBag` instance also has some methods to filter the input values: -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::getAlpha`: Returns - the alphabetic characters of the parameter value; +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::getAlpha` + Returns the alphabetic characters of the parameter value; -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::getAlnum`: Returns - the alphabetic characters and digits of the parameter value; +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::getAlnum` + Returns the alphabetic characters and digits of the parameter value; -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::getDigits`: Returns - the digits of the parameter value; +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::getDigits` + Returns the digits of the parameter value; -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::getInt`: Returns the - parameter value converted to integer; +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::getInt` + Returns the parameter value converted to integer; -* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::filter`: Filters the - parameter by using the PHP :phpfunction:`filter_var` function. +:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::filter` + Filters the parameter by using the PHP :phpfunction:`filter_var` function. All getters takes up to three arguments: the first one is the parameter name and the second one is the default value to return if the parameter does not @@ -241,14 +241,14 @@ Accessing `Accept-*` Headers Data You can easily access basic data extracted from ``Accept-*`` headers by using the following methods: -* :method:`Symfony\\Component\\HttpFoundation\\Request::getAcceptableContentTypes`: - returns the list of accepted content types ordered by descending quality; +:method:`Symfony\\Component\\HttpFoundation\\Request::getAcceptableContentTypes` + Returns the list of accepted content types ordered by descending quality. -* :method:`Symfony\\Component\\HttpFoundation\\Request::getLanguages`: - returns the list of accepted languages ordered by descending quality; +:method:`Symfony\\Component\\HttpFoundation\\Request::getLanguages` + Returns the list of accepted languages ordered by descending quality. -* :method:`Symfony\\Component\\HttpFoundation\\Request::getCharsets`: - returns the list of accepted charsets ordered by descending quality. +:method:`Symfony\\Component\\HttpFoundation\\Request::getCharsets` + Returns the list of accepted charsets ordered by descending quality. .. versionadded:: 2.2 The :class:`Symfony\\Component\\HttpFoundation\\AcceptHeader` class was diff --git a/quick_tour/the_architecture.rst b/quick_tour/the_architecture.rst index 8e353c6ccd1..f8e947dae75 100644 --- a/quick_tour/the_architecture.rst +++ b/quick_tour/the_architecture.rst @@ -13,10 +13,14 @@ Understanding the Directory Structure The directory structure of a Symfony :term:`application` is rather flexible, but the recommended structure is as follows: -* ``app/``: the application configuration, templates and translations; -* ``src/``: the project's PHP code; -* ``vendor/``: the third-party dependencies; -* ``web/``: the web root directory. +``app/`` + The application configuration, templates and translations. +``src/`` + The project's PHP code. +``vendor/`` + The third-party dependencies. +``web/`` + The web root directory. The ``web/`` Directory ~~~~~~~~~~~~~~~~~~~~~~ @@ -52,10 +56,11 @@ configuration and as such, it is stored in the ``app/`` directory. This class must implement two methods: -* ``registerBundles()`` must return an array of all bundles needed to run the - application, as explained in the next section; -* ``registerContainerConfiguration()`` loads the application configuration - (more on this later). +``registerBundles()`` + Must return an array of all bundles needed to run the application, as explained + in the next section. +``registerContainerConfiguration()`` + Loads the application configuration (more on this later). Autoloading is handled automatically via `Composer`_, which means that you can use any PHP class without doing anything at all! All dependencies diff --git a/quick_tour/the_view.rst b/quick_tour/the_view.rst index 2de45855636..975418f480d 100644 --- a/quick_tour/the_view.rst +++ b/quick_tour/the_view.rst @@ -18,14 +18,16 @@ A Twig template is a text file that can generate any type of content (HTML, CSS, JavaScript, XML, CSV, LaTeX, etc.) Twig elements are separated from the rest of the template contents using any of these delimiters: -* ``{{ ... }}``: prints the content of a variable or the result of evaluating an - expression; +``{{ ... }}`` + Prints the content of a variable or the result of evaluating an expression; -* ``{% ... %}``: controls the logic of the template; it is used for example to - execute ``for`` loops and ``if`` statements; +``{% ... %}`` + Controls the logic of the template; it is used for example to execute ``for`` + loops and ``if`` statements. -* ``{# ... #}``: allows including comments inside templates. Contrary to HTML - comments, they aren't included in the rendered template. +``{# ... #}`` + Allows including comments inside templates. Contrary to HTML comments, they + aren't included in the rendered template. Below is a minimal template that illustrates a few basics, using two variables ``page_title`` and ``navigation``, which would be passed into the template: From 3fd3963ed81e7458546d2747e23c6f0398c14ec8 Mon Sep 17 00:00:00 2001 From: Pedro Nofuentes Date: Tue, 2 Dec 2014 18:04:07 +0100 Subject: [PATCH 5/5] Changed to definition lists from Book section --- book/forms.rst | 27 +++++++------ book/http_cache.rst | 82 +++++++++++++++++++++----------------- book/http_fundamentals.rst | 38 +++++++++--------- book/internals.rst | 32 +++++++-------- book/templating.rst | 35 +++++++++------- book/validation.rst | 13 +++--- 6 files changed, 124 insertions(+), 103 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index dab0a3137f3..681ff57dc70 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -716,14 +716,16 @@ the correct values of a number of field options. And though you'll need to manually add your server-side validation, these field type options can then be guessed from that information. -* ``required``: The ``required`` option can be guessed based on the validation - rules (i.e. is the field ``NotBlank`` or ``NotNull``) or the Doctrine metadata - (i.e. is the field ``nullable``). This is very useful, as your client-side - validation will automatically match your validation rules. +``required`` + The ``required`` option can be guessed based on the validation rules (i.e. is + the field ``NotBlank`` or ``NotNull``) or the Doctrine metadata (i.e. is the + field ``nullable``). This is very useful, as your client-side validation will + automatically match your validation rules. -* ``max_length``: If the field is some sort of text field, then the ``max_length`` - option can be guessed from the validation constraints (if ``Length`` or - ``Range`` is used) or from the Doctrine metadata (via the field's length). +``max_length`` + If the field is some sort of text field, then the ``max_length`` option can be + guessed from the validation constraints (if ``Length`` or ``Range`` is used) or + from the Doctrine metadata (via the field's length). .. note:: @@ -771,12 +773,13 @@ of code. Of course, you'll usually need much more flexibility when rendering: You already know the ``form_start()`` and ``form_end()`` functions, but what do the other functions do? -* ``form_errors(form)`` - Renders any errors global to the whole form - (field-specific errors are displayed next to each field); +``form_errors(form)`` + Renders any errors global to the whole form (field-specific errors are displayed + next to each field). -* ``form_row(form.dueDate)`` - Renders the label, any errors, and the HTML - form widget for the given field (e.g. ``dueDate``) inside, by default, a - ``div`` element. +``form_row(form.dueDate)`` + Renders the label, any errors, and the HTML form widget for the given field + (e.g. ``dueDate``) inside, by default, a ``div`` element. The majority of the work is done by the ``form_row`` helper, which renders the label, errors and HTML form widget of each field inside a ``div`` tag by diff --git a/book/http_cache.rst b/book/http_cache.rst index 46e80ed4e73..1a41d2bb422 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -202,34 +202,39 @@ method:: Here is a list of the main options: -* ``default_ttl``: The number of seconds that a cache entry should be - considered fresh when no explicit freshness information is provided in a - response. Explicit ``Cache-Control`` or ``Expires`` headers override this - value (default: ``0``); - -* ``private_headers``: Set of request headers that trigger "private" - ``Cache-Control`` behavior on responses that don't explicitly state whether - the response is ``public`` or ``private`` via a ``Cache-Control`` directive. - (default: ``Authorization`` and ``Cookie``); - -* ``allow_reload``: Specifies whether the client can force a cache reload by - including a ``Cache-Control`` "no-cache" directive in the request. Set it to - ``true`` for compliance with RFC 2616 (default: ``false``); - -* ``allow_revalidate``: Specifies whether the client can force a cache - revalidate by including a ``Cache-Control`` "max-age=0" directive in the - request. Set it to ``true`` for compliance with RFC 2616 (default: false); - -* ``stale_while_revalidate``: Specifies the default number of seconds (the - granularity is the second as the Response TTL precision is a second) during - which the cache can immediately return a stale response while it revalidates - it in the background (default: ``2``); this setting is overridden by the - ``stale-while-revalidate`` HTTP ``Cache-Control`` extension (see RFC 5861); - -* ``stale_if_error``: Specifies the default number of seconds (the granularity - is the second) during which the cache can serve a stale response when an - error is encountered (default: ``60``). This setting is overridden by the - ``stale-if-error`` HTTP ``Cache-Control`` extension (see RFC 5861). +``default_ttl`` + The number of seconds that a cache entry should be considered fresh when no + explicit freshness information is provided in a response. Explicit + ``Cache-Control`` or ``Expires`` headers override this value (default: ``0``). + +``private_headers`` + Set of request headers that trigger "private" ``Cache-Control`` behavior on + responses that don't explicitly state whether the response is ``public`` or + ``private`` via a ``Cache-Control`` directive (default: ``Authorization`` + and ``Cookie``). + +``allow_reload`` + Specifies whether the client can force a cache reload by including a + ``Cache-Control`` "no-cache" directive in the request. Set it to ``true`` for + compliance with RFC 2616 (default: ``false``). + +``allow_revalidate`` + Specifies whether the client can force a cache revalidate by including a + ``Cache-Control`` "max-age=0" directive in the request. Set it to ``true`` for + compliance with RFC 2616 (default: false). + +``stale_while_revalidate`` + Specifies the default number of seconds (the granularity is the second as the + Response TTL precision is a second) during which the cache can immediately + return a stale response while it revalidates it in the background (default: + ``2``); this setting is overridden by the ``stale-while-revalidate`` HTTP + ``Cache-Control`` extension (see RFC 5861). + +``stale_if_error`` + Specifies the default number of seconds (the granularity is the second) during + which the cache can serve a stale response when an error is encountered + (default: ``60``). This setting is overridden by the ``stale-if-error`` HTTP + ``Cache-Control`` extension (see RFC 5861). If ``debug`` is ``true``, Symfony automatically adds a ``X-Symfony-Cache`` header to the response containing useful information about cache hits and @@ -339,11 +344,12 @@ and then returned to every subsequent user who asked for their account page! To handle this situation, every response may be set to be public or private: -* *public*: Indicates that the response may be cached by both private and - shared caches; +*public* + Indicates that the response may be cached by both private and shared caches. -* *private*: Indicates that all or part of the response message is intended - for a single user and must not be cached by a shared cache. +*private* + Indicates that all or part of the response message is intended for a single + user and must not be cached by a shared cache. Symfony conservatively defaults each response to be private. To take advantage of shared caches (like the Symfony reverse proxy), the response will need @@ -1033,12 +1039,14 @@ possible. The ``render_esi`` helper supports two other useful options: -* ``alt``: used as the ``alt`` attribute on the ESI tag, which allows you - to specify an alternative URL to be used if the ``src`` cannot be found; +``alt`` + Used as the ``alt`` attribute on the ESI tag, which allows you to specify an + alternative URL to be used if the ``src`` cannot be found. -* ``ignore_errors``: if set to true, an ``onerror`` attribute will be added - to the ESI with a value of ``continue`` indicating that, in the event of - a failure, the gateway cache will simply remove the ESI tag silently. +``ignore_errors`` + If set to true, an ``onerror`` attribute will be added to the ESI with a value + of ``continue`` indicating that, in the event of a failure, the gateway cache + will simply remove the ESI tag silently. .. index:: single: Cache; Invalidation diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index eaadacff92f..b49729183f7 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -515,30 +515,32 @@ libraries that can be used inside *any* PHP project. These libraries, called the *Symfony Components*, contain something useful for almost any situation, regardless of how your project is developed. To name a few: -* :doc:`HttpFoundation ` - Contains - the ``Request`` and ``Response`` classes, as well as other classes for handling - sessions and file uploads; +:doc:`HttpFoundation ` + Contains the ``Request`` and ``Response`` classes, as well as other classes for + handling sessions and file uploads. -* :doc:`Routing ` - Powerful and fast routing system that - allows you to map a specific URI (e.g. ``/contact``) to some information - about how that request should be handled (e.g. execute the ``contactAction()`` - method); +:doc:`Routing ` + Powerful and fast routing system that allows you to map a specific URI + (e.g. ``/contact``) to some information about how that request should be handled + (e.g. execute the ``contactAction()`` method). -* :doc:`Form ` - A full-featured and flexible - framework for creating forms and handling form submissions; +:doc:`Form ` + A full-featured and flexible framework for creating forms and handling form + submissions. -* `Validator`_ - A system for creating rules about data and then validating - whether or not user-submitted data follows those rules; +`Validator`_ + A system for creating rules about data and then validating whether or not + user-submitted data follows those rules. -* :doc:`Templating ` - A toolkit for rendering - templates, handling template inheritance (i.e. a template is decorated with - a layout) and performing other common template tasks; +:doc:`Templating ` + A toolkit for rendering templates, handling template inheritance (i.e. a + template is decorated with a layout) and performing other common template tasks. -* :doc:`Security ` - A powerful library for - handling all types of security inside an application; +:doc:`Security ` + A powerful library for handling all types of security inside an application. -* :doc:`Translation ` - A framework for - translating strings in your application. +:doc:`Translation ` + A framework for translating strings in your application. Each and every one of these components is decoupled and can be used in *any* PHP project, regardless of whether or not you use the Symfony framework. diff --git a/book/internals.rst b/book/internals.rst index e5492ced478..87bae69895d 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -212,15 +212,15 @@ Each event thrown by the Kernel is a subclass of :class:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent`. This means that each event has access to the same basic information: -* :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getRequestType` - - returns the *type* of the request (``HttpKernelInterface::MASTER_REQUEST`` - or ``HttpKernelInterface::SUB_REQUEST``); +:method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getRequestType` + Returns the *type* of the request (``HttpKernelInterface::MASTER_REQUEST`` or + ``HttpKernelInterface::SUB_REQUEST``). -* :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getKernel` - - returns the Kernel handling the request; +:method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getKernel` + Returns the Kernel handling the request. -* :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getRequest` - - returns the current ``Request`` being handled. +:method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getRequest` + Returns the current ``Request`` being handled. ``getRequestType()`` .................... @@ -347,18 +347,18 @@ The purpose of this event is to allow other systems to modify or replace the The FrameworkBundle registers several listeners: -* :class:`Symfony\\Component\\HttpKernel\\EventListener\\ProfilerListener`: - collects data for the current request; +:class:`Symfony\\Component\\HttpKernel\\EventListener\\ProfilerListener` + Collects data for the current request. -* :class:`Symfony\\Bundle\\WebProfilerBundle\\EventListener\\WebDebugToolbarListener`: - injects the Web Debug Toolbar; +:class:`Symfony\\Bundle\\WebProfilerBundle\\EventListener\\WebDebugToolbarListener` + Injects the Web Debug Toolbar. -* :class:`Symfony\\Component\\HttpKernel\\EventListener\\ResponseListener`: fixes the - Response ``Content-Type`` based on the request format; +:class:`Symfony\\Component\\HttpKernel\\EventListener\\ResponseListener` + Fixes the Response ``Content-Type`` based on the request format. -* :class:`Symfony\\Component\\HttpKernel\\EventListener\\EsiListener`: adds a - ``Surrogate-Control`` HTTP header when the Response needs to be parsed for - ESI tags. +:class:`Symfony\\Component\\HttpKernel\\EventListener\\EsiListener` + Adds a ``Surrogate-Control`` HTTP header when the Response needs to be parsed + for ESI tags. .. seealso:: diff --git a/book/templating.rst b/book/templating.rst index 46dfde2e906..dd2cb88300b 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -384,15 +384,16 @@ Template Naming and Locations By default, templates can live in two different locations: -* ``app/Resources/views/``: The applications ``views`` directory can contain - application-wide base templates (i.e. your application's layouts and - templates of the application bundle) as well as templates that override - third party bundle templates (see :ref:`overriding-bundle-templates`); +``app/Resources/views/`` + The applications ``views`` directory can contain application-wide base templates + (i.e. your application's layouts and templates of the application bundle) as + well as templates that override third party bundle templates + (see :ref:`overriding-bundle-templates`). -* ``path/to/bundle/Resources/views/``: Each third party bundle houses its - templates in its ``Resources/views/`` directory (and subdirectories). When you - plan to share your bundle, you should put the templates in the bundle instead - of the ``app/`` directory. +``path/to/bundle/Resources/views/`` + Each third party bundle houses its templates in its ``Resources/views/`` + directory (and subdirectories). When you plan to share your bundle, you should + put the templates in the bundle instead of the ``app/`` directory. Most of the templates you'll use live in the ``app/Resources/views/`` directory. The path you'll use will be relative to this directory. For example, @@ -1123,12 +1124,18 @@ is a :class:`Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables` instance which will give you access to some application specific variables automatically: -* ``app.security`` - The security context. -* ``app.user`` - The current user object. -* ``app.request`` - The request object. -* ``app.session`` - The session object. -* ``app.environment`` - The current environment (dev, prod, etc). -* ``app.debug`` - True if in debug mode. False otherwise. +``app.security`` + The security context. +``app.user`` + The current user object. +``app.request`` + The request object. +``app.session`` + The session object. +``app.environment`` + The current environment (dev, prod, etc). +``app.debug`` + True if in debug mode. False otherwise. .. configuration-block:: diff --git a/book/validation.rst b/book/validation.rst index 0cd59ae5aea..43d231ec393 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -809,14 +809,15 @@ user registers and when a user updates their contact information later: With this configuration, there are three validation groups: -* ``Default`` - contains the constraints in the current class and all - referenced classes that belong to no other group; +``Default`` + Contains the constraints in the current class and all referenced classes + that belong to no other group. -* ``User`` - equivalent to all constraints of the ``User`` object in the - ``Default`` group; +``User`` + Equivalent to all constraints of the ``User`` object in the ``Default`` group. -* ``registration`` - contains the constraints on the ``email`` and ``password`` - fields only. +``registration`` + Contains the constraints on the ``email`` and ``password`` fields only. To tell the validator to use a specific group, pass one or more group names as the second argument to the ``validate()`` method::