Doxygen
Loading...
Searching...
No Matches
htmlgen.cpp File Reference
#include <stdlib.h>
#include <assert.h>
#include <mutex>
#include "message.h"
#include "htmlgen.h"
#include "config.h"
#include "util.h"
#include "doxygen.h"
#include "diagram.h"
#include "version.h"
#include "dot.h"
#include "dotcallgraph.h"
#include "dotclassgraph.h"
#include "dotdirdeps.h"
#include "dotgfxhierarchytable.h"
#include "dotgroupcollaboration.h"
#include "dotincldepgraph.h"
#include "language.h"
#include "htmlhelp.h"
#include "docparser.h"
#include "docnode.h"
#include "htmldocvisitor.h"
#include "searchindex.h"
#include "pagedef.h"
#include "debug.h"
#include "dirdef.h"
#include "vhdldocgen.h"
#include "layout.h"
#include "image.h"
#include "ftvhelp.h"
#include "resourcemgr.h"
#include "tooltip.h"
#include "growbuf.h"
#include "fileinfo.h"
#include "dir.h"
#include "utf8.h"
#include "textstream.h"
#include "indexlist.h"
#include "datetime.h"
#include "portable.h"
#include "outputlist.h"
#include "stringutil.h"
Include dependency graph for htmlgen.cpp:

Go to the source code of this file.

Macros

#define DBG_HTML(x)
 

Functions

static void writeClientSearchBox (TextStream &t, const QCString &relPath)
 
static void writeServerSearchBox (TextStream &t, const QCString &relPath, bool highlightSearch)
 
static QCString getConvertLatexMacro ()
 Convert a set of LaTeX commands \(re)newcommand to a form readable by MathJax LaTeX syntax:
 
static QCString getSearchBox (bool serverSide, QCString relPath, bool highlightSearch)
 
static QCString substituteHtmlKeywords (const QCString &file, const QCString &str, const QCString &title, const QCString &relPath, const QCString &navPath=QCString())
 
static void fillColorStyleMap (const QCString &definitions, StringUnorderedMap &map)
 
static void fillColorStyleMaps ()
 
static QCString replaceVariables (const QCString &input)
 
static void writeDefaultStyleSheet (TextStream &t)
 
static void startSectionHeader (TextStream &t, const QCString &relPath, int sectionCount)
 
static void endSectionHeader (TextStream &t)
 
static void startSectionSummary (TextStream &t, int sectionCount)
 
static void endSectionSummary (TextStream &t)
 
static void startSectionContent (TextStream &t, int sectionCount)
 
static void endSectionContent (TextStream &t)
 
static void startQuickIndexList (TextStream &t, bool topLevel=TRUE)
 
static void endQuickIndexList (TextStream &t)
 
static void startQuickIndexItem (TextStream &t, const QCString &l, bool hl, bool, const QCString &relPath)
 
static void endQuickIndexItem (TextStream &t, const QCString &l)
 
static bool quickLinkVisible (LayoutNavEntry::Kind kind)
 
static void renderQuickLinksAsTree (TextStream &t, const QCString &relPath, LayoutNavEntry *root)
 
static void renderQuickLinksAsTabs (TextStream &t, const QCString &relPath, LayoutNavEntry *hlEntry, LayoutNavEntry::Kind kind, bool highlightParent, bool highlightSearch)
 
static void writeDefaultQuickLinks (TextStream &t, HighlightedItem hli, const QCString &file, const QCString &relPath, bool extraTabs)
 

Variables

static QCString g_header
 
static QCString g_header_file
 
static QCString g_footer_file
 
static QCString g_footer
 
static QCString g_mathjax_code
 
static QCString g_latex_macro
 
static constexpr auto hex ="0123456789ABCDEF"
 
static const SelectionMarkerInfo htmlMarkerInfo = { '<', "<!--BEGIN ",10,"<!--END ",8,"-->",3 }
 
static StringUnorderedMap g_lightMap
 
static StringUnorderedMap g_darkMap
 
static std::mutex g_indexLock
 

Macro Definition Documentation

◆ DBG_HTML

#define DBG_HTML ( x)

Definition at line 62 of file htmlgen.cpp.

Referenced by HtmlGenerator::endIndent(), HtmlGenerator::endInlineMemberDoc(), HtmlGenerator::endInlineMemberName(), HtmlGenerator::endInlineMemberType(), HtmlGenerator::endLabels(), HtmlGenerator::endMemberDescription(), HtmlGenerator::endMemberDoc(), HtmlGenerator::endMemberDocList(), HtmlGenerator::endMemberDocName(), HtmlGenerator::endMemberDocPrefixItem(), HtmlGenerator::endMemberDocSimple(), HtmlGenerator::endMemberHeader(), HtmlGenerator::endMemberList(), HtmlGenerator::endMemberSections(), HtmlGenerator::endMemberSubtitle(), HtmlGenerator::endParameterExtra(), HtmlGenerator::endParameterList(), HtmlGenerator::endParameterName(), HtmlGenerator::endParameterType(), HtmlGenerator::exceptionEntry(), HtmlGenerator::insertMemberAlign(), HtmlGenerator::startIndent(), HtmlGenerator::startInlineMemberDoc(), HtmlGenerator::startInlineMemberName(), HtmlGenerator::startInlineMemberType(), HtmlGenerator::startLabels(), HtmlGenerator::startMemberDescription(), HtmlGenerator::startMemberDoc(), HtmlGenerator::startMemberDocList(), HtmlGenerator::startMemberDocName(), HtmlGenerator::startMemberDocPrefixItem(), HtmlGenerator::startMemberDocSimple(), HtmlGenerator::startMemberHeader(), HtmlGenerator::startMemberItem(), HtmlGenerator::startMemberList(), HtmlGenerator::startMemberSections(), HtmlGenerator::startMemberSubtitle(), HtmlGenerator::startParameterExtra(), HtmlGenerator::startParameterList(), HtmlGenerator::startParameterName(), HtmlGenerator::startParameterType(), HtmlGenerator::writeInheritedSectionTitle(), and HtmlGenerator::writeLabel().

Function Documentation

◆ endQuickIndexItem()

void endQuickIndexItem ( TextStream & t,
const QCString & l )
static

Definition at line 2678 of file htmlgen.cpp.

2679{
2680 t << "</span>";
2681 if (!l.isEmpty()) t << "</a>";
2682 t << "</li>\n";
2683}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150

References QCString::isEmpty().

Referenced by renderQuickLinksAsTabs().

◆ endQuickIndexList()

void endQuickIndexList ( TextStream & t)
static

Definition at line 2651 of file htmlgen.cpp.

2652{
2653 if (!Config_getBool(DISABLE_INDEX))
2654 {
2655 t << " </ul>\n";
2656 t << " </div>\n";
2657 }
2658 else
2659 {
2660 t << "</ul>\n";
2661 }
2662}
#define Config_getBool(name)
Definition config.h:33

References Config_getBool.

Referenced by renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ endSectionContent()

void endSectionContent ( TextStream & t)
static

Definition at line 1971 of file htmlgen.cpp.

1972{
1973 //t << "<!-- endSectionContent -->";
1974 t << "</div>\n";
1975}

Referenced by HtmlGenerator::endCallGraph(), HtmlGenerator::endClassDiagram(), HtmlGenerator::endDirDepGraph(), HtmlGenerator::endDotGraph(), HtmlGenerator::endGroupCollaboration(), and HtmlGenerator::endInclDepGraph().

◆ endSectionHeader()

void endSectionHeader ( TextStream & t)
static

◆ endSectionSummary()

void endSectionSummary ( TextStream & t)
static

Definition at line 1945 of file htmlgen.cpp.

1946{
1947 //t << "<!-- endSectionSummary -->";
1948 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1949 if (dynamicSections)
1950 {
1951 t << "</div>\n";
1952 }
1953}

References Config_getBool.

Referenced by HtmlGenerator::endCallGraph(), HtmlGenerator::endClassDiagram(), HtmlGenerator::endDirDepGraph(), HtmlGenerator::endDotGraph(), HtmlGenerator::endGroupCollaboration(), and HtmlGenerator::endInclDepGraph().

◆ fillColorStyleMap()

void fillColorStyleMap ( const QCString & definitions,
StringUnorderedMap & map )
static

