diff options
Diffstat (limited to 'tools/qdoc3/htmlgenerator.cpp')
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 203 |
1 files changed, 126 insertions, 77 deletions
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 416d44a..76d8c0d 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -219,7 +219,8 @@ HtmlGenerator::HtmlGenerator() inTableHeader(false), numTableRows(0), threeColumnEnumValueTable(true), - offlineDocs(true), + offlineDocs(false), + onlineDocs(false), creatorDocs(true), funcLeftParen("\\S(\\()"), myTree(0), @@ -271,6 +272,12 @@ void HtmlGenerator::initializeGenerator(const Config &config) postPostHeader = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTPOSTHEADER); + creatorPostHeader = config.getString(HtmlGenerator::format() + + Config::dot + + HTMLGENERATOR_CREATORPOSTHEADER); + creatorPostPostHeader = config.getString(HtmlGenerator::format() + + Config::dot + + HTMLGENERATOR_CREATORPOSTPOSTHEADER); footer = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_FOOTER); @@ -282,8 +289,13 @@ void HtmlGenerator::initializeGenerator(const Config &config) HTMLGENERATOR_GENERATEMACREFS); project = config.getString(CONFIG_PROJECT); - offlineDocs = !config.getBool(CONFIG_ONLINE); - creatorDocs = false; //!config.getBool(CONFIG_CREATOR); + + onlineDocs = config.getBool(CONFIG_ONLINE); + + offlineDocs = config.getBool(CONFIG_OFFLINE); + + creatorDocs = config.getBool(CONFIG_CREATOR); + projectDescription = config.getString(CONFIG_DESCRIPTION); if (projectDescription.isEmpty() && !project.isEmpty()) projectDescription = project + " Reference Documentation"; @@ -1615,7 +1627,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) } else { generateExtractionMark(fake, DetailedDescriptionMark); - out() << "<div class=\"descr\">\n"; // QTBUG-9504 + out() << "<div class=\"descr\"> <a name=\"" << registerRef("details") << "\"></a>\n"; // QTBUG-9504 } generateBody(fake, marker); @@ -1781,64 +1793,94 @@ void HtmlGenerator::generateHeader(const QString& title, else shortVersion = "Qt " + shortVersion + ": "; } - // Generating page title + + // Generating page title out() << " <title>" << shortVersion << protectEnc(title) << "</title>\n"; - // Adding style sheet - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />"; - // Adding jquery and functions - providing online tools and search features - out() << " <script src=\"scripts/jquery.js\" type=\"text/javascript\"></script>\n"; - out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; - // Adding style and js for small windows - out() << " <script src=\"./scripts/superfish.js\" type=\"text/javascript\"></script>\n"; - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/superfish.css\" />"; - out() << " <script src=\"./scripts/narrow.js\" type=\"text/javascript\"></script>\n"; - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/narrow.css\" />"; + // Adding style sheet + out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />\n"; + // Adding jquery and functions - providing online tools and search features + out() << " <script src=\"scripts/jquery.js\" type=\"text/javascript\"></script>\n"; + out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; + // Adding style and js for small windows + out() << " <script src=\"./scripts/superfish.js\" type=\"text/javascript\"></script>\n"; + out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/superfish.css\" />"; + out() << " <script src=\"./scripts/narrow.js\" type=\"text/javascript\"></script>\n"; + out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/narrow.css\" />\n"; - // Adding syntax highlighter // future release + // Adding syntax highlighter // future release - // Setting assistant configuration - if (offlineDocs) - { - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />"; // Only for Qt Creator - out() << "</head>\n"; - out() << "<body class=\"offline \">\n"; // offline for Assistant - } - if (creatorDocs) - { - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />"; // Only for Qt Creator - out() << "</head>\n"; - out() << "<body class=\"offline narrow creator\">\n"; // offline for Creator - } - // Setting online doc configuration - else - { - // Browser spec styles - out() << " <!--[if IE]>\n"; - out() << "<meta name=\"MSSmartTagsPreventParsing\" content=\"true\">\n"; - out() << "<meta http-equiv=\"imagetoolbar\" content=\"no\">\n"; - out() << "<![endif]-->\n"; - out() << "<!--[if lt IE 7]>\n"; - out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie6.css\">\n"; - out() << "<![endif]-->\n"; - out() << "<!--[if IE 7]>\n"; - out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie7.css\">\n"; - out() << "<![endif]-->\n"; - out() << "<!--[if IE 8]>\n"; - out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie8.css\">\n"; - out() << "<![endif]-->\n"; + // Setting some additional style sheet related details depending on configuration (e.g. online/offline) + + + if(onlineDocs==true) // onlineDocs is for the web + { + // Browser spec styles + out() << " <!--[if IE]>\n"; + out() << "<meta name=\"MSSmartTagsPreventParsing\" content=\"true\">\n"; + out() << "<meta http-equiv=\"imagetoolbar\" content=\"no\">\n"; + out() << "<![endif]-->\n"; + out() << "<!--[if lt IE 7]>\n"; + out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie6.css\">\n"; + out() << "<![endif]-->\n"; + out() << "<!--[if IE 7]>\n"; + out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie7.css\">\n"; + out() << "<![endif]-->\n"; + out() << "<!--[if IE 8]>\n"; + out() << "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie8.css\">\n"; + out() << "<![endif]-->\n"; - out() << "</head>\n"; - // CheckEmptyAndLoadList activating search - out() << "<body class=\"\" onload=\"CheckEmptyAndLoadList();\">\n"; - } + out() << "</head>\n"; + // CheckEmptyAndLoadList activating search + out() << "<body class=\"\" onload=\"CheckEmptyAndLoadList();\">\n"; + } + else if (offlineDocs == true) // offlineDocs is for ??? + { + out() << "</head>\n"; + out() << "<body class=\"offline \">\n"; // offline + } + else if (creatorDocs == true) // creatorDocs is for Assistant/Creator + { + out() << "</head>\n"; + out() << "<body class=\"offline narrow creator\">\n"; // offline narrow + } + // default -- not used except if one forgets to set any of the above settings to true + else + { + out() << "</head>\n"; + out() << "<body>\n"; + } #ifdef GENERATE_MAC_REFS if (mainPage) generateMacRef(node, marker); -#endif - out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); +#endif + + + if(onlineDocs==true) // onlineDocs is for the web + { + out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + generateBreadCrumbs(title,node,marker); + out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + } + else if (offlineDocs == true) // offlineDocs is for ??? + { + out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + generateBreadCrumbs(title,node,marker); + out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + } + else if (creatorDocs == true) // creatorDocs is for Assistant/Creator + { + out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + generateBreadCrumbs(title,node,marker); + out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + } + // default -- not used except if one forgets to set any of the above settings to true + else + { + out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + generateBreadCrumbs(title,node,marker); + out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + } #if 0 // Removed for new doc format. MWS if (node && !node->links().empty()) @@ -1873,29 +1915,33 @@ void HtmlGenerator::generateFooter(const Node *node) out() << QString(footer).replace("\\" + COMMAND_VERSION, myTree->version()) << QString(address).replace("\\" + COMMAND_VERSION, myTree->version()); - if (offlineDocs) - { - out() << "</body>\n"; - } - if (creatorDocs) - { - out() << "</body>\n"; - } - else - { - out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; - out() << " <!-- <script type=\"text/javascript\">\n"; - out() << " var _gaq = _gaq || [];\n"; - out() << " _gaq.push(['_setAccount', 'UA-4457116-5']);\n"; - out() << " _gaq.push(['_trackPageview']);\n"; - out() << " (function() {\n"; - out() << " var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n"; - out() << " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n"; - out() << " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n"; - out() << " })();\n"; - out() << " </script> -->\n"; - out() << "</body>\n"; - } + if (onlineDocs == true) + { + out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; + out() << " <!-- <script type=\"text/javascript\">\n"; + out() << " var _gaq = _gaq || [];\n"; + out() << " _gaq.push(['_setAccount', 'UA-4457116-5']);\n"; + out() << " _gaq.push(['_trackPageview']);\n"; + out() << " (function() {\n"; + out() << " var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n"; + out() << " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n"; + out() << " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n"; + out() << " })();\n"; + out() << " </script> -->\n"; + out() << "</body>\n"; + } + else if (offlineDocs == true) + { + out() << "</body>\n"; + } + else if (creatorDocs == true) + { + out() << "</body>\n"; + } + else + { + out() << "</body>\n"; + } out() << "</html>\n"; } @@ -1907,11 +1953,14 @@ void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker, generateExtractionMark(node, BriefMark); out() << "<p>"; generateText(brief, node, marker); + if (!relative || node == relative) out() << " <a href=\"#"; else out() << " <a href=\"" << linkForNode(node, relative) << "#"; out() << registerRef("details") << "\">More...</a></p>\n"; + + generateExtractionMark(node, EndMark); } } |