A few more fixes following the big cleanup.

This commit is contained in:
mtail 2019-02-10 15:44:06 -08:00
parent 6f7fa1445f
commit efdae03b36
18 changed files with 36 additions and 24 deletions

View File

@ -1,4 +1,4 @@
{{- /* Inserts a text block into the HTML. See https://preliminary.istio.io/about/contribute/writing-a-new-topic/#embedding-preformatted-blocks for details */ -}}
{{- /* Inserts a text block into the HTML. See https://preliminary.istio.io/about/contribute/creating-and-editing-pages/#embedding-preformatted-blocks for details */ -}}
{{- $downloadas := "" -}}
{{- if .Get 2 -}}
{{- $downloadas = .Get 2 -}}
@ -44,16 +44,12 @@
{{- if eq $syntax "bash" -}}
{{- if not (hasPrefix $text "$") -}}
{{- errorf "Text block specifies a bash syntax, but the first line of the block does not start with $ (%s)" .Position -}}
{{- else -}}
{{- if findRE "<<EOF" $line0 -}}
{{- $text = substr $text 2 -}}
{{- else -}}
{{- $syntax = "command" -}}
{{- if $output -}}
{{- $syntax = printf "command-output-as-%s" $output -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- /* include a link to the special embedded @@ references so the links are statically checked as we build the site */ -}}

View File

@ -1,4 +1,4 @@
{{- /* Inserts a text file into the HTML. See https://preliminary.istio.io/about/contribute/writing-a-new-topic/#embedding-preformatted-blocks for details */ -}}
{{- /* Inserts a text file into the HTML. See https://preliminary.istio.io/about/contribute/creating-and-editing-pages/#embedding-preformatted-blocks for details */ -}}
{{- $name := split (.Get "file") "/" | last 1 -}}
{{- $downloadas := index $name 0 -}}
{{- if .Get "downloadas" -}}

View File

@ -186,7 +186,7 @@ function handleDOMLoaded() {
var text = getToolbarDivText(div);
var downloadas = code.getAttribute("data-downloadas");
if (downloadas === null || downloadas === "") {
downloadas = "foo.txt";
downloadas = "foo";
var lang = "";
for (var j = 0; j < code.classList.length; j++) {
@ -283,6 +283,7 @@ function handleDOMLoaded() {
var lines = code.innerText.split("\n");
var cmd = "";
var escape = false;
var escapeUntilEOF = false;
var tmp = "";
for (var j = 0; j < lines.length; j++) {
var line = lines[j];
@ -293,9 +294,22 @@ function handleDOMLoaded() {
}
tmp = line.slice(2);
if (line.endsWith("<<EOF")) {
escapeUntilEOF = true;
}
} else if (escape) {
// continuation
tmp += "\n" + line;
if (line.endsWith("<<EOF")) {
escapeUntilEOF = true;
}
} else if (escapeUntilEOF) {
tmp += "\n" + line;
if (line === "EOF") {
escapeUntilEOF = false;
}
} else {
outputStart = j;
break;

View File

@ -207,6 +207,8 @@ pre {
}
div.toolbar {
position: relative;
button {
font-size: .8em;
padding: 0 .5em;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long