Definition at line 637 of file htmlgen.cpp.

638{
639 int p=0,i=0;
640 while ((i=definitions.find('\n',p))!=-1)
641 {
642 QCString line = definitions.mid(p,i-p);
643 if (line.startsWith("--"))
644 {
645 int separator = line.find(':');
646 assert(separator!=-1);
647 std::string key = line.left(separator).str();
648 int semi = line.findRev(';');
649 assert(semi!=-1);
650 std::string value = line.mid(separator+1,semi-separator-1).stripWhiteSpace().str();
651 map.emplace(key,value);
652 //printf("var(%s)=%s\n",qPrint(key),qPrint(value));
653 }
654 p=i+1;
655 }
656}
This is an alternative implementation of QCString.
Definition qcstring.h:101
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
bool startsWith(const char *s) const
Definition qcstring.h:492
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:245
const std::string & str() const
Definition qcstring.h:537
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:91
QCString left(size_t len) const
Definition qcstring.h:214

References QCString::find(), QCString::findRev(), QCString::left(), QCString::mid(), QCString::startsWith(), QCString::str(), and QCString::stripWhiteSpace().

Referenced by fillColorStyleMaps().

◆ fillColorStyleMaps()

void fillColorStyleMaps ( )
static

Definition at line 658 of file htmlgen.cpp.

659{
661 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
662 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
663 {
664 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("lightmode_settings.css")),g_lightMap);
665 }
666 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
667 {
668 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("darkmode_settings.css")),g_darkMap);
669 }
670}
Singleton for managing resources compiled into an executable.
Definition resourcemgr.h:37
static ResourceMgr & instance()
Returns the one and only instance of this class.
QCString getAsString(const QCString &name) const
Gets the resource data as a C string.
#define Config_getEnum(name)
Definition config.h:35
static void fillColorStyleMap(const QCString &definitions, StringUnorderedMap &map)
Definition htmlgen.cpp:637
static StringUnorderedMap g_lightMap
Definition htmlgen.cpp:634
static StringUnorderedMap g_darkMap
Definition htmlgen.cpp:635
QCString replaceColorMarkers(const QCString &str)
Replaces any markers of the form ##AA in input string str by new markers of the form #AABBCC,...
Definition util.cpp:6284

References Config_getEnum, fillColorStyleMap(), g_darkMap, g_lightMap, ResourceMgr::getAsString(), ResourceMgr::instance(), and replaceColorMarkers().

Referenced by HtmlGenerator::init(), and HtmlGenerator::writeStyleSheetFile().

◆ getConvertLatexMacro()

QCString getConvertLatexMacro ( )
static

Convert a set of LaTeX commands \(re)newcommand to a form readable by MathJax LaTeX syntax:

\newcommand{\cmd}{replacement}
or
\renewcommand{\cmd}{replacement}

MathJax syntax:

cmd: "{replacement}"

LaTeX syntax:

\newcommand{\cmd}[nr]{replacement}
or
\renewcommand{\cmd}[nr]{replacement}

MathJax syntax:

cmd: ["{replacement}",nr]

Definition at line 149 of file htmlgen.cpp.

150{
151 QCString macrofile = Config_getString(FORMULA_MACROFILE);
152 if (macrofile.isEmpty()) return "";
153 QCString s = fileToString(macrofile);
154 macrofile = FileInfo(macrofile.str()).absFilePath();
155 size_t size = s.length();
156 GrowBuf out(size);
157 const char *data = s.data();
158 int line = 1;
159 int cnt = 0;
160 size_t i = 0;
161 QCString nr;
162 while (i < size)
163 {
164 nr = "";
165 // skip initial white space, but count lines
166 while (i < size && (data[i] == ' ' || data[i] == '\t' || data[i] == '\n'))
167 {
168 if (data[i] == '\n') line++;
169 i++;
170 }
171 if (i >= size) break;
172 // check for \newcommand or \renewcommand
173 if (data[i] != '\\')
174 {
175 warn(macrofile,line, "file contains non valid code, expected '\\' got '{:c}'",data[i]);
176 return "";
177 }
178 i++;
179 if (literal_at(data+i,"newcommand"))
180 {
181 i += strlen("newcommand");
182 }
183 else if (literal_at(data+i,"renewcommand"))
184 {
185 i += strlen("renewcommand");
186 }
187 else
188 {
189 warn(macrofile,line, "file contains non valid code, expected 'newcommand' or 'renewcommand'");
190 return "";
191 }
192 // handle {cmd}
193 if (data[i] != '{')
194 {
195 warn(macrofile,line, "file contains non valid code, expected '{{' got '{:c}'",data[i]);
196 return "";
197 }
198 i++;
199 if (data[i] != '\\')
200 {
201 warn(macrofile,line, "file contains non valid code, expected '\\' got '{:c}'",data[i]);
202 return "";
203 }
204 i++;
205 // run till }, i.e. cmd
206 out.addStr(" ");
207 while (i < size && (data[i] != '}')) out.addChar(data[i++]);
208 if (i >= size)
209 {
210 warn(macrofile,line, "file contains non valid code, no closing '}}' for command");
211 return "";
212 }
213 out.addChar(':');
214 out.addChar(' ');
215 i++;
216
217 if (data[i] == '[')
218 {
219 // handle [nr]
220 // run till ]
221 out.addChar('[');
222 i++;
223 while (i < size && (data[i] != ']')) nr += data[i++];
224 if (i >= size)
225 {
226 warn(macrofile,line, "file contains non valid code, no closing ']'");
227 return "";
228 }
229 i++;
230 }
231 else if (data[i] != '{')
232 {
233 warn(macrofile,line, "file contains non valid code, expected '[' or '{{' got '{:c}'",data[i]);
234 return "";
235 }
236 // handle {replacement}
237 // retest as the '[' part might have advanced so we can have a new '{'
238 if (data[i] != '{')
239 {
240 warn(macrofile,line, "file contains non valid code, expected '{{' got '{:c}'",data[i]);
241 return "";
242 }
243 out.addChar('"');
244 out.addChar('{');
245 i++;
246 // run till }
247 cnt = 1;
248 while (i < size && cnt)
249 {
250 switch(data[i])
251 {
252 case '\\':
253 out.addChar('\\'); // need to escape it for MathJax js code
254 out.addChar('\\');
255 i++;
256 if (data[i] == '\\') // we have an escaped backslash
257 {
258 out.addChar('\\');
259 out.addChar('\\');
260 i++;
261 }
262 else if (data[i] != '"') out.addChar(data[i++]); // double quote handled separately
263 break;
264 case '{':
265 cnt++;
266 out.addChar(data[i++]);
267 break;
268 case '}':
269 cnt--;
270 if (cnt) out.addChar(data[i]);
271 i++;
272 break;
273 case '"':
274 out.addChar('\\'); // need to escape it for MathJax js code
275 out.addChar(data[i++]);
276 break;
277 case '\n':
278 line++;
279 out.addChar(data[i++]);
280 break;
281 default:
282 out.addChar(data[i++]);
283 break;
284 }
285 }
286 if (i > size)
287 {
288 warn(macrofile,line, "file contains non valid code, no closing '}}' for replacement");
289 return "";
290 }
291 out.addChar('}');
292 out.addChar('"');
293 if (!nr.isEmpty())
294 {
295 out.addChar(',');
296 out.addStr(nr);
297 }
298 if (!nr.isEmpty())
299 {
300 out.addChar(']');
301 }
302 out.addChar(',');
303 out.addChar('\n');
304 }
305 out.addChar(0);
306 return out.get();
307}
Minimal replacement for QFileInfo.
Definition fileinfo.h:23
std::string absFilePath() const
Definition fileinfo.cpp:101
Class representing a string buffer optimized for growing.
Definition growbuf.h:28
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159
#define Config_getString(name)
Definition config.h:32
#define warn(file, line, fmt,...)
Definition message.h:97
bool literal_at(const char *data, const char(&str)[N])
returns TRUE iff data points to a substring that matches string literal str
Definition stringutil.h:98
QCString fileToString(const QCString &name, bool filter, bool isSourceCode)
Definition util.cpp:1441

