Skip to content

Commit 8b4cbc2

Browse files
committed
add latex and markdown magics to robot notebook
1 parent cb3586e commit 8b4cbc2

File tree

7 files changed

+64
-13
lines changed

7 files changed

+64
-13
lines changed

atest/03_Notebook.robot

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,19 @@ Python
1212
Capture Page Screenshot 02-python.png
1313
Clean Up After Working With File Python.ipynb
1414

15-
Foregin Extractors
16-
Setup Notebook Python Foreign extractors.ipynb
15+
Foreign Extractors
16+
${file} = Set Variable Foreign extractors.ipynb
17+
Configure JupyterLab Plugin {"language_servers": {"texlab": {"serverSettings": {"latex.lint.onChange": true}}}}
18+
Setup Notebook Python ${file}
1719
# if mypy and pyflakes will fight over `(N|n)ame 'valid'`, just hope for the best
18-
@{diagnostics} = Create List Failed to parse expression ame 'valid' Trailing whitespace is superfluous.
20+
@{diagnostics} = Create List
21+
... Failed to parse expression # bash
22+
... ame 'valid' # python
23+
... Trailing whitespace is superfluous. # r
24+
... `frob` is misspelt # markdown
25+
... Command terminated with space # latex
1926
FOR ${diagnostic} IN @{diagnostics}
2027
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title*\="${diagnostic}"] timeout=35s
2128
Capture Page Screenshot 0x-${diagnostic}.png
2229
END
23-
Clean Up After Working With File Foreign Extractors.ipynb
30+
[Teardown] Clean Up After Working with File and Settings ${file}

atest/07_Configuration.robot

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Markdown
2727
... `Colour` is misspelt
2828

2929
LaTeX
30-
[Tags] FOO
3130
[Documentation] diagnostics only appear if configured
3231
Settings Should Change Editor Diagnostics LaTeX example.tex texlab
3332
... {"latex.lint.onChange": true}
@@ -36,11 +35,6 @@ LaTeX
3635
... Save File
3736

3837
*** Keywords ***
39-
Clean Up After Working with File and Settings
40-
[Arguments] ${file}
41-
Clean Up After Working With File ${file}
42-
Reset Plugin Settings
43-
4438
Settings Should Change Editor Diagnostics
4539
[Arguments] ${language} ${file} ${server} ${settings} ${before} ${after} ${save command}=${EMPTY}
4640
${before diagnostic} = Set Variable ${CSS DIAGNOSTIC}\[title^="${before}"]
@@ -62,7 +56,7 @@ Settings Should Change Editor Diagnostics
6256
Wait Until Page Contains No errors found
6357
Capture Page Screenshot 02-default-diagnostics-and-unsaved-settings.png
6458
Click Element css:button[title\='Save User Settings']
65-
Click Element ${JLAB XP DOCK TAB}\[contains(., 'Settings')]/${close icon}
59+
Click Element ${JLAB XP CLOSE SETTINGS}
6660
Drag and Drop By Offset ${tab} 0 100
6761
Lab Command ${save command}
6862
Ensure Sidebar Is Closed

atest/Keywords.robot

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,16 @@ Get Editor Content
286286
[Arguments] ${css}=${EMPTY}
287287
${content} = Execute JavaScript return document.querySelector('${css} .CodeMirror').CodeMirror.getValue()
288288
[Return] ${content}
289+
290+
Configure JupyterLab Plugin
291+
[Arguments] ${settings json} ${plugin id}=${LSP PLUGIN ID}
292+
Open in Advanced Settings ${plugin id}
293+
Set Editor Content ${settings json} ${CSS USER SETTINGS}
294+
Wait Until Page Contains No errors found
295+
Click Element css:button[title\='Save User Settings']
296+
Click Element ${JLAB XP CLOSE SETTINGS}
297+
298+
Clean Up After Working with File and Settings
299+
[Arguments] ${file}
300+
Clean Up After Working With File ${file}
301+
Reset Plugin Settings

atest/Variables.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ ${CM CURSORS} css:.CodeMirror-cursors:not([style='visibility: hidden'])
3535
${LSP PLUGIN ID} @krassowski/jupyterlab-lsp:plugin
3636
${LSP PLUGIN SETTINGS FILE} @krassowski${/}jupyterlab-lsp${/}plugin.jupyterlab-settings
3737
${CSS USER SETTINGS} .jp-SettingsRawEditor-user
38+
${JLAB XP CLOSE SETTINGS} ${JLAB XP DOCK TAB}\[contains(., 'Settings')]/*[contains(@class, 'm-TabBar-tabCloseIcon')]
3839
# diagnostics
3940
${CSS DIAGNOSTIC} css:.cm-lsp-diagnostic
4041
# log messages

atest/examples/Foreign extractors.ipynb

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,41 @@
6666
"%%bash\n",
6767
"echo $"
6868
]
69+
},
70+
{
71+
"cell_type": "markdown",
72+
"metadata": {},
73+
"source": [
74+
"### $\\LaTeX$"
75+
]
76+
},
77+
{
78+
"cell_type": "code",
79+
"execution_count": null,
80+
"metadata": {},
81+
"outputs": [],
82+
"source": [
83+
"%%latex\n",
84+
"\n",
85+
"\\foo bar"
86+
]
87+
},
88+
{
89+
"cell_type": "markdown",
90+
"metadata": {},
91+
"source": [
92+
"### Markdown"
93+
]
94+
},
95+
{
96+
"cell_type": "code",
97+
"execution_count": null,
98+
"metadata": {},
99+
"outputs": [],
100+
"source": [
101+
"%%markdown\n",
102+
"frob"
103+
]
69104
}
70105
],
71106
"metadata": {
@@ -84,7 +119,7 @@
84119
"name": "python",
85120
"nbconvert_exporter": "python",
86121
"pygments_lexer": "ipython3",
87-
"version": "3.8.0"
122+
"version": "3.7.6"
88123
}
89124
},
90125
"nbformat": 4,

packages/jupyterlab-lsp/src/extractors/defaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export let foreign_code_extractors: IForeignCodeExtractorsRegistry = {
112112
pattern: '^%%(latex)( .*?)?\n([^]*)',
113113
extract_to_foreign: '$3',
114114
is_standalone: false,
115-
file_extension: 'latex'
115+
file_extension: 'tex'
116116
}),
117117
new RegExpForeignCodeExtractor({
118118
language: 'markdown',

scripts/lint.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"TooFewTestSteps:1",
3030
"TooManyTestSteps:30",
3131
"TooManyTestCases:30",
32+
"FileTooLong:400",
3233
]
3334

3435
RFLINT_IGNORES = [

0 commit comments

Comments
 (0)