Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -0,0 +1,42 @@
|
|||
csv2html() {
|
||||
IFS=,
|
||||
echo "<table>"
|
||||
|
||||
echo "<thead>"
|
||||
read -r speaker text
|
||||
htmlrow "$speaker" "$text" th
|
||||
echo "</thead>"
|
||||
|
||||
echo "<tbody>"
|
||||
while read -r speaker text; do
|
||||
htmlrow "$speaker" "$text"
|
||||
done
|
||||
echo "</tbody>"
|
||||
echo "</table>"
|
||||
}
|
||||
|
||||
htmlrow() {
|
||||
cell=${3:-td}
|
||||
printf "<tr><%s>%s</%s><%s>%s</%s></tr>\n" \
|
||||
"$cell" "$(escape_html "$1")" "$cell" \
|
||||
"$cell" "$(escape_html "$2")" "$cell"
|
||||
}
|
||||
|
||||
escape_html() {
|
||||
str=${1//\&/&}
|
||||
str=${str//</<}
|
||||
str=${str//>/>}
|
||||
echo "$str"
|
||||
}
|
||||
|
||||
html=$(
|
||||
csv2html <<-END
|
||||
Character,Speech
|
||||
The multitude,The messiah! Show us the messiah!
|
||||
Brians mother,<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
|
||||
The multitude,Who are you?
|
||||
Brians mother,I'm his mother; that's who!
|
||||
The multitude,Behold his mother! Behold his mother!
|
||||
END
|
||||
)
|
||||
echo "$html"
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<table>
|
||||
<thead>
|
||||
<tr><th>Character</th><th>Speech</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
|
||||
<tr><td>Brians mother</td><td><angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry></td></tr>
|
||||
<tr><td>The multitude</td><td>Who are you?</td></tr>
|
||||
<tr><td>Brians mother</td><td>I'm his mother; that's who!</td></tr>
|
||||
<tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
Loading…
Add table
Add a link
Reference in a new issue