saga 0.15.1 → 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: c5c5f033278bff0ecbe1f20538b7bd941c332e656a3c6ae64f88622f3efe2510
4
- data.tar.gz: 4f8d452bb4d7ddf1acbe244ca6c91ff8d02803134476386f2fdabcd94daeeebe
3
+ metadata.gz: 69aaaf9865fd974b99d588d9c98c7ef72e33607aac693f1b516ca5182e551154
4
+ data.tar.gz: 3319c648841e57fd1f83152405996215ed578fd9a91104741a7a4922f1034080
5
5
  SHA512:
6
- metadata.gz: 4eedabed8c5770263a74a8578bdf5f4cb82f19834704780174da9e739c6e6812e1e829c84f69e7812d962dab2c3b017ccf9b2c1342ce5c5b385bec8f53e44cd3
7
- data.tar.gz: 5f0472e1e7f857c3f637882a29c9170e554f21b1c8f1a372b3e98017c613f9823e65b5f38be2e66c70827307c0f10037473b90f212063a3c78c91bd29b5e83dc
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.1'.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.stories > div.story
121
+ div.stories > div
122
122
  {
123
123
  grid-column-start: 1;
124
124
  grid-column-end: 6;
@@ -131,76 +131,69 @@ div.stories > h3:first-child
131
131
  {
132
132
  margin-top: 0;
133
133
  }
134
- div.stories > 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.stories > 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
+ border-color: var(--background) !important;
148
149
  }
149
- div.story.dropped
150
+ div.stories > div.dropped
150
151
  {
151
152
  color: var(--dropped);
152
153
  }
153
- div.story.dropped > div.content
154
+ div.stories > div.dropped > div.content
154
155
  {
155
156
  text-decoration: line-through;
156
157
  }
157
- div.story:target
158
+ div.stories > div:target
158
159
  {
159
160
  background: var(--target-background);
160
161
  }
161
- div.story > *
162
+ div.stories > div > *
162
163
  {
163
164
  padding: 0 0.5rem;
164
165
  }
165
- div.story > *:first-child
166
- {
167
- padding-left: calc(var(--inset-right) - 0.5rem);
168
- }
169
- div.story > *:last-child
170
- {
171
- padding-right: calc(var(--inset-left) - 0.5rem);
172
- }
173
- div.story > a.id
166
+ div.stories > div > a.id
174
167
  {
175
168
  grid-column: 1;
176
169
  color: inherit;
177
170
  text-decoration: none;
178
171
  }
179
- div.story > div.content
172
+ div.stories > div > div.content
180
173
  {
181
174
  grid-column: 2;
182
175
  }
183
- div.story > div.estimate
176
+ div.stories > div > div.estimate
184
177
  {
185
178
  grid-column: 3;
186
179
  }
187
- div.story > div.iteration
180
+ div.stories > div > div.iteration
188
181
  {
189
182
  grid-column: 4;
190
183
  font-variant-numeric: tabular-nums;
191
184
  }
192
- div.story > div.status
185
+ div.stories > div > div.status
193
186
  {
194
187
  grid-column: 5;
195
188
  }
196
189
  @media (max-width: 25rem) {
197
- div.story > div.content
190
+ div.stories > div > div.content
198
191
  {
199
192
  grid-column: 2 / span 4;
200
193
  }
201
- div.story > div.estimate,
202
- div.story > div.iteration,
203
- div.story > div.status
194
+ div.stories > div > div.estimate,
195
+ div.stories > div > div.iteration,
196
+ div.stories > div > div.status
204
197
  {
205
198
  padding-top: 0.25rem;
206
199
  }
@@ -210,7 +203,7 @@ div.content p:not(:first-of-type)
210
203
  font-style: italic;
211
204
  margin-top: 0.25rem;
212
205
  }
213
- div.story.nested div.content
206
+ div.stories > div.substory div.content p
214
207
  {
215
208
  padding-left: 2rem;
216
209
  }
@@ -250,7 +243,7 @@ div.iteration
250
243
  <% end %>
251
244
 
252
245
  <% stories.each do |story| %>
253
- <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]) %>">
254
247
  <%= id(story[:id]) %>
255
248
  <div class="content">
256
249
  <p><%= h story[:description] %></p>
@@ -262,22 +255,6 @@ div.iteration
262
255
  <%= iteration(story[:iteration]) %>
263
256
  <%= status(story[:status]) %>
264
257
  </div>
265
- <% if story[:stories] %>
266
- <% story[:stories].each do |nested| %>
267
- <div class="story nested <%= nested[:status] %>" id="<%= dom_story_id(nested[:id]) %>">
268
- <%= id(nested[:id]) %>
269
- <div class="content">
270
- <p><%= h nested[:description] %></p>
271
- <% if nested[:notes] %>
272
- <p><%= h nested[:notes] %></p>
273
- <% end %>
274
- </div>
275
- <%= estimate(*nested[:estimate]) %>
276
- <%= iteration(nested[:iteration]) %>
277
- <%= status(nested[:status]) %>
278
- </div>
279
- <% end %>
280
- <% end %>
281
258
  <% end %>
282
259
  <% end %>
283
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.1
4
+ version: '0.16'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manfred Stienstra