Text to HTML: Difference between revisions
m
syntax highlighting fixup automation
m (→{{header|Phix}}: fix bad markup) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 16:
=={{header|Go}}==
This isn't very sophisticated but does a few things in a simple-minded way.
<
import (
Line 106:
fmt.Println("</body>")
fmt.Println("</html>")
}</
{{out}}
<
<head><title>Sample Text</title></head>
<body>
Line 125:
<p>That's all folks.</p>
</body>
</html></
=={{header|Julia}}==
{{trans|Go}}
<
const exampletxt = """ Sample Text
Line 212:
txt_to_html()
</
<pre>
<html>
Line 235:
=={{header|Nim}}==
{{trans|Go}}
<
const Text = """ Sample Text
Line 305:
echo "</body>"
echo "</html>"</
{{out}}
Line 328:
=={{header|Perl}}==
{{trans|Raku}}
<
use strict;
Line 387:
my $parser = Pod::Simple::HTML->new();
$parser->output_fh(*STDOUT);
$parser->parse_string_document($pod)</
=={{header|Phix}}==
The best thing to do here is to keep it utterly trivial.
<!--<
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">constant</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">hchars</span><span style="color: #0000FF;">,</span><span style="color: #000000;">hsubs</span><span style="color: #0000FF;">}</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">columnize</span><span style="color: #0000FF;">({{</span><span style="color: #008000;">"&"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"&amp;"</span><span style="color: #0000FF;">},</span>
Line 431:
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">text_to_html_page</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"my title"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">text</span><span style="color: #0000FF;">))</span>
<!--</
{{out}}
The last line of text_to_html() (as commented out) was used to generate the
Line 474:
this implementation is still incomplete.
<
int linelength(array lines)
{
Line 591:
}
return root;
}</
=={{header|Racket}}==
Line 601:
It certainly seems to me as a useful thing compared to some half-baked not-really-markdown-or-anything implementation.)
<
#lang at-exp racket
Line 630:
> and code
})
</syntaxhighlight>
{{out}}
Line 658:
It is '''not''' markup free, but it is actually usable in production.
<syntaxhighlight lang="raku"
use HTML::Escape;
Line 762:
# normally
#say render($pod6);</
{{out|Returns something like}}
Line 891:
=={{header|Tcl}}==
This renderer doesn't do all that much. Indeed, it deliberately avoids doing all the complexity that is possible; instead it seeks to just provide the minimum that could possibly be useful to someone who is doing very simple text pages.
<
proc splitParagraphs {text} {
Line 961:
}
return [append result "</body></html>"]
}</
Here's an example of how it would be used.
<
This is an example of how a pseudo-markdown-ish formatting scheme could
work. It's really much simpler than markdown, but does support a few things.
Line 985:
but relies on the encoding of the characters to be conveyed separately."
puts [markupText "Sample" $sample]</
{{out}}
<
</head><body><h1>Sample</h1>
<p>This is an example of how a pseudo-markdown-ish formatting scheme could work. It's really much simpler than markdown, but does support a few things.</p>
Line 998:
</ol><h2>Inline formatting types</h2>
<p>The formatter can render text with <i>italics</i>, <b>bold</b> and in a <tt>typewriter</tt> font. It also does the right thing with <angle brackets> and &amp;ersands, but relies on the encoding of the characters to be conveyed separately.</p>
</body></html></
=={{header|Wren}}==
Line 1,004:
{{libheader|Wren-pattern}}
Note that Wren doesn't support any form of raw string so we need to construct the sample text by concatenating strings for each paragraph.
<
var t =
Line 1,075:
System.print("</body>")
System.print("</html>")
</syntaxhighlight>
{{out}}
|