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 "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(), bool isSource=false)
static void fillColorStyleMap (const QCString &definitions, StringUnorderedMap &map)
static void fillColorStyleMaps ()
static QCString replaceVariables (const QCString &input)
static bool hasDateReplacement (const QCString &str)
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 bool g_build_date = false
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 61 of file htmlgen.cpp.

Referenced by HtmlGenerator::endEmbeddedDoc(), 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::startEmbeddedDoc(), 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 2798 of file htmlgen.cpp.

2799{
2800 t << "</span>";
2801 if (!l.isEmpty()) t << "</a>";
2802 t << "</li>\n";
2803}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163

References QCString::isEmpty().

Referenced by renderQuickLinksAsTabs().

◆ endQuickIndexList()

void endQuickIndexList ( TextStream & t)
static

Definition at line 2771 of file htmlgen.cpp.

2772{
2773 if (!Config_getBool(DISABLE_INDEX))
2774 {
2775 t << " </ul>\n";
2776 t << " </div>\n";
2777 }
2778 else
2779 {
2780 t << "</ul>\n";
2781 }
2782}
#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 2075 of file htmlgen.cpp.

2076{
2077 //t << "<!-- endSectionContent -->";
2078 t << "</div>\n";
2079}

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

2050{
2051 //t << "<!-- endSectionSummary -->";
2052 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
2053 if (dynamicSections)
2054 {
2055 t << "</div>\n";
2056 }
2057}

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

666{
667 int p=0,i=0;
668 while ((i=definitions.find('\n',p))!=-1)
669 {
670 QCString line = definitions.mid(p,i-p);
671 if (line.startsWith("--"))
672 {
673 int separator = line.find(':');
674 assert(separator!=-1);
675 std::string key = line.left(separator).str();
676 int semi = line.findRev(';');
677 assert(semi!=-1);
678 std::string value = line.mid(separator+1,semi-separator-1).stripWhiteSpace().str();
679 map.emplace(key,value);
680 //printf("var(%s)=%s\n",qPrint(key),qPrint(value));
681 }
682 p=i+1;
683 }
684}
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:507
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:241
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:260
const std::string & str() const
Definition qcstring.h:552
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:96
QCString left(size_t len) const
Definition qcstring.h:229

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

687{
689 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
690 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
691 {
692 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("lightmode_settings.css")),g_lightMap);
693 }
694 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
695 {
696 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("darkmode_settings.css")),g_darkMap);
697 }
698}
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:665
static StringUnorderedMap g_lightMap
Definition htmlgen.cpp:662
static StringUnorderedMap g_darkMap
Definition htmlgen.cpp:663
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:5808

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 QCString result;
157 result.reserve(size+8);
158 const char *data = s.data();
159 int line = 1;
160 int cnt = 0;
161 size_t i = 0;
162 QCString nr;
163 while (i < size)
164 {
165 nr = "";
166 // skip initial white space, but count lines
167 while (i < size && (data[i] == ' ' || data[i] == '\t' || data[i] == '\n'))
168 {
169 if (data[i] == '\n') line++;
170 i++;
171 }
172 if (i >= size) break;
173 // check for \newcommand or \renewcommand
174 if (data[i] != '\\')
175 {
176 warn(macrofile,line, "file contains non valid code, expected '\\' got '{:c}'",data[i]);
177 return "";
178 }
179 i++;
180 if (literal_at(data+i,"newcommand"))
181 {
182 i += strlen("newcommand");
183 }
184 else if (literal_at(data+i,"renewcommand"))
185 {
186 i += strlen("renewcommand");
187 }
188 else
189 {
190 warn(macrofile,line, "file contains non valid code, expected 'newcommand' or 'renewcommand'");
191 return "";
192 }
193 // handle {cmd}
194 if (data[i] != '{')
195 {
196 warn(macrofile,line, "file contains non valid code, expected '{{' got '{:c}'",data[i]);
197 return "";
198 }
199 i++;
200 if (data[i] != '\\')
201 {
202 warn(macrofile,line, "file contains non valid code, expected '\\' got '{:c}'",data[i]);
203 return "";
204 }
205 i++;
206 // run till }, i.e. cmd
207 result+=" ";
208 while (i < size && (data[i] != '}')) result+=data[i++];
209 if (i >= size)
210 {
211 warn(macrofile,line, "file contains non valid code, no closing '}}' for command");
212 return "";
213 }
214 result+=": ";
215 i++;
216
217 if (data[i] == '[')
218 {
219 // handle [nr]
220 // run till ]
221 result+='[';
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 result+="\"{";
244 i++;
245 // run till }
246 cnt = 1;
247 while (i < size && cnt)
248 {
249 switch(data[i])
250 {
251 case '\\':
252 result+="\\\\"; // need to escape it for MathJax js code
253 i++;
254 if (data[i] == '\\') // we have an escaped backslash
255 {
256 result+="\\\\";
257 i++;
258 }
259 else if (data[i] != '"') result+=data[i++]; // double quote handled separately
260 break;
261 case '{':
262 cnt++;
263 result+=data[i++];
264 break;
265 case '}':
266 cnt--;
267 if (cnt) result+=data[i];
268 i++;
269 break;
270 case '"':
271 result+='\\'; // need to escape it for MathJax js code
272 result+=data[i++];
273 break;
274 case '\n':
275 line++;
276 result+=data[i++];
277 break;
278 default:
279 result+=data[i++];
280 break;
281 }
282 }
283 if (i > size)
284 {
285 warn(macrofile,line, "file contains non valid code, no closing '}}' for replacement");
286 return "";
287 }
288 result+="}\"";
289 if (!nr.isEmpty())
290 {
291 result+=',';
292 result+=nr;
293 result+=']';
294 }
295 result+=",\n";
296 }
297 return result;
298}
Minimal replacement for QFileInfo.
Definition fileinfo.h:23
std::string absFilePath() const
Definition fileinfo.cpp:101
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
void reserve(size_t size)
Reserve space for size bytes without changing the string contents.
Definition qcstring.h:185
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:172
#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:1473

References FileInfo::absFilePath(), Config_getString, QCString::data(), fileToString(), QCString::isEmpty(), QCString::length(), literal_at(), QCString::reserve(), QCString::str(), and warn.

Referenced by HtmlGenerator::init().

◆ getSearchBox()

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

Definition at line 300 of file htmlgen.cpp.

