Skip to content

Commit

Permalink
Don't put any HTML in plain raw pages
Browse files Browse the repository at this point in the history
  • Loading branch information
tombh committed Jun 23, 2018
1 parent f89ecc6 commit 5ddba85
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions webext/src/dom/serialise_mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default (MixinBase) => class extends MixinBase {
}

_serialiseRawText() {
let info = '';
let raw_text = '';
this._previous_cell_href = '';
this._is_inside_anchor = false;
Expand All @@ -41,13 +40,21 @@ export default (MixinBase) => class extends MixinBase {
}
raw_text += "\n";
}
if (this._raw_mode_type === 'raw_text_html') {
raw_text = this._wrapHTML(raw_text);
}
return raw_text;
}

_wrapHTML(raw_text) {
let info = '';
const head = this._getHTMLHead();
const date_time = this._getCurrentDataTime();
info += "\n\n" + `Built by <a href="https://www.brow.sh">Browsh</a> on ${date_time}`;
if (this.dimensions.is_page_truncated) {
info += '\nBrowsh parser: the page was too large, some text may have been truncated.';
}
const foot = `${info}</pre></body></html>`
const foot = `${info}</pre></body></html>`;
return head + raw_text + foot;
}

Expand Down

0 comments on commit 5ddba85

Please sign in to comment.