Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ for `Robot Framework <http://robotframework.org>`_ test data in plain
text format. It is available as a separate plugin and *included in
Pygments 1.6 and newer*.

This version will be available not before

What is Pygments
----------------

Expand Down Expand Up @@ -57,7 +59,21 @@ script for an example of the programmatic usage. For general information about
using Pygments, consult `its documentation <http://pygments.org/docs/>`_ and/or
the documentation of the tool you are using it with.

Alternative Usage
-----------------

You can use ``robotframeworklexer.py`` as a custom lexer in ``pygments``. See the documentation
of ``pygments`` for more information. Below, are two examples applied to the test suite `example.robot <file:///./example.robot>`_.

.. code:: bash

python -m pygments -l ./robotframeworklexer.py:RobotFrameworkLexer -x -o example.png -f png ./example.robot
# result: `<file:///./example.png>`_

python -m pygments -l ./robotframeworklexer.py:RobotFrameworkLexer -x -o example.txt -f raw ./example.robot
# result: `<file:///./example.txt>`_

License
-------

`Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0.html>`_.
`Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0.html>`_.
Binary file added example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 54 additions & 9 deletions example.robot
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
*** Settings ***
Documentation Simple example demonstrating syntax highlighting.
Library ExampleLibrary
Test Setup Keyword argument argument with ${VARIABLE}
Documentation Simple example demonstrating syntax highlighting.
Test Setup Keyword argument argument with ${VARIABLE}
Library Process

*** Variables ***
${VARIABLE} Variable value
@{LIST} List variable here
&{DICT} Key1=Value1 Key2=Value2
${VARIABLE} Variable value
@{LIST} List variable here
&{DICT} Key1=Value1 Key2=Value2

*** Test Cases ***
Keyword-driven example
Expand All @@ -17,7 +17,7 @@ Keyword-driven example

Data-driven example
[Template] Keyword
argument1 argument2
argument1 argument2
argument ${VARIABLE}
@{LIST}

Expand All @@ -30,12 +30,57 @@ Gherkin
| | [Documentation] | Also pipe separated format is supported. |
| | Log | As this example demonstrates. |

*** Comments ***
This is a section of comments.
We can have many lines without any comment marker.

*** Keywords ***
Result Should Be
[Arguments] ${expected}
[Tags] whatever
${actual} = Get Value
[Tags] whatever
${actual} = Get Value ${expected}
Should be Equal ${actual} ${expected}

Then result should be "${expected}"
Result Should Be ${expected}

System is initialized
# This is a single line comment
Initialize System

something is done
Do Something

Keyword
[Arguments] ${arg1} ${arg2} ${arg3}=${EMPTY}
IF "${arg1}" == "${arg2}"
Log Equal Arguments
ELSE IF "${arg1}" == "argument1"
Log arg1 is equal to argument1
ELSE
FOR ${idx} IN RANGE 4
IF ${idx} == 3 BREAK
Log ${\n}arg${idx+1} = ${arg${idx+1}} console=True
END
END

Initialize System
Log System initialized

Do Something
Run Keywords Log Done
... AND No Operation

Cleanup System
TRY
Log %{HOME}
EXCEPT
Log To Console \%{HOME} does not exist
ELSE
Log To Console \%{HOME} exists
END
Log System cleaned

Get Value
[Arguments] ${arg1}=42
RETURN ${arg1}
Loading