References FileInfo::absFilePath(), GrowBuf::addChar(), GrowBuf::addStr(), Config_getString, QCString::data(), fileToString(), GrowBuf::get(), QCString::isEmpty(), QCString::length(), literal_at(), QCString::str(), and warn.

Referenced by HtmlGenerator::getMathJaxMacros(), and HtmlGenerator::init().

◆ getSearchBox()

QCString getSearchBox ( bool serverSide,
QCString relPath,
bool highlightSearch )
static

Definition at line 309 of file htmlgen.cpp.

310{
311 TextStream t;
312 if (serverSide)
313 {
314 writeServerSearchBox(t, relPath, highlightSearch);
315 }
316 else
317 {
318 writeClientSearchBox(t, relPath);
319 }
320 return t.str();
321}
Text streaming class that buffers data.
Definition textstream.h:36
std::string str() const
Return the contents of the buffer as a std::string object.
Definition textstream.h:229
static void writeServerSearchBox(TextStream &t, const QCString &relPath, bool highlightSearch)
Definition htmlgen.cpp:98
static void writeClientSearchBox(TextStream &t, const QCString &relPath)
Definition htmlgen.cpp:76

References TextStream::str(), writeClientSearchBox(), and writeServerSearchBox().

Referenced by substituteHtmlKeywords().

◆ quickLinkVisible()

bool quickLinkVisible ( LayoutNavEntry::Kind kind)
static

Definition at line 2685 of file htmlgen.cpp.

2686{
2687 const auto &index = Index::instance();
2688 bool showNamespaces = Config_getBool(SHOW_NAMESPACES);
2689 bool showFiles = Config_getBool(SHOW_FILES);
2690 switch (kind)
2691 {
2692 case LayoutNavEntry::MainPage: return TRUE;
2693 case LayoutNavEntry::User: return TRUE;
2694 case LayoutNavEntry::UserGroup: return TRUE;
2695 case LayoutNavEntry::Pages: return index.numIndexedPages()>0;
2696 case LayoutNavEntry::Topics: return index.numDocumentedGroups()>0;
2697 case LayoutNavEntry::Modules: return index.numDocumentedModules()>0;
2698 case LayoutNavEntry::ModuleList: return index.numDocumentedModules()>0;
2699 case LayoutNavEntry::ModuleMembers: return index.numDocumentedModuleMembers(ModuleMemberHighlight::All)>0;
2700 case LayoutNavEntry::Namespaces: return showNamespaces && index.numDocumentedNamespaces()>0;
2701 case LayoutNavEntry::NamespaceList: return showNamespaces && index.numDocumentedNamespaces()>0;
2702 case LayoutNavEntry::NamespaceMembers: return showNamespaces && index.numDocumentedNamespaceMembers(NamespaceMemberHighlight::All)>0;
2703 case LayoutNavEntry::Concepts: return index.numDocumentedConcepts()>0;
2704 case LayoutNavEntry::Classes: return index.numAnnotatedClasses()>0;
2705 case LayoutNavEntry::ClassList: return index.numAnnotatedClasses()>0;
2706 case LayoutNavEntry::ClassIndex: return index.numAnnotatedClasses()>0;
2707 case LayoutNavEntry::ClassHierarchy: return index.numHierarchyClasses()>0;
2708 case LayoutNavEntry::ClassMembers: return index.numDocumentedClassMembers(ClassMemberHighlight::All)>0;
2709 case LayoutNavEntry::Files: return showFiles && index.numDocumentedFiles()>0;
2710 case LayoutNavEntry::FileList: return showFiles && index.numDocumentedFiles()>0;
2711 case LayoutNavEntry::FileGlobals: return showFiles && index.numDocumentedFileMembers(FileMemberHighlight::All)>0;
2712 case LayoutNavEntry::Examples: return !Doxygen::exampleLinkedMap->empty();
2713 case LayoutNavEntry::Interfaces: return index.numAnnotatedInterfaces()>0;
2714 case LayoutNavEntry::InterfaceList: return index.numAnnotatedInterfaces()>0;
2715 case LayoutNavEntry::InterfaceIndex: return index.numAnnotatedInterfaces()>0;
2716 case LayoutNavEntry::InterfaceHierarchy: return index.numHierarchyInterfaces()>0;
2717 case LayoutNavEntry::Structs: return index.numAnnotatedStructs()>0;
2718 case LayoutNavEntry::StructList: return index.numAnnotatedStructs()>0;
2719 case LayoutNavEntry::StructIndex: return index.numAnnotatedStructs()>0;
2720 case LayoutNavEntry::Exceptions: return index.numAnnotatedExceptions()>0;
2721 case LayoutNavEntry::ExceptionList: return index.numAnnotatedExceptions()>0;
2722 case LayoutNavEntry::ExceptionIndex: return index.numAnnotatedExceptions()>0;
2723 case LayoutNavEntry::ExceptionHierarchy: return index.numHierarchyExceptions()>0;
2724 case LayoutNavEntry::None: // should never happen, means not properly initialized
2725 assert(kind != LayoutNavEntry::None);
2726 return FALSE;
2727 }
2728 return FALSE;
2729}
static PageLinkedMap * exampleLinkedMap
Definition doxygen.h:99
static Index & instance()
Definition index.cpp:106
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34

References ClassMemberHighlight::All, FileMemberHighlight::All, ModuleMemberHighlight::All, NamespaceMemberHighlight::All, Config_getBool, Doxygen::exampleLinkedMap, FALSE, Index::instance(), and TRUE.

Referenced by renderQuickLinksAsJs(), renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ renderQuickLinksAsTabs()

void renderQuickLinksAsTabs ( TextStream & t,
const QCString & relPath,
LayoutNavEntry * hlEntry,
LayoutNavEntry::Kind kind,
bool highlightParent,
bool highlightSearch )
static

Definition at line 2760 of file htmlgen.cpp.

2763{
2764 if (hlEntry->parent()) // first draw the tabs for the parent of hlEntry
2765 {
2766 renderQuickLinksAsTabs(t,relPath,hlEntry->parent(),kind,highlightParent,highlightSearch);
2767 }
2768 if (hlEntry->parent() && !hlEntry->parent()->children().empty()) // draw tabs for row containing hlEntry
2769 {
2770 bool topLevel = hlEntry->parent()->parent()==nullptr;
2771 int count=0;
2772 for (const auto &entry : hlEntry->parent()->children())
2773 {
2774 if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2775 }
2776 if (count>0) // at least one item is visible
2777 {
2778 startQuickIndexList(t,topLevel);
2779 for (const auto &entry : hlEntry->parent()->children())
2780 {
2781 if (entry->visible() && quickLinkVisible(entry->kind()))
2782 {
2783 QCString url = entry->url();
2784 startQuickIndexItem(t,url,
2785 entry.get()==hlEntry &&
2786 (!entry->children().empty() ||
2787 (entry->kind()==kind && !highlightParent)
2788 ),
2789 TRUE,relPath);
2790 t << fixSpaces(entry->title());
2791 endQuickIndexItem(t,url);
2792 }
2793 }
2794 if (hlEntry->parent()==LayoutDocManager::instance().rootNavEntry()) // first row is special as it contains the search box
2795 {
2796 bool searchEngine = Config_getBool(SEARCHENGINE);
2797 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2798 bool disableIndex = Config_getBool(DISABLE_INDEX);
2799 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2800 bool fullSidebar = Config_getBool(FULL_SIDEBAR);
2801 // case where DISABLE_INDEX=NO & GENERATE_TREEVIEW=YES & FULL_SIDEBAR=YES has search box in the side panel
2802 if (searchEngine)
2803 {
2804 t << " <li>\n";
2805 if (disableIndex || !generateTreeView || !fullSidebar)
2806 {
2807 if (!serverBasedSearch) // pure client side search
2808 {
2809 writeClientSearchBox(t,relPath);
2810 t << " </li>\n";
2811 }
2812 else // server based search
2813 {
2814 writeServerSearchBox(t,relPath,highlightSearch);
2815 if (!highlightSearch)
2816 {
2817 t << " </li>\n";
2818 }
2819 }
2820 }
2821 else
2822 {
2823 t << " </li>\n";
2824 }
2825 }
2826 if (!highlightSearch || Config_getBool(FULL_SIDEBAR))
2827 // on the search page the index will be ended by the page itself if the search box is part of the navigation bar
2828 {
2830 }
2831 }
2832 else // normal case for other rows than first one
2833 {
2835 }
2836 }
2837 }
2838}
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1435
static void endQuickIndexList(TextStream &t)
Definition htmlgen.cpp:2651
static void startQuickIndexList(TextStream &t, bool topLevel=TRUE)
Definition htmlgen.cpp:2631
static void startQuickIndexItem(TextStream &t, const QCString &l, bool hl, bool, const QCString &relPath)
Definition htmlgen.cpp:2664
static void renderQuickLinksAsTabs(TextStream &t, const QCString &relPath, LayoutNavEntry *hlEntry, LayoutNavEntry::Kind kind, bool highlightParent, bool highlightSearch)
Definition htmlgen.cpp:2760
static void endQuickIndexItem(TextStream &t, const QCString &l)
Definition htmlgen.cpp:2678
static bool quickLinkVisible(LayoutNavEntry::Kind kind)
Definition htmlgen.cpp:2685
const LayoutNavEntryList & children() const
Definition layout.h:219
LayoutNavEntry * parent() const
Definition layout.h:212
QCString fixSpaces(const QCString &s)
Definition util.h:471

