prismic.io 1.0.0.rc1 → 1.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfc8f36ad84978908dd0e3de61caaf36a354c572
4
- data.tar.gz: 9faacc27422f43a5e668136082398036a95a3034
3
+ metadata.gz: 6f3ceb1f0344bdcb62956f4f7a5cc1726f7bd71d
4
+ data.tar.gz: 15093ac28e13027b611f19dcf0ef5d0711b9e6f0
5
5
  SHA512:
6
- metadata.gz: b70799f5a36b767f8635017c7b6451b2162285f38027d578fe7d31844dad2332d23e9afe19685be06af1293773debf7366dbb5a31301c61c42db0bdee4e4c156
7
- data.tar.gz: f3b17450288b894a4f5e37943608630c14ae9a990483e5cb6691ac7ca81a984cc7b4602cd3e0d108527a9cee857b0454213e8f15a0eb2bf813d8def439d25594
6
+ metadata.gz: f01b158ca5911cca23adeb97c1a5113d17d5e40e4a548074fe787ec7737c1b44e6676d56156a808d215ec6e834a7f1fc57c08aad759c7cc1ba49e110f76a3abb
7
+ data.tar.gz: b62bfd8113a345921a3700e797d1839f49f0257fbd5f68313fdd392a417aa80c5e0244175a7dbfbb5696312f8198aeda44bfc6bc6ce3a4312c83a09183657eee
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prismic.io (1.0.0.rc1)
4
+ prismic.io (1.0.0.rc2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -48,7 +48,7 @@ Thanks to Ruby's syntax, this kit contains some mild differences and syntastic s
48
48
 
49
49
  ### Changelog
50
50
 
51
- Need to see what changed, or to upgrade your kit? Check out [this kit's changelog](changelog.md).
51
+ Need to see what changed, or to upgrade your kit? We keep our changelog on [this repository's "Releases" tab](https://github.com/prismicio/ruby-kit/releases).
52
52
 
53
53
  ### Contribute to the kit
54
54
 
@@ -4,19 +4,24 @@ module Prismic
4
4
  class Link < Fragment
5
5
 
6
6
  def start_html(link_resolver = nil)
7
- %(<a href="#@url">)
7
+ %(<a href="#{url(link_resolver)}">)
8
8
  end
9
9
 
10
- def end_html(link_resolver = nil)
10
+ def end_html
11
11
  %(</a>)
12
12
  end
13
13
 
14
14
  def as_html(link_resolver=nil)
15
- %(#{start_html(link_resolver)}#@url#{end_html(link_resolver)})
15
+ %(#{start_html(link_resolver)}#{url(link_resolver)}#{end_html})
16
16
  end
17
17
 
18
- def url(link_resolver=nil)
19
- @url
18
+ # Returns the URL of the link
19
+ #
20
+ # @abstract See {WebLink#url}, {FileLink#url}, {ImageLink#url} or {DocumentLink#url}
21
+ #
22
+ # @param link_resolver [LinkResolver] The link resolver
23
+ def url(link_resolver = nil)
24
+ raise NotImplementedError, "Method #{__method__} is not implemented for #{inspect}", caller
20
25
  end
21
26
 
22
27
  end
@@ -27,6 +32,18 @@ module Prismic
27
32
  def initialize(url)
28
33
  @url = url
29
34
  end
35
+
36
+ # Returns the URL of the link
37
+ #
38
+ # @note The link_resolver parameter is accepted but it is not used by
39
+ # this method, so not providing it is perfectly fine.
40
+ #
41
+ # @see Link#url
42
+ #
43
+ # @param link_resolver [LinkResolver] The link resolver
44
+ def url(link_resolver = nil)
45
+ @url
46
+ end
30
47
  end
31
48
 
32
49
  class FileLink < Link
@@ -40,7 +57,19 @@ module Prismic
40
57
  end
41
58
 
42
59
  def as_html(link_resolver=nil)
43
- %(#{start_html(link_resolver)}#@name#{end_html(link_resolver)})
60
+ %(#{start_html(link_resolver)}#@name#{end_html})
61
+ end
62
+
63
+ # Returns the URL of the link
64
+ #
65
+ # @note The link_resolver parameter is accepted but it is not used by
66
+ # this method, so not providing it is perfectly fine.
67
+ #
68
+ # @see Link#url
69
+ #
70
+ # @param link_resolver [LinkResolver]
71
+ def url(link_resolver = nil)
72
+ @url
44
73
  end
45
74
 
46
75
  end
@@ -51,6 +80,18 @@ module Prismic
51
80
  def initialize(url)
52
81
  @url = url
53
82
  end
83
+
84
+ # Returns the URL of the link
85
+ #
86
+ # @note The link_resolver parameter is accepted but it is not used by
87
+ # this method, so not providing it is perfectly fine.
88
+ #
89
+ # @see Link#url
90
+ #
91
+ # @param link_resolver [LinkResolver]
92
+ def url(link_resolver=nil)
93
+ @url
94
+ end
54
95
  end
55
96
 
56
97
  class DocumentLink < Link
@@ -65,18 +106,25 @@ module Prismic
65
106
  end
66
107
 
67
108
  def start_html(link_resolver)
68
- broken? ? %(<span>) : %(<a href="#{self.url(link_resolver)}">)
109
+ broken? ? %(<span>) : super
69
110
  end
70
111
 
71
- def end_html(link_resolver = nil)
72
- broken? ? %(</span>) : %(</a>)
112
+ def end_html
113
+ broken? ? %(</span>) : super
73
114
  end
74
115
 
75
116
  def as_html(link_resolver=nil)
76
- %(#{start_html(link_resolver)}#{slug}#{end_html(link_resolver)})
117
+ %(#{start_html(link_resolver)}#{slug}#{end_html})
77
118
  end
78
119
 
79
- def url(link_resolver)
120
+ # Returns the URL of the link
121
+ #
122
+ # @overload url(link_resolver)
123
+ #
124
+ # @see Link#url
125
+ #
126
+ # @param link_resolver [LinkResolver]
127
+ def url(link_resolver = nil)
80
128
  raise "A link_resolver method is needed to serialize document links into a correct URL on your website. If you're using a starter kit, a trivial one is provided out-of-the-box, that you can update later." if link_resolver == nil
81
129
  link_resolver.link_to(self)
82
130
  end
@@ -100,7 +100,7 @@ module Prismic
100
100
  def start_html(link_resolver=nil)
101
101
  "<em>"
102
102
  end
103
- def end_html(link_resolver=nil)
103
+ def end_html
104
104
  "</em>"
105
105
  end
106
106
  end
@@ -109,7 +109,7 @@ module Prismic
109
109
  def start_html(link_resolver=nil)
110
110
  "<strong>"
111
111
  end
112
- def end_html(link_resolver=nil)
112
+ def end_html
113
113
  "</strong>"
114
114
  end
115
115
  end
@@ -123,8 +123,8 @@ module Prismic
123
123
  def start_html(link_resolver = nil)
124
124
  link.start_html(link_resolver)
125
125
  end
126
- def end_html(link_resolver=nil)
127
- link.end_html(link_resolver)
126
+ def end_html
127
+ link.end_html
128
128
  end
129
129
  end
130
130
  end
@@ -144,22 +144,38 @@ module Prismic
144
144
 
145
145
  def initialize(text, spans)
146
146
  @text = text
147
- @spans = spans
147
+ @spans = spans.select{|span| span.start < span.end}
148
148
  end
149
149
 
150
150
  def as_html(link_resolver=nil)
151
+ # Getting Hashes of spanning tags to insert, sorted by starting position, and by ending position
151
152
  start_spans, end_spans = prepare_spans
152
- text.chars.each_with_index.map {|c, i|
153
- opening = start_spans[i].map {|span|
154
- span.start_html(link_resolver)
155
- }
156
- closing = end_spans[i].map {|span|
157
- span.end_html(link_resolver)
158
- }
159
- opening + closing + [CGI::escapeHTML(c)]
160
- }.flatten.join("")
153
+ # All the positions in which we'll have to insert an opening or closing tag
154
+ all_cuts = (start_spans.keys | end_spans.keys).sort
155
+
156
+ # Initializing the browsing of the string
157
+ output = []
158
+ cursor = 0
159
+
160
+ # Taking each text cut and inserting the closing tags and the opening tags if needed
161
+ all_cuts.each do |cut|
162
+ output << CGI::escapeHTML(text[cursor, cut-cursor])
163
+ output << end_spans[cut].map{|span| span.end_html} # this pushes an array into the array; we'll need to flatten later
164
+ output << start_spans[cut].map{|span| span.start_html(link_resolver)} # this pushes an array into the array; we'll need to flatten later
165
+ cursor = cut # cursor is now where the cut was
166
+ end
167
+
168
+ # Inserting what's left of the string, if there is something
169
+ output << text[cursor..-1]
170
+
171
+ # Making the array into a string
172
+ output.flatten.join
173
+
161
174
  end
162
175
 
176
+ # Building two span Hashes:
177
+ # * start_spans, with the starting positions as keys, and spans as values
178
+ # * end_spans, with the ending positions as keys, and spans as values
163
179
  def prepare_spans
164
180
  unless defined?(@prepared_spans)
165
181
  start_spans = Hash.new{|h,k| h[k] = [] }
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Prismic
3
3
 
4
- VERSION = "1.0.0.rc1"
4
+ VERSION = "1.0.0.rc2"
5
5
 
6
6
  end
@@ -2,11 +2,10 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe 'WebLink' do
5
- describe 'as_html' do
6
- before do
5
+ before do
7
6
  @web_link = Prismic::Fragments::WebLink.new('my_url')
8
- end
9
-
7
+ end
8
+ describe 'as_html' do
10
9
  it "returns an <a> HTML element" do
11
10
  Nokogiri::XML(@web_link.as_html).child.name.should == 'a'
12
11
  end
@@ -25,13 +24,34 @@ describe 'WebLink' do
25
24
  end
26
25
 
27
26
  describe 'as_text' do
28
- before do
29
- @web_link = Prismic::Fragments::WebLink.new('my_url')
30
- end
31
27
  it 'raises an NotImplementedError' do
32
28
  expect { @web_link.as_text }.to raise_error NotImplementedError
33
29
  end
34
30
  end
31
+
32
+ describe 'url' do
33
+ before do
34
+ @link_resolver = Prismic.link_resolver("master"){|doc_link| "http://localhost/#{doc_link.id}" }
35
+ end
36
+ it 'works in a unified way' do
37
+ @web_link.url(@link_resolver).should == 'my_url'
38
+ end
39
+ end
40
+ end
41
+
42
+ describe 'DocumentLink' do
43
+ before do
44
+ @document_link = Prismic::Fragments::DocumentLink.new("UdUjvt_mqVNObPeO", "product", ["Macaron"], "dark-chocolate-macaron", false)
45
+ end
46
+
47
+ describe 'url' do
48
+ before do
49
+ @link_resolver = Prismic.link_resolver("master"){|doc_link| "http://localhost/#{doc_link.id}" }
50
+ end
51
+ it 'works in a unified way' do
52
+ @document_link.url(@link_resolver).should == 'http://localhost/UdUjvt_mqVNObPeO'
53
+ end
54
+ end
35
55
  end
36
56
 
37
57
  describe 'ImageLink' do
@@ -63,19 +83,51 @@ describe 'ImageLink' do
63
83
  expect { @image_link.as_text }.to raise_error NotImplementedError
64
84
  end
65
85
  end
86
+
87
+ describe 'url' do
88
+ before do
89
+ @link_resolver = Prismic.link_resolver("master"){|doc_link| "http://localhost/#{doc_link.id}" }
90
+ end
91
+ it 'works in a unified way' do
92
+ @image_link.url(@link_resolver).should == 'my_url'
93
+ end
94
+ end
66
95
  end
67
96
 
68
97
  describe 'FileLink' do
69
- describe 'in structured texts' do
70
- before do
71
- @raw_json_structured_text = File.read("#{File.dirname(__FILE__)}/responses_mocks/structured_text_linkfile.json")
72
- @json_structured_text = JSON.parse(@raw_json_structured_text)
73
- @structured_text = Prismic::JsonParser.structured_text_parser(@json_structured_text)
74
- end
75
- it 'serializes well into HTML' do
76
- @structured_text.as_html(nil).should == "<p><a href=\"https://prismic-io.s3.amazonaws.com/annual.report.pdf\">2012 Annual Report</p>\n\n<p><a href=\"https://prismic-io.s3.amazonaws.com/annual.budget.pdf\">2012 Annual Budget</p>\n\n<p><a href=\"https://prismic-io.s3.amazonaws.com/vision.strategic.plan_.sm_.pdf\">2015 Vision &amp; Strategic Plan</p>"
77
- end
78
- end
98
+ describe 'in structured texts' do
99
+ before do
100
+ @raw_json_structured_text = File.read("#{File.dirname(__FILE__)}/responses_mocks/structured_text_linkfile.json")
101
+ @json_structured_text = JSON.parse(@raw_json_structured_text)
102
+ @structured_text = Prismic::JsonParser.structured_text_parser(@json_structured_text)
103
+ end
104
+ it 'serializes well into HTML' do
105
+ @structured_text.as_html(nil).should == "<p><a href=\"https://prismic-io.s3.amazonaws.com/annual.report.pdf\">2012 Annual Report</a></p>\n\n<p><a href=\"https://prismic-io.s3.amazonaws.com/annual.budget.pdf\">2012 Annual Budget</a></p>\n\n<p><a href=\"https://prismic-io.s3.amazonaws.com/vision.strategic.plan_.sm_.pdf\">2015 Vision &amp; Strategic Plan</a></p>"
106
+ end
107
+ end
108
+ end
109
+
110
+ describe 'Span' do
111
+ describe 'in structured texts when end is at the end of line' do
112
+ before do
113
+ @raw_json_structured_text = File.read("#{File.dirname(__FILE__)}/responses_mocks/structured_text_with_tricky_spans.json")
114
+ @json_structured_text = JSON.parse(@raw_json_structured_text)
115
+ @structured_text = Prismic::JsonParser.structured_text_parser(@json_structured_text)
116
+ end
117
+ it 'serializes well into HTML' do
118
+ @structured_text.as_html(nil).should == "<h3><strong>Powering Through 2013 </strong></h3>\n\n<h3><strong>Online Resources:</strong></h3>\n\n<ul><li>Hear more from our executive team as they reflect on 2013 and share their vision for 2014 on our blog <a href=\"http://prismic.io\">here</a></li></ul>"
119
+ end
120
+ end
121
+ describe 'in structured texts when multiple spans' do
122
+ before do
123
+ @raw_json_structured_text = File.read("#{File.dirname(__FILE__)}/responses_mocks/structured_text_paragraph.json")
124
+ @json_structured_text = JSON.parse(@raw_json_structured_text)
125
+ @structured_text = Prismic::JsonParser.structured_text_parser(@json_structured_text)
126
+ end
127
+ it 'serializes well into HTML' do
128
+ @structured_text.as_html(nil).should == "<p>Experience <a href=\"http://prismic.io\">the</a> ultimate vanilla experience. Our vanilla Macarons are made with our very own (in-house) <em>pure extract of Madagascar vanilla</em>, and subtly dusted with <strong>our own vanilla sugar</strong> (which we make from real vanilla beans).</p>"
129
+ end
130
+ end
79
131
  end
80
132
 
81
133
  describe 'Text' do
@@ -63,12 +63,12 @@ describe 'LesBonnesChoses' do
63
63
  it "returns a correct as_html on a StructuredText with list, span, embed and image" do
64
64
  @api.form("everything")
65
65
  .query(%([[:d = at(document.id, "UkL0gMuvzYUANCpr")]]))
66
- .submit(@master_ref)[0]['blog-post.body'].as_html(@link_resolver).gsub("&#39;", "'").should == "<h1>Get the right approach to ganache</h1>\n\n<p>A lot of people touch base with us to know about one of our key ingredients, and the essential role it plays in our creations: ganache.</p>\n\n<p>Indeed, ganache is the macaron's softener, or else, macarons would be but tough biscuits; it is the cupcake's wrapper, or else, cupcakes would be but plain old cake. We even sometimes use ganache within our cupcakes, to soften the cake itself, or as a support to our pies' content.</p>\n\n<h2>How to approach ganache</h2>\n\n<img src=\"https://prismic-io.s3.amazonaws.com/lesbonneschoses/ee7b984b98db4516aba2eabd54ab498293913c6c.jpg\" alt=\"\" width=\"640\" height=\"425\" />\n\n<p>Apart from the taste balance, which is always a challenge when it comes to pastry, the tough part about ganache is about thickness. It is even harder to predict through all the phases the ganache gets to meet (how long will it get melted? how long will it remain in the fridge?). Things get a hell of a lot easier to get once you consider that there are two main ways to get the perfect ganache:</p>\n\n<ul><li><strong>working from the top down</strong>: start with a thick, almost hard material, and soften it by manipulating it, or by mixing it with a more liquid ingredient (like milk)</li><li><strong>working from the bottom up</strong>: start from a liquid-ish state, and harden it by miwing it with thicker ingredients, or by leaving it in the fridge longer.</li></ul>\n\n<p>We do hope this advice will empower you in your ganache-making skills. Let us know how you did with it!</p>\n\n<h2>Ganache at <em>Les Bonnes Choses</h2>\n\n<p>We have a saying at Les Bonnes Choses: &quot;Once you can make ganache, you can make anything.&quot;</p>\n\n<p>As you may know, we like to give our workshop artists the ability to master their art to the top; that is why our Preparation Experts always start off as being Ganache Specialists for Les Bonnes Choses. That way, they're given an opportunity to focus on one exercise before moving on. Once they master their ganache, and are able to provide the most optimal delight to our customers, we consider they'll thrive as they work on other kinds of preparations.</p>\n\n<h2>About the chocolate in our ganache</h2>\n\n<p>Now, we've also had a lot of questions about how our chocolate gets made. It's true, as you might know, that we make it ourselves, from Columbian cocoa and French cow milk, with a process that much resembles the one in the following Discovery Channel documentary.</p>\n\n <div data-oembed=\"http://www.youtube.com/\"\n data-oembed-type=\"video\"\n data-oembed-provider=\"youtube\"><iframe width=\"459\" height=\"344\" src=\"http://www.youtube.com/embed/Ye78F3-CuXY?feature=oembed\" frameborder=\"0\" allowfullscreen></iframe></div>\n"
66
+ .submit(@master_ref)[0]['blog-post.body'].as_html(@link_resolver).gsub("&#39;", "'").should == "<h1>Get the right approach to ganache</h1>\n\n<p>A lot of people touch base with us to know about one of our key ingredients, and the essential role it plays in our creations: ganache.</p>\n\n<p>Indeed, ganache is the macaron's softener, or else, macarons would be but tough biscuits; it is the cupcake's wrapper, or else, cupcakes would be but plain old cake. We even sometimes use ganache within our cupcakes, to soften the cake itself, or as a support to our pies' content.</p>\n\n<h2>How to approach ganache</h2>\n\n<img src=\"https://prismic-io.s3.amazonaws.com/lesbonneschoses/ee7b984b98db4516aba2eabd54ab498293913c6c.jpg\" alt=\"\" width=\"640\" height=\"425\" />\n\n<p>Apart from the taste balance, which is always a challenge when it comes to pastry, the tough part about ganache is about thickness. It is even harder to predict through all the phases the ganache gets to meet (how long will it get melted? how long will it remain in the fridge?). Things get a hell of a lot easier to get once you consider that there are two main ways to get the perfect ganache:</p>\n\n<ul><li><strong>working from the top down</strong>: start with a thick, almost hard material, and soften it by manipulating it, or by mixing it with a more liquid ingredient (like milk)</li><li><strong>working from the bottom up</strong>: start from a liquid-ish state, and harden it by miwing it with thicker ingredients, or by leaving it in the fridge longer.</li></ul>\n\n<p>We do hope this advice will empower you in your ganache-making skills. Let us know how you did with it!</p>\n\n<h2>Ganache at <em>Les Bonnes Choses</em></h2>\n\n<p>We have a saying at Les Bonnes Choses: \"Once you can make ganache, you can make anything.\"</p>\n\n<p>As you may know, we like to give our workshop artists the ability to master their art to the top; that is why our Preparation Experts always start off as being Ganache Specialists for Les Bonnes Choses. That way, they're given an opportunity to focus on one exercise before moving on. Once they master their ganache, and are able to provide the most optimal delight to our customers, we consider they'll thrive as they work on other kinds of preparations.</p>\n\n<h2>About the chocolate in our ganache</h2>\n\n<p>Now, we've also had a lot of questions about how our chocolate gets made. It's true, as you might know, that we make it ourselves, from Columbian cocoa and French cow milk, with a process that much resembles the one in the following Discovery Channel documentary.</p>\n\n <div data-oembed=\"http://www.youtube.com/\"\n data-oembed-type=\"video\"\n data-oembed-provider=\"youtube\"><iframe width=\"459\" height=\"344\" src=\"http://www.youtube.com/embed/Ye78F3-CuXY?feature=oembed\" frameborder=\"0\" allowfullscreen></iframe></div>\n"
67
67
  end
68
68
  it "returns a correct as_html on a StructuredText with links" do
69
69
  @api.form("everything")
70
70
  .query(%([[:d = at(document.id, "#{@api.bookmark('about')}")]]))
71
- .submit(@master_ref)[0]['article.content'].as_html(@link_resolver).gsub("&#39;", "'").should == "<h2>A tale of pastry and passion</h2>\n\n<p>As a child, Jean-Michel Pastranova learned the art of fine cuisine from his grand-father, Jacques Pastranova, who was the creator of the &quot;taste-design&quot; art current, and still today an unmissable reference of forward-thinking in cuisine. At first an assistant in his grand-father's kitchen, Jean-Michel soon found himself fascinated by sweet flavors and the tougher art of pastry, drawing his own path in the ever-changing cuisine world.</p>\n\n<p>In 1992, the first Les Bonnes Choses store opened on rue Saint-Lazare, in Paris (<a href=\"http://localhost/UkL0gMuvzYUANCpa\">we're still there!</a>), much to everyone's surprise; indeed, back then, it was very surprising for a highly promising young man with a preordained career as a restaurant chef, to open a pastry shop instead. But soon enough, contemporary chefs understood that Jean-Michel had the drive to redefine a new nobility to pastry, the same way many other kinds of cuisine were being qualified as &quot;fine&quot;.</p>\n\n<p>In 1996, meeting an overwhelming demand, Jean-Michel Pastranova opened <a href=\"http://localhost/UkL0gMuvzYUANCpX\">a second shop on Paris's Champs-Élysées</a>, and <a href=\"http://localhost/UkL0gMuvzYUANCpY\">a third one in London</a>, the same week! Eventually, Les Bonnes Choses gained an international reputation as &quot;a perfection so familiar and new at the same time, that it will feel like a taste travel&quot; (New York Gazette), &quot;the finest balance between surprise and comfort, enveloped in sweetness&quot; (The Tokyo Tribune), &quot;a renewal of the pastry genre (...), the kind that changed the way pastry is approached globally&quot; (The San Francisco Gourmet News). Therefore, it was only a matter of time before Les Bonnes Choses opened shops in <a href=\"http://localhost/UkL0gMuvzYUANCpW\">New York</a> (2000) and <a href=\"http://localhost/UkL0gMuvzYUANCpZ\">Tokyo</a> (2004).</p>\n\n<p>In 2013, Jean-Michel Pastranova stepped down as the CEO and Director of Workshops, remaining a senior advisor to the board and to the workshop artists; he passed the light on to Selena, his daugther, who initially learned the art of pastry from him. Passion for great food runs in the Pastranova family...</p>\n\n<img src=\"https://prismic-io.s3.amazonaws.com/lesbonneschoses/df6c1d87258a5bfadf3479b163fd85c829a5c0b8.jpg\" alt=\"\" width=\"800\" height=\"533\" />\n\n<h2>Our main value: our customers' delight</h2>\n\n<p>Our every action is driven by the firm belief that there is art in pastry, and that this art is one of the dearest pleasures one can experience.</p>\n\n<p>At Les Bonnes Choses, people preparing your macarons are not simply &quot;pastry chefs&quot;: they are &quot;<a href=\"http://localhost/UkL0gMuvzYUANCpe\">ganache specialists</a>&quot;, &quot;<a href=\"http://localhost/UkL0gMuvzYUANCpc\">fruit experts</a>&quot;, or &quot;<a href=\"http://localhost/UkL0gMuvzYUANCpb\">oven instrumentalists</a>&quot;. They are the best people out there to perform the tasks they perform to create your pastry, giving it the greatest value. And they just love to make their specialized pastry skill better and better until perfection.</p>\n\n<p>Of course, there is a workshop in each <em>Les Bonnes Choses</em> store, and every pastry you buy was made today, by the best pastry specialists in your country.</p>\n\n<p>However, the very difficult art of creating new concepts, juggling with tastes and creating brand new, powerful experiences, is performed every few months, during our &quot;<a href=\"http://localhost/UkL0gMuvzYUANCpo\">Pastry Art Brainstorms</a>&quot;. During the event, the best pastry artists in the world (some working for <em>Les Bonnes Choses</em>, some not) gather in Paris, and showcase the experiments they've been working on; then, the other present artists comment on the piece, and iterate on it together, in order to make it the best possible masterchief!</p>\n\n<p>The session is presided by Jean-Michel Pastranova, who then selects the most delightful experiences, to add it to <em>Les Bonnes Choses</em>'s catalogue.</p>"
71
+ .submit(@master_ref)[0]['article.content'].as_html(@link_resolver).gsub("&#39;", "'").should == "<h2>A tale of pastry and passion</h2>\n\n<p>As a child, Jean-Michel Pastranova learned the art of fine cuisine from his grand-father, Jacques Pastranova, who was the creator of the \"taste-design\" art current, and still today an unmissable reference of forward-thinking in cuisine. At first an assistant in his grand-father's kitchen, Jean-Michel soon found himself fascinated by sweet flavors and the tougher art of pastry, drawing his own path in the ever-changing cuisine world.</p>\n\n<p>In 1992, the first Les Bonnes Choses store opened on rue Saint-Lazare, in Paris (<a href=\"http://localhost/UkL0gMuvzYUANCpa\">we're still there!</a>), much to everyone's surprise; indeed, back then, it was very surprising for a highly promising young man with a preordained career as a restaurant chef, to open a pastry shop instead. But soon enough, contemporary chefs understood that Jean-Michel had the drive to redefine a new nobility to pastry, the same way many other kinds of cuisine were being qualified as \"fine\".</p>\n\n<p>In 1996, meeting an overwhelming demand, Jean-Michel Pastranova opened <a href=\"http://localhost/UkL0gMuvzYUANCpX\">a second shop on Paris's Champs-Élysées</a>, and <a href=\"http://localhost/UkL0gMuvzYUANCpY\">a third one in London</a>, the same week! Eventually, Les Bonnes Choses gained an international reputation as &quot;a perfection so familiar and new at the same time, that it will feel like a taste travel&quot; (New York Gazette), &quot;the finest balance between surprise and comfort, enveloped in sweetness&quot; (The Tokyo Tribune), &quot;a renewal of the pastry genre (...), the kind that changed the way pastry is approached globally&quot; (The San Francisco Gourmet News). Therefore, it was only a matter of time before Les Bonnes Choses opened shops in <a href=\"http://localhost/UkL0gMuvzYUANCpW\">New York</a> (2000) and <a href=\"http://localhost/UkL0gMuvzYUANCpZ\">Tokyo</a> (2004).</p>\n\n<p>In 2013, Jean-Michel Pastranova stepped down as the CEO and Director of Workshops, remaining a senior advisor to the board and to the workshop artists; he passed the light on to Selena, his daugther, who initially learned the art of pastry from him. Passion for great food runs in the Pastranova family...</p>\n\n<img src=\"https://prismic-io.s3.amazonaws.com/lesbonneschoses/df6c1d87258a5bfadf3479b163fd85c829a5c0b8.jpg\" alt=\"\" width=\"800\" height=\"533\" />\n\n<h2>Our main value: our customers' delight</h2>\n\n<p>Our every action is driven by the firm belief that there is art in pastry, and that this art is one of the dearest pleasures one can experience.</p>\n\n<p>At Les Bonnes Choses, people preparing your macarons are not simply &quot;pastry chefs&quot;: they are &quot;<a href=\"http://localhost/UkL0gMuvzYUANCpe\">ganache specialists</a>&quot;, &quot;<a href=\"http://localhost/UkL0gMuvzYUANCpc\">fruit experts</a>&quot;, or &quot;<a href=\"http://localhost/UkL0gMuvzYUANCpb\">oven instrumentalists</a>\". They are the best people out there to perform the tasks they perform to create your pastry, giving it the greatest value. And they just love to make their specialized pastry skill better and better until perfection.</p>\n\n<p>Of course, there is a workshop in each <em>Les Bonnes Choses</em> store, and every pastry you buy was made today, by the best pastry specialists in your country.</p>\n\n<p>However, the very difficult art of creating new concepts, juggling with tastes and creating brand new, powerful experiences, is performed every few months, during our &quot;<a href=\"http://localhost/UkL0gMuvzYUANCpo\">Pastry Art Brainstorms</a>&quot;. During the event, the best pastry artists in the world (some working for <em>Les Bonnes Choses</em>, some not) gather in Paris, and showcase the experiments they've been working on; then, the other present artists comment on the piece, and iterate on it together, in order to make it the best possible masterchief!</p>\n\n<p>The session is presided by Jean-Michel Pastranova, who then selects the most delightful experiences, to add it to <em>Les Bonnes Choses</em>'s catalogue.</p>"
72
72
  end
73
73
  it "returns a correct as_text on a StructuredText" do
74
74
  @api.form("everything")
@@ -10,8 +10,8 @@
10
10
  "type": "em"
11
11
  },
12
12
  {
13
- "start": 10,
14
- "end": 13,
13
+ "start": 11,
14
+ "end": 14,
15
15
  "type": "hyperlink",
16
16
  "data": {
17
17
  "type": "Link.web",
@@ -0,0 +1,44 @@
1
+ {
2
+ "type": "StructuredText",
3
+ "value" : [
4
+ {
5
+ "type" : "heading3",
6
+ "text" : "Powering Through 2013 ",
7
+ "spans" : [
8
+ {
9
+ "start": 0,
10
+ "end": 22,
11
+ "type": "strong"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "type" : "heading3",
17
+ "text" : "Online Resources:",
18
+ "spans" : [
19
+ {
20
+ "start": 0,
21
+ "end": 17,
22
+ "type": "strong"
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "type" : "list-item",
28
+ "text" : "Hear more from our executive team as they reflect on 2013 and share their vision for 2014 on our blog here",
29
+ "spans" : [
30
+ {
31
+ "start" : 102,
32
+ "end" : 106,
33
+ "type" : "hyperlink",
34
+ "data" : {
35
+ "type" : "Link.web",
36
+ "value" : {
37
+ "url" : "http://prismic.io"
38
+ }
39
+ }
40
+ }
41
+ ]
42
+ }
43
+ ]
44
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prismic.io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc1
4
+ version: 1.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Étienne Vallette d'Osia
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-29 00:00:00.000000000 Z
12
+ date: 2014-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -80,7 +80,6 @@ files:
80
80
  - Gemfile.lock
81
81
  - README.md
82
82
  - Rakefile
83
- - changelog.md
84
83
  - lib/prismic.rb
85
84
  - lib/prismic/api.rb
86
85
  - lib/prismic/form.rb
@@ -111,6 +110,7 @@ files:
111
110
  - spec/responses_mocks/structured_text_heading.json
112
111
  - spec/responses_mocks/structured_text_linkfile.json
113
112
  - spec/responses_mocks/structured_text_paragraph.json
113
+ - spec/responses_mocks/structured_text_with_tricky_spans.json
114
114
  - spec/spec_helper.rb
115
115
  homepage: http://prismic.io
116
116
  licenses:
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: 1.3.1
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.2.0
135
+ rubygems_version: 2.2.2
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: Prismic.io development kit
@@ -148,4 +148,6 @@ test_files:
148
148
  - spec/responses_mocks/structured_text_heading.json
149
149
  - spec/responses_mocks/structured_text_linkfile.json
150
150
  - spec/responses_mocks/structured_text_paragraph.json
151
+ - spec/responses_mocks/structured_text_with_tricky_spans.json
151
152
  - spec/spec_helper.rb
153
+ has_rdoc:
data/changelog.md DELETED
@@ -1,42 +0,0 @@
1
- ## Changelog for prismic.io Ruby development kit
2
-
3
- ### prismic.io.1.0.0.rc1
4
-
5
- #### Potentially breaking changes for advanced users
6
-
7
- * **If you've been monkey-patching or overriding the `Prismic::Fragments::MediaLink`** class: it doesn't exist anymore, and is now replaced by `Prismic::Fragments::FileLink` or `Prismic::Fragments::ImageLink`, depending on the kind of link.
8
-
9
- #### New features
10
- * Support for `Link.image` and `Link.file` kinds of links, with new `Prismic::Fragments::FileLink` and `Prismic::Fragments::ImageLink` classes.
11
- * `Prismic::Fragments::Group` class now includes `Enumerable`, which means you can use `each`, `map`, `select`, etc. on `Group` objects. Same with `Prismic::Fragments::Group::FragmentMapping` objects (used internally by the `Group` class).
12
- * `Prismic::Fragments::Group` class now have a `length` method, aliased as `size`. Same with `Prismic::Fragments::Group::FragmentMapping` objects (used internally by the `Group` class).
13
- * The `url` method only existed for the `Prismic::Fragments::WebLink` class, now it is directly in the `Prismic::Fragments::Link` class, extended by all links classes: `Prismic::Fragments::WebLink`, `Prismic::Fragments::DocumentLink`, etc...
14
-
15
- #### Syntactic sugar
16
- * Since you can now call `url` on any kind of link (see right above), this allows to do this in Rails, regardless of the kind of link the `link` object is: `<%= link_to "Click here", link.url, :whatever_attribute => "whatever value" %>`.
17
-
18
- ### prismic.io.1.0.0.preview.8
19
-
20
- #### New features
21
- * Support for group fragments.
22
- * Support for unknown fragments (instead of crashing, ignores the fragment with a warning advising to update the kit).
23
-
24
- #### Syntactic sugar
25
- * `Prismic::API#create_search_form` is now `Prismic::API#form` (the former issues a deprecation warning, and will be removed in a later release); the online cross-tech doc was adapted to reflect that possibility.
26
-
27
- ### prismic.io.1.0.0.preview.7
28
-
29
- #### Potentially breaking changes for basic users
30
- * Boldness in `Prismic::Fragments::StructuredText#as_html` was represented as `<b>` tags, now as `<strong>` tags.
31
-
32
- #### New features
33
- * You had to call `Prismic::Link_resolver#link_to` on a `Prismic::Fragments::DocumentLink` object, but sometimes, you actually have the full `Prismic::Document`; you can now call it on both types of objects.
34
- * You had to call `api.master_ref` to get the master ref; now you can call it `api.master`, just like in the other dev kits; both methods do the same thing.
35
- * New method: `Prismic::Fragments::StructuredText#as_text`, renders zero formatting, and ignores images and embeds.
36
- * `Prismic::SearchForm` only had the `query` method to set the `q` parameter of the API call. Now those methods are dynamically created from the RESTful form found in the `/api` document, so it's now possible to use those methods too: `orderings`, `page`, `pageSize`, as well as all the future non-yet-existing ones.
37
-
38
-
39
- ### prismic.io.1.0.0.preview.6
40
-
41
- #### Potentially breaking changes for basic users
42
- * From an image, you had to call the view with its index, like this `image_object[0]`; now they're stored in a Hash, you have to call them with their proper name: `image_object['large']`.