saga 0.15.2 → 0.16

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
  SHA256:
3
- metadata.gz: d16bfba2b536f86acbe4219034dabf388adfaf10aabe9b291d63c7011cf224d6
4
- data.tar.gz: b0f60085a8fa1ec7664a40b17b8a34214601f868ca1d1d4527195a747f22ddf6
3
+ metadata.gz: 69aaaf9865fd974b99d588d9c98c7ef72e33607aac693f1b516ca5182e551154
4
+ data.tar.gz: 3319c648841e57fd1f83152405996215ed578fd9a91104741a7a4922f1034080
5
5
  SHA512:
6
- metadata.gz: cd606c2c9d5872bdf4a5cf6bd3a416dc25c916a357465d6a54cfc84503ec64fc1c987344fc24dc6380ba5c2a4c6da593da8728d1cd75ce3d3a2469e77bb7b363
7
- data.tar.gz: 512c06ed05fa15bd83a08440b6212c90f698e503098045129d70a158d58a8615d08353446055d64b49e6efc3a88ab0f34a88eafe1c23938798bb043d66b30f86
6
+ metadata.gz: a0cd222fd3c66218e101b270989e6be78ebfea8d9e3e99897ab99b39d34d0ce391c85c48b38ce219f5663f1d0271050e11e9e07402cb117a5dcb843928e2ce9c
7
+ data.tar.gz: 6a0fa9b3d0256178a7b7742eedcb65eacb927da40e3a6e5b84344d9ae8e6023aa06482a38932726c3834346e92af5fcd9098191680ea683172f05d684a23bfeb
data/lib/saga/document.rb CHANGED
@@ -17,20 +17,8 @@ module Saga
17
17
  end; copied
18
18
  end
19
19
 
20
- def flatten_stories(stories)
21
- stories_as_flat_list = []
22
- stories.flatten.each do |story|
23
- if story[:stories]
24
- stories_as_flat_list << copy_story(story)
25
- stories_as_flat_list.concat(story[:stories])
26
- else
27
- stories_as_flat_list << story
28
- end
29
- end; stories_as_flat_list
30
- end
31
-
32
20
  def stories_as_flat_list
33
- flatten_stories(stories.values)
21
+ stories.values.flatten
34
22
  end
35
23
 
36
24
  def _binding
@@ -38,16 +26,7 @@ module Saga
38
26
  end
39
27
 
40
28
  def used_ids
41
- @stories.values.each_with_object([]) do |stories, ids|
42
- stories.each do |story|
43
- ids << story[:id]
44
- next unless story[:stories]
45
-
46
- story[:stories].each do |nested|
47
- ids << nested[:id]
48
- end
49
- end
50
- end.compact
29
+ stories_as_flat_list.map{ |story| story[:id] }.compact
51
30
  end
52
31
 
53
32
  def unused_ids(limit)
data/lib/saga/parser.rb CHANGED
@@ -24,16 +24,15 @@ module Saga
24
24
  end
25
25
 
26
26
  def handle_story(story)
27
+ story[:type] = 'story' unless story[:type]
27
28
  self.current_section = :stories
28
29
  @document.stories[@current_header] ||= []
29
30
  @document.stories[@current_header] << story
30
31
  end
31
32
 
32
- def handle_nested_story(story)
33
- self.current_section = :story
34
- parent = @document.stories[@current_header][-1]
35
- parent[:stories] ||= []
36
- parent[:stories] << story
33
+ def handle_substory(story)
34
+ story[:type] = 'substory'
35
+ handle_story(story)
37
36
  end
38
37
 
39
38
  def handle_notes(notes)
@@ -20,7 +20,7 @@ module Saga
20
20
  elsif input[0, 3] == '| '
21
21
  @parser.handle_notes(input[1..-1].strip)
22
22
  elsif input[0, 1] == '|'
23
- @parser.handle_nested_story(self.class.tokenize_story(input[1..-1]))
23
+ @parser.handle_substory(self.class.tokenize_story(input[1..-1]))
24
24
  elsif input[0, 1] == '-'
25
25
  @parser.handle_author(self.class.tokenize_author(input))
26
26
  elsif input =~ RE_DEFINITION
data/lib/saga/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Saga
4
- VERSION = '0.15.2'.freeze
4
+ VERSION = '0.16'.freeze
5
5
  end
@@ -118,7 +118,7 @@ div.stories
118
118
  margin: 1rem calc(-1 * var(--inset-right)) 1rem calc(-1 * var(--inset-left));
119
119
  }
120
120
  h3,
