|
| 1 | +require "spec_helper" |
| 2 | + |
| 3 | +RSpec.describe Relaton::Render::JIS do |
| 4 | + it "renders home standard, ISO" do |
| 5 | + input = <<~INPUT |
| 6 | + <bibitem type="standard" schema-version="v1.2.1"> |
| 7 | + <fetched>2022-12-22</fetched> |
| 8 | + <title type="title-intro" format="text/plain" language="en" script="Latn">Latex, rubber</title> |
| 9 | + <title type="title-main" format="text/plain" language="en" script="Latn">Determination of total solids content</title> |
| 10 | + <title type="main" format="text/plain" language="en" script="Latn">Latex, rubber - Determination of total solids content</title> |
| 11 | + <title type="title-intro" format="text/plain" language="fr" script="Latn">Latex de caoutchouc</title> |
| 12 | + <title type="title-main" format="text/plain" language="fr" script="Latn">Détermination des matières solides totales</title> |
| 13 | + <title type="main" format="text/plain" language="fr" script="Latn">Latex de caoutchouc - Détermination des matières solides totales</title> |
| 14 | + <uri type="src">https://www.iso.org/standard/61884.html</uri> |
| 15 | + <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri> |
| 16 | + <uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri> |
| 17 | + <docidentifier type="ISO" primary="true">ISO 124</docidentifier> |
| 18 | + <docidentifier type="URN">urn:iso:std:iso:124:ed-7</docidentifier> |
| 19 | + <docnumber>124</docnumber> |
| 20 | + <contributor> |
| 21 | + <role type="publisher"/> |
| 22 | + <organization> |
| 23 | + <name>International Organization for Standardization</name> |
| 24 | + <abbreviation>ISO</abbreviation> |
| 25 | + <uri>www.iso.org</uri> |
| 26 | + </organization> |
| 27 | + </contributor> |
| 28 | + <edition>7</edition> |
| 29 | + <language>en</language> |
| 30 | + <language>fr</language> |
| 31 | + <script>Latn</script> |
| 32 | + <status> |
| 33 | + <stage>90</stage> |
| 34 | + <substage>93</substage> |
| 35 | + </status> |
| 36 | + <copyright> |
| 37 | + <from>2014</from> |
| 38 | + <owner> |
| 39 | + <organization> |
| 40 | + <name>ISO</name> |
| 41 | + </organization> |
| 42 | + </owner> |
| 43 | + </copyright> |
| 44 | + <relation type="obsoletes"> |
| 45 | + <bibitem type="standard"> |
| 46 | + <formattedref format="text/plain">ISO 124:2011</formattedref> |
| 47 | + <docidentifier type="ISO" primary="true">ISO 124:2011</docidentifier> |
| 48 | + </bibitem> |
| 49 | + </relation> |
| 50 | + <place>Geneva</place> |
| 51 | + <ext schema-version="v1.0.0"> |
| 52 | + <doctype>international-standard</doctype> |
| 53 | + <editorialgroup> |
| 54 | + <technical-committee number="45" type="TC">Raw materials (including latex) for use in the rubber industry</technical-committee> |
| 55 | + </editorialgroup> |
| 56 | + <ics> |
| 57 | + <code>83.040.10</code> |
| 58 | + <text>Latex and raw rubber</text> |
| 59 | + </ics> |
| 60 | + <structuredidentifier type="ISO"> |
| 61 | + <project-number>ISO 124</project-number> |
| 62 | + </structuredidentifier> |
| 63 | + </ext> |
| 64 | + </bibitem> |
| 65 | + INPUT |
| 66 | + output = <<~OUTPUT |
| 67 | + <formattedref><em><span class='stddocTitle'>Latex, rubber - Determination of total solids content</span></em></formattedref> |
| 68 | + OUTPUT |
| 69 | + p = renderer |
| 70 | + expect(p.render(input)) |
| 71 | + .to be_equivalent_to output |
| 72 | + end |
| 73 | + |
| 74 | + it "renders home standard, JIS" do |
| 75 | + input = <<~INPUT |
| 76 | + <bibdata type="standard" schema-version="v1.2.9"> |
| 77 | + <fetched>2024-07-22</fetched> |
| 78 | + <title format="text/plain" language="ja" script="Jpan">電気及び関連分野―信号指定及び接続指定</title> |
| 79 | + <title format="text/plain" language="en" script="Lant">Designations for signals and connections</title> |
| 80 | + <uri type="src">https://webdesk.jsa.or.jp/books/W11M0090/index/?bunsyo_id=JIS+C+0450%3A2004</uri> |
| 81 | + <uri type="pdf">https://webdesk.jsa.or.jp/preview/pre_jis_c_00450_000_000_2004_j_ed10_ch.pdf</uri> |
| 82 | + <docidentifier type="JIS" primary="true">JIS C 0450</docidentifier> |
| 83 | + <docnumber>C0450</docnumber> |
| 84 | + <contributor> |
| 85 | + <role type="author"/> |
| 86 | + <organization> |
| 87 | + <name language="ja" script="Jpan">一般財団法人 日本規格協会</name> |
| 88 | + </organization> |
| 89 | + </contributor> |
| 90 | + <language>ja</language> |
| 91 | + <script>Jpan</script> |
| 92 | + <status> |
| 93 | + <stage>valid</stage> |
| 94 | + </status> |
| 95 | + <relation type="instanceOf"> |
| 96 | + <bibitem type="standard"> |
| 97 | + <fetched>2024-07-22</fetched> |
| 98 | + <title format="text/plain" language="ja" script="Jpan">電気及び関連分野―信号指定及び接続指定</title> |
| 99 | + <title format="text/plain" language="en" script="Lant">Designations for signals and connections</title> |
| 100 | + <uri type="src">https://webdesk.jsa.or.jp/books/W11M0090/index/?bunsyo_id=JIS+C+0450%3A2004</uri> |
| 101 | + <uri type="pdf">https://webdesk.jsa.or.jp/preview/pre_jis_c_00450_000_000_2004_j_ed10_ch.pdf</uri> |
| 102 | + <docidentifier type="JIS" primary="true">JIS C 0450:2004</docidentifier> |
| 103 | + <docnumber>C0450</docnumber> |
| 104 | + <date type="issued"> |
| 105 | + <on>2004-12-20</on> |
| 106 | + </date> |
| 107 | + <date type="confirmed"> |
| 108 | + <on>2020-06-22</on> |
| 109 | + </date> |
| 110 | + <contributor> |
| 111 | + <role type="author"/> |
| 112 | + <organization> |
| 113 | + <name language="ja" script="Jpan">一般財団法人 日本規格協会</name> |
| 114 | + </organization> |
| 115 | + </contributor> |
| 116 | + <language>ja</language> |
| 117 | + <script>Jpan</script> |
| 118 | + <abstract format="text/plain" language="ja" script="Jpan">電気及びその関連分野の信号及び接続を識別する指定並びに名称の組合せに関する規則について規定。</abstract> |
| 119 | + <status> |
| 120 | + <stage>valid</stage> |
| 121 | + </status> |
| 122 | + </bibitem> |
| 123 | + </relation> |
| 124 | + <ext schema-version="v0.0.1"> |
| 125 | + <doctype>japanese-industrial-standard</doctype> |
| 126 | + <editorialgroup> |
| 127 | + <technical-committee>一般財団法人 日本規格協会</technical-committee> |
| 128 | + </editorialgroup> |
| 129 | + <ics> |
| 130 | + <code>29.020</code> |
| 131 | + <text>Electrical engineering in general</text> |
| 132 | + </ics> |
| 133 | + <structuredidentifier type="JIS"> |
| 134 | + <docnumber/> |
| 135 | + </structuredidentifier> |
| 136 | + </ext> |
| 137 | + </bibdata> |
| 138 | + INPUT |
| 139 | + output = <<~OUTPUT |
| 140 | + <formattedref><smallcap>一般財団法人 日本規格協会</smallcap>. <em><span class='stddocTitle'>電気及び関連分野―信号指定及び接続指定</span></em>. 有効です. 入手可能: <span class='biburl'><link target='https://webdesk.jsa.or.jp/books/W11M0090/index/?bunsyo_id=JIS+C+0450%3A2004'>https://webdesk.jsa.or.jp/books/W11M0090/index/?bunsyo_id=JIS+C+0450%3A2004</link></span>.</formattedref> |
| 141 | + OUTPUT |
| 142 | + p = renderer |
| 143 | + expect(p.render(input)) |
| 144 | + .to be_equivalent_to output |
| 145 | + end |
| 146 | + |
| 147 | + it "renders external standard, IETF" do |
| 148 | + input = <<~INPUT |
| 149 | + <bibitem type="standard"> |
| 150 | + <fetched>2022-12-22</fetched> |
| 151 | + <title type="main" format="text/plain">Intellectual Property Rights in IETF Technology</title> |
| 152 | + <uri type="src">https://www.rfc-editor.org/info/rfc3979</uri> |
| 153 | + <docidentifier type="IETF" primary="true">RFC 3979</docidentifier> |
| 154 | + <docidentifier type="DOI">10.17487/RFC3979</docidentifier> |
| 155 | + <docnumber>RFC3979</docnumber> |
| 156 | + <date type="published"> |
| 157 | + <on>2005-03</on> |
| 158 | + </date> |
| 159 | + <contributor> |
| 160 | + <role type="editor"/> |
| 161 | + <person> |
| 162 | + <name> |
| 163 | + <completename language="en" script="Latn">S. Bradner</completename> |
| 164 | + </name> |
| 165 | + </person> |
| 166 | + </contributor> |
| 167 | + <contributor> |
| 168 | + <role type="authorizer"/> |
| 169 | + <organization> |
| 170 | + <name>RFC Series</name> |
| 171 | + </organization> |
| 172 | + </contributor> |
| 173 | + <language>en</language> |
| 174 | + <script>Latn</script> |
| 175 | + <abstract format="text/html" language="en" script="Latn"> |
| 176 | + <p>The IETF policies about Intellectual Property Rights (IPR), such as patent rights, relative to technologies developed in the IETF are designed to ensure that IETF working groups and participants have as much information about any IPR constraints on a technical proposal as possible. The policies are also intended to benefit the Internet community and the public at large, while respecting the legitimate rights of IPR holders. This memo details the IETF policies concerning IPR related to technology worked on within the IETF. It also describes the objectives that the policies are designed to meet. This memo updates RFC 2026 and, with RFC 3978, replaces Section 10 of RFC 2026. This memo also updates paragraph 4 of Section 3.2 of RFC 2028, for all purposes, including reference [2] in RFC 2418. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</p> |
| 177 | + </abstract> |
| 178 | + <relation type="obsoletedBy"> |
| 179 | + <bibitem> |
| 180 | + <formattedref format="text/plain">RFC8179</formattedref> |
| 181 | + <docidentifier type="IETF" primary="true">RFC8179</docidentifier> |
| 182 | + </bibitem> |
| 183 | + </relation> |
| 184 | + <relation type="updates"> |
| 185 | + <bibitem> |
| 186 | + <formattedref format="text/plain">RFC2026</formattedref> |
| 187 | + <docidentifier type="IETF" primary="true">RFC2026</docidentifier> |
| 188 | + </bibitem> |
| 189 | + </relation> |
| 190 | + <relation type="updates"> |
| 191 | + <bibitem> |
| 192 | + <formattedref format="text/plain">RFC2028</formattedref> |
| 193 | + <docidentifier type="IETF" primary="true">RFC2028</docidentifier> |
| 194 | + </bibitem> |
| 195 | + </relation> |
| 196 | + <series> |
| 197 | + <title format="text/plain">RFC</title> |
| 198 | + <number>3979</number> |
| 199 | + </series> |
| 200 | + <keyword>ipr</keyword> |
| 201 | + <keyword>copyright</keyword> |
| 202 | + <ext schema-version="v1.0.0"> |
| 203 | + <editorialgroup> |
| 204 | + <committee>ipr</committee> |
| 205 | + </editorialgroup> |
| 206 | + </ext> |
| 207 | + </bibitem> |
| 208 | + INPUT |
| 209 | + output = <<~OUTPUT |
| 210 | + <formattedref><smallcap>S. Bradner</smallcap>. <em><span class='stddocTitle'>Intellectual Property Rights in IETF Technology</span></em>. RFC Series. 入手可能: <span class='biburl'><link target='https://www.rfc-editor.org/info/rfc3979'>https://www.rfc-editor.org/info/rfc3979</link></span>.</formattedref> |
| 211 | + OUTPUT |
| 212 | + p = renderer |
| 213 | + expect(p.render(input)) |
| 214 | + .to be_equivalent_to output |
| 215 | + end |
| 216 | + |
| 217 | + private |
| 218 | + |
| 219 | + def renderer |
| 220 | + Relaton::Render::JIS::General |
| 221 | + .new("language" => "ja", "script" => "Jpan", |
| 222 | + "i18nhash" => IsoDoc::JIS::PresentationXMLConvert.new({}) |
| 223 | + .i18n_init("ja", "Jpan", nil).get) |
| 224 | + end |
| 225 | +end |
0 commit comments