OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # | 5 # |
6 # This is a Sphinx extension. | 6 # This is a Sphinx extension. |
7 # | 7 # |
8 | 8 |
9 from __future__ import print_function | 9 from __future__ import print_function |
10 import codecs | 10 import codecs |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 # auto-generated navbar and permalinks. | 96 # auto-generated navbar and permalinks. |
97 if node.parent.hasattr('ids'): | 97 if node.parent.hasattr('ids'): |
98 node['ids'] = node.parent['ids'][:] | 98 node['ids'] = node.parent['ids'][:] |
99 | 99 |
100 HTMLTranslator.visit_title(self, node) | 100 HTMLTranslator.visit_title(self, node) |
101 | 101 |
102 | 102 |
103 def visit_section(self, node): | 103 def visit_section(self, node): |
104 # chromesite needs <section> instead of <div class='section'> | 104 # chromesite needs <section> instead of <div class='section'> |
105 self.section_level += 1 | 105 self.section_level += 1 |
106 self.body.append(self.starttag(node, 'section')) | 106 if self.section_level == 1: |
| 107 self.body.append(self.starttag(node, 'section')) |
107 | 108 |
108 def depart_section(self, node): | 109 def depart_section(self, node): |
| 110 if self.section_level == 1: |
| 111 self.body.append('</section>') |
109 self.section_level -= 1 | 112 self.section_level -= 1 |
110 self.body.append('</section>') | |
111 | 113 |
112 def visit_image(self, node): | 114 def visit_image(self, node): |
113 # Paths to images in .rst sources should be absolute. This visitor does the | 115 # Paths to images in .rst sources should be absolute. This visitor does the |
114 # required transformation for the path to be correct in the final HTML. | 116 # required transformation for the path to be correct in the final HTML. |
115 # if self.builder.chromesite_production_mode: | 117 # if self.builder.chromesite_production_mode: |
116 node['uri'] = self.builder.get_production_url(node['uri']) | 118 node['uri'] = self.builder.get_production_url(node['uri']) |
117 HTMLTranslator.visit_image(self, node) | 119 HTMLTranslator.visit_image(self, node) |
118 | 120 |
119 def visit_reference(self, node): | 121 def visit_reference(self, node): |
120 # In "kill_internal_links" mode, we don't emit the actual links for internal | 122 # In "kill_internal_links" mode, we don't emit the actual links for internal |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 from sphinx.builders import linkcheck | 297 from sphinx.builders import linkcheck |
296 import urllib2 | 298 import urllib2 |
297 linkcheck.HeadRequest = urllib2.Request | 299 linkcheck.HeadRequest = urllib2.Request |
298 | 300 |
299 app.add_directive('naclcode', NaclCodeDirective) | 301 app.add_directive('naclcode', NaclCodeDirective) |
300 app.add_builder(ChromesiteBuilder) | 302 app.add_builder(ChromesiteBuilder) |
301 | 303 |
302 # "Production mode" for local testing vs. on-server documentation. | 304 # "Production mode" for local testing vs. on-server documentation. |
303 app.add_config_value('chromesite_kill_internal_links', default='0', | 305 app.add_config_value('chromesite_kill_internal_links', default='0', |
304 rebuild='html') | 306 rebuild='html') |
OLD | NEW |