Translate @version Doxygen markup into rst format
authorZhanna Tsitkov <tsitkova@mit.edu>
Tue, 17 Apr 2012 18:07:07 +0000 (18:07 +0000)
committerZhanna Tsitkov <tsitkova@mit.edu>
Tue, 17 Apr 2012 18:07:07 +0000 (18:07 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25811 dc483132-0cff-0310-8789-dd5450dbe970

doc/rst_tools/docmodel.py
doc/rst_tools/doxybuilder_funcs.py
doc/rst_tools/func_document.tmpl

index acfc1440e389e94c09a5040127a2080296b13e6b..0699b5af60a96ed26ab6d0358081b39863dfc163 100644 (file)
@@ -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)
         
index fb403f375606c9d79f24e006a93edc94ceda6ce8..8168344955e956a7ea2eb8748d57aae08cb96676 100644 (file)
@@ -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':
index 6a8874de7ee9add062dec1eb4d54af62584424cd..9a80a20db0d7f41be5c33766d2ddd0eaafcd526b 100644 (file)
@@ -91,3 +91,9 @@ $function.long_description
 #end if
 
 #end if
+
+#if $function.version_num is not None
+.. note::
+       $function.version_num
+#end if
+