diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
commit | 1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch) | |
tree | f1fdd326034e05177596851be6a7127615d81498 /extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen2.php | |
parent | 9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff) | |
parent | f6d65e533c62f6deb21342d4901ece24497b433e (diff) |
Merge commit 'f6d65'
# Conflicts:
# skins/ArchLinux/ArchLinux.php
Diffstat (limited to 'extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen2.php')
-rw-r--r-- | extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen2.php | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen2.php b/extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen2.php new file mode 100644 index 00000000..cc3c39cb --- /dev/null +++ b/extensions/SyntaxHighlight_GeSHi/geshi/contrib/cssgen2.php @@ -0,0 +1,59 @@ +<?php +/** + * A simple script which outputs the CSS classes for all languages + * supported by GeSHi. You can access it directly to download + * the CSS file. On *NIX you can also do a simple `php cssgen.php > geshi.css`. + * + * This file is part of GeSHi. + * + * GeSHi 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. + * + * GeSHi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GeSHi; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @package geshi + * @subpackage contrib + * @author revulo <revulon@gmail.com> + * @copyright 2008 revulo + * @license http://gnu.org/copyleft/gpl.html GNU GPL + * + */ + +require dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'geshi.php'; +$geshi = new GeSHi; + +$languages = array(); +if ($handle = opendir($geshi->language_path)) { + while (($file = readdir($handle)) !== false) { + $pos = strpos($file, '.'); + if ($pos > 0 && substr($file, $pos) == '.php') { + $languages[] = substr($file, 0, $pos); + } + } + closedir($handle); +} +sort($languages); + +header('Content-Type: application/octet-stream'); +header('Content-Disposition: attachment; filename="geshi.css"'); + +echo "/**\n". + " * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann\n" . + " * (http://qbnz.com/highlighter/ and http://geshi.org/)\n". + " */\n"; + +foreach ($languages as $language) { + $geshi->set_language($language); + // note: the false argument is required for stylesheet generators, see API documentation + $css = $geshi->get_stylesheet(false); + echo preg_replace('/^\/\*\*.*?\*\//s', '', $css); +} |