Class: Slideshow::Gen
- Inherits:
-
Object
- Object
- Slideshow::Gen
- Includes:
- LogUtils::Logging, BackgroundHelper, DebugFilter, DirectiveHelper, HeadersFilter, MarkdownEngines, SlideFilter, SourceHelper, StepHelper, Syntax::CodeRayHelper, Syntax::ShHelper, Syntax::UvHelper, TextFilter
- Defined in:
- lib/slideshow/markdown.rb,
lib/slideshow/commands/gen.rb,
lib/slideshow/filters/text_filter.rb,
lib/slideshow/helpers/step_helper.rb,
lib/slideshow/filters/debug_filter.rb,
lib/slideshow/filters/slide_filter.rb,
lib/slideshow/helpers/source_helper.rb,
lib/slideshow/filters/headers_filter.rb,
lib/slideshow/helpers/directive_helper.rb,
lib/slideshow/helpers/syntax/sh_helper.rb,
lib/slideshow/helpers/syntax/uv_helper.rb,
lib/slideshow/helpers/background_helper.rb,
lib/slideshow/helpers/syntax/coderay_helper.rb more...
Overview
module Slideshow
Constant Summary
Constants included from Syntax::CodeRayHelper
Syntax::CodeRayHelper::CR_LANG, Syntax::CodeRayHelper::CR_LINE_NUMBERS
Constants included from Syntax::UvHelper
Syntax::UvHelper::UV_LANG, Syntax::UvHelper::UV_LINE_NUMBERS, Syntax::UvHelper::UV_THEME
Constants included from Syntax::ShHelper
Syntax::ShHelper::SH_LANG, Syntax::ShHelper::SH_LINE_NUMBERS
Constants included from TextFilter
TextFilter::DIRECTIVES_EXPRS, TextFilter::DIRECTIVES_RENAMES, TextFilter::DIRECTIVES_UNPARSED
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#outdir ⇒ Object
readonly
NB: “initalized” in create_slideshow.
-
#session ⇒ Object
readonly
give helpers/plugins a session-like hash.
-
#srcdir ⇒ Object
readonly
NB: “initalized” in create_slideshow.
-
#usrdir ⇒ Object
readonly
todo/check: usrdir needed for something (e.g. why keep it?) - remove? why? why not??.
Instance Method Summary collapse
-
#guard_block(text) ⇒ Object
use/rename to guard_text_block - why? why not?.
-
#guard_inline(text) ⇒ Object
use/rename to guard_text_inline - why? why not?.
-
#guard_text(text) ⇒ Object
some markdown guard helpers (e.g. guard text/mark text for do NOT convert).
-
#initialize(config, headers, session = {}, content_for = {}) ⇒ Gen
constructor
A new instance of Gen.
- #render(content, ctx) ⇒ Object
- #wrap_markup(text) ⇒ Object
Methods included from Syntax::CodeRayHelper
Methods included from BackgroundHelper
#background, #color, #gradient, #gradient_from_headers
Methods included from Syntax::UvHelper
Methods included from Syntax::ShHelper
Methods included from DirectiveHelper
Methods included from HeadersFilter
Methods included from SourceHelper
Methods included from SlideFilter
Methods included from DebugFilter
#dump_content_to_file_debug_html, #dump_content_to_file_debug_text, #dump_content_to_file_debug_text_erb
Methods included from StepHelper
Methods included from TextFilter
#directives_bang_style_to_percent_style, #directives_percent_style, #erb_rename_helper_hack
Methods included from MarkdownEngines
Constructor Details
permalink #initialize(config, headers, session = {}, content_for = {}) ⇒ Gen
Returns a new instance of Gen.
13 14 15 16 17 18 19 |
# 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 |
Instance Attribute Details
permalink #config ⇒ Object (readonly)
Returns the value of attribute config.
21 22 23 |
# File 'lib/slideshow/commands/gen.rb', line 21 def config @config end |
permalink #headers ⇒ Object (readonly)
Returns the value of attribute headers.
21 22 23 |
# File 'lib/slideshow/commands/gen.rb', line 21 def headers @headers end |
permalink #outdir ⇒ Object (readonly)
NB: “initalized” in create_slideshow
26 27 28 |
# File 'lib/slideshow/commands/gen.rb', line 26 def outdir @outdir end |
permalink #session ⇒ Object (readonly)
give helpers/plugins a session-like hash
22 23 24 |
# File 'lib/slideshow/commands/gen.rb', line 22 def session @session end |
permalink #srcdir ⇒ Object (readonly)
NB: “initalized” in create_slideshow
26 27 28 |
# File 'lib/slideshow/commands/gen.rb', line 26 def srcdir @srcdir end |
permalink #usrdir ⇒ Object (readonly)
todo/check: usrdir needed for something (e.g. why keep it?) - remove? why? why not??
25 26 27 |
# File 'lib/slideshow/commands/gen.rb', line 25 def usrdir @usrdir end |
Instance Method Details
permalink #guard_block(text) ⇒ Object
use/rename to guard_text_block - why? why not?
76 77 78 79 |
# 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 |
permalink #guard_inline(text) ⇒ Object
use/rename to guard_text_inline - why? why not?
81 82 83 |
# 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 |
permalink #guard_text(text) ⇒ Object
some markdown guard helpers
(e.g. guard text/mark text for do NOT convert)
63 64 65 66 67 68 69 70 71 72 73 74 |
# 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 |
permalink #render(content, ctx) ⇒ Object
[View source]
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# 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 = ( content ) end # convert light-weight markup to hypertext content = markdown_to_html( content ) content end |
permalink #wrap_markup(text) ⇒ Object
[View source]
85 86 87 88 |
# 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 |