From 28231c1b188c6d9baf2ec9140662e3116ce9fa19 Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sun, 3 Aug 2014 16:49:10 +0200 Subject: [PATCH] Add language attribute to code samples Create the literal_block nodes with a 'language' attribute to add syntax highlighting in the generated documentation. This change is not visible in the HTML output, but is used when the generated XML is imported in the openstack-manuals hot-reference book (WIP). The 'hot' language is not currently supported in sphinx or in the manuals, but it doesn't hurt to have it and it could be implemented later. Change-Id: Ie5d4ab31665da812ccd7ec1232d3858786170477 Implements: blueprint heat-templates Closes-Bug: #1360559 --- doc/source/ext/resources.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/ext/resources.py b/doc/source/ext/resources.py index 25f051d4b..b84940ff1 100644 --- a/doc/source/ext/resources.py +++ b/doc/source/ext/resources.py @@ -123,7 +123,7 @@ resources: properties: %s''' % (self.resource_type, '\n '.join(props)) - block = nodes.literal_block('', template) + block = nodes.literal_block('', template, language="hot") section.append(block) def contribute_yaml_syntax(self, parent): @@ -145,7 +145,7 @@ Resources: Properties: %s''' % (self.resource_type, '\n '.join(props)) - block = nodes.literal_block('', template) + block = nodes.literal_block('', template, language='yaml') section.append(block) def contribute_json_syntax(self, parent): @@ -170,7 +170,7 @@ Resources: } } }''' % (self.resource_type, ',\n '.join(props)) - block = nodes.literal_block('', template) + block = nodes.literal_block('', template, language="json") section.append(block) @staticmethod