References LayoutNavEntry::children(), Config_getBool, endQuickIndexItem(), endQuickIndexList(), fixSpaces(), LayoutDocManager::instance(), LayoutNavEntry::parent(), quickLinkVisible(), renderQuickLinksAsTabs(), startQuickIndexItem(), startQuickIndexList(), TRUE, writeClientSearchBox(), and writeServerSearchBox().

Referenced by renderQuickLinksAsTabs(), and writeDefaultQuickLinks().

◆ renderQuickLinksAsTree()

void renderQuickLinksAsTree ( TextStream & t,
const QCString & relPath,
LayoutNavEntry * root )
static

Definition at line 2731 of file htmlgen.cpp.

2733{
2734 int count=0;
2735 for (const auto &entry : root->children())
2736 {
2737 if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2738 }
2739 if (count>0) // at least one item is visible
2740 {
2742 for (const auto &entry : root->children())
2743 {
2744 if (entry->visible() && quickLinkVisible(entry->kind()))
2745 {
2746 QCString url = entry->url();
2747 t << "<li><a href=\"" << relPath << url << "\"><span>";
2748 t << fixSpaces(entry->title());
2749 t << "</span></a>\n";
2750 // recursive into child list
2751 renderQuickLinksAsTree(t,relPath,entry.get());
2752 t << "</li>";
2753 }
2754 }
2756 }
2757}
static void renderQuickLinksAsTree(TextStream &t, const QCString &relPath, LayoutNavEntry *root)
Definition htmlgen.cpp:2731

References LayoutNavEntry::children(), endQuickIndexList(), fixSpaces(), quickLinkVisible(), renderQuickLinksAsTree(), and startQuickIndexList().

Referenced by renderQuickLinksAsTree(), and writeDefaultQuickLinks().

◆ replaceVariables()

QCString replaceVariables ( const QCString & input)
static

Definition at line 672 of file htmlgen.cpp.

673{
674 auto doReplacements = [&input](const StringUnorderedMap &mapping) -> QCString
675 {
676 GrowBuf output;
677 int p=0,i=0;
678 while ((i=input.find("var(",p))!=-1)
679 {
680 output.addStr(input.data()+p,i-p);
681 int j=input.find(")",i+4);
682 assert(j!=-1);
683 auto it = mapping.find(input.mid(i+4,j-i-4).str()); // find variable
684 assert(it!=mapping.end()); // should be found
685 output.addStr(it->second); // add it value
686 //printf("replace '%s' by '%s'\n",qPrint(input.mid(i+4,j-i-4)),qPrint(it->second));
687 p=j+1;
688 }
689 output.addStr(input.data()+p,input.length()-p);
690 output.addChar(0);
691 return output.get();
692 };
693
694 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
695 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
696 {
697 return doReplacements(g_lightMap);
698 }
699 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
700 {
701 return doReplacements(g_darkMap);
702 }
703 else
704 {
705 return input;
706 }
707}
void addChar(char c)
Definition growbuf.h:69
void addStr(const QCString &s)
Definition growbuf.h:72
char * get()
Definition growbuf.h:114
std::unordered_map< std::string, std::string > StringUnorderedMap
Definition containers.h:28

References GrowBuf::addChar(), GrowBuf::addStr(), Config_getEnum, QCString::data(), QCString::find(), g_darkMap, g_lightMap, GrowBuf::get(), QCString::length(), QCString::mid(), and QCString::str().

Referenced by HtmlGenerator::getNavTreeCss(), HtmlGenerator::init(), writeDefaultStyleSheet(), and HtmlGenerator::writeSearchData().

◆ startQuickIndexItem()

void startQuickIndexItem ( TextStream & t,
const QCString & l,
bool hl,
bool ,
const QCString & relPath )
static

Definition at line 2664 of file htmlgen.cpp.

2667{
2668 t << " <li";
2669 if (hl)
2670 {
2671 t << " class=\"current\"";
2672 }
2673 t << ">";
2674 if (!l.isEmpty()) t << "<a href=\"" << correctURL(l,relPath) << "\">";
2675 t << "<span>";
2676}
QCString correctURL(const QCString &url, const QCString &relPath)
Corrects URL url according to the relative path relPath.
Definition util.cpp:6403

References correctURL(), and QCString::isEmpty().

Referenced by renderQuickLinksAsTabs().

◆ startQuickIndexList()

void startQuickIndexList ( TextStream & t,
bool topLevel = TRUE )
static

Definition at line 2631 of file htmlgen.cpp.

2632{
2633 if (!Config_getBool(DISABLE_INDEX))
2634 {
2635 if (topLevel)
2636 {
2637 t << " <div id=\"navrow1\" class=\"tabs\">\n";
2638 }
2639 else
2640 {
2641 t << " <div id=\"navrow2\" class=\"tabs2\">\n";
2642 }
2643 t << " <ul class=\"tablist\">\n";
2644 }
2645 else
2646 {
2647 t << "<ul>";
2648 }
2649}

References Config_getBool, and TRUE.

Referenced by renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ startSectionContent()

void startSectionContent ( TextStream & t,
int sectionCount )
static

Definition at line 1955 of file htmlgen.cpp.

1956{
1957 //t << "<!-- startSectionContent -->";
1958 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1959 if (dynamicSections)
1960 {
1961 t << "<div id=\"dynsection-" << sectionCount << "-content\" "
1962 "class=\"dyncontent\" "
1963 "style=\"display:none;\">\n";
1964 }
1965 else
1966 {
1967 t << "<div class=\"dyncontent\">\n";
1968 }
1969}

References Config_getBool.

Referenced by HtmlGenerator::endCallGraph(), HtmlGenerator::endClassDiagram(), HtmlGenerator::endDirDepGraph(), HtmlGenerator::endDotGraph(), HtmlGenerator::endGroupCollaboration(), and HtmlGenerator::endInclDepGraph().

◆ startSectionHeader()

void startSectionHeader ( TextStream & t,
const QCString & relPath,
int sectionCount )
static

Definition at line 1908 of file htmlgen.cpp.

1910{
1911 //t << "<!-- startSectionHeader -->";
1912 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1913 if (dynamicSections)
1914 {
1915 t << "<div id=\"dynsection-" << sectionCount << "\" "
1916 "onclick=\"return dynsection.toggleVisibility(this)\" "
1917 "class=\"dynheader closed\" "
1918 "style=\"cursor:pointer;\">"
1919 "<span class=\"dynarrow\"><span class=\"arrowhead closed\"></span></span>";
1920 }
1921 else
1922 {
1923 t << "<div class=\"dynheader\">\n";
1924 }
1925}

References Config_getBool.

Referenced by HtmlGenerator::startCallGraph(), HtmlGenerator::startClassDiagram(), HtmlGenerator::startDirDepGraph(), HtmlGenerator::startDotGraph(), HtmlGenerator::startGroupCollaboration(), and HtmlGenerator::startInclDepGraph().

◆ startSectionSummary()

void startSectionSummary ( TextStream & t,
int sectionCount )
static

Definition at line 1933 of file htmlgen.cpp.

