metanorma-ietf 2.3.1 → 2.3.2

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: '0009480252eb6b82ab3d795efc48b9fc3146a1790dedb07ab40b415c0085dde2'
4
- data.tar.gz: 1ff86a356bcc191b07b5302439f88b134b69a02a9ab26db48fe85feed2a16cfa
3
+ metadata.gz: e7a4d62d9ba4598f0bc4a7e03e9a2685e157adf44914b5513d75e664e625a9e2
4
+ data.tar.gz: 56a43f317ad9b8feae2469e3a0f27ccb4c52960611df53ab6a6678989c5504c5
5
5
  SHA512:
6
- metadata.gz: 061bf172d476731cd3885c49b825751c8d68dc458f0d591b48df8b47cc0f5fffcb2016e1934f3ade8f21fa55f13ecdcd68a2b2590eea198870ad3c0d7af9a95a
7
- data.tar.gz: 684c4f1e6f6701fa54bf3b903a28ada68be7352fe99b4aa23036c6bd96c288cf15628b778689adfb516154bdb5cfaaf130ebf8bae8e5a78090bc08a7a157a439
6
+ metadata.gz: 05e58bfa09d771d279fd9358253d27ce7be451ae8cfb223aac2438dc4971f51736a630d983d435ab33140ac6ba52898b71f2b9dcb5efc7852d4e488e33cd2205
7
+ data.tar.gz: 6ecac088b4b00f92fbf1044d7345d50cc391280b0576cf300b7980e2edf5cf4ec4c1fd2a44b8a9e4b9b583dcbf763f894094c54696121af0e1fa1c90919e6684
data/.rubocop.yml CHANGED
@@ -10,5 +10,3 @@ AllCops:
10
10
  DisplayCopNames: false
11
11
  StyleGuideCopsOnly: false
12
12
  TargetRubyVersion: 2.4
13
- Rails:
14
- Enabled: true
@@ -876,6 +876,18 @@
876
876
  </zeroOrMore>
877
877
  </element>
878
878
  </define>
879
+ <define name="pagebreak">
880
+ <element name="pagebreak">
881
+ <optional>
882
+ <attribute name="orientation">
883
+ <choice>
884
+ <value>landscape</value>
885
+ <value>portrait</value>
886
+ </choice>
887
+ </attribute>
888
+ </optional>
889
+ </element>
890
+ </define>
879
891
  </include>
880
892
  <!-- end overrides -->
881
893
  <define name="colgroup">
@@ -943,8 +955,170 @@
943
955
  <ref name="permission"/>
944
956
  <ref name="imagemap"/>
945
957
  <ref name="svgmap"/>
958
+ <ref name="inputform"/>
959
+ </choice>
960
+ </define>
961
+ <define name="inputform">
962
+ <element name="form">
963
+ <attribute name="id">
964
+ <data type="ID"/>
965
+ </attribute>
966
+ <attribute name="name"/>
967
+ <attribute name="action"/>
968
+ <zeroOrMore>
969
+ <choice>
970
+ <ref name="TextElement"/>
971
+ <ref name="FormInput"/>
972
+ </choice>
973
+ </zeroOrMore>
974
+ </element>
975
+ </define>
976
+ <define name="FormInput">
977
+ <choice>
978
+ <ref name="input"/>
979
+ <ref name="formlabel"/>
980
+ <ref name="select"/>
981
+ <ref name="textarea"/>
982
+ </choice>
983
+ </define>
984
+ <define name="InputType">
985
+ <choice>
986
+ <value>button</value>
987
+ <value>checkbox</value>
988
+ <value>date</value>
989
+ <value>file</value>
990
+ <value>password</value>
991
+ <value>radio</value>
992
+ <value>submit</value>
993
+ <value>text</value>
946
994
  </choice>
947
995
  </define>
996
+ <define name="input">
997
+ <element name="input">
998
+ <attribute name="type">
999
+ <ref name="InputType"/>
1000
+ </attribute>
1001
+ <optional>
1002
+ <attribute name="checked">
1003
+ <data type="boolean"/>
1004
+ </attribute>
1005
+ </optional>
1006
+ <optional>
1007
+ <attribute name="disabled">
1008
+ <data type="boolean"/>
1009
+ </attribute>
1010
+ </optional>
1011
+ <optional>
1012
+ <attribute name="readonly">
1013
+ <data type="boolean"/>
1014
+ </attribute>
1015
+ </optional>
1016
+ <optional>
1017
+ <attribute name="maxlength">
1018
+ <data type="int"/>
1019
+ </attribute>
1020
+ </optional>
1021
+ <optional>
1022
+ <attribute name="minlength">
1023
+ <data type="int"/>
1024
+ </attribute>
1025
+ </optional>
1026
+ <optional>
1027
+ <attribute name="name"/>
1028
+ </optional>
1029
+ <optional>
1030
+ <attribute name="value"/>
1031
+ </optional>
1032
+ <optional>
1033
+ <attribute name="id">
1034
+ <data type="ID"/>
1035
+ </attribute>
1036
+ </optional>
1037
+ </element>
1038
+ </define>
1039
+ <define name="formlabel">
1040
+ <element name="label">
1041
+ <attribute name="for">
1042
+ <data type="IDREF"/>
1043
+ </attribute>
1044
+ <zeroOrMore>
1045
+ <ref name="PureTextElement"/>
1046
+ </zeroOrMore>
1047
+ </element>
1048
+ </define>
1049
+ <define name="select">
1050
+ <element name="select">
1051
+ <optional>
1052
+ <attribute name="name"/>
1053
+ </optional>
1054
+ <optional>
1055
+ <attribute name="value"/>
1056
+ </optional>
1057
+ <optional>
1058
+ <attribute name="id">
1059
+ <data type="ID"/>
1060
+ </attribute>
1061
+ </optional>
1062
+ <optional>
1063
+ <attribute name="disabled">
1064
+ <data type="boolean"/>
1065
+ </attribute>
1066
+ </optional>
1067
+ <optional>
1068
+ <attribute name="multiple">
1069
+ <data type="boolean"/>
1070
+ </attribute>
1071
+ </optional>
1072
+ <optional>
1073
+ <attribute name="size">
1074
+ <data type="int"/>
1075
+ </attribute>
1076
+ </optional>
1077
+ <oneOrMore>
1078
+ <ref name="option"/>
1079
+ </oneOrMore>
1080
+ </element>
1081
+ </define>
1082
+ <define name="option">
1083
+ <element name="option">
1084
+ <optional>
1085
+ <attribute name="disabled">
1086
+ <data type="boolean"/>
1087
+ </attribute>
1088
+ </optional>
1089
+ <optional>
1090
+ <attribute name="value"/>
1091
+ </optional>
1092
+ <zeroOrMore>
1093
+ <ref name="PureTextElement"/>
1094
+ </zeroOrMore>
1095
+ </element>
1096
+ </define>
1097
+ <define name="textarea">
1098
+ <element name="textarea">
1099
+ <optional>
1100
+ <attribute name="name"/>
1101
+ </optional>
1102
+ <optional>
1103
+ <attribute name="value"/>
1104
+ </optional>
1105
+ <optional>
1106
+ <attribute name="id">
1107
+ <data type="ID"/>
1108
+ </attribute>
1109
+ </optional>
1110
+ <optional>
1111
+ <attribute name="rows">
1112
+ <data type="int"/>
1113
+ </attribute>
1114
+ </optional>
1115
+ <optional>
1116
+ <attribute name="cols">
1117
+ <data type="int"/>
1118
+ </attribute>
1119
+ </optional>
1120
+ </element>
1121
+ </define>
948
1122
  <define name="bibliography">
949
1123
  <element name="bibliography">
950
1124
  <oneOrMore>
@@ -1,11 +1,14 @@
1
1
  require "metanorma/processor"
2
2
  require "tempfile"
3
3
 
4
+ require "isodoc/ietf/rfc_convert"
5
+
4
6
  module Metanorma
5
7
  module Ietf
6
- class Processor < Metanorma::Processor
8
+ RfcConvert = ::IsoDoc::Ietf::RfcConvert
7
9
 
8
- def initialize
10
+ class Processor < Metanorma::Processor
11
+ def initialize # rubocop:disable Lint/MissingSuper
9
12
  @short = :ietf
10
13
  @input_format = :asciidoc
