当前位置: 首页>>代码示例>>PHP>>正文


PHP GeSHi::set_overall_style方法代码示例

本文整理汇总了PHP中GeSHi::set_overall_style方法的典型用法代码示例。如果您正苦于以下问题:PHP GeSHi::set_overall_style方法的具体用法?PHP GeSHi::set_overall_style怎么用?PHP GeSHi::set_overall_style使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GeSHi的用法示例。


在下文中一共展示了GeSHi::set_overall_style方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: highlight_syntax

function highlight_syntax($code, $langid)
{
    $value = get_record('problemstatement_programming_language', 'id', $langid);
    if ($value) {
        $syntax = $value->geshi;
    } else {
        $syntax = '';
    }
    /*
    	switch ($langid) {
    		case '0': $syntax='cpp'; break;
    		case '1': $syntax='delphi'; break;
    		case '2': $syntax='java'; break;
    		case '3': $syntax='python'; break;
    		case '4': $syntax='csharp'; break;
    	}*/
    $geshi = new GeSHi($code, $syntax);
    $geshi->set_header_type(GESHI_HEADER_DIV);
    //   $geshi->enable_classes(true);
    $geshi->set_overall_style('font-family: monospace;');
    $linenumbers = 1;
    if ($linenumbers) {
        $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 5);
        $geshi->set_line_style('color:#222;', 'color:#888;');
        $geshi->set_overall_style('font-size: 14px;font-family: monospace;', true);
    }
    $urls = FALSE;
    $indentsize = FALSE;
    $inline = FALSE;
    if (!$urls) {
        for ($i = 0; $i < 5; $i++) {
            $geshi->set_url_for_keyword_group($i, '');
        }
    }
    if ($indentsize) {
        $geshi->set_tab_width($indentsize);
    }
    $parsed = $geshi->parse_code();
    if ($inline) {
        $parsed = preg_replace('/^<div/', '<span', $parsed);
        $parsed = preg_replace('/<\\/div>$/', '</span>', $parsed);
    }
    //return $geshi->parse_code().$syntax;
    $lang = get_record('problemstatement_programming_language', 'id', $langid);
    if (!$lang) {
        $lang = '';
    }
    $comment = get_string("programwritten", "problemstatement") . $lang->language_name;
    //get_string("lang_".$langid, "problemstatement");
    return $parsed . $comment;
}
开发者ID:Anna-Sentyakova,项目名称:runningcat,代码行数:51,代码来源:problemstatement.class.php

示例2: print_highlighted

function print_highlighted($lang)
{
    //The GeSHI syntax highlighter is included.
    include_once 'geshi/geshi.php';
    //The string returned is stored in a variable.
    $filename = get_id($_SERVER['REQUEST_URI']);
    //If file does not exist then it redirects the user to the home page.
    $file = fopen("data/{$filename}", "r") or header("Location: /");
    $source = '';
    while (!feof($file)) {
        $source = $source . fgets($file);
    }
    //The object created is passed two arguments for syntax highlighting.
    $geshi = new GeSHi($source, $lang);
    $geshi->set_overall_style('background-color: #f2f2f2; margin: 0px 35px; border: 1px dotted;', true);
    //$geshi->set_header_type(GESHI_HEADER_PRE_VALID);
    $geshi->set_header_type(GESHI_HEADER_DIV);
    //The flag below shows the line numbers. See GeSHI docs for more options.
    $flag = GESHI_FANCY_LINE_NUMBERS;
    $geshi->enable_line_numbers($flag);
    $geshi->set_line_style(' padding: 0px 15px;');
    //The <pre> tags are included for maintaining the indentation.
    // echo "<pre>";
    echo $geshi->parse_code();
    // echo "</pre></div>";
    return 0;
}
开发者ID:vrnkalra,项目名称:glupaste,代码行数:27,代码来源:libpaste1.php

示例3: source_highlighter

