Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
37
Task/CSV-to-HTML-translation/D/csv-to-html-translation-1.d
Normal file
37
Task/CSV-to-HTML-translation/D/csv-to-html-translation-1.d
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
void main() {
|
||||
import std.stdio;
|
||||
|
||||
immutable input =
|
||||
"Character,Speech\n" ~
|
||||
"The multitude,The messiah! Show us the messiah!\n" ~
|
||||
"Brians mother,<angry>Now you listen here! He's not the messiah; " ~
|
||||
"he's a very naughty boy! Now go away!</angry>\n" ~
|
||||
"The multitude,Who are you?\n" ~
|
||||
"Brians mother,I'm his mother; that's who!\n" ~
|
||||
"The multitude,Behold his mother! Behold his mother!";
|
||||
|
||||
"<html>\n<head><meta charset=\"utf-8\"></head>\n<body>\n\n".write;
|
||||
"<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n<thead>\n <tr><td>".write;
|
||||
|
||||
bool theadDone = false;
|
||||
|
||||
foreach (immutable c; input) {
|
||||
switch(c) {
|
||||
case '\n':
|
||||
if (theadDone) {
|
||||
"</td></tr>\n <tr><td>".write;
|
||||
} else {
|
||||
"</td></tr>\n</thead>\n<tbody>\n <tr><td>".write;
|
||||
theadDone = true;
|
||||
}
|
||||
break;
|
||||
case ',': "</td><td>".write; break;
|
||||
case '<': "<".write; break;
|
||||
case '>': ">".write; break;
|
||||
case '&': "&".write; break;
|
||||
default: c.write; break;
|
||||
}
|
||||
}
|
||||
|
||||
"</td></tr>\n</tbody>\n</table>\n\n</body></html>".write;
|
||||
}
|
||||
19
Task/CSV-to-HTML-translation/D/csv-to-html-translation-2.d
Normal file
19
Task/CSV-to-HTML-translation/D/csv-to-html-translation-2.d
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<html>
|
||||
<head><meta charset="utf-8"></head>
|
||||
<body>
|
||||
|
||||
<table border="1" cellpadding="5" cellspacing="0">
|
||||
<thead>
|
||||
<tr><td>Character</td><td>Speech</td></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>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue