openstax_kitchen 3.1.0 → 3.2.0

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
  SHA256:
3
- metadata.gz: 994e6a3d5161afbcd853fe2b432e7aeb80bf2390d4d7b7ae8463e6da8ce21f15
4
- data.tar.gz: 7c276963aaa777b1e6116b98a9af0659f8b4e9c1491a3fe968bd9f15fc46f61c
3
+ metadata.gz: 4e855f5598f3d3a425d670a828131a25605935b01ce0de9c38cceea7bb27703f
4
+ data.tar.gz: 50b1a58be988e539a031390ee7387a1249a1ddcdc2734c3b9a0d9c9dfa43b426
5
5
  SHA512:
6
- metadata.gz: a0041d04e8a1e39295c21ed0884db3e1b838edac90c7c317409b3499e1e2d5744450d26ccb1518a55c7cf6ec39a35b278e03781b8f9933486d789583b9c39bdd
7
- data.tar.gz: f9207ee80e17ae3035d2c29cca11f4d59e10afc7193e73f751763fb27987477e7cffcc914166927d196484c0c82767d3c1302bca92a64098d4eb2674edb83843
6
+ metadata.gz: 844384ec30da9c49e15026d1e5604e7248ef3a2806bbd242be398a04d6d8bddb8924225036dc3f4cfd0a0033fa27fa0bb975768317ddae012684bcf01e5b7483
7
+ data.tar.gz: 3f68410be5d1f0e7b06a8f8b618f44cd022a35d6e5ab6ce76a785eb5f702cd22ef2312cba218d8d0fb0628ce13d04cffc023fc647bee16c6ebe6ab566c2f862e
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [3.2.0] - 2021-04-19
10
+
11
+ * Adds a decorating option of equation numbers on `BakeEquations` (minor)
12
+
9
13
  ## [3.1.0] - 2021-04-19
10
14
 
11
15
  * Add the ability to copy an element's ID to `ElementBase` (minor)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openstax_kitchen (3.1.0)
4
+ openstax_kitchen (3.2.0)
5
5
  activesupport
6
6
  i18n
7
7
  nokogiri
@@ -3,7 +3,7 @@
3
3
  module Kitchen
4
4
  module Directions
5
5
  module BakeEquations
6
- def self.v1(book:)
6
+ def self.v1(book:, number_decorator: :none)
7
7
  book.chapters.search('[data-type="equation"]:not(.unnumbered)').each do |eq|
8
8
  chapter = eq.ancestor(:chapter)
9
9
  number = "#{chapter.count_in(:book)}.#{eq.count_in(:chapter)}"
@@ -12,11 +12,21 @@ module Kitchen
12
12
  equation_label = "#{I18n.t(:equation)} #{number}"
13
13
  book.document.pantry(name: :link_text).store equation_label, label: eq.id
14
14
 
15
+ decorated_number =
16
+ case number_decorator
17
+ when :none
18
+ number
19
+ when :parentheses
20
+ "(#{number})"
21
+ else
22
+ raise "Unsupported number_decorator '#{number_decorator}'"
23
+ end
24
+
15
25
  # Bake the equation
16
26
  eq.append(child:
17
27
  <<~HTML
18
28
  <div class="os-equation-number">
19
- <span class="os-number">#{number}</span>
29
+ <span class="os-number">#{decorated_number}</span>
20
30
  </div>
21
31
  HTML
22
32
  )
@@ -3,5 +3,5 @@
3
3
  # A library for modifying the structure of OpenStax book XML.
4
4
  #
5
5
  module Kitchen
6
- VERSION = '3.1.0'
6
+ VERSION = '3.2.0'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_kitchen
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky