Skip to main content

The htmlgen.cpp File Reference

Included Headers

#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"

Functions Index

static voidwriteClientSearchBox (TextStream &t, const QCString &relPath)
static voidwriteServerSearchBox (TextStream &t, const QCString &relPath, bool highlightSearch)
static QCStringgetConvertLatexMacro ()

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

static QCStringgetSearchBox (bool serverSide, QCString relPath, bool highlightSearch)
static QCStringsubstituteHtmlKeywords (const QCString &file, const QCString &str, const QCString &title, const QCString &relPath, const QCString &navPath=QCString())
static voidfillColorStyleMap (const QCString &definitions, StringUnorderedMap &map)
static voidfillColorStyleMaps ()
static QCStringreplaceVariables (const QCString &input)
static voidwriteDefaultStyleSheet (TextStream &t)
static voidstartSectionHeader (TextStream &t, const QCString &relPath, int sectionCount)
static voidendSectionHeader (TextStream &t)
static voidstartSectionSummary (TextStream &t, int sectionCount)
static voidendSectionSummary (TextStream &t)
static voidstartSectionContent (TextStream &t, int sectionCount)
static voidendSectionContent (TextStream &t)
static voidstartQuickIndexList (TextStream &t, bool topLevel=TRUE)
static voidendQuickIndexList (TextStream &t)
static voidstartQuickIndexItem (TextStream &t, const QCString &l, bool hl, bool, const QCString &relPath)
static voidendQuickIndexItem (TextStream &t, const QCString &l)
static boolquickLinkVisible (LayoutNavEntry::Kind kind)
static voidrenderQuickLinksAsTree (TextStream &t, const QCString &relPath, LayoutNavEntry *root)
static voidrenderQuickLinksAsTabs (TextStream &t, const QCString &relPath, LayoutNavEntry *hlEntry, LayoutNavEntry::Kind kind, bool highlightParent, bool highlightSearch)
static voidwriteDefaultQuickLinks (TextStream &t, HighlightedItem hli, const QCString &file, const QCString &relPath, bool extraTabs)

Variables Index

static QCStringg_header
static QCStringg_header_file
static QCStringg_footer_file
static QCStringg_footer
static QCStringg_mathjax_code
static QCStringg_latex_macro
static constexpr autohex ="0123456789ABCDEF"
static const SelectionMarkerInfohtmlMarkerInfo = { '<', "<!--BEGIN ",10,"<!--END ",8,"-->",3 }
static StringUnorderedMapg_lightMap
static StringUnorderedMapg_darkMap
static std::mutexg_indexLock

Macro Definitions Index

#defineDBG_HTML(x)

Functions

endQuickIndexItem()

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

Definition at line 2682 of file htmlgen.cpp.

2682static void endQuickIndexItem(TextStream &t,const QCString &l)
2683{
2684 t << "</span>";
2685 if (!l.isEmpty()) t << "</a>";
2686 t << "</li>\n";
2687}

Reference QCString::isEmpty.

Referenced by renderQuickLinksAsTabs.

endQuickIndexList()

void endQuickIndexList (TextStream & t)
static

Definition at line 2655 of file htmlgen.cpp.

2656{
2657 if (!Config_getBool(DISABLE_INDEX))
2658 {
2659 t << " </ul>\n";
2660 t << " </div>\n";
2661 }
2662 else
2663 {
2664 t << "</ul>\n";
2665 }
2666}

Reference Config_getBool.

Referenced by renderQuickLinksAsTabs and renderQuickLinksAsTree.

endSectionContent()

void endSectionContent (TextStream & t)
static

Definition at line 1965 of file htmlgen.cpp.

1966{
1967 //t << "<!-- endSectionContent -->";
1968 t << "</div>\n";
1969}

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

endSectionHeader()

void endSectionHeader (TextStream & t)
static

Definition at line 1921 of file htmlgen.cpp.

1922{
1923 //t << "<!-- endSectionHeader -->";
1924 t << "</div>\n";
1925}

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

endSectionSummary()

void endSectionSummary (TextStream & t)
static

