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

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: shortcut for language codes
now users can define the language in a attribute with @<code>, e.g. @de
  • Loading branch information
Christian Kruse committed Nov 16, 2016
1 parent 0175a2f commit 64d2fdb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/cf_kramdown.rb
Expand Up @@ -74,6 +74,20 @@ def handle_extension(name, opts, body, type, line_no = nil)
super(name, opts, body, type, line_no)
end
end

def parse_attribute_list(str, opts)
return if str.strip.empty? || str.strip == ':'
my_opts = {}

if str =~ /@([a-zA-Z_-]+)/
my_opts['lang'] = Regexp.last_match(1)
str = str.gsub(/@([a-zA-Z_-]+)/, '')
end

super(str, opts)

opts.merge!(my_opts)
end
end

class Kramdown::Converter::CfHtml < Kramdown::Converter::Html
Expand Down

0 comments on commit 64d2fdb

Please sign in to comment.