Sha256: e78c7e9670980ed2549939b8fca5a1d952e26c880cbbe0112f95da034edc87a2

Contents?: true

Size: 978 Bytes

Versions: 13

Compression:

Stored size: 978 Bytes

Contents

# coding: UTF-8

require 'sdbm'

module Juli
  module Macro
    # set ERB template.
    #
    # ERB template, which is used on generating HTML from juli-formatted text,
    # can be specified by:
    #
    # 1. juli(1) command line -t option.
    # 1. this macro
    # 1. .juli/config template directive.
    # 1. lib/juli/template
    #
    # See 'doc/template(macro).txt' for the detail how to use it.
    # Here is the implementation document.
    #
    # NOTE: Template class is <b>totally different</b> from TemplateBase.
    # Template is to specify ERB template, while TemplateBase is the
    # base class to provide HTML flagment replacement in a juli document.
    class Template < Base
      # save visitor for later use at run()
      def on_root(file, root, visitor = nil)
        @visitor = visitor
      end

      def run(*args)
        if @visitor.respond_to?('template=')
          @visitor.template = args[0]
        end
        ''
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
juli-2.3.2 lib/juli/macro/template.rb
juli-2.3.1 lib/juli/macro/template.rb
juli-2.3.0 lib/juli/macro/template.rb
juli-2.2.4 lib/juli/macro/template.rb
juli-2.2.3 lib/juli/macro/template.rb
juli-2.2.1 lib/juli/macro/template.rb
juli-2.2.0 lib/juli/macro/template.rb
juli-2.1.0 lib/juli/macro/template.rb
juli-2.0.4 lib/juli/macro/template.rb
juli-2.0.3 lib/juli/macro/template.rb
juli-2.0.2 lib/juli/macro/template.rb
juli-2.0.1 lib/juli/macro/template.rb
juli-2.0.0 lib/juli/macro/template.rb