Skip to content

Commit 8901ad2

Browse files
committed
minor #7939 Update twig_reference.rst (raulconti, javiereguiluz)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #7939). Discussion ---------- Update twig_reference.rst Fix some doc errors https://github.com/symfony/twig-bridge/blob/master/Extension/CodeExtension.php Commits ------- c2033c9 Minor reword f67762d Update twig_reference.rst
2 parents ff14308 + c2033c9 commit 8901ad2

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

reference/twig_reference.rst

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -595,14 +595,18 @@ file_excerpt
595595

596596
.. code-block:: twig
597597
598-
{{ file|file_excerpt(line = null) }}
598+
{{ file|file_excerpt(line, srcContext = 3) }}
599599
600600
``file``
601601
**type**: ``string``
602-
``line`` *(optional)*
602+
``line``
603+
**type**: ``integer``
604+
``srcContext`` *(optional)*
603605
**type**: ``integer``
604606

605-
Generates an excerpt of seven lines around the given ``line``.
607+
Generates an excerpt of a code file around the given ``line`` number. The
608+
``srcContext`` argument defines the total number of lines to display around the
609+
given line number (use ``-1`` to display the whole file).
606610

607611
format_file
608612
~~~~~~~~~~~
@@ -639,12 +643,14 @@ file_link
639643

640644
.. code-block:: twig
641645
642-
{{ file|file_link(line = null) }}
646+
{{ file|file_link(line) }}
643647
644-
``line`` *(optional)*
648+
``file``
649+
**type**: ``string``
650+
``line``
645651
**type**: ``integer``
646652

647-
Generates a link to the provided file (and optionally line number) using
653+
Generates a link to the provided file and line number using
648654
a preconfigured scheme.
649655

650656
.. _reference-twig-tags:

0 commit comments

Comments
 (0)