Handle html param from code block output

This commit is contained in:
Samy Pessé
2015-09-22 22:41:13 +02:00
parent 62d0eb606e
commit 4e4bd23e2b
3 changed files with 9 additions and 5 deletions
+4 -3
View File
@@ -244,14 +244,15 @@ function normalizeHtml(src, options) {
.value();
var source = $(this).text();
var html = options.book.template.applyBlock("code", {
var blk = options.book.template.applyBlock("code", {
body: source,
kwargs: {
language: lang
}
}).body;
});
$(this).html(html);
if (blk.html === false) $(this).text(blk.body);
else $(this).html(blk.body);
});
// Replace glossary terms
+1 -1
View File
@@ -56,7 +56,7 @@ describe("Code Highlighting", function () {
it("should correctly replace highlighting for inline code with html tags", function() {
PAGE.should.be.html({
"code": {
index: 2,
index: 3,
text: "code_<test>_code"
}
});
+4 -1
View File
@@ -4,7 +4,10 @@ module.exports = {
process: function(blk) {
var lang = blk.kwargs.language || "code";
return lang+"_"+blk.body+"_"+lang;
return {
body: lang+"_"+blk.body+"_"+lang,
html: false
};
}
}
}