quby-compiler 0.5.26 → 0.5.28

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: eb03f5addb141e1e202837e24ca40e98f9e9c8e2560eccfbdd3685dbe88d2f4a
4
- data.tar.gz: 4d5b0f40b267fc8e2b538edcb0e7af777fb63df221aa982f8fb8a8f2c334491f
3
+ metadata.gz: 258b02451b98e7d37bda66a027d936e29dc81de2ec230e6cb304e957aa707daa
4
+ data.tar.gz: 32afc3c10ac8dc491dea798046ae4175e0c71cdcf31137dc22c822bdf81d5c8b
5
5
  SHA512:
6
- metadata.gz: bdc2a846329dd4f32cbbdaf6b29eac0112d02777c1105773321c864addef32158005b1660ad6012ae83ccfeea0d5e5e18c730b6737b911a432d5f9ca768f0c10
7
- data.tar.gz: be50d806c0711d615bf3dc2de53d1646253e945345c73f984e8111b4cf0af2edc93dca50ecaa5157e9fdd8d3c011b8efee00a7018c5d2587f9b291ab99c1b0ee
6
+ metadata.gz: 71caf12ba67af3315949989b6b37213168cb5c18ea1ee2199668ed10c91123af67e23304b55bedbea6522acf89af939b47d3891b1aa24c47197aa7b86aea9fb2
7
+ data.tar.gz: c52b9f16bdbf8bd70094dd6d51ec7e29890a55f24e15adb8e727ae42cb4df85db1b3ebc69bf238ec09974c9bab14615c49d02f884b4d96073ab8e7f50ebcf0a6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 0.5.28
2
+
3
+ * roqua.json: Don't parse markdown in title/descriptions for layour_version :v2
4
+
5
+ # 0.5.27
6
+
7
+ * roqua.json: put label in context_free description if present.
8
+ * quby2.json: write option#description to label when no label present. parse/sanitize label when not select.
9
+
1
10
  # 0.5.26
2
11
 
3
12
  * Quby2: Allow img tags
@@ -0,0 +1,16 @@
1
+ merge(values(:v_1, :v_2), values(v_4).recode(1 => 3)).sum
2
+
3
+
4
+
5
+ divide(value(:v_2), multiply(value(:v_1), value(:v_1)))
6
+
7
+ w / l * l
8
+
9
+
10
+ sexp_variable :key1 do
11
+ foo = values(:v_1, :v_2)
12
+ bar = recode(foo, 1 => 3)
13
+ bla = merge(foo, bar)
14
+ sum(bla)
15
+
16
+ end
@@ -261,12 +261,16 @@ module Quby
261
261
  end
262
262
 
263
263
  def option_as_json(option)
264
+ label = option.label || option.description
265
+ label = handle_html(label) if option.question.type != :select
266
+ description = !option.label ? nil : option.description
267
+ description = handle_html(description) if option.question.type != :select
264
268
  {
265
269
  type: 'option',
266
270
  key: option.key,
267
271
  value: option.question.type != :check_box && option.value,
268
- label: option.label, # TODO fallback on description and empty description if no label (after quby2 has been deployed)
269
- description: option.question.type == :select ? option.description : handle_html(option.description),
272
+ label:,
273
+ description:,
270
274
  questions: option.question.type != :select && option.questions.map{ question(_1) },
271
275
  hidden: option.hidden.presence,
272
276
  viewId: option.view_id
@@ -244,7 +244,7 @@ module Quby
244
244
  {
245
245
  key: option.key,
246
246
  value: (option.value.to_s unless question.type == :check_box),
247
- description: option.context_free_description || parse_markdown_and_strip_tags(option.description),
247
+ description: option.context_free_description || parse_markdown_and_strip_tags(option.label || option.description),
248
248
  child_question_keys: option.questions.map(&:key).presence,
249
249
  unchecks_all_others: question.try(:uncheck_all_option) && question.uncheck_all_option == option.key
250
250
  }.compact
@@ -304,8 +304,13 @@ module Quby
304
304
  end
305
305
  end
306
306
 
307
- def parse_markdown_and_strip_tags(markdown)
308
- strip_tags_without_html_encode(Quby::Compiler::MarkdownParser.new(markdown).to_html)
307
+ # Only parses markdown for layout v1
308
+ def parse_markdown_and_strip_tags(markdown_or_html)
309
+ if questionnaire.layout_version == :v2 # only supports markdown in `text`-method, which doesn't show up in roqua.json
310
+ strip_tags_without_html_encode(markdown_or_html)
311
+ else
312
+ strip_tags_without_html_encode(Quby::Compiler::MarkdownParser.new(markdown_or_html).to_html)
313
+ end
309
314
  end
310
315
 
311
316
  def strip_tags_without_html_encode(html)
@@ -1,5 +1,5 @@
1
1
  module Quby
2
2
  module Compiler
3
- VERSION = "0.5.26"
3
+ VERSION = "0.5.28"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quby-compiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.26
4
+ version: 0.5.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-07-29 00:00:00.000000000 Z
10
+ date: 2025-08-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activemodel
@@ -151,6 +151,7 @@ files:
151
151
  - lib/quby/compiler/dsl/charting/radar_chart_builder.rb
152
152
  - lib/quby/compiler/dsl/helpers.rb
153
153
  - lib/quby/compiler/dsl/info_block_builder.rb
154
+ - lib/quby/compiler/dsl/merge(values(:v_1, :v_2), values(v_4).rb
154
155
  - lib/quby/compiler/dsl/panel_builder.rb
155
156
  - lib/quby/compiler/dsl/question_builder.rb
156
157
  - lib/quby/compiler/dsl/questionnaire_builder.rb