From 1254e5ff8de86addad29201d7e034876569bb078 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Fri, 15 May 2015 15:25:46 +1000 Subject: [PATCH] * ::Markdown->span --- lib/Text/Dokuwiki/Render/Markdown.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/Text/Dokuwiki/Render/Markdown.pm b/lib/Text/Dokuwiki/Render/Markdown.pm index 3c9df9f..17ad3ff 100644 --- a/lib/Text/Dokuwiki/Render/Markdown.pm +++ b/lib/Text/Dokuwiki/Render/Markdown.pm @@ -73,4 +73,25 @@ sub img { return sprintf("![%s](%s%s)", $alt, $attrs->{src}, $title); } +use Data::Dumper; + +sub span { + my ($self, $attrs, $content) = @_; + + return sprintf "``%s``", $content + if ($attrs->{'font-family'} and $attrs->{'font-family'} eq 'monospace'); + + $content = $self->treewalk($content); + return sprintf "__%s__", $content + if ($attrs->{'text-decoration'} and $attrs->{'text-decoration'} eq 'underline'); + + return sprintf "**%s**", $content + if ($attrs->{'font-weight'} and $attrs->{'font-weight'} eq 'bold'); + + return sprintf "//%s//", $content + if ($attrs->{'font-family'} and $attrs->{'font-family'} eq 'italic'); + + return $content; +} + 1;