Sha256: 16d8d1f2be6a115a8075f10f37a1420463adcbdf0ca621fb88e994066237d2b5
Contents?: true
Size: 1.06 KB
Versions: 5
Compression:
Stored size: 1.06 KB
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) @template = @template.gsub('%root_path%', root_path) end def pygments_wrapped_in_tags "<style type=\"text/css\"> #{Pygments.css('.highlight')} </style>" end def root_path options.root_path 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
5 entries across 5 versions & 1 rubygems