зеркало из https://github.com/mozilla/ubiquity.git
docs: Prettified.
This commit is contained in:
Родитель
2b99c41aeb
Коммит
57cb3e1aba
|
@ -5,6 +5,8 @@
|
|||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" media="all"
|
||||
href="scripts/docs/docs.css" />
|
||||
<link rel="stylesheet" type="text/css" media="all"
|
||||
href="scripts/prettify.css" />
|
||||
<title>Ubiquity Code Documentation</title>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -62,6 +64,7 @@
|
|||
<script src="scripts/jquery.js"></script>
|
||||
<script src="scripts/wikicreole.js"></script>
|
||||
<script src="scripts/docs/docs.js"></script>
|
||||
<script src="scripts/prettify.js"></script>
|
||||
<script>
|
||||
var MDC_URL_TEMPLATE = "https://developer.mozilla.org/en/N%QUERY%";
|
||||
var INTRA_DOC_LINKS = {};
|
||||
|
@ -70,8 +73,8 @@ $(".intra-wiki").each(function () {
|
|||
INTRA_DOC_LINKS[$a.text()] = $a.attr("href");
|
||||
});
|
||||
|
||||
App.processors.push(function (documentation) {
|
||||
$(documentation).find("tt").each(function () {
|
||||
App.processors.push(function ($documentation) {
|
||||
$documentation.find("tt").each(function () {
|
||||
var $tt = $(this), text = $tt.text();
|
||||
if (~text.lastIndexOf("nsI", 0)) {
|
||||
App.addMenuItem(this, "View MDC entry",
|
||||
|
@ -83,6 +86,12 @@ App.processors.push(function (documentation) {
|
|||
$tt.wrap('<a class="intra-wiki" href="' + href + '"></a>');
|
||||
}
|
||||
});
|
||||
$("pre").addClass("prettyprint").each(function () {
|
||||
// workaround to preserve trailing linefeeds after prettify
|
||||
var $code = $(this);
|
||||
if ($code.text().slice(-1) == "\n") $code.append("\n");
|
||||
});
|
||||
prettyPrint();
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
|
|
|
@ -21,7 +21,7 @@ body {
|
|||
color: black;
|
||||
padding: 3px;
|
||||
border: black dotted;
|
||||
border-width: 1px 1px 0 1px;
|
||||
border-width: 1px 1px 0 1px;
|
||||
}
|
||||
|
||||
.popup .selected {
|
||||
|
@ -65,6 +65,7 @@ body {
|
|||
courier new, monospace;
|
||||
float: left;
|
||||
white-space: pre;
|
||||
margin: 0;
|
||||
font-size: 6pt;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ App.layout = function layout(parser, code, div) {
|
|||
docs.css(App.columnCss);
|
||||
parser.renderDocText(docs, this.text);
|
||||
$(div).append(docs);
|
||||
var code = $('<div class="code">');
|
||||
var code = $('<pre class="code">');
|
||||
code.css(App.columnCss);
|
||||
parser.renderCode(code, this.code);
|
||||
$(div).append(code);
|
||||
|
@ -405,7 +405,7 @@ App.CHARS_PER_ROW = 80;
|
|||
|
||||
App.initColumnSizes = function initSizes() {
|
||||
// Get the width of a single monospaced character of code.
|
||||
var oneCodeCharacter = $('<div class="code">M</div>');
|
||||
var oneCodeCharacter = $('<pre class="code">M</pre>');
|
||||
$("#content").append(oneCodeCharacter);
|
||||
App.charWidth = oneCodeCharacter.width();
|
||||
App.columnWidth = App.charWidth * App.CHARS_PER_ROW;
|
||||
|
|
Загрузка…
Ссылка в новой задаче