CSV to HTML translation: Difference between revisions
Content added Content deleted
Line 1,627: | Line 1,627: | ||
=={{header|Mathematica}}== |
=={{header|Mathematica}}== |
||
<lang Mathematica>a |
<lang Mathematica>a="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!"; |
|||
(*Naive*) |
(*Naive*) |
||
StringJoin["<table>\n", |
StringJoin["<table>\n",Map[StringJoin["<tr><td>",#,"</td></tr>\n"]&, |
||
StringSplit[StringReplace[a,{","->"</td><td>","<"->"<",">"->">"}],"\n"]] |
|||
"</table>"] |
,"</table>"] |
||
(*Extra*) |
(*Extra*) |
||
StringJoin["<table>\n", |
StringJoin["<table>\n",StringJoin["<tr><th>",#,"</th></tr>\n"]&[ |
||
StringSplit[StringReplace[a,{","->"</td><td>","<"->"<",">"->">"}],"\n"]//First] |
|||
Map[StringJoin["<tr><td>",#,"</td></tr>\n"]&, |
,Map[StringJoin["<tr><td>",#,"</td></tr>\n"]&, |
||
StringSplit[StringReplace[a,{","->"</td><td>","<"->"<",">"->">"}],"\n"]//Rest] |
|||
⚫ | |||
,"</table>"] |
|||
Output: |
Output: |
||
<pre><table> |
|||
⚫ | |||
<tr><td>Character</td><td>Speech</td></tr> |
<tr><td>Character</td><td>Speech</td></tr> |
||
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr> |
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr> |
||
<tr><td>Brians mother</td><td> |
<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>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>Brians mother</td><td>I'm his mother;that's who!</td></tr> |
||
Line 1,654: | Line 1,656: | ||
<table> |
<table> |
||
<tr><th>Character</ |
<tr><th>Character</td><td>Speech</th></tr> |
||
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr> |
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr> |
||
<tr><td>Brians mother</td><td> |
<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>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>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> |
<tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr> |
||
</table> |
</table></lang> |
||
</pre> |
|||
=={{header|ML/I}}== |
=={{header|ML/I}}== |