Skip to content

Commit

Permalink
pageLevelConfigMeta on ALL, nested indent fix
Browse files Browse the repository at this point in the history
- pageLevelConfigMeta (e.g., for :github_url:) now on ALL generated
  files, not just leaf-like nodes
- when more than one nested type, indentation was broken due to
  using `textwrap.dedent` with the child list -> string
  • Loading branch information
svenevs committed Sep 14, 2017
1 parent 0f17357 commit bb92907
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion exhale/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from __future__ import unicode_literals

__version__ = "0.1.4"
__version__ = "0.1.5"


def environment_ready(app):
Expand Down
25 changes: 22 additions & 3 deletions exhale/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,10 @@ def generateAPIRootHeader(self):
)
try:
with codecs.open(self.full_root_file_path, "w", "utf-8") as generated_index:
# Add the metadata if they requested it
if configs.pageLevelConfigMeta:
generated_index.write("{0}\n\n".format(configs.pageLevelConfigMeta))

generated_index.write(textwrap.dedent('''
{heading}
{heading_mark}
Expand Down Expand Up @@ -2163,12 +2167,11 @@ def generateSingleNodeRST(self, node):
{heading}
{heading_mark}
{children}
'''.format(
heading="Nested Types",
heading_mark=configs.SUB_SUB_SECTION_HEADING,
children=nested_child_string
heading_mark=configs.SUB_SUB_SECTION_HEADING
))
nested_defs = "{0}{1}\n".format(nested_defs, nested_child_string)

if nested_type_of or nested_defs:
gen_file.write(textwrap.dedent('''
Expand Down Expand Up @@ -2317,6 +2320,10 @@ def generateSingleNamespace(self, nspace):
'''
try:
with codecs.open(nspace.file_name, "w", "utf-8") as gen_file:
# Add the metadata if they requested it
if configs.pageLevelConfigMeta:
gen_file.write("{0}\n\n".format(configs.pageLevelConfigMeta))

# generate a link label for every generated file
link_declaration = ".. _{}:\n\n".format(nspace.link_name)
# every generated file must have a header for sphinx to be happy
Expand Down Expand Up @@ -2464,6 +2471,10 @@ def generateFileNodeDocuments(self):
# create the programlisting file
try:
with codecs.open(f.program_file, "w", "utf-8") as gen_file:
# Add the metadata if they requested it
if configs.pageLevelConfigMeta:
gen_file.write("{0}\n\n".format(configs.pageLevelConfigMeta))

# generate a link label for every generated file
link_declaration = ".. _{}:".format(f.program_link_name)
# every generated file must have a header for sphinx to be happy
Expand Down Expand Up @@ -2597,6 +2608,10 @@ def generateFileNodeDocuments(self):

try:
with codecs.open(f.file_name, "w", "utf-8") as gen_file:
# Add the metadata if they requested it
if configs.pageLevelConfigMeta:
gen_file.write("{0}\n\n".format(configs.pageLevelConfigMeta))

# generate a link label for every generated file
link_declaration = ".. _{}:".format(f.link_name)
# every generated file must have a header for sphinx to be happy
Expand Down Expand Up @@ -2728,6 +2743,10 @@ def generateDirectoryNodeRST(self, node):
try:
#flake8fail get rid of {} in this method
with codecs.open(node.file_name, "w", "utf-8") as gen_file:
# Add the metadata if they requested it
if configs.pageLevelConfigMeta:
gen_file.write("{0}\n\n".format(configs.pageLevelConfigMeta))

# generate a link label for every generated file
link_declaration = ".. _{}:\n\n".format(node.link_name)
header = "{}\n{}\n\n".format(node.title, configs.SECTION_HEADING)
Expand Down

0 comments on commit bb92907

Please sign in to comment.