lib/vimwiki_markdown/template.rb in vimwiki_markdown-0.8.2 vs lib/vimwiki_markdown/template.rb in vimwiki_markdown-0.9.0
- old
+ new
@@ -31,10 +31,12 @@
.gsub('%root_path%', root_path)
.gsub('%date%', Date.today.strftime("%e %b %Y"))
end
def pygments_wrapped_in_tags
+ Rouge::Themes::Github.dark! if dark_template?
+
"<style type=\"text/css\">
#{::Rouge::Themes::Github.render(scope: '.highlight')}
</style>"
end
@@ -45,9 +47,19 @@
def title
options.title
end
def validate_template
- raise MissingRequiredParamError.new("ERROR: vimwiki template must contain %pygments% placeholder token. Please visit https://github.com/patrickdavey/vimwiki_markdown for more information") unless @template =~ /%pygments%/
+ return if dark_template? || regular_template?
+
+ raise MissingRequiredParamError.new("ERROR: vimwiki template must contain %pygments% placeholder token. Please visit https://github.com/patrickdavey/vimwiki_markdown for more information")
+ end
+
+ def dark_template?
+ @template =~ /%dark_pygments%/
+ end
+
+ def regular_template?
+ @template =~ /%pygments%/
end
end
end