From 040f91d9919c51a5ecbe54352a207a3281f07359 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Tue, 12 Apr 2022 07:20:31 +0200 Subject: [PATCH 1/2] Make sure all anchors are created for RST links. --- 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 c7c89dce..c6fc663e 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -199,8 +199,8 @@ class GitHubHTMLTranslator(HTMLTranslator): # 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) + for id_attribute in node.attributes['ids']: + self.body.append('\n' % id_attribute) self.section_level += 1 def depart_section(self, node): From a78c9a718bf64daeb6cf2f996c5844fa7fc3457f Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Tue, 12 Apr 2022 07:28:04 +0200 Subject: [PATCH 2/2] Add test. On my system rest2html generates quite some different markup so I'm not sure whether this actually works. --- test/markups/README.rst | 4 ++++ test/markups/README.rst.html | 2 ++ 2 files changed, 6 insertions(+) diff --git a/test/markups/README.rst b/test/markups/README.rst index 53cba9e0..ad7af380 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -8,6 +8,8 @@ Example text. .. contents:: Table of Contents +.. _label_for_header_2: + Header 2 -------- @@ -17,6 +19,8 @@ Header 2 3. Somé UTF-8° +4. `Link to the above header `_ + The UTF-8 quote character in this table used to cause python to go boom. Now docutils just silently ignores it. .. csv-table:: Things that are Awesome (on a scale of 1-11) diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 6accfdf6..ca6807f8 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -9,11 +9,13 @@

Subtitle

+

Header 2

  1. Blah blah code blah
  2. More code, hooray
  3. Somé UTF-8°
  4. +
  5. Link to the above header

The UTF-8 quote character in this table used to cause python to go boom. Now docutils just silently ignores it.