Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
15
Task/CSV-to-HTML-translation/Ed/csv-to-html-translation.ed
Normal file
15
Task/CSV-to-HTML-translation/Ed/csv-to-html-translation.ed
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
H
|
||||
g/&/s//\&/g
|
||||
g/</s//\</g
|
||||
g/>/s//\>/g
|
||||
g/"/s//\"e;/g
|
||||
g/^/s// <tr><td>/g
|
||||
g/,/s//<\/td><td>/g
|
||||
g/$/s//<\/td>\
|
||||
<\/tr>/
|
||||
1s/^/<table>\
|
||||
/
|
||||
$s/$/\
|
||||
<\/table>/
|
||||
,p
|
||||
Q
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
global switch thead initial {true}
|
||||
global switch tbody-first initial {true}
|
||||
|
||||
define function process-tr (value stream line) as
|
||||
do when thead
|
||||
output '<thead>%n<tr><th>'
|
||||
else when tbody-first
|
||||
output '</thead>%n'
|
||||
output '<tbody>%n<tr><td>'
|
||||
deactivate tbody-first
|
||||
else
|
||||
output '<tr><td>'
|
||||
done
|
||||
repeat scan line
|
||||
match ',' any-text => char
|
||||
output '</th><th>' when thead
|
||||
output '</td><td>' unless thead
|
||||
using group ents submit char
|
||||
match any-text => char
|
||||
using group ents submit char
|
||||
again
|
||||
output '</td>' unless thead
|
||||
output '</th>' when thead
|
||||
output '</tr>'
|
||||
deactivate thead
|
||||
|
||||
|
||||
process-start
|
||||
output '<?xml version="1.0" encoding="UTF-8"?>%n' ||
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">%n' ||
|
||||
'<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">%n' ||
|
||||
'<head>%n' ||
|
||||
'<title>Monty Python’s Life of Brian (1979). Scene 20 (extract).</title>%n' ||
|
||||
'<meta name="description" content="Rosetta Code. Task: CSV to HTML translation (extra credit)" />%n' ||
|
||||
'<meta name="keywords" content="OmniMark" />%n' ||
|
||||
'<meta name="author" content="Kennypete" />%n' ||
|
||||
'<style type="text/css">%nth { background-color: gold }%n</style>%n' ||
|
||||
'</head>%n' ||
|
||||
'<body>%n' ||
|
||||
'<table border=%"1%">%n'
|
||||
|
||||
process-end
|
||||
output '</tbody>%n' ||
|
||||
'</table>%n' ||
|
||||
'</body>%n' ||
|
||||
'</html>%n'
|
||||
; Output validates to XHTML 1.0 - https://validator.w3.org/check
|
||||
|
||||
process
|
||||
local stream s
|
||||
set s to "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!%n"
|
||||
using group line submit s
|
||||
|
||||
group ents
|
||||
|
||||
find '<'
|
||||
output '<'
|
||||
|
||||
find '>'
|
||||
output '>'
|
||||
|
||||
find "'"
|
||||
output '''
|
||||
|
||||
group line
|
||||
|
||||
find line-start any-text+ => line
|
||||
process-tr(line)
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<title>Monty Python’s Life of Brian (1979). Scene 20 (extract).</title>
|
||||
<meta name="description" content="Rosetta Code. Task: CSV to HTML translation (extra credit)" />
|
||||
<meta name="keywords" content="OmniMark" />
|
||||
<meta name="author" content="Kennypete" />
|
||||
<style type="text/css">
|
||||
th { background-color: gold }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table border="1">
|
||||
<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