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 18:10:39 UTC

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

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/preprocessor cea173269 -> d8044446c


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/preprocessor
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


[2/2] incubator-tinkerpop git commit: fixed another grep for OSX

Posted by dk...@apache.org.
fixed another grep for OSX


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

Branch: refs/heads/preprocessor
Commit: d8044446c84d3a4f6d20648dad23c87f492fd949
Parents: ec4e41c
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Fri Jun 5 18:10:14 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Fri Jun 5 18:10:14 2015 +0200

----------------------------------------------------------------------
 docs/preprocessor/preprocess-file.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d8044446/docs/preprocessor/preprocess-file.sh
----------------------------------------------------------------------
diff --git a/docs/preprocessor/preprocess-file.sh b/docs/preprocessor/preprocess-file.sh
index 9b8abac..42e33c0 100755
--- a/docs/preprocessor/preprocess-file.sh
+++ b/docs/preprocessor/preprocess-file.sh
@@ -34,7 +34,7 @@ echo -ne "   progress: initializing"
 if [ $(grep -c '^\[gremlin' ${input}) -gt 0 ]; then
   pushd "${CONSOLE_HOME}" > /dev/null
   bin/gremlin.sh -e ${TP_HOME}/docs/preprocessor/processor.groovy ${input} > ${input}.part2.groovy
-  cat ${input}.part2.groovy | grep -o '^pb([0-9][0-9]*' | tail -n1 | grep -o '[0-9]*' | xargs echo "TOTAL_LINES =" > ${input}.part1.groovy
+  cat ${input}.part2.groovy | grep -o '^pb([0-9][0-9]*' | tail -n1 | cut -d '(' -f2 | xargs echo "TOTAL_LINES =" > ${input}.part1.groovy
   cat ${input}.part?.groovy > ${input}.groovy && rm -f ${input}.part?.groovy
   ec=${PIPESTATUS[0]}
   if [ ${ec} -eq 0 ]; then