You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2015/06/05 22:18:14 UTC

[21/26] incubator-tinkerpop git commit: added support for multi-line strings in code samples

added support for multi-line strings in code samples


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/ec4e41c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/ec4e41c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/ec4e41c1

Branch: refs/heads/master
Commit: ec4e41c19aa9d20987832f3dc8c34ce85ba5287b
Parents: cea1732
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Fri Jun 5 16:40:42 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Fri Jun 5 16:40:42 2015 +0200

----------------------------------------------------------------------
 docs/preprocessor/processor.groovy | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ec4e41c1/docs/preprocessor/processor.groovy
----------------------------------------------------------------------
diff --git a/docs/preprocessor/processor.groovy b/docs/preprocessor/processor.groovy
index 3c3b3b6..00d41d2 100644
--- a/docs/preprocessor/processor.groovy
+++ b/docs/preprocessor/processor.groovy
@@ -83,14 +83,21 @@ new File(this.args[0]).withReader { reader ->
                     def sanitizedLine = sanitize(line)
                     script.append(sanitizedLine)
                     println stringify(STATEMENT_PREFIX + format(line), lineNumber)
-                    if (!sanitizedLine.isEmpty() && sanitizedLine[-1] in STATEMENT_CONTINUATION_CHARACTERS) {
-                        while (true) {
+                    if (!sanitizedLine.isEmpty() && (sanitizedLine[-1] in STATEMENT_CONTINUATION_CHARACTERS || line.split('"""', -1).size() % 2 == 0)) {
+                        def inMultiLineString = line.split('"""', -1).size() % 2 == 0
+                        def run = true
+                        while (run) {
                             line = reader.readLine()
-                            if (!line.startsWith(" ") && !line.startsWith("}") && !line.startsWith(")") || line.equals(BLOCK_DELIMITER)) {
+                            if (inMultiLineString) {
+                                if (line.split('"""', -1).size() % 2 == 0) {
+                                    run = false
+                                }
+                            } else if (!line.startsWith(" ") && !line.startsWith("}") && !line.startsWith(")") || line.equals(BLOCK_DELIMITER)) {
                                 skipNextRead = true
                                 break
                             }
                             sanitizedLine = sanitize(line)
+                            if (inMultiLineString) script.append("\n")
                             script.append(sanitizedLine)
                             println stringify(STATEMENT_CONTINUATION_PREFIX + format(line), lineNumber)
                         }
@@ -121,6 +128,7 @@ new File(this.args[0]).withReader { reader ->
                     println "marko = g.V().has(\"name\", \"marko\").tryNext().orElse(null)"
                     println "f = new File('/tmp/neo4j')"
                     println "if (f.exists()) f.deleteDir()"
+                    println ":set max-iteration 100"
                     println stringify("IGNORE")
                     reader.readLine()
                     inCodeSection = true