Rosetta Code/Fix code tags: Difference between revisions
Content added Content deleted
(Found incorrectness.) |
Thundergnat (talk | contribs) (Undo revision 266616 by Dijkstra Incorrectly marked incorrect. There IS no language named "barf" so those tags were not changed.) |
||
Line 82: | Line 82: | ||
=={{header|Erlang}}== |
=={{header|Erlang}}== |
||
{{incorrect|Erlang|<%s> .. <\%s> tag pairs are not converted e.g. "<barf>".}} |
|||
Commented away are 3 lines that would create a dict of the existing languages on Rosetta Code. Since the examples have 3 imaginary code tags, I replaced that code this way. |
Commented away are 3 lines that would create a dict of the existing languages on Rosetta Code. Since the examples have 3 imaginary code tags, I replaced that code this way. |
||
<lang Erlang> |
<lang Erlang> |
||
#! /usr/bin/env escript |
|||
-module( fix_code_tags ). |
-module( fix_code_tags ). |
||
-mode( compile ). |
-mode( compile ). |
||
Line 121: | Line 121: | ||
loop( eof, Acc ) -> lists:reverse( Acc ); |
loop( eof, Acc ) -> lists:reverse( Acc ); |
||
loop( Line, Acc ) -> loop( io:get_line(""), [Line | Acc] ). |
loop( Line, Acc ) -> loop( io:get_line(""), [Line | Acc] ). |
||
⚫ | |||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
% cat fix_code_tags |
|||
Lorem ipsum <code foo>saepe audire</code> elaboraret ne quo, id equidem |
Lorem ipsum <code foo>saepe audire</code> elaboraret ne quo, id equidem |
||
atomorum inciderint usu. <foo>In sit inermis deleniti percipit</foo>, |
atomorum inciderint usu. <foo>In sit inermis deleniti percipit</foo>, |
||
Line 136: | Line 138: | ||
altera electram. Tota adhuc altera te sea, <lang bar>soluta appetere ut mel</lang>. |
altera electram. Tota adhuc altera te sea, <lang bar>soluta appetere ut mel</lang>. |
||
Quo quis graecis vivendo te, <lang baz>posse nullam lobortis ex usu</lang>. Eam volumus perpetua |
Quo quis graecis vivendo te, <lang baz>posse nullam lobortis ex usu</lang>. Eam volumus perpetua |
||
constituto id, mea an omittam fierent vituperatoribus. |
constituto id, mea an omittam fierent vituperatoribus. |
||
</pre> |
|||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |
||
Line 269: | Line 272: | ||
=={{header|J}}== |
=={{header|J}}== |
||
{{incorrect|J|<%s> .. <\%s> tag pairs are not converted e.g. "<barf>".}} |
|||
'''Solution:''' |
'''Solution:''' |
||
<lang j>require 'printf strings files' |
<lang j>require 'printf strings files' |
||
Line 306: | Line 308: | ||
=={{header|Java}}== |
=={{header|Java}}== |
||
{{incorrect|Java|<%s> .. <\%s> tag pairs are not converted e.g. "<barf>".}} |
|||
<lang java>import java.io.BufferedReader; |
<lang java>import java.io.BufferedReader; |
||
import java.io.File; |
import java.io.File; |
||
Line 373: | Line 374: | ||
} |
} |
||
} |
} |
||
} |
|||
⚫ | |||
</lang> |
|||
Example: |
Example: |
||
<pre> |
|||
user@ubuntu:~$ cat fix.in |
|||
Lorem ipsum <code foo>saepe audire</code> elaboraret ne quo, id equidem |
Lorem ipsum <code foo>saepe audire</code> elaboraret ne quo, id equidem |
||
atomorum inciderint usu. <foo>In sit inermis deleniti percipit</foo>, |
atomorum inciderint usu. <foo>In sit inermis deleniti percipit</foo>, |
||
Line 390: | Line 394: | ||
altera electram. Tota adhuc altera te sea, <lang bar>soluta appetere ut mel</bar>. |
altera electram. Tota adhuc altera te sea, <lang bar>soluta appetere ut mel</bar>. |
||
Quo quis graecis vivendo te, <baz>posse nullam lobortis ex usu</lang>. Eam volumus perpetua |
Quo quis graecis vivendo te, <baz>posse nullam lobortis ex usu</lang>. Eam volumus perpetua |
||
constituto id, mea an omittam fierent vituperatoribus. |
constituto id, mea an omittam fierent vituperatoribus. |
||
</pre> |
|||
=={{header|JavaScript}}== |
=={{header|JavaScript}}== |
||
Line 802: | Line 808: | ||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
{{incorrect|Ruby|<%s> .. <\%s> tag pairs are not converted e.g. "<barf>".}} |
|||
<lang ruby># get all stdin in one string |
<lang ruby># get all stdin in one string |
||
#text = $stdin.read |
#text = $stdin.read |
||
Line 823: | Line 828: | ||
altera electram. Tota adhuc altera te sea, <code bar>soluta appetere ut mel</bar>. |
altera electram. Tota adhuc altera te sea, <code bar>soluta appetere ut mel</bar>. |
||
Quo quis graecis vivendo te, <baz>posse nullam lobortis ex usu</code>. Eam volumus perpetua |
Quo quis graecis vivendo te, <baz>posse nullam lobortis ex usu</code>. Eam volumus perpetua |
||
constituto id, mea an omittam fierent vituperatoribus.</lang> |
constituto id, mea an omittam fierent vituperatoribus. </lang> |
||
<pre>Lorem ipsum <lang foo>saepe audire</lang> elaboraret ne quo, id equidem |
<pre>Lorem ipsum <lang foo>saepe audire</lang> elaboraret ne quo, id equidem |