<div class="smw-editpage-help"><p data-msgkey="smw-editpage-annotation-enabled"><span class="icon-huiji"></span> 本维基已启用语义注释(Semantic MediaWiki)。详见<a href="https://www.huijiwiki.com/wiki/%E5%B8%AE%E5%8A%A9:Semantic_Mediawiki" class="extiw" title="h:帮助:Semantic Mediawiki">帮助文档</a>。</p></div>
<div class="smw-editpage-help"><p data-msgkey="smw-editpage-annotation-enabled"><span class="icon-huiji"></span> 本维基已启用语义注释(Semantic MediaWiki)。详见<a href="https://www.huijiwiki.com/wiki/%E5%B8%AE%E5%8A%A9:Semantic_Mediawiki" class="extiw" title="h:帮助:Semantic Mediawiki">帮助文档</a>。</p></div>

prettyprint 语言参数

为pre标签增加如下class可控制染色语言。如果不加则脚本会根据内容猜测语言。 理论支持:

  • lang-apollo
  • lang-clj
  • lang-css
  • lang-go
  • lang-hs
  • lang-lisp
  • lang-lua
  • lang-ml
  • lang-n
  • lang-proto
  • lang-scala
  • lang-sql
  • lang-tex
  • lang-vb
  • lang-vhdl
  • lang-wiki
  • lang-xq
  • lang-yaml

示例

function timeFormat() {
    Date.prototype.format = function (format) {
        var o = {
            "M+": this.getMonth() + 1, //month
            "d+": this.getDate(), //day
            "h+": this.getHours(), //hour
            "m+": this.getMinutes(), //minute
            "s+": this.getSeconds(), //second
            "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
            "S": this.getMilliseconds() //millisecond
        };
        if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
            (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(format))
                format = format.replace(RegExp.$1,
                    RegExp.$1.length == 1 ? o[k] :
                        ("00" + o[k]).substr(("" + o[k]).length));
        return format;
    };
}
timeFormat();
function timeFormat() {
    Date.prototype.format = function (format) {
        var o = {
            "M+": this.getMonth() + 1, //month
            "d+": this.getDate(), //day
            "h+": this.getHours(), //hour
            "m+": this.getMinutes(), //minute
            "s+": this.getSeconds(), //second
            "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
            "S": this.getMilliseconds() //millisecond
        };
        if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
            (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(format))
                format = format.replace(RegExp.$1,
                    RegExp.$1.length == 1 ? o[k] :
                        ("00" + o[k]).substr(("" + o[k]).length));
        return format;
    };
}
timeFormat();
function timeFormat() {
    Date.prototype.format = function (format) {
        var o = {
            "M+": this.getMonth() + 1, //month
            "d+": this.getDate(), //day
            "h+": this.getHours(), //hour
            "m+": this.getMinutes(), //minute
            "s+": this.getSeconds(), //second
            "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
            "S": this.getMilliseconds() //millisecond
        };
        if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
            (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(format))
                format = format.replace(RegExp.$1,
                    RegExp.$1.length == 1 ? o[k] :
                        ("00" + o[k]).substr(("" + o[k]).length));
        return format;
    };
}
timeFormat();
function timeFormat() {
    Date.prototype.format = function (format) {
        var o = {
            "M+": this.getMonth() + 1, //month
            "d+": this.getDate(), //day
            "h+": this.getHours(), //hour
            "m+": this.getMinutes(), //minute
            "s+": this.getSeconds(), //second
            "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
            "S": this.getMilliseconds() //millisecond
        };
        if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
            (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(format))
                format = format.replace(RegExp.$1,
                    RegExp.$1.length == 1 ? o[k] :
                        ("00" + o[k]).substr(("" + o[k]).length));
        return format;
    };
}
timeFormat();
avatar