Skip to content

Commit

Permalink
Merge pull request #1007 from Tradeshift/elkin/fix-docs-processor
Browse files Browse the repository at this point in the history
build: Updated docs generator code to use changed API of cheerio library
  • Loading branch information
aleks-elkin authored Jul 29, 2021
2 parents f57d0ff + 574a1a7 commit 306d534
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/tasks/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function highlite($) {
type = script.attr('type') || 'text/plain';
lang = klass.split('-')[1];
gram = prism.languages[lang];
code = unindent(script.text()).replace(/scrxpt/g, 'script');
code = unindent(script.html()).replace(/scrxpt/g, 'script');
setup($, figure, script, klass, type, lang, gram, code);
code = klass === 'language-javascript' ? compile(code).code : code;
figure.attr('data-ts.code', encodeURIComponent(code));
Expand All @@ -176,7 +176,7 @@ function highlite($) {
$('[data-ts=DoxApi]').each(function(i, table) {
script = $(table).find('script');
if (script) {
code = unindent(script.text());
code = unindent(script.html());
$(table).attr('data-ts.code', encodeURIComponent(code));
script.remove();
}
Expand Down Expand Up @@ -341,6 +341,11 @@ function includetags($, source) {
var pre = preparsers(include, $);
var post = postparsers(include, $);
html = fetchinclude(file, hash, pre, post);
if (href === 'tabs.xhtml') {
// if it is a "tabs.xhtml" we need to append it to <head>
// because it contains a list of "<link prefetch>"
include.appendTo('head');
}
} else {
console.log('Human error: "' + file + '" not found!!!');
console.log(badinclude(file));
Expand Down

0 comments on commit 306d534

Please sign in to comment.