Skip to content
Closed
Show file tree
Hide file tree
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
cosmetic update
  • Loading branch information
smackesey committed Aug 26, 2021
commit 3be5280aec88b5edca7aa268ee16d3d382114141
24 changes: 12 additions & 12 deletions bin/dasht-query-html
Original file line number Diff line number Diff line change
Expand Up @@ -115,35 +115,35 @@ trap 'exit 44' USR1 # exit with a nonzero status when no results found
NR == 1 { print "<table>" }
{

# $1, $2, $3, $4 :: name, docset, type, url
name = $1; docset = $2; type = $3; url = $4;

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

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

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

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

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

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

print \
"<tr>"\
"<td><a href=\"" $4 "\">" $1 "</a></td>"\
"<td valign=\"bottom\" align=\"right\">" $2 "</td>"\
"<td valign=\"bottom\">" tolower($3) "</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=" $4 "\">"
print "<meta http-equiv=\"refresh\" content=\"0;url=" $url "\">"
}
}
}
Expand Down
8 changes: 1 addition & 7 deletions bin/dasht-query-line
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,7 @@ dasht-docsets "$@" | while read -r docset; do
# resolve URL to filesystem location
$3 = file_url $3

printf( \
"%s\t%s\t%s\t%s\n", \
result["name"], \
docset, \
result["type"], \
$3 \
)
printf("%s\t%s\t%s\t%s\n", result["name"], docset, result["type"], $3)

}

Expand Down