From 1827663dbe6f984f4b317004ddf07ce5b23254a0 Mon Sep 17 00:00:00 2001 From: Zhanna Tsitkov Date: Tue, 17 Apr 2012 18:07:07 +0000 Subject: [PATCH] Translate @version Doxygen markup into rst format git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25811 dc483132-0cff-0310-8789-dd5450dbe970 --- doc/rst_tools/docmodel.py | 2 ++ doc/rst_tools/doxybuilder_funcs.py | 25 +++++++++++++++++++++++++ doc/rst_tools/func_document.tmpl | 6 ++++++ 3 files changed, 33 insertions(+) diff --git a/doc/rst_tools/docmodel.py b/doc/rst_tools/docmodel.py index acfc1440e..0699b5af6 100644 --- a/doc/rst_tools/docmodel.py +++ b/doc/rst_tools/docmodel.py @@ -120,6 +120,7 @@ class Function(object): self.warn_description = argkw.get('warn_description') self.sa_description = argkw.get('sa_description') self.notes_description = argkw.get('notes_description') + self.version_num = argkw.get('version_num') self.short_description = argkw.get('short_description') self.long_description = argkw.get('long_description') self.deprecated_description = argkw.get('deprecated_description') @@ -179,6 +180,7 @@ class Function(object): lines.append('Warning description:\n%s' % self.warn_description) lines.append('See also description:\n%s' % self.sa_description) lines.append('NOTE description:\n%s' % self.notes_description) + lines.append('Version introduced:\n%s' % self.version_num) lines.append('Deprecated description:\n%s' % self.deprecated_description) result = '\n'.join(lines) diff --git a/doc/rst_tools/doxybuilder_funcs.py b/doc/rst_tools/doxybuilder_funcs.py index fb403f375..816834495 100644 --- a/doc/rst_tools/doxybuilder_funcs.py +++ b/doc/rst_tools/doxybuilder_funcs.py @@ -199,6 +199,7 @@ class DoxyFuncs(XML2AST): warning_description = self._process_warning_description(f_detailed) seealso_description = self._process_seealso_description(f_detailed) notes_description = self._process_notes_description(f_detailed) + f_version = self._process_version_description(f_detailed) deprecated_description = self._process_deprecated_description(f_detailed) param_description_map = self.process_parameter_description(f_detailed) f_definition = node.children['definition'][0].getContent() @@ -214,6 +215,7 @@ class DoxyFuncs(XML2AST): 'warn_description': warning_description, 'notes_description': notes_description, 'short_description': f_brief, + 'version_num': f_version, 'long_description': detailed_description, 'deprecated_description': deprecated_description, 'parameters': list()} @@ -475,6 +477,29 @@ class DoxyFuncs(XML2AST): result = it.walk(decorators, 1) return result + def return_version_decorator(self, node, value): + if node.name == 'simplesect': + if node.attributes['kind'] == 'version': + return value + else: + return None + + def _process_version_description(self, node): + result = None + para = node.children.get('para') + if para is not None: + for p in para: + simplesect_list = p.children.get('simplesect') + if simplesect_list is None: + continue + for it in simplesect_list: + decorators = {'default': self.return_version_decorator, + 'para': self.paragraph_content_decorator} + result = it.walk(decorators, 1) + if result is not None: + return result + return result + def return_notes_decorator(self, node, value): if node.name == 'simplesect': if node.attributes['kind'] == 'note': diff --git a/doc/rst_tools/func_document.tmpl b/doc/rst_tools/func_document.tmpl index 6a8874de7..9a80a20db 100644 --- a/doc/rst_tools/func_document.tmpl +++ b/doc/rst_tools/func_document.tmpl @@ -91,3 +91,9 @@ $function.long_description #end if #end if + +#if $function.version_num is not None +.. note:: + $function.version_num +#end if + -- 2.26.2