function source_highlighter($code)
{
    $source = str_replace(array("&gt;", "&lt;", "&quot;", "&amp;"), array(">", "<", "\"", "&"), $code[1]);
    if (false !== stristr($code[0], "[php]")) {
        $lang2geshi = "php";
    } elseif (false !== stristr($code[0], "[sql]")) {
        $lang2geshi = "sql";
    } elseif (false !== stristr($code[0], "[html]")) {
        $lang2geshi = "html4strict";
    } else {
        $lang2geshi = "txt";
    }
    $geshi = new GeSHi($source, $lang2geshi);
    $geshi->set_header_type(GESHI_HEADER_PRE_VALID);
    $geshi->set_overall_style('font: normal normal 100% monospace; color: #000066;', false);
    $geshi->set_line_style('color: #003030;', 'font-weight: bold; color: #006060;', true);
    $geshi->set_code_style('color: #000020;font-family:monospace; font-size:12px;line-height:6px;', true);
    //$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
    $geshi->enable_classes(false);
    $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
    $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
    $return = "<div class=\"codetop\">CODE</div><div class=\"codemain\">\n";
    $return .= $geshi->parse_code();
    $return .= "\n</div>\n";
    return $return;
}
开发者ID:ZenoX2012,项目名称:CyBerFuN-CoDeX,代码行数:26,代码来源:bbcode_functions.php

示例4: substr

 function _codeBlockHighlighter($codeblock, &$clear)
 {
     $split = preg_split('/[\\r\\n]/', $codeblock, 2, PREG_SPLIT_NO_EMPTY);
     if (count($split) == 2 && preg_match('/^\\s*((\\\\){0,2}\\[([a-zA-Z0-9\\-_]+)\\]\\s*)/', $split[0], $matches)) {
         if ($matches[2] == '\\') {
             $codeblock = substr($codeblock, 1);
             return $codeblock;
         }
         $strlen = strlen($matches[0]);
         $parser = strtolower($matches[3]);
         $codeblock = $split[1];
         if ($strlen > 0) {
             if ($parser == 'console') {
                 $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
                 $codeblock = preg_replace_callback('/^\\n+/', array($this, '_doFencedCodeBlocks_newlines'), $codeblock);
                 $codeblock = "<pre class=\"console\"><code>{$codeblock}</code></pre>";
             } else {
                 $codeblock = preg_replace('/\\n+$/', '', $codeblock);
                 $geshi = new GeSHi($codeblock, $parser);
                 $geshi->set_overall_style('');
                 $codeblock = $geshi->parse_code();
             }
             $clear = false;
         }
     }
     return $codeblock;
 }
开发者ID:TypeFriendly,项目名称:TypeFriendly,代码行数:27,代码来源:markdown.php

示例5: getSyntaxHighlightedContent

 public function getSyntaxHighlightedContent($content, $type)
 {
     //$content = ;
     //return array('<pre>' . $content . '</pre>', 'none');
     //error_log("content len=" . strlen($content));
     // サイズがでかすぎたら syntax highlight ナシ
     if (strlen($content) > 1 << 15) {
         error_log($content);
         return array('<pre>' . htmlspecialchars($content, ENT_QUOTES) . '</pre>', 'none');
     }
     if ($type == '__pastit_type_none__') {
         $type = 'none';
         // auto detect
         $first_line = explode(PHP_EOL, $content);
         $first_line = $first_line[0];
         if (preg_match('@#!.+bin/(\\w+)@', $first_line, $m)) {
             $type = $m[1];
         }
         if (preg_match('@#!.+bin/env\\s+(\\w+)@', $first_line, $m)) {
             $type = $m[1];
         }
         if (preg_match('@\\+\\+\\+@', $content) && preg_match('@\\-\\-\\-@', $content)) {
             $type = 'diff';
         }
     }
     require_once 'geshi/geshi.php';
     $geshi = new GeSHi($content, $type);
     $geshi->set_overall_style('font-family: menlo, monaco, \'courier new\', mono-space;');
     $content = $geshi->parse_code();
     //return '<pre class=" superpre">' . PHP_EOL . $body . '</pre>';
     return array($content, $type);
 }
开发者ID:riaf,项目名称:pastit,代码行数:32,代码来源:Pastit_PasteManager.php

示例6: syntaxHighlight

 function syntaxHighlight($matches)
 {
     $geshi = new GeSHi($matches[3], empty($matches[2]) ? "txt" : $matches[2]);
     $geshi->enable_classes();
     $geshi->set_overall_style("");
     // empty style
     return $geshi->parse_code();
 }