Definition at line 1939 of file htmlgen.cpp.

1940{
1941 //t << "<!-- endSectionSummary -->";
1942 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1943 if (dynamicSections)
1944 {
1945 t << "</div>\n";
1946 }
1947}

Reference 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 627 of file htmlgen.cpp.

627static void fillColorStyleMap(const QCString &definitions,StringUnorderedMap &map)
628{
629 int p=0,i=0;
630 while ((i=definitions.find('\n',p))!=-1)
631 {
632 QCString line = definitions.mid(p,i-p);
633 if (line.startsWith("--"))
634 {
635 int separator = line.find(':');
636 assert(separator!=-1);
637 std::string key = line.left(separator).str();
638 int semi = line.findRev(';');
639 assert(semi!=-1);
640 std::string value = line.mid(separator+1,semi-separator-1).stripWhiteSpace().str();
641 map.emplace(key,value);
642 //printf("var(%s)=%s\n",qPrint(key),qPrint(value));
643 }
644 p=i+1;
645 }
646}

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 648 of file htmlgen.cpp.

648static void fillColorStyleMaps()
649{
651 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
652 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
653 {
654 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("lightmode_settings.css")),g_lightMap);
655 }
656 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
657 {
658 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("darkmode_settings.css")),g_darkMap);
659 }
660}

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}

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.

309static QCString getSearchBox(bool serverSide, QCString relPath, bool highlightSearch)
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}

References TextStream::str, writeClientSearchBox and writeServerSearchBox.

Referenced by substituteHtmlKeywords.

quickLinkVisible()

bool quickLinkVisible (LayoutNavEntry::Kind kind)
static

Definition at line 2689 of file htmlgen.cpp.

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

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 2764 of file htmlgen.cpp.

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

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 2735 of file htmlgen.cpp.

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

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

Referenced by renderQuickLinksAsTree and writeDefaultQuickLinks.

replaceVariables()

QCString replaceVariables (const QCString & input)
static

Definition at line 662 of file htmlgen.cpp.

663{
664 auto doReplacements = [&input](const StringUnorderedMap &mapping) -> QCString
665 {
666 GrowBuf output;
667 int p=0,i=0;
668 while ((i=input.find("var(",p))!=-1)
669 {
670 output.addStr(input.data()+p,i-p);
671 int j=input.find(")",i+4);
672 assert(j!=-1);
673 auto it = mapping.find(input.mid(i+4,j-i-4).str()); // find variable
674 if (it==mapping.end())
675 { // should be found
676 err("failed to find value variable {}. It is not longer defined in doxygen.css\n",input.mid(i+4,j-i-4));
677 }
678 else
679 {
680 //printf("replace '%s' by '%s'\n",qPrint(input.mid(i+4,j-i-4)),qPrint(it->second));
681 output.addStr(it->second); // add it value
682 }
683 p=j+1;
684 }
685 output.addStr(input.data()+p,input.length()-p);
686 output.addChar(0);
687 return output.get();
688 };
689
690 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
691 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
692 {
693 return doReplacements(g_lightMap);
694 }
695 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
696 {
697 return doReplacements(g_darkMap);
698 }
699 else
700 {
701 return input;
702 }
703}

References GrowBuf::addChar, GrowBuf::addStr, Config_getEnum, QCString::data, err, 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 2668 of file htmlgen.cpp.

2669 bool hl,bool /*compact*/,
2670 const QCString &relPath)
2671{
2672 t << " <li";
2673 if (hl)
2674 {
2675 t << " class=\"current\"";
2676 }
2677 t << ">";
2678 if (!l.isEmpty()) t << "<a href=\"" << correctURL(l,relPath) << "\">";
2679 t << "<span>";
2680}

References correctURL and QCString::isEmpty.

Referenced by renderQuickLinksAsTabs.

startQuickIndexList()

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

Definition at line 2635 of file htmlgen.cpp.

