Commit 1134237a authored by Dimitri van Heesch's avatar Dimitri van Heesch

Added \latexinclude command (thanks to Juan Zaratiegui for the patch)

parent 904ad3fb
...@@ -117,6 +117,7 @@ documentation: ...@@ -117,6 +117,7 @@ documentation:
\refitem cmdinternal \\internal \refitem cmdinternal \\internal
\refitem cmdinvariant \\invariant \refitem cmdinvariant \\invariant
\refitem cmdinterface \\interface \refitem cmdinterface \\interface
\refitem cmdlatexinclude \\latexinclude
\refitem cmdlatexonly \\latexonly \refitem cmdlatexonly \\latexonly
\refitem cmdli \\li \refitem cmdli \\li
\refitem cmdline \\line \refitem cmdline \\line
...@@ -2224,6 +2225,19 @@ Commands for displaying examples ...@@ -2224,6 +2225,19 @@ Commands for displaying examples
<hr> <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 \htmlonly <center> \endhtmlonly
<h2> <h2>
\htmlonly --- \endhtmlonly \htmlonly --- \endhtmlonly
......
...@@ -63,6 +63,7 @@ CommandMap cmdMap[] = ...@@ -63,6 +63,7 @@ CommandMap cmdMap[] =
{ "internal", CMD_INTERNAL }, { "internal", CMD_INTERNAL },
{ "invariant", CMD_INVARIANT }, { "invariant", CMD_INVARIANT },
{ "javalink", CMD_JAVALINK }, { "javalink", CMD_JAVALINK },
{ "latexinclude", CMD_LATEXINCLUDE },
{ "latexonly", CMD_LATEXONLY }, { "latexonly", CMD_LATEXONLY },
{ "li", CMD_LI }, { "li", CMD_LI },
{ "line", CMD_LINE }, { "line", CMD_LINE },
......
...@@ -124,7 +124,8 @@ enum CommandType ...@@ -124,7 +124,8 @@ enum CommandType
CMD_ENDINTERNAL = 94, CMD_ENDINTERNAL = 94,
CMD_PARBLOCK = 95, CMD_PARBLOCK = 95,
CMD_ENDPARBLOCK = 96, CMD_ENDPARBLOCK = 96,
CMD_DIAFILE = 97 CMD_DIAFILE = 97,
CMD_LATEXINCLUDE = 98
}; };
enum HtmlTagType enum HtmlTagType
......
...@@ -234,6 +234,7 @@ static DocCmdMap docCmdMap[] = ...@@ -234,6 +234,7 @@ static DocCmdMap docCmdMap[] =
{ "include", 0, TRUE }, { "include", 0, TRUE },
{ "includelineno", 0, TRUE }, { "includelineno", 0, TRUE },
{ "invariant", 0, TRUE }, { "invariant", 0, TRUE },
{ "latexinclude", 0, FALSE },
{ "li", 0, TRUE }, { "li", 0, TRUE },
{ "line", 0, TRUE }, { "line", 0, TRUE },
{ "note", 0, TRUE }, { "note", 0, TRUE },
...@@ -879,7 +880,7 @@ DCMD1 ("arg"|"attention"|"author"|"cite"|"code") ...@@ -879,7 +880,7 @@ DCMD1 ("arg"|"attention"|"author"|"cite"|"code")
DCMD2 ("date"|"dot"|"msc"|"dotfile"|"example") DCMD2 ("date"|"dot"|"msc"|"dotfile"|"example")
DCMD3 ("htmlinclude"|"htmlonly"|"image"|"include") DCMD3 ("htmlinclude"|"htmlonly"|"image"|"include")
DCMD4 ("includelineno"|"internal"|"invariant") DCMD4 ("includelineno"|"internal"|"invariant")
DCMD5 ("latexonly"|"li"|"line"|"manonly"|"name") DCMD5 ("latexinclude"|"latexonly"|"li"|"line"|"manonly"|"name")
DCMD6 ("note"|"par"|"paragraph"|"param"|"post") DCMD6 ("note"|"par"|"paragraph"|"param"|"post")
DCMD7 ("pre"|"remarks"|(("relate"[sd])("also")?)) DCMD7 ("pre"|"remarks"|(("relate"[sd])("also")?))
DCMD8 ("remarks"|("return"[s]?)|"retval"|"sa"|"section") DCMD8 ("remarks"|("return"[s]?)|"retval"|"sa"|"section")
......
...@@ -285,6 +285,8 @@ void DocbookDocVisitor::visit(DocInclude *inc) ...@@ -285,6 +285,8 @@ void DocbookDocVisitor::visit(DocInclude *inc)
break; break;
case DocInclude::HtmlInclude: case DocInclude::HtmlInclude:
break; break;
case DocInclude::LatexInclude:
break;
case DocInclude::VerbInclude: case DocInclude::VerbInclude:
m_t << "<verbatim>"; m_t << "<verbatim>";
filter(inc->text()); filter(inc->text());
......
...@@ -1777,6 +1777,9 @@ void DocInclude::parse() ...@@ -1777,6 +1777,9 @@ void DocInclude::parse()
case HtmlInclude: case HtmlInclude:
readTextFileByName(m_file,m_text); readTextFileByName(m_file,m_text);
break; break;
case LatexInclude:
readTextFileByName(m_file,m_text);
break;
case Snippet: case Snippet:
readTextFileByName(m_file,m_text); readTextFileByName(m_file,m_text);
// check here for the existence of the blockId inside the file, so we // check here for the existence of the blockId inside the file, so we
...@@ -5628,6 +5631,9 @@ int DocPara::handleCommand(const QCString &cmdName) ...@@ -5628,6 +5631,9 @@ int DocPara::handleCommand(const QCString &cmdName)
case CMD_HTMLINCLUDE: case CMD_HTMLINCLUDE:
handleInclude(cmdName,DocInclude::HtmlInclude); handleInclude(cmdName,DocInclude::HtmlInclude);
break; break;
case CMD_LATEXINCLUDE:
handleInclude(cmdName,DocInclude::LatexInclude);
break;
case CMD_VERBINCLUDE: case CMD_VERBINCLUDE:
handleInclude(cmdName,DocInclude::VerbInclude); handleInclude(cmdName,DocInclude::VerbInclude);
break; break;
......
...@@ -462,7 +462,7 @@ class DocVerbatim : public DocNode ...@@ -462,7 +462,7 @@ class DocVerbatim : public DocNode
class DocInclude : public DocNode class DocInclude : public DocNode
{ {
public: public:
enum Type { Include, DontInclude, VerbInclude, HtmlInclude, IncWithLines, Snippet }; enum Type { Include, DontInclude, VerbInclude, HtmlInclude, LatexInclude, IncWithLines, Snippet };
DocInclude(DocNode *parent,const QCString &file, DocInclude(DocNode *parent,const QCString &file,
const QCString context, Type t, const QCString context, Type t,
bool isExample,const QCString exampleFile, bool isExample,const QCString exampleFile,
......
...@@ -490,6 +490,8 @@ void HtmlDocVisitor::visit(DocInclude *inc) ...@@ -490,6 +490,8 @@ void HtmlDocVisitor::visit(DocInclude *inc)
case DocInclude::HtmlInclude: case DocInclude::HtmlInclude:
m_t << inc->text(); m_t << inc->text();
break; break;
case DocInclude::LatexInclude:
break;
case DocInclude::VerbInclude: case DocInclude::VerbInclude:
forceEndParagraph(inc); forceEndParagraph(inc);
m_t << /*PREFRAG_START <<*/ "<pre class=\"fragment\">"; m_t << /*PREFRAG_START <<*/ "<pre class=\"fragment\">";
......
...@@ -362,6 +362,9 @@ void LatexDocVisitor::visit(DocInclude *inc) ...@@ -362,6 +362,9 @@ void LatexDocVisitor::visit(DocInclude *inc)
break; break;
case DocInclude::HtmlInclude: case DocInclude::HtmlInclude:
break; break;
case DocInclude::LatexInclude:
m_t << inc->text();
break;
case DocInclude::VerbInclude: case DocInclude::VerbInclude:
m_t << "\n\\begin{DoxyVerbInclude}\n"; m_t << "\n\\begin{DoxyVerbInclude}\n";
m_t << inc->text(); m_t << inc->text();
......
...@@ -262,6 +262,8 @@ void ManDocVisitor::visit(DocInclude *inc) ...@@ -262,6 +262,8 @@ void ManDocVisitor::visit(DocInclude *inc)
break; break;
case DocInclude::HtmlInclude: case DocInclude::HtmlInclude:
break; break;
case DocInclude::LatexInclude:
break;
case DocInclude::VerbInclude: case DocInclude::VerbInclude:
if (!m_firstCol) m_t << endl; if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl; m_t << ".PP" << endl;
......
...@@ -704,6 +704,7 @@ void PerlModDocVisitor::visit(DocInclude *inc) ...@@ -704,6 +704,7 @@ void PerlModDocVisitor::visit(DocInclude *inc)
return; return;
case DocInclude::DontInclude: return; case DocInclude::DontInclude: return;
case DocInclude::HtmlInclude: type = "htmlonly"; break; case DocInclude::HtmlInclude: type = "htmlonly"; break;
case DocInclude::LatexInclude: type = "latexonly"; break;
case DocInclude::VerbInclude: type = "preformatted"; break; case DocInclude::VerbInclude: type = "preformatted"; break;
case DocInclude::Snippet: return; case DocInclude::Snippet: return;
} }
......
...@@ -165,6 +165,7 @@ class PrintDocVisitor : public DocVisitor ...@@ -165,6 +165,7 @@ class PrintDocVisitor : public DocVisitor
case DocInclude::IncWithLines: printf("incwithlines"); break; case DocInclude::IncWithLines: printf("incwithlines"); break;
case DocInclude::DontInclude: printf("dontinclude"); break; case DocInclude::DontInclude: printf("dontinclude"); break;
case DocInclude::HtmlInclude: printf("htmlinclude"); break; case DocInclude::HtmlInclude: printf("htmlinclude"); break;
case DocInclude::LatexInclude: printf("latexinclude"); break;
case DocInclude::VerbInclude: printf("verbinclude"); break; case DocInclude::VerbInclude: printf("verbinclude"); break;
case DocInclude::Snippet: printf("snippet"); break; case DocInclude::Snippet: printf("snippet"); break;
} }
......
...@@ -382,6 +382,8 @@ void RTFDocVisitor::visit(DocInclude *inc) ...@@ -382,6 +382,8 @@ void RTFDocVisitor::visit(DocInclude *inc)
break; break;
case DocInclude::HtmlInclude: case DocInclude::HtmlInclude:
break; break;
case DocInclude::LatexInclude:
break;
case DocInclude::VerbInclude: case DocInclude::VerbInclude:
m_t << "{" << endl; m_t << "{" << endl;
m_t << "\\par" << endl; m_t << "\\par" << endl;
......
...@@ -255,6 +255,11 @@ void XmlDocVisitor::visit(DocInclude *inc) ...@@ -255,6 +255,11 @@ void XmlDocVisitor::visit(DocInclude *inc)
filter(inc->text()); filter(inc->text());
m_t << "</htmlonly>"; m_t << "</htmlonly>";
break; break;
case DocInclude::LatexInclude:
m_t << "<latexonly>";
filter(inc->text());
m_t << "</latexonly>";
break;
case DocInclude::VerbInclude: case DocInclude::VerbInclude:
m_t << "<verbatim>"; m_t << "<verbatim>";
filter(inc->text()); filter(inc->text());
......
<?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>
// objective: test the \latexinclude command
// check: indexpage.xml
// config: EXAMPLE_PATH = .
/** \mainpage
* Some text.
* \latexinclude sample.tex
* More text.
*/
\section{Hello world}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment