Skip to content

Commit

Permalink
Added \latexinclude command (thanks to Juan Zaratiegui for the patch)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri van Heesch committed Mar 27, 2014
1 parent 904ad3f commit 1134237
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 3 deletions.
14 changes: 14 additions & 0 deletions doc/commands.doc
Expand Up @@ -117,6 +117,7 @@ documentation:
\refitem cmdinternal \\internal
\refitem cmdinvariant \\invariant
\refitem cmdinterface \\interface
\refitem cmdlatexinclude \\latexinclude
\refitem cmdlatexonly \\latexonly
\refitem cmdli \\li
\refitem cmdline \\line
Expand Down Expand Up @@ -2224,6 +2225,19 @@ Commands for displaying examples

<hr>

\section cmdlatexinclude \\latexinclude <file-name>

\addindex \\latexinclude
This command includes the file \<file-name\> as is in the LaTeX documentation.
The command is equivalent to pasting the file in the documentation and
placing \ref cmdlatexonly "\\latexonly" and \ref cmdendlatexonly "\\endlatexonly"
commands around it.

Files or directories that doxygen should look for can be specified using the
\ref cfg_example_path "EXAMPLE_PATH" tag of doxygen's configuration file.

<hr>

\htmlonly <center> \endhtmlonly
<h2>
\htmlonly --- \endhtmlonly
Expand Down
1 change: 1 addition & 0 deletions src/cmdmapper.cpp
Expand Up @@ -63,6 +63,7 @@ CommandMap cmdMap[] =
{ "internal", CMD_INTERNAL },
{ "invariant", CMD_INVARIANT },
{ "javalink", CMD_JAVALINK },
{ "latexinclude", CMD_LATEXINCLUDE },
{ "latexonly", CMD_LATEXONLY },
{ "li", CMD_LI },
{ "line", CMD_LINE },
Expand Down
3 changes: 2 additions & 1 deletion src/cmdmapper.h
Expand Up @@ -124,7 +124,8 @@ enum CommandType
CMD_ENDINTERNAL = 94,
CMD_PARBLOCK = 95,
CMD_ENDPARBLOCK = 96,
CMD_DIAFILE = 97
CMD_DIAFILE = 97,
CMD_LATEXINCLUDE = 98
};

