reveal-ck 3.3.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +3 -1
 - data/lib/reveal-ck/builders/create_slides_html.rb +1 -1
 - data/lib/reveal-ck/commands/start_web_server.rb +1 -0
 - data/lib/reveal-ck/config.rb +1 -1
 - data/lib/reveal-ck/markdown.rb +6 -2
 - data/lib/reveal-ck/markdown/post_processor.rb +7 -0
 - data/lib/reveal-ck/markdown/pre_processor.rb +5 -97
 - data/lib/reveal-ck/markdown/pre_processor_for_dividers.rb +58 -0
 - data/lib/reveal-ck/markdown/pre_processor_for_emoji.rb +32 -0
 - data/lib/reveal-ck/markdown/pre_processor_transforms.rb +110 -0
 - data/lib/reveal-ck/markdown/slide_markdown_template.rb +22 -10
 - data/lib/reveal-ck/version.rb +1 -1
 - data/spec/lib/reveal-ck/commands/serve_spec.rb +0 -36
 - data/spec/lib/reveal-ck/markdown/post_processor_spec.rb +28 -0
 - data/spec/lib/reveal-ck/markdown/pre_processor_spec.rb +54 -0
 - data/spec/lib/reveal-ck/markdown/slide_markdown_template_spec.rb +3 -23
 - metadata +31 -17
 - data/lib/reveal-ck/markdown/slide_markdown.rb +0 -28
 - data/spec/lib/reveal-ck/markdown/slide_markdown_spec.rb +0 -8
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5abc61d7b21417c0840e9f633b5d4331f112667f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9091ea11615acc60b96eb4ca7dde87186056b7de
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8be33144aab193ddd52aacf0db6f923b318e0f21b1f9f9cf348bbaf86ac26bc4a1224811f3daa9715ab69d982dc57da2c34f6a7cc2ed6c40fdc5e6a5022352ca
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0056e09318624ac5c94efd88d1cf9decf9a6d1df063c0956b2aca1c72e4e51dd76014bff3af526e732148bf2a6a45335c24f29f21360f1d1d87ad63413709986
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -66,4 +66,6 @@ like to [ask a question or log a bug please do so][new-issue]! 
     | 
|
| 
       66 
