Module: MaRuKu::In::Markdown

### Home Classes Methods

### In Files

- lib/maruku.rb
- lib/maruku/input/extensions.rb
- lib/maruku/input/parse_block.rb

### Namespace

- MODULE MaRuKu::In::Markdown::BlockLevelParser
- MODULE MaRuKu::In::Markdown::SpanLevelParser
- CLASS MaRuKu::In::Markdown::SpanExtension

### Methods

- ::register_block_extension
- ::register_span_extension
- #any_matching_block_extension?
- #check_block_extensions
- #check_span_extensions

### Class/Module Index

Quicksearch

- MaRuKu
- MaRuKu::AttributeList
- MaRuKu::Errors
- MaRuKu::Exception
- MaRuKu::HTMLElement
- MaRuKu::HTMLFragment
- MaRuKu::Helpers
- MaRuKu::In
- MaRuKu::In::Markdown
- MaRuKu::In::Markdown::BlockLevelParser
- MaRuKu::In::Markdown::BlockLevelParser::BlockContext
- MaRuKu::In::Markdown::BlockLevelParser::LineSource
- MaRuKu::In::Markdown::SpanExtension
- MaRuKu::In::Markdown::SpanLevelParser
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceDebug
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceManual
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceStrscan
- MaRuKu::In::Markdown::SpanLevelParser::HTMLHelper
- MaRuKu::In::Markdown::SpanLevelParser::SpanContext
- MaRuKu::MDDocument
- MaRuKu::MDElement
- MaRuKu::MDHTMLElement
- MaRuKu::MDLine
- MaRuKu::NokogiriHTMLFragment
- MaRuKu::Out
- MaRuKu::Out::EntityTable
- MaRuKu::Out::HTML
- MaRuKu::Out::HTML::HTMLElement
- MaRuKu::Out::Latex
- MaRuKu::Out::Latex::MDDocumentExtensions
- MaRuKu::Out::Markdown
- MaRuKu::REXMLHTMLFragment
- MaRuKu::Section
- MaRuKu::Strings
- Maruku
- Maruku::In
- Maruku::In::Markdown
- Maruku::In::Markdown::FencedCode
- Object
- String
- Textile2Signature

No matching classes.

# MaRuKu::In::Markdown

### Constants

BlockExtensions

  Hash Regexp -> Block

SpanExtensions

  Hash String -> Extension

SpanExtensionsTrigger

  Hash Fixnum -> name

### Public Class Methods

register_block_extension(args) click to toggle source

    # File lib/maruku/input/extensions.rb, line 41
    def self.register_block_extension(args)
      regexp = args[:regexp]
      BlockExtensions[regexp] = (args[:handler] || raise("No blocks passed"))
    end

register_span_extension(args) click to toggle source

    # File lib/maruku/input/extensions.rb, line 31
    def self.register_span_extension(args)
      e = SpanExtension.new
      e.chars = [*args[:chars]]
      e.regexp = args[:regexp]
      e.block = args[:handler] || raise("No blocks passed")
      e.chars.each do |c|
        (SpanExtensionsTrigger[c] ||= []).push e
      end
    end

### Public Instance Methods

any_matching_block_extension?(line) click to toggle source

    # File lib/maruku/input/extensions.rb, line 60
    def any_matching_block_extension?(line)
      BlockExtensions.each_key do |reg|
        m = reg.match(line)
        return m if m
      end
      false
    end

check_block_extensions(src, con, line) click to toggle source

    # File lib/maruku/input/extensions.rb, line 49
    def check_block_extensions(src, con, line)
      BlockExtensions.each do |reg, block|
        if reg.match(line)
          block = BlockExtensions[reg]
          accepted =  block.call(doc, src, con)
          return true if accepted
        end
      end
      false # not special
    end

check_span_extensions(src, con) click to toggle source

    # File lib/maruku/input/extensions.rb, line 18
    def check_span_extensions(src, con)
      c = src.cur_char
      if extensions = SpanExtensionsTrigger[c]
        extensions.each do |e|
          if e.regexp && src.next_matches(e.regexp)
            return true if e.block.call(doc, src, con)
          end
        end
      end

      false # not special
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.