301{
302 TextStream t;
303 if (serverSide)
304 {
305 writeServerSearchBox(t, relPath, highlightSearch);
306 }
307 else
308 {
309 writeClientSearchBox(t, relPath);
310 }
311 return t.str();
312}
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:216
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(), and writeDefaultQuickLinks().

◆ hasDateReplacement()

bool hasDateReplacement ( const QCString & str)
static

Definition at line 1188 of file htmlgen.cpp.

1189{
1190 return (str.contains("$datetime",false) ||
1191 str.contains("$date",false) ||
1192 str.contains("$time",false) ||
1193 str.contains("$year",false)
1194 );
1195}
int contains(char c, bool cs=TRUE) const
Definition qcstring.cpp:148

References QCString::contains().

Referenced by HtmlGenerator::init().

◆ quickLinkVisible()

bool quickLinkVisible ( LayoutNavEntry::Kind kind)
static

Definition at line 2805 of file htmlgen.cpp.

2806{
2807 const auto &index = Index::instance();
2808 bool showNamespaces = Config_getBool(SHOW_NAMESPACES);
2809 bool showFiles = Config_getBool(SHOW_FILES);
2810 switch (kind)
2811 {
2812 case LayoutNavEntry::MainPage: return TRUE;
2813 case LayoutNavEntry::User: return TRUE;
2814 case LayoutNavEntry::UserGroup: return TRUE;
2815 case LayoutNavEntry::Pages: return index.numIndexedPages()>0;
2816 case LayoutNavEntry::Topics: return index.numDocumentedGroups()>0;
2817 case LayoutNavEntry::Modules: return index.numDocumentedModules()>0;
2818 case LayoutNavEntry::ModuleList: return index.numDocumentedModules()>0;
2819 case LayoutNavEntry::ModuleMembers: return index.numDocumentedModuleMembers(ModuleMemberHighlight::All)>0;
2820 case LayoutNavEntry::Namespaces: return showNamespaces && index.numDocumentedNamespaces()>0;
2821 case LayoutNavEntry::NamespaceList: return showNamespaces && index.numDocumentedNamespaces()>0;
2822 case LayoutNavEntry::NamespaceMembers: return showNamespaces && index.numDocumentedNamespaceMembers(NamespaceMemberHighlight::All)>0;
2823 case LayoutNavEntry::Concepts: return index.numDocumentedConcepts()>0;
2824 case LayoutNavEntry::Classes: return index.numAnnotatedClasses()>0;
2825 case LayoutNavEntry::ClassList: return index.numAnnotatedClasses()>0;
2826 case LayoutNavEntry::ClassIndex: return index.numAnnotatedClasses()>0;
2827 case LayoutNavEntry::ClassHierarchy: return index.numHierarchyClasses()>0;
2828 case LayoutNavEntry::ClassMembers: return index.numDocumentedClassMembers(ClassMemberHighlight::All)>0;
2829 case LayoutNavEntry::Files: return showFiles && index.numDocumentedFiles()>0;
2830 case LayoutNavEntry::FileList: return showFiles && index.numDocumentedFiles()>0;
2831 case LayoutNavEntry::FileGlobals: return showFiles && index.numDocumentedFileMembers(FileMemberHighlight::All)>0;
2832 case LayoutNavEntry::Examples: return !Doxygen::exampleLinkedMap->empty();
2833 case LayoutNavEntry::Interfaces: return index.numAnnotatedInterfaces()>0;
2834 case LayoutNavEntry::InterfaceList: return index.numAnnotatedInterfaces()>0;
2835 case LayoutNavEntry::InterfaceIndex: return index.numAnnotatedInterfaces()>0;
2836 case LayoutNavEntry::InterfaceHierarchy: return index.numHierarchyInterfaces()>0;
2837 case LayoutNavEntry::Structs: return index.numAnnotatedStructs()>0;
2838 case LayoutNavEntry::StructList: return index.numAnnotatedStructs()>0;
2839 case LayoutNavEntry::StructIndex: return index.numAnnotatedStructs()>0;
2840 case LayoutNavEntry::Exceptions: return index.numAnnotatedExceptions()>0;
2841 case LayoutNavEntry::ExceptionList: return index.numAnnotatedExceptions()>0;
2842 case LayoutNavEntry::ExceptionIndex: return index.numAnnotatedExceptions()>0;
2843 case LayoutNavEntry::ExceptionHierarchy: return index.numHierarchyExceptions()>0;
2844 case LayoutNavEntry::None: // should never happen, means not properly initialized
2845 assert(kind != LayoutNavEntry::None);
2846 return FALSE;
2847 }
2848 return FALSE;
2849}
static PageLinkedMap * exampleLinkedMap
Definition doxygen.h:98
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 renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ renderQuickLinksAsTabs()

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

Definition at line 2880 of file htmlgen.cpp.