66 
     | 
    
         
             
            [](https://codeclimate.com/github/jedcn/reveal-ck)
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
68 
     | 
    
         
             
            If you're a ruby developer and you want to get going with local
         
     | 
| 
       69 
     | 
    
         
            -
            development, please see [CONTRIBUTING.md] 
     | 
| 
      
 69 
     | 
    
         
            +
            development, please see [.github/CONTRIBUTING.md][CONTRIBUTING.md].
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            [CONTRIBUTING.md]: .github/CONTRIBUTING.md
         
     | 
    
        data/lib/reveal-ck/config.rb
    CHANGED
    
    
    
        data/lib/reveal-ck/markdown.rb
    CHANGED
    
    | 
         @@ -1,15 +1,19 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module RevealCK
         
     | 
| 
       2 
     | 
    
         
            -
              # This module defines how reveal-ck works with  
     | 
| 
      
 2 
     | 
    
         
            +
              # This module defines how reveal-ck works with kramdown to produce
         
     | 
| 
       3 
3 
     | 
    
         
             
              # slides from markdown.
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Markdown
         
     | 
| 
       5 
5 
     | 
    
         
             
                REVEALCK_SYMBOL_FOR_DIVIDER          = '<div>DIVIDER</div>'.freeze
         
     | 
| 
      
 6 
     | 
    
         
            +
                REVEALCK_SYMBOL_FOR_NOTES_OPEN       = '<div>NOTES_OPEN</div>'.freeze
         
     | 
| 
      
 7 
     | 
    
         
            +
                REVEALCK_SYMBOL_FOR_NOTES_CLOSE      = '<div>NOTES_CLOSE</div>'.freeze
         
     | 
| 
       6 
8 
     | 
    
         
             
                REVEALCK_SYMBOL_FOR_VERTICAL_START   = '<div>VERTICAL_START</div>'.freeze
         
     | 
| 
       7 
9 
     | 
    
         
             
                REVEALCK_SYMBOL_FOR_VERTICAL_END     = '<div>VERTICAL_END</div>'.freeze
         
     | 
| 
       8 
10 
     | 
    
         
             
                REVEALCK_SYMBOL_FOR_EMOJI_UNDERSCORE = 'EU'.freeze
         
     | 
| 
       9 
11 
     | 
    
         
             
              end
         
     | 
| 
       10 
12 
     | 
    
         
             
            end
         
     | 
| 
       11 
13 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            require_relative 'markdown/ 
     | 
| 
      
 14 
     | 
    
         
            +
            require_relative 'markdown/pre_processor_for_emoji'
         
     | 
| 
      
 15 
     | 
    
         
            +
            require_relative 'markdown/pre_processor_for_dividers'
         
     | 
| 
      
 16 
     | 
    
         
            +
            require_relative 'markdown/pre_processor_transforms'
         
     | 
| 
       13 
17 
     | 
    
         
             
            require_relative 'markdown/pre_processor'
         
     | 
| 
       14 
18 
     | 
    
         
             
            require_relative 'markdown/post_processor'
         
     | 
| 
       15 
19 
     | 
    
         
             
            require_relative 'markdown/slide_markdown_template'
         
     | 
| 
         @@ -15,6 +15,7 @@ module RevealCK 
     | 
|
| 
       15 
15 
     | 
    
         
             
                    handle_start
         
     | 
| 
       16 
16 
     | 
    
         
             
                    handle_end
         
     | 
| 
       17 
17 
     | 
    
         
             
                    transform_symbols_to_sections
         
     | 
| 
      
 18 
     | 
    
         
            +
                    transform_notes_symbols_to_asides
         
     | 
| 
       18 
19 
     | 
    
         
             
                  end
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
       20 
21 
     | 
    
         
             
                  private
         
     | 
| 
         @@ -59,6 +60,12 @@ module RevealCK 
     | 
|
| 
       59 
60 
     | 
    
         
             
                    replace(vertical_end_symbol, vertical_end)
         
     | 
| 
       60 
61 
     | 
    
         
             
                  end
         
     | 
| 
       61 
62 
     | 
    
         | 
| 
      
 63 
     | 
    
         
            +
                  def transform_notes_symbols_to_asides
         
     | 
| 
      
 64 
     | 
    
         
            +
                    replace(RevealCK::Markdown::REVEALCK_SYMBOL_FOR_NOTES_OPEN,
         
     | 
| 
      
 65 
     | 
    
         
            +
                            '<aside class="notes">')
         
     | 
| 
      
 66 
     | 
    
         
            +
                    replace(RevealCK::Markdown::REVEALCK_SYMBOL_FOR_NOTES_CLOSE, '</aside>')
         
     | 
| 
      
 67 
     | 
    
         
            +
                  end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
       62 
69 
     | 
    
         
             
                  def replace(old, new)
         
     | 
| 
       63 
70 
     | 
    
         
             
                    @doc = doc.gsub(old, new)
         
     | 
| 
       64 
71 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -11,108 +11,16 @@ module RevealCK 
     | 
|
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                  def process
         
     | 
| 
       13 
13 
     | 
    
         
             
                    strip_whitespace
         
     | 
| 
       14 
     | 
    
         
            -
                     
     | 
| 
       15 
     | 
    
         
            -
                     
     | 
| 
       16 
     | 
    
         
            -
                     
     | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
       18 
     | 
    
         
            -
                    transform_slide_dividers_to_divider_symbols
         
     | 
| 
       19 
     | 
    
         
            -
                    transform_slide_verticals_to_vertical_symbols
         
     | 
| 
       20 
     | 
    
         
            -
                    @doc.lstrip
         
     | 
| 
      
 14 
     | 
    
         
            +
                    PreProcessorForEmoji.new(doc).process
         
     | 
| 
      
 15 
     | 
    
         
            +
                    PreProcessorForDividers.new(doc).process
         
     | 
| 
      
 16 
     | 
    
         
            +
                    PreProcessorTransforms.new(doc).process
         
     | 
| 
      
 17 
     | 
    
         
            +
                    doc.lstrip
         
     | 
| 
       21 
18 
     | 
    
         
             
                  end
         
     | 
| 
       22 
19 
     | 
    
         | 
| 
       23 
20 
     | 
    
         
             
                  private
         
     | 
| 
       24 
21 
     | 
    
         | 
| 
       25 
22 
     | 
    
         
             
                  def strip_whitespace
         
     | 
| 
       26 
     | 
    
         
            -
                     
     | 
| 
       27 
     | 
    
         
            -
                  end
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                  def protect_emojis
         
     | 
| 
       30 
     | 
    
         
            -
                    @doc = doc.gsub(emoji_regex) do |emoji|
         
     | 
| 
       31 
     | 
    
         
            -
                      emoji.gsub(/_/, emoji_underscore_symbol)
         
     | 
| 
       32 
     | 
    
         
            -
                    end
         
     | 
| 
       33 
     | 
    
         
            -
                  end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                  def add_first_slide_divider_if_needed
         
     | 
| 
       36 
     | 
    
         
            -
                    return if doc.start_with?(slide_divider)
         
     | 
| 
       37 
     | 
    
         
            -
                    return if doc.start_with?(slide_vertical)
         
     | 
| 
       38 
     | 
    
         
            -
                    prepend(slide_divider)
         
     | 
| 
       39 
     | 
    
         
            -
                  end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                  def add_last_slide_divider_if_needed
         
     | 
| 
       42 
     | 
    
         
            -
                    return if doc.end_with?(slide_divider)
         
     | 
| 
       43 
     | 
    
         
            -
                    return if doc.end_with?(slide_vertical)
         
     | 
| 
       44 
     | 
    
         
            -
                    append(slide_divider)
         
     | 
| 
       45 
     | 
    
         
            -
                  end
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                  def transform_slide_dividers_to_divider_symbols
         
     | 
| 
       48 
     | 
    
         
            -
                    @doc =
         
     | 
| 
       49 
     | 
    
         
            -
                      doc.gsub(slide_divider_regex,
         
     | 
| 
       50 
     | 
    
         
            -
                               newline_wrapped(divider_symbol))
         
     | 
| 
       51 
     | 
    
         
            -
                  end
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                  def transform_slide_verticals_to_vertical_symbols
         
     | 
| 
       54 
     | 
    
         
            -
                    count = 0
         
     | 
| 
       55 
     | 
    
         
            -
                    @doc = doc.gsub(slide_vertical_regex) do
         
     | 
| 
       56 
     | 
    
         
            -
                      count += 1
         
     | 
| 
       57 
     | 
    
         
            -
                      if count.odd?
         
     | 
| 
       58 
     | 
    
         
            -
                        newline_wrapped(vertical_start_symbol)
         
     | 
| 
       59 
     | 
    
         
            -
                      else
         
     | 
| 
       60 
     | 
    
         
            -
                        newline_wrapped(vertical_end_symbol)
         
     | 
| 
       61 
     | 
    
         
            -
                      end
         
     | 
| 
       62 
     | 
    
         
            -
                    end
         
     | 
| 
       63 
     | 
    
         
            -
                  end
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                  def add_last_slide_vertical_if_needed
         
     | 
| 
       66 
     | 
    
         
            -
                    return unless doc.scan(slide_vertical_regex).size.odd?
         
     | 
| 
       67 
     | 
    
         
            -
                    append(slide_vertical)
         
     | 
| 
       68 
     | 
    
         
            -
                  end
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                  def emoji_regex
         
     | 
| 
       71 
     | 
    
         
            -
                    /:[a-z\d_\-\+]*:/
         
     | 
| 
       72 
     | 
    
         
            -
                  end
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                  def slide_divider
         
     | 
| 
       75 
     | 
    
         
            -
                    '---'
         
     | 
| 
       76 
     | 
    
         
            -
                  end
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
                  def slide_divider_regex
         
     | 
| 
       79 
     | 
    
         
            -
                    /^---$/
         
     | 
| 
       80 
     | 
    
         
            -
                  end
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                  def slide_vertical
         
     | 
| 
       83 
     | 
    
         
            -
                    '***'
         
     | 
| 
       84 
     | 
    
         
            -
                  end
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
                  def slide_vertical_regex
         
     | 
| 
       87 
     | 
    
         
            -
                    /^\*\*\*$/
         
     | 
| 
       88 
     | 
    
         
            -
                  end
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
                  def prepend(s)
         
     | 
| 
       91 
     | 
    
         
            -
                    @doc = "#{s}\n#{doc}"
         
     | 
| 
       92 
     | 
    
         
            -
                  end
         
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
                  def append(s)
         
     | 
| 
       95 
     | 
    
         
            -
                    @doc = "#{doc}\n#{s}"
         
     | 
| 
       96 
     | 
    
         
            -
                  end
         
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
                  def newline_wrapped(s)
         
     | 
| 
       99 
     | 
    
         
            -
                    "\n#{s}\n"
         
     | 
| 
       100 
     | 
    
         
            -
                  end
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
                  def emoji_underscore_symbol
         
     | 
| 
       103 
     | 
    
         
            -
                    RevealCK::Markdown::REVEALCK_SYMBOL_FOR_EMOJI_UNDERSCORE
         
     | 
| 
       104 
     | 
    
         
            -
                  end
         
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
                  def divider_symbol
         
     | 
| 
       107 
     | 
    
         
            -
                    RevealCK::Markdown::REVEALCK_SYMBOL_FOR_DIVIDER
         
     | 
| 
       108 
     | 
    
         
            -
                  end
         
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
                  def vertical_start_symbol
         
     | 
| 
       111 
     | 
    
         
            -
                    RevealCK::Markdown::REVEALCK_SYMBOL_FOR_VERTICAL_START
         
     | 
| 
       112 
     | 
    
         
            -
                  end
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
                  def vertical_end_symbol
         
     | 
| 
       115 
     | 
    
         
            -
                    RevealCK::Markdown::REVEALCK_SYMBOL_FOR_VERTICAL_END
         
     | 
| 
      
 23 
     | 
    
         
            +
                    doc.strip!
         
     | 
| 
       116 
24 
     | 
    
         
             
                  end
         
     | 
| 
       117 
25 
     | 
    
         
             
                end
         
     | 
| 
       118 
26 
     | 
    
         
             
              end
         
     | 
| 
         @@ -0,0 +1,58 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module RevealCK
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Markdown
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This class embodies the preprocessing that starts with a
         
     | 
| 
      
 4 
     | 
    
         
            +
                # traditional Markdown document and turns it into something that
         
     | 
| 
      
 5 
     | 
    
         
            +
                # can later "become" reveal.js slides.
         
     | 
| 
      
 6 
     | 
    
         
            +
                class PreProcessorForDividers
         
     | 
| 
      
 7 
     | 
    
         
            +
                  attr_reader :doc
         
     | 
| 
      
 8 
     | 
    
         
            +
                  def initialize(doc)
         
     | 
| 
      
 9 
     | 
    
         
            +
                    @doc = doc
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  def process
         
     | 
| 
      
 13 
     | 
    
         
            +
                    add_first_slide_divider_if_needed
         
     | 
| 
      
 14 
     | 
    
         
            +
                    add_last_slide_vertical_if_needed
         
     | 
| 
      
 15 
     | 
    
         
            +
                    add_last_slide_divider_if_needed
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  private
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  def add_first_slide_divider_if_needed
         
     | 
| 
      
 21 
     | 
    
         
            +
                    return if doc.start_with?(slide_divider)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    return if doc.start_with?(slide_vertical)
         
     | 
| 
      
 23 
     | 
    
         
            +
                    prepend(slide_divider)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  def add_last_slide_divider_if_needed
         
     | 
| 
      
 27 
     | 
    
         
            +
                    return if doc.end_with?(slide_divider)
         
     | 
| 
      
 28 
     | 
    
         
            +
                    return if doc.end_with?(slide_vertical)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    append(slide_divider)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  def add_last_slide_vertical_if_needed
         
     | 
| 
      
 33 
     | 
    
         
            +
                    return unless doc.scan(slide_vertical_regex).size.odd?
         
     | 
| 
      
 34 
     | 
    
         
            +
                    append(slide_vertical)
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  def slide_divider
         
     | 
| 
      
 38 
     | 
    
         
            +
                    '---'
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                  def slide_vertical
         
     | 
| 
      
 42 
     | 
    
         
            +
                    '***'
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  def slide_vertical_regex
         
     | 
| 
      
 46 
     | 
    
         
            +
                    /^\*\*\*$/
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  def prepend(s)
         
     | 
| 
      
 50 
     | 
    
         
            +
                    doc.insert(0, "#{s}\n")
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                  def append(s)
         
     | 
| 
      
 54 
     | 
    
         
            +
                    doc.insert(doc.size, "\n#{s}")
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
      
 58 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module RevealCK
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Markdown
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This class knows how to modify emoji so that underscores within
         
     | 
| 
      
 4 
     | 
    
         
            +
                # emoji are not considered as indicators of markdown emphasis.
         
     | 
| 
      
 5 
     | 
    
         
            +
                class PreProcessorForEmoji
         
     | 
| 
      
 6 
     | 
    
         
            +
                  attr_reader :doc
         
     | 
| 
      
 7 
     | 
    
         
            +
                  def initialize(doc)
         
     | 
| 
      
 8 
     | 
    
         
            +
                    @doc = doc
         
     | 
| 
      
 9 
     | 
    
         
            +
                  end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  def process
         
     | 
| 
      
 12 
     | 
    
         
            +
                    protect_emojis
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  private
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  def protect_emojis
         
     | 
| 
      
 18 
     | 
    
         
            +
                    doc.gsub!(emoji_regex) do |emoji|
         
     | 
| 
      
 19 
     | 
    
         
            +
                      emoji.gsub(/_/, emoji_underscore_symbol)
         
     | 
| 
      
 20 
     | 
    
         
            +
                    end
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  def emoji_regex
         
     | 
| 
      
 24 
     | 
    
         
            +
                    /:[a-z\d_\-\+]*:/
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  def emoji_underscore_symbol
         
     | 
| 
      
 28 
     | 
    
         
            +
                    RevealCK::Markdown::REVEALCK_SYMBOL_FOR_EMOJI_UNDERSCORE
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,110 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module RevealCK
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Markdown
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This class gives special meaning to legitimate markdown within
         
     | 
| 
      
 4 
     | 
    
         
            +
                # slides. This "slides markdown" is transformed into symbols that
         
     | 
| 
      
 5 
     | 
    
         
            +
                # are not markdown. Later on these will be transformed into HTML
         
     | 
| 
      
 6 
     | 
    
         
            +
                # meanings.
         
     | 
| 
      
 7 
     | 
    
         
            +
                #
         
     | 
| 
      
 8 
     | 
    
         
            +
                # For example,
         
     | 
| 
      
 9 
     | 
    
         
            +
                #
         
     | 
| 
      
 10 
     | 
    
         
            +
                # * --- becomes <div>DIVIDER</div>
         
     | 
| 
      
 11 
     | 
    
         
            +
                # * ```notes becomes <div>NOTES_OPEN</div>
         
     | 
| 
      
 12 
     | 
    
         
            +
                #
         
     | 
| 
      
 13 
     | 
    
         
            +
                class PreProcessorTransforms
         
     | 
| 
      
 14 
     | 
    
         
            +
                  attr_reader :doc
         
     | 
| 
      
 15 
     | 
    
         
            +
                  def initialize(doc)
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @doc = doc
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  def process
         
     | 
| 
      
 20 
     | 
    
         
            +
                    transform_slide_notes_to_notes_symbols
         
     | 
| 
      
 21 
     | 
    
         
            +
                    transform_slide_dividers_to_divider_symbols
         
     | 
| 
      
 22 
     | 
    
         
            +
                    transform_slide_verticals_to_vertical_symbols
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  private
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  def transform_slide_notes_to_notes_symbols
         
     | 
| 
      
 28 
     | 
    
         
            +
                    match = find_next_notes_match(0)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    while match
         
     | 
| 
      
 30 
     | 
    
         
            +
                      match_start = match.offset(0)[0]
         
     | 
| 
      
 31 
     | 
    
         
            +
                      match_end = match.offset(0)[1]
         
     | 
| 
      
 32 
     | 
    
         
            +
                      replace_notes_open_with_symbol(match_start, match_end - match_start)
         
     | 
| 
      
 33 
     | 
    
         
            +
                      close_start = find_next_notes_close(match_start)
         
     | 
| 
      
 34 
     | 
    
         
            +
                      replace_notes_close_with_symbol(close_start) if close_start
         
     | 
| 
      
 35 
     | 
    
         
            +
                      match = find_next_notes_match(match_start)
         
     | 
| 
      
 36 
     | 
    
         
            +
                    end
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  def find_next_notes_match(current)
         
     | 
| 
      
 40 
     | 
    
         
            +
                    doc.match(slide_notes_regex, current)
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                  def find_next_notes_close(current)
         
     | 
| 
      
 44 
     | 
    
         
            +
                    doc.index('```', current)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  def replace_notes_open_with_symbol(start, length)
         
     | 
| 
      
 48 
     | 
    
         
            +
                    doc.slice!(start, length)
         
     | 
| 
      
 49 
     | 
    
         
            +
                    doc.insert(start, notes_open_symbol)
         
     | 
| 
      
 50 
     | 
    
         
            +
                  end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                  def replace_notes_close_with_symbol(start)
         
     | 
| 
      
 53 
     | 
    
         
            +
                    doc.slice!(start, 3)
         
     | 
| 
      
 54 
     | 
    
         
            +
                    doc.insert(start, notes_close_symbol)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  def transform_slide_dividers_to_divider_symbols
         
     | 
| 
      
 58 
     | 
    
         
            +
                    doc.gsub!(slide_divider_regex, divider_symbol)
         
     | 
| 
      
 59 
     | 
    
         
            +
                  end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                  def transform_slide_verticals_to_vertical_symbols
         
     | 
| 
      
 62 
     | 
    
         
            +
                    count = 0
         
     | 
| 
      
 63 
     | 
    
         
            +
                    doc.gsub!(slide_vertical_regex) do
         
     | 
| 
      
 64 
     | 
    
         
            +
                      count += 1
         
     | 
| 
      
 65 
     | 
    
         
            +
                      if count.odd?
         
     | 
| 
      
 66 
     | 
    
         
            +
                        vertical_start_symbol
         
     | 
| 
      
 67 
     | 
    
         
            +
                      else
         
     | 
| 
      
 68 
     | 
    
         
            +
                        vertical_end_symbol
         
     | 
| 
      
 69 
     | 
    
         
            +
                      end
         
     | 
| 
      
 70 
     | 
    
         
            +
                    end
         
     | 
| 
      
 71 
     | 
    
         
            +
                  end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                  def slide_notes_regex
         
     | 
| 
      
 74 
     | 
    
         
            +
                    /^```notes?$/
         
     | 
| 
      
 75 
     | 
    
         
            +
                  end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                  def slide_divider_regex
         
     | 
| 
      
 78 
     | 
    
         
            +
                    /^---$/
         
     | 
| 
      
 79 
     | 
    
         
            +
                  end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                  def slide_vertical_regex
         
     | 
| 
      
 82 
     | 
    
         
            +
                    /^\*\*\*$/
         
     | 
| 
      
 83 
     | 
    
         
            +
                  end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                  def newline_wrapped(s)
         
     | 
| 
      
 86 
     | 
    
         
            +
                    "\n#{s}\n"
         
     | 
| 
      
 87 
     | 
    
         
            +
                  end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                  def notes_open_symbol
         
     | 
| 
      
 90 
     | 
    
         
            +
                    newline_wrapped(RevealCK::Markdown::REVEALCK_SYMBOL_FOR_NOTES_OPEN)
         
     | 
| 
      
 91 
     | 
    
         
            +
                  end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                  def notes_close_symbol
         
     | 
| 
      
 94 
     | 
    
         
            +
                    newline_wrapped(RevealCK::Markdown::REVEALCK_SYMBOL_FOR_NOTES_CLOSE)
         
     | 
| 
      
 95 
     | 
    
         
            +
                  end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                  def divider_symbol
         
     | 
| 
      
 98 
     | 
    
         
            +
                    newline_wrapped(RevealCK::Markdown::REVEALCK_SYMBOL_FOR_DIVIDER)
         
     | 
| 
      
 99 
     | 
    
         
            +
                  end
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                  def vertical_start_symbol
         
     | 
| 
      
 102 
     | 
    
         
            +
                    newline_wrapped(RevealCK::Markdown::REVEALCK_SYMBOL_FOR_VERTICAL_START)
         
     | 
| 
      
 103 
     | 
    
         
            +
                  end
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                  def vertical_end_symbol
         
     | 
| 
      
 106 
     | 
    
         
            +
                    newline_wrapped(RevealCK::Markdown::REVEALCK_SYMBOL_FOR_VERTICAL_END)
         
     | 
| 
      
 107 
     | 
    
         
            +
                  end
         
     | 
| 
      
 108 
     | 
    
         
            +
                end
         
     | 
| 
      
 109 
     | 
    
         
            +
              end
         
     | 
| 
      
 110 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,25 +1,37 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'tilt/template'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'kramdown'
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
4 
     | 
    
         
             
            module RevealCK
         
     | 
| 
       4 
5 
     | 
    
         
             
              module Markdown
         
     | 
| 
       5 
6 
     | 
    
         
             
                #
         
     | 
| 
       6 
     | 
    
         
            -
                # Public: This class allows  
     | 
| 
      
 7 
     | 
    
         
            +
                # Public: This class allows Kramdown to hook into Tilt 2.0. See
         
     | 
| 
       7 
8 
     | 
    
         
             
                # https://github.com/rtomayko/tilt.
         
     | 
| 
       8 
9 
     | 
    
         
             
                #
         
     | 
| 
       9 
10 
     | 
    
         
             
                class SlideMarkdownTemplate < ::Tilt::Template
         
     | 
| 
       10 
11 
     | 
    
         
             
                  # Must be implemented by all subclasses of Tilt::Template
         
     | 
| 
       11 
     | 
    
         
            -
                  def prepare
         
     | 
| 
      
 12 
     | 
    
         
            +
                  def prepare; end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def pre_process(input)
         
     | 
| 
      
 15 
     | 
    
         
            +
                    PreProcessor.new(input).process
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  def post_process(input)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    PostProcessor.new(input).process
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  def kramdown_options
         
     | 
| 
      
 23 
     | 
    
         
            +
                    {
         
     | 
| 
      
 24 
     | 
    
         
            +
                      auto_ids: false,
         
     | 
| 
      
 25 
     | 
    
         
            +
                      input: 'GFM',
         
     | 
| 
      
 26 
     | 
    
         
            +
                      syntax_highlighter: nil
         
     | 
| 
      
 27 
     | 
    
         
            +
                    }
         
     | 
| 
       12 
28 
     | 
    
         
             
                  end
         
     | 
| 
       13 
29 
     | 
    
         | 
| 
       14 
30 
     | 
    
         
             
                  def evaluate(*)
         
     | 
| 
       15 
     | 
    
         
            -
                     
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                       
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                      strikethrough: true,
         
     | 
| 
       20 
     | 
    
         
            -
                      highlight: true
         
     | 
| 
       21 
     | 
    
         
            -
                    )
         
     | 
| 
       22 
     | 
    
         
            -
                    @output = markdown.render(data)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    pre_process_result = pre_process(data)
         
     | 
| 
      
 32 
     | 
    
         
            +
                    kramdown_result =
         
     | 
| 
      
 33 
     | 
    
         
            +
                      Kramdown::Document.new(pre_process_result, kramdown_options).to_html
         
     | 
| 
      
 34 
     | 
    
         
            +
                    post_process(kramdown_result)
         
     | 
| 
       23 
35 
     | 
    
         
             
                  end
         
     | 
| 
       24 
36 
     | 
    
         
             
                end
         
     | 
| 
       25 
37 
     | 
    
         
             
              end
         
     | 
    
        data/lib/reveal-ck/version.rb
    CHANGED
    
    
| 
         @@ -84,42 +84,6 @@ module RevealCK 
     | 
|
| 
       84 
84 
     | 
    
         
             
                      expect_new_and_run(RevealCK::Commands::StartWebServer)
         
     | 
| 
       85 
85 
     | 
    
         
             
                      build_serve.run
         
     | 
| 
       86 
86 
     | 
    
         
             
                    end
         
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
                    it 'actually listens for file system changes' do
         
     | 
| 
       89 
     | 
    
         
            -
                      serve_ui = double
         
     | 
| 
       90 
     | 
    
         
            -
                      allow(ServeUI)
         
     | 
| 
       91 
     | 
    
         
            -
                        .to(receive(:new))
         
     | 
| 
       92 
     | 
    
         
            -
                        .and_return(serve_ui)
         
     | 
| 
       93 
     | 
    
         
            -
                      allow(serve_ui)
         
     | 
| 
       94 
     | 
    
         
            -
                        .to(receive(:message))
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
                      Dir.mktmpdir do |dir|
         
     | 
| 
       97 
     | 
    
         
            -
                        Dir.chdir(dir) do
         
     | 
| 
       98 
     | 
    
         
            -
                          print_banner = double
         
     | 
| 
       99 
     | 
    
         
            -
                          allow(PrintBanner)
         
     | 
| 
       100 
     | 
    
         
            -
                            .to(receive(:new))
         
     | 
| 
       101 
     | 
    
         
            -
                            .and_return(print_banner)
         
     | 
| 
       102 
     | 
    
         
            -
                          allow(print_banner)
         
     | 
| 
       103 
     | 
    
         
            -
                            .to(receive(:run))
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
                          # Don't stub out ListenToRebuildSlides
         
     | 
| 
       106 
     | 
    
         
            -
                          allow_new_and_run(RevealCK::Commands::ListenToReloadBrowser)
         
     | 
| 
       107 
     | 
    
         
            -
                          allow_new_and_run(RevealCK::Commands::StartWebServer)
         
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
                          serve = build_serve
         
     | 
| 
       110 
     | 
    
         
            -
                          serve.run
         
     | 
| 
       111 
     | 
    
         
            -
                          expect(serve)
         
     | 
| 
       112 
     | 
    
         
            -
                            .to(receive(:rebuild_slides))
         
     | 
| 
       113 
     | 
    
         
            -
                          File.open('slides.md', 'w') do |file|
         
     | 
| 
       114 
     | 
    
         
            -
                            file.puts('Slides')
         
     | 
| 
       115 
     | 
    
         
            -
                          end
         
     | 
| 
       116 
     | 
    
         
            -
                          # Creating the file will trigger the call back. But need
         
     | 
| 
       117 
     | 
    
         
            -
                          # to wait else the expecation of :rebuild_slides will
         
     | 
| 
       118 
     | 
    
         
            -
                          # fail-- it's not instantaneous
         
     | 
| 
       119 
     | 
    
         
            -
                          sleep 0.5
         
     | 
| 
       120 
     | 
    
         
            -
                        end
         
     | 
| 
       121 
     | 
    
         
            -
                      end
         
     | 
| 
       122 
     | 
    
         
            -
                    end
         
     | 
| 
       123 
87 
     | 
    
         
             
                  end
         
     | 
| 
       124 
88 
     | 
    
         
             
                end
         
     | 
| 
       125 
89 
     | 
    
         
             
              end
         
     | 
| 
         @@ -17,6 +17,34 @@ module RevealCK 
     | 
|
| 
       17 
17 
     | 
    
         
             
                    expect(output).to include ':non-potable_water:'
         
     | 
| 
       18 
18 
     | 
    
         
             
                  end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
      
 20 
     | 
    
         
            +
                  context 'handling notes' do
         
     | 
| 
      
 21 
     | 
    
         
            +
                    let :transformed_notes do
         
     | 
| 
      
 22 
     | 
    
         
            +
                      <<-eos
         
     | 
| 
      
 23 
     | 
    
         
            +
            <div>DIVIDER</div>
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            <div>NOTES_OPEN</div>
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            This is a note
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            <div>NOTES_CLOSE</div>
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            <div>DIVIDER</div>
         
     | 
| 
      
 34 
     | 
    
         
            +
            eos
         
     | 
| 
      
 35 
     | 
    
         
            +
                    end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                    it 'translates <div>NOTES_OPEN</div> into <aside class="notes">' do
         
     | 
| 
      
 38 
     | 
    
         
            +
                      output = PostProcessor.new(transformed_notes).process
         
     | 
| 
      
 39 
     | 
    
         
            +
                      expect(output).to include "\n<aside class=\"notes\">\n"
         
     | 
| 
      
 40 
     | 
    
         
            +
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                    it 'translates <div>NOTES_CLOSE</div> into </aside>' do
         
     | 
| 
      
 43 
     | 
    
         
            +
                      output = PostProcessor.new(transformed_notes).process
         
     | 
| 
      
 44 
     | 
    
         
            +
                      expect(output).to include "\n</aside>\n"
         
     | 
| 
      
 45 
     | 
    
         
            +
                    end
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
       20 
48 
     | 
    
         
             
                  context 'without vertical slides' do
         
     | 
| 
       21 
49 
     | 
    
         
             
                    let :three_slide_input do
         
     | 
| 
       22 
50 
     | 
    
         
             
                      <<-eos
         
     | 
| 
         @@ -3,6 +3,60 @@ require 'spec_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module RevealCK
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Markdown
         
     | 
| 
       5 
5 
     | 
    
         
             
                describe PreProcessor do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  describe 'handling ```notes' do
         
     | 
| 
      
 7 
     | 
    
         
            +
                    let :notes_input do
         
     | 
| 
      
 8 
     | 
    
         
            +
                      <<-eos
         
     | 
| 
      
 9 
     | 
    
         
            +
            ```notes
         
     | 
| 
      
 10 
     | 
    
         
            +
            This is a note
         
     | 
| 
      
 11 
     | 
    
         
            +
            ```
         
     | 
| 
      
 12 
     | 
    
         
            +
            eos
         
     | 
| 
      
 13 
     | 
    
         
            +
                    end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                    let :note_input do
         
     | 
| 
      
 16 
     | 
    
         
            +
                      <<-eos
         
     | 
| 
      
 17 
     | 
    
         
            +
            ```note
         
     | 
| 
      
 18 
     | 
    
         
            +
            This is a note
         
     | 
| 
      
 19 
     | 
    
         
            +
            ```
         
     | 
| 
      
 20 
     | 
    
         
            +
            eos
         
     | 
| 
      
 21 
     | 
    
         
            +
                    end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                    let :transformed_notes do
         
     | 
| 
      
 24 
     | 
    
         
            +
                      <<-eos
         
     | 
| 
      
 25 
     | 
    
         
            +
            <div>DIVIDER</div>
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            <div>NOTES_OPEN</div>
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            This is a note
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            <div>NOTES_CLOSE</div>
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            <div>DIVIDER</div>
         
     | 
| 
      
 36 
     | 
    
         
            +
            eos
         
     | 
| 
      
 37 
     | 
    
         
            +
                    end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                    it 'transforms ```notes into <div>NOTES_OPEN</div>' do
         
     | 
| 
      
 40 
     | 
    
         
            +
                      output = PreProcessor.new(notes_input).process
         
     | 
| 
      
 41 
     | 
    
         
            +
                      expect(output).to include '<div>NOTES_OPEN</div>'
         
     | 
| 
      
 42 
     | 
    
         
            +
                    end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                    it 'transforms ```note into <div>NOTES_OPEN</div>' do
         
     | 
| 
      
 45 
     | 
    
         
            +
                      output = PreProcessor.new(note_input).process
         
     | 
| 
      
 46 
     | 
    
         
            +
                      expect(output).to include '<div>NOTES_OPEN</div>'
         
     | 
| 
      
 47 
     | 
    
         
            +
                    end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                    it 'transforms the trailing ``` into <div>NOTES_CLOSE</div>' do
         
     | 
| 
      
 50 
     | 
    
         
            +
                      output = PreProcessor.new(note_input).process
         
     | 
| 
      
 51 
     | 
    
         
            +
                      expect(output).to include '<div>NOTES_CLOSE</div>'
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                    it 'transforms both open and close and adds some newlines' do
         
     | 
| 
      
 55 
     | 
    
         
            +
                      output = PreProcessor.new(notes_input).process
         
     | 
| 
      
 56 
     | 
    
         
            +
                      expect(output).to eq transformed_notes
         
     | 
| 
      
 57 
     | 
    
         
            +
                    end
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
       6 
60 
     | 
    
         
             
                  it 'protects _s within emoji by turning them into a temporary token' do
         
     | 
| 
       7 
61 
     | 
    
         
             
                    input = ':money_with_wings:'
         
     | 
| 
       8 
62 
     | 
    
         
             
                    output = PreProcessor.new(input).process
         
     | 
| 
         @@ -57,40 +57,20 @@ eos 
     | 
|
| 
       57 
57 
     | 
    
         
             
            eos
         
     | 
| 
       58 
58 
     | 
    
         
             
                    expect(output).to include '<pre><code>'
         
     | 
| 
       59 
59 
     | 
    
         
             
                    expect(output).to include '</code></pre>'
         
     | 
| 
       60 
     | 
    
         
            -
                    expect(output).to include '<p> 
     | 
| 
      
 60 
     | 
    
         
            +
                    expect(output).to include '<p>"&"</p>'
         
     | 
| 
       61 
61 
     | 
    
         
             
                  end
         
     | 
| 
       62 
62 
     | 
    
         | 
| 
       63 
     | 
    
         
            -
                  it 'wraps ```ruby code in a <pre> and <code class="ruby">' do
         
     | 
| 
      
 63 
     | 
    
         
            +
                  it 'wraps ```ruby code in a <pre> and <code class="language-ruby">' do
         
     | 
| 
       64 
64 
     | 
    
         
             
                    output = render_markdown <<-eos
         
     | 
| 
       65 
65 
     | 
    
         
             
            ```ruby
         
     | 
| 
       66 
66 
     | 
    
         
             
            def adder(a, b); a + b; end
         
     | 
| 
       67 
67 
     | 
    
         
             
            ```
         
     | 
| 
       68 
68 
     | 
    
         
             
            eos
         
     | 
| 
       69 
     | 
    
         
            -
                    expect(output).to include '<pre><code class="ruby">'
         
     | 
| 
      
 69 
     | 
    
         
            +
                    expect(output).to include '<pre><code class="language-ruby">'
         
     | 
| 
       70 
70 
     | 
    
         
             
                    expect(output).to include '</code></pre>'
         
     | 
| 
       71 
71 
     | 
    
         
             
                    expect(output).to include 'a + b'
         
     | 
| 
       72 
72 
     | 
    
         
             
                  end
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
                  it 'creates an <aside class="notes"> when it sees a ```notes' do
         
     | 
| 
       75 
     | 
    
         
            -
                    output = render_markdown <<-eos
         
     | 
| 
       76 
     | 
    
         
            -
            ```notes
         
     | 
| 
       77 
     | 
    
         
            -
            This is a note
         
     | 
| 
       78 
     | 
    
         
            -
            ```
         
     | 
| 
       79 
     | 
    
         
            -
            eos
         
     | 
| 
       80 
     | 
    
         
            -
                    expect(output).to include "<aside class='notes'"
         
     | 
| 
       81 
     | 
    
         
            -
                    expect(output).to include 'This is a note'
         
     | 
| 
       82 
     | 
    
         
            -
                  end
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
                  it 'creates an <aside class="notes"> when it sees a ```note' do
         
     | 
| 
       85 
     | 
    
         
            -
                    output = render_markdown <<-eos
         
     | 
| 
       86 
     | 
    
         
            -
            ```note
         
     | 
| 
       87 
     | 
    
         
            -
            This is a note
         
     | 
| 
       88 
     | 
    
         
            -
            ```
         
     | 
| 
       89 
     | 
    
         
            -
            eos
         
     | 
| 
       90 
     | 
    
         
            -
                    expect(output).to include "<aside class='notes'"
         
     | 
| 
       91 
     | 
    
         
            -
                    expect(output).to include 'This is a note'
         
     | 
| 
       92 
     | 
    
         
            -
                  end
         
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
74 
     | 
    
         
             
                  it 'works when there is no space surrounding the ---' do
         
     | 
| 
       95 
75 
     | 
    
         
             
                    output = render_markdown <<-eos
         
     | 
| 
       96 
76 
     | 
    
         
             
            # Your headline
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: reveal-ck
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Jed Northridge
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-12-11 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: docile
         
     | 
| 
         @@ -108,6 +108,20 @@ dependencies: 
     | 
|
| 
       108 
108 
     | 
    
         
             
                - - '='
         
     | 
| 
       109 
109 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       110 
110 
     | 
    
         
             
                    version: 2.1.0
         
     | 
| 
      
 111 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 112 
     | 
    
         
            +
              name: kramdown
         
     | 
| 
      
 113 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 114 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 115 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 116 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 117 
     | 
    
         
            +
                    version: 1.13.1
         
     | 
| 
      
 118 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 119 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 120 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 121 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 122 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 123 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 124 
     | 
    
         
            +
                    version: 1.13.1
         
     | 
| 
       111 
125 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       112 
126 
     | 
    
         
             
              name: listen
         
     | 
| 
       113 
127 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -165,61 +179,61 @@ dependencies: 
     | 
|
| 
       165 
179 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       166 
180 
     | 
    
         
             
                    version: 10.4.2
         
     | 
| 
       167 
181 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       168 
     | 
    
         
            -
              name:  
     | 
| 
      
 182 
     | 
    
         
            +
              name: rinku
         
     | 
| 
       169 
183 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       170 
184 
     | 
    
         
             
                requirements:
         
     | 
| 
       171 
185 
     | 
    
         
             
                - - '='
         
     | 
| 
       172 
186 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       173 
     | 
    
         
            -
                    version:  
     | 
| 
      
 187 
     | 
    
         
            +
                    version: 1.7.3
         
     | 
| 
       174 
188 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       175 
189 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       176 
190 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       177 
191 
     | 
    
         
             
                requirements:
         
     | 
| 
       178 
192 
     | 
    
         
             
                - - '='
         
     | 
| 
       179 
193 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       180 
     | 
    
         
            -
                    version:  
     | 
| 
      
 194 
     | 
    
         
            +
                    version: 1.7.3
         
     | 
| 
       181 
195 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       182 
     | 
    
         
            -
              name:  
     | 
| 
      
 196 
     | 
    
         
            +
              name: slim
         
     | 
| 
       183 
197 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       184 
198 
     | 
    
         
             
                requirements:
         
     | 
| 
       185 
199 
     | 
    
         
             
                - - '='
         
     | 
| 
       186 
200 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       187 
     | 
    
         
            -
                    version:  
     | 
| 
      
 201 
     | 
    
         
            +
                    version: 3.0.6
         
     | 
| 
       188 
202 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       189 
203 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       190 
204 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       191 
205 
     | 
    
         
             
                requirements:
         
     | 
| 
       192 
206 
     | 
    
         
             
                - - '='
         
     | 
| 
       193 
207 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       194 
     | 
    
         
            -
                    version:  
     | 
| 
      
 208 
     | 
    
         
            +
                    version: 3.0.6
         
     | 
| 
       195 
209 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       196 
     | 
    
         
            -
              name:  
     | 
| 
      
 210 
     | 
    
         
            +
              name: tilt
         
     | 
| 
       197 
211 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       198 
212 
     | 
    
         
             
                requirements:
         
     | 
| 
       199 
213 
     | 
    
         
             
                - - '='
         
     | 
| 
       200 
214 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       201 
     | 
    
         
            -
                    version:  
     | 
| 
      
 215 
     | 
    
         
            +
                    version: 2.0.1
         
     | 
| 
       202 
216 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       203 
217 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       204 
218 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       205 
219 
     | 
    
         
             
                requirements:
         
     | 
| 
       206 
220 
     | 
    
         
             
                - - '='
         
     | 
| 
       207 
221 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       208 
     | 
    
         
            -
                    version:  
     | 
| 
      
 222 
     | 
    
         
            +
                    version: 2.0.1
         
     | 
| 
       209 
223 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       210 
     | 
    
         
            -
              name:  
     | 
| 
      
 224 
     | 
    
         
            +
              name: thor
         
     | 
| 
       211 
225 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       212 
226 
     | 
    
         
             
                requirements:
         
     | 
| 
       213 
227 
     | 
    
         
             
                - - '='
         
     | 
| 
       214 
228 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       215 
     | 
    
         
            -
                    version:  
     | 
| 
      
 229 
     | 
    
         
            +
                    version: 0.19.1
         
     | 
| 
       216 
230 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       217 
231 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       218 
232 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       219 
233 
     | 
    
         
             
                requirements:
         
     | 
| 
       220 
234 
     | 
    
         
             
                - - '='
         
     | 
| 
       221 
235 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       222 
     | 
    
         
            -
                    version:  
     | 
| 
      
 236 
     | 
    
         
            +
                    version: 0.19.1
         
     | 
| 
       223 
237 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       224 
238 
     | 
    
         
             
              name: aruba
         
     | 
| 
       225 
239 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -489,7 +503,9 @@ files: 
     | 
|
| 
       489 
503 
     | 
    
         
             
            - lib/reveal-ck/markdown.rb
         
     | 
| 
       490 
504 
     | 
    
         
             
            - lib/reveal-ck/markdown/post_processor.rb
         
     | 
| 
       491 
505 
     | 
    
         
             
            - lib/reveal-ck/markdown/pre_processor.rb
         
     | 
| 
       492 
     | 
    
         
            -
            - lib/reveal-ck/markdown/ 
     | 
| 
      
 506 
     | 
    
         
            +
            - lib/reveal-ck/markdown/pre_processor_for_dividers.rb
         
     | 
| 
      
 507 
     | 
    
         
            +
            - lib/reveal-ck/markdown/pre_processor_for_emoji.rb
         
     | 
| 
      
 508 
     | 
    
         
            +
            - lib/reveal-ck/markdown/pre_processor_transforms.rb
         
     | 
| 
       493 
509 
     | 
    
         
             
            - lib/reveal-ck/markdown/slide_markdown_template.rb
         
     | 
| 
       494 
510 
     | 
    
         
             
            - lib/reveal-ck/misc.rb
         
     | 
| 
       495 
511 
     | 
    
         
             
            - lib/reveal-ck/misc/remove_extension.rb
         
     | 
| 
         @@ -554,7 +570,6 @@ files: 
     | 
|
| 
       554 
570 
     | 
    
         
             
            - spec/lib/reveal-ck/config_spec.rb
         
     | 
| 
       555 
571 
     | 
    
         
             
            - spec/lib/reveal-ck/markdown/post_processor_spec.rb
         
     | 
| 
       556 
572 
     | 
    
         
             
            - spec/lib/reveal-ck/markdown/pre_processor_spec.rb
         
     | 
| 
       557 
     | 
    
         
            -
            - spec/lib/reveal-ck/markdown/slide_markdown_spec.rb
         
     | 
| 
       558 
573 
     | 
    
         
             
            - spec/lib/reveal-ck/markdown/slide_markdown_template_spec.rb
         
     | 
| 
       559 
574 
     | 
    
         
             
            - spec/lib/reveal-ck/misc/remove_extension_spec.rb
         
     | 
| 
       560 
575 
     | 
    
         
             
            - spec/lib/reveal-ck/presentation_dsl_spec.rb
         
     | 
| 
         @@ -635,7 +650,6 @@ test_files: 
     | 
|
| 
       635 
650 
     | 
    
         
             
            - spec/lib/reveal-ck/config_spec.rb
         
     | 
| 
       636 
651 
     | 
    
         
             
            - spec/lib/reveal-ck/markdown/post_processor_spec.rb
         
     | 
| 
       637 
652 
     | 
    
         
             
            - spec/lib/reveal-ck/markdown/pre_processor_spec.rb
         
     | 
| 
       638 
     | 
    
         
            -
            - spec/lib/reveal-ck/markdown/slide_markdown_spec.rb
         
     | 
| 
       639 
653 
     | 
    
         
             
            - spec/lib/reveal-ck/markdown/slide_markdown_template_spec.rb
         
     | 
| 
       640 
654 
     | 
    
         
             
            - spec/lib/reveal-ck/misc/remove_extension_spec.rb
         
     | 
| 
       641 
655 
     | 
    
         
             
            - spec/lib/reveal-ck/presentation_dsl_spec.rb
         
     | 
| 
         @@ -1,28 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'cgi'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'redcarpet'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module RevealCK
         
     | 
| 
       5 
     | 
    
         
            -
              module Markdown
         
     | 
| 
       6 
     | 
    
         
            -
                # This class defines what "Slide Markdown" is.
         
     | 
| 
       7 
     | 
    
         
            -
                class SlideMarkdown < Redcarpet::Render::HTML
         
     | 
| 
       8 
     | 
    
         
            -
                  def preprocess(doc)
         
     | 
| 
       9 
     | 
    
         
            -
                    PreProcessor.new(doc).process
         
     | 
| 
       10 
     | 
    
         
            -
                  end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                  def postprocess(doc)
         
     | 
| 
       13 
     | 
    
         
            -
                    PostProcessor.new(doc).process
         
     | 
| 
       14 
     | 
    
         
            -
                  end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                  def block_code(code, language)
         
     | 
| 
       17 
     | 
    
         
            -
                    escaped = CGI.escape_html(code)
         
     | 
| 
       18 
     | 
    
         
            -
                    if language.nil?
         
     | 
| 
       19 
     | 
    
         
            -
                      "<pre><code>#{escaped}</code></pre>"
         
     | 
| 
       20 
     | 
    
         
            -
                    elsif language == 'notes' || language == 'note'
         
     | 
| 
       21 
     | 
    
         
            -
                      "<aside class='notes'>#{escaped}</aside>"
         
     | 
| 
       22 
     | 
    
         
            -
                    else
         
     | 
| 
       23 
     | 
    
         
            -
                      "<pre><code class=\"#{language}\">#{escaped}</code></pre>"
         
     | 
| 
       24 
     | 
    
         
            -
                    end
         
     | 
| 
       25 
     | 
    
         
            -
                  end
         
     | 
| 
       26 
     | 
    
         
            -
                end
         
     | 
| 
       27 
     | 
    
         
            -
              end
         
     | 
| 
       28 
     | 
    
         
            -
            end
         
     |