mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
support alternate inline format to work around docs shortcodes
This commit is contained in:
parent
78afbfbc52
commit
c316bed26a
@ -200,7 +200,7 @@ that each activity that uses the http driver shares a client instance across
|
||||
all threads by default. If you want to have a new http client per-thread,
|
||||
simply add a binding for `space: ThreadNumToInteger()` and reference it in
|
||||
an op template like `space: {space}`, OR use an inline op field in your op
|
||||
template like `space: {{ThreadNumToInteger()}}`.
|
||||
template like `space: {(ThreadNumToInteger())}`.
|
||||
|
||||
You can use any binding function you want for the space op field. However,
|
||||
if you were to assign it something like "space: {{Identity()}}" you would
|
||||
|
@ -9,6 +9,10 @@
|
||||
* Deprecated old drivers (conflicts, etc)
|
||||
- version conflicts (removing cql drivers 1.9.* 3.*)
|
||||
|
||||
## New Topic
|
||||
* Advanced linearization features
|
||||
* variable capture in results
|
||||
|
||||
## new Docs
|
||||
javadoc site
|
||||
developer guide
|
||||
|
@ -51,6 +51,7 @@ public class BindPoint {
|
||||
reference,
|
||||
/**
|
||||
* a definition bindpoint is expressed as anything between double curly braces like <pre>{@code {{Identity()}}</pre>
|
||||
* or <pre>{@code {(Identity())}}
|
||||
*/
|
||||
definition
|
||||
}
|
||||
|
@ -37,7 +37,9 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
public class BindPointParser implements BiFunction<String, Map<String, String>, BindPointParser.Result> {
|
||||
|
||||
public final static Pattern BINDPOINT_ANCHOR = Pattern.compile("(\\{((?<anchor>\\w+[-_<>,\\d\\w.]*)})|(\\{\\{(?<extended>(?!}}).+?)}}))");
|
||||
public final static Pattern BINDPOINT_ANCHOR = Pattern.compile(
|
||||
"(\\{((?<reference>\\w+[-_<>,\\d\\w.]*)})|(\\{\\{(?<inline1>(?!}}).+?)}})|(\\{\\((?<inline2>(?!\\)}).+?)\\)}))"
|
||||
);
|
||||
public final static String DEFINITION = "DEFINITION";
|
||||
|
||||
|
||||
@ -55,14 +57,18 @@ public class BindPointParser implements BiFunction<String, Map<String, String>,
|
||||
spans.add(pre);
|
||||
lastMatch = m.end();
|
||||
|
||||
String anchor = m.group("anchor");
|
||||
String extendedAnchor = m.group("extended");
|
||||
if (anchor != null) {
|
||||
bindpoints.add(BindPoint.of(anchor, bindings.getOrDefault(anchor, null), BindPoint.Type.reference));
|
||||
spans.add(anchor);
|
||||
} else if (extendedAnchor != null) {
|
||||
bindpoints.add(BindPoint.of(DEFINITION, extendedAnchor, BindPoint.Type.definition));
|
||||
spans.add(extendedAnchor);
|
||||
String reference = m.group("reference");
|
||||
String inline1 = m.group("inline1");
|
||||
String inline2 = m.group("inline2");
|
||||
if (reference != null) {
|
||||
bindpoints.add(BindPoint.of(reference, bindings.getOrDefault(reference, null), BindPoint.Type.reference));
|
||||
spans.add(reference);
|
||||
} else if (inline1 != null) {
|
||||
bindpoints.add(BindPoint.of(DEFINITION, inline1, BindPoint.Type.definition));
|
||||
spans.add(inline1);
|
||||
} else if (inline2 != null) {
|
||||
bindpoints.add(BindPoint.of(DEFINITION, inline2, BindPoint.Type.definition));
|
||||
spans.add(inline2);
|
||||
} else {
|
||||
throw new BasicError("Unable to parse: " + template);
|
||||
}
|
||||
|
@ -60,6 +60,20 @@ public class BindPointParserTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInline2TypeBindPoint() {
|
||||
BindPointParser bpp = new BindPointParser();
|
||||
assertThat(bpp.apply("test {(this is a definition)} and {{another}}", Map.of())).isEqualTo(
|
||||
new BindPointParser.Result(
|
||||
List.of("test ","this is a definition"," and ","another",""),
|
||||
List.of(
|
||||
BindPoint.of(BindPointParser.DEFINITION,"this is a definition", BindPoint.Type.definition),
|
||||
BindPoint.of(BindPointParser.DEFINITION, "another",BindPoint.Type.definition)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCurlyBracesWithinPattern() {
|
||||
BindPointParser bpp = new BindPointParser();
|
||||
|
Loading…
Reference in New Issue
Block a user