1934{
1935 //t << "<!-- startSectionSummary -->";
1936 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1937 if (dynamicSections)
1938 {
1939 t << "<div id=\"dynsection-" << sectionCount << "-summary\" "
1940 "class=\"dynsummary\" "
1941 "style=\"display:block;\">\n";
1942 }
1943}

References Config_getBool.

Referenced by HtmlGenerator::endCallGraph(), HtmlGenerator::endClassDiagram(), HtmlGenerator::endDirDepGraph(), HtmlGenerator::endDotGraph(), HtmlGenerator::endGroupCollaboration(), and HtmlGenerator::endInclDepGraph().

◆ substituteHtmlKeywords()

QCString substituteHtmlKeywords ( const QCString & file,
const QCString & str,
const QCString & title,
const QCString & relPath,
const QCString & navPath = QCString() )
static

Definition at line 323 of file htmlgen.cpp.

328{
329 // Build CSS/JavaScript tags depending on treeview, search engine settings
330 QCString cssFile;
331 QCString generatedBy;
332 QCString treeViewCssJs;
333 QCString searchCssJs;
334 QCString searchBox;
335 QCString mathJaxJs;
336 QCString extraCssText;
337
338 QCString projectName = Config_getString(PROJECT_NAME);
339 bool treeView = Config_getBool(GENERATE_TREEVIEW);
340 bool searchEngine = Config_getBool(SEARCHENGINE);
341 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
342 bool mathJax = Config_getBool(USE_MATHJAX);
343 QCString mathJaxFormat = Config_getEnumAsString(MATHJAX_FORMAT);
344 bool disableIndex = Config_getBool(DISABLE_INDEX);
345 bool hasProjectName = !projectName.isEmpty();
346 bool hasProjectNumber = !Config_getString(PROJECT_NUMBER).isEmpty();
347 bool hasProjectBrief = !Config_getString(PROJECT_BRIEF).isEmpty();
348 bool hasProjectLogo = !Config_getString(PROJECT_LOGO).isEmpty();
349 bool hasProjectIcon = !Config_getString(PROJECT_ICON).isEmpty();
350 bool hasFullSideBar = Config_getBool(FULL_SIDEBAR) && /*disableIndex &&*/ treeView;
351 bool hasCopyClipboard = Config_getBool(HTML_COPY_CLIPBOARD);
352 bool hasCookie = treeView || searchEngine || Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE;
353 static bool titleArea = (hasProjectName || hasProjectBrief || hasProjectLogo || (disableIndex && searchEngine));
354
355 cssFile = Config_getString(HTML_STYLESHEET);
356 if (cssFile.isEmpty())
357 {
358 cssFile = "doxygen.css";
359 }
360 else
361 {
362 if (!cssFile.startsWith("http:") && !cssFile.startsWith("https:"))
363 {
364 FileInfo cssfi(cssFile.str());
365 if (cssfi.exists())
366 {
367 cssFile = cssfi.fileName();
368 }
369 else
370 {
371 cssFile = "doxygen.css";
372 }
373 }
374 }
375
376 extraCssText = "";
377 const StringVector &extraCssFile = Config_getList(HTML_EXTRA_STYLESHEET);
378 for (const auto &fileName : extraCssFile)
379 {
380 if (!fileName.empty())
381 {
382 QCString htmlStyleSheet = fileName.c_str();
383 if (htmlStyleSheet.startsWith("http:") || htmlStyleSheet.startsWith("https:"))
384 {
385 extraCssText += "<link href=\""+htmlStyleSheet+"\" rel=\"stylesheet\" type=\"text/css\"/>\n";
386 }
387 else
388 {
389 FileInfo fi(fileName);
390 if (fi.exists())
391 {
392 extraCssText += "<link href=\"$relpath^"+stripPath(fileName.c_str())+"\" rel=\"stylesheet\" type=\"text/css\"/>\n";
393 }
394 }
395 }
396 }
397
398 switch (Config_getEnum(TIMESTAMP))
399 {
400 case TIMESTAMP_t::YES:
401 case TIMESTAMP_t::DATETIME:
402 generatedBy = theTranslator->trGeneratedAt(dateToString(DateTimeType::DateTime),
403 convertToHtml(Config_getString(PROJECT_NAME)));
404 break;
405 case TIMESTAMP_t::DATE:
406 generatedBy = theTranslator->trGeneratedAt(dateToString(DateTimeType::Date),
407 convertToHtml(Config_getString(PROJECT_NAME)));
408 break;
409 case TIMESTAMP_t::NO:
410 generatedBy = theTranslator->trGeneratedBy();
411 break;
412 }
413 if (treeView)
414 {
415 treeViewCssJs = "<link href=\"$relpath^navtree.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"
416 "<script type=\"text/javascript\" src=\"$relpath^navtreedata.js\"></script>\n"
417 "<script type=\"text/javascript\" src=\"$relpath^navtree.js\"></script>\n";
418 }
419 treeViewCssJs += "<script type=\"text/javascript\" src=\"$relpath^resize.js\"></script>\n";
420
421 if (searchEngine)
422 {
423 searchCssJs = "<link href=\"$relpath^search/search.css\" rel=\"stylesheet\" type=\"text/css\"/>\n";
424 if (!serverBasedSearch)
425 {
426 searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/searchdata.js\"></script>\n";
427 }
428 searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/search.js\"></script>\n";
429
430 if (!serverBasedSearch)
431 {
432 if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS) || Config_getBool(FULL_SIDEBAR))
433 {
434 searchCssJs += "<script type=\"text/javascript\">\n"
435 "/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */\n"
436 " $(function() { init_search(); });\n"
437 "/* @license-end */\n"
438 "</script>";
439 }
440 }
441 else
442 {
443 if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS))
444 {
445 searchCssJs += "<script type=\"text/javascript\">\n"
446 "/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */\n"
447 " $(function() {\n"
448 " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n"
449 " });\n"
450 " /* @license-end */\n"
451 "</script>\n";
452 }
453
454 // OPENSEARCH_PROVIDER {
455 searchCssJs += "<link rel=\"search\" href=\"" + relPath +
456 "search_opensearch.php?v=opensearch.xml\" "
457 "type=\"application/opensearchdescription+xml\" title=\"" +
458 (hasProjectName ? projectName : QCString("Doxygen")) +
459 "\"/>";
460 // OPENSEARCH_PROVIDER }
461 }
462 searchBox = getSearchBox(serverBasedSearch, relPath, FALSE);
463 }
464
465 if (mathJax)
466 {
467 auto mathJaxVersion = Config_getEnum(MATHJAX_VERSION);
468 QCString path = Config_getString(MATHJAX_RELPATH);
469 if (path.isEmpty() || path.startsWith("..")) // relative path
470 {
471 path.prepend(relPath);
472 }
473
474 switch (mathJaxVersion)
475 {
476 case MATHJAX_VERSION_t::MathJax_3:
477 {
478 mathJaxJs += // "<script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n" // needed for IE11 only, see #10354
479 "<script type=\"text/javascript\">\n"
480 "window.MathJax = {\n"
481 " options: {\n"
482 " ignoreHtmlClass: 'tex2jax_ignore',\n"
483 " processHtmlClass: 'tex2jax_process'\n"
484 " }";
485 const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS);
486 if (!mathJaxExtensions.empty() || !g_latex_macro.isEmpty())
487 {
488 mathJaxJs+= ",\n";
489 if (!mathJaxExtensions.empty())
490 {
491 bool first = true;
492 mathJaxJs+= " loader: {\n"
493 " load: [";
494 for (const auto &s : mathJaxExtensions)
495 {
496 if (!first) mathJaxJs+= ",";
497 mathJaxJs+= "'[tex]/"+QCString(s.c_str())+"'";
498 first = false;
499 }
500 mathJaxJs+= "]\n"
501 " },\n";
502 }
503 mathJaxJs+= " tex: {\n"
504 " macros: {";
505 if (!g_latex_macro.isEmpty())
506 {
507 mathJaxJs += g_latex_macro+" ";
508 }
509 mathJaxJs+="},\n"
510 " packages: ['base','configmacros'";
511 if (!g_latex_macro.isEmpty())
512 {
513 mathJaxJs+= ",'newcommand'";
514 }
515 for (const auto &s : mathJaxExtensions)
516 {
517 mathJaxJs+= ",'"+QCString(s.c_str())+"'";
518 }
519 mathJaxJs += "]\n"
520 " }\n";
521 }
522 else
523 {
524 mathJaxJs += "\n";
525 }
526 mathJaxJs += "};\n";
527 // MATHJAX_CODEFILE
528 if (!g_mathjax_code.isEmpty())
529 {
530 mathJaxJs += g_mathjax_code;
531 mathJaxJs += "\n";
532 }
533 mathJaxJs += "</script>\n";
534 mathJaxJs += "<script type=\"text/javascript\" id=\"MathJax-script\" async=\"async\" src=\"" +
535 path + "es5/tex-" + mathJaxFormat.lower() + ".js\">";
536 mathJaxJs+="</script>\n";
537 }
538 break;
539 case MATHJAX_VERSION_t::MathJax_2:
540 {
541 mathJaxJs = "<script type=\"text/x-mathjax-config\">\n"
542 "MathJax.Hub.Config({\n"
543 " extensions: [\"tex2jax.js\"";
544 const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS);
545 for (const auto &s : mathJaxExtensions)
546 {
547 mathJaxJs+= ", \""+QCString(s.c_str())+".js\"";
548 }
549 if (mathJaxFormat.isEmpty())
550 {
551 mathJaxFormat = "HTML-CSS";
552 }
553 mathJaxJs += "],\n"
554 " jax: [\"input/TeX\",\"output/"+mathJaxFormat+"\"],\n";
555 if (!g_latex_macro.isEmpty())
556 {
557 mathJaxJs += " TeX: { Macros: {\n";
558 mathJaxJs += g_latex_macro;
559 mathJaxJs += "\n"
560 " } }\n";
561 }
562 mathJaxJs += "});\n";
563 if (!g_mathjax_code.isEmpty())
564 {
565 mathJaxJs += g_mathjax_code;
566 mathJaxJs += "\n";
567 }
568 mathJaxJs += "</script>\n";
569 mathJaxJs += "<script type=\"text/javascript\" async=\"async\" src=\"" + path + "MathJax.js\"></script>\n";
570 }
571 break;
572 }
573 }
574
575 QCString darkModeJs;
576 if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE)
577 {
578 darkModeJs="<script type=\"text/javascript\" src=\"$relpath^darkmode_toggle.js\"></script>\n";
579 }
580
581 if (hasCookie) // extend the $treeview tag to avoid breaking old files used with HTML_HEADER
582 {
583 treeViewCssJs+="<script type=\"text/javascript\" src=\"$relpath^cookie.js\"></script>\n";
584 }
585
586 // first substitute generic keywords
587 QCString result = substituteKeywords(file,str,title,
588 convertToHtml(Config_getString(PROJECT_NAME)),
589 convertToHtml(Config_getString(PROJECT_NUMBER)),
590 convertToHtml(Config_getString(PROJECT_BRIEF)));
591
592 // then do the HTML specific keywords
593 result = substituteKeywords(file,result,
594 {
595 // keyword value getter
596 { "$navpath", [&]() { return navPath; } },
597 { "$stylesheet", [&]() { return cssFile; } },
598 { "$treeview", [&]() { return treeViewCssJs; } },
599 { "$searchbox", [&]() { return searchBox; } },
600 { "$search", [&]() { return searchCssJs; } },
601 { "$mathjax", [&]() { return mathJaxJs; } },
602 { "$darkmode", [&]() { return darkModeJs; } },
603 { "$generatedby", [&]() { return generatedBy; } },
604 { "$extrastylesheet",[&]() { return extraCssText; } },
605 { "$relpath$", [&]() { return relPath; } } //<-- obsolete: for backwards compatibility only
606 });
607
608 result = substitute(result,"$relpath^",relPath); //<-- must be done after the previous substitutions
609
610 // remove conditional blocks
611 result = selectBlocks(result,
612 {
613 // keyword, is enabled
614 { "FULL_SIDEBAR", hasFullSideBar },
615 { "DISABLE_INDEX", disableIndex },
616 { "GENERATE_TREEVIEW", treeView },
617 { "SEARCHENGINE", searchEngine },
618 { "TITLEAREA", titleArea },
619 { "PROJECT_NAME", hasProjectName },
620 { "PROJECT_NUMBER", hasProjectNumber },
621 { "PROJECT_BRIEF", hasProjectBrief },
622 { "PROJECT_LOGO", hasProjectLogo },
623 { "PROJECT_ICON", hasProjectIcon },
624 { "COPY_CLIPBOARD", hasCopyClipboard },
626
627 result = removeEmptyLines(result);
628
629 return result;
630}
QCString & prepend(const char *s)
Definition qcstring.h:407
QCString lower() const
Definition qcstring.h:234
#define Config_getList(name)
Definition config.h:38
#define Config_getEnumAsString(name)
Definition config.h:36
std::vector< std::string > StringVector
Definition containers.h:33
QCString dateToString(DateTimeType includeTime)
Returns the current date, when includeTime is set also the time is provided.
Definition datetime.cpp:63
static QCString g_mathjax_code
Definition htmlgen.cpp:68
static const SelectionMarkerInfo htmlMarkerInfo
Definition htmlgen.cpp:72
static QCString getSearchBox(bool serverSide, QCString relPath, bool highlightSearch)
Definition htmlgen.cpp:309
static QCString g_latex_macro
Definition htmlgen.cpp:69
Translator * theTranslator
Definition language.cpp:71
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:477
QCString convertToHtml(const QCString &s, bool keepEntities)
Definition util.cpp:4472
QCString stripPath(const QCString &s)
Definition util.cpp:5457
QCString removeEmptyLines(const QCString &s)
Definition util.cpp:7062
QCString selectBlocks(const QCString &s, const SelectionBlockList &blockList, const SelectionMarkerInfo &markerInfo)
remove disabled blocks and all block markers from s and return the result as a string
Definition util.cpp:6885
QCString substituteKeywords(const QCString &file, const QCString &s, const KeywordSubstitutionList &keywords)
Definition util.cpp:3564

References Config_getBool, Config_getEnum, Config_getEnumAsString, Config_getList, Config_getString, convertToHtml(), Date, DateTime, dateToString(), FileInfo::exists(), FALSE, FileInfo::fileName(), g_latex_macro, g_mathjax_code, getSearchBox(), htmlMarkerInfo, QCString::isEmpty(), QCString::lower(), QCString::prepend(), removeEmptyLines(), selectBlocks(), QCString::startsWith(), QCString::str(), stripPath(), substitute(), substituteKeywords(), and theTranslator.

Referenced by HtmlGenerator::init(), HtmlGenerator::startFile(), HtmlGenerator::writeExternalSearchPage(), HtmlGenerator::writePageFooter(), and HtmlGenerator::writeSearchPage().

◆ writeClientSearchBox()

void writeClientSearchBox ( TextStream & t,
const QCString & relPath )
static

Definition at line 76 of file htmlgen.cpp.

77{
78 t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n";
79 t << " <span class=\"left\">\n";
80 t << " <span id=\"MSearchSelect\" class=\"search-icon\" ";
81 t << "onmouseover=\"return searchBox.OnSearchSelectShow()\" ";
82 t << "onmouseout=\"return searchBox.OnSearchSelectHide()\">";
83 t << "<span class=\"search-icon-dropdown\"></span></span>\n";
84 t << " <input type=\"text\" id=\"MSearchField\" value=\"\" placeholder=\""
85 << theTranslator->trSearch() << "\" accesskey=\"S\"\n";
86 t << " onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n";
87 t << " onblur=\"searchBox.OnSearchFieldFocus(false)\" \n";
88 t << " onkeyup=\"searchBox.OnSearchFieldChange(event)\"/>\n";
89 t << " </span><span class=\"right\">\n";
90 t << " <a id=\"MSearchClose\" href=\"javascript:searchBox.CloseResultsWindow()\">"
91 << "<div id=\"MSearchCloseImg\" class=\"close-icon\"></div></a>\n";
92 t << " </span>\n";
93 t << " </div>\n";
94}

References theTranslator.

Referenced by getSearchBox(), and renderQuickLinksAsTabs().

◆ writeDefaultQuickLinks()

void writeDefaultQuickLinks ( TextStream & t,
HighlightedItem hli,
const QCString & file,
const QCString & relPath,
bool extraTabs )
static

Definition at line 2840 of file htmlgen.cpp.

2845{
2846 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2847 bool searchEngine = Config_getBool(SEARCHENGINE);
2848 bool externalSearch = Config_getBool(EXTERNAL_SEARCH);
2849 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2850 bool fullSidebar = Config_getBool(FULL_SIDEBAR);
2851 bool disableIndex = Config_getBool(DISABLE_INDEX);
2852 bool dynamicMenus = Config_getBool(HTML_DYNAMIC_MENUS);
2854 LayoutNavEntry::Kind kind = LayoutNavEntry::None;
2855 LayoutNavEntry::Kind altKind = LayoutNavEntry::None; // fall back for the old layout file
2856 bool highlightParent=false;
2857 switch (hli) // map HLI enums to LayoutNavEntry::Kind enums
2858 {
2859 case HighlightedItem::Main: kind = LayoutNavEntry::MainPage; break;
2860 case HighlightedItem::Topics: kind = LayoutNavEntry::Topics; break;
2861 case HighlightedItem::Modules: kind = LayoutNavEntry::ModuleList; altKind = LayoutNavEntry::Modules; break;
2862 case HighlightedItem::Namespaces: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces; break;
2863 case HighlightedItem::ClassHierarchy: kind = LayoutNavEntry::ClassHierarchy; break;
2864 case HighlightedItem::InterfaceHierarchy: kind = LayoutNavEntry::InterfaceHierarchy; break;
2865 case HighlightedItem::ExceptionHierarchy: kind = LayoutNavEntry::ExceptionHierarchy; break;
2866 case HighlightedItem::Classes: kind = LayoutNavEntry::ClassIndex; altKind = LayoutNavEntry::Classes; break;
2867 case HighlightedItem::Concepts: kind = LayoutNavEntry::Concepts; break;
2868 case HighlightedItem::Interfaces: kind = LayoutNavEntry::InterfaceIndex; altKind = LayoutNavEntry::Interfaces; break;
2869 case HighlightedItem::Structs: kind = LayoutNavEntry::StructIndex; altKind = LayoutNavEntry::Structs; break;
2870 case HighlightedItem::Exceptions: kind = LayoutNavEntry::ExceptionIndex; altKind = LayoutNavEntry::Exceptions; break;
2871 case HighlightedItem::AnnotatedClasses: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes; break;
2872 case HighlightedItem::AnnotatedInterfaces: kind = LayoutNavEntry::InterfaceList; altKind = LayoutNavEntry::Interfaces; break;
2873 case HighlightedItem::AnnotatedStructs: kind = LayoutNavEntry::StructList; altKind = LayoutNavEntry::Structs; break;
2874 case HighlightedItem::AnnotatedExceptions: kind = LayoutNavEntry::ExceptionList; altKind = LayoutNavEntry::Exceptions; break;
2875 case HighlightedItem::Files: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files; break;
2876 case HighlightedItem::NamespaceMembers: kind = LayoutNavEntry::NamespaceMembers; break;
2877 case HighlightedItem::ModuleMembers: kind = LayoutNavEntry::ModuleMembers; break;
2878 case HighlightedItem::Functions: kind = LayoutNavEntry::ClassMembers; break;
2879 case HighlightedItem::Globals: kind = LayoutNavEntry::FileGlobals; break;
2880 case HighlightedItem::Pages: kind = LayoutNavEntry::Pages; break;
2881 case HighlightedItem::Examples: kind = LayoutNavEntry::Examples; break;
2882 case HighlightedItem::UserGroup: kind = LayoutNavEntry::UserGroup; break;
2883 case HighlightedItem::ClassVisible: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes;
2884 highlightParent = true; break;
2885 case HighlightedItem::ConceptVisible: kind = LayoutNavEntry::Concepts;
2886 highlightParent = true; break;
2887 case HighlightedItem::ModuleVisible: kind = LayoutNavEntry::ModuleList; altKind = LayoutNavEntry::Modules;
2888 highlightParent = true; break;
2889 case HighlightedItem::InterfaceVisible: kind = LayoutNavEntry::InterfaceList; altKind = LayoutNavEntry::Interfaces;
2890 highlightParent = true; break;
2891 case HighlightedItem::StructVisible: kind = LayoutNavEntry::StructList; altKind = LayoutNavEntry::Structs;
2892 highlightParent = true; break;
2893 case HighlightedItem::ExceptionVisible: kind = LayoutNavEntry::ExceptionList; altKind = LayoutNavEntry::Exceptions;
2894 highlightParent = true; break;
2895 case HighlightedItem::NamespaceVisible: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces;
2896 highlightParent = true; break;
2897 case HighlightedItem::FileVisible: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files;
2898 highlightParent = true; break;
2899 case HighlightedItem::None: break;
2900 case HighlightedItem::Search: break;
2901 }
2902
2903 if (!disableIndex && dynamicMenus)
2904 {
2905 QCString searchPage;
2906 if (externalSearch)
2907 {
2908 searchPage = "search" + Doxygen::htmlFileExtension;
2909 }
2910 else
2911 {
2912 searchPage = "search.php";
2913 }
2914 t << "<script type=\"text/javascript\" src=\"" << relPath << "menudata.js\"></script>\n";
2915 t << "<script type=\"text/javascript\" src=\"" << relPath << "menu.js\"></script>\n";
2916 t << "<script type=\"text/javascript\">\n";
2917 t << "/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */\n";
2918 t << "$(function() {\n";
2919 t << " initMenu('" << relPath << "',"
2920 << (searchEngine && !(generateTreeView && fullSidebar)?"true":"false") << ","
2921 << (serverBasedSearch?"true":"false") << ",'"
2922 << searchPage << "','"
2923 << theTranslator->trSearch() << "',"
2924 << (generateTreeView?"true":"false")
2925 << ");\n";
2926 if (searchEngine)
2927 {
2928 if (!serverBasedSearch)
2929 {
2930 if (!disableIndex && dynamicMenus && !fullSidebar)
2931 {
2932 t << " $(function() { init_search(); });\n";
2933 }
2934 }
2935 else
2936 {
2937 t << " $(function() {\n"
2938 << " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n";
2939 t << " });\n";
2940 }
2941 }
2942 t << "});\n";
2943 t << "/* @license-end */\n";
2944 t << "</script>\n";
2945 t << "<div id=\"main-nav\"></div>\n";
2946 }
2947 else if (!disableIndex) // && !Config_getBool(HTML_DYNAMIC_MENUS)
2948 {
2949 // find highlighted index item
2950 LayoutNavEntry *hlEntry = root->find(kind,kind==LayoutNavEntry::UserGroup ? file : QCString());
2951 if (!hlEntry && altKind!=LayoutNavEntry::None) { hlEntry=root->find(altKind); kind=altKind; }
2952 if (!hlEntry) // highlighted item not found in the index! -> just show the level 1 index...
2953 {
2954 highlightParent=TRUE;
2955 hlEntry = root->children().front().get();
2956 if (hlEntry==nullptr)
2957 {
2958 return; // argl, empty index!
2959 }
2960 }
2961 if (kind==LayoutNavEntry::UserGroup)
2962 {
2963 LayoutNavEntry *e = hlEntry->children().front().get();
2964 if (e)
2965 {
2966 hlEntry = e;
2967 }
2968 }
2969 t << "<div id=\"main-nav\">\n";
2970 renderQuickLinksAsTabs(t,relPath,hlEntry,kind,highlightParent,hli==HighlightedItem::Search);
2971 if (!extraTabs)
2972 {
2973 t << "</div><!-- main-nav -->\n";
2974 }
2975 }
2976 else if (!generateTreeView)
2977 {
2978 renderQuickLinksAsTree(t,relPath,root);
2979 }
2980 if (generateTreeView && !disableIndex && fullSidebar && !extraTabs)
2981 {
2982 t << "<div id=\"doc-content\">\n";
2983 }
2984}
static QCString htmlFileExtension
Definition doxygen.h:122
LayoutNavEntry * rootNavEntry() const
returns the (invisible) root of the navigation tree.
Definition layout.cpp:1446
@ AnnotatedExceptions
Definition index.h:76
@ InterfaceVisible
Definition index.h:89
@ InterfaceHierarchy
Definition index.h:66
@ AnnotatedInterfaces
Definition index.h:74
@ NamespaceMembers
Definition index.h:78
@ AnnotatedClasses
Definition index.h:73
@ AnnotatedStructs
Definition index.h:75
@ ExceptionVisible
Definition index.h:91
@ NamespaceVisible
Definition index.h:92
@ ExceptionHierarchy
Definition index.h:67
Base class for the layout of a navigation item at the top of the HTML pages.
Definition layout.h:156
LayoutNavEntry * find(LayoutNavEntry::Kind k, const QCString &file=QCString()) const
Definition layout.cpp:133
Kind
Definition layout.h:193

References AnnotatedClasses, AnnotatedExceptions, AnnotatedInterfaces, AnnotatedStructs, LayoutNavEntry::children(), Classes, ClassHierarchy, ClassVisible, Concepts, ConceptVisible, Config_getBool, Examples, ExceptionHierarchy, Exceptions, ExceptionVisible, Files, FileVisible, LayoutNavEntry::find(), Functions, Globals, Doxygen::htmlFileExtension, LayoutDocManager::instance(), InterfaceHierarchy, Interfaces, InterfaceVisible, Main, ModuleMembers, Modules, ModuleVisible, NamespaceMembers, Namespaces, NamespaceVisible, None, Pages, renderQuickLinksAsTabs(), renderQuickLinksAsTree(), LayoutDocManager::rootNavEntry(), Search, Structs, StructVisible, theTranslator, Topics, TRUE, and UserGroup.

Referenced by HtmlGenerator::writeExternalSearchPage(), HtmlGenerator::writeQuickLinks(), and HtmlGenerator::writeSearchPage().

◆ writeDefaultStyleSheet()

void writeDefaultStyleSheet ( TextStream & t)
static

Definition at line 1357 of file htmlgen.cpp.

1358{
1359 t << "/* The standard CSS for doxygen " << getDoxygenVersion() << "*/\n\n";
1360 switch (Config_getEnum(HTML_COLORSTYLE))
1361 {
1362 case HTML_COLORSTYLE_t::LIGHT:
1363 case HTML_COLORSTYLE_t::DARK:
1364 /* variables will be resolved while writing to the CSS file */
1365 break;
1366 case HTML_COLORSTYLE_t::AUTO_LIGHT:
1367 case HTML_COLORSTYLE_t::TOGGLE:
1368 t << "html {\n";
1369 t << replaceColorMarkers(ResourceMgr::instance().getAsString("lightmode_settings.css"));
1370 t << "}\n\n";
1371 break;
1372 case HTML_COLORSTYLE_t::AUTO_DARK:
1373 t << "html {\n";
1374 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1375 t << "}\n\n";
1376 break;
1377 }
1378 if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::AUTO_LIGHT)
1379 {
1380 t << "@media (prefers-color-scheme: dark) {\n";
1381 t << " html:not(.dark-mode) {\n";
1382 t << " color-scheme: dark;\n\n";
1383 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1384 t << "}}\n";
1385 }
1386 else if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::AUTO_DARK)
1387 {
1388 t << "@media (prefers-color-scheme: light) {\n";
1389 t << " html:not(.light-mode) {\n";
1390 t << " color-scheme: light;\n\n";
1391 t << replaceColorMarkers(ResourceMgr::instance().getAsString("lightmode_settings.css"));
1392 t << "}}\n";
1393 }
1394 else if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE)
1395 {
1396 t << "html.dark-mode {\n";
1397 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1398 t << "}\n\n";
1399 }
1400
1401 QCString cssStr = ResourceMgr::instance().getAsString("doxygen.css");
1402 bool hasFullSidebar = Config_getBool(FULL_SIDEBAR) && Config_getBool(GENERATE_TREEVIEW);
1403 if (hasFullSidebar)
1404 {
1405 cssStr+="\n"
1406 "#titlearea {\n"
1407 " border-bottom: none;\n"
1408 " background-color: var(--nav-background-color);\n"
1409 " border-right: 1px solid var(--nav-border-color);\n"
1410 "}\n";
1411 }
1412 t << replaceVariables(cssStr);
1413
1414 // For Webkit based the scrollbar styling cannot be overruled (bug in chromium?).
1415 // To allow the user to style the scrollbars differently we should only add it in case
1416 // the user did not specify any extra stylesheets.
1417 bool addScrollbarStyling = Config_getList(HTML_EXTRA_STYLESHEET).empty();
1418 if (addScrollbarStyling)
1419 {
1420 t << replaceVariables(ResourceMgr::instance().getAsString("scrollbar.css"));
1421 }
1422
1423}
static QCString replaceVariables(const QCString &input)
Definition htmlgen.cpp:672

