From b5539e7a30da963af3e5967e2af2524a5e99efbb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 16 Mar 2004 12:47:09 +0000 Subject: [PATCH] * Store paths are now abbreviated in the generated HTML file. Hovering over the abbreviated path will reveal the full path. This probably only works in Mozilla. --- src/log2xml/log2html.xsl | 17 ++++++++++------ src/log2xml/log2xml.cc | 43 +++++++++++++++++++++++++++++++++------- src/log2xml/logfile.css | 42 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 13 deletions(-) diff --git a/src/log2xml/log2html.xsl b/src/log2xml/log2html.xsl index 96691a6aef..be4af66ce3 100644 --- a/src/log2xml/log2html.xsl +++ b/src/log2xml/log2html.xsl @@ -17,9 +17,7 @@
- - - +
@@ -52,10 +50,17 @@
- - - + + + + + + + + (...) + + \ No newline at end of file diff --git a/src/log2xml/log2xml.cc b/src/log2xml/log2xml.cc index 711fc82b89..f3e976fd91 100644 --- a/src/log2xml/log2xml.cc +++ b/src/log2xml/log2xml.cc @@ -35,12 +35,7 @@ void Decoder::pushChar(char c) state = stEscape; } else if (c == '\n') { finishLine(); - } else if (c == '<') - line += "<"; - else if (c == '&') - line += "&"; - else - line += c; + } else line += c; break; case stEscape: @@ -78,9 +73,43 @@ void Decoder::pushChar(char c) void Decoder::finishLine() { + string storeDir = "/nix/store/"; + int sz = storeDir.size(); string tag = inHeader ? "head" : "line"; cout << "<" << tag << ">"; - cout << line; + + for (int i = 0; i < line.size(); i++) { + + if (line[i] == '<') cout << "<"; + else if (line[i] == '&') cout << "&"; + else if (i + sz + 33 < line.size() && + string(line, i, sz) == storeDir && + line[i + sz + 32] == '-') + { + int j = i + sz + 32; + /* skip name */ + while (!strchr("/\n\r\t ()[]:;?<>", line[j])) j++; + int k = j; + while (!strchr("\n\r\t ()[]:;?<>", line[k])) k++; + // !!! escaping + cout << "" + << "" + << string(line, i, sz) + << "" + << "" + << string(line, i + sz, 32) + << "" + << "" + << string(line, i + sz + 32, j - (i + sz + 32)) + << "" + << "" + << string(line, j, k - j) + << "" + << ""; + i = k - 1; + } else cout << line[i]; + } + cout << "" << endl; line = ""; inHeader = false; diff --git a/src/log2xml/logfile.css b/src/log2xml/logfile.css index e240eb3815..342cf25839 100644 --- a/src/log2xml/logfile.css +++ b/src/log2xml/logfile.css @@ -64,3 +64,45 @@ tr.y > td.dummy > div.dummy border-left: 3px solid #6185a0; border-bottom: 3px solid #6185a0; } + + +em.storeref +{ + color: #500000; +} + + +em.storeref:hover +{ + background-color: #eeeeee; +} + + +*.popup { + display: none; +/* background: url('http://losser.st-lab.cs.uu.nl/~mbravenb/menuback.png') repeat; */ + background: #ffffcd; + border: solid #555555 1px; + position: absolute; + top: 1.5em; + left: 0.5em; + margin: 0; + padding: 0; + z-index: 100; +} + + +em.storeref { + position: static; +} + + +span.z { + position: absolute; + width: 100%; +} + + +em.storeref:hover > span.z > *.popup { + display: block; +}