Disable formatting of monospaced text in Asciidoctor templates
Previously, if text enclosed in ` characters contained multiple * characters, the *s would be removed and the characters they enclosed would become bold. This commit escapes the text by enclosing it in + characters in addition to the existing, enclosing ` characters. The `+text+` arrangement retains the monospace formatting be disables any further formatting of the text. Closes gh-474
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|Relation|Description
|
||||
|
||||
{{#links}}
|
||||
|{{#tableCellContent}}`{{rel}}`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`+{{rel}}+`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}{{description}}{{/tableCellContent}}
|
||||
|
||||
{{/links}}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|Parameter|Description
|
||||
|
||||
{{#parameters}}
|
||||
|{{#tableCellContent}}`{{name}}`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`+{{name}}+`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}{{description}}{{/tableCellContent}}
|
||||
|
||||
{{/parameters}}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|Path|Type|Description
|
||||
|
||||
{{#fields}}
|
||||
|{{#tableCellContent}}`{{path}}`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`{{type}}`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`+{{path}}+`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`+{{type}}+`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}{{description}}{{/tableCellContent}}
|
||||
|
||||
{{/fields}}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|Name|Description
|
||||
|
||||
{{#headers}}
|
||||
|{{#tableCellContent}}`{{name}}`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`+{{name}}+`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}{{description}}{{/tableCellContent}}
|
||||
|
||||
{{/headers}}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|Parameter|Description
|
||||
|
||||
{{#parameters}}
|
||||
|{{#tableCellContent}}`{{name}}`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`+{{name}}+`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}{{description}}{{/tableCellContent}}
|
||||
|
||||
{{/parameters}}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|Path|Type|Description
|
||||
|
||||
{{#fields}}
|
||||
|{{#tableCellContent}}`{{path}}`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`{{type}}`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`+{{path}}+`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`+{{type}}+`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}{{description}}{{/tableCellContent}}
|
||||
|
||||
{{/fields}}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|Part|Description
|
||||
|
||||
{{#requestParts}}
|
||||
|{{#tableCellContent}}`{{name}}`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`+{{name}}+`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}{{description}}{{/tableCellContent}}
|
||||
|
||||
{{/requestParts}}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|Path|Type|Description
|
||||
|
||||
{{#fields}}
|
||||
|{{#tableCellContent}}`{{path}}`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`{{type}}`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`+{{path}}+`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`+{{type}}+`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}{{description}}{{/tableCellContent}}
|
||||
|
||||
{{/fields}}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|Name|Description
|
||||
|
||||
{{#headers}}
|
||||
|{{#tableCellContent}}`{{name}}`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}`+{{name}}+`{{/tableCellContent}}
|
||||
|{{#tableCellContent}}{{description}}{{/tableCellContent}}
|
||||
|
||||
{{/headers}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -335,12 +335,19 @@ public final class SnippetMatchers {
|
||||
@Override
|
||||
public AsciidoctorTableMatcher row(String... entries) {
|
||||
for (String entry : entries) {
|
||||
this.addLine(-1, "|" + entry);
|
||||
this.addLine(-1, "|" + escapeEntry(entry));
|
||||
}
|
||||
this.addLine(-1, "");
|
||||
return this;
|
||||
}
|
||||
|
||||
private String escapeEntry(String entry) {
|
||||
if (entry.startsWith("`") && entry.endsWith("`")) {
|
||||
return "`+" + entry.substring(1, entry.length() - 1) + "+`";
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsciidoctorTableMatcher configuration(String configuration) {
|
||||
this.addLine(0, configuration);
|
||||
|
||||
Reference in New Issue
Block a user