References Config_getBool, Config_getEnum, Config_getList, ResourceMgr::getAsString(), ResourceMgr::instance(), replaceColorMarkers(), and replaceVariables().

Referenced by HtmlGenerator::writeStyleInfo(), LatexGenerator::writeStyleInfo(), HtmlGenerator::writeStyleSheetFile(), and LatexGenerator::writeStyleSheetFile().

◆ writeServerSearchBox()

void writeServerSearchBox ( TextStream & t,
const QCString & relPath,
bool highlightSearch )
static

Definition at line 98 of file htmlgen.cpp.

99{
100 bool externalSearch = Config_getBool(EXTERNAL_SEARCH);
101 t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n";
102 t << " <div class=\"left\">\n";
103 t << " <form id=\"FSearchBox\" action=\"" << relPath;
104 if (externalSearch)
105 {
106 t << "search" << Doxygen::htmlFileExtension;
107 }
108 else
109 {
110 t << "search.php";
111 }
112 t << "\" method=\"get\">\n";
113 t << " <span id=\"MSearchSelectExt\" class=\"search-icon\"></span>\n";
114 if (!highlightSearch || !Config_getBool(HTML_DYNAMIC_MENUS))
115 {
116 t << " <input type=\"text\" id=\"MSearchField\" name=\"query\" value=\"\" placeholder=\""
117 << theTranslator->trSearch() << "\" size=\"20\" accesskey=\"S\" \n";
118 t << " onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n";
119 t << " onblur=\"searchBox.OnSearchFieldFocus(false)\"/>\n";
120 t << " </form>\n";
121 t << " </div><div class=\"right\"></div>\n";
122 t << " </div>\n";
123 }
124}

