Skip to content

Commit

Permalink
Merge pull request #210 from albert-github/feature/snippet_from_curre…
Browse files Browse the repository at this point in the history
…nt_file

Create an easy possibility to take a snippet from the current file.
  • Loading branch information
Dimitri van Heesch committed Aug 26, 2014
2 parents 70a1b6e + f8ceac6 commit e269181
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/commands.doc
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,8 @@ Commands for displaying examples
\addindex \\snippet
Where the \ref cmdinclude "\\include" command can be used to include
a complete file as source code, this command can be used to quote only
a fragment of a source file.
a fragment of a source file. In case `this` is used as <file-name> the
current file is taken as file to take the snippet from.

For example, the putting the following command in the documentation,
references a snippet in file \c example.cpp residing in a subdirectory
Expand Down
1 change: 1 addition & 0 deletions src/docparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5217,6 +5217,7 @@ void DocPara::handleInclude(const QCString &cmdName,DocInclude::Type t)
QCString blockId;
if (t==DocInclude::Snippet)
{
if (fileName == "this") fileName=g_fileName;
doctokenizerYYsetStateSnippet();
tok=doctokenizerYYlex();
doctokenizerYYsetStatePara();
Expand Down

0 comments on commit e269181

Please sign in to comment.