[docs] Don't allow `[source,javascript]`

The syntax highlighter doesn't support it. Just use `js`.
This commit is contained in:
Nik Everett 2016-08-12 17:08:43 -04:00
parent ffd226efa0
commit 7542ef3173
3 changed files with 11 additions and 5 deletions

View File

@ -48,8 +48,8 @@ public class DocsTestPlugin extends RestTestPlugin {
return
}
List<String> languages = [
// These languages should almost always be marked console
'js', 'json',
// This language should almost always be marked console
'js',
// These are often curl commands that should be converted but
// are probably false positives
'sh', 'shell',

View File

@ -32,6 +32,12 @@ import java.util.regex.Matcher
* Generates REST tests for each snippet marked // TEST.
*/
public class RestTestsFromSnippetsTask extends SnippetsTask {
/**
* These languages aren't supported by the syntax highlighter so we
* shouldn't use them.
*/
private static final List BAD_LANGUAGES = ['json', 'javascript']
@Input
Map<String, String> setups = new HashMap()
@ -87,9 +93,9 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {
* calls buildTest to actually build the test.
*/
void handleSnippet(Snippet snippet) {
if (snippet.language == 'json') {
if (BAD_LANGUAGES.contains(snippet.language)) {
throw new InvalidUserDataException(
"$snippet: Use `js` instead of `json`.")
"$snippet: Use `js` instead of `${snippet.language}`.")
}
if (snippet.testSetup) {
setup(snippet)

View File

@ -387,7 +387,7 @@ curl http://localhost:9200/
This command should give you a JSON result:
[source,javascript]
[source,js]
----
{
"status" : 200,