extended-markdown-filter 0.3.4 → 0.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 555bea313bb40a9b286a9916a4bc3a87c258771d
4
- data.tar.gz: 3780420bd64f8cd2034ccbecb60a34d0e467c881
3
+ metadata.gz: 0be701777aecab5f6a8ed73bcb9778cc4a01b68d
4
+ data.tar.gz: 074027daffa94871274bb024e1d6fc306029a15f
5
5
  SHA512:
6
- metadata.gz: a56659b608016e369af761743454e54403ebff307a5904b5a98e75c22ac672c3be491c80bc1e6c1ffc7a5d2350fa43ed43ef79c2e222e26dc37c2da2e9fde832
7
- data.tar.gz: 86eb129658b054247d53dd1acb6ae9d075e94c850a79a5cecc067b0003127a6d2f7c41b5fd591753cd08750b91b4711ce1abc7b183c2ccd3544d92f9777ff9c0
6
+ metadata.gz: caa52431a623a1f427462a9d5ebbf24f60361186d1e0f21e9ffb4008ccbf202eedeba22c2604332765e43370d20de6f96673e3bebb527cc358dd4fb97bca21ad
7
+ data.tar.gz: 3de7ea80ba2efcdbbd72186be361b83876c5ed2d1962ded4700b2f394fcfb6bab25a9aa64b1c434ffbda0b8fe333641d6298549b31d8d0bef12541b680a0ad82
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "extended-markdown-filter"
3
- spec.version = "0.3.4"
3
+ spec.version = "0.3.5"
4
4
  spec.authors = ["Garen Torikian"]
5
5
  spec.email = ["gjtorikian@gmail.com"]
6
6
  spec.summary = %q{Add extended markup syntax to the HTML::Pipeline}
@@ -1,13 +1,9 @@
1
1
  module Filters
2
2
  module PreFilter
3
3
  def format_command_line!(text)
4
- text.gsub! /((`{3}\s*)(command-line)?(\s*([\w\W]+?)\n*)\2)\n*(?:[^\S\w\s]|$)/m do |block|
5
- str = $5.dup
6
- return block unless str.lines.to_a[0].chomp == "command-line"
7
- str = str.lines.to_a[1..-1].join
8
-
9
- block.gsub! /``` command-line/, '<pre class="command-line">'
10
- block.gsub! /```/, "</pre>\n"
4
+ text.gsub! /\n?``` command-line(.+?)```/m do |block|
5
+ block.gsub! /^``` command-line/, '<pre class="command-line">'
6
+ block.gsub! /^```$/, "</pre>\n"
11
7
  block.gsub!(/^\$ (.+)$/) { %Q|<span class="command">#{$1.rstrip}</span>| }
12
8
  block.gsub!(/^(\# .+)$/) { %Q|<span class="comment">#{$1.rstrip}</span>| }
13
9
  block.gsub!(/^> (.+)$/) { %Q|<span class="output"><span># </span>#{$1.rstrip}</span>| }
@@ -1,6 +1,8 @@
1
1
  module Filters
2
2
  module PreFilter
3
3
  def format_helper!(text)
4
+ prefix = '<p'
5
+
4
6
  text.gsub! /\n?``` helper(.+?)```/m do |block|
5
7
  block.gsub! /^``` helper\s*/, ''
6
8
  block.gsub! /^```$/, ''
@@ -12,7 +14,7 @@ module Filters
12
14
  end
13
15
 
14
16
  content = block.strip
15
- content = "<p>#{content}</p>" unless content =~ /^<p/
17
+ content = "<p>#{content}</p>" unless content[0, prefix.length] == prefix
16
18
  content = "<div class='helper'><h4 class='header'><a href='#'>#{header}</a></h4><div class='content'>#{content}</div></div>"
17
19
  end
18
20
  end
@@ -14,11 +14,6 @@ class HTML::Pipeline::ExtendedMarkdownFilterTest < Minitest::Test
14
14
  assert_equal 1, doc.css('span.comment').size
15
15
  assert_equal 2, doc.css('em').size
16
16
  assert_equal 1, doc.css('span.output').size
17
-
18
- doc = ExtendedMarkdownFilter.to_document(fixture("command_line_list.md"), {})
19
- assert doc.kind_of?(HTML::Pipeline::DocumentFragment)
20
-
21
- assert_equal 2, doc.css('li pre.command-line').size
22
17
  end
23
18
 
24
19
  def test_helper
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extended-markdown-filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-04 00:00:00.000000000 Z
11
+ date: 2014-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-pipeline
@@ -109,7 +109,6 @@ files:
109
109
  - test/fixtures/block_octicon.md
110
110
  - test/fixtures/block_os_blocks.md
111
111
  - test/fixtures/command_line.md
112
- - test/fixtures/command_line_list.md
113
112
  - test/fixtures/helper.md
114
113
  - test/fixtures/intro.md
115
114
  - test/fixtures/octicon.md
@@ -147,7 +146,6 @@ test_files:
147
146
  - test/fixtures/block_octicon.md
148
147
  - test/fixtures/block_os_blocks.md
149
148
  - test/fixtures/command_line.md
150
- - test/fixtures/command_line_list.md
151
149
  - test/fixtures/helper.md
152
150
  - test/fixtures/intro.md
153
151
  - test/fixtures/octicon.md
@@ -1,29 +0,0 @@
1
- 1. On the command line, navigate to the repository that contains the commit you want to amend.
2
- 2. Use the `git rebase -i HEAD~n` command to display a list of the last `n` commits in your default text editor.
3
- ``` command-line
4
- $ git rebase -i HEAD~3 # Displays a list of the last 3 commits on the current branch
5
- ```
6
- The list will look similar to the following:
7
- ``` command-line
8
- pick e499d89 Delete CNAME
9
- pick 0c39034 Better README
10
- pick f7fde4a Change the commit message but push the same commit.
11
-
12
- # Rebase 9fdb3bd..f7fde4a onto 9fdb3bd
13
- #
14
- # Commands:
15
- # p, pick = use commit
16
- # r, reword = use commit, but edit the commit message
17
- # e, edit = use commit, but stop for amending
18
- # s, squash = use commit, but meld into previous commit
19
- # f, fixup = like "squash", but discard this commit's log message
20
- # x, exec = run command (the rest of the line) using shell
21
- #
22
- # These lines can be re-ordered; they are executed from top to bottom.
23
- #
24
- # If you remove a line here THAT COMMIT WILL BE LOST.
25
- #
26
- # However, if you remove everything, the rebase will be aborted.
27
- #
28
- # Note that empty commits are commented out
29
- ```