خرید بک لینک

Quite often there's a single format but with different extensions… e.g. XML can be .xml, .xmi, .graphml, and million others.

Unfortunately pygmentize guesses the appropriate lexer by the file extension and not by the content, which means that it often fails on more obscure ones.

My question is: is it possible to somehow add more aliases (e.g. the aformentioned .graphml for XML Lexer) without the need to define my own Lexer? Perhaps in some sort of configuration file.

Right now I have a bash alias as a workaround, but I'd like to solve it on pygmentize-side instead.

function pig() {
    local lexer=
    case $1 in
        *.gxl | *.graphml)
            lexer=xml
            ;;
        ...[etc]...
    esac
    if [[ -n $lexer ]]; then
        pygmentize -l $lexer $1
    else
        pygmentize $@
    fi
}

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 27 اسفند 1394 ساعت: 16:51

صفحه بندی