121
- div.story
121
+ div.stories > div
122
122
  {
123
123
  grid-column-start: 1;
124
124
  grid-column-end: 6;
@@ -131,77 +131,69 @@ div.stories > h3:first-child
131
131
  {
132
132
  margin-top: 0;
133
133
  }
134
- div.story
134
+ div.stories > div
135
135
  {
136
136
  display: grid;
137
137
  grid-template-columns: subgrid;
138
138
  border-top: 1px solid var(--border);
139
- padding: 0.5rem;
139
+ padding: 0.5rem calc(var(--inset-right) - 0.5rem) 0.5rem calc(var(--inset-left) - 0.5rem);
140
140
  }
141
- div.story:not(:has(+ div.story))
141
+ div.stories > div:not(:has(+ div.stories > div))
142
142
  {
143
143
  border-bottom: 1px solid var(--border);
144
144
  }
145
- div.story.done
145
+ div.stories > div.done
146
146
  {
147
147
  background: var(--done-background);
148
148
  border-color: var(--background) !important;
149
149
  }
150
- div.story.dropped
150
+ div.stories > div.dropped
151
151
  {
152
152
  color: var(--dropped);
153
153
  }
154
- div.story.dropped > div.content
154
+ div.stories > div.dropped > div.content
155
155
  {
156
156
  text-decoration: line-through;
157
157
  }
158
- div.story:target
158
+ div.stories > div:target
159
159
  {
160
160
  background: var(--target-background);
161
161
  }
162
- div.story > *
162
+ div.stories > div > *
163
163
  {
164
164
  padding: 0 0.5rem;
165
165
  }
166
- div.story > *:first-child
167
- {
168
- padding-left: calc(var(--inset-right) - 0.5rem);
169
- }
170
- div.story > *:last-child
171
- {
172
- padding-right: calc(var(--inset-left) - 0.5rem);
173
- }
174
- div.story > a.id
166
+ div.stories > div > a.id
175
167
  {
176
168
  grid-column: 1;
177
169
  color: inherit;
178
170
  text-decoration: none;
179
171
  }
180
- div.story > div.content
172
+ div.stories > div > div.content
181
173
  {
182
174
  grid-column: 2;
183
175
  }
184
- div.story > div.estimate
176
+ div.stories > div > div.estimate
185
177
  {
186
178
  grid-column: 3;
187
179
  }
188
- div.story > div.iteration
180
+ div.stories > div > div.iteration
189
181
  {
190
182
  grid-column: 4;
191
183
  font-variant-numeric: tabular-nums;
192
184
  }
193
- div.story > div.status
185
+ div.stories > div > div.status
194
186
  {
195
187
  grid-column: 5;
196
188
  }
197
189
  @media (max-width: 25rem) {
198
- div.story > div.content
190
+ div.stories > div > div.content
199
191
  {
200
192
  grid-column: 2 / span 4;
201
193
  }
202
- div.story > div.estimate,
203
- div.story > div.iteration,
204
- div.story > div.status
194
+ div.stories > div > div.estimate,
195
+ div.stories > div > div.iteration,
196
+ div.stories > div > div.status
205
197
  {
206
198
  padding-top: 0.25rem;
207
199
  }
@@ -211,7 +203,7 @@ div.content p:not(:first-of-type)
211
203
  font-style: italic;
212
204
  margin-top: 0.25rem;
213
205
  }
214
- div.story.nested div.content
206
+ div.stories > div.substory div.content p
215
207
  {
216
208
  padding-left: 2rem;
217
209
  }
@@ -251,7 +243,7 @@ div.iteration
251
243
  <% end %>
252
244
 
253
245
  <% stories.each do |story| %>
254
- <div class="story <%= story[:status] %>" id="<%= dom_story_id(story[:id]) %>">
246
+ <div class="<%= [story[:type], story[:status]].compact.join(' ') %>" id="<%= dom_story_id(story[:id]) %>">
255
247
  <%= id(story[:id]) %>
256
248
  <div class="content">
257
249
  <p><%= h story[:description] %></p>
@@ -263,22 +255,6 @@ div.iteration
263
255
  <%= iteration(story[:iteration]) %>
264
256
  <%= status(story[:status]) %>
265
257
  </div>
266
- <% if story[:stories] %>
267
- <% story[:stories].each do |nested| %>
268
- <div class="story nested <%= nested[:status] %>" id="<%= dom_story_id(nested[:id]) %>">
269
- <%= id(nested[:id]) %>
270
- <div class="content">
271
- <p><%= h nested[:description] %></p>
272
- <% if nested[:notes] %>
273
- <p><%= h nested[:notes] %></p>
274
- <% end %>
275
- </div>
276
- <%= estimate(*nested[:estimate]) %>
277
- <%= iteration(nested[:iteration]) %>
278
- <%= status(nested[:status]) %>
279
- </div>
280
- <% end %>
281
- <% end %>
282
258
  <% end %>
283
259
  <% end %>
284
260
  </div>
@@ -25,4 +25,4 @@ USER STORIES
25
25
  <% definitions.each do |definition| -%>
26
26
  <%= format_definition(definition) %>
27
27
  <% end -%>
28
- <% end %>
28
+ <% end %>
@@ -15,23 +15,18 @@ def format_estimate(cardinality, interval)
15
15
  end
16
16
  end
17
17
 
18
- def format_story(story, kind = :regular)
18
+ def format_story(story)
19
19
  story_attributes = []
20
20
  story_attributes << "##{story[:id]}" if story[:id]
21
21
  story_attributes << story[:status] if story[:status]
22
22
  story_attributes << format_estimate(*story[:estimate]) if story[:estimate]
23
23
  story_attributes << "i#{story[:iteration]}" if story[:iteration]
24
24
 
25
- prefix = kind == :nested ? '| ' : ''
25
+ prefix = story[:type] == 'substory' ? '| ' : ''
26
26
  formatted = "#{prefix}#{story[:description]}"
27
27
  formatted << " - #{story_attributes.join(' ')}" unless story_attributes.empty?
28
28
  formatted << "\n"
29
29
  formatted << "#{prefix} #{story[:notes]}\n" if story[:notes]
30
- if story[:stories]
31
- story[:stories].each do |nested|
32
- formatted << format_story(nested, :nested)
33
- end
34
- end
35
30
  formatted
36
31
  end
37
32
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saga
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.2
4
+ version: '0.16'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manfred Stienstra