2635static void startQuickIndexList(TextStream &t,bool topLevel=TRUE)
2636{
2637 if (!Config_getBool(DISABLE_INDEX))
2638 {
2639 if (topLevel)
2640 {
2641 t << " <div id=\"navrow1\" class=\"tabs\">\n";
2642 }
2643 else
2644 {
2645 t << " <div id=\"navrow2\" class=\"tabs2\">\n";
2646 }
2647 t << " <ul class=\"tablist\">\n";
2648 }
2649 else
2650 {
2651 t << "<ul>";
2652 }
2653}

References Config_getBool and TRUE.

Referenced by renderQuickLinksAsTabs and renderQuickLinksAsTree.

startSectionContent()

void startSectionContent (TextStream & t, int sectionCount)
static

Definition at line 1949 of file htmlgen.cpp.

1949static void startSectionContent(TextStream &t,int sectionCount)
1950{
1951 //t << "<!-- startSectionContent -->";
1952 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1953 if (dynamicSections)
1954 {
1955 t << "<div id=\"dynsection-" << sectionCount << "-content\" "
1956 "class=\"dyncontent\" "
1957 "style=\"display:none;\">\n";
1958 }
1959 else
1960 {
1961 t << "<div class=\"dyncontent\">\n";
1962 }
1963}

Reference 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 1902 of file htmlgen.cpp.

1903 const QCString &relPath,int sectionCount)
1904{
1905 //t << "<!-- startSectionHeader -->";
1906 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1907 if (dynamicSections)
1908 {
1909 t << "<div id=\"dynsection-" << sectionCount << "\" "
1910 "onclick=\"return dynsection.toggleVisibility(this)\" "
1911 "class=\"dynheader closed\" "
1912 "style=\"cursor:pointer;\">"
1913 "<span class=\"dynarrow\"><span class=\"arrowhead closed\"></span></span>";
1914 }
1915 else
1916 {
1917 t << "<div class=\"dynheader\">\n";
1918 }
1919}

Reference 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 1927 of file htmlgen.cpp.

1927static void startSectionSummary(TextStream &t,int sectionCount)
1928{
1929 //t << "<!-- startSectionSummary -->";
1930 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1931 if (dynamicSections)
1932 {
1933 t << "<div id=\"dynsection-" << sectionCount << "-summary\" "
1934 "class=\"dynsummary\" "
1935 "style=\"display:block;\">\n";
1936 }
1937}

Reference 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.

