[from now] 2014/08/05 02:27:03

diff --git a/javascript/static/css/style.css b/javascript/static/css/style.css
index b638d0a..e9927a9 100644
--- a/javascript/static/css/style.css
+++ b/javascript/static/css/style.css
@@ -109,6 +109,10 @@ p {
     color: #333;
 }

+.toc .current > a {
+    font-weight: 700;
+}
+
 @media screen and (max-width: 480px) {
     .toc {
         display: none;
diff --git a/src/main/groovy/gaiden/BindingBuilder.groovy b/src/main/groovy/gaiden/BindingBuilder.groovy
index 9b96842..289669e 100644
--- a/src/main/groovy/gaiden/BindingBuilder.groovy
+++ b/src/main/groovy/gaiden/BindingBuilder.groovy
@@ -54,13 +54,13 @@
      */
     Map<String, Object> build() {
         [
-            title    : escapeHtml4(gaidenConfig.title),
-            content  : content,
-            tocPath  : tocPath,
-            resource : resourceMethod,
-            prevPage : prevPage,
-            nextPage : nextPage,
-            toc      : toc,
+            title   : escapeHtml4(gaidenConfig.title),
+            content : content,
+            tocPath : tocPath,
+            resource: resourceMethod,
+            prevPage: prevPage,
+            nextPage: nextPage,
+            toc     : toc,
         ]
     }

@@ -163,30 +163,14 @@ private String buildContent() {

         builder.doubleQuotes = true // surrounds an attribute with double quotes

-        buildContentOfToc(builder, pageBuildContext.toc.tocNodes)
+        buildContentOfToc(builder, pageBuildContext.toc.tocNodes.findAll { !it.parent })

         writer.toString()
     }

     private String resolveOutputPath(PageReference pageReference) {
         def destPageSource = pageBuildContext.documentSource.findPageSource(pageReference)
-//        println "*" * 10
-//        println pageSource.path
-//        println pageReference.path
-//        println path
-//        println pageReference.path
-//        println destPageSource?.path
-//        if (!destPageSource) {
-//            if (!PathUtils.getExtension(pageReference.path) || PathUtils.getExtension(pageReference.path) in SourceCollector.PAGE_SOURCE_EXTENSIONS) {
-//                return null
-//            }
-//            return path.toString()
-//        }
-//
-
         return pageSource.outputPath.parent.relativize(destPageSource.outputPath).toString() + pageReference.hash
-
-
     }

     @CompileStatic(TypeCheckingMode.SKIP)
@@ -204,7 +188,7 @@ private void buildContentOfToc(MarkupBuilder builder, List<TocNode> tocNodes) {
                 } else {
                     def outputPath = resolveOutputPath(tocNode.pageReference)
                     if (outputPath) {
-                        li {
+                        li("class": pageSource == tocNode.pageSource ? "current" : "") {
                             a(href: outputPath, tocNode.title)
                             buildContentOfToc(builder, tocNode.children)
                         }
diff --git a/src/main/groovy/gaiden/TocBuilder.groovy b/src/main/groovy/gaiden/TocBuilder.groovy
index e6a4d23..152936c 100644
--- a/src/main/groovy/gaiden/TocBuilder.groovy
+++ b/src/main/groovy/gaiden/TocBuilder.groovy
@@ -141,14 +141,13 @@ private String resolveOutputPath(BuildContext context, Path path) {
         return gaidenConfig.tocOutputFile.parent.relativize(pageSource.outputPath).toString() + pageReference.hash
     }

-    private List<TocNode> toTocNodes(BuildContext context, List<Node> nodes, int depth = 1) {
+    private List<TocNode> toTocNodes(BuildContext context, List<Node> nodes) {
         nodes.collect { Node node ->
             def tocNode = new TocNode()
             tocNode.path = Paths.get(node.name() as String)
             tocNode.title = node.attributes().title
             tocNode.pageReference = pageReferenceFactory.get(tocNode.path)
             tocNode.pageSource = context.documentSource.findPageSource(tocNode.pageReference)
-            tocNode.depth = depth

             if (!tocNodes.empty) {
                 def previous = tocNodes.last()
@@ -157,7 +156,7 @@ private String resolveOutputPath(BuildContext context, Path path) {
             }
             tocNodes << tocNode

-            def children = toTocNodes(context, node.children(), depth + 1)
+            def children = toTocNodes(context, node.children())
             children.each { TocNode child ->
                 child.parent = tocNode
             }
diff --git a/src/main/groovy/gaiden/TocNode.groovy b/src/main/groovy/gaiden/TocNode.groovy
index 8723a35..3edc573 100644
--- a/src/main/groovy/gaiden/TocNode.groovy
+++ b/src/main/groovy/gaiden/TocNode.groovy
@@ -46,7 +46,5 @@
     /** The {@code List} of TOC nodes children */
     List<TocNode> children

-    int depth
-
     PageReference pageReference
 }