Skip to content

Commit

Permalink
Add Robot Framework (.robot) -language support
Browse files Browse the repository at this point in the history
  • Loading branch information
datakurre committed Nov 8, 2019
1 parent 700f03a commit 45ad485
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jupytext/languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Jupyter magic commands that are also languages
_JUPYTER_LANGUAGES = ['R', 'bash', 'sh', 'python', 'python2', 'python3', 'javascript', 'js', 'perl',
'html', 'latex', 'markdown', 'pypy', 'ruby', 'script', 'svg',
'matlab', 'octave', 'idl', 'spark', 'sql']
'matlab', 'octave', 'idl', 'robotframework', 'spark', 'sql']

# Supported file extensions (and languages)
# Please add more languages here (and add a few tests) - see CONTRIBUTING.md
Expand All @@ -23,7 +23,8 @@
'.js': {'language': 'javascript', 'comment': '//'},
'.ts': {'language': 'typescript', 'comment': '//'},
'.scala': {'language': 'scala', 'comment': '//'},
'.rs': {'language': 'rust', 'comment': '//'}}
'.rs': {'language': 'rust', 'comment': '//'},
'.robot': {'language': 'robotframework', 'comment': '#'}}

_COMMENT_CHARS = [_SCRIPT_EXTENSIONS[ext]['comment'] for ext in _SCRIPT_EXTENSIONS if
_SCRIPT_EXTENSIONS[ext]['comment'] != '#']
Expand Down
70 changes: 70 additions & 0 deletions tests/notebooks/ipynb_robot/simple_robot_notebook.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"*** Settings ***\n",
"\n",
"Library Collections"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"*** Keywords ***\n",
"\n",
"Head\n",
" [Arguments] ${list}\n",
" ${value}= Get from list ${list} 0\n",
" [Return] ${value}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"lines_to_next_cell": 0
},
"outputs": [],
"source": [
"*** Tasks ***\n",
"\n",
"Get head\n",
" ${array}= Create list 1 2 3 4 5\n",
" ${head}= Head ${array}\n",
" Should be equal ${head} 1"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Robot Framework",
"language": "robotframework",
"name": "robotkernel"
},
"language_info": {
"codemirror_mode": "robotframework",
"file_extension": ".robot",
"mimetype": "text/plain",
"name": "robotframework",
"pygments_lexer": "robotframework"
},
"pycharm": {
"stem_cell": {
"cell_type": "raw",
"source": [],
"metadata": {
"collapsed": false
}
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
10 changes: 10 additions & 0 deletions tests/test_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,13 @@ def test_ipynb_to_scheme_percent(nb_file, extension, no_jupytext_version_number)
assert_conversion_same_as_mirror(nb_file,
'{}:percent'.format(extension),
'ipynb_to_percent')


@pytest.mark.parametrize('nb_file', list_notebooks('ipynb_robot'))
def test_ipynb_to_robot_light(nb_file, no_jupytext_version_number):
assert_conversion_same_as_mirror(nb_file, 'auto', 'ipynb_to_script')


@pytest.mark.parametrize('nb_file', list_notebooks('ipynb_robot'))
def test_ipynb_to_robot_percent(nb_file, no_jupytext_version_number):
assert_conversion_same_as_mirror(nb_file, 'auto:percent', 'ipynb_to_percent')

0 comments on commit 45ad485

Please sign in to comment.