| ... | ... | @@ -1224,41 +1224,39 @@ fn printShell(out: anytype, shell_content: []const u8, escape: bool) !void { |
| 1224 | 1224 | while (iter.next()) |orig_line| { |
| 1225 | 1225 | const line = mem.trimRight(u8, orig_line, " "); |
| 1226 | 1226 | if (!cmd_cont and line.len > 1 and mem.eql(u8, line[0..2], "$ ") and line[line.len - 1] != '\\') { |
| 1227 | | try out.writeAll(start_line ++ "$ <kbd>"); |
| 1227 | try out.writeAll("$ <kbd>"); |
| 1228 | 1228 | const s = std.mem.trimLeft(u8, line[1..], " "); |
| 1229 | 1229 | if (escape) { |
| 1230 | 1230 | try writeEscaped(out, s); |
| 1231 | 1231 | } else { |
| 1232 | 1232 | try out.writeAll(s); |
| 1233 | 1233 | } |
| 1234 | | try out.writeAll("</kbd>" ++ end_line ++ "\n"); |
| 1234 | try out.writeAll("</kbd>" ++ "\n"); |
| 1235 | 1235 | } else if (!cmd_cont and line.len > 1 and mem.eql(u8, line[0..2], "$ ") and line[line.len - 1] == '\\') { |
| 1236 | | try out.writeAll(start_line ++ "$ <kbd>"); |
| 1236 | try out.writeAll("$ <kbd>"); |
| 1237 | 1237 | const s = std.mem.trimLeft(u8, line[1..], " "); |
| 1238 | 1238 | if (escape) { |
| 1239 | 1239 | try writeEscaped(out, s); |
| 1240 | 1240 | } else { |
| 1241 | 1241 | try out.writeAll(s); |
| 1242 | 1242 | } |
| 1243 | | try out.writeAll(end_line ++ "\n"); |
| 1243 | try out.writeAll("\n"); |
| 1244 | 1244 | cmd_cont = true; |
| 1245 | 1245 | } else if (line.len > 0 and line[line.len - 1] != '\\' and cmd_cont) { |
| 1246 | | try out.writeAll(start_line); |
| 1247 | 1246 | if (escape) { |
| 1248 | 1247 | try writeEscaped(out, line); |
| 1249 | 1248 | } else { |
| 1250 | 1249 | try out.writeAll(line); |
| 1251 | 1250 | } |
| 1252 | | try out.writeAll("</kbd>" ++ end_line ++ "\n"); |
| 1251 | try out.writeAll("</kbd>" ++ "\n"); |
| 1253 | 1252 | cmd_cont = false; |
| 1254 | 1253 | } else { |
| 1255 | | try out.writeAll(start_line); |
| 1256 | 1254 | if (escape) { |
| 1257 | 1255 | try writeEscaped(out, line); |
| 1258 | 1256 | } else { |
| 1259 | 1257 | try out.writeAll(line); |
| 1260 | 1258 | } |
| 1261 | | try out.writeAll(end_line ++ "\n"); |
| 1259 | try out.writeAll("\n"); |
| 1262 | 1260 | } |
| 1263 | 1261 | } |
| 1264 | 1262 | |
| ... | ... | @@ -1511,7 +1509,7 @@ fn genHtml( |
| 1511 | 1509 | const colored_stderr = try termColor(allocator, escaped_stderr); |
| 1512 | 1510 | const colored_stdout = try termColor(allocator, escaped_stdout); |
| 1513 | 1511 | |
| 1514 | | try shell_out.print("\n$ ./{s}\n{s}{s}", .{ code.name, colored_stdout, colored_stderr }); |
| 1512 | try shell_out.print("$ ./{s}\n{s}{s}", .{ code.name, colored_stdout, colored_stderr }); |
| 1515 | 1513 | if (exited_with_signal) { |
| 1516 | 1514 | try shell_out.print("(process terminated by signal)", .{}); |
| 1517 | 1515 | } |
| ... | ... | @@ -1884,7 +1882,7 @@ test "shell parsed" { |
| 1884 | 1882 | \\$ zig build test.zig |
| 1885 | 1883 | ; |
| 1886 | 1884 | const expected = |
| 1887 | | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp><span class="line">$ <kbd>zig build test.zig</kbd></span> |
| 1885 | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp>$ <kbd>zig build test.zig</kbd> |
| 1888 | 1886 | \\</samp></pre></figure> |
| 1889 | 1887 | ; |
| 1890 | 1888 | |
| ... | ... | @@ -1892,7 +1890,6 @@ test "shell parsed" { |
| 1892 | 1890 | defer buffer.deinit(); |
| 1893 | 1891 | |
| 1894 | 1892 | try printShell(buffer.writer(), shell_out, false); |
| 1895 | | std.log.emerg("{s}", .{buffer.items}); |
| 1896 | 1893 | try testing.expectEqualSlices(u8, expected, buffer.items); |
| 1897 | 1894 | } |
| 1898 | 1895 | { |
| ... | ... | @@ -1901,8 +1898,8 @@ test "shell parsed" { |
| 1901 | 1898 | \\build output |
| 1902 | 1899 | ; |
| 1903 | 1900 | const expected = |
| 1904 | | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp><span class="line">$ <kbd>zig build test.zig</kbd></span> |
| 1905 | | \\<span class="line">build output</span> |
| 1901 | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp>$ <kbd>zig build test.zig</kbd> |
| 1902 | \\build output |
| 1906 | 1903 | \\</samp></pre></figure> |
| 1907 | 1904 | ; |
| 1908 | 1905 | |
| ... | ... | @@ -1919,9 +1916,9 @@ test "shell parsed" { |
| 1919 | 1916 | \\$ ./test |
| 1920 | 1917 | ; |
| 1921 | 1918 | const expected = |
| 1922 | | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp><span class="line">$ <kbd>zig build test.zig</kbd></span> |
| 1923 | | \\<span class="line">build output</span> |
| 1924 | | \\<span class="line">$ <kbd>./test</kbd></span> |
| 1919 | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp>$ <kbd>zig build test.zig</kbd> |
| 1920 | \\build output |
| 1921 | \\$ <kbd>./test</kbd> |
| 1925 | 1922 | \\</samp></pre></figure> |
| 1926 | 1923 | ; |
| 1927 | 1924 | |
| ... | ... | @@ -1939,10 +1936,10 @@ test "shell parsed" { |
| 1939 | 1936 | \\output |
| 1940 | 1937 | ; |
| 1941 | 1938 | const expected = |
| 1942 | | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp><span class="line">$ <kbd>zig build test.zig</kbd></span> |
| 1943 | | \\<span class="line"></span> |
| 1944 | | \\<span class="line">$ <kbd>./test</kbd></span> |
| 1945 | | \\<span class="line">output</span> |
| 1939 | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp>$ <kbd>zig build test.zig</kbd> |
| 1940 | \\ |
| 1941 | \\$ <kbd>./test</kbd> |
| 1942 | \\output |
| 1946 | 1943 | \\</samp></pre></figure> |
| 1947 | 1944 | ; |
| 1948 | 1945 | |
| ... | ... | @@ -1959,9 +1956,9 @@ test "shell parsed" { |
| 1959 | 1956 | \\output |
| 1960 | 1957 | ; |
| 1961 | 1958 | const expected = |
| 1962 | | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp><span class="line">$ <kbd>zig build test.zig</kbd></span> |
| 1963 | | \\<span class="line">$ <kbd>./test</kbd></span> |
| 1964 | | \\<span class="line">output</span> |
| 1959 | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp>$ <kbd>zig build test.zig</kbd> |
| 1960 | \\$ <kbd>./test</kbd> |
| 1961 | \\output |
| 1965 | 1962 | \\</samp></pre></figure> |
| 1966 | 1963 | ; |
| 1967 | 1964 | |
| ... | ... | @@ -1980,11 +1977,11 @@ test "shell parsed" { |
| 1980 | 1977 | \\output |
| 1981 | 1978 | ; |
| 1982 | 1979 | const expected = |
| 1983 | | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp><span class="line">$ <kbd>zig build test.zig \</span> |
| 1984 | | \\<span class="line"> --build-option</kbd></span> |
| 1985 | | \\<span class="line">build output</span> |
| 1986 | | \\<span class="line">$ <kbd>./test</kbd></span> |
| 1987 | | \\<span class="line">output</span> |
| 1980 | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp>$ <kbd>zig build test.zig \ |
| 1981 | \\ --build-option</kbd> |
| 1982 | \\build output |
| 1983 | \\$ <kbd>./test</kbd> |
| 1984 | \\output |
| 1988 | 1985 | \\</samp></pre></figure> |
| 1989 | 1986 | ; |
| 1990 | 1987 | |
| ... | ... | @@ -1998,15 +1995,15 @@ test "shell parsed" { |
| 1998 | 1995 | // intentional space after "--build-option1 \" |
| 1999 | 1996 | const shell_out = |
| 2000 | 1997 | \\$ zig build test.zig \ |
| 2001 | | \\ --build-option1 \ |
| 1998 | \\ --build-option1 \ |
| 2002 | 1999 | \\ --build-option2 |
| 2003 | 2000 | \\$ ./test |
| 2004 | 2001 | ; |
| 2005 | 2002 | const expected = |
| 2006 | | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp><span class="line">$ <kbd>zig build test.zig \</span> |
| 2007 | | \\<span class="line"> --build-option1 \</span> |
| 2008 | | \\<span class="line"> --build-option2</kbd></span> |
| 2009 | | \\<span class="line">$ <kbd>./test</kbd></span> |
| 2003 | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp>$ <kbd>zig build test.zig \ |
| 2004 | \\ --build-option1 \ |
| 2005 | \\ --build-option2</kbd> |
| 2006 | \\$ <kbd>./test</kbd> |
| 2010 | 2007 | \\</samp></pre></figure> |
| 2011 | 2008 | ; |
| 2012 | 2009 | |
| ... | ... | @@ -2022,8 +2019,8 @@ test "shell parsed" { |
| 2022 | 2019 | \\$ ./test |
| 2023 | 2020 | ; |
| 2024 | 2021 | const expected = |
| 2025 | | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp><span class="line">$ <kbd>zig build test.zig \</span> |
| 2026 | | \\<span class="line">$ ./test</kbd></span> |
| 2022 | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp>$ <kbd>zig build test.zig \ |
| 2023 | \\$ ./test</kbd> |
| 2027 | 2024 | \\</samp></pre></figure> |
| 2028 | 2025 | ; |
| 2029 | 2026 | |
| ... | ... | @@ -2040,9 +2037,9 @@ test "shell parsed" { |
| 2040 | 2037 | \\$1 |
| 2041 | 2038 | ; |
| 2042 | 2039 | const expected = |
| 2043 | | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp><span class="line">$ <kbd>zig build test.zig</kbd></span> |
| 2044 | | \\<span class="line">$ <kbd>./test</kbd></span> |
| 2045 | | \\<span class="line">$1</span> |
| 2040 | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp>$ <kbd>zig build test.zig</kbd> |
| 2041 | \\$ <kbd>./test</kbd> |
| 2042 | \\$1 |
| 2046 | 2043 | \\</samp></pre></figure> |
| 2047 | 2044 | ; |
| 2048 | 2045 | |
| ... | ... | @@ -2057,7 +2054,7 @@ test "shell parsed" { |
| 2057 | 2054 | \\$zig build test.zig |
| 2058 | 2055 | ; |
| 2059 | 2056 | const expected = |
| 2060 | | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp><span class="line">$zig build test.zig</span> |
| 2057 | \\<figure><figcaption class="shell-cap">Shell</figcaption><pre><samp>$zig build test.zig |
| 2061 | 2058 | \\</samp></pre></figure> |
| 2062 | 2059 | ; |
| 2063 | 2060 | |