Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix awk variable naming
  • Loading branch information
smackesey committed Aug 27, 2021
commit d3855296122ec99bf66b72d2d8ddbd9861fdf35b
22 changes: 11 additions & 11 deletions bin/dasht-query-html
Original file line number Diff line number Diff line change
Expand Up @@ -119,31 +119,31 @@ trap 'exit 44' USR1 # exit with a nonzero status when no results found

# mark search terms with STX and ETX bytes which are ignored by escape()
if (pattern) {
gsub(pattern, "\002&\003", $name)
gsub(pattern, "\002&\003", name)
}

# mark word-wrappable points with VT bytes which are ignored by escape()
$name = wordbreak($name, "\v", "\002\003")
name = wordbreak(name, "\v", "\002\003")

# escape XML entities in search result to make them visible in browsers
$name = escape($name)
name = escape(name)

# insert word-break opportunity <wbr> tags at points marked by VT bytes
gsub("\v", "<wbr>", $name)
gsub("\v", "<wbr>", name)

# highlight search terms in search result using the STX and ETX markers
if (pattern) {
gsub("\002", "<b><i><u>", $name)
gsub("\003", "</u></i></b>", $name)
gsub("\002", "<b><i><u>", name)
gsub("\003", "</u></i></b>", name)
}

$docset = wordbreak_cached($docset, "<wbr>") # docset field
docset = wordbreak_cached(docset, "<wbr>") # docset field

print \
"<tr>"\
"<td><a href=\"" $url "\">" $name "</a></td>"\
"<td valign=\"bottom\" align=\"right\">" $docset "</td>"\
"<td valign=\"bottom\">" tolower($type) "</td>"\
"<td><a href=\"" url "\">" name "</a></td>"\
"<td valign=\"bottom\" align=\"right\">" docset "</td>"\
"<td valign=\"bottom\">" tolower(type) "</td>"\
"</tr>"

}
Expand All @@ -152,7 +152,7 @@ trap 'exit 44' USR1 # exit with a nonzero status when no results found
print "</table>"
if (NR == 1) {
# there was only one search result, so automatically visit its url
print "<meta http-equiv=\"refresh\" content=\"0;url=" $url "\">"
print "<meta http-equiv=\"refresh\" content=\"0;url=" url "\">"
}
}
}
Expand Down