class Slideshow::Gen
fix:/todo: move generation code out of command into its own class
not residing/depending on cli
Attributes
config[R]
headers[R]
outdir[R]
session[R]
srcdir[R]
usrdir[R]
todo/check: usrdir needed for something (e.g. why keep it?) - remove? why? why not??
Public Class Methods
new( config, headers, session={}, content_for={} )
click to toggle source
# File lib/slideshow/commands/gen.rb, line 13 def initialize( config, headers, session={}, content_for={} ) @config = config @headers = headers @session = session @content_for = content_for end
Public Instance Methods
guard_block( text )
click to toggle source
# File lib/slideshow/commands/gen.rb, line 76 def guard_block( text ) ## use/rename to guard_text_block - why? why not? # wrap in newlines to avoid runons "\n\n#{text}\n\n" end
guard_inline( text )
click to toggle source
# File lib/slideshow/commands/gen.rb, line 81 def guard_inline( text ) ## use/rename to guard_text_inline - why? why not? wrap_markup( text ) end
guard_text( text )
click to toggle source
some markdown guard helpers
(e.g. guard text/mark text for do NOT convert)
# File lib/slideshow/commands/gen.rb, line 63 def guard_text( text ) # todo/fix 2: note we need to differentiate between blocks and inline # thus, to avoid runs - use guard_block (add a leading newline to avoid getting include in block that goes before) # todo/fix: remove wrap_markup; replace w/ guard_text # why: text might be css, js, not just html ### !!!!!!!!!!!! ## todo: add print depreciation warning wrap_markup( text ) end
render( content, ctx )
click to toggle source
# File lib/slideshow/commands/gen.rb, line 29 def render( content, ctx ) #################### ## todo/fix: move ctx to Gen.initialize - why? why not? @name = ctx[:name] @outdir = ctx[:outdir] @srcdir = ctx[:srcdir] @usrdir = ctx[:usrdir] # run text filters config.text_filters.each do |filter| mn = filter.tr( '-', '_' ).to_sym # construct method name (mn) puts " run filter #{mn}..." content = send( mn, content ) # call filter e.g. include_helper_hack( content ) end if config.takahashi? content = takahashi_slide_breaks( content ) end # convert light-weight markup to hypertext content = markdown_to_html( content ) content end
wrap_markup( text )
click to toggle source
# File lib/slideshow/commands/gen.rb, line 85 def wrap_markup( text ) # saveguard with wrapper etc./no further processing needed - check how to do in markdown text end