The singlecomment.h
File Reference
Included Headers
#include <string>
Functions Index
void | generateHtmlForComment (const std::string &fileName, const std::string &text) |
Helper for implemented the -c option of doxygen, which produces HTML output for a given doxygen formatted string. More... | |
Functions
generateHtmlForComment()
|
Helper for implemented the -c option of doxygen, which produces HTML output for a given doxygen formatted string.
Declaration at line 22 of file singlecomment.h, definition at line 47 of file singlecomment.cpp.
47void generateHtmlForComment(const std::string &fn,const std::string &text)
48{
49 QCString fileName = "index.html";
50 std::shared_ptr<Entry> root = std::make_shared<Entry>();
51
52 // 1 Pass input through commentcnv
53 std::string convBuf;
54 convBuf.reserve(text.size()+1024);
55 convertCppComments(text,convBuf,"input.md");
56
57 // 2 Pass result through commentscan
58 MarkdownOutlineParser markdownParser;
59 CommentScanner scanner;
60 int lineNr=1;
61 scanner.enterFile(fileName,lineNr);
62 int pos=0;
63 bool needsEntry=false;
64 GuardedSectionStack guards;
65 Markdown markdown(fileName,1,0);
67 std::shared_ptr<Entry> current = std::make_shared<Entry>();
68 current->lang = SrcLangExt::Markdown;
69 current->fileName = fn;
70 current->docFile = fn;
71 current->docLine = 1;
72 auto prot = Protection::Public;
73 while (scanner.parseCommentBlock(&markdownParser,
74 current.get(),
75 processedDocs,
76 fileName,lineNr,
77 false, // isBrief
78 false, // isAutoBriefOn
79 false, // isInbody
80 prot,
81 pos,
82 needsEntry,
83 true, // markdownSupport
84 &guards))
85 {
86 if (needsEntry)
87 {
88 QCString docFile = current->docFile;
89 root->moveToSubEntryAndRefresh(current);
90 current->lang = SrcLangExt::Markdown;
91 current->docFile = docFile;
92 current->docLine = lineNr;
93 }
94 }
95 root->moveToSubEntryAndKeep(current);
96 scanner.leaveFile(fileName,lineNr);
97
98 // 3 Pass result through docparser
99 for (const auto &child : root->children())
100 {
101 if (!child->brief.isEmpty())
102 {
103 generateHtmlOutput(QCString(fn),child->brief);
104 }
105 if (!child->doc.isEmpty())
106 {
107 generateHtmlOutput(QCString(fn),child->doc);
108 }
109 }
110}
References convertCppComments, CommentScanner::enterFile, generateHtmlOutput, CommentScanner::leaveFile, CommentScanner::parseCommentBlock and Markdown::process.
Referenced by parseInput.
Generated via doxygen2docusaurus by Doxygen 1.14.0.