Handle edge case with continuation lines. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/90a321c5 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/90a321c5 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/90a321c5
Branch: refs/heads/0.6.0 Commit: 90a321c5cc1c3ca0b4fb5285d82f07371e047740 Parents: 1a3633f Author: Alasdair Hodge <[email protected]> Authored: Mon Nov 18 12:19:47 2013 +0000 Committer: Alasdair Hodge <[email protected]> Committed: Mon Nov 18 12:19:47 2013 +0000 ---------------------------------------------------------------------- docs/_layouts/page.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/90a321c5/docs/_layouts/page.html ---------------------------------------------------------------------- diff --git a/docs/_layouts/page.html b/docs/_layouts/page.html index 00fc6a9..ffb6a00 100644 --- a/docs/_layouts/page.html +++ b/docs/_layouts/page.html @@ -47,9 +47,9 @@ $(document).ready(function() { var txt = target.text().trim(); if (target.find('code.bash')) { // Strip out bash prompts from the start of each line (i.e. '$' or '%' characters - // at the very start, or immediately following any newline). Note this may screw up if - // a continuation line (preceding line ends with '\') begins with one of those characters. - txt = txt.replace(/(^|\n)[$%] /g, "$1"); + // at the very start, or immediately following any newline). Correctly handles continuation + // lines, where a leading '$' or '%' is *not* a prompt character. + txt = txt.replace(/(^|[^\\]\n)[$%] /g, "$1"); } clipboard.setText(txt); });