开发者ID:hellovigoss,项目名称:tipi,代码行数:8,代码来源:TipiMarkdownExt.php

示例7: source_highlighter

function source_highlighter($source, $lang2geshi)
{
    require_once 'geshi/geshi.php';
    $source = str_replace(array("&#039;", "&gt;", "&lt;", "&quot;", "&amp;"), array("'", ">", "<", "\"", "&"), $source);
    $lang2geshi = $lang2geshi == 'html' ? 'html4strict' : $lang2geshi;
    $geshi = new GeSHi($source, $lang2geshi);
    $geshi->set_header_type(GESHI_HEADER_PRE_VALID);
    $geshi->set_overall_style('font: normal normal 100% monospace; color: #000066;', false);
    $geshi->set_line_style('color: #003030;', 'font-weight: bold; color: #006060;', true);
    $geshi->set_code_style('color: #000020;font-family:monospace; font-size:12px;line-height:13px;', true);
    $geshi->enable_classes(false);
    $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
    $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
    $return = "<div class=\"codetop\">Code</div><div class=\"codemain\">\n";
    $return .= $geshi->parse_code();
    $return .= "\n</div>\n";
    return $return;
}
开发者ID:CharlieHD,项目名称:U-232-V3,代码行数:18,代码来源:bbcode_functions.php

示例8: AffichageSource

function AffichageSource($type, $lang, $nom)
{
    if (preg_match("#^../#", $nom) == TRUE) {
        $result = "Erreur lors du chargement du script";
    } else {
        $language = str_replace('.', '', strstr($nom, '.'));
        $source = '';
        $script = 'fichiers/' . $type . '/' . $lang . '/' . $nom;
        if (file_exists($script)) {
            $contenu = file($script);
            while (list($cle, $val) = each($contenu)) {
                $source .= $val;
            }
        }
        $geshi = new GeSHi($source, $language);
        $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 2);
        $geshi->set_overall_style('font-size:11px;width:580px;', true);
        $geshi->set_line_style('background: #fcfcfc;', 'background: #f0f0f0;');
        $result = $geshi->parse_code();
    }
    $result .= '<div align=center><a href="?page=' . $type . '">Retour</a></div>';
    return $result;
}
开发者ID:bobibox,项目名称:Bobiscript,代码行数:23,代码来源:fonctions_affichage.php

示例9: blockHandler

/**
 * User handler for code block
 *
 * @param TexyHandlerInvocation  handler invocation
 * @param string  block type
 * @param string  text to highlight
 * @param string  language
 * @param TexyModifier modifier
 * @return TexyHtml
 */
function blockHandler($invocation, $blocktype, $content, $lang, $modifier)
{
    if ($blocktype !== 'block/code') {
        return $invocation->proceed();
    }
    $texy = $invocation->getTexy();
    global $geshiPath;
    if ($lang == 'html') {
        $lang = 'html4strict';
    }
    $content = Texy::outdent($content);
    $geshi = new GeSHi($content, $lang, $geshiPath . 'geshi/');
    // GeSHi could not find the language
    if ($geshi->error) {
        return $invocation->proceed();
    }
    // do syntax-highlighting
    $geshi->set_encoding('UTF-8');
    $geshi->set_header_type(GESHI_HEADER_PRE);
    $geshi->enable_classes();
    $geshi->set_overall_style('color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', true);
    $geshi->set_line_style('font: normal normal 95% \'Courier New\', Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060;', true);
    $geshi->set_code_style('color: #000020;', 'color: #000020;');
    $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
    $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
    // save generated stylesheet
    $texy->styleSheet .= $geshi->get_stylesheet();
    $content = $geshi->parse_code();
    // check buggy GESHI, it sometimes produce not UTF-8 valid code :-((
    $content = iconv('UTF-8', 'UTF-8//IGNORE', $content);
    // protect output is in HTML
    $content = $texy->protect($content, Texy::CONTENT_BLOCK);
    $el = TexyHtml::el();
    $el->setText($content);
    return $el;
}
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:46,代码来源:demo-geshi.php