11
14
  @asciidoctor_backend = :ietf
@@ -18,7 +21,7 @@ module Metanorma
18
21
  rfc: "rfc.xml",
19
22
  html: "html",
20
23
  txt: "txt",
21
- pdf: "pdf"
24
+ pdf: "pdf",
22
25
  }
23
26
  end
24
27
 
@@ -26,15 +29,15 @@ module Metanorma
26
29
  "Metanorma::Ietf #{::Metanorma::Ietf::VERSION}"
27
30
  end
28
31
 
29
- def extract_options(isodocxml)
32
+ def extract_options(_isodocxml)
30
33
  {}
31
34
  end
32
35
 
33
36
  # From mislav: https://stackoverflow.com/questions/2108727
34
37
  # /which-in-ruby-checking-if-program-exists-in-path-from-ruby
35
38
  def which(cmd)
36
- exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
37
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
39
+ exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
40
+ ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
38
41
  exts.each do |ext|
39
42
  exe = File.join(path, "#{cmd}#{ext}")
40
43
  return exe if File.executable?(exe) && !File.directory?(exe)
@@ -43,49 +46,43 @@ module Metanorma
43
46
  nil
44
47
  end
45
48
 
46
- def use_presentation_xml(ext)
49
+ def use_presentation_xml(_ext)
47
50
  false
48
51
  end
49
52
 
50
- def xml2rfc_present?
51
- !which("xml2rfc").nil?
53
+ def check_xml2rfc_present?(format)
54
+ if which("xml2rfc").nil?
55
+ raise "[metanorma-ietf] Fatal: unable to generate #{format}," \
56
+ " the command `xml2rfc` is not found in path."
57
+ end
52
58
  end
53
59
 
54
- def output(isodoc_node, inname, outname, format, options={})
60
+ def output(isodoc_node, inname, outname, format, options = {})
55
61
  case format
56
62
  when :rfc
57
63
  outname ||= inname.sub(/\.xml$/, ".rfc.xml")
58
- IsoDoc::Ietf::RfcConvert.new(options).convert(inname, isodoc_node, nil, outname)
64
+ RfcConvert.new(options).convert(inname, isodoc_node, nil, outname)
59
65
  @done_rfc = true
60
-
61
66
  when :txt, :pdf, :html
62
- unless xml2rfc_present?
63
- warn "[metanorma-ietf] Error: unable to generate #{format}, the command `xml2rfc` is not found in path."
64
- return
65
- end
67
+ xml2rfc(isodoc_node, inname, outname, format, options)
68
+ else
69
+ super
70
+ end
71
+ end
66
72
 
67
- rfcname = inname.sub(/\.xml$/, ".rfc.xml")
68
- unless @done_rfc && File.exist?(rfcname)
69
- output(isodoc_node, inname, rfcname, :rfc, options)
70
- end
73
+ def xml2rfc(isodoc_node, inname, outname, format, options)
74
+ check_xml2rfc_present?(format)
71
75
 
72
- outext = case format
73
- when :txt then ".txt"
74
- when :pdf then ".pdf"
75
- when :html then ".html"
76
- end
76
+ rfcname = inname.sub(/\.xml$/, ".rfc.xml")
77
+ unless @done_rfc && File.exist?(rfcname)
78
+ output(isodoc_node, inname, rfcname, :rfc, options)
79
+ end
77
80
 
78
- outflag = case format
79
- when :txt then "--text"
80
- when :pdf then "--pdf"
81
- when :html then "--html"
82
- end
81
+ outext = { txt: ".txt", pdf: ".pdf", html: ".html" }[format]
82
+ outflag = { txt: "--text", pdf: "--pdf", html: "--html" }[format]
83
83
 
84
- outname ||= inname.sub(/\.xml$/, outext)
85
- system("xml2rfc #{outflag} #{rfcname} -o #{outname}")
86
- else
87
- super
88
- end
84
+ outname ||= inname.sub(/\.xml$/, outext)
85
+ system("xml2rfc #{outflag} #{rfcname} -o #{outname}")
89
86
  end
90
87
  end
91
88
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "2.3.1".freeze
3
+ VERSION = "2.3.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ietf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-26 00:00:00.000000000 Z
11
+ date: 2021-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: isodoc