summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-05-21 17:52:23 (GMT)
committerGitHub <noreply@github.com>2019-05-21 17:52:23 (GMT)
commit5c9d812083af06c9e683c9ff2e32f5839066863c (patch)
tree7ff5bacf7b93c6c6e37d164534784470481bcae7
parentebefc53b60276e38270fe19251045b46b285e23d (diff)
parentfaafe83a69d2f3c27daca0974c9a063bdb81ecdc (diff)
downloadDoxygen-5c9d812083af06c9e683c9ff2e32f5839066863c.zip
Doxygen-5c9d812083af06c9e683c9ff2e32f5839066863c.tar.gz
Doxygen-5c9d812083af06c9e683c9ff2e32f5839066863c.tar.bz2
Merge pull request #6957 from cfriedt/feature/cfriedt/6955/allow-javadoc-style-comment-blocks-with-a-doxyfile-variable
Allow Javadoc-style comment blocks with a Doxyfile variable
-rw-r--r--doc/docblocks.doc19
-rw-r--r--doc/doxygen_manual.tex2
-rw-r--r--examples/CMakeLists.txt8
-rw-r--r--examples/javadoc-banner.cfg15
-rw-r--r--examples/javadoc-banner.h45
-rw-r--r--src/code.l18
-rw-r--r--src/config.xml11
-rw-r--r--src/scanner.l37
8 files changed, 155 insertions, 0 deletions
diff --git a/doc/docblocks.doc b/doc/docblocks.doc
index d4eab5d..9d14f6e 100644
--- a/doc/docblocks.doc
+++ b/doc/docblocks.doc
@@ -123,6 +123,25 @@ or
/////////////////////////////////////////////////
\endverbatim
+or
+
+\verbatim
+/************************************************
+ * ... text
+ ***********************************************/
+\endverbatim
+
+as long as JAVADOC_BANNER = YES is used.
+\include javadoc-banner.h
+ \htmlonly
+ Click <a href="examples/javadoc-banner/html/index.html">here</a>
+ for the corresponding HTML documentation that is generated by doxygen.
+ \endhtmlonly
+ \latexonly
+ See \hyperlink{javadoc_banner_example}{Javadoc Banner example}
+ for the corresponding \mbox{\LaTeX} documentation that is generated by doxygen.
+ \endlatexonly
+
</ol>
For the brief description there are also several possibilities:
diff --git a/doc/doxygen_manual.tex b/doc/doxygen_manual.tex
index 1a44574..5265b9b 100644
--- a/doc/doxygen_manual.tex
+++ b/doc/doxygen_manual.tex
@@ -178,6 +178,8 @@ Written by Dimitri van Heesch\\[2ex]
\subinputfrom{../html/examples/file/latex/}{refman_doc}
\chapter{Fn Example}\label{fn_example}\hypertarget{fn_example}{}
\subinputfrom{../html/examples/func/latex/}{refman_doc}
+\chapter{Javadoc Banner Example}\label{javadoc_banner_example}\hypertarget{javadoc_banner_example}{}
+\subinputfrom{../html/examples/javadoc-banner/latex/}{refman_doc}
\chapter{Overload Example}\label{overload_example}\hypertarget{overload_example}{}
\subinputfrom{../html/examples/overload/latex/}{refman_doc}
\chapter{Page Example}\label{page_example}\hypertarget{page_example}{}
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 0f34c6d..967f3d4 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -23,6 +23,7 @@ add_custom_target(examples
${PROJECT_BINARY_DIR}/html/examples/enum/html/index.html
${PROJECT_BINARY_DIR}/html/examples/file/html/index.html
${PROJECT_BINARY_DIR}/html/examples/func/html/index.html
+ ${PROJECT_BINARY_DIR}/html/examples/javadoc-banner/html/index.html
${PROJECT_BINARY_DIR}/html/examples/page/html/index.html
${PROJECT_BINARY_DIR}/html/examples/relates/html/index.html
${PROJECT_BINARY_DIR}/html/examples/author/html/index.html
@@ -85,6 +86,13 @@ add_custom_command(
)
add_custom_command(
+ COMMAND ${EXECUTABLE_OUTPUT_PATH}/doxygen javadoc-banner.cfg
+ COMMAND ${PYTHON_EXECUTABLE} ${TOP}/examples/strip_example.py < ${PROJECT_BINARY_DIR}/html/examples/javadoc-banner/latex/refman.tex > ${PROJECT_BINARY_DIR}/html/examples/javadoc-banner/latex/refman_doc.tex
+ DEPENDS doxygen javadoc-banner.h javadoc-banner.cfg ${TOP}/examples/strip_example.py
+ OUTPUT ${PROJECT_BINARY_DIR}/html/examples/javadoc-banner/html/index.html ${PROJECT_BINARY_DIR}/html/examples/javadoc-banner/latex/refman_doc.tex
+)
+
+add_custom_command(
COMMAND ${EXECUTABLE_OUTPUT_PATH}/doxygen page.cfg
COMMAND ${PYTHON_EXECUTABLE} ${TOP}/examples/strip_example.py < ${PROJECT_BINARY_DIR}/html/examples/page/latex/refman.tex > ${PROJECT_BINARY_DIR}/html/examples/page/latex/refman_doc.tex
DEPENDS doxygen page.doc page.cfg ${TOP}/examples/strip_example.py
diff --git a/examples/javadoc-banner.cfg b/examples/javadoc-banner.cfg
new file mode 100644
index 0000000..d650dbc
--- /dev/null
+++ b/examples/javadoc-banner.cfg
@@ -0,0 +1,15 @@
+PROJECT_NAME = "Javadoc Banner"
+OUTPUT_DIRECTORY = ../html/examples/javadoc-banner
+GENERATE_LATEX = YES
+GENERATE_MAN = NO
+GENERATE_RTF = NO
+CASE_SENSE_NAMES = NO
+INPUT = javadoc-banner.h
+STRIP_CODE_COMMENTS = NO
+QUIET = YES
+JAVADOC_AUTOBRIEF = YES
+JAVADOC_BANNER = YES
+SEARCHENGINE = NO
+COMPACT_LATEX = YES
+LATEX_HIDE_INDICES = YES
+EXTRACT_ALL = YES
diff --git a/examples/javadoc-banner.h b/examples/javadoc-banner.h
new file mode 100644
index 0000000..bc413bb
--- /dev/null
+++ b/examples/javadoc-banner.h
@@ -0,0 +1,45 @@
+/**
+ * A brief history of JavaDoc-style (C-style) comments.
+ *
+ * This is the typical JavaDoc-style C-style comment. It starts with two
+ * asterisks.
+ *
+ * @param theory Even if there is only one possible unified theory. it is just a
+ * set of rules and equations.
+ */
+void cstyle( int theory );
+
+/*******************************************************************************
+ * A brief history of JavaDoc-style (C-style) banner comments.
+ *
+ * This is the typical JavaDoc-style C-style "banner" comment. It starts with
+ * a forward slash followed by some number, n, of asterisks, where n > 2. It's
+ * written this way to be more "visible" to developers who are reading the
+ * source code.
+ *
+ * Often, developers are unaware that this is not (by default) a valid Doxygen
+ * comment block!
+ *
+ * However, as long as JAVADOC_BLOCK = YES is added to the Doxyfile, it will
+ * work as expected.
+ *
+ * This style of commenting behaves well with clang-format.
+ *
+ * @param theory Even if there is only one possible unified theory. it is just a
+ * set of rules and equations.
+ ******************************************************************************/
+void javadocBanner( int theory );
+
+/***************************************************************************//**
+ * A brief history of Doxygen-style banner comments.
+ *
+ * This is a Doxygen-style C-style "banner" comment. It starts with a "normal"
+ * comment and is then converted to a "special" comment block near the end of
+ * the first line. It is written this way to be more "visible" to developers
+ * who are reading the source code.
+ * This style of commenting behaves poorly with clang-format.
+ *
+ * @param theory Even if there is only one possible unified theory. it is just a
+ * set of rules and equations.
+ ******************************************************************************/
+void doxygenBanner( int theory );
diff --git a/src/code.l b/src/code.l
index cbcb560..ad39e0e 100644
--- a/src/code.l
+++ b/src/code.l
@@ -3553,6 +3553,24 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
BEGIN(SkipComment);
}
}
+<*>^{B}*"/**"[*]+/[^/] { // special C "banner" comment block at a new line
+ if (Config_getBool(JAVADOC_BANNER) && Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ g_lastSpecialCContext = YY_START;
+ BEGIN(RemoveSpecialCComment);
+ }
+ else
+ {
+ // check is to prevent getting stuck in skipping C++ comments
+ if (YY_START != SkipCxxComment)
+ {
+ g_lastCContext = YY_START ;
+ }
+ startFontClass("comment");
+ g_code->codify(yytext);
+ BEGIN(SkipComment);
+ }
+ }
<*>^{B}*"/*"[!*]/[^/*] { // special C comment block at a new line
if (Config_getBool(STRIP_CODE_COMMENTS))
{
diff --git a/src/config.xml b/src/config.xml
index 0b26571..0bf34a8 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -478,6 +478,17 @@ Go to the <a href="commands.html">next</a> section or return to the
]]>
</docs>
</option>
+ <option type='bool' id='JAVADOC_BANNER' defval='0'>
+ <docs>
+<![CDATA[
+ If the \c JAVADOC_BANNER tag is set to \c YES then doxygen
+ will interpret a line such as "/***************" as being the
+ beginning of a Javadoc-style comment "banner". If set to \c NO, the
+ Javadoc-style will behave just like regular comments and it will
+ not be interpreted by doxygen.
+]]>
+ </docs>
+ </option>
<option type='bool' id='QT_AUTOBRIEF' defval='0'>
<docs>
<![CDATA[
diff --git a/src/scanner.l b/src/scanner.l
index 5395e49..f94e4f8 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -6254,6 +6254,43 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
startCommentBlock(FALSE);
BEGIN( DocBlock );
}
+<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>"/**"[*]+{BL} {
+
+ static bool javadocBanner = Config_getBool(JAVADOC_BANNER);
+
+ if( javadocBanner ) {
+ lastDocContext = YY_START;
+
+ //printf("Found comment banner at %s:%d\n",yyFileName,yyLineNr);
+ if (current_root->section & Entry::SCOPE_MASK)
+ {
+ current->inside = current_root->name+"::";
+ }
+ current->docLine = yyLineNr;
+ current->docFile = yyFileName;
+ docBlockContext = YY_START;
+ docBlockInBody = YY_START==SkipCurly;
+ static bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF);
+ docBlockAutoBrief = javadocAutoBrief;
+
+ QCString indent;
+ indent.fill(' ',computeIndent(yytext,g_column));
+ docBlock=indent;
+
+ if (docBlockAutoBrief)
+ {
+ current->briefLine = yyLineNr;
+ current->briefFile = yyFileName;
+ }
+ startCommentBlock(FALSE);
+ BEGIN( DocBlock );
+ } else {
+ current->program += yytext ;
+ lastContext = YY_START ;
+ BEGIN( Comment ) ;
+ }
+
+ }
<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>("//"{B}*)?"/**"/[^/*] {
removeSlashes=(yytext[1]=='/');
lastDocContext = YY_START;