smartdown 0.13.0 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -60,7 +60,7 @@ module Smartdown
60
60
  def build_govspeak(elements)
61
61
  elements.select { |element| markdown_element?(element) }
62
62
  return nil if elements.empty?
63
- elements.map(&:content).join("\n")
63
+ elements.map(&:content).join("")
64
64
  end
65
65
  end
66
66
  end
@@ -50,7 +50,7 @@ module Smartdown
50
50
 
51
51
  def build_govspeak(elements)
52
52
  markdown_elements = elements.select { |element| markdown_element?(element) }
53
- markdown_elements.map(&:content).join("\n") unless markdown_elements.empty?
53
+ markdown_elements.map(&:content).join("") unless markdown_elements.empty?
54
54
  end
55
55
  end
56
56
  end
@@ -1,3 +1,3 @@
1
1
  module Smartdown
2
- VERSION = "0.13.0"
2
+ VERSION = "0.13.1"
3
3
  end
@@ -61,6 +61,13 @@ of text.
61
61
 
62
62
 
63
63
  And handles multiple new lines
64
+
65
+ And handles tables
66
+
67
+ Academic Year | Form
68
+ - | -
69
+ 2015 to 2016 | [PR1 - form (PDF, 569KB)](http://www.sfengland.slc.co.uk/media/860450/sfe_pr1_form_1516_d.pdf)
70
+ 2015 to 2016 | [PR1 - guidance notes (PDF, 199KB)](http://www.sfengland.slc.co.uk/media/860454/sfe_pr1_notes_1516_d.pdf)
64
71
  EXPECTED
65
72
  end
66
73
  end
@@ -43,23 +43,35 @@ describe Smartdown::Api::Node do
43
43
  let(:question_heading) { Smartdown::Model::Element::MarkdownHeading.new(question_heading_content) }
44
44
 
45
45
  let(:body_content) { "I <3 bodyshopping" }
46
- let(:body_element) {
47
- Smartdown::Model::Element::MarkdownLine.new(body_content)
46
+ let(:body_elements) {
47
+ Smartdown::Model::Elements.new(
48
+ [
49
+ Smartdown::Model::Element::MarkdownLine.new(body_content),
50
+ Smartdown::Model::Element::MarkdownLine.new("\n")
51
+ ]
52
+ )
48
53
  }
49
54
 
50
55
  let(:post_body_content) { "hur hur such content" }
51
- let(:post_body_element) {
52
- Smartdown::Model::Element::MarkdownLine.new(post_body_content)
56
+ let(:post_body_elements) {
57
+ Smartdown::Model::Elements.new(
58
+ [Smartdown::Model::Element::MarkdownLine.new(post_body_content)]
59
+ )
53
60
  }
54
61
 
55
62
  let(:other_post_body_content) { "Postman Pat and his black and white cat" }
56
- let(:other_post_body_element) {
57
- Smartdown::Model::Element::MarkdownLine.new(other_post_body_content)
63
+ let(:other_post_body_elements) {
64
+ Smartdown::Model::Elements.new(
65
+ [
66
+ Smartdown::Model::Element::MarkdownLine.new("\n"),
67
+ Smartdown::Model::Element::MarkdownLine.new(other_post_body_content)
68
+ ]
69
+ )
58
70
  }
59
71
 
60
72
 
61
73
  context "with a body and post_body (and next node rules)" do
62
- let(:elements) { [node_heading, body_element, question_heading, question_element, post_body_element, other_post_body_element, next_node_rules] }
74
+ let(:elements) { [node_heading, body_elements, question_heading, question_element, post_body_elements, other_post_body_elements, next_node_rules] }
63
75
 
64
76
  describe "#body" do
65
77
  it 'returns the content before the question element' do
@@ -77,7 +89,7 @@ describe Smartdown::Api::Node do
77
89
  end
78
90
 
79
91
  context "missing a body" do
80
- let(:elements) { [question_element, post_body_element] }
92
+ let(:elements) { [question_element, post_body_elements] }
81
93
 
82
94
  describe "#body" do
83
95
  it 'returns nil' do
@@ -93,7 +105,7 @@ describe Smartdown::Api::Node do
93
105
  end
94
106
 
95
107
  context "missing a post body" do
96
- let(:elements) { [node_heading, body_element, question_heading, question_element] }
108
+ let(:elements) { [node_heading, body_elements, question_heading, question_element] }
97
109
 
98
110
  describe "#body" do
99
111
  it 'returns the content before the question element' do
@@ -17,3 +17,10 @@ of text.
17
17
 
18
18
 
19
19
  And handles multiple new lines
20
+
21
+ And handles tables
22
+
23
+ Academic Year | Form
24
+ - | -
25
+ 2015 to 2016 | [PR1 - form (PDF, 569KB)](http://www.sfengland.slc.co.uk/media/860450/sfe_pr1_form_1516_d.pdf)
26
+ 2015 to 2016 | [PR1 - guidance notes (PDF, 199KB)](http://www.sfengland.slc.co.uk/media/860454/sfe_pr1_notes_1516_d.pdf)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-15 00:00:00.000000000 Z
12
+ date: 2015-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parslet
16
- requirement: &16864100 !ruby/object:Gem::Requirement
16
+ requirement: &12661260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.6.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16864100
24
+ version_requirements: *12661260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: uk_postcode
27
- requirement: &16863580 !ruby/object:Gem::Requirement
27
+ requirement: &12660740 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *16863580
35
+ version_requirements: *12660740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &16863120 !ruby/object:Gem::Requirement
38
+ requirement: &12660200 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 3.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *16863120
46
+ version_requirements: *12660200
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &16862640 !ruby/object:Gem::Requirement
49
+ requirement: &12659780 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *16862640
57
+ version_requirements: *12659780
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: pry
60
- requirement: &16862140 !ruby/object:Gem::Requirement
60
+ requirement: &12659200 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *16862140
68
+ version_requirements: *12659200
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: gem_publisher
71
- requirement: &16861580 !ruby/object:Gem::Requirement
71
+ requirement: &12658640 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *16861580
79
+ version_requirements: *12658640
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: timecop
82
- requirement: &16861040 !ruby/object:Gem::Requirement
82
+ requirement: &12658200 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *16861040
90
+ version_requirements: *12658200
91
91
  description:
92
92
  email: david.heath@digital.cabinet-office.gov.uk
93
93
  executables:
@@ -309,7 +309,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
309
309
  version: '0'
310
310
  segments:
311
311
  - 0
312
- hash: 2163453024912914140
312
+ hash: 1413061790039635549
313
313
  required_rubygems_version: !ruby/object:Gem::Requirement
314
314
  none: false
315
315
  requirements:
@@ -318,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
318
  version: '0'
319
319
  segments:
320
320
  - 0
321
- hash: 2163453024912914140
321
+ hash: 1413061790039635549
322
322
  requirements: []
323
323
  rubyforge_project:
324
324
  rubygems_version: 1.8.11