Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,120 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols nobinary
|
||||
|
||||
parse arg inFileName .
|
||||
if inFileName = '' | inFileName = '.' then inFileName = './data/Brian.csv'
|
||||
csv = RREadFileLineByLine01.scanFile(inFileName)
|
||||
|
||||
header = htmlHeader()
|
||||
pre = htmlCsvText(csv, inFileName)
|
||||
table = htmlCsvTable(csv, inFileName)
|
||||
footer = htmlFooter()
|
||||
|
||||
say header
|
||||
say pre
|
||||
say table
|
||||
say footer
|
||||
|
||||
return
|
||||
|
||||
method htmlHeader() public static returns Rexx
|
||||
html = '<?xml version="1.0" encoding="UTF-8"?>\n' -
|
||||
|| '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n' -
|
||||
|| '<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">\n' -
|
||||
|| '<head>\n' -
|
||||
|| '<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>\n' -
|
||||
|| '<title>RCsv2Html</title>\n' -
|
||||
|| '<style type="text/css">\n' -
|
||||
|| '<!--\n' -
|
||||
|| '/* <![DATA[ */\n' -
|
||||
|| 'body {\n' -
|
||||
|| ' font-family: "Verdana", "Geneva", "Helvetica Neue", "Helvetica", "DejaVu Sans", "Arial", sans-serif;\n' -
|
||||
|| '}\n' -
|
||||
|| 'table, th, td {\n' -
|
||||
|| ' border: 1px solid black;\n' -
|
||||
|| ' border-collapse: collapse;\n' -
|
||||
|| ' padding: 0.25em;\n' -
|
||||
|| ' font-size: 85%;\n' -
|
||||
|| '}\n' -
|
||||
|| 'th {\n' -
|
||||
|| ' color: white;\n' -
|
||||
|| ' background-color: green;\n' -
|
||||
|| '}\n' -
|
||||
|| 'p.classname {\n' -
|
||||
|| ' font-size: inherit;\n' -
|
||||
|| '}\n' -
|
||||
|| '/* ]] */\n' -
|
||||
|| '//-->\n' -
|
||||
|| '</style>\n' -
|
||||
|| '</head>\n' -
|
||||
|| '<body>\n' -
|
||||
|| '<h1>Rosetta Code – NetRexx Sample Output</h2>\n' -
|
||||
|| '<h2><a href="http://rosettacode.org/wiki/CSV_to_HTML_translation">CSV to HTML translation</a></h2>\n' -
|
||||
|| ''
|
||||
|
||||
return html
|
||||
|
||||
method htmlFooter() public static returns Rexx
|
||||
html = '</body>\n' -
|
||||
|| '</html>\n' -
|
||||
|| ''
|
||||
return html
|
||||
|
||||
method htmlCsvText(csv, fileName = '.') public static returns Rexx
|
||||
html = '<h3>Contents of CSV <code>'fileName'</code></h3>\n' -
|
||||
|| '<pre>\n' -
|
||||
|| ''
|
||||
loop row = 1 to csv[0]
|
||||
html = html || csv[row]'\n'
|
||||
end row
|
||||
html = html -
|
||||
|| '</pre>\n' -
|
||||
|| ''
|
||||
return html
|
||||
|
||||
method htmlCsvTable(csv, fileName = '.') public static returns Rexx
|
||||
html = '<table>\n' -
|
||||
|| '<caption>Translation of CSV <code>'fileName'</code></caption>\n' -
|
||||
|| '<thead>\n' -
|
||||
|| ''
|
||||
html = html -
|
||||
|| htmlCsvTableRow(csv[1], 'th')'\n' -
|
||||
|| '</thead>\n' -
|
||||
|| '<tbody>\n' -
|
||||
|| ''
|
||||
loop r_ = 2 to csv[0]
|
||||
html = html -
|
||||
|| htmlCsvTableRow(csv[r_])'\n' -
|
||||
|| ''
|
||||
end r_
|
||||
html = html -
|
||||
|| '</tbody>\n' -
|
||||
|| '</table>\n' -
|
||||
|| ''
|
||||
return html
|
||||
|
||||
method htmlCsvTableRow(row, tag = 'td') public static returns Rexx
|
||||
row = row.strip('t')
|
||||
row = row.changestr('&', '&') -- need to do this one first to avoid double translation
|
||||
row = row.changestr('"', '"')
|
||||
row = row.changestr("'", ''')
|
||||
row = row.changestr('<', '<')
|
||||
row = row.changestr('>', '>')
|
||||
elmts = ''
|
||||
elmts[0] = 0
|
||||
e_ = 0
|
||||
loop while row.length() > 0
|
||||
parse row elmt ',' row
|
||||
e_ = e_ + 1; elmts[0] = e_; elmts[e_] = elmt
|
||||
end
|
||||
html = '<tr>\n' -
|
||||
|| ''
|
||||
loop e_ = 1 to elmts[0]
|
||||
html = html -
|
||||
|| '<'tag'>'elmts[e_]'</'tag'>\n' -
|
||||
|| ''
|
||||
end e_
|
||||
html = html -
|
||||
|| '</tr>\n' -
|
||||
|| ''
|
||||
return html
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
|
||||
<title>RCsv2Html</title>
|
||||
<style type="text/css">
|
||||
<!--
|
||||
/* <![DATA[ */
|
||||
body {
|
||||
font-family: "Verdana", "Geneva", "Helvetica Neue", "Helvetica", "DejaVu Sans", "Arial", sans-serif;
|
||||
}
|
||||
table, th, td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
padding: 0.25em;
|
||||
font-size: 85%;
|
||||
}
|
||||
th {
|
||||
color: white;
|
||||
background-color: green;
|
||||
}
|
||||
p.classname {
|
||||
font-size: inherit;
|
||||
}
|
||||
/* ]] */
|
||||
//-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Rosetta Code – NetRexx Sample Output</h2>
|
||||
<h2><a href="http://rosettacode.org/wiki/CSV_to_HTML_translation">CSV to HTML translation</a></h2>
|
||||
|
||||
<h3>Contents of CSV <code>./data/Brian.csv</code></h3>
|
||||
<pre>
|
||||
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!
|
||||
</pre>
|
||||
|
||||
<table>
|
||||
<caption>Contents of CSV <code>./data/Brian.csv</code></caption>
|
||||
<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>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue