Kirill Simonov avatar Kirill Simonov committed 9b476c4

htsqldoc: replaced `[+]` toggle with a link arrow.

Comments (0)

Files changed (5)

doc/ref/functions.rst

    :cut: 3
 
 .. htsql::
+   :cut: 3
 
    /department^avg_credits {avg_credits, count(department)}
     :where department.avg_credits := avg(course.credits) :trunc(1)

doc/ref/syntax.rst

 .. htsql:: /school/:csv
    :cut: 3
 
-See :class:`htsql.tr.parse.QueryParser` for a formal description of the
-HTSQL grammar.
-
 Next we describe individual syntax elements.
 
 Atomic Expressions

src/sphinxext_htsqldoc/__init__.py

                 return [doc.reporter.error("failed to load: %s" % uri,
                                            line=self.lineno)]
             env.htsql_uris[uri] = result
+        query_container = nodes.container('', query_node,
+                                          classes=['htsql-input'])
+        if 'hide' in self.options:
+            return [query_container]
         content_type, content = env.htsql_uris[uri]
         if 'plain' in self.options:
             content_type = 'text/plain'
         result_node = build_result(self.content_offset, content_type, content,
                                    self.options.get('cut'))
-        query_container = nodes.container('', query_node,
-                                          classes=['htsql-input'])
         result_container = nodes.container('', result_node,
                                            classes=['htsql-output'])
-        if 'hide' in self.options:
-            result_container['classes'].append('htsql-hide')
         return [query_container, result_container]
 
 
     if node.has_key('uri'):
         highlighted = '<a href="%s" target="_new" class="htsql-link">%s</a>' \
                 % (escape(node['uri'], True), highlighted)
-    toggle = "[-]"
-    if node.has_key('hide') and node['hide']:
-        toggle = "[+]"
-    highlighted = '<span class="htsql-toggle">%s</span>%s' \
-            % (toggle, highlighted)
+        highlighted = '<a href="%s" target="_new" class="htsql-arrow-link">' \
+                      '&#x25E5;</a>%s' \
+                % (escape(node['uri'], True), highlighted)
     highlighted = '<pre>%s</pre>' % highlighted
     highlighted = '<div class="highlight">%s</div>' % highlighted
     starttag = self.starttag(node, 'div', suffix='',
             row_node += entry_node
             para_node = nodes.paragraph()
             entry_node += para_node
-            text_node = nodes.Text(title)
+            text_node = nodes.Text(title.replace(u' ', u'\xA0'))
             para_node += text_node
         body_node = nodes.tbody()
         group_node += body_node
     app.add_node(htsql_block,
                  html=(visit_htsql_block, depart_htsql_block))
     app.add_stylesheet('htsqldoc.css')
-    app.add_javascript('htsqldoc.js')
     app.add_lexer('htsql', HtsqlLexer())
 
 

src/sphinxext_htsqldoc/static/htsqldoc.css

 }
 
 div.htsql-output {
-  max-height: 11em;
   overflow: auto;
 }
 
   border-bottom: 0;
 }
 
-div.htsql-hide {
-  display: none;
-}
-
-span.htsql-toggle {
-  float: right;
-  cursor: pointer;
+div.htsql-output div.highlight pre {
+  margin-top: 0;
 }
 
 a.htsql-link {
   opacity: 0.7;
 }
 
+a.htsql-arrow-link {
+  float: right;
+  font-size: 105%;
+  opacity: 0.9;
+}
+
+a.htsql-arrow-link:hover {
+  text-decoration: none;
+  opacity: 0.6;
+}
+

src/sphinxext_htsqldoc/static/htsqldoc.js

-
-
-$(function () {
-    $('.htsql-toggle').click(function () {
-        var output = this;
-        if ($(this).text() == '[+]') {
-            $(this).parents('.htsql-input').next('.htsql-output').slideDown('fast');
-            $(this).text('[-]');
-        }
-        else {
-            $(this).parents('.htsql-input').next('.htsql-output').slideUp('fast');
-            $(this).text('[+]');
-        }
-    });
-});
-
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.