Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -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//\&/&amp;}
str=${str//</&lt;}
str=${str//>/&gt;}
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"

View file

@ -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>&lt;angry&gt;Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!&lt;/angry&gt;</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>