metanorma-nist 0.1.0 → 0.1.1

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: 7e2116c19f5daea959497e608d2a19599645a3b827aa4d50f218e8bcc873ff6a
4
- data.tar.gz: 47edb544f7e6379637bc9165c5c9b920cb3221c4f16407161edc531661bb8867
3
+ metadata.gz: 75fb9c059ae72c09ccc3d401bb440d5763ec93d1dcb4cba42e93e7f981fd79a4
4
+ data.tar.gz: 067a9a1a8ea310fc7948c3423bbd693fd5a5e63ff03b7dab5fe50dcd605f2150
5
5
  SHA512:
6
- metadata.gz: e607121469a2d8d3c96579459a4ab6266a0a2f53dfcbe0bf0c2c35dfe53edf62501d44ba9b124e4c757dfbf940fdfba03cbc91b8ef2dec28509530f524bc2d34
7
- data.tar.gz: 885616b6cc0281fa7f06c97c70e7859631ee5857a7543f0c8fa4d9142d3a0406eea165a461e44b6ebf6a06f21b4056652f9f5802ff61c03970ed6d00f745709e
6
+ metadata.gz: 678c8b927d107d784d1fddaabeb650f0e03b74b558e1ef4c75f8f959a94d96f00414ea76d4db8666f3ff502ffdfa349db9ca728fffa01a01d78a5a21ea86a8c2
7
+ data.tar.gz: 26f7b3f77ea5226a601b4dee47d4c7c6b62d3967e0840c713b0e2521d6cfc5da37b30b3398bf51001b403302cdb94acb5381c6f7140f9b57f5dda53ff7e6cc2e
@@ -166,13 +166,14 @@ module Iso690Render
166
166
  doc.at("./series[not(@type)]") ||
167
167
  doc.at("./series")
168
168
  return "" unless s
169
- f = s.at("./formattedref") and return r.text
169
+ f = s.at("./formattedref")
170
+ return f.text if f
170
171
  t = s.at("./title")
171
172
  a = s.at("./abbreviation")
172
173
  n = s.at("./number")
173
174
  p = s.at("./partnumber")
174
175
  dn = doc.at("./docnumber")
175
- rev = doc&.at(".//edition")&.text.sub(/^Revision /, "")
176
+ rev = doc&.at(".//edition")&.text&.sub(/^Revision /, "")
176
177
  ret = ""
177
178
  if t
178
179
  title = included(type) ? wrap(t.text, " <I>", "</I>") : wrap(t.text, " ", "")
@@ -191,7 +192,6 @@ module Iso690Render
191
192
 
192
193
  def self.standardidentifier(doc)
193
194
  ret = []
194
- require "byebug"; byebug
195
195
  doc.xpath("./docidentifier").each do |id|
196
196
  next if %w(nist-mr nist-long).include? id["type"]
197
197
  ret << standardidentifier1(id)
@@ -201,7 +201,6 @@ module Iso690Render
201
201
 
202
202
  def self.standardidentifier1(id)
203
203
  r = ""
204
- require "byebug"; byebug
205
204
  r += "#{id['type']} " if id["type"] and
206
205
  !%w(ISO IEC NIST).include? id["type"]
207
206
  r += id.text
@@ -257,17 +256,33 @@ module Iso690Render
257
256
 
258
257
  def self.monthyr(isodate)
259
258
  return nil if isodate.nil?
260
- DateTime.parse(isodate).localize(:en).to_additional_s("yMMMM")
259
+ arr = isodate.split("-")
260
+ date = if arr.size == 2
261
+ DateTime.new(*arr.map(&:to_i))
262
+ else
263
+ DateTime.parse(isodate)
264
+ end
265
+ date.localize(:en).to_additional_s("yMMMM")
261
266
  end
262
267
 
263
268
  def self.mmddyyyy(isodate)
264
269
  return nil if isodate.nil?
265
- Date.parse(isodate).strftime("%m-%d-%Y")
270
+ arr = isodate.split("-")
271
+ date = if arr.size == 2
272
+ Date.new(*arr.map(&:to_i)).strftime("%m-%Y")
273
+ else
274
+ Date.parse(isodate).strftime("%m-%d-%Y")
275
+ end
266
276
  end
267
277
 
268
278
  def self.MMMddyyyy(isodate)
269
279
  return nil if isodate.nil?
270
- Date.parse(isodate).strftime("%B %d, %Y")
280
+ arr = isodate.split("-")
281
+ date = if arr.size == 2
282
+ Date.new(*arr.map(&:to_i)).strftime("%B, %Y")
283
+ else
284
+ Date.parse(isodate).strftime("%B %d, %Y")
285
+ end
271
286
  end
272
287
 
273
288
  def self.draft(doc)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module NIST
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-nist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-16 00:00:00.000000000 Z
11
+ date: 2019-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor