home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- htmlcode.cpp - description
- -------------------
- begin : Wed Nov 28 2001
- copyright : (C) 2001 by AndrĪ Simon
- email : andre.simon1@gmx.de
- ***************************************************************************/
-
- /***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
- #include "xhtmlgenerator.h"
-
- using namespace std;
-
- namespace highlight {
-
- XHtmlGenerator::XHtmlGenerator(void)
- {}
-
- XHtmlGenerator::XHtmlGenerator (
- const string &cssStyle,
- const string &enc,
- bool omitEnc,
- bool withAnchors)
- : HtmlGenerator(cssStyle, enc, omitEnc, withAnchors)
- {
- fileSuffix=".xhtml";
- brTag="<br />";
- hrTag="<hr />";
- idAttr="id";
-
- HTML_FOOTER=
- "\n</body>\n</html>\n<!--XHTML generated by highlight "
- HIGHLIGHT_VERSION
- ", "
- HIGHLIGHT_URL
- "-->\n";
- }
-
- string XHtmlGenerator::getHeaderStart(const string &title){
- ostringstream header;
- header << "<?xml version=\"1.0\"";
- if (!omitEncoding) {
- header << " encoding=\"" << encoding << "\"";
- }
- header << "?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\""
- << " \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
- << "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
- << "<head>\n<title>" << title << "</title>\n";
-
- return header.str();
- }
-
-
- string XHtmlGenerator::getHeader(const string &title)
- {
- ostringstream osPart1;
- osPart1 << getHeaderStart((title.empty())?"Source file":title );
-
- if (langInfo.getSyntaxHighlight())
- {
- if (includeStyleDef) //CSS-Definition in HTML-<head> einfuegen
- {
- osPart1 << "<style type=\"text/css\">\n";
- osPart1 << "<![CDATA[\n";
- osPart1 << getStyleDefinition();
- osPart1 << CodeGenerator::readUserStyleDef();
- osPart1 << "]]>\n";
- osPart1 << "</style>\n";
- }
- else //Referenz auf CSS-Datei einfuegen
- {
- osPart1 << "<link rel=\"stylesheet\" type=\"text/css\" href=\""
- << getStyleOutputPath()
- << "\""
- << "/"
- << ">\n";
- }
- }
- osPart1 << "</head>\n<body class=\"hl\">\n<pre class=\"hl\">";
-
- return osPart1.str();
- }
-
- }
-