コード例 #1
0
string LatexGenerator::getHeader()
{
  ostringstream os;

  os << "\\documentclass{article}\n"
     << "\\usepackage{color}\n"
     << "\\usepackage{alltt}\n";

  if (StringTools::lowerCase(encoding)=="utf-8"){
     os << "\\usepackage{ucs}\n\\usepackage[utf8x]{inputenc}\n";
  } else if (encodingDefined()){
     os << "\\usepackage[latin1]{inputenc}\n";
  }

  if (langInfo.getSyntaxHighlight()) {
    if (includeStyleDef) {
      os << "\n"<<getStyleDefinition();
      os << CodeGenerator::readUserStyleDef();
    }  else  {
      os << "\n\\input {"
         << getStyleOutputPath()
         << "}\n";
    }
  }

  os << "\n\\title{" << docTitle << "}\n"
     << "\\begin{document}\n"
     << "\\pagecolor{bgcolor}\n";
  return os.str();
}
コード例 #2
0
ファイル: odtgenerator.cpp プロジェクト: svn2github/highlight
string ODTGenerator::getHeader()
{
      string enc = "UTF-8";
     if ( encodingDefined() ) {
        enc = encoding;
    }
    ostringstream header;
    header << "<?xml version=\"1.0\" encoding=\""<<enc<<"\"?>\n"\
           "<office:document xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\" xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\""\
           " xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\" xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\""\
           " xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\""\
           " xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\""\
           " xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\" xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\""\
           " xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\" xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\""\
           " xmlns:math=\"http://www.w3.org/1998/Math/MathML\" xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\" xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\""\
           " xmlns:config=\"urn:oasis:names:tc:opendocument:xmlns:config:1.0\" xmlns:ooo=\"http://openoffice.org/2004/office\" xmlns:ooow=\"http://openoffice.org/2004/writer\""\
           " xmlns:oooc=\"http://openoffice.org/2004/calc\" xmlns:dom=\"http://www.w3.org/2001/xml-events\" xmlns:xforms=\"http://www.w3.org/2002/xforms\""\
           " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rpt=\"http://openoffice.org/2005/report\""\
           " xmlns:of=\"urn:oasis:names:tc:opendocument:xmlns:of:1.2\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\" xmlns:grddl=\"http://www.w3.org/2003/g/data-view#\""\
           " xmlns:tableooo=\"http://openoffice.org/2009/table\" xmlns:field=\"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\""\
           " xmlns:formx=\"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\" xmlns:css3t=\"http://www.w3.org/TR/css3-text/\" office:version=\"1.2\""\
           " office:mimetype=\"application/vnd.oasis.opendocument.text\">\n"\
           " <office:font-face-decls>\n"\
           "  <style:font-face style:name=\""<< getBaseFont()<<"\" svg:font-family=\""<< getBaseFont()<<"\" style:font-family-generic=\"modern\" style:font-pitch=\"fixed\"/>\n"\
           " </office:font-face-decls>\n";

    header << getStyleDefinition();

    header  << " <office:body>\n"
            << "  <office:text>\n"
            << "<text:p text:style-name=\"Standard\">";

    return header.str();
}
コード例 #3
0
	string SVGGenerator::getHeader()
	{
		ostringstream header;
		header << "<?xml version=\"1.0\"";
		if ( encodingDefined() )
		{
			header << " encoding=\"" << encoding << "\"";
		}
		header << "?>\n";
		if ( !includeStyleDef )
		{
			header  << "<?xml-stylesheet type=\"text/css\" href=\""
			<< getStyleOutputPath()
			<< "\"?>\n";
		}
		header << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.2//EN\" "
		<< "\"http://www.w3.org/Graphics/SVG/1.2/DTD/svg12.dtd\">\n";
		header << "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.2\" "
		<< "baseProfile=\"full\" xml:space=\"preserve\"";
		if ( width.size() ) header << " width=\""<<width<<"\"";
		if ( height.size() ) header << " height=\""<<height<<"\"";
		//viewBox=\"0 0 800 600\"
		header << ">\n<desc>" << docTitle << "</desc>\n";
		if ( includeStyleDef )
		{
			header << "<defs>\n";
			header << getStyleDefinition();
			header << "\n</defs>\n";
		}
		return header.str();
	}
コード例 #4
0
ファイル: xmlgenerator.cpp プロジェクト: Dasonk/highlight
	string XmlGenerator::getHeader()
	{
		ostringstream header;
		header << "<?xml version=\"1.0\"";
		if ( encodingDefined() )
		{
			header << " encoding=\"" << encoding << "\"";
		}
		header << "?>\n<document>";
		header << "\n<title>" << docTitle << "</title>";
		header << getStyleDefinition();
		return header.str();
	}
コード例 #5
0
string HtmlGenerator::getHeaderStart(const string &title){
    ostringstream header;
    header<<  "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"
            << "\n<html>\n<head>\n";
    if (encodingDefined()){
        header << "<meta http-equiv=\"content-type\" content=\"text/html; charset="
               << encoding
               << "\">\n";
    }
    header << "<title>"
           << title
           << "</title>\n";
    return header.str();
}
コード例 #6
0
string HtmlGenerator::getHeader()
{
  ostringstream os;
  os << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"
     << "\n<html>\n<head>\n";
  if (encodingDefined()){
     os << "<meta http-equiv=\"content-type\" content=\"text/html; charset="
        << encoding
        << "\">\n";
  }
  if (!styleSheetPath.empty()){
   os <<  "<link rel=\"stylesheet\" type=\"text/css\" href=\""<<styleSheetPath<<"\">\n";
  }
  os << "<title>" << docTitle << "</title>\n";
  os << "</head>\n<body>\n<pre style=\"";
  os << "font-family:"<<font << ";";
  os << "font-size:"<<fontSize << ";";
  os << "\">";
  return os.str();
}