Sha256: acc87373941a471b687dc0b9101ee83f80ab90ad9c7b904e7ca7f5a413b3fa1b
Contents?: true
Size: 971 Bytes
Versions: 8
Compression:
Stored size: 971 Bytes
Contents
require 'pygments.rb' module VimwikiMarkdown class Template def initialize(options) @options = options get_template_contents validate_template end def to_s fixtags(template) end private attr_reader :options, :template def get_template_contents file = File.open(options.template_filename, "r") @template = file.read end def fixtags(template) @template = template.gsub('%title%',title).gsub('%pygments%',pygments_wrapped_in_tags) end def pygments_wrapped_in_tags "<style type=\"text/css\"> #{Pygments.css('.highlight')} </style>" end 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%/ end end end
Version data entries
8 entries across 8 versions & 1 rubygems