From 2dea6e8c3d62d70b1503c9fbd23bef0381953e01 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 13 Feb 2015 00:01:04 -0800 Subject: [PATCH 1/3] Add comments to describe these calls --- lib/github/commands/rest2html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index ca9f26ff..2d750407 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -66,8 +66,8 @@ class GitHubHTMLTranslator(HTMLTranslator): # see also: http://bit.ly/1exfq2h (warning! sourceforge link.) def depart_document(self, node): HTMLTranslator.depart_document(self, node) - self.html_body.pop(0) - self.html_body.pop() + self.html_body.pop(0) # pop the starting
off + self.html_body.pop() # pop the ending
off # technique for visiting sections, without generating additional divs # see also: http://bit.ly/NHtyRx From a1d3798e7de27e1fd55c7c6a0d0f5a8fe206a95a Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sun, 15 Feb 2015 10:49:30 -0800 Subject: [PATCH 2/3] Add empty `a` to support contents with sectnums --- lib/github/commands/rest2html | 3 +++ test/markups/README.toc.rst | 30 ++++++++++++++++++++++++++++++ test/markups/README.toc.rst.html | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 test/markups/README.toc.rst create mode 100644 test/markups/README.toc.rst.html diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 2d750407..63ecc0ed 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -71,7 +71,10 @@ class GitHubHTMLTranslator(HTMLTranslator): # technique for visiting sections, without generating additional divs # see also: http://bit.ly/NHtyRx + # the a is to support ::contents with ::sectnums: http://git.io/N1yC def visit_section(self, node): + id_attribute = node.attributes['ids'][0] + self.body.append('\n' % id_attribute) self.section_level += 1 def depart_section(self, node): diff --git a/test/markups/README.toc.rst b/test/markups/README.toc.rst new file mode 100644 index 00000000..a86b88a5 --- /dev/null +++ b/test/markups/README.toc.rst @@ -0,0 +1,30 @@ +.. contents:: + :backlinks: none + +.. sectnum:: + +Introduction +============ + +What is pycparser? +------------------ + +**pycparser** is a parser for the C language, written in pure Python. It is a +module designed to be easily integrated into applications that need to parse +C source code. + +What is it good for? +-------------------- + +Anything that needs C code to be parsed. The following are some uses for +**pycparser**, taken from real user reports: + +* C code obfuscator +* Front-end for various specialized C compilers +* Static code checker +* Automatic unit-test discovery +* Adding specialized extensions to the C language + +**pycparser** is unique in the sense that it's written in pure Python - a very +high level language that's easy to experiment with and tweak. To people familiar +with Lex and Yacc, **pycparser**'s code will be simple to understand. diff --git a/test/markups/README.toc.rst.html b/test/markups/README.toc.rst.html new file mode 100644 index 00000000..4890e99b --- /dev/null +++ b/test/markups/README.toc.rst.html @@ -0,0 +1,32 @@ +
+

Contents

+ +
+ +

1   Introduction

+ +

1.1   What is pycparser?

+

pycparser is a parser for the C language, written in pure Python. It is a +module designed to be easily integrated into applications that need to parse +C source code.

+ +

1.2   What is it good for?

+

Anything that needs C code to be parsed. The following are some uses for +pycparser, taken from real user reports:

+ +

pycparser is unique in the sense that it's written in pure Python - a very +high level language that's easy to experiment with and tweak. To people familiar +with Lex and Yacc, pycparser's code will be simple to understand.

From 73011b63ed083fe5f4a68caf13a3bcbd0846cbd2 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sun, 15 Feb 2015 10:49:39 -0800 Subject: [PATCH 3/3] Spruce up old tests --- test/markups/README.rst.html | 2 ++ test/markups/README.rst.txt.html | 1 + 2 files changed, 3 insertions(+) diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index a074e8d5..77b79b98 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -8,6 +8,7 @@

Subtitle

  • Field list
  • +

    Header 2

    1. Blah blah code blah
    2. @@ -46,6 +47,7 @@

      Header 2

      Coverity Scan Build Status Coverity Scan Build Status +

      Field list

      diff --git a/test/markups/README.rst.txt.html b/test/markups/README.rst.txt.html index d2e61dc6..6d5d0675 100644 --- a/test/markups/README.rst.txt.html +++ b/test/markups/README.rst.txt.html @@ -1,5 +1,6 @@

      Header 1

      Example text.

      +

      Header 2

      1. Blah blah code blah