@@ -67,6 +67,7 @@ static QCString g_footer_file;
6767static QCString g_footer;
6868static QCString g_mathjax_code;
6969static QCString g_latex_macro;
70+ static bool g_build_date = false ;
7071static constexpr auto hex=" 0123456789ABCDEF" ;
7172
7273static const SelectionMarkerInfo htmlMarkerInfo = { ' <' , " <!--BEGIN " ,10 ," <!--END " ,8 ," -->" ,3 };
@@ -583,6 +584,10 @@ static QCString substituteHtmlKeywords(const QCString &file,
583584 result = substituteKeywords (file,result,
584585 {
585586 // keyword value getter
587+ { " $datetime" , [&]() { return " <span class=\" datetime\" ></span>" ; } },
588+ { " $date" , [&]() { return " <span class=\" date\" ></span>" ; } },
589+ { " $time" , [&]() { return " <span class=\" time\" ></span>" ; } },
590+ { " $year" , [&]() { return " <span class=\" year\" ></span>" ; } },
586591 { " $navpath" , [&]() { return navPath; } },
587592 { " $stylesheet" , [&]() { return cssFile; } },
588593 { " $treeview" , [&]() { return treeViewCssJs; } },
@@ -1133,6 +1138,15 @@ void HtmlGenerator::addCodeGen(OutputCodeList &list)
11331138 list.add <HtmlCodeGeneratorDefer>(m_codeGen);
11341139}
11351140
1141+ static bool hasDateReplacement (const QCString &str)
1142+ {
1143+ return (str.contains (" $datetime" ,false ) ||
1144+ str.contains (" $date" ,false ) ||
1145+ str.contains (" $time" ,false ) ||
1146+ str.contains (" $year" ,false )
1147+ );
1148+ }
1149+
11361150void HtmlGenerator::init ()
11371151{
11381152 QCString dname = Config_getString (HTML_OUTPUT);
@@ -1146,6 +1160,7 @@ void HtmlGenerator::init()
11461160 {
11471161 g_header_file=Config_getString (HTML_HEADER);
11481162 g_header=fileToString (g_header_file);
1163+ g_build_date = (g_build_date || hasDateReplacement (g_header));
11491164 // printf("g_header='%s'\n",qPrint(g_header));
11501165 QCString result = substituteHtmlKeywords (g_header_file,g_header,QCString (),QCString ());
11511166 checkBlocks (result,Config_getString (HTML_HEADER),htmlMarkerInfo);
@@ -1154,6 +1169,7 @@ void HtmlGenerator::init()
11541169 {
11551170 g_header_file=" header.html" ;
11561171 g_header = ResourceMgr::instance ().getAsString (g_header_file);
1172+ g_build_date = (g_build_date || hasDateReplacement (g_header));
11571173 QCString result = substituteHtmlKeywords (g_header_file,g_header,QCString (),QCString ());
11581174 checkBlocks (result," <default header.html>" ,htmlMarkerInfo);
11591175 }
@@ -1162,6 +1178,7 @@ void HtmlGenerator::init()
11621178 {
11631179 g_footer_file=Config_getString (HTML_FOOTER);
11641180 g_footer=fileToString (g_footer_file);
1181+ g_build_date = (g_build_date || hasDateReplacement (g_footer));
11651182 // printf("g_footer='%s'\n",qPrint(g_footer));
11661183 QCString result = substituteHtmlKeywords (g_footer_file,g_footer,QCString (),QCString ());
11671184 checkBlocks (result,Config_getString (HTML_FOOTER),htmlMarkerInfo);
@@ -1170,6 +1187,7 @@ void HtmlGenerator::init()
11701187 {
11711188 g_footer_file = " footer.html" ;
11721189 g_footer = ResourceMgr::instance ().getAsString (g_footer_file);
1190+ g_build_date = (g_build_date || hasDateReplacement (g_footer));
11731191 QCString result = substituteHtmlKeywords (g_footer_file,g_footer,QCString (),QCString ());
11741192 checkBlocks (result," <default footer.html>" ,htmlMarkerInfo);
11751193 }
@@ -1392,26 +1410,52 @@ static void writeDefaultStyleSheet(TextStream &t)
13921410 t << replaceVariables (cssStr);
13931411
13941412 bool addTimestamp = Config_getEnum (TIMESTAMP)!=TIMESTAMP_t::NO;
1395- if (addTimestamp)
1413+ if (g_build_date || addTimestamp)
13961414 {
1397- QCString timeStampStr;
1398- switch (Config_getEnum (TIMESTAMP))
1415+ t << " \n html {\n " ;
1416+
1417+ if (addTimestamp)
13991418 {
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 ;
1419+ QCString timeStampStr;
1420+ switch (Config_getEnum (TIMESTAMP))
1421+ {
1422+ case TIMESTAMP_t::YES:
1423+ case TIMESTAMP_t::DATETIME:
1424+ timeStampStr = dateToString (DateTimeType::DateTime);
1425+ break ;
1426+ case TIMESTAMP_t::DATE:
1427+ timeStampStr = dateToString (DateTimeType::Date);
1428+ break ;
1429+ default :
1430+ break ;
1431+ }
1432+ t << " --timestamp: '" << timeStampStr << " ';\n " ;
1433+ }
1434+ if (g_build_date)
1435+ {
1436+ t << " --datetime: '" << dateToString (DateTimeType::DateTime) << " ';\n " ;
1437+ t << " --date: '" << dateToString (DateTimeType::Date) << " ';\n " ;
1438+ t << " --time: '" << dateToString (DateTimeType::Time) << " ';\n " ;
1439+ t << " --year: '" << yearToString () << " ';\n " ;
14091440 }
1410- t << " \n html {\n " ;
1411- t << " --timestamp: '" << timeStampStr << " '\n " ;
14121441 t << " }\n " ;
1413- t << " span.timestamp { content: ' '; }\n " ;
1414- t << " span.timestamp:before { content: var(--timestamp); }\n\n " ;
1442+
1443+ if (addTimestamp)
1444+ {
1445+ t << " span.timestamp { content: ' '; }\n " ;
1446+ t << " span.timestamp:before { content: var(--timestamp); }\n\n " ;
1447+ }
1448+ if (g_build_date)
1449+ {
1450+ t << " span.datetime { content: ' '; }\n " ;
1451+ t << " span.datetime:before { content: var(--datetime); }\n\n " ;
1452+ t << " span.date { content: ' '; }\n " ;
1453+ t << " span.date:before { content: var(--date); }\n\n " ;
1454+ t << " span.time { content: ' '; }\n " ;
1455+ t << " span.time:before { content: var(--time); }\n\n " ;
1456+ t << " span.year { content: ' '; }\n " ;
1457+ t << " span.year:before { content: var(--year); }\n\n " ;
1458+ }
14151459 }
14161460
14171461 // For Webkit based the scrollbar styling cannot be overruled (bug in chromium?).
0 commit comments