This is an automated email from the ASF dual-hosted git repository. Cole-Greer pushed a commit to branch docs-3.7 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 8e5a3d4278120bee4ce66ade549c63849039e3cb Author: Cole Greer <[email protected]> AuthorDate: Fri May 22 16:50:29 2026 -0700 Fix multi-line statement display: only first line gets gremlin> prompt Published docs show continuation lines with indentation only, not repeated gremlin> prompts. Also handle console startup failure gracefully during restart (skip block instead of crashing build). --- .../gremlin/docs/GremlinTreeprocessor.java | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tools/tinkerpop-docs/src/main/java/org/apache/tinkerpop/gremlin/docs/GremlinTreeprocessor.java b/tools/tinkerpop-docs/src/main/java/org/apache/tinkerpop/gremlin/docs/GremlinTreeprocessor.java index 6ec0766026..0b524b0df3 100644 --- a/tools/tinkerpop-docs/src/main/java/org/apache/tinkerpop/gremlin/docs/GremlinTreeprocessor.java +++ b/tools/tinkerpop-docs/src/main/java/org/apache/tinkerpop/gremlin/docs/GremlinTreeprocessor.java @@ -440,8 +440,17 @@ public class GremlinTreeprocessor extends Treeprocessor { final String source = block.getSource(); if (source == null || source.isEmpty()) return ""; final StringBuilder output = new StringBuilder(); - for (final String line : source.split("\\r?\\n")) { - output.append(PROMPT).append(line).append("\n"); + final String[] lines = source.split("\\r?\\n"); + final List<String> statements = buildDisplayStatements(lines); + for (final String statement : statements) { + final String[] stmtLines = statement.split("\\r?\\n"); + for (int l = 0; l < stmtLines.length; l++) { + if (l == 0) { + output.append(PROMPT).append(stmtLines[l]).append("\n"); + } else { + output.append(" ").append(stmtLines[l]).append("\n"); + } + } } return output.toString().stripTrailing(); } @@ -466,8 +475,14 @@ public class GremlinTreeprocessor extends Treeprocessor { final List<String> execStatements = buildStatements(lines); for (int s = 0; s < displayStatements.size(); s++) { // Show original lines with callouts for display - for (final String displayLine : displayStatements.get(s).split("\\r?\\n")) { - output.append(PROMPT).append(displayLine).append("\n"); + final String[] displayLines = displayStatements.get(s).split("\\r?\\n"); + for (int l = 0; l < displayLines.length; l++) { + if (l == 0) { + output.append(PROMPT).append(displayLines[l]).append("\n"); + } else { + // Continuation lines: indent to align with first line (no prompt) + output.append(" ").append(displayLines[l]).append("\n"); + } } if (!dryRun && getActiveExecutor() != null) { final String result = executeSafely(execStatements.get(s));
