Skip to content
This repository has been archived by the owner on Jun 9, 2018. It is now read-only.

Commit

Permalink
email address is obscure (just a few)
Browse files Browse the repository at this point in the history
  • Loading branch information
fperrad committed Mar 22, 2009
1 parent e4b3f39 commit 238c9de
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 21 additions & 4 deletions src/Compiler.pir
Expand Up @@ -43,8 +43,24 @@ Markdown::HTML::Compiler implements a compiler for MAST nodes.

.sub 'obscure_text' :anon
.param string str
# TODO
.return (str)
$S0 = ''
new $P1, 'FixedPMCArray'
set $P1, 1
$P0 = split '', str
L1:
unless $P0 goto L2
$S1 = shift $P0
unless $S1 == ':' goto L3
$S0 .= $S1
goto L1
L3:
$I1 = ord $S1
$P1[0] = $I1
$S1 = sprintf '&#x%X;', $P1
$S0 .= $S1
goto L1
L2:
.return ($S0)
.end

=item html_children(node)
Expand Down Expand Up @@ -328,8 +344,9 @@ Return generated HTML for all of its children.
$S1 = obscure_text($S1)
$S0 .= $S1
$S0 .= "\">"
$S1 = node.'text'()
$S1 = obscure_text($S1)
$I0 = index $S1, ':'
inc $I0
$S1 = substr $S1, $I0
$S0 .= $S1
$S0 .= "</a>"
set code, $S0
Expand Down
2 changes: 1 addition & 1 deletion t/30-autolink.t
Expand Up @@ -32,7 +32,7 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'autolink email' );
<somebbob@example.com>
CODE
<p><a href="mailto:somebbob@example.com">somebbob@example.com</a></p>
<p><a href="&#x6D;&#x61;&#x69;&#x6C;&#x74;&#x6F;:&#x73;&#x6F;&#x6D;&#x65;&#x62;&#x62;&#x6F;&#x62;&#x40;&#x65;&#x78;&#x61;&#x6D;&#x70;&#x6C;&#x65;&#x2E;&#x63;&#x6F;&#x6D;">&#x73;&#x6F;&#x6D;&#x65;&#x62;&#x62;&#x6F;&#x62;&#x40;&#x65;&#x78;&#x61;&#x6D;&#x70;&#x6C;&#x65;&#x2E;&#x63;&#x6F;&#x6D;</a></p>

OUT

Expand Down

0 comments on commit 238c9de

Please sign in to comment.