Skip to content

Commit

Permalink
[docs] Don't allow [source,javascript]
Browse files Browse the repository at this point in the history
The syntax highlighter doesn't support it. Just use `js`.
  • Loading branch information
nik9000 committed Aug 12, 2016
1 parent ffd226e commit 7542ef3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/discovery-azure-classic.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ curl http://localhost:9200/

This command should give you a JSON result:

[source,javascript]
[source,js]
----
{
"status" : 200,
Expand Down

0 comments on commit 7542ef3

Please sign in to comment.