Code Monkey home page Code Monkey logo

pubid-jis's Introduction

JIS publication identifiers ("JIS PubID")

Purpose

This gem implements a mechanism to parse and utilize JIS publication identifiers.

Use cases to support

  1. generate updated PubID

Usage

Identifier creation

Basic usage of the pubid-jis gem starts with the Identifier#create method.

require "pubid-jis"

pubid = Pubid::Jis::Identifier.create(number: 1234, series: "A", part: 1, year: 1999, language: "E")
pubid.to_s

=> "JIS A 1234-1:1999(E)"

pubid-jis's People

Contributors

camobap avatar mico avatar opoudjis avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pubid-jis's Issues

Parse JIS identifiers

Specification

JIS identifiers are of the following patterns:

Undated reference:

JIS {series in alphabet} {4 digit or 5 digit number}
JIS {series in alphabet} {4 digit or 5 digit number}-{part}
JIS {series in alphabet} {4 digit or 5 digit number}-{part}-{subpart}

(the subpart format is only for adopted standards from IEC)

Dated reference:

JIS {series in alphabet} {4 digit or 5 digit number}:{year}
JIS {series in alphabet} {4 digit or 5 digit number}-{part}:{year}
JIS {series in alphabet} {4 digit or 5 digit number}-{part}-{subpart}:{year}

Reference number:

JIS ... (J)
JIS ... (E)

The single language code at the end is used for the Reference number on the front page.

The key in parsing JIS identifiers is that the "whitespace", "dash" and "colons" can be in the Japanese character format (in addition to the normal characters we support):

  • Whitespace   (ideographic space U+3000)
  • Colon (full width colon U+FF1A)
  • Dash (HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK U+FF70)

Example identifiers

JIS A 8426:2019
JIS B 0001
JIS B 0021
JIS B 0022
JIS B 0023
JIS B 0024
JIS B 0031
JIS B 0060
JIS B 0125
JIS B 0401
JIS B 0601
JIS B 0621
JIS B 0641-1
JIS C 0450
JIS C 0617
JIS C 60063
JIS C 60068
JIS C 6065:2015
JIS C 61000
JIS C 61000-3-2:2011
JIS C 61000-3-2
JIS C 61000-4-2
JIS C 61000-4-3
JIS K 0050
JIS K 0211 
JIS P 0138
JIS Q 0064
JIS Q 0073 
JIS Q 14021
JIS Q 14050 
JIS Q 17000
JIS Q 27001
JIS Q 9000 
JIS Q 9001
JIS Q 9001
JIS S 0101
JIS S 0103
JIS X 0001 
JIS X 0121
JIS X 0304 
JIS X 0412
JIS X 0807
JIS Z 0150
JIS Z 7253
JIS Z 8000
JIS Z 8000-1
JIS Z 8000-3
JIS Z 8000-6
JIS Z 8000-8
JIS Z 8002
JIS Z 8002:2006
JIS Z 8050
JIS Z 8051
JIS Z 8071
JIS Z 8101
JIS Z 8101-1 
JIS Z 8101-2 
JIS Z 8101-3 
JIS Z 8102 
JIS Z 8103 
JIS Z 8105 
JIS Z 8106 
JIS Z 8113
JIS Z 8114
JIS Z 8115
JIS Z 8116
JIS Z 8120
JIS Z 8126
JIS Z 8141 
JIS Z 8201
JIS Z 8204
JIS Z 8206
JIS Z 8208
JIS Z 8210
JIS Z 8221-1
JIS Z 8221-1
JIS Z 8221-2
JIS Z 8221-3
JIS Z 8222-1
JIS Z 8222-1
JIS Z 8301:2011
JIS Z 8301:2019 
JIS Z 8310
JIS Z 8312
JIS Z 8313
JIS Z 8314
JIS Z 8315
JIS Z 8316
JIS Z 8317-1
JIS Z 8318
JIS Z 8321
JIS Z 8322
JIS Z 8401
JIS Z 8404-1
JIS Z 8405
JIS Z 8601
JIS Z 8617
JIS Z 8703
JIS Z 8731
JIS Z 8735
JIS Z 9080
JIS Z 9101
JIS Z 9104
JIS Z 8301:2019(J)
JIS Z 8301:2019(E)

Allow rendering option to strip initial "JIS"

From #8

I will be stripping the initial JIS from the identifier. As far as I can tell, that is universal to JIS identifiers, and does not cause any issues.

I believe it would make sense for pubid-jis to provide a mechanism to not give the JIS prefix, because it is one of the basic needs on the cover page.

(with_publisher: false) applies recursively in Amendments

In the case of

params = {:number=>"3", :type=>:amd, :publisher=>"JIS", :year=>"2022", :base=>Pubid::Jis::Identifier.create(**{:publisher=>"JIS", :number=>"1000", :year=>1980, :series=>"Z", :part=>"1", :all_parts=>false, :edition=>1})}
Pubid::Jis::Identifier.create(**params).to_s(with_publisher:false)

we are getting:

"JIS Z 1000-1:1980/AMD 3:2022"

That is incorrect: the "JIS" needs to be stripped recursively on rendering from the base identifier as well, so that the result is:

"Z 1000-1:1980/AMD 3:2022"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.