From fad5f65a46921d58e05e8e4dc28d3872589365ef Mon Sep 17 00:00:00 2001
From: Dilawar Singh <dilawars@ncbs.res.in>
Date: Sat, 20 Jan 2018 12:07:24 +0530
Subject: [PATCH] Fixed #232. Latex writer is producing good pdf.

---
 docs/source/Extensions/hidden_code_block.py | 31 ++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/docs/source/Extensions/hidden_code_block.py b/docs/source/Extensions/hidden_code_block.py
index 195a8092..d2867c1d 100644
--- a/docs/source/Extensions/hidden_code_block.py
+++ b/docs/source/Extensions/hidden_code_block.py
@@ -88,7 +88,36 @@ class HiddenCodeBlock(CodeBlock):
         return [hcb]
 
 def visit_hcb_tex( self, node ):
-    pass
+    global HCB_COUNTER
+
+    # We want to use the original highlighter so that we don't
+    # have to reimplement it.  However it raises a SkipNode 
+    # error at the end of the function call.  Thus we intercept
+    # it and raise it again later.
+    try: 
+        self.visit_literal_block(node)
+    except nodes.SkipNode:
+        pass
+
+    ## The last element of the body should be the literal code 
+    ## block that was just made.
+    #code_block = self.body[-1]
+
+    #fill_header = {'divname': 'hiddencodeblock{0}'.format(HCB_COUNTER), 
+    #               'startdisplay': 'none' if node['starthidden'] else 'block', 
+    #               'label': node.get('label'), 
+    #               }
+
+    #divheader = ("""<a href="javascript:showhide(document.getElementById('{divname}'))">"""
+    #             """{label}</a><br />"""
+    #             '''<div id="{divname}" style="display: {startdisplay}">'''
+    #             ).format(**fill_header)
+
+    #code_block = js_showhide + divheader + code_block + "</div>"
+
+    ## reassign and exit
+    #self.body[-1] = code_block
+    raise nodes.SkipNode
 
 def depart_hcb_tex( self, node ):
     pass
-- 
GitLab