2883{
2884 if (hlEntry->parent()) // first draw the tabs for the parent of hlEntry
2885 {
2886 renderQuickLinksAsTabs(t,relPath,hlEntry->parent(),kind,highlightParent,highlightSearch);
2887 }
2888 if (hlEntry->parent() && !hlEntry->parent()->children().empty()) // draw tabs for row containing hlEntry
2889 {
2890 bool topLevel = hlEntry->parent()->parent()==nullptr;
2891 int count=0;
2892 for (const auto &entry : hlEntry->parent()->children())
2893 {
2894 if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2895 }
2896 if (count>0) // at least one item is visible
2897 {
2898 startQuickIndexList(t,topLevel);
2899 for (const auto &entry : hlEntry->parent()->children())
2900 {
2901 if (entry->visible() && quickLinkVisible(entry->kind()))
2902 {
2903 QCString url = entry->url();
2904 startQuickIndexItem(t,url,
2905 entry.get()==hlEntry &&
2906 (!entry->children().empty() ||
2907 (entry->kind()==kind && !highlightParent)
2908 ),
2909 TRUE,relPath);
2910 t << fixSpaces(entry->title());
2911 endQuickIndexItem(t,url);
2912 }
2913 }
2914 if (hlEntry->parent()==LayoutDocManager::instance().rootNavEntry()) // first row is special as it contains the search box
2915 {
2916 bool searchEngine = Config_getBool(SEARCHENGINE);
2917 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2918 bool disableIndex = Config_getBool(DISABLE_INDEX);
2919 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2920 bool fullSidebar = Config_getBool(FULL_SIDEBAR);
2921 // case where DISABLE_INDEX=NO & GENERATE_TREEVIEW=YES & FULL_SIDEBAR=YES has search box in the side panel
2922 if (searchEngine)
2923 {
2924 t << " <li>\n";
2925 if (disableIndex || !generateTreeView || !fullSidebar)
2926 {
2927 if (!serverBasedSearch) // pure client side search
2928 {
2929 writeClientSearchBox(t,relPath);
2930 t << " </li>\n";
2931 }
2932 else // server based search
2933 {
2934 writeServerSearchBox(t,relPath,highlightSearch);
2935 if (!highlightSearch)
2936 {
2937 t << " </li>\n";
2938 }
2939 }
2940 }
2941 else
2942 {
2943 t << " </li>\n";
2944 }
2945 }
2946 if (!highlightSearch || Config_getBool(FULL_SIDEBAR))
2947 // on the search page the index will be ended by the page itself if the search box is part of the navigation bar
2948 {
2950 }
2951 }
2952 else // normal case for other rows than first one
2953 {
2955 }
2956 }
2957 }
2958}
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1437
static void endQuickIndexList(TextStream &t)
Definition htmlgen.cpp:2771
static void startQuickIndexList(TextStream &t, bool topLevel=TRUE)
Definition htmlgen.cpp:2751
static void startQuickIndexItem(TextStream &t, const QCString &l, bool hl, bool, const QCString &relPath)
Definition htmlgen.cpp:2784
static void renderQuickLinksAsTabs(TextStream &t, const QCString &relPath, LayoutNavEntry *hlEntry, LayoutNavEntry::Kind kind, bool highlightParent, bool highlightSearch)
Definition htmlgen.cpp:2880
static void endQuickIndexItem(TextStream &t, const QCString &l)
Definition htmlgen.cpp:2798
static bool quickLinkVisible(LayoutNavEntry::Kind kind)
Definition htmlgen.cpp:2805
const LayoutNavEntryList & children() const
Definition layout.h:219
LayoutNavEntry * parent() const
Definition layout.h:212
QCString fixSpaces(const QCString &s)
Definition util.h:474

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

2853{
2854 int count=0;
2855 for (const auto &entry : root->children())
2856 {
2857 if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2858 }
2859 if (count>0) // at least one item is visible
2860 {
2862 for (const auto &entry : root->children())
2863 {
2864 if (entry->visible() && quickLinkVisible(entry->kind()))
2865 {
2866 QCString url = entry->url();
2867 t << "<li><a href=\"" << relPath << url << "\"><span>";
2868 t << fixSpaces(entry->title());
2869 t << "</span></a>\n";
2870 // recursive into child list
2871 renderQuickLinksAsTree(t,relPath,entry.get());
2872 t << "</li>";
2873 }
2874 }
2876 }
2877}
static void renderQuickLinksAsTree(TextStream &t, const QCString &relPath, LayoutNavEntry *root)
Definition htmlgen.cpp:2851

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

Referenced by renderQuickLinksAsTree(), and writeDefaultQuickLinks().

◆ replaceVariables()

QCString replaceVariables ( const QCString & input)
static

Definition at line 700 of file htmlgen.cpp.

701{
702 auto doReplacements = [&input](const StringUnorderedMap &mapping) -> QCString
703 {
704 QCString result;
705 result.reserve(input.length());
706 int p=0,i=0;
707 while ((i=input.find("var(",p))!=-1)
708 {
709 result+=input.mid(p,i-p);
710 int j=input.find(")",i+4);
711 assert(j!=-1);
712 auto it = mapping.find(input.mid(i+4,j-i-4).str()); // find variable
713 if (it==mapping.end())
714 { // should be found
715 err("failed to find value variable {}. It is not longer defined in doxygen.css\n",input.mid(i+4,j-i-4));
716 }
717 else
718 {
719 //printf("replace '%s' by '%s'\n",qPrint(input.mid(i+4,j-i-4)),qPrint(it->second));
720 result+=it->second; // add it value
721 }
722 p=j+1;
723 }
724 result+=input.mid(p,input.length()-p);
725 return result;
726 };
727
728 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
729 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
730 {
731 return doReplacements(g_lightMap);
732 }
733 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
734 {
735 return doReplacements(g_darkMap);
736 }
737 else
738 {
739 return input;
740 }
741}
std::unordered_map< std::string, std::string > StringUnorderedMap
Definition containers.h:28
#define err(fmt,...)
Definition message.h:127

References Config_getEnum, err, QCString::find(), g_darkMap, g_lightMap, QCString::length(), QCString::mid(), QCString::reserve(), 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 2784 of file htmlgen.cpp.

2787{
2788 t << " <li";
2789 if (hl)
2790 {
2791 t << " class=\"current\"";
2792 }
2793 t << ">";
2794 if (!l.isEmpty()) t << "<a href=\"" << correctURL(l,relPath) << "\">";
2795 t << "<span>";
2796}
QCString correctURL(const QCString &url, const QCString &relPath)
Corrects URL url according to the relative path relPath.
Definition util.cpp:5927

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

Referenced by renderQuickLinksAsTabs().

◆ startQuickIndexList()

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

Definition at line 2751 of file htmlgen.cpp.

2752{
2753 if (!Config_getBool(DISABLE_INDEX))
2754 {
2755 if (topLevel)
2756 {
2757 t << " <div id=\"navrow1\" class=\"tabs\">\n";
2758 }
2759 else
2760 {
2761 t << " <div id=\"navrow2\" class=\"tabs2\">\n";
2762 }
2763 t << " <ul class=\"tablist\">\n";
2764 }
2765 else
2766 {
2767 t << "<ul>";
2768 }
2769}

References Config_getBool, and TRUE.

Referenced by renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ startSectionContent()

void startSectionContent ( TextStream & t,
int sectionCount )
static

Definition at line 2059 of file htmlgen.cpp.

2060{
2061 //t << "<!-- startSectionContent -->";
2062 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
2063 if (dynamicSections)
2064 {
2065 t << "<div id=\"dynsection-" << sectionCount << "-content\" "
2066 "class=\"dyncontent\" "
2067 "style=\"display:none;\">\n";
2068 }
2069 else
2070 {
2071 t << "<div class=\"dyncontent\">\n";
2072 }
2073}

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

