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 2018/10/19 17:40:53 UTC

[tinkerpop] branch TINKERPOP-2073 created (now 6fdc8ba)

This is an automated email from the ASF dual-hosted git repository.

dkuppitz pushed a change to branch TINKERPOP-2073
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git.


      at 6fdc8ba  TINKERPOP-2073 Generate tabs for static code blocks

This branch includes the following new commits:

     new 6fdc8ba  TINKERPOP-2073 Generate tabs for static code blocks

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[tinkerpop] 01/01: TINKERPOP-2073 Generate tabs for static code blocks

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkuppitz pushed a commit to branch TINKERPOP-2073
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 6fdc8ba5c77fa46fd6016a5c7f96a090825d93f8
Author: Daniel Kuppitz <da...@hotmail.com>
AuthorDate: Fri Oct 19 10:40:20 2018 -0700

    TINKERPOP-2073 Generate tabs for static code blocks
---
 docs/preprocessor/awk/tabify.awk | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/docs/preprocessor/awk/tabify.awk b/docs/preprocessor/awk/tabify.awk
index 24d42a6..28e7cf6 100644
--- a/docs/preprocessor/awk/tabify.awk
+++ b/docs/preprocessor/awk/tabify.awk
@@ -63,9 +63,17 @@ BEGIN {
   status = 1
   lang = gensub(/^\[gremlin-([^,\]]+).*/, "\\1", "g", $0)
   code = ""
+  evaluate = 1
 }
 
-/^\[source,(csharp|groovy|java|python)/ {
+/^\[source,(csharp|groovy|java|javascript|python),tab\]/ {
+  status = 1
+  lang = gensub(/^\[source,([^,\]]+).*/, "\\1", "g", $0)
+  code = ""
+  evaluate = 0
+}
+
+/^\[source,(csharp|groovy|java|javascript|python)\]/ {
   if (status == 3) {
     status = 1
     lang = gensub(/^\[source,([^\]]+).*/, "\\1", "g", $0)
@@ -73,7 +81,7 @@ BEGIN {
   }
 }
 
-! /^\[source,(csharp|groovy|java|python)/ {
+! /^\[source,(csharp|groovy|java|javascript|python)/ {
   if (status == 3 && $0 != "") {
     print_tabs(next_id, tabs, blocks)
     next_id = next_id + length(tabs)
@@ -96,7 +104,7 @@ BEGIN {
 { if (status == 3) {
     if ($0 == "----") {
       i = length(blocks) + 1
-      if (i == 1) {
+      if (i == 1 && evaluate == 1) {
         tabs[i] = "console (" lang ")"
         blocks[i] = code_header code "\n" $0 "\n"
         i++
@@ -114,7 +122,7 @@ BEGIN {
     }
   } else {
     if (status == 0) print
-    else if (status == 1) code_header = $0
+    else if (status == 1) code_header = gensub(/,tab/, "", "g", $0)
     else code = code "\n" $0
   }
 }