References Config_getBool, Doxygen::htmlFileExtension, and theTranslator.

Referenced by getSearchBox(), and renderQuickLinksAsTabs().

Variable Documentation

◆ g_darkMap

StringUnorderedMap g_darkMap
static

Definition at line 635 of file htmlgen.cpp.

Referenced by fillColorStyleMaps(), and replaceVariables().

◆ g_footer

◆ g_footer_file

◆ g_header

◆ g_header_file

◆ g_indexLock

std::mutex g_indexLock
static

Definition at line 1443 of file htmlgen.cpp.

Referenced by HtmlGenerator::startFile().

◆ g_latex_macro

QCString g_latex_macro
static

Definition at line 69 of file htmlgen.cpp.

Referenced by HtmlGenerator::init(), and substituteHtmlKeywords().

◆ g_lightMap

StringUnorderedMap g_lightMap
static

Definition at line 634 of file htmlgen.cpp.

Referenced by fillColorStyleMaps(), and replaceVariables().

◆ g_mathjax_code

QCString g_mathjax_code
static

Definition at line 68 of file htmlgen.cpp.

Referenced by HtmlGenerator::init(), and substituteHtmlKeywords().

◆ hex

auto hex ="0123456789ABCDEF"
staticconstexpr

Definition at line 70 of file htmlgen.cpp.

◆ htmlMarkerInfo

const SelectionMarkerInfo htmlMarkerInfo = { '<', "<!--BEGIN ",10,"<!--END ",8,"-->",3 }
static

Definition at line 72 of file htmlgen.cpp.

72{ '<', "<!--BEGIN ",10,"<!--END ",8,"-->",3 };

Referenced by HtmlGenerator::init(), and substituteHtmlKeywords().