2014{
2015 //t << "<!-- startSectionHeader -->";
2016 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
2017 if (dynamicSections)
2018 {
2019 t << "<div id=\"dynsection-" << sectionCount << "\" "
2020 "onclick=\"return dynsection.toggleVisibility(this)\" "
2021 "class=\"dynheader closed\" "
2022 "style=\"cursor:pointer;\">"
2023 "<span class=\"dynarrow\"><span class=\"arrowhead closed\"></span></span>";
2024 }
2025 else
2026 {
2027 t << "<div class=\"dynheader\">\n";
2028 }
2029}

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

2038{
2039 //t << "<!-- startSectionSummary -->";
2040 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
2041 if (dynamicSections)
2042 {
2043 t << "<div id=\"dynsection-" << sectionCount << "-summary\" "
2044 "class=\"dynsummary\" "
2045 "style=\"display:block;\">\n";
2046 }
2047}

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(),
bool isSource = false )
static

Definition at line 314 of file htmlgen.cpp.

320{
321 // Build CSS/JavaScript tags depending on treeview, search engine settings
322 QCString cssFile;
323 QCString generatedBy;
324 QCString treeViewCssJs;
325 QCString searchCssJs;
326 QCString searchBox;
327 QCString mathJaxJs;
328 QCString extraCssText;
329
330 QCString projectName = Config_getString(PROJECT_NAME);
331 bool treeView = Config_getBool(GENERATE_TREEVIEW);
332 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
333 bool codeFolding = Config_getBool(HTML_CODE_FOLDING);
334 bool searchEngine = Config_getBool(SEARCHENGINE);
335 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
336 bool mathJax = Config_getBool(USE_MATHJAX);
337 bool disableIndex = Config_getBool(DISABLE_INDEX);
338 bool hasProjectName = !projectName.isEmpty();
339 bool hasProjectNumber = !Config_getString(PROJECT_NUMBER).isEmpty();
340 bool hasProjectBrief = !Config_getString(PROJECT_BRIEF).isEmpty();
341 bool hasProjectLogo = !Config_getString(PROJECT_LOGO).isEmpty();
342 bool hasProjectIcon = !Config_getString(PROJECT_ICON).isEmpty();
343 bool hasFullSideBar = Config_getBool(FULL_SIDEBAR) && /*disableIndex &&*/ treeView;
344 bool hasCopyClipboard = Config_getBool(HTML_COPY_CLIPBOARD);
345 bool hasCookie = treeView || searchEngine || Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE;
346 static bool titleArea = (hasProjectName || hasProjectBrief || hasProjectLogo || (disableIndex && searchEngine));
347
348 cssFile = Config_getString(HTML_STYLESHEET);
349 if (cssFile.isEmpty())
350 {
351 cssFile = "doxygen.css";
352 }
353 else
354 {
355 if (!cssFile.startsWith("http:") && !cssFile.startsWith("https:"))
356 {
357 FileInfo cssfi(cssFile.str());
358 if (cssfi.exists())
359 {
360 cssFile = cssfi.fileName();
361 }
362 else
363 {
364 cssFile = "doxygen.css";
365 }
366 }
367 }
368
369 extraCssText = "";
370 const StringVector &extraCssFile = Config_getList(HTML_EXTRA_STYLESHEET);
371 for (const auto &fileName : extraCssFile)
372 {
373 if (!fileName.empty())
374 {
375 QCString htmlStyleSheet = fileName;
376 if (htmlStyleSheet.startsWith("http:") || htmlStyleSheet.startsWith("https:"))
377 {
378 extraCssText += "<link href=\""+htmlStyleSheet+"\" rel=\"stylesheet\" type=\"text/css\"/>\n";
379 }
380 else
381 {
382 FileInfo fi(fileName);
383 if (fi.exists())
384 {
385 extraCssText += "<link href=\"$relpath^"+stripPath(fileName)+"\" rel=\"stylesheet\" type=\"text/css\"/>\n";
386 }
387 }
388 }
389 }
390
391 switch (Config_getEnum(TIMESTAMP))
392 {
393 case TIMESTAMP_t::NO:
394 generatedBy = theTranslator->trGeneratedBy();
395 break;
396 default:
397 generatedBy = theTranslator->trGeneratedAt("<span class=\"timestamp\"></span>",
398 convertToHtml(Config_getString(PROJECT_NAME)));
399 break;
400 }
401 if (treeView)
402 {
403 treeViewCssJs = "<link href=\"$relpath^navtree.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"
404 "<script type=\"text/javascript\" src=\"$relpath^navtreedata.js\"></script>\n"
405 "<script type=\"text/javascript\" src=\"$relpath^navtree.js\"></script>\n";
406 }
407
408 if (searchEngine)
409 {
410 searchCssJs = "<link href=\"$relpath^search/search.css\" rel=\"stylesheet\" type=\"text/css\"/>\n";
411 if (!serverBasedSearch)
412 {
413 searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/searchdata.js\"></script>\n";
414 }
415 searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/search.js\"></script>\n";
416
417 if (!serverBasedSearch)
418 {
419 if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS) || Config_getBool(FULL_SIDEBAR))
420 {
421 searchCssJs += "<script type=\"text/javascript\">\n"
422 "document.addEventListener('DOMContentLoaded', init_search);\n"
423 "</script>";
424 }
425 }
426 else
427 {
428 if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS))
429 {
430 searchCssJs += "<script type=\"text/javascript\">\n"
431 "document.addEventListener('DOMContentLoaded', () => {\n"
432 " if (document.querySelector('.searchresults')) { searchBox.DOMSearchField().focus(); }\n"
433 "});\n"
434 "</script>\n";
435 }
436
437 // OPENSEARCH_PROVIDER {
438 searchCssJs += "<link rel=\"search\" href=\"" + relPath +
439 "search_opensearch.php?v=opensearch.xml\" "
440 "type=\"application/opensearchdescription+xml\" title=\"" +
441 (hasProjectName ? projectName : QCString("Doxygen")) +
442 "\"/>";
443 // OPENSEARCH_PROVIDER }
444 }
445 searchBox = getSearchBox(serverBasedSearch, relPath, FALSE);
446 }
447
448 if (mathJax && !isSource)
449 {
450 auto mathJaxVersion = Config_getEnum(MATHJAX_VERSION);
451 QCString path = Config_getString(MATHJAX_RELPATH);
452 if (path.isEmpty() || path.startsWith("..")) // relative path
453 {
454 path.prepend(relPath);
455 }
456
457 auto writeMathJax3Packages = [&mathJaxJs](const StringVector &mathJaxExtensions)
458 {
459 mathJaxJs += " packages: ['base','configmacros'";
460 if (!g_latex_macro.isEmpty())
461 {
462 mathJaxJs+= ",'newcommand'";
463 }
464 for (const auto &s : mathJaxExtensions)
465 {
466 mathJaxJs+= ",'"+s+"'";
467 }
468 mathJaxJs += "]\n";
469 };
470
471 auto writeMathJax4Packages = [&mathJaxJs](const StringVector &mathJaxExtensions)
472 {
473 mathJaxJs += " packages: {\n";
474 bool first = true;
475 for (const auto &s : mathJaxExtensions)
476 {
477 if (!first) mathJaxJs+= ",";
478 if (s.at(0) =='-')
479 {
480 mathJaxJs+= "\n '[-]': ['";
481 mathJaxJs+=s.data()+1;
482 mathJaxJs+="']";
483 }
484 else
485 {
486 mathJaxJs+= "\n '[+]': ['"+s+"']";
487 }
488 first = false;
489 }
490 mathJaxJs += "\n }\n";
491 };
492
493 auto writeMathJaxScript = [&path,&mathJaxJs](const QCString &pathPostfix,
494 std::function<void(const StringVector&)> writePackages)
495 {
496 QCString mathJaxFormat = Config_getEnumAsString(MATHJAX_FORMAT);
497 mathJaxJs += "<script type=\"text/javascript\">\n"
498 "window.MathJax = {\n"
499 " options: {\n"
500 " ignoreHtmlClass: 'tex2jax_ignore',\n"
501 " processHtmlClass: 'tex2jax_process'\n"
502 " }";
503 // MACRO / EXT
504 const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS);
505 if (!mathJaxExtensions.empty() || !g_latex_macro.isEmpty())
506 {
507 mathJaxJs+= ",\n";
508 if (!mathJaxExtensions.empty())
509 {
510 bool first = true;
511 mathJaxJs+= " loader: {\n"
512 " load: [";
513 for (const auto &s : mathJaxExtensions)
514 {
515 if (s.at(0) !='-')
516 {
517 if (!first) mathJaxJs+= ",";
518 mathJaxJs+= "'[tex]/"+s+"'"; // packages preceded by a minus sign should not be loaded
519 first = false;
520 }
521 }
522 mathJaxJs+= "]\n"
523 " },\n";
524 }
525 mathJaxJs+= " tex: {\n"
526 " macros: {";
527 if (!g_latex_macro.isEmpty())
528 {
529 mathJaxJs += g_latex_macro+" ";
530 }
531 mathJaxJs+="},\n";
532 writePackages(mathJaxExtensions);
533 mathJaxJs += " }\n";
534 }
535 else
536 {
537 mathJaxJs += "\n";
538 }
539 mathJaxJs += "};\n";
540 // MATHJAX_CODEFILE
541 if (!g_mathjax_code.isEmpty())
542 {
543 mathJaxJs += g_mathjax_code;
544 mathJaxJs += "\n";
545 }
546 mathJaxJs+="</script>\n";
547 mathJaxJs += "<script type=\"text/javascript\" id=\"MathJax-script\" async=\"async\" src=\"" +
548 path + pathPostfix + "tex-" + mathJaxFormat.lower() + ".js\">";
549 mathJaxJs+="</script>\n";
550 };
551
552 switch (mathJaxVersion)
553 {
554 case MATHJAX_VERSION_t::MathJax_4:
555 writeMathJaxScript("",writeMathJax4Packages);
556 break;
557 case MATHJAX_VERSION_t::MathJax_3:
558 writeMathJaxScript("es5/",writeMathJax3Packages);
559 break;
560 case MATHJAX_VERSION_t::MathJax_2:
561 {
562 QCString mathJaxFormat = Config_getEnumAsString(MATHJAX_FORMAT);
563 mathJaxJs = "<script type=\"text/x-mathjax-config\">\n"
564 "MathJax.Hub.Config({\n"
565 " extensions: [\"tex2jax.js\"";
566 const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS);
567 for (const auto &s : mathJaxExtensions)
568 {
569 mathJaxJs+= ", \""+QCString(s)+".js\"";
570 }
571 if (mathJaxFormat.isEmpty())
572 {
573 mathJaxFormat = "HTML-CSS";
574 }
575 mathJaxJs += "],\n"
576 " jax: [\"input/TeX\",\"output/"+mathJaxFormat+"\"],\n";
577 if (!g_latex_macro.isEmpty())
578 {
579 mathJaxJs += " TeX: { Macros: {\n";
580 mathJaxJs += g_latex_macro;
581 mathJaxJs += "\n"
582 " } }\n";
583 }
584 mathJaxJs += "});\n";
585 if (!g_mathjax_code.isEmpty())
586 {
587 mathJaxJs += g_mathjax_code;
588 mathJaxJs += "\n";
589 }
590 mathJaxJs += "</script>\n";
591 mathJaxJs += "<script type=\"text/javascript\" async=\"async\" src=\"" + path + "MathJax.js\"></script>\n";
592 }
593 break;
594 }
595 }
596
597 QCString darkModeJs;
598 if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE)
599 {
600 darkModeJs="<script type=\"text/javascript\" src=\"$relpath^darkmode_toggle.js\"></script>\n";
601 }
602
603 if (hasCookie) // extend the $treeview tag to avoid breaking old files used with HTML_HEADER
604 {
605 treeViewCssJs+="<script type=\"text/javascript\" src=\"$relpath^cookie.js\"></script>\n";
606 }
607
608 // first substitute generic keywords
609 QCString result = substituteKeywords(file,str,title,
610 convertToHtml(Config_getString(PROJECT_NAME)),
611 convertToHtml(Config_getString(PROJECT_NUMBER)),
612 convertToHtml(Config_getString(PROJECT_BRIEF)));
613
614 // then do the HTML specific keywords
615 result = substituteKeywords(file,result,
616 {
617 // keyword value getter
618 { "$datetime", [&]() -> QCString { return "<span class=\"datetime\"></span>"; } },
619 { "$date", [&]() -> QCString { return "<span class=\"date\"></span>"; } },
620 { "$time", [&]() -> QCString { return "<span class=\"time\"></span>"; } },
621 { "$year", [&]() -> QCString { return "<span class=\"year\"></span>"; } },
622 { "$navpath", [&]() -> QCString { return navPath; } },
623 { "$stylesheet", [&]() -> QCString { return cssFile; } },
624 { "$treeview", [&]() -> QCString { return treeViewCssJs; } },
625 { "$searchbox", [&]() -> QCString { return searchBox; } },
626 { "$search", [&]() -> QCString { return searchCssJs; } },
627 { "$mathjax", [&]() -> QCString { return mathJaxJs; } },
628 { "$darkmode", [&]() -> QCString { return darkModeJs; } },
629 { "$generatedby", [&]() -> QCString { return generatedBy; } },
630 { "$extrastylesheet",[&]() -> QCString { return extraCssText; } },
631 { "$relpath$", [&]() -> QCString { return relPath; } } //<-- obsolete: for backwards compatibility only
632 });
633
634 result = substitute(result,"$relpath^",relPath); //<-- must be done after the previous substitutions
635
636 // remove conditional blocks
637 result = selectBlocks(result,
638 {
639 // keyword, is enabled
640 { "FULL_SIDEBAR", hasFullSideBar },
641 { "DISABLE_INDEX", disableIndex },
642 { "GENERATE_TREEVIEW", treeView },
643 { "SEARCHENGINE", searchEngine },
644 { "TITLEAREA", titleArea },
645 { "PROJECT_NAME", hasProjectName },
646 { "PROJECT_NUMBER", hasProjectNumber },
647 { "PROJECT_BRIEF", hasProjectBrief },
648 { "PROJECT_LOGO", hasProjectLogo },
649 { "PROJECT_ICON", hasProjectIcon },
650 { "COPY_CLIPBOARD", hasCopyClipboard },
651 { "HTML_CODE_FOLDING", codeFolding },
652 { "HTML_DYNAMIC_SECTIONS", dynamicSections},
654
655 result = removeEmptyLines(result);
656
657 return result;
658}
QCString & prepend(const char *s)
Definition qcstring.h:422
QCString lower() const
Definition qcstring.h:249
static void codeFolding(yyscan_t yyscanner, const Definition *d)
Definition code.l:2362
#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
static QCString g_mathjax_code
Definition htmlgen.cpp:67
static const SelectionMarkerInfo htmlMarkerInfo
Definition htmlgen.cpp:72
static QCString getSearchBox(bool serverSide, QCString relPath, bool highlightSearch)
Definition htmlgen.cpp:300
static QCString g_latex_macro
Definition htmlgen.cpp:68
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:571
QCString convertToHtml(const QCString &s, bool keepEntities)
Definition util.cpp:3946
QCString stripPath(const QCString &s)
Definition util.cpp:4931
QCString removeEmptyLines(const QCString &s)
Definition util.cpp:6588
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:6411
QCString substituteKeywords(const QCString &file, const QCString &s, const KeywordSubstitutionList &keywords)
Definition util.cpp:3037

References codeFolding(), Config_getBool, Config_getEnum, Config_getEnumAsString, Config_getList, Config_getString, convertToHtml(), QCString::data(), 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 2960 of file htmlgen.cpp.

2965{
2966 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2967 bool searchEngine = Config_getBool(SEARCHENGINE);
2968 bool externalSearch = Config_getBool(EXTERNAL_SEARCH);
2969 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2970 bool fullSidebar = Config_getBool(FULL_SIDEBAR);
2971 bool disableIndex = Config_getBool(DISABLE_INDEX);
2972 bool dynamicMenus = Config_getBool(HTML_DYNAMIC_MENUS);
2974 LayoutNavEntry::Kind kind = LayoutNavEntry::None;
2975 LayoutNavEntry::Kind altKind = LayoutNavEntry::None; // fall back for the old layout file
2976 bool highlightParent=false;
2977 switch (hli) // map HLI enums to LayoutNavEntry::Kind enums
2978 {
2979 case HighlightedItem::Main: kind = LayoutNavEntry::MainPage; break;
2980 case HighlightedItem::Topics: kind = LayoutNavEntry::Topics; break;
2981 case HighlightedItem::Modules: kind = LayoutNavEntry::ModuleList; altKind = LayoutNavEntry::Modules; break;
2982 case HighlightedItem::Namespaces: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces; break;
2983 case HighlightedItem::ClassHierarchy: kind = LayoutNavEntry::ClassHierarchy; break;
2984 case HighlightedItem::InterfaceHierarchy: kind = LayoutNavEntry::InterfaceHierarchy; break;
2985 case HighlightedItem::ExceptionHierarchy: kind = LayoutNavEntry::ExceptionHierarchy; break;
2986 case HighlightedItem::Classes: kind = LayoutNavEntry::ClassIndex; altKind = LayoutNavEntry::Classes; break;
2987 case HighlightedItem::Concepts: kind = LayoutNavEntry::Concepts; break;
2988 case HighlightedItem::Interfaces: kind = LayoutNavEntry::InterfaceIndex; altKind = LayoutNavEntry::Interfaces; break;
2989 case HighlightedItem::Structs: kind = LayoutNavEntry::StructIndex; altKind = LayoutNavEntry::Structs; break;
2990 case HighlightedItem::Exceptions: kind = LayoutNavEntry::ExceptionIndex; altKind = LayoutNavEntry::Exceptions; break;
2991 case HighlightedItem::AnnotatedClasses: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes; break;
2992 case HighlightedItem::AnnotatedInterfaces: kind = LayoutNavEntry::InterfaceList; altKind = LayoutNavEntry::Interfaces; break;
2993 case HighlightedItem::AnnotatedStructs: kind = LayoutNavEntry::StructList; altKind = LayoutNavEntry::Structs; break;
2994 case HighlightedItem::AnnotatedExceptions: kind = LayoutNavEntry::ExceptionList; altKind = LayoutNavEntry::Exceptions; break;
2995 case HighlightedItem::Files: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files; break;
2996 case HighlightedItem::NamespaceMembers: kind = LayoutNavEntry::NamespaceMembers; break;
2997 case HighlightedItem::ModuleMembers: kind = LayoutNavEntry::ModuleMembers; break;
2998 case HighlightedItem::Functions: kind = LayoutNavEntry::ClassMembers; break;
2999 case HighlightedItem::Globals: kind = LayoutNavEntry::FileGlobals; break;
3000 case HighlightedItem::Pages: kind = LayoutNavEntry::Pages; break;
3001 case HighlightedItem::Examples: kind = LayoutNavEntry::Examples; break;
3002 case HighlightedItem::UserGroup: kind = LayoutNavEntry::UserGroup; break;
3003 case HighlightedItem::ClassVisible: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes;
3004 highlightParent = true; break;
3005 case HighlightedItem::ConceptVisible: kind = LayoutNavEntry::Concepts;
3006 highlightParent = true; break;
3007 case HighlightedItem::ModuleVisible: kind = LayoutNavEntry::ModuleList; altKind = LayoutNavEntry::Modules;
3008 highlightParent = true; break;
3009 case HighlightedItem::InterfaceVisible: kind = LayoutNavEntry::InterfaceList; altKind = LayoutNavEntry::Interfaces;
3010 highlightParent = true; break;
3011 case HighlightedItem::StructVisible: kind = LayoutNavEntry::StructList; altKind = LayoutNavEntry::Structs;
3012 highlightParent = true; break;
3013 case HighlightedItem::ExceptionVisible: kind = LayoutNavEntry::ExceptionList; altKind = LayoutNavEntry::Exceptions;
3014 highlightParent = true; break;
3015 case HighlightedItem::NamespaceVisible: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces;
3016 highlightParent = true; break;
3017 case HighlightedItem::FileVisible: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files;
3018 highlightParent = true; break;
3019 case HighlightedItem::None: break;
3020 case HighlightedItem::Search: break;
3021 }
3022
3023 if (!disableIndex && dynamicMenus)
3024 {
3025 QCString searchPage;
3026 if (externalSearch)
3027 {
3028 searchPage = "search" + Doxygen::htmlFileExtension;
3029 }
3030 else
3031 {
3032 searchPage = "search.php";
3033 }
3034 t << "<script type=\"text/javascript\" src=\"" << relPath << "menudata.js\"></script>\n";
3035 t << "<script type=\"text/javascript\" src=\"" << relPath << "menu.js\"></script>\n";
3036 t << "<script type=\"text/javascript\">\n";
3037 t << "document.addEventListener('DOMContentLoaded', () => {\n";
3038 t << " initMenu('" << relPath << "'," << (generateTreeView?"true":"false") << ");\n";
3039 if (searchEngine)
3040 {
3041 if (!serverBasedSearch)
3042 {
3043 if (!disableIndex && dynamicMenus && !fullSidebar)
3044 {
3045 t << " init_search();\n";
3046 }
3047 }
3048 else
3049 {
3050 t << " if (document.querySelector('.searchresults')) { searchBox.DOMSearchField().focus(); }\n";
3051 }
3052 }
3053 t << "});\n";
3054 t << "</script>\n";
3055 t << "<div id=\"main-nav-mobile\">\n";
3056 if (searchEngine && !fullSidebar)
3057 {
3058 t << "<div class=\"sm sm-dox\"><input id=\"main-menu-state\" type=\"checkbox\"/>\n";
3059 t << "<label class=\"main-menu-btn\" for=\"main-menu-state\">\n";
3060 t << "<span class=\"main-menu-btn-icon\"></span> Toggle main menu visibility</label>\n";
3061 t << "<span id=\"searchBoxPos1\" style=\"position:absolute;right:8px;top:8px;height:36px;\">";
3062 t << "</span>\n";
3063 t << "</div>\n";
3064 }
3065 t << "</div><!-- main-nav-mobile -->\n";
3066 t << "<div id=\"main-nav\">\n";
3067 t << " <ul class=\"sm sm-dox\" id=\"main-menu\">\n";
3068 t << " <li id=\"searchBoxPos2\" style=\"float:right\">\n";
3069 if (searchEngine && !(generateTreeView && fullSidebar))
3070 {
3071 t << getSearchBox(serverBasedSearch,relPath,false);
3072 }
3073 t << " </li>\n";
3074 t << " </ul>\n";
3075 t << "</div><!-- main-nav -->\n";
3076 }
3077 else if (!disableIndex) // && !Config_getBool(HTML_DYNAMIC_MENUS)
3078 {
3079 // find highlighted index item
3080 LayoutNavEntry *hlEntry = root->find(kind,kind==LayoutNavEntry::UserGroup ? file : QCString());
3081 if (!hlEntry && altKind!=LayoutNavEntry::None) { hlEntry=root->find(altKind); kind=altKind; }
3082 if (!hlEntry) // highlighted item not found in the index! -> just show the level 1 index...
3083 {
3084 highlightParent=TRUE;
3085 hlEntry = root->children().front().get();
3086 if (hlEntry==nullptr)
3087 {
3088 return; // argl, empty index!
3089 }
3090 }
3091 if (kind==LayoutNavEntry::UserGroup)
3092 {
3093 LayoutNavEntry *e = hlEntry->children().front().get();
3094 if (e)
3095 {
3096 hlEntry = e;
3097 }
3098 }
3099 t << "<div id=\"main-nav\">\n";
3100 renderQuickLinksAsTabs(t,relPath,hlEntry,kind,highlightParent,hli==HighlightedItem::Search);
3101 if (!extraTabs)
3102 {
3103 t << "</div><!-- main-nav -->\n";
3104 }
3105 }
3106 else if (!generateTreeView)
3107 {
3108 renderQuickLinksAsTree(t,relPath,root);
3109 }
3110 if (generateTreeView && !disableIndex && fullSidebar && !extraTabs)
3111 {
3112 t << "<div id=\"container\"><div id=\"doc-content\">\n";
3113 }
3114}
static QCString htmlFileExtension
Definition doxygen.h:121
LayoutNavEntry * rootNavEntry() const
returns the (invisible) root of the navigation tree.
Definition layout.cpp:1448
@ 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, getSearchBox(), Globals, Doxygen::htmlFileExtension, LayoutDocManager::instance(), InterfaceHierarchy, Interfaces, InterfaceVisible, Main, ModuleMembers, Modules, ModuleVisible, NamespaceMembers, Namespaces, NamespaceVisible, None, Pages, renderQuickLinksAsTabs(), renderQuickLinksAsTree(), LayoutDocManager::rootNavEntry(), Search, Structs, StructVisible, Topics, TRUE, and UserGroup.

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

◆ writeDefaultStyleSheet()

void writeDefaultStyleSheet ( TextStream & t)
static

Definition at line 1411 of file htmlgen.cpp.

1412{
1413 t << "/* The standard CSS for doxygen " << getDoxygenVersion() << "*/\n\n";
1414 switch (Config_getEnum(HTML_COLORSTYLE))
1415 {
1416 case HTML_COLORSTYLE_t::LIGHT:
1417 case HTML_COLORSTYLE_t::DARK:
1418 /* variables will be resolved while writing to the CSS file */
1419 break;
1420 case HTML_COLORSTYLE_t::AUTO_LIGHT:
1421 case HTML_COLORSTYLE_t::TOGGLE:
1422 t << "html {\n";
1423 t << replaceColorMarkers(ResourceMgr::instance().getAsString("lightmode_settings.css"));
1424 t << "}\n\n";
1425 break;
1426 case HTML_COLORSTYLE_t::AUTO_DARK:
1427 t << "html {\n";
1428 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1429 t << "}\n\n";
1430 break;
1431 }
1432 if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::AUTO_LIGHT)
1433 {
1434 t << "@media (prefers-color-scheme: dark) {\n";
1435 t << " html:not(.dark-mode) {\n";
1436 t << " color-scheme: dark;\n\n";
1437 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1438 t << "}}\n";
1439 }
1440 else if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::AUTO_DARK)
1441 {
1442 t << "@media (prefers-color-scheme: light) {\n";
1443 t << " html:not(.light-mode) {\n";
1444 t << " color-scheme: light;\n\n";
1445 t << replaceColorMarkers(ResourceMgr::instance().getAsString("lightmode_settings.css"));
1446 t << "}}\n";
1447 }
1448 else if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE)
1449 {
1450 t << "html.dark-mode {\n";
1451 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1452 t << "}\n\n";
1453 }
1454
1455 QCString cssStr = ResourceMgr::instance().getAsString("doxygen.css");
1456 bool hasFullSidebar = Config_getBool(FULL_SIDEBAR) && Config_getBool(GENERATE_TREEVIEW);
1457 if (hasFullSidebar)
1458 {
1459 cssStr+="\n"
1460 "#titlearea {\n"
1461 " border-bottom: none;\n"
1462 " background-color: var(--nav-background-color);\n"
1463 " border-right: 1px solid var(--nav-border-color);\n"
1464 "}\n";
1465 }
1466 t << replaceVariables(cssStr);
1467
1468 bool addTimestamp = Config_getEnum(TIMESTAMP)!=TIMESTAMP_t::NO;
1469 if (g_build_date || addTimestamp)
1470 {
1471 t << "\nhtml {\n";
1472
1473 if (addTimestamp)
1474 {
1475 QCString timeStampStr;
1476 switch (Config_getEnum(TIMESTAMP))
1477 {
1478 case TIMESTAMP_t::YES:
1479 case TIMESTAMP_t::DATETIME:
1480 timeStampStr = dateToString(DateTimeType::DateTime);
1481 break;
1482 case TIMESTAMP_t::DATE:
1483 timeStampStr = dateToString(DateTimeType::Date);
1484 break;
1485 default:
1486 break;
1487 }
1488 t << "--timestamp: '" << timeStampStr << "';\n";
1489 }
1490 if (g_build_date)
1491 {
1492 t << "--datetime: '" << dateToString(DateTimeType::DateTime) << "';\n";
1493 t << "--date: '" << dateToString(DateTimeType::Date) << "';\n";
1494 t << "--time: '" << dateToString(DateTimeType::Time) << "';\n";
1495 t << "--year: '" << yearToString() << "';\n";
1496 }
1497 t << "}\n";
1498
1499 if (addTimestamp)
1500 {
1501 t << "span.timestamp { content: ' '; }\n";
1502 t << "span.timestamp:before { content: var(--timestamp); }\n\n";
1503 }
1504 if (g_build_date)
1505 {
1506 t << "span.datetime { content: ' '; }\n";
1507 t << "span.datetime:before { content: var(--datetime); }\n\n";
1508 t << "span.date { content: ' '; }\n";
1509 t << "span.date:before { content: var(--date); }\n\n";
1510 t << "span.time { content: ' '; }\n";
1511 t << "span.time:before { content: var(--time); }\n\n";
1512 t << "span.year { content: ' '; }\n";
1513 t << "span.year:before { content: var(--year); }\n\n";
1514 }
1515 }
1516
1517 // For Webkit based the scrollbar styling cannot be overruled (bug in chromium?).
1518 // To allow the user to style the scrollbars differently we should only add it in case
1519 // the user did not specify any extra stylesheets.
1520 bool addScrollbarStyling = Config_getList(HTML_EXTRA_STYLESHEET).empty();
1521 if (addScrollbarStyling)
1522 {
1523 t << replaceVariables(ResourceMgr::instance().getAsString("scrollbar.css"));
1524 }
1525
1526}
QCString dateToString(DateTimeType includeTime)
Returns the current date, when includeTime is set also the time is provided.
Definition datetime.cpp:62
QCString yearToString()
Returns the current year as a string.
Definition datetime.cpp:75
static bool g_build_date
Definition htmlgen.cpp:69
static QCString replaceVariables(const QCString &input)
Definition htmlgen.cpp:700

References Config_getBool, Config_getEnum, Config_getList, Date, DateTime, dateToString(), g_build_date, ResourceMgr::getAsString(), ResourceMgr::instance(), replaceColorMarkers(), replaceVariables(), Time, and yearToString().

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_build_date

bool g_build_date = false
static

Definition at line 69 of file htmlgen.cpp.

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

◆ g_darkMap

StringUnorderedMap g_darkMap
static

Definition at line 663 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 1546 of file htmlgen.cpp.

Referenced by HtmlGenerator::startFile().

◆ g_latex_macro

QCString g_latex_macro
static

Definition at line 68 of file htmlgen.cpp.

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

◆ g_lightMap

StringUnorderedMap g_lightMap
static

Definition at line 662 of file htmlgen.cpp.

Referenced by fillColorStyleMaps(), and replaceVariables().

◆ g_mathjax_code

QCString g_mathjax_code
static

Definition at line 67 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().