示例10: explode

unset($lines);
unset($ccount);
unset($matches);
include_once INCLUDES . "bbcodes/geshi/geshi.php";
preg_match_all("#\\[geshi=(.*?)\\](.*?)\\[/geshi\\]#si", $text, $matches, PREG_PATTERN_ORDER);
for ($i = 0; $i < count($matches[1]); $i++) {
    $lines = explode("\n", $matches[2][$i]);
    if (count($lines) < 200) {
        $input = str_replace('<br>', '', str_replace('<br  />', '', str_replace('<br />', '', stripslashes($matches[2][$i]))));
        //replace problematic characters
        $search = array("\\", "&quot;", "&#39;", "&#92;", "&quot;", "&#39;", "&lt;", "&gt;", "&amp;");
        $replace = array("\\\\", "\"", "'", "\\", "\"", "\\'", "<", ">", "&");
        $input = str_replace($search, $replace, $input);
        $geshi = new GeSHi($input, $matches[1][$i]);
        $geshi->set_header_type(GESHI_HEADER_PRE);
        $geshi->set_overall_style('font-family:\'Courier New\', Courier; font-size:12px;');
        $geshi->set_link_styles(GESHI_LINK, 'font-weight:bold;');
        $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
        $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 10);
        $geshi->set_footer_content($locale['bb_geshi_info']);
        $geshi->set_footer_content_style('font-family:Verdana,Arial,sans-serif;color:#808080;font-size:9px;font-weight:bold;background-color:#f0f0ff;border-top: 1px solid #d0d0d0;padding:2px;width:400px');
        if (preg_match("/\\/forum\\//i", FUSION_REQUEST) && isset($data['post_id'])) {
            $geshi_save = "<a href='" . INCLUDES . "bbcodes/geshi_bbcode_save.php?thread_id=" . $_GET['thread_id'] . "&amp;post_id=" . $data['post_id'] . "&amp;code_id=" . $i . "'><img src='" . INCLUDES . "bbcodes/images/geshi_save.png' alt='" . $locale['bb_geshi_save'] . "' title='" . $locale['bb_geshi_save'] . "' style='border:none' /></a>&nbsp;&nbsp;";
        } else {
            $geshi_save = "";
        }
        $text = preg_replace("#\\[geshi=(.*?)\\](.*?)\\[/geshi\\]#si", '$2', $text);
        $text = str_replace($matches[2][$i], "<div class='tbl-border tbl2' style='width:400px'>" . $geshi_save . "<strong>GeSHi: " . $geshi->get_language_name() . "</strong></div><div class='tbl-border tbl1' style='width:400px;height:auto;white-space:nowrap;overflow:auto;background-color:#ffffff;'><code style='white-space:nowrap'>" . $geshi->parse_code() . "</code></div>", $text);
    } else {
        $ccount = substr_count($text, "[geshi=");
        for ($i = 0; $i < $ccount; $i++) {
开发者ID:MichaelFichtner,项目名称:RadioLaFamilia,代码行数:31,代码来源:geshi_bbcode_include.php

示例11: highlight

 private function highlight(&$text, $lang = 'php', $lines = false)
 {
     $geshi = new GeSHi(trim($text, "\r\n"), $lang);
     $geshi->enable_classes();
     $geshi->set_header_type(GESHI_HEADER_PRE);
     $geshi->set_overall_class("code");
     $geshi->set_encoding("utf-8");
     // [[mw:user:Brianegge]] suggestion
     $geshi->set_overall_style('background: #EEEEEE; border: padding: 0.2em');
     if ($lines == true or $lines == 1 or $lines == '1') {
         $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
     } else {
         $geshi->enable_line_numbers(GESHI_NO_LINE_NUMBERS);
     }
     return "<style>" . $geshi->get_stylesheet() . "</style>" . $geshi->parse_code();
 }
开发者ID:clrh,项目名称:mediawiki,代码行数:16,代码来源:geshi.body.php

示例12: texyBlockHandler

 static function texyBlockHandler($invocation, $blocktype, $content, $lang, $modifier)
 {
     if ($blocktype !== 'block/code') {
         return $invocation->proceed();
     }
     $texy = $invocation->getTexy();
     if ($lang == 'html') {
         $lang = 'html4strict';
     } elseif ($lang == 'yaml') {
         $lang = 'python';
     }
     $content = Texy::outdent($content);
     $geshi = new GeSHi($content, $lang);
     // GeSHi could not find the language
     if ($geshi->error) {
         return $invocation->proceed();
     }
     // do syntax-highlighting
     $geshi->set_encoding('UTF-8');
     $geshi->set_header_type(GESHI_HEADER_PRE);
     $geshi->enable_classes();
     $geshi->enable_keyword_links(false);
     $geshi->set_overall_style('');
     $geshi->set_overall_class('code');
     // save generated stylesheet
     $content = $geshi->parse_code();
     // check buggy GESHI, it sometimes produce not UTF-8 valid code :-((
     $content = iconv('UTF-8', 'UTF-8//IGNORE', $content);
     // protect output is in HTML
     $content = $texy->protect($content, Texy::CONTENT_BLOCK);
     $el = TexyHtml::el();
     $el->setText($content);
     return $el;
 }
开发者ID:xtgss,项目名称:qeephp2_x,代码行数:34,代码来源:abstract.php

示例13: GeSHi

        </tr>
        <?php 
drawTableBorder('b', 'white');
?>
    </table>

<?php 
// GeSHi is included in any case for the version information in the footer.
include_once '../geshi/src/geshi.php';
if (empty($error)) {
    if (empty($spec)) {
        echo '<div style="height: 128px"></div>';
    } else {
        $geshi = new GeSHi();
        $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
        $geshi->set_overall_style('background-color: #c7d1d2; font-size: small;');
        $geshi->set_line_style('background: #d3e0e7;');
        $geshi->set_header_type(GESHI_HEADER_DIV);
        echo '<div style="height: 32px"></div>';
        // writeMacroHeader
        if (!empty($p)) {
            echo '<table style="width: 70%">';
            drawTableBorder('t', 'white', FALSE, 2);
            showSourceCode($p);
            drawTableBorder('b', 'white', FALSE, 2);
            echo '</table>';
            echo '<div style="height: 16px"></div>';
        }
        // writePrototypeHeader
        if (!empty($h)) {
            echo '<table style="width: 70%">';
开发者ID:sschuberth,项目名称:glex1,代码行数:31,代码来源:index.php

示例14: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the login screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
    // -------------------------------------------------------------------------
    // Variables
    // -------------------------------------------------------------------------
    $filename_extension = get_filename_extension($net2ftp_globals["entry"]);
    // ------------------------
    // Set the state2 variable depending on the file extension !!!!!
    // ------------------------
    if (getFileType($net2ftp_globals["entry"]) == "IMAGE") {
        $filetype = "image";
    } elseif ($filename_extension == "swf") {
        $filetype = "flash";
    } else {
        $filetype = "text";
    }
    // Form name, back and forward buttons
    $formname = "ViewForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    // Next screen
    $nextscreen = 2;
    // -------------------------------------------------------------------------
    // Text
    // -------------------------------------------------------------------------
    if ($filetype == "text") {
        // Title
        $title = __("View file %1\$s", $net2ftp_globals["entry"]);
        // ------------------------
        // geshi_text
        // ------------------------
        setStatus(2, 10, __("Reading the file"));
        $geshi_text = ftp_readfile("", $net2ftp_globals["directory"], $net2ftp_globals["entry"]);
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // ------------------------
        // geshi_language
        // ------------------------
        $geshi_language = "";
        $list_language_extensions = array('html4strict' => array('html', 'htm'), 'javascript' => array('js'), 'css' => array('css'), 'php' => array('php', 'php5', 'phtml', 'phps'), 'perl' => array('pl', 'pm', 'cgi'), 'sql' => array('sql'), 'java' => array('java'), 'actionscript' => array('as'), 'ada' => array('a', 'ada', 'adb', 'ads'), 'apache' => array('conf'), 'asm' => array('ash', 'asm'), 'asp' => array('asp'), 'bash' => array('sh'), 'c' => array('c', 'h'), 'c_mac' => array('c'), 'caddcl' => array(), 'cadlisp' => array(), 'cpp' => array('cpp'), 'csharp' => array(), 'd' => array(''), 'delphi' => array('dpk'), 'diff' => array(''), 'email' => array('eml', 'mbox'), 'lisp' => array('lisp'), 'lua' => array('lua'), 'matlab' => array(), 'mpasm' => array(), 'nsis' => array(), 'objc' => array(), 'oobas' => array(), 'oracle8' => array(), 'pascal' => array('pas'), 'python' => array('py'), 'qbasic' => array('bi'), 'smarty' => array('tpl'), 'vb' => array('bas'), 'vbnet' => array(), 'vhdl' => array(), 'visualfoxpro' => array(), 'xml' => array('xml'));
        while (list($language, $extensions) = each($list_language_extensions)) {
            if (in_array($filename_extension, $extensions)) {
                $geshi_language = $language;
                break;
            }
        }
        // ------------------------
        // geshi_path
        // ------------------------
        $geshi_path = NET2FTP_APPLICATION_ROOTDIR . "/plugins/geshi/geshi/";
        // ------------------------
        // Call geshi
        // ------------------------
        setStatus(4, 10, __("Parsing the file"));
        $geshi = new GeSHi($geshi_text, $geshi_language, $geshi_path);
        $geshi->set_encoding(__("iso-8859-1"));
        $geshi->set_header_type(GESHI_HEADER_PRE);
        $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 10);
        //		$geshi->enable_classes();
        $geshi->set_overall_style('border: 2px solid #d0d0d0; background-color: #f6f6f6; color: #000066; padding: 10px;', true);
        $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
        $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
        $geshi->set_tab_width(4);
        $geshi_text = $geshi->parse_code();
    } elseif ($filetype == "image") {
        $title = __("View image %1\$s", htmlEncode2($net2ftp_globals["entry"]));
        $image_url = printPHP_SELF("view");
        $image_alt = __("Image") . $net2ftp_globals["entry"];
    } elseif ($filetype == "flash") {
        $title = __("View Macromedia ShockWave Flash movie %1\$s", htmlEncode2($net2ftp_globals["entry"]));
        $flash_url = printPHP_SELF("view");
    }
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:rohdoor,项目名称:Zpanel-net2ftp,代码行数:84,代码来源:view.inc.php

示例15: buildHeadItem

 /**
  * Prepare a CSS snippet suitable for use as a ParserOutput/OutputPage
  * head item
  *
  * @param GeSHi $geshi
  * @return string
  */
 public static function buildHeadItem($geshi)
 {
     global $wgUseSiteCss, $wgSquidMaxage;
     // begin Wikia change
     // VOLDEV-85
     // backporting core fix to monobook font size
     /**
      * GeSHi comes by default with a font-family set to monospace, which
      * causes the font-size to be smaller than one would expect.
      * We append a CSS hack to the default GeSHi styles: specifying 'monospace'
      * twice "resets" the browser font-size specified for monospace.
      *
      * The hack is documented in MediaWiki core under
      * docs/uidesign/monospace.html and in bug 33496.
      */
     // Preserve default since we don't want to override the other style
     // properties set by geshi (padding, font-size, vertical-align etc.)
     $geshi->set_code_style('font-family: monospace, monospace;', true);
     // No need to preserve default (which is just "font-family: monospace;")
     // outputting both is unnecessary
     $geshi->set_overall_style('font-family: monospace, monospace;', false);
     // end Wikia change
     $lang = $geshi->language;
     $css = array();
     $css[] = '<style type="text/css">/*<![CDATA[*/';
     $css[] = ".source-{$lang} {line-height: normal;}";
     $css[] = ".source-{$lang} li, .source-{$lang} pre {";
     $css[] = "\tline-height: normal; border: 0px none white;";
     $css[] = "}";
     $css[] = $geshi->get_stylesheet(false);
     $css[] = '/*]]>*/';
     $css[] = '</style>';
     return implode("\n", $css);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:41,代码来源:SyntaxHighlight_GeSHi.class.php


注:本文中的GeSHi::set_overall_style方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。