void HtmlGenerator::printBody() { if (!fragmentOutput || enclosePreTag) { if (!useInlineCSS){ *out << "<pre class=\"" << cssClassName << "\">"; } else { *out << "<pre style=\"" << "color:#" << (docStyle.getDefaultStyle().getColour().getRed(HTML)) << (docStyle.getDefaultStyle().getColour().getGreen(HTML)) << (docStyle.getDefaultStyle().getColour().getBlue(HTML) ) << "; background-color:#" << (docStyle.getBgColour().getRed(HTML)) << (docStyle.getBgColour().getGreen(HTML)) << (docStyle.getBgColour().getBlue(HTML)) << "; font-size:" << this->getBaseFontSize() << "pt; font-family:'" << this->getBaseFont()<<"';\">"; } } if (showLineNumbers && orderedList) *out << "<ol>"; processRootState(); if (showLineNumbers && orderedList) *out << "\n</ol>"; if (!fragmentOutput || enclosePreTag) *out << "</pre>"; }
void RtfGenerator::printBody() { *out << "{\\rtf1\\ansi\\uc0 \\deff1" << "{\\fonttbl{\\f1\\fmodern\\fprq1\\fcharset0 " ; *out << this->getBaseFont() ; *out << ";}}" << "{\\colortbl;"; *out << "\\red" << (docStyle.getBgColour().getRed(RTF)); *out << "\\green" << (docStyle.getBgColour().getGreen(RTF)); *out << "\\blue" << (docStyle.getBgColour().getBlue(RTF)); *out << ";"; *out << getAttributes(docStyle.getDefaultStyle()); *out << getAttributes(docStyle.getStringStyle()); *out << getAttributes(docStyle.getNumberStyle()); *out << getAttributes(docStyle.getSingleLineCommentStyle()); *out << getAttributes(docStyle.getCommentStyle()); *out << getAttributes(docStyle.getEscapeCharStyle()); *out << getAttributes(docStyle.getDirectiveStyle()); *out << getAttributes(docStyle.getDirectiveStringStyle()); *out << getAttributes(docStyle.getLineStyle()); *out << getAttributes(docStyle.getSymbolStyle()); /* For output formats which can refer to external styles it is more safe to use the colour theme's keyword class names, since the language definitions (which may change during a batch conversion) do not have to define all keyword classes, that are needed to highlight all input files correctly. It is ok for RTF to use the language definition's class names, because RTF does not refer to external styles. We cannot use the theme's class names, because KSIterator returns an alphabetically ordered list, which is not good because RTF is dependent on the order. We access the keyword style with an ID, which is calculated ignoring the alphabetic order. */ vector<string> keywordClasses = langInfo.getKeywordClasses(); for (unsigned int i=0;i<keywordClasses.size();i++){ *out << getAttributes(docStyle.getKeywordStyle(keywordClasses[i])); } *out << "}\n"; *out << "\\paperw"<< psMap[pageSize].width <<"\\paperh"<< psMap[pageSize].height << "\\margl1134\\margr1134\\margt1134\\margb1134\\sectd" // page margins << "\\plain\\f1\\fs" ; // Font formatting int fontSize=0; StringTools::str2num<int>(fontSize, this->getBaseFontSize(), std::dec); *out << ((fontSize)? fontSize*2: 20); // RTF needs double amount *out << "\n\\pard \\cbpat1{"; processRootState(); *out << "}}"<<endl; }
void SVGGenerator::printBody() { *out << "<g>\n<rect x=\"0\" y=\"0\" width=\"100%\" height=\"100%\"/>"; // rect: background color int fontSize=0; StringTools::str2num<int> ( fontSize, getBaseFontSize(), std::dec ); *out << "\n<text x=\"10\" y=\""<<fontSize*2<<"\">"; processRootState(); *out << "</text>\n</g>\n"; }
void PangoGenerator::printBody() { int fontSize=0; StringTools::str2num<int> ( fontSize, this->getBaseFontSize(), std::dec ); *out << "<span size=\""<<( ( fontSize ) ? fontSize*1024: 10*1024 ) << "\" " << "font_family=\"" << getBaseFont() << "\"" <<">"; processRootState(); *out << "</span>"; }
void LatexGenerator::printBody() { *out << "\\noindent\n" ; if (! this->getBaseFont().empty() ) *out << "\\" << this->getBaseFont() << "\n" ; else *out << "\\ttfamily\n"; if (! this->getBaseFontSize().empty() ) *out << "\\" << this->getBaseFontSize() << "\n" ; if (disableBabelShortHand) *out << "\\shorthandoff{\"}\n"; processRootState(); *out << "\\mbox{}\n" << "\\normalfont\n"; if (! this->getBaseFontSize().empty()) *out << "\\normalsize\n" ; if (disableBabelShortHand) *out << "\\shorthandon{\"}\n"; }
void HtmlGenerator::printBody() { processRootState(); }
void AnsiGenerator::printBody() { processRootState(); }
void ODTGenerator::printBody() { processRootState(); }
void RtfGenerator::printBody() { isUtf8 = StringTools::change_case ( encoding ) == "utf-8"; *out << "{\\rtf1\\ansi \\deff1" // drop \\uc0 because of unicode output << "{\\fonttbl{\\f1\\fmodern\\fprq1\\fcharset0 " ; *out << this->getBaseFont() ; *out << ";}}" << "{\\colortbl;"; *out << "\\red" << ( docStyle.getBgColour().getRed ( RTF ) ); *out << "\\green" << ( docStyle.getBgColour().getGreen ( RTF ) ); *out << "\\blue" << ( docStyle.getBgColour().getBlue ( RTF ) ); *out << ";"; *out << getAttributes ( docStyle.getDefaultStyle() ); *out << getAttributes ( docStyle.getStringStyle() ); *out << getAttributes ( docStyle.getNumberStyle() ); *out << getAttributes ( docStyle.getSingleLineCommentStyle() ); *out << getAttributes ( docStyle.getCommentStyle() ); *out << getAttributes ( docStyle.getEscapeCharStyle() ); *out << getAttributes ( docStyle.getPreProcessorStyle() ); *out << getAttributes ( docStyle.getPreProcStringStyle() ); *out << getAttributes ( docStyle.getLineStyle() ); *out << getAttributes ( docStyle.getOperatorStyle() ); *out << getAttributes ( docStyle.getInterpolationStyle() ); /* For output formats which can refer to external styles it is more safe to use the colour theme's keyword class names, since the language definitions (which may change during a batch conversion) do not have to define all keyword classes, that are needed to highlight all input files correctly. It is ok for RTF to use the language definition's class names, because RTF does not refer to external styles. We cannot use the theme's class names, because KSIterator returns an alphabetically ordered list, which is not good because RTF is dependent on the order. We access the keyword style with an ID, which is calculated ignoring the alphabetic order. */ ///FIXME: nested syntax may be highlighted incorrectly if it contains more // keyword definitions than the hosting syntax. // Workaround: Add keyword gruop to hosting syntax (see html.lang) vector<string> keywordClasses = currentSyntax->getKeywordClasses(); for ( unsigned int i=0; i<keywordClasses.size(); i++ ) { *out << getAttributes ( docStyle.getKeywordStyle ( keywordClasses[i] ) ); } *out << "}\n"; if ( addCharStyles ) { *out << "{\\stylesheet{\n"; *out << getCharStyle ( STANDARD, docStyle.getDefaultStyle(), "HL Default" ); *out << getCharStyle ( STRING, docStyle.getStringStyle(), "HL String" ); *out << getCharStyle ( NUMBER, docStyle.getNumberStyle(), "HL Number" ); *out << getCharStyle ( SL_COMMENT, docStyle.getSingleLineCommentStyle(), "HL SL Comment" ); *out << getCharStyle ( ML_COMMENT, docStyle.getCommentStyle(), "HL ML Comment" ); *out << getCharStyle ( ESC_CHAR, docStyle.getEscapeCharStyle(), "HL Escape Character" ); *out << getCharStyle ( DIRECTIVE, docStyle.getPreProcessorStyle(), "HL Directive" ); *out << getCharStyle ( DIRECTIVE_STRING, docStyle.getPreProcStringStyle(), "HL Directive String" ); *out << getCharStyle ( LINENUMBER, docStyle.getLineStyle(), "HL Line" ); *out << getCharStyle ( SYMBOL, docStyle.getOperatorStyle(), "HL Operator" ); *out << getCharStyle ( STRING_INTERPOLATION, docStyle.getInterpolationStyle(), "HL Interpolation" ); char styleName[20]; for ( unsigned int i=0; i<keywordClasses.size(); i++ ) { sprintf ( styleName, "HL Keyword %c", 'A'+i ); //maybe better simple numbering *out << getCharStyle ( KEYWORD+i, docStyle.getKeywordStyle ( keywordClasses[i] ), string ( styleName ) ); } *out << "}}\n"; } if (addPageColor) { long svVal = docStyle.getBgColour().getRed() + docStyle.getBgColour().getGreen() * 256+ docStyle.getBgColour().getBlue() * 256 * 256; *out<<"\\viewbksp1\\ilfomacatclnup0{\\*\\background{\\shp{{\\sp{\\sn fillColor}{\\sv "<<svVal<<"}}}}}\n"; } *out << "\\paperw"<< psMap[pageSize].width <<"\\paperh"<< psMap[pageSize].height << "\\margl1134\\margr1134\\margt1134\\margb1134\\sectd" // page margins << "\\plain\\f1\\fs" ; // Font formatting int fontSize=0; StringTools::str2num<int> ( fontSize, this->getBaseFontSize(), std::dec ); *out << ( ( fontSize ) ? fontSize*2: 20 ); // RTF needs double amount *out << "\n\\pard \\cbpat1{"; processRootState(); *out << "}}"<<endl; }
void XmlGenerator::printBody() { *out << "<source>\n"; processRootState(); *out << "</source>\n"; }
void PangoGenerator::printBody() { processRootState(); }