-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Robot Framework plain text format (#2034)
This adds support for the Robot Framework plain text space separated format. https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#plain-text-format
- Loading branch information
1 parent
3fda5c9
commit f7eaa61
Showing
16 changed files
with
865 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
(function (Prism) { | ||
|
||
var comment = { | ||
pattern: /(^[ \t]*| {2}|\t)#.*/m, | ||
lookbehind: true, | ||
greedy: true | ||
}; | ||
|
||
var variable = { | ||
pattern: /((?:^|[^\\])(?:\\{2})*)[$@&%]\{(?:[^{}\r\n]|\{[^{}\r\n]*\})*\}/, | ||
lookbehind: true, | ||
inside: { | ||
'punctuation': /^[$@&%]\{|\}$/ | ||
} | ||
}; | ||
|
||
function createSection(name, inside) { | ||
var extendecInside = {}; | ||
|
||
extendecInside['section-header'] = { | ||
pattern: /^ ?\*{3}.+?\*{3}/, | ||
alias: 'keyword' | ||
}; | ||
|
||
// copy inside tokens | ||
for (var token in inside) { | ||
extendecInside[token] = inside[token]; | ||
} | ||
|
||
extendecInside['tag'] = { | ||
pattern: /([\r\n](?: |\t)[ \t]*)\[[-\w]+\]/, | ||
lookbehind: true, | ||
inside: { | ||
'punctuation': /\[|\]/ | ||
} | ||
}; | ||
extendecInside['variable'] = variable; | ||
extendecInside['comment'] = comment; | ||
|
||
return { | ||
pattern: RegExp(/^ ?\*{3}[ \t]*<name>[ \t]*\*{3}(?:.|[\r\n](?!\*{3}))*/.source.replace(/<name>/g, name), 'im'), | ||
alias: 'section', | ||
inside: extendecInside | ||
}; | ||
} | ||
|
||
|
||
var docTag = { | ||
pattern: /(\[Documentation\](?: |\t)[ \t]*)(?![ \t]|#)(?:.|[ \t]*(?:\r\n?|\n)[ \t]*\.{3}[ \t]*)+/, | ||
lookbehind: true, | ||
alias: 'string' | ||
}; | ||
|
||
var testNameLike = { | ||
pattern: /([\r\n] ?)(?!#)(?:\S(?:[ \t]\S)*)+/, | ||
lookbehind: true, | ||
alias: 'function', | ||
inside: { | ||
'variable': variable | ||
} | ||
}; | ||
|
||
var testPropertyLike = { | ||
pattern: /([\r\n](?: |\t)[ \t]*)(?!\[|\.{3}|#)(?:\S(?:[ \t]\S)*)+/, | ||
lookbehind: true, | ||
inside: { | ||
'variable': variable | ||
} | ||
}; | ||
|
||
Prism.languages['robot-framework'] = { | ||
'settings': createSection('Settings', { | ||
'documentation': { | ||
pattern: /([\r\n] ?Documentation(?: |\t)[ \t]*)(?![ \t]|#)(?:.|[ \t]*(?:\r\n?|\n)[ \t]*\.{3}[ \t]*)+/, | ||
lookbehind: true, | ||
alias: 'string' | ||
}, | ||
'property': { | ||
pattern: /([\r\n] ?)(?!\.{3}|#)(?:\S(?:[ \t]\S)*)+/, | ||
lookbehind: true | ||
} | ||
}), | ||
'variables': createSection('Variables'), | ||
'test-cases': createSection('Test Cases', { | ||
'test-name': testNameLike, | ||
'documentation': docTag, | ||
'property': testPropertyLike | ||
}), | ||
'keywords': createSection('Keywords', { | ||
'keyword-name': testNameLike, | ||
'documentation': docTag, | ||
'property': testPropertyLike | ||
}), | ||
'tasks': createSection('Tasks', { | ||
'task-name': testNameLike, | ||
'documentation': docTag, | ||
'property': testPropertyLike | ||
}), | ||
'comment': comment | ||
}; | ||
|
||
Prism.languages.robot = Prism.languages['robot-framework']; | ||
|
||
}(Prism)); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<h2>Full example</h2> | ||
<pre><code>*** Settings *** | ||
Documentation Example using the space separated plain text format. | ||
Library OperatingSystem | ||
|
||
*** Variables *** | ||
${MESSAGE} Hello, world! | ||
|
||
*** Test Cases *** | ||
My Test | ||
[Documentation] Example test | ||
Log ${MESSAGE} | ||
My Keyword /tmp | ||
|
||
Another Test | ||
Should Be Equal ${MESSAGE} Hello, world! | ||
|
||
*** Keywords *** | ||
My Keyword | ||
[Arguments] ${path} | ||
Directory Should Exist ${path}</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.