enum HtmlTagType
Expand Down
3 changes: 2 additions & 1 deletion src/commentscan.l
Expand Up @@ -234,6 +234,7 @@ static DocCmdMap docCmdMap[] =
{ "include", 0, TRUE },
{ "includelineno", 0, TRUE },
{ "invariant", 0, TRUE },
{ "latexinclude", 0, FALSE },
{ "li", 0, TRUE },
{ "line", 0, TRUE },
{ "note", 0, TRUE },
Expand Down Expand Up @@ -879,7 +880,7 @@ DCMD1 ("arg"|"attention"|"author"|"cite"|"code")
DCMD2 ("date"|"dot"|"msc"|"dotfile"|"example")
DCMD3 ("htmlinclude"|"htmlonly"|"image"|"include")
DCMD4 ("includelineno"|"internal"|"invariant")
DCMD5 ("latexonly"|"li"|"line"|"manonly"|"name")
DCMD5 ("latexinclude"|"latexonly"|"li"|"line"|"manonly"|"name")
DCMD6 ("note"|"par"|"paragraph"|"param"|"post")
DCMD7 ("pre"|"remarks"|(("relate"[sd])("also")?))
DCMD8 ("remarks"|("return"[s]?)|"retval"|"sa"|"section")
Expand Down
2 changes: 2 additions & 0 deletions src/docbookvisitor.cpp
Expand Up @@ -285,6 +285,8 @@ void DocbookDocVisitor::visit(DocInclude *inc)
break;
case DocInclude::HtmlInclude:
break;
case DocInclude::LatexInclude:
break;
case DocInclude::VerbInclude:
m_t << "<verbatim>";
filter(inc->text());
Expand Down
6 changes: 6 additions & 0 deletions src/docparser.cpp
Expand Up @@ -1777,6 +1777,9 @@ void DocInclude::parse()
case HtmlInclude:
readTextFileByName(m_file,m_text);
break;
case LatexInclude:
readTextFileByName(m_file,m_text);
break;
case Snippet:
readTextFileByName(m_file,m_text);
// check here for the existence of the blockId inside the file, so we
Expand Down Expand Up @@ -5628,6 +5631,9 @@ int DocPara::handleCommand(const QCString &cmdName)
case CMD_HTMLINCLUDE:
handleInclude(cmdName,DocInclude::HtmlInclude);
break;
case CMD_LATEXINCLUDE:
handleInclude(cmdName,DocInclude::LatexInclude);
break;
case CMD_VERBINCLUDE:
handleInclude(cmdName,DocInclude::VerbInclude);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/docparser.h
Expand Up @@ -462,7 +462,7 @@ class DocVerbatim : public DocNode
class DocInclude : public DocNode
{
public:
enum Type { Include, DontInclude, VerbInclude, HtmlInclude, IncWithLines, Snippet };
enum Type { Include, DontInclude, VerbInclude, HtmlInclude, LatexInclude, IncWithLines, Snippet };
DocInclude(DocNode *parent,const QCString &file,
const QCString context, Type t,
bool isExample,const QCString exampleFile,
Expand Down
2 changes: 2 additions & 0 deletions src/htmldocvisitor.cpp
Expand Up @@ -490,6 +490,8 @@ void HtmlDocVisitor::visit(DocInclude *inc)
case DocInclude::HtmlInclude:
m_t << inc->text();
break;
case DocInclude::LatexInclude:
break;
case DocInclude::VerbInclude:
forceEndParagraph(inc);
m_t << /*PREFRAG_START <<*/ "<pre class=\"fragment\">";
Expand Down
3 changes: 3 additions & 0 deletions src/latexdocvisitor.cpp
Expand Up @@ -362,6 +362,9 @@ void LatexDocVisitor::visit(DocInclude *inc)
break;
case DocInclude::HtmlInclude:
break;
case DocInclude::LatexInclude:
m_t << inc->text();
break;
case DocInclude::VerbInclude:
m_t << "\n\\begin{DoxyVerbInclude}\n";
m_t << inc->text();
Expand Down
2 changes: 2 additions & 0 deletions src/mandocvisitor.cpp
Expand Up @@ -262,6 +262,8 @@ void ManDocVisitor::visit(DocInclude *inc)
break;
case DocInclude::HtmlInclude:
break;
case DocInclude::LatexInclude:
break;
case DocInclude::VerbInclude:
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
Expand Down
1 change: 1 addition & 0 deletions src/perlmodgen.cpp
Expand Up @@ -704,6 +704,7 @@ void PerlModDocVisitor::visit(DocInclude *inc)
return;
case DocInclude::DontInclude: return;
case DocInclude::HtmlInclude: type = "htmlonly"; break;
case DocInclude::LatexInclude: type = "latexonly"; break;
case DocInclude::VerbInclude: type = "preformatted"; break;
case DocInclude::Snippet: return;
}
Expand Down
1 change: 1 addition & 0 deletions src/printdocvisitor.h
Expand Up @@ -165,6 +165,7 @@ class PrintDocVisitor : public DocVisitor
case DocInclude::IncWithLines: printf("incwithlines"); break;
case DocInclude::DontInclude: printf("dontinclude"); break;
case DocInclude::HtmlInclude: printf("htmlinclude"); break;
case DocInclude::LatexInclude: printf("latexinclude"); break;
case DocInclude::VerbInclude: printf("verbinclude"); break;
case DocInclude::Snippet: printf("snippet"); break;
}
Expand Down
2 changes: 2 additions & 0 deletions src/rtfdocvisitor.cpp
Expand Up @@ -382,6 +382,8 @@ void RTFDocVisitor::visit(DocInclude *inc)
break;
case DocInclude::HtmlInclude:
break;
case DocInclude::LatexInclude:
break;
case DocInclude::VerbInclude:
m_t << "{" << endl;
m_t << "\\par" << endl;
Expand Down
5 changes: 5 additions & 0 deletions src/xmldocvisitor.cpp
Expand Up @@ -255,6 +255,11 @@ void XmlDocVisitor::visit(DocInclude *inc)
filter(inc->text());
m_t << "</htmlonly>";
break;
case DocInclude::LatexInclude:
m_t << "<latexonly>";
filter(inc->text());
m_t << "</latexonly>";
break;
case DocInclude::VerbInclude:
m_t << "<verbatim>";
filter(inc->text());
Expand Down
11 changes: 11 additions & 0 deletions testing/056/indexpage.xml
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="">
<compounddef id="indexpage" kind="page">
<compoundname>index</compoundname>
<title>My Project</title>
<detaileddescription>
<para>Some text. <latexonly>\section{Hello world}
</latexonly> More text. </para>
</detaileddescription>
</compounddef>
</doxygen>
8 changes: 8 additions & 0 deletions testing/056_latexinclude.dox
@@ -0,0 +1,8 @@
// objective: test the \latexinclude command
// check: indexpage.xml
// config: EXAMPLE_PATH = .
/** \mainpage
* Some text.
* \latexinclude sample.tex
* More text.
*/
1 change: 1 addition & 0 deletions testing/sample.tex
@@ -0,0 +1 @@
\section{Hello world}

0 comments on commit 1134237

Please sign in to comment.