chiark / gitweb /
doxygen: explicitly write trailing newline to all output files.
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 31 Dec 2018 02:22:09 +0000 (03:22 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 31 Dec 2018 02:48:32 +0000 (03:48 +0100)
Makes test file updates much easier. I need to revisit this later with a
more systematic solution.

doxygen/dox2html5.py

index 41bf411f7589955b9b3b944c611e19e98d6b35e9..45c369a5304871024f2b3e7567eb1f21b496ddeb 100755 (executable)
@@ -3324,6 +3324,11 @@ def run(doxyfile, templates=default_templates, wildcard=default_wildcard, index_
                 output = os.path.join(html_output, file)
                 with open(output, 'wb') as f:
                     f.write(rendered.encode('utf-8'))
+                    # Add back a trailing newline so we don't need to bother
+                    # with patching test files to include a trailing newline to
+                    # make Git happy
+                    # TODO could keep_trailing_newline fix this better?
+                    f.write(b'\n')
         else:
             parsed = parse_xml(state, file)
             if not parsed: continue
@@ -3337,6 +3342,11 @@ def run(doxyfile, templates=default_templates, wildcard=default_wildcard, index_
             output = os.path.join(html_output, parsed.compound.url)
             with open(output, 'wb') as f:
                 f.write(rendered.encode('utf-8'))
+                # Add back a trailing newline so we don't need to bother with
+                # patching test files to include a trailing newline to make Git
+                # happy
+                # TODO could keep_trailing_newline fix this better?
+                f.write(b'\n')
 
     # Empty index page in case no mainpage documentation was provided so
     # there's at least some entrypoint. Doxygen version is not set in this
@@ -3355,6 +3365,11 @@ def run(doxyfile, templates=default_templates, wildcard=default_wildcard, index_
         output = os.path.join(html_output, 'index.html')
         with open(output, 'wb') as f:
             f.write(rendered.encode('utf-8'))
+            # Add back a trailing newline so we don't need to bother with
+            # patching test files to include a trailing newline to make Git
+            # happy
+            # TODO could keep_trailing_newline fix this better?
+            f.write(b'\n')
 
     if not state.doxyfile['M_SEARCH_DISABLED']:
         data = build_search_data(state, add_lookahead_barriers=search_add_lookahead_barriers, merge_subtrees=search_merge_subtrees, merge_prefixes=search_merge_prefixes)