Added doxygen:notranslate feature, to prevent running of automatic comment translation
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13517 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6365770c7f
commit
346fdfcab7
4 changed files with 139 additions and 6 deletions
|
|
@ -189,8 +189,10 @@ CPP_TEST_CASES += \
|
||||||
disown \
|
disown \
|
||||||
doxygen_parsing \
|
doxygen_parsing \
|
||||||
doxygen_basic_translate \
|
doxygen_basic_translate \
|
||||||
|
doxygen_basic_notranslate \
|
||||||
doxygen_translate \
|
doxygen_translate \
|
||||||
doxygen_translate_all_tags \
|
doxygen_translate_all_tags \
|
||||||
|
doxygen_translate_links \
|
||||||
dynamic_cast \
|
dynamic_cast \
|
||||||
empty \
|
empty \
|
||||||
enum_rename \
|
enum_rename \
|
||||||
|
|
|
||||||
103
Examples/test-suite/doxygen_basic_notranslate.i
Normal file
103
Examples/test-suite/doxygen_basic_notranslate.i
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
%module doxygen_basic_notranslate
|
||||||
|
|
||||||
|
%include "doxygen_basic_translate.h"
|
||||||
|
%feature("doxygen:notranslate") function;
|
||||||
|
%feature("doxygen:notranslate") function2;
|
||||||
|
%feature("doxygen:notranslate") function3;
|
||||||
|
%feature("doxygen:notranslate") function4;
|
||||||
|
%feature("doxygen:notranslate") function5;
|
||||||
|
%feature("doxygen:notranslate") function6;
|
||||||
|
%feature("doxygen:notranslate") function7;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief
|
||||||
|
* Brief description.
|
||||||
|
*
|
||||||
|
* The comment text
|
||||||
|
* \author Some author
|
||||||
|
* \return Some number
|
||||||
|
* \sa function2
|
||||||
|
*/
|
||||||
|
int function()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A test of a very very very very very very very very very very very very very very very very
|
||||||
|
* very very very very very long comment string.
|
||||||
|
*/
|
||||||
|
int function2()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A test for overloaded functions
|
||||||
|
* This is function \b one
|
||||||
|
*/
|
||||||
|
int function3(int a)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A test for overloaded functions
|
||||||
|
* This is function \b two
|
||||||
|
*/
|
||||||
|
int function3(int a, int b)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A test of some mixed tag usage
|
||||||
|
* \if CONDITION
|
||||||
|
* This \a code fragment shows us something \.
|
||||||
|
* \par Minuses:
|
||||||
|
* \arg it's senseless
|
||||||
|
* \arg it's stupid
|
||||||
|
* \arg it's null
|
||||||
|
*
|
||||||
|
* \warning This may not work as expected
|
||||||
|
*
|
||||||
|
* \code
|
||||||
|
* int main() { while(true); }
|
||||||
|
* \endcode
|
||||||
|
* \endif
|
||||||
|
*/
|
||||||
|
int function4()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int function5(int a)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/**< This is a post comment. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for default args
|
||||||
|
* @param a Some parameter, default is 42
|
||||||
|
*/
|
||||||
|
int function6(int a=42)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
class Shape
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef Shape* superType;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for a parameter with difficult type
|
||||||
|
* (mostly for python)
|
||||||
|
* @param a Very strange param
|
||||||
|
*/
|
||||||
|
void function7(Shape::superType *a[10])
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comment at the end of file should be ignored.
|
||||||
|
*/
|
||||||
|
%}
|
||||||
|
|
@ -412,6 +412,16 @@ String *JavaDocConverter::makeDocumentation(Node *node) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GetFlag(node, "feature:doxygen:notranslate")) {
|
||||||
|
String *comment = NewString("/**\n");
|
||||||
|
Append(comment, documentation);
|
||||||
|
// reformat the comment
|
||||||
|
Replaceall(comment, "\n *", "\n");
|
||||||
|
Replaceall(comment, "\n", "\n * ");
|
||||||
|
Append(comment, "\n */\n");
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation));
|
std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation));
|
||||||
|
|
||||||
// entityList.sort(CompareDoxygenEntities()); sorting currently not used,
|
// entityList.sort(CompareDoxygenEntities()); sorting currently not used,
|
||||||
|
|
|
||||||
|
|
@ -254,9 +254,18 @@ String *PyDocConverter::makeDocumentation(Node *n) {
|
||||||
documentation = getDoxygenComment(n);
|
documentation = getDoxygenComment(n);
|
||||||
if (!Swig_is_generated_overload(n) && documentation) {
|
if (!Swig_is_generated_overload(n) && documentation) {
|
||||||
currentNode = n;
|
currentNode = n;
|
||||||
std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation));
|
if (GetFlag(n, "feature:doxygen:notranslate")) {
|
||||||
DoxygenEntity root("root", entityList);
|
String *comment = NewString("");
|
||||||
allDocumentation.push_back(translateSubtree(root));
|
Append(comment, documentation);
|
||||||
|
Replaceall(comment, "\n *", "\n");
|
||||||
|
allDocumentation.push_back(Char(comment));
|
||||||
|
Delete(comment);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation));
|
||||||
|
DoxygenEntity root("root", entityList);
|
||||||
|
allDocumentation.push_back(translateSubtree(root));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
n = Getattr(n, "sym:nextSibling");
|
n = Getattr(n, "sym:nextSibling");
|
||||||
}
|
}
|
||||||
|
|
@ -279,9 +288,18 @@ String *PyDocConverter::makeDocumentation(Node *n) {
|
||||||
else {
|
else {
|
||||||
documentation = getDoxygenComment(n);
|
documentation = getDoxygenComment(n);
|
||||||
if (documentation != NULL) {
|
if (documentation != NULL) {
|
||||||
std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation));
|
if (GetFlag(n, "feature:doxygen:notranslate")) {
|
||||||
DoxygenEntity root("root", entityList);
|
String *comment = NewString("");
|
||||||
pyDocString = translateSubtree(root);
|
Append(comment, documentation);
|
||||||
|
Replaceall(comment, "\n *", "\n");
|
||||||
|
pyDocString = Char(comment);
|
||||||
|
Delete(comment);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation));
|
||||||
|
DoxygenEntity root("root", entityList);
|
||||||
|
pyDocString = translateSubtree(root);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue