Show
Ignore:
Timestamp:
08/22/11 13:57:20 (13 years ago)
Author:
František Kučera <franta-hg@…>
Branch:
default
Message:

Zvýrazňování syntaxe #12 – prakticky hotové.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • šablona/funkce/src/cz/frantovo/xmlWebGenerator/Funkce.java

    r30 r31  
    4040         * @param jazyk předáme příkazu pygmentize jako parametr -l &lt;lexer&gt; 
    4141         * @return zvýrazněný text nebo null, pokud došlo k chybě. 
    42          * TODO: použít (?) místo textu instanci com.icl.saxon.om.NodeInfo http://saxon.sourceforge.net/saxon6.5.3/extensibility.html 
     42         * TODO:  
     43         *      - použít (?) místo textu instanci com.icl.saxon.om.NodeInfo http://saxon.sourceforge.net/saxon6.5.3/extensibility.html 
     44         *  - nebo kontrolovat validitu vygenerovaného kódu (v současnosti se spoléháme na bezchybnost pygmentize) 
    4345         */ 
    4446        public static String zvýrazniSyntaxi(String zdroják, String jazyk) throws IOException, InterruptedException { 
     
    7173                        System.err.println("\t$ aptitude install python-pygments   # (Debian/Ubuntu)"); 
    7274                        System.err.println("\t$ yum install python-pygments        # (Fedora/RedHat)"); 
     75                        return null; 
     76                } 
     77        } 
     78 
     79        /** 
     80         * Vygeneruje CSS styl pro zvýrazňování syntaxe. 
     81         * @return obsah CSS souboru nebo null, pokud generování nebylo možné 
     82         */ 
     83        public static String generujCssSyntaxe() throws IOException, InterruptedException { 
     84                if (isPrikazDostupny(PŘÍKAZ_PYGMENTIZE)) { 
     85                        Runtime r = Runtime.getRuntime(); 
     86                        Process p = r.exec(new String[]{PŘÍKAZ_PYGMENTIZE, "-S", "default", "-f", "html"}); 
     87                        return načtiProud(p.getInputStream()); 
     88                } else { 
    7389                        return null; 
    7490                }