324 const QCString &str,
325 const QCString &title,
326 const QCString &relPath,
327 const QCString &navPath=QCString())
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::NO:
401 generatedBy = theTranslator->trGeneratedBy();
402 break;
403 default:
404 generatedBy = theTranslator->trGeneratedAt("<span class=\"timestamp\"></span>",
405 convertToHtml(Config_getString(PROJECT_NAME)));
406 break;
407 }
408 if (treeView)
409 {
410 treeViewCssJs = "<link href=\"$relpath^navtree.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"
411 "<script type=\"text/javascript\" src=\"$relpath^navtreedata.js\"></script>\n"
412 "<script type=\"text/javascript\" src=\"$relpath^navtree.js\"></script>\n";
413 }
414
415 if (searchEngine)
416 {
417 searchCssJs = "<link href=\"$relpath^search/search.css\" rel=\"stylesheet\" type=\"text/css\"/>\n";
418 if (!serverBasedSearch)
419 {
420 searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/searchdata.js\"></script>\n";
421 }
422 searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/search.js\"></script>\n";
423
424 if (!serverBasedSearch)
425 {
426 if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS) || Config_getBool(FULL_SIDEBAR))
427 {
428 searchCssJs += "<script type=\"text/javascript\">\n"
429 " $(function() { init_search(); });\n"
430 "</script>";
431 }
432 }
433 else
434 {
435 if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS))
436 {
437 searchCssJs += "<script type=\"text/javascript\">\n"
438 " $(function() {\n"
439 " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n"
440 " });\n"
441 "</script>\n";
442 }
443
444 // OPENSEARCH_PROVIDER {
445 searchCssJs += "<link rel=\"search\" href=\"" + relPath +
446 "search_opensearch.php?v=opensearch.xml\" "
447 "type=\"application/opensearchdescription+xml\" title=\"" +
448 (hasProjectName ? projectName : QCString("Doxygen")) +
449 "\"/>";
450 // OPENSEARCH_PROVIDER }
451 }
452 searchBox = getSearchBox(serverBasedSearch, relPath, FALSE);
453 }
454
455 if (mathJax)
456 {
457 auto mathJaxVersion = Config_getEnum(MATHJAX_VERSION);
458 QCString path = Config_getString(MATHJAX_RELPATH);
459 if (path.isEmpty() || path.startsWith("..")) // relative path
460 {
461 path.prepend(relPath);
462 }
463
464 switch (mathJaxVersion)
465 {
466 case MATHJAX_VERSION_t::MathJax_3:
467 {
468 mathJaxJs += // "<script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n" // needed for IE11 only, see #10354
469 "<script type=\"text/javascript\">\n"
470 "window.MathJax = {\n"
471 " options: {\n"
472 " ignoreHtmlClass: 'tex2jax_ignore',\n"
473 " processHtmlClass: 'tex2jax_process'\n"
474 " }";
475 const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS);
476 if (!mathJaxExtensions.empty() || !g_latex_macro.isEmpty())
477 {
478 mathJaxJs+= ",\n";
479 if (!mathJaxExtensions.empty())
480 {
481 bool first = true;
482 mathJaxJs+= " loader: {\n"
483 " load: [";
484 for (const auto &s : mathJaxExtensions)
485 {
486 if (!first) mathJaxJs+= ",";
487 mathJaxJs+= "'[tex]/"+QCString(s.c_str())+"'";
488 first = false;
489 }
490 mathJaxJs+= "]\n"
491 " },\n";
492 }
493 mathJaxJs+= " tex: {\n"
494 " macros: {";
495 if (!g_latex_macro.isEmpty())
496 {
497 mathJaxJs += g_latex_macro+" ";
498 }
499 mathJaxJs+="},\n"
500 " packages: ['base','configmacros'";
501 if (!g_latex_macro.isEmpty())
502 {
503 mathJaxJs+= ",'newcommand'";
504 }
505 for (const auto &s : mathJaxExtensions)
506 {
507 mathJaxJs+= ",'"+QCString(s.c_str())+"'";
508 }
509 mathJaxJs += "]\n"
510 " }\n";
511 }
512 else
513 {
514 mathJaxJs += "\n";
515 }
516 mathJaxJs += "};\n";
517 // MATHJAX_CODEFILE
518 if (!g_mathjax_code.isEmpty())
519 {
520 mathJaxJs += g_mathjax_code;
521 mathJaxJs += "\n";
522 }
523 mathJaxJs += "</script>\n";
524 mathJaxJs += "<script type=\"text/javascript\" id=\"MathJax-script\" async=\"async\" src=\"" +
525 path + "es5/tex-" + mathJaxFormat.lower() + ".js\">";
526 mathJaxJs+="</script>\n";
527 }
528 break;
529 case MATHJAX_VERSION_t::MathJax_2:
530 {
531 mathJaxJs = "<script type=\"text/x-mathjax-config\">\n"
532 "MathJax.Hub.Config({\n"
533 " extensions: [\"tex2jax.js\"";
534 const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS);
535 for (const auto &s : mathJaxExtensions)
536 {
537 mathJaxJs+= ", \""+QCString(s.c_str())+".js\"";
538 }
539 if (mathJaxFormat.isEmpty())
540 {
541 mathJaxFormat = "HTML-CSS";
542 }
543 mathJaxJs += "],\n"
544 " jax: [\"input/TeX\",\"output/"+mathJaxFormat+"\"],\n";
545 if (!g_latex_macro.isEmpty())
546 {
547 mathJaxJs += " TeX: { Macros: {\n";
548 mathJaxJs += g_latex_macro;
549 mathJaxJs += "\n"
550 " } }\n";
551 }
552 mathJaxJs += "});\n";
553 if (!g_mathjax_code.isEmpty())
554 {
555 mathJaxJs += g_mathjax_code;
556 mathJaxJs += "\n";
557 }
558 mathJaxJs += "</script>\n";
559 mathJaxJs += "<script type=\"text/javascript\" async=\"async\" src=\"" + path + "MathJax.js\"></script>\n";
560 }
561 break;
562 }
563 }
564
565 QCString darkModeJs;
566 if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE)
567 {
568 darkModeJs="<script type=\"text/javascript\" src=\"$relpath^darkmode_toggle.js\"></script>\n";
569 }
570
571 if (hasCookie) // extend the $treeview tag to avoid breaking old files used with HTML_HEADER
572 {
573 treeViewCssJs+="<script type=\"text/javascript\" src=\"$relpath^cookie.js\"></script>\n";
574 }
575
576 // first substitute generic keywords
577 QCString result = substituteKeywords(file,str,title,
578 convertToHtml(Config_getString(PROJECT_NAME)),
579 convertToHtml(Config_getString(PROJECT_NUMBER)),
580 convertToHtml(Config_getString(PROJECT_BRIEF)));
581
582 // then do the HTML specific keywords
583 result = substituteKeywords(file,result,
584 {
585 // keyword value getter
586 { "$navpath", [&]() { return navPath; } },
587 { "$stylesheet", [&]() { return cssFile; } },
588 { "$treeview", [&]() { return treeViewCssJs; } },
589 { "$searchbox", [&]() { return searchBox; } },
590 { "$search", [&]() { return searchCssJs; } },
591 { "$mathjax", [&]() { return mathJaxJs; } },
592 { "$darkmode", [&]() { return darkModeJs; } },
593 { "$generatedby", [&]() { return generatedBy; } },
594 { "$extrastylesheet",[&]() { return extraCssText; } },
595 { "$relpath$", [&]() { return relPath; } } //<-- obsolete: for backwards compatibility only
596 });
597
598 result = substitute(result,"$relpath^",relPath); //<-- must be done after the previous substitutions
599
600 // remove conditional blocks
601 result = selectBlocks(result,
602 {
603 // keyword, is enabled
604 { "FULL_SIDEBAR", hasFullSideBar },
605 { "DISABLE_INDEX", disableIndex },
606 { "GENERATE_TREEVIEW", treeView },
607 { "SEARCHENGINE", searchEngine },
608 { "TITLEAREA", titleArea },
609 { "PROJECT_NAME", hasProjectName },
610 { "PROJECT_NUMBER", hasProjectNumber },
611 { "PROJECT_BRIEF", hasProjectBrief },
612 { "PROJECT_LOGO", hasProjectLogo },
613 { "PROJECT_ICON", hasProjectIcon },
614 { "COPY_CLIPBOARD", hasCopyClipboard },
616
617 result = removeEmptyLines(result);
618
619 return result;
620}

References Config_getBool, Config_getEnum, Config_getEnumAsString, Config_getList, Config_getString, convertToHtml, 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.

76static void writeClientSearchBox(TextStream &t,const QCString &relPath)
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}

