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 +4 -4
- data/.rubocop.yml +0 -2
- data/lib/asciidoctor/ietf/isodoc.rng +174 -0
- data/lib/metanorma/ietf/processor.rb +32 -35
- data/lib/metanorma/ietf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7a4d62d9ba4598f0bc4a7e03e9a2685e157adf44914b5513d75e664e625a9e2
|
4
|
+
data.tar.gz: 56a43f317ad9b8feae2469e3a0f27ccb4c52960611df53ab6a6678989c5504c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05e58bfa09d771d279fd9358253d27ce7be451ae8cfb223aac2438dc4971f51736a630d983d435ab33140ac6ba52898b71f2b9dcb5efc7852d4e488e33cd2205
|
7
|
+
data.tar.gz: 6ecac088b4b00f92fbf1044d7345d50cc391280b0576cf300b7980e2edf5cf4ec4c1fd2a44b8a9e4b9b583dcbf763f894094c54696121af0e1fa1c90919e6684
|
data/.rubocop.yml
CHANGED
@@ -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
|
-
|
8
|
+
RfcConvert = ::IsoDoc::Ietf::RfcConvert
|
7
9
|
|
8
|
-
|
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(
|
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[
|
37
|
-
ENV[
|
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(
|
49
|
+
def use_presentation_xml(_ext)
|
47
50
|
false
|
48
51
|
end
|
49
52
|
|
50
|
-
def
|
51
|
-
|
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
|
-
|
64
|
+
RfcConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
59
65
|
@done_rfc = true
|
60
|
-
|
61
66
|
when :txt, :pdf, :html
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
67
|
+
xml2rfc(isodoc_node, inname, outname, format, options)
|
68
|
+
else
|
69
|
+
super
|
70
|
+
end
|
71
|
+
end
|
66
72
|
|
67
|
-
|
68
|
-
|
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
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
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
|
-
|
79
|
-
|
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
|
-
|
85
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2021-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: isodoc
|