Reference 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 2844 of file htmlgen.cpp.

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

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 1337 of file htmlgen.cpp.

1338{
1339 t << "/* The standard CSS for doxygen " << getDoxygenVersion() << "*/\n\n";
1340 switch (Config_getEnum(HTML_COLORSTYLE))
1341 {
1342 case HTML_COLORSTYLE_t::LIGHT:
1343 case HTML_COLORSTYLE_t::DARK:
1344 /* variables will be resolved while writing to the CSS file */
1345 break;
1346 case HTML_COLORSTYLE_t::AUTO_LIGHT:
1347 case HTML_COLORSTYLE_t::TOGGLE:
1348 t << "html {\n";
1349 t << replaceColorMarkers(ResourceMgr::instance().getAsString("lightmode_settings.css"));
1350 t << "}\n\n";
1351 break;
1352 case HTML_COLORSTYLE_t::AUTO_DARK:
1353 t << "html {\n";
1354 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1355 t << "}\n\n";
1356 break;
1357 }
1358 if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::AUTO_LIGHT)
1359 {
1360 t << "@media (prefers-color-scheme: dark) {\n";
1361 t << " html:not(.dark-mode) {\n";
1362 t << " color-scheme: dark;\n\n";
1363 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1364 t << "}}\n";
1365 }
1366 else if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::AUTO_DARK)
1367 {
1368 t << "@media (prefers-color-scheme: light) {\n";
1369 t << " html:not(.light-mode) {\n";
1370 t << " color-scheme: light;\n\n";
1371 t << replaceColorMarkers(ResourceMgr::instance().getAsString("lightmode_settings.css"));
1372 t << "}}\n";
1373 }
1374 else if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE)
1375 {
1376 t << "html.dark-mode {\n";
1377 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1378 t << "}\n\n";
1379 }
1380
1381 QCString cssStr = ResourceMgr::instance().getAsString("doxygen.css");
1382 bool hasFullSidebar = Config_getBool(FULL_SIDEBAR) && Config_getBool(GENERATE_TREEVIEW);
1383 if (hasFullSidebar)
1384 {
1385 cssStr+="\n"
1386 "#titlearea {\n"
1387 " border-bottom: none;\n"
1388 " background-color: var(--nav-background-color);\n"
1389 " border-right: 1px solid var(--nav-border-color);\n"
1390 "}\n";
1391 }
1392 t << replaceVariables(cssStr);
1393
1394 bool addTimestamp = Config_getEnum(TIMESTAMP)!=TIMESTAMP_t::NO;
1395 if (addTimestamp)
1396 {
1397 QCString timeStampStr;
1398 switch (Config_getEnum(TIMESTAMP))
1399 {
1400 case TIMESTAMP_t::YES:
1401 case TIMESTAMP_t::DATETIME:
1402 timeStampStr = dateToString(DateTimeType::DateTime);
1403 break;
1404 case TIMESTAMP_t::DATE:
1405 timeStampStr = dateToString(DateTimeType::Date);
1406 break;
1407 default:
1408 break;
1409 }
1410 t << "\nhtml {\n";
1411 t << "--timestamp: '" << timeStampStr << "'\n";
1412 t << "}\n";
1413 t << "span.timestamp { content: ' '; }\n";
1414 t << "span.timestamp:before { content: var(--timestamp); }\n\n";
1415 }
1416
1417 // For Webkit based the scrollbar styling cannot be overruled (bug in chromium?).
1418 // To allow the user to style the scrollbars differently we should only add it in case
1419 // the user did not specify any extra stylesheets.
1420 bool addScrollbarStyling = Config_getList(HTML_EXTRA_STYLESHEET).empty();
1421 if (addScrollbarStyling)
1422 {
1423 t << replaceVariables(ResourceMgr::instance().getAsString("scrollbar.css"));
1424 }
1425
1426}

References Config_getBool, Config_getEnum, Config_getList, Date, DateTime, dateToString, 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.

98static void writeServerSearchBox(TextStream &t,const QCString &relPath,bool highlightSearch)
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.

Variables

g_darkMap

StringUnorderedMap g_darkMap
static

Definition at line 625 of file htmlgen.cpp.

Referenced by fillColorStyleMaps and replaceVariables.

g_footer

QCString g_footer
static

g_footer_file

QCString g_footer_file
static

g_header

g_header_file

g_indexLock

std::mutex g_indexLock
static

Definition at line 1446 of file htmlgen.cpp.

1446static std::mutex g_indexLock;

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 624 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"
constexpr static

Definition at line 70 of file htmlgen.cpp.

70static constexpr auto hex="0123456789ABCDEF";

htmlMarkerInfo

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

Definition at line 72 of file htmlgen.cpp.

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

Referenced by HtmlGenerator::init and substituteHtmlKeywords.

Macro Definitions

DBG_HTML

#define DBG_HTML(x)

Definition at line 62 of file htmlgen.cpp.

62#define DBG_HTML(x)

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.


Generated via doxygen2docusaurus by Doxygen 1.14.0.