nanoc 2.1.6 → 2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +3 -221
- data/Rakefile +9 -51
- data/bin/nanoc +5 -2
- data/lib/nanoc.rb +9 -31
- data/lib/nanoc/base.rb +26 -0
- data/lib/nanoc/base/core_ext.rb +2 -0
- data/lib/nanoc/base/filter.rb +11 -41
- data/lib/nanoc/base/layout.rb +1 -5
- data/lib/nanoc/base/page_rep.rb +1 -1
- data/lib/nanoc/base/proxies.rb +5 -0
- data/lib/nanoc/base/site.rb +4 -2
- data/lib/nanoc/binary_filters.rb +1 -0
- data/lib/nanoc/cli.rb +9 -1
- data/lib/nanoc/cli/base.rb +41 -129
- data/lib/nanoc/cli/commands.rb +10 -0
- data/lib/nanoc/cli/commands/autocompile.rb +1 -1
- data/lib/nanoc/cli/commands/compile.rb +51 -13
- data/lib/nanoc/cli/commands/create_layout.rb +1 -1
- data/lib/nanoc/cli/commands/create_page.rb +1 -1
- data/lib/nanoc/cli/commands/create_site.rb +1 -1
- data/lib/nanoc/cli/commands/create_template.rb +1 -1
- data/lib/nanoc/cli/commands/help.rb +1 -1
- data/lib/nanoc/cli/commands/info.rb +1 -1
- data/lib/nanoc/cli/commands/switch.rb +1 -1
- data/lib/nanoc/cli/commands/update.rb +1 -1
- data/lib/nanoc/cli/logger.rb +13 -7
- data/lib/nanoc/data_sources.rb +2 -0
- data/lib/nanoc/data_sources/filesystem.rb +3 -38
- data/lib/nanoc/extra.rb +6 -0
- data/lib/nanoc/extra/core_ext.rb +2 -0
- data/lib/nanoc/extra/vcses.rb +5 -0
- data/lib/nanoc/filters.rb +14 -0
- data/lib/nanoc/filters/erb.rb +3 -2
- data/lib/nanoc/filters/haml.rb +1 -1
- data/lib/nanoc/filters/markaby.rb +0 -1
- data/lib/nanoc/filters/rainpress.rb +13 -0
- data/lib/nanoc/filters/relativize_paths.rb +25 -0
- data/lib/nanoc/filters/sass.rb +1 -0
- data/lib/nanoc/helpers.rb +9 -0
- data/lib/nanoc/helpers/blogging.rb +55 -12
- data/lib/nanoc/helpers/filtering.rb +54 -0
- data/lib/nanoc/helpers/link_to.rb +40 -0
- data/lib/nanoc/helpers/text.rb +38 -0
- data/lib/nanoc/helpers/xml_sitemap.rb +3 -2
- data/lib/nanoc/routers.rb +3 -0
- data/vendor/cri/ChangeLog +0 -0
- data/vendor/cri/LICENSE +19 -0
- data/vendor/cri/NEWS +0 -0
- data/vendor/cri/README +4 -0
- data/vendor/cri/Rakefile +25 -0
- data/vendor/cri/lib/cri.rb +12 -0
- data/vendor/cri/lib/cri/base.rb +153 -0
- data/{lib/nanoc/cli → vendor/cri/lib/cri}/command.rb +5 -6
- data/vendor/cri/lib/cri/core_ext.rb +8 -0
- data/vendor/cri/lib/cri/core_ext/string.rb +41 -0
- data/{lib/nanoc/cli → vendor/cri/lib/cri}/option_parser.rb +35 -17
- data/vendor/cri/test/test_base.rb +6 -0
- data/vendor/cri/test/test_command.rb +6 -0
- data/vendor/cri/test/test_core_ext.rb +21 -0
- data/vendor/cri/test/test_option_parser.rb +279 -0
- data/vendor/mime-types/lib/mime/types.rb +1558 -0
- metadata +45 -9
- data/lib/nanoc/base/enhancements.rb +0 -14
- data/lib/nanoc/cli/cli.rb +0 -16
- data/lib/nanoc/cli/ext.rb +0 -37
@@ -0,0 +1,21 @@
|
|
1
|
+
class Cri::CoreExtTest < MiniTest::Unit::TestCase
|
2
|
+
|
3
|
+
def test_string_wrap_and_indent
|
4
|
+
assert_equal(
|
5
|
+
"Lorem ipsum dolor sit amet, consectetur\n" +
|
6
|
+
"adipisicing elit, sed do eiusmod tempor\n" +
|
7
|
+
"incididunt ut labore et dolore magna\n" +
|
8
|
+
"aliqua.",
|
9
|
+
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.".wrap_and_indent(40, 0)
|
10
|
+
)
|
11
|
+
|
12
|
+
assert_equal(
|
13
|
+
" Lorem ipsum dolor sit amet,\n" +
|
14
|
+
" consectetur adipisicing elit, sed\n" +
|
15
|
+
" do eiusmod tempor incididunt ut\n" +
|
16
|
+
" labore et dolore magna aliqua.",
|
17
|
+
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.".wrap_and_indent(36, 4)
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,279 @@
|
|
1
|
+
class Cri::OptionParserTest < MiniTest::Unit::TestCase
|
2
|
+
|
3
|
+
def test_parse_without_options
|
4
|
+
input = %w( foo bar baz )
|
5
|
+
definitions = []
|
6
|
+
|
7
|
+
result = Cri::OptionParser.parse(input, definitions)
|
8
|
+
|
9
|
+
assert_equal({}, result[:options])
|
10
|
+
assert_equal([ 'foo', 'bar', 'baz' ], result[:arguments])
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_parse_with_invalid_option
|
14
|
+
input = %w( foo -x )
|
15
|
+
definitions = []
|
16
|
+
|
17
|
+
result = nil
|
18
|
+
|
19
|
+
assert_raises(Cri::OptionParser::IllegalOptionError) do
|
20
|
+
result = Cri::OptionParser.parse(input, definitions)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_parse_without_options
|
25
|
+
input = %w( foo )
|
26
|
+
definitions = [
|
27
|
+
{ :long => 'aaa', :short => 'a', :argument => :forbidden }
|
28
|
+
]
|
29
|
+
|
30
|
+
result = Cri::OptionParser.parse(input, definitions)
|
31
|
+
|
32
|
+
assert(!result[:options][:aaa])
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_parse_with_long_valueless_option
|
36
|
+
input = %w( foo --aaa bar )
|
37
|
+
definitions = [
|
38
|
+
{ :long => 'aaa', :short => 'a', :argument => :forbidden }
|
39
|
+
]
|
40
|
+
|
41
|
+
result = Cri::OptionParser.parse(input, definitions)
|
42
|
+
|
43
|
+
assert(result[:options][:aaa])
|
44
|
+
assert_equal([ 'foo', 'bar' ], result[:arguments])
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_parse_with_long_valueful_option
|
48
|
+
input = %w( foo --aaa xxx bar )
|
49
|
+
definitions = [
|
50
|
+
{ :long => 'aaa', :short => 'a', :argument => :required }
|
51
|
+
]
|
52
|
+
|
53
|
+
result = Cri::OptionParser.parse(input, definitions)
|
54
|
+
|
55
|
+
assert_equal({ :aaa => 'xxx' }, result[:options])
|
56
|
+
assert_equal([ 'foo', 'bar' ], result[:arguments])
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_parse_with_long_valueful_equalsign_option
|
60
|
+
input = %w( foo --aaa=xxx bar )
|
61
|
+
definitions = [
|
62
|
+
{ :long => 'aaa', :short => 'a', :argument => :required }
|
63
|
+
]
|
64
|
+
|
65
|
+
result = Cri::OptionParser.parse(input, definitions)
|
66
|
+
|
67
|
+
assert_equal({ :aaa => 'xxx' }, result[:options])
|
68
|
+
assert_equal([ 'foo', 'bar' ], result[:arguments])
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_parse_with_long_valueful_option_with_missing_value
|
72
|
+
input = %w( foo --aaa )
|
73
|
+
definitions = [
|
74
|
+
{ :long => 'aaa', :short => 'a', :argument => :required }
|
75
|
+
]
|
76
|
+
|
77
|
+
result = nil
|
78
|
+
|
79
|
+
assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
|
80
|
+
result = Cri::OptionParser.parse(input, definitions)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_parse_with_two_long_valueful_options
|
85
|
+
input = %w( foo --all --port 2 )
|
86
|
+
definitions = [
|
87
|
+
{ :long => 'all', :short => 'a', :argument => :required },
|
88
|
+
{ :long => 'port', :short => 'p', :argument => :required }
|
89
|
+
]
|
90
|
+
|
91
|
+
result = nil
|
92
|
+
|
93
|
+
assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
|
94
|
+
result = Cri::OptionParser.parse(input, definitions)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_parse_with_long_valueless_option_with_optional_value
|
99
|
+
input = %w( foo --aaa )
|
100
|
+
definitions = [
|
101
|
+
{ :long => 'aaa', :short => 'a', :argument => :optional }
|
102
|
+
]
|
103
|
+
|
104
|
+
result = Cri::OptionParser.parse(input, definitions)
|
105
|
+
|
106
|
+
assert(result[:options][:aaa])
|
107
|
+
assert_equal([ 'foo' ], result[:arguments])
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_parse_with_long_valueful_option_with_optional_value
|
111
|
+
input = %w( foo --aaa xxx )
|
112
|
+
definitions = [
|
113
|
+
{ :long => 'aaa', :short => 'a', :argument => :optional }
|
114
|
+
]
|
115
|
+
|
116
|
+
result = Cri::OptionParser.parse(input, definitions)
|
117
|
+
|
118
|
+
assert_equal({ :aaa => 'xxx' }, result[:options])
|
119
|
+
assert_equal([ 'foo' ], result[:arguments])
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_parse_with_long_valueless_option_with_optional_value_and_more_options
|
123
|
+
input = %w( foo --aaa -b -c )
|
124
|
+
definitions = [
|
125
|
+
{ :long => 'aaa', :short => 'a', :argument => :optional },
|
126
|
+
{ :long => 'bbb', :short => 'b', :argument => :forbidden },
|
127
|
+
{ :long => 'ccc', :short => 'c', :argument => :forbidden }
|
128
|
+
]
|
129
|
+
|
130
|
+
result = Cri::OptionParser.parse(input, definitions)
|
131
|
+
|
132
|
+
assert(result[:options][:aaa])
|
133
|
+
assert(result[:options][:bbb])
|
134
|
+
assert(result[:options][:ccc])
|
135
|
+
assert_equal([ 'foo' ], result[:arguments])
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_parse_with_short_valueless_options
|
139
|
+
input = %w( foo -a bar )
|
140
|
+
definitions = [
|
141
|
+
{ :long => 'aaa', :short => 'a', :argument => :forbidden }
|
142
|
+
]
|
143
|
+
|
144
|
+
result = Cri::OptionParser.parse(input, definitions)
|
145
|
+
|
146
|
+
assert(result[:options][:aaa])
|
147
|
+
assert_equal([ 'foo', 'bar' ], result[:arguments])
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_parse_with_short_valueful_option_with_missing_value
|
151
|
+
input = %w( foo -a )
|
152
|
+
definitions = [
|
153
|
+
{ :long => 'aaa', :short => 'a', :argument => :required }
|
154
|
+
]
|
155
|
+
|
156
|
+
result = nil
|
157
|
+
|
158
|
+
assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
|
159
|
+
result = Cri::OptionParser.parse(input, definitions)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_parse_with_short_combined_valueless_options
|
164
|
+
input = %w( foo -abc bar )
|
165
|
+
definitions = [
|
166
|
+
{ :long => 'aaa', :short => 'a', :argument => :forbidden },
|
167
|
+
{ :long => 'bbb', :short => 'b', :argument => :forbidden },
|
168
|
+
{ :long => 'ccc', :short => 'c', :argument => :forbidden }
|
169
|
+
]
|
170
|
+
|
171
|
+
result = Cri::OptionParser.parse(input, definitions)
|
172
|
+
|
173
|
+
assert(result[:options][:aaa])
|
174
|
+
assert(result[:options][:bbb])
|
175
|
+
assert(result[:options][:ccc])
|
176
|
+
assert_equal([ 'foo', 'bar' ], result[:arguments])
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_parse_with_short_combined_valueful_options_with_missing_value
|
180
|
+
input = %w( foo -abc bar )
|
181
|
+
definitions = [
|
182
|
+
{ :long => 'aaa', :short => 'a', :argument => :required },
|
183
|
+
{ :long => 'bbb', :short => 'b', :argument => :forbidden },
|
184
|
+
{ :long => 'ccc', :short => 'c', :argument => :forbidden }
|
185
|
+
]
|
186
|
+
|
187
|
+
result = nil
|
188
|
+
|
189
|
+
assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
|
190
|
+
result = Cri::OptionParser.parse(input, definitions)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_parse_with_two_short_valueful_options
|
195
|
+
input = %w( foo -a -p 2 )
|
196
|
+
definitions = [
|
197
|
+
{ :long => 'all', :short => 'a', :argument => :required },
|
198
|
+
{ :long => 'port', :short => 'p', :argument => :required }
|
199
|
+
]
|
200
|
+
|
201
|
+
result = nil
|
202
|
+
|
203
|
+
assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
|
204
|
+
result = Cri::OptionParser.parse(input, definitions)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
def test_parse_with_short_valueless_option_with_optional_value
|
209
|
+
input = %w( foo -a )
|
210
|
+
definitions = [
|
211
|
+
{ :long => 'aaa', :short => 'a', :argument => :optional }
|
212
|
+
]
|
213
|
+
|
214
|
+
result = Cri::OptionParser.parse(input, definitions)
|
215
|
+
|
216
|
+
assert(result[:options][:aaa])
|
217
|
+
assert_equal([ 'foo' ], result[:arguments])
|
218
|
+
end
|
219
|
+
|
220
|
+
def test_parse_with_short_valueful_option_with_optional_value
|
221
|
+
input = %w( foo -a xxx )
|
222
|
+
definitions = [
|
223
|
+
{ :long => 'aaa', :short => 'a', :argument => :optional }
|
224
|
+
]
|
225
|
+
|
226
|
+
result = Cri::OptionParser.parse(input, definitions)
|
227
|
+
|
228
|
+
assert_equal({ :aaa => 'xxx' }, result[:options])
|
229
|
+
assert_equal([ 'foo' ], result[:arguments])
|
230
|
+
end
|
231
|
+
|
232
|
+
def test_parse_with_short_valueless_option_with_optional_value_and_more_options
|
233
|
+
input = %w( foo -a -b -c )
|
234
|
+
definitions = [
|
235
|
+
{ :long => 'aaa', :short => 'a', :argument => :optional },
|
236
|
+
{ :long => 'bbb', :short => 'b', :argument => :forbidden },
|
237
|
+
{ :long => 'ccc', :short => 'c', :argument => :forbidden }
|
238
|
+
]
|
239
|
+
|
240
|
+
result = Cri::OptionParser.parse(input, definitions)
|
241
|
+
|
242
|
+
assert(result[:options][:aaa])
|
243
|
+
assert(result[:options][:bbb])
|
244
|
+
assert(result[:options][:ccc])
|
245
|
+
assert_equal([ 'foo' ], result[:arguments])
|
246
|
+
end
|
247
|
+
|
248
|
+
def test_parse_with_single_hyphen
|
249
|
+
input = %w( foo - bar )
|
250
|
+
definitions = []
|
251
|
+
|
252
|
+
result = Cri::OptionParser.parse(input, definitions)
|
253
|
+
|
254
|
+
assert_equal({}, result[:options])
|
255
|
+
assert_equal([ 'foo', '-', 'bar' ], result[:arguments])
|
256
|
+
end
|
257
|
+
|
258
|
+
def test_parse_with_end_marker
|
259
|
+
input = %w( foo bar -- -x --yyy -abc )
|
260
|
+
definitions = []
|
261
|
+
|
262
|
+
result = Cri::OptionParser.parse(input, definitions)
|
263
|
+
|
264
|
+
assert_equal({}, result[:options])
|
265
|
+
assert_equal([ 'foo', 'bar', '-x', '--yyy', '-abc' ], result[:arguments])
|
266
|
+
end
|
267
|
+
|
268
|
+
def test_parse_with_end_marker_between_option_key_and_value
|
269
|
+
input = %w( foo --aaa -- zzz )
|
270
|
+
definitions = [
|
271
|
+
{ :long => 'aaa', :short => 'a', :argument => :required }
|
272
|
+
]
|
273
|
+
|
274
|
+
assert_raises(Cri::OptionParser::OptionRequiresAnArgumentError) do
|
275
|
+
result = Cri::OptionParser.parse(input, definitions)
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
end
|
@@ -0,0 +1,1558 @@
|
|
1
|
+
#--
|
2
|
+
# MIME::Types for Ruby
|
3
|
+
# Version 1.15
|
4
|
+
#
|
5
|
+
# Copyright (c) 2002 - 2004 Austin Ziegler
|
6
|
+
#
|
7
|
+
# $Id: types.rb,v 1.4 2006/02/12 21:27:22 austin Exp $
|
8
|
+
#
|
9
|
+
# The ChangeLog contains all details on revisions.
|
10
|
+
#++
|
11
|
+
|
12
|
+
# The namespace for MIME applications, tools, and libraries.
|
13
|
+
module MIME
|
14
|
+
# Reflects a MIME Content-Type which is in invalid format (e.g., it isn't
|
15
|
+
# in the form of type/subtype).
|
16
|
+
class InvalidContentType < RuntimeError; end
|
17
|
+
|
18
|
+
# The definition of one MIME content-type.
|
19
|
+
#
|
20
|
+
# == Usage
|
21
|
+
# require 'mime/types'
|
22
|
+
#
|
23
|
+
# plaintext = MIME::Types['text/plain']
|
24
|
+
# print plaintext.media_type # => 'text'
|
25
|
+
# print plaintext.sub_type # => 'plain'
|
26
|
+
#
|
27
|
+
# puts plaintext.extensions.join(" ") # => 'asc txt c cc h hh cpp'
|
28
|
+
#
|
29
|
+
# puts plaintext.encoding # => 8bit
|
30
|
+
# puts plaintext.binary? # => false
|
31
|
+
# puts plaintext.ascii? # => true
|
32
|
+
# puts plaintext == 'text/plain' # => true
|
33
|
+
# puts MIME::Type.simplified('x-appl/x-zip') # => 'appl/zip'
|
34
|
+
#
|
35
|
+
class Type
|
36
|
+
VERSION = '1.15'
|
37
|
+
|
38
|
+
include Comparable
|
39
|
+
|
40
|
+
MEDIA_TYPE_RE = %r{([-\w.+]+)/([-\w.+]*)}o #:nodoc:
|
41
|
+
UNREG_RE = %r{[Xx]-}o #:nodoc:
|
42
|
+
ENCODING_RE = %r{(?:base64|7bit|8bit|quoted\-printable)}o #:nodoc:
|
43
|
+
PLATFORM_RE = %r|#{RUBY_PLATFORM}|o #:nodoc:
|
44
|
+
|
45
|
+
SIGNATURES = %w(application/pgp-keys application/pgp
|
46
|
+
application/pgp-signature application/pkcs10
|
47
|
+
application/pkcs7-mime application/pkcs7-signature
|
48
|
+
text/vcard) #:nodoc:
|
49
|
+
|
50
|
+
IANA_URL = "http://www.iana.org/assignments/media-types/%s/%s"
|
51
|
+
RFC_URL = "http://rfc-editor.org/rfc/rfc%s.txt"
|
52
|
+
DRAFT_URL = "http://datatracker.ietf.org/public/idindex.cgi?command=id_details&filename=%s"
|
53
|
+
LTSW_URL = "http://www.ltsw.se/knbase/internet/%s.htp"
|
54
|
+
CONTACT_URL = "http://www.iana.org/assignments/contact-people.htm#%s"
|
55
|
+
|
56
|
+
# Returns +true+ if the simplified type matches the current
|
57
|
+
def like?(other)
|
58
|
+
if other.respond_to?(:simplified)
|
59
|
+
@simplified == other.simplified
|
60
|
+
else
|
61
|
+
@simplified == Type.simplified(other)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Compares the MIME::Type against the exact content type or the
|
66
|
+
# simplified type (the simplified type will be used if comparing against
|
67
|
+
# something that can be treated as a String with #to_s).
|
68
|
+
def <=>(other) #:nodoc:
|
69
|
+
if other.respond_to?(:content_type)
|
70
|
+
@content_type.downcase <=> other.content_type.downcase
|
71
|
+
elsif other.respond_to?(:to_s)
|
72
|
+
@simplified <=> Type.simplified(other.to_s)
|
73
|
+
else
|
74
|
+
@content_type.downcase <=> other.downcase
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Returns +true+ if the other object is a MIME::Type and the content
|
79
|
+
# types match.
|
80
|
+
def eql?(other) #:nodoc:
|
81
|
+
other.kind_of?(MIME::Type) and self == other
|
82
|
+
end
|
83
|
+
|
84
|
+
# Returns the whole MIME content-type string.
|
85
|
+
#
|
86
|
+
# text/plain => text/plain
|
87
|
+
# x-chemical/x-pdb => x-chemical/x-pdb
|
88
|
+
attr_reader :content_type
|
89
|
+
# Returns the media type of the simplified MIME type.
|
90
|
+
#
|
91
|
+
# text/plain => text
|
92
|
+
# x-chemical/x-pdb => chemical
|
93
|
+
attr_reader :media_type
|
94
|
+
# Returns the media type of the unmodified MIME type.
|
95
|
+
#
|
96
|
+
# text/plain => text
|
97
|
+
# x-chemical/x-pdb => x-chemical
|
98
|
+
attr_reader :raw_media_type
|
99
|
+
# Returns the sub-type of the simplified MIME type.
|
100
|
+
#
|
101
|
+
# text/plain => plain
|
102
|
+
# x-chemical/x-pdb => pdb
|
103
|
+
attr_reader :sub_type
|
104
|
+
# Returns the media type of the unmodified MIME type.
|
105
|
+
#
|
106
|
+
# text/plain => plain
|
107
|
+
# x-chemical/x-pdb => x-pdb
|
108
|
+
attr_reader :raw_sub_type
|
109
|
+
# The MIME types main- and sub-label can both start with <tt>x-</tt>,
|
110
|
+
# which indicates that it is a non-registered name. Of course, after
|
111
|
+
# registration this flag can disappear, adds to the confusing
|
112
|
+
# proliferation of MIME types. The simplified string has the <tt>x-</tt>
|
113
|
+
# removed and are translated to lowercase.
|
114
|
+
#
|
115
|
+
# text/plain => text/plain
|
116
|
+
# x-chemical/x-pdb => chemical/pdb
|
117
|
+
attr_reader :simplified
|
118
|
+
# The list of extensions which are known to be used for this MIME::Type.
|
119
|
+
# Non-array values will be coerced into an array with #to_a. Array
|
120
|
+
# values will be flattened and +nil+ values removed.
|
121
|
+
attr_accessor :extensions
|
122
|
+
remove_method :extensions= ;
|
123
|
+
def extensions=(ext) #:nodoc:
|
124
|
+
@extensions = ext.to_a.flatten.compact
|
125
|
+
end
|
126
|
+
|
127
|
+
# The encoding (7bit, 8bit, quoted-printable, or base64) required to
|
128
|
+
# transport the data of this content type safely across a network, which
|
129
|
+
# roughly corresponds to Content-Transfer-Encoding. A value of +nil+ or
|
130
|
+
# <tt>:default</tt> will reset the #encoding to the #default_encoding
|
131
|
+
# for the MIME::Type. Raises ArgumentError if the encoding provided is
|
132
|
+
# invalid.
|
133
|
+
#
|
134
|
+
# If the encoding is not provided on construction, this will be either
|
135
|
+
# 'quoted-printable' (for text/* media types) and 'base64' for eveything
|
136
|
+
# else.
|
137
|
+
attr_accessor :encoding
|
138
|
+
remove_method :encoding= ;
|
139
|
+
def encoding=(enc) #:nodoc:
|
140
|
+
if enc.nil? or enc == :default
|
141
|
+
@encoding = self.default_encoding
|
142
|
+
elsif enc =~ ENCODING_RE
|
143
|
+
@encoding = enc
|
144
|
+
else
|
145
|
+
raise ArgumentError, "The encoding must be nil, :default, base64, 7bit, 8bit, or quoted-printable."
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# The regexp for the operating system that this MIME::Type is specific
|
150
|
+
# to.
|
151
|
+
attr_accessor :system
|
152
|
+
remove_method :system= ;
|
153
|
+
def system=(os) #:nodoc:
|
154
|
+
if os.nil? or os.kind_of?(Regexp)
|
155
|
+
@system = os
|
156
|
+
else
|
157
|
+
@system = %r|#{os}|
|
158
|
+
end
|
159
|
+
end
|
160
|
+
# Returns the default encoding for the MIME::Type based on the media
|
161
|
+
# type.
|
162
|
+
attr_reader :default_encoding
|
163
|
+
remove_method :default_encoding
|
164
|
+
def default_encoding
|
165
|
+
(@media_type == 'text') ? 'quoted-printable' : 'base64'
|
166
|
+
end
|
167
|
+
|
168
|
+
# Returns the media type or types that should be used instead of this
|
169
|
+
# media type, if it is obsolete. If there is no replacement media type,
|
170
|
+
# or it is not obsolete, +nil+ will be returned.
|
171
|
+
attr_reader :use_instead
|
172
|
+
remove_method :use_instead
|
173
|
+
def use_instead
|
174
|
+
return nil unless @obsolete
|
175
|
+
@use_instead
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns +true+ if the media type is obsolete.
|
179
|
+
def obsolete?
|
180
|
+
@obsolete ? true : false
|
181
|
+
end
|
182
|
+
# Sets the obsolescence indicator for this media type.
|
183
|
+
attr_writer :obsolete
|
184
|
+
|
185
|
+
# The documentation for this MIME::Type. Documentation about media
|
186
|
+
# types will be found on a media type definition as a comment.
|
187
|
+
# Documentation will be found through #docs.
|
188
|
+
attr_accessor :docs
|
189
|
+
remove_method :docs= ;
|
190
|
+
def docs=(d)
|
191
|
+
if d
|
192
|
+
a = d.scan(%r{use-instead:#{MEDIA_TYPE_RE}})
|
193
|
+
|
194
|
+
if a.empty?
|
195
|
+
@use_instead = nil
|
196
|
+
else
|
197
|
+
@use_instead = a.map { |el| "#{el[0]}/#{el[1]}" }
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
# The encoded URL list for this MIME::Type. See #urls for
|
203
|
+
attr_accessor :url
|
204
|
+
# The decoded URL list for this MIME::Type.
|
205
|
+
# The special URL value IANA will be translated into:
|
206
|
+
# http://www.iana.org/assignments/media-types/<mediatype>/<subtype>
|
207
|
+
#
|
208
|
+
# The special URL value RFC### will be translated into:
|
209
|
+
# http://www.rfc-editor.org/rfc/rfc###.txt
|
210
|
+
#
|
211
|
+
# The special URL value DRAFT:name will be translated into:
|
212
|
+
# https://datatracker.ietf.org/public/idindex.cgi?
|
213
|
+
# command=id_detail&filename=<name>
|
214
|
+
#
|
215
|
+
# The special URL value LTSW will be translated into:
|
216
|
+
# http://www.ltsw.se/knbase/internet/<mediatype>.htp
|
217
|
+
#
|
218
|
+
# The special URL value [token] will be translated into:
|
219
|
+
# http://www.iana.org/assignments/contact-people.htm#<token>
|
220
|
+
#
|
221
|
+
# These values will be accessible through #url, which always returns an
|
222
|
+
# array.
|
223
|
+
def urls
|
224
|
+
@url.map { |el|
|
225
|
+
case el
|
226
|
+
when %r{^IANA$}
|
227
|
+
IANA_URL % [ @media_type, @sub_type ]
|
228
|
+
when %r{^RFC(\d+)$}
|
229
|
+
RFC_URL % $1
|
230
|
+
when %r{^DRAFT:(.+)$}
|
231
|
+
DRAFT_URL % $1
|
232
|
+
when %r{^LTSW$}
|
233
|
+
LTSW_URL % @media_type
|
234
|
+
when %r{^\[([^\]]+)\]}
|
235
|
+
CONTACT_URL % $1
|
236
|
+
else
|
237
|
+
el
|
238
|
+
end
|
239
|
+
}
|
240
|
+
end
|
241
|
+
|
242
|
+
class << self
|
243
|
+
# The MIME types main- and sub-label can both start with <tt>x-</tt>,
|
244
|
+
# which indicates that it is a non-registered name. Of course, after
|
245
|
+
# registration this flag can disappear, adds to the confusing
|
246
|
+
# proliferation of MIME types. The simplified string has the
|
247
|
+
# <tt>x-</tt> removed and are translated to lowercase.
|
248
|
+
def simplified(content_type)
|
249
|
+
matchdata = MEDIA_TYPE_RE.match(content_type)
|
250
|
+
|
251
|
+
if matchdata.nil?
|
252
|
+
simplified = nil
|
253
|
+
else
|
254
|
+
media_type = matchdata.captures[0].downcase.gsub(UNREG_RE, '')
|
255
|
+
subtype = matchdata.captures[1].downcase.gsub(UNREG_RE, '')
|
256
|
+
simplified = "#{media_type}/#{subtype}"
|
257
|
+
end
|
258
|
+
simplified
|
259
|
+
end
|
260
|
+
|
261
|
+
# Creates a MIME::Type from an array in the form of:
|
262
|
+
# [type-name, [extensions], encoding, system]
|
263
|
+
#
|
264
|
+
# +extensions+, +encoding+, and +system+ are optional.
|
265
|
+
#
|
266
|
+
# MIME::Type.from_array("application/x-ruby", ['rb'], '8bit')
|
267
|
+
# MIME::Type.from_array(["application/x-ruby", ['rb'], '8bit'])
|
268
|
+
#
|
269
|
+
# These are equivalent to:
|
270
|
+
#
|
271
|
+
# MIME::Type.new('application/x-ruby') do |t|
|
272
|
+
# t.extensions = %w(rb)
|
273
|
+
# t.encoding = '8bit'
|
274
|
+
# end
|
275
|
+
def from_array(*args) #:yields MIME::Type.new:
|
276
|
+
# Dereferences the array one level, if necessary.
|
277
|
+
args = args[0] if args[0].kind_of?(Array)
|
278
|
+
|
279
|
+
if args.size.between?(1, 8)
|
280
|
+
m = MIME::Type.new(args[0]) do |t|
|
281
|
+
t.extensions = args[1] if args.size > 1
|
282
|
+
t.encoding = args[2] if args.size > 2
|
283
|
+
t.system = args[3] if args.size > 3
|
284
|
+
t.obsolete = args[4] if args.size > 4
|
285
|
+
t.docs = args[5] if args.size > 5
|
286
|
+
t.url = args[6] if args.size > 6
|
287
|
+
t.registered = args[7] if args.size > 7
|
288
|
+
end
|
289
|
+
yield m if block_given?
|
290
|
+
else
|
291
|
+
raise ArgumentError, "Array provided must contain between one and eight elements."
|
292
|
+
end
|
293
|
+
m
|
294
|
+
end
|
295
|
+
|
296
|
+
# Creates a MIME::Type from a hash. Keys are case-insensitive,
|
297
|
+
# dashes may be replaced with underscores, and the internal Symbol
|
298
|
+
# of the lowercase-underscore version can be used as well. That is,
|
299
|
+
# Content-Type can be provided as content-type, Content_Type,
|
300
|
+
# content_type, or :content_type.
|
301
|
+
#
|
302
|
+
# Known keys are <tt>Content-Type</tt>,
|
303
|
+
# <tt>Content-Transfer-Encoding</tt>, <tt>Extensions</tt>, and
|
304
|
+
# <tt>System</tt>.
|
305
|
+
#
|
306
|
+
# MIME::Type.from_hash('Content-Type' => 'text/x-yaml',
|
307
|
+
# 'Content-Transfer-Encoding' => '8bit',
|
308
|
+
# 'System' => 'linux',
|
309
|
+
# 'Extensions' => ['yaml', 'yml'])
|
310
|
+
#
|
311
|
+
# This is equivalent to:
|
312
|
+
#
|
313
|
+
# MIME::Type.new('text/x-yaml') do |t|
|
314
|
+
# t.encoding = '8bit'
|
315
|
+
# t.system = 'linux'
|
316
|
+
# t.extensions = ['yaml', 'yml']
|
317
|
+
# end
|
318
|
+
def from_hash(hash) #:yields MIME::Type.new:
|
319
|
+
type = {}
|
320
|
+
hash.each_pair do |k, v|
|
321
|
+
type[k.to_s.tr('-A-Z', '_a-z').to_sym] = v
|
322
|
+
end
|
323
|
+
|
324
|
+
m = MIME::Type.new(type[:content_type]) do |t|
|
325
|
+
t.extensions = type[:extensions]
|
326
|
+
t.encoding = type[:content_transfer_encoding]
|
327
|
+
t.system = type[:system]
|
328
|
+
t.obsolete = type[:obsolete]
|
329
|
+
t.docs = type[:docs]
|
330
|
+
t.url = type[:url]
|
331
|
+
t.registered = type[:registered]
|
332
|
+
end
|
333
|
+
|
334
|
+
yield m if block_given?
|
335
|
+
m
|
336
|
+
end
|
337
|
+
|
338
|
+
# Essentially a copy constructor.
|
339
|
+
#
|
340
|
+
# MIME::Type.from_mime_type(plaintext)
|
341
|
+
#
|
342
|
+
# is equivalent to:
|
343
|
+
#
|
344
|
+
# MIME::Type.new(plaintext.content_type.dup) do |t|
|
345
|
+
# t.extensions = plaintext.extensions.dup
|
346
|
+
# t.system = plaintext.system.dup
|
347
|
+
# t.encoding = plaintext.encoding.dup
|
348
|
+
# end
|
349
|
+
def from_mime_type(mime_type) #:yields the new MIME::Type:
|
350
|
+
m = MIME::Type.new(mime_type.content_type.dup) do |t|
|
351
|
+
t.extensions = mime_type.extensions.dup
|
352
|
+
t.system = mime_type.system.dup
|
353
|
+
t.encoding = mime_type.encoding.dup
|
354
|
+
end
|
355
|
+
|
356
|
+
yield m if block_given?
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
# Builds a MIME::Type object from the provided MIME Content Type value
|
361
|
+
# (e.g., 'text/plain' or 'applicaton/x-eruby'). The constructed object
|
362
|
+
# is yielded to an optional block for additional configuration, such as
|
363
|
+
# associating extensions and encoding information.
|
364
|
+
def initialize(content_type) #:yields self:
|
365
|
+
matchdata = MEDIA_TYPE_RE.match(content_type)
|
366
|
+
|
367
|
+
if matchdata.nil?
|
368
|
+
raise InvalidContentType, "Invalid Content-Type provided ('#{content_type}')"
|
369
|
+
end
|
370
|
+
|
371
|
+
@content_type = content_type
|
372
|
+
@raw_media_type = matchdata.captures[0]
|
373
|
+
@raw_sub_type = matchdata.captures[1]
|
374
|
+
|
375
|
+
@simplified = MIME::Type.simplified(@content_type)
|
376
|
+
matchdata = MEDIA_TYPE_RE.match(@simplified)
|
377
|
+
@media_type = matchdata.captures[0]
|
378
|
+
@sub_type = matchdata.captures[1]
|
379
|
+
|
380
|
+
self.extensions = nil
|
381
|
+
self.encoding = :default
|
382
|
+
self.system = nil
|
383
|
+
self.registered = true
|
384
|
+
|
385
|
+
yield self if block_given?
|
386
|
+
end
|
387
|
+
|
388
|
+
# MIME content-types which are not regestered by IANA nor defined in
|
389
|
+
# RFCs are required to start with <tt>x-</tt>. This counts as well for
|
390
|
+
# a new media type as well as a new sub-type of an existing media
|
391
|
+
# type. If either the media-type or the content-type begins with
|
392
|
+
# <tt>x-</tt>, this method will return +false+.
|
393
|
+
def registered?
|
394
|
+
if (@raw_media_type =~ UNREG_RE) || (@raw_sub_type =~ UNREG_RE)
|
395
|
+
false
|
396
|
+
else
|
397
|
+
@registered
|
398
|
+
end
|
399
|
+
end
|
400
|
+
attr_writer :registered #:nodoc:
|
401
|
+
|
402
|
+
# MIME types can be specified to be sent across a network in particular
|
403
|
+
# formats. This method returns +true+ when the MIME type encoding is set
|
404
|
+
# to <tt>base64</tt>.
|
405
|
+
def binary?
|
406
|
+
@encoding == 'base64'
|
407
|
+
end
|
408
|
+
|
409
|
+
# MIME types can be specified to be sent across a network in particular
|
410
|
+
# formats. This method returns +false+ when the MIME type encoding is
|
411
|
+
# set to <tt>base64</tt>.
|
412
|
+
def ascii?
|
413
|
+
not binary?
|
414
|
+
end
|
415
|
+
|
416
|
+
# Returns +true+ when the simplified MIME type is in the list of known
|
417
|
+
# digital signatures.
|
418
|
+
def signature?
|
419
|
+
SIGNATURES.include?(@simplified.downcase)
|
420
|
+
end
|
421
|
+
|
422
|
+
# Returns +true+ if the MIME::Type is specific to an operating system.
|
423
|
+
def system?
|
424
|
+
not @system.nil?
|
425
|
+
end
|
426
|
+
|
427
|
+
# Returns +true+ if the MIME::Type is specific to the current operating
|
428
|
+
# system as represented by RUBY_PLATFORM.
|
429
|
+
def platform?
|
430
|
+
system? and (RUBY_PLATFORM =~ @system)
|
431
|
+
end
|
432
|
+
|
433
|
+
# Returns +true+ if the MIME::Type specifies an extension list,
|
434
|
+
# indicating that it is a complete MIME::Type.
|
435
|
+
def complete?
|
436
|
+
not @extensions.empty?
|
437
|
+
end
|
438
|
+
|
439
|
+
# Returns the MIME type as a string.
|
440
|
+
def to_s
|
441
|
+
@content_type
|
442
|
+
end
|
443
|
+
|
444
|
+
# Returns the MIME type as a string for implicit conversions.
|
445
|
+
def to_str
|
446
|
+
@content_type
|
447
|
+
end
|
448
|
+
|
449
|
+
# Returns the MIME type as an array suitable for use with
|
450
|
+
# MIME::Type.from_array.
|
451
|
+
def to_a
|
452
|
+
[ @content_type, @extensions, @encoding, @system, @obsolete, @docs,
|
453
|
+
@url, registered? ]
|
454
|
+
end
|
455
|
+
|
456
|
+
# Returns the MIME type as an array suitable for use with
|
457
|
+
# MIME::Type.from_hash.
|
458
|
+
def to_hash
|
459
|
+
{ 'Content-Type' => @content_type,
|
460
|
+
'Content-Transfer-Encoding' => @encoding,
|
461
|
+
'Extensions' => @extensions,
|
462
|
+
'System' => @system,
|
463
|
+
'Obsolete' => @obsolete,
|
464
|
+
'Docs' => @docs,
|
465
|
+
'URL' => @url,
|
466
|
+
'Registered' => registered?,
|
467
|
+
}
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
# = MIME::Types
|
472
|
+
# MIME types are used in MIME-compliant communications, as in e-mail or
|
473
|
+
# HTTP traffic, to indicate the type of content which is transmitted.
|
474
|
+
# MIME::Types provides the ability for detailed information about MIME
|
475
|
+
# entities (provided as a set of MIME::Type objects) to be determined and
|
476
|
+
# used programmatically. There are many types defined by RFCs and vendors,
|
477
|
+
# so the list is long but not complete; don't hesitate to ask to add
|
478
|
+
# additional information. This library follows the IANA collection of MIME
|
479
|
+
# types (see below for reference).
|
480
|
+
#
|
481
|
+
# == Description
|
482
|
+
# MIME types are used in MIME entities, as in email or HTTP traffic. It is
|
483
|
+
# useful at times to have information available about MIME types (or,
|
484
|
+
# inversely, about files). A MIME::Type stores the known information about
|
485
|
+
# one MIME type.
|
486
|
+
#
|
487
|
+
# == Usage
|
488
|
+
# require 'mime/types'
|
489
|
+
#
|
490
|
+
# plaintext = MIME::Types['text/plain']
|
491
|
+
# print plaintext.media_type # => 'text'
|
492
|
+
# print plaintext.sub_type # => 'plain'
|
493
|
+
#
|
494
|
+
# puts plaintext.extensions.join(" ") # => 'asc txt c cc h hh cpp'
|
495
|
+
#
|
496
|
+
# puts plaintext.encoding # => 8bit
|
497
|
+
# puts plaintext.binary? # => false
|
498
|
+
# puts plaintext.ascii? # => true
|
499
|
+
# puts plaintext.obsolete? # => false
|
500
|
+
# puts plaintext.registered? # => true
|
501
|
+
# puts plaintext == 'text/plain' # => true
|
502
|
+
# puts MIME::Type.simplified('x-appl/x-zip') # => 'appl/zip'
|
503
|
+
#
|
504
|
+
# This module is built to conform to the MIME types of RFCs 2045 and 2231.
|
505
|
+
# It follows the official IANA registry at
|
506
|
+
# http://www.iana.org/assignments/media-types/ and
|
507
|
+
# ftp://ftp.iana.org/assignments/media-types with some unofficial types
|
508
|
+
# added from the the collection at
|
509
|
+
# http://www.ltsw.se/knbase/internet/mime.htp
|
510
|
+
#
|
511
|
+
# This is originally based on Perl MIME::Types by Mark Overmeer.
|
512
|
+
#
|
513
|
+
# = Author
|
514
|
+
# Copyright:: Copyright (c) 2002 - 2006 by Austin Ziegler
|
515
|
+
# <austin@rubyforge.org>
|
516
|
+
# Version:: 1.15
|
517
|
+
# Based On:: Perl
|
518
|
+
# MIME::Types[http://search.cpan.org/author/MARKOV/MIME-Types-1.15/MIME/Types.pm],
|
519
|
+
# Copyright (c) 2001 - 2005 by Mark Overmeer
|
520
|
+
# <mimetypes@overmeer.net>.
|
521
|
+
# Licence:: Ruby's, Perl Artistic, or GPL version 2 (or later)
|
522
|
+
# See Also:: http://www.iana.org/assignments/media-types/
|
523
|
+
# http://www.ltsw.se/knbase/internet/mime.htp
|
524
|
+
#
|
525
|
+
class Types
|
526
|
+
# The released version of Ruby MIME::Types
|
527
|
+
VERSION = '1.15'
|
528
|
+
|
529
|
+
# The data version.
|
530
|
+
attr_reader :data_version
|
531
|
+
|
532
|
+
def initialize(data_version = nil)
|
533
|
+
@type_variants = Hash.new { |h, k| h[k] = [] }
|
534
|
+
@extension_index = Hash.new { |h, k| h[k] = [] }
|
535
|
+
end
|
536
|
+
|
537
|
+
def add_type_variant(mime_type) #:nodoc:
|
538
|
+
@type_variants[mime_type.simplified] << mime_type
|
539
|
+
end
|
540
|
+
|
541
|
+
def index_extensions(mime_type) #:nodoc:
|
542
|
+
mime_type.extensions.each { |ext| @extension_index[ext] << mime_type }
|
543
|
+
end
|
544
|
+
|
545
|
+
@__types__ = self.new(VERSION)
|
546
|
+
|
547
|
+
# Returns a list of MIME::Type objects, which may be empty. The optional
|
548
|
+
# flag parameters are :complete (finds only complete MIME::Type objects)
|
549
|
+
# and :platform (finds only MIME::Types for the current platform). It is
|
550
|
+
# possible for multiple matches to be returned for either type (in the
|
551
|
+
# example below, 'text/plain' returns two values -- one for the general
|
552
|
+
# case, and one for VMS systems.
|
553
|
+
#
|
554
|
+
# puts "\nMIME::Types['text/plain']"
|
555
|
+
# MIME::Types['text/plain'].each { |t| puts t.to_a.join(", ") }
|
556
|
+
#
|
557
|
+
# puts "\nMIME::Types[/^image/, :complete => true]"
|
558
|
+
# MIME::Types[/^image/, :complete => true].each do |t|
|
559
|
+
# puts t.to_a.join(", ")
|
560
|
+
# end
|
561
|
+
def [](type_id, flags = {})
|
562
|
+
if type_id.kind_of?(Regexp)
|
563
|
+
matches = []
|
564
|
+
@type_variants.each_key do |k|
|
565
|
+
matches << @type_variants[k] if k =~ type_id
|
566
|
+
end
|
567
|
+
matches.flatten!
|
568
|
+
elsif type_id.kind_of?(MIME::Type)
|
569
|
+
matches = [type_id]
|
570
|
+
else
|
571
|
+
matches = @type_variants[MIME::Type.simplified(type_id)]
|
572
|
+
end
|
573
|
+
|
574
|
+
matches.delete_if { |e| not e.complete? } if flags[:complete]
|
575
|
+
matches.delete_if { |e| not e.platform? } if flags[:platform]
|
576
|
+
matches
|
577
|
+
end
|
578
|
+
|
579
|
+
# Return the list of MIME::Types which belongs to the file based on its
|
580
|
+
# filename extension. If +platform+ is +true+, then only file types that
|
581
|
+
# are specific to the current platform will be returned.
|
582
|
+
#
|
583
|
+
# puts "MIME::Types.type_for('citydesk.xml')
|
584
|
+
# => "#{MIME::Types.type_for('citydesk.xml')}"
|
585
|
+
# puts "MIME::Types.type_for('citydesk.gif')
|
586
|
+
# => "#{MIME::Types.type_for('citydesk.gif')}"
|
587
|
+
def type_for(filename, platform = false)
|
588
|
+
ext = filename.chomp.downcase.gsub(/.*\./o, '')
|
589
|
+
list = @extension_index[ext]
|
590
|
+
list.delete_if { |e| not e.platform? } if platform
|
591
|
+
list
|
592
|
+
end
|
593
|
+
|
594
|
+
# A synonym for MIME::Types.type_for
|
595
|
+
def of(filename, platform = false)
|
596
|
+
type_for(filename, platform)
|
597
|
+
end
|
598
|
+
|
599
|
+
# Add one or more MIME::Type objects to the set of known types. Each
|
600
|
+
# type should be experimental (e.g., 'application/x-ruby'). If the type
|
601
|
+
# is already known, a warning will be displayed.
|
602
|
+
#
|
603
|
+
# <b>Please inform the maintainer of this module when registered types
|
604
|
+
# are missing.</b>
|
605
|
+
def add(*types)
|
606
|
+
types.each do |mime_type|
|
607
|
+
if @type_variants.include?(mime_type.simplified)
|
608
|
+
if @type_variants[mime_type.simplified].include?(mime_type)
|
609
|
+
warn "Type #{mime_type} already registered as a variant of #{mime_type.simplified}."
|
610
|
+
end
|
611
|
+
end
|
612
|
+
add_type_variant(mime_type)
|
613
|
+
index_extensions(mime_type)
|
614
|
+
end
|
615
|
+
end
|
616
|
+
|
617
|
+
class <<self
|
618
|
+
def add_type_variant(mime_type) #:nodoc:
|
619
|
+
@__types__.add_type_variant(mime_type)
|
620
|
+
end
|
621
|
+
|
622
|
+
def index_extensions(mime_type) #:nodoc:
|
623
|
+
@__types__.index_extensions(mime_type)
|
624
|
+
end
|
625
|
+
|
626
|
+
# Returns a list of MIME::Type objects, which may be empty. The
|
627
|
+
# optional flag parameters are :complete (finds only complete
|
628
|
+
# MIME::Type objects) and :platform (finds only MIME::Types for the
|
629
|
+
# current platform). It is possible for multiple matches to be
|
630
|
+
# returned for either type (in the example below, 'text/plain' returns
|
631
|
+
# two values -- one for the general case, and one for VMS systems.
|
632
|
+
#
|
633
|
+
# puts "\nMIME::Types['text/plain']"
|
634
|
+
# MIME::Types['text/plain'].each { |t| puts t.to_a.join(", ") }
|
635
|
+
#
|
636
|
+
# puts "\nMIME::Types[/^image/, :complete => true]"
|
637
|
+
# MIME::Types[/^image/, :complete => true].each do |t|
|
638
|
+
# puts t.to_a.join(", ")
|
639
|
+
# end
|
640
|
+
def [](type_id, flags = {})
|
641
|
+
@__types__[type_id, flags]
|
642
|
+
end
|
643
|
+
|
644
|
+
# Return the list of MIME::Types which belongs to the file based on
|
645
|
+
# its filename extension. If +platform+ is +true+, then only file
|
646
|
+
# types that are specific to the current platform will be returned.
|
647
|
+
#
|
648
|
+
# puts "MIME::Types.type_for('citydesk.xml')
|
649
|
+
# => "#{MIME::Types.type_for('citydesk.xml')}"
|
650
|
+
# puts "MIME::Types.type_for('citydesk.gif')
|
651
|
+
# => "#{MIME::Types.type_for('citydesk.gif')}"
|
652
|
+
def type_for(filename, platform = false)
|
653
|
+
@__types__.type_for(filename, platform)
|
654
|
+
end
|
655
|
+
|
656
|
+
# A synonym for MIME::Types.type_for
|
657
|
+
def of(filename, platform = false)
|
658
|
+
@__types__.type_for(filename, platform)
|
659
|
+
end
|
660
|
+
|
661
|
+
# Add one or more MIME::Type objects to the set of known types. Each
|
662
|
+
# type should be experimental (e.g., 'application/x-ruby'). If the
|
663
|
+
# type is already known, a warning will be displayed.
|
664
|
+
#
|
665
|
+
# <b>Please inform the maintainer of this module when registered types
|
666
|
+
# are missing.</b>
|
667
|
+
def add(*types)
|
668
|
+
@__types__.add(*types)
|
669
|
+
end
|
670
|
+
end
|
671
|
+
end
|
672
|
+
end
|
673
|
+
|
674
|
+
# Build the type list
|
675
|
+
data_mime_type = <<MIME_TYPES
|
676
|
+
# What follows is the compiled list of known media types, IANA-registered
|
677
|
+
# ones first, one per line.
|
678
|
+
#
|
679
|
+
# [*][!][os:]mt/st[<ws>@ext][<ws>:enc][<ws>'url-list][<ws>=docs]
|
680
|
+
#
|
681
|
+
# == *
|
682
|
+
# An unofficial MIME type. This should be used if an only if the MIME type
|
683
|
+
# is not properly specified.
|
684
|
+
#
|
685
|
+
# == !
|
686
|
+
# An obsolete MIME type.
|
687
|
+
#
|
688
|
+
# == os:
|
689
|
+
# Platform-specific MIME type definition.
|
690
|
+
#
|
691
|
+
# == mt
|
692
|
+
# The media type.
|
693
|
+
#
|
694
|
+
# == st
|
695
|
+
# The media subtype.
|
696
|
+
#
|
697
|
+
# == <ws>@ext
|
698
|
+
# The list of comma-separated extensions.
|
699
|
+
#
|
700
|
+
# == <ws>:enc
|
701
|
+
# The encoding.
|
702
|
+
#
|
703
|
+
# == <ws>'url-list
|
704
|
+
# The list of comma-separated URLs.
|
705
|
+
#
|
706
|
+
# == <ws>=docs
|
707
|
+
# The documentation string.
|
708
|
+
#
|
709
|
+
# That is, everything except the media type and the subtype is optional.
|
710
|
+
#
|
711
|
+
# -- Austin Ziegler, 2006.02.12
|
712
|
+
|
713
|
+
# Registered: application/*
|
714
|
+
!application/xhtml-voice+xml 'DRAFT:draft-mccobb-xplusv-media-type
|
715
|
+
application/CSTAdata+xml 'IANA,[Ecma International Helpdesk]
|
716
|
+
application/EDI-Consent 'RFC1767
|
717
|
+
application/EDI-X12 'RFC1767
|
718
|
+
application/EDIFACT 'RFC1767
|
719
|
+
application/activemessage 'IANA,[Shapiro]
|
720
|
+
application/andrew-inset 'IANA,[Borenstein]
|
721
|
+
application/applefile :base64 'IANA,[Faltstrom]
|
722
|
+
application/atom+xml 'RFC4287
|
723
|
+
application/atomicmail 'IANA,[Borenstein]
|
724
|
+
application/batch-SMTP 'RFC2442
|
725
|
+
application/beep+xml 'RFC3080
|
726
|
+
application/cals-1840 'RFC1895
|
727
|
+
application/ccxml+xml 'DRAFT:draft-froumentin-voice-mediatypes
|
728
|
+
application/cnrp+xml 'RFCCNRP
|
729
|
+
application/commonground 'IANA,[Glazer]
|
730
|
+
application/conference-info+xml 'DRAFT:draft-ietf-sipping-conference-package
|
731
|
+
application/cpl+xml 'RFC3880
|
732
|
+
application/csta+xml 'IANA,[Ecma International Helpdesk]
|
733
|
+
application/cybercash 'IANA,[Eastlake]
|
734
|
+
application/dca-rft 'IANA,[Campbell]
|
735
|
+
application/dec-dx 'IANA,[Campbell]
|
736
|
+
application/dialog-info+xml 'DRAFT:draft-ietf-sipping-dialog-package
|
737
|
+
application/dicom 'RFC3240
|
738
|
+
application/dns 'RFC4027
|
739
|
+
application/dvcs 'RFC3029
|
740
|
+
application/ecmascript 'DRAFT:draft-hoehrmann-script-types
|
741
|
+
application/epp+xml 'RFC3730
|
742
|
+
application/eshop 'IANA,[Katz]
|
743
|
+
application/fastinfoset 'IANA,[ITU-T ASN.1 Rapporteur]
|
744
|
+
application/fastsoap 'IANA,[ITU-T ASN.1 Rapporteur]
|
745
|
+
application/fits 'RFC4047
|
746
|
+
application/font-tdpfr @pfr 'RFC3073
|
747
|
+
application/http 'RFC2616
|
748
|
+
application/hyperstudio @stk 'IANA,[Domino]
|
749
|
+
application/iges 'IANA,[Parks]
|
750
|
+
application/im-iscomposing+xml 'RFC3994
|
751
|
+
application/index 'RFC2652
|
752
|
+
application/index.cmd 'RFC2652
|
753
|
+
application/index.obj 'RFC2652
|
754
|
+
application/index.response 'RFC2652
|
755
|
+
application/index.vnd 'RFC2652
|
756
|
+
application/iotp 'RFC2935
|
757
|
+
application/ipp 'RFC2910
|
758
|
+
application/isup 'RFC3204
|
759
|
+
application/javascript 'DRAFT:draft-hoehrmann-script-types
|
760
|
+
application/kpml-request+xml 'DRAFT:draft-ietf-sipping-kpml
|
761
|
+
application/kpml-response+xml 'DRAFT:draft-ietf-sipping-kpml
|
762
|
+
application/mac-binhex40 @hqx :8bit 'IANA,[Faltstrom]
|
763
|
+
application/macwriteii 'IANA,[Lindner]
|
764
|
+
application/marc 'RFC2220
|
765
|
+
application/mathematica 'IANA,[Van Nostern]
|
766
|
+
application/mbox 'DRAFT:draft-hall-mime-app-mbox
|
767
|
+
application/mikey 'RFC3830
|
768
|
+
application/mp4 'DRAFT:draft-lim-mpeg4-mime
|
769
|
+
application/mpeg4-generic 'RFC3640
|
770
|
+
application/mpeg4-iod 'DRAFT:draft-lim-mpeg4-mime
|
771
|
+
application/mpeg4-iod-xmt 'DRAFT:draft-lim-mpeg4-mime
|
772
|
+
application/msword @doc,dot :base64 'IANA,[Lindner]
|
773
|
+
application/news-message-id 'RFC1036,[Spencer]
|
774
|
+
application/news-transmission 'RFC1036,[Spencer]
|
775
|
+
application/nss 'IANA,[Hammer]
|
776
|
+
application/ocsp-request 'RFC2560
|
777
|
+
application/ocsp-response 'RFC2560
|
778
|
+
application/octet-stream @bin,dms,lha,lzh,exe,class,ani,pgp :base64 'RFC2045,RFC2046
|
779
|
+
application/oda @oda 'RFC2045,RFC2046
|
780
|
+
application/ogg @ogg 'RFC3534
|
781
|
+
application/parityfec 'RFC3009
|
782
|
+
application/pdf @pdf :base64 'RFC3778
|
783
|
+
application/pgp-encrypted :7bit 'RFC3156
|
784
|
+
application/pgp-keys :7bit 'RFC3156
|
785
|
+
application/pgp-signature @sig :base64 'RFC3156
|
786
|
+
application/pidf+xml 'IANA,RFC3863
|
787
|
+
application/pkcs10 @p10 'RFC2311
|
788
|
+
application/pkcs7-mime @p7m,p7c 'RFC2311
|
789
|
+
application/pkcs7-signature @p7s 'RFC2311
|
790
|
+
application/pkix-cert @cer 'RFC2585
|
791
|
+
application/pkix-crl @crl 'RFC2585
|
792
|
+
application/pkix-pkipath @pkipath 'DRAFT:draft-ietf-tls-rfc3546bis
|
793
|
+
application/pkixcmp @pki 'RFC2510
|
794
|
+
application/pls+xml 'DRAFT:draft-froumentin-voice-mediatypes
|
795
|
+
application/poc-settings+xml 'DRAFT:draft-garcia-sipping-poc-isb-am
|
796
|
+
application/postscript @ai,eps,ps :8bit 'RFC2045,RFC2046
|
797
|
+
application/prs.alvestrand.titrax-sheet 'IANA,[Alvestrand]
|
798
|
+
application/prs.cww @cw,cww 'IANA,[Rungchavalnont]
|
799
|
+
application/prs.nprend @rnd,rct 'IANA,[Doggett]
|
800
|
+
application/prs.plucker 'IANA,[Janssen]
|
801
|
+
application/qsig 'RFC3204
|
802
|
+
application/rdf+xml @rdf 'RFC3870
|
803
|
+
application/reginfo+xml 'RFC3680
|
804
|
+
application/remote-printing 'IANA,RFC1486,[Rose]
|
805
|
+
application/resource-lists+xml 'DRAFT:draft-ietf-simple-xcap-list-usage
|
806
|
+
application/riscos 'IANA,[Smith]
|
807
|
+
application/rlmi+xml 'DRAFT:draft-ietf-simple-event-list
|
808
|
+
application/rls-services+xml 'DRAFT:draft-ietf-simple-xcap-list-usage
|
809
|
+
application/rtf @rtf 'IANA,[Lindner]
|
810
|
+
application/rtx 'DRAFT:draft-ietf-avt-rtp-retransmission
|
811
|
+
application/samlassertion+xml 'IANA,[OASIS Security Services Technical Committee (SSTC)]
|
812
|
+
application/samlmetadata+xml 'IANA,[OASIS Security Services Technical Committee (SSTC)]
|
813
|
+
application/sbml+xml 'RFC3823
|
814
|
+
application/sdp 'RFC2327
|
815
|
+
application/set-payment 'IANA,[Korver]
|
816
|
+
application/set-payment-initiation 'IANA,[Korver]
|
817
|
+
application/set-registration 'IANA,[Korver]
|
818
|
+
application/set-registration-initiation 'IANA,[Korver]
|
819
|
+
application/sgml @sgml 'RFC1874
|
820
|
+
application/sgml-open-catalog @soc 'IANA,[Grosso]
|
821
|
+
application/shf+xml 'RFC4194
|
822
|
+
application/sieve @siv 'RFC3028
|
823
|
+
application/simple-filter+xml 'DRAFT:draft-ietf-simple-filter-format
|
824
|
+
application/simple-message-summary 'RFC3842
|
825
|
+
application/slate 'IANA,[Crowley]
|
826
|
+
application/soap+fastinfoset 'IANA,[ITU-T ASN.1 Rapporteur]
|
827
|
+
application/soap+xml 'RFC3902
|
828
|
+
application/spirits-event+xml 'RFC3910
|
829
|
+
application/srgs 'DRAFT:draft-froumentin-voice-mediatypes
|
830
|
+
application/srgs+xml 'DRAFT:draft-froumentin-voice-mediatypes
|
831
|
+
application/ssml+xml 'DRAFT:draft-froumentin-voice-mediatypes
|
832
|
+
application/timestamp-query 'RFC3161
|
833
|
+
application/timestamp-reply 'RFC3161
|
834
|
+
application/tve-trigger 'IANA,[Welsh]
|
835
|
+
application/vemmi 'RFC2122
|
836
|
+
application/vnd.3M.Post-it-Notes 'IANA,[O'Brien]
|
837
|
+
application/vnd.3gpp.pic-bw-large @plb 'IANA,[Meredith]
|
838
|
+
application/vnd.3gpp.pic-bw-small @psb 'IANA,[Meredith]
|
839
|
+
application/vnd.3gpp.pic-bw-var @pvb 'IANA,[Meredith]
|
840
|
+
application/vnd.3gpp.sms @sms 'IANA,[Meredith]
|
841
|
+
application/vnd.FloGraphIt 'IANA,[Floersch]
|
842
|
+
application/vnd.Kinar @kne,knp,sdf 'IANA,[Thakkar]
|
843
|
+
application/vnd.Mobius.DAF 'IANA,[Kabayama]
|
844
|
+
application/vnd.Mobius.DIS 'IANA,[Kabayama]
|
845
|
+
application/vnd.Mobius.MBK 'IANA,[Devasia]
|
846
|
+
application/vnd.Mobius.MQY 'IANA,[Devasia]
|
847
|
+
application/vnd.Mobius.MSL 'IANA,[Kabayama]
|
848
|
+
application/vnd.Mobius.PLC 'IANA,[Kabayama]
|
849
|
+
application/vnd.Mobius.TXF 'IANA,[Kabayama]
|
850
|
+
application/vnd.Quark.QuarkXPress @qxd,qxt,qwd,qwt,qxl,qxb :8bit 'IANA,[Scheidler]
|
851
|
+
application/vnd.RenLearn.rlprint 'IANA,[Wick]
|
852
|
+
application/vnd.accpac.simply.aso 'IANA,[Leow]
|
853
|
+
application/vnd.accpac.simply.imp 'IANA,[Leow]
|
854
|
+
application/vnd.acucobol 'IANA,[Lubin]
|
855
|
+
application/vnd.acucorp @atc,acutc :7bit 'IANA,[Lubin]
|
856
|
+
application/vnd.adobe.xfdf @xfdf 'IANA,[Perelman]
|
857
|
+
application/vnd.aether.imp 'IANA,[Moskowitz]
|
858
|
+
application/vnd.amiga.ami @ami 'IANA,[Blumberg]
|
859
|
+
application/vnd.apple.installer+xml 'IANA,[Bierman]
|
860
|
+
application/vnd.audiograph 'IANA,[Slusanschi]
|
861
|
+
application/vnd.autopackage 'IANA,[Hearn]
|
862
|
+
application/vnd.blueice.multipass @mpm 'IANA,[Holmstrom]
|
863
|
+
application/vnd.bmi 'IANA,[Gotoh]
|
864
|
+
application/vnd.businessobjects 'IANA,[Imoucha]
|
865
|
+
application/vnd.cinderella @cdy 'IANA,[Kortenkamp]
|
866
|
+
application/vnd.claymore 'IANA,[Simpson]
|
867
|
+
application/vnd.commerce-battelle 'IANA,[Applebaum]
|
868
|
+
application/vnd.commonspace 'IANA,[Chandhok]
|
869
|
+
application/vnd.contact.cmsg 'IANA,[Patz]
|
870
|
+
application/vnd.cosmocaller @cmc 'IANA,[Dellutri]
|
871
|
+
application/vnd.criticaltools.wbs+xml @wbs 'IANA,[Spiller]
|
872
|
+
application/vnd.ctc-posml 'IANA,[Kohlhepp]
|
873
|
+
application/vnd.cups-postscript 'IANA,[Sweet]
|
874
|
+
application/vnd.cups-raster 'IANA,[Sweet]
|
875
|
+
application/vnd.cups-raw 'IANA,[Sweet]
|
876
|
+
application/vnd.curl @curl 'IANA,[Byrnes]
|
877
|
+
application/vnd.cybank 'IANA,[Helmee]
|
878
|
+
application/vnd.data-vision.rdz @rdz 'IANA,[Fields]
|
879
|
+
application/vnd.dna 'IANA,[Searcy]
|
880
|
+
application/vnd.dpgraph 'IANA,[Parker]
|
881
|
+
application/vnd.dreamfactory @dfac 'IANA,[Appleton]
|
882
|
+
application/vnd.dxr 'IANA,[Duffy]
|
883
|
+
application/vnd.ecdis-update 'IANA,[Buettgenbach]
|
884
|
+
application/vnd.ecowin.chart 'IANA,[Olsson]
|
885
|
+
application/vnd.ecowin.filerequest 'IANA,[Olsson]
|
886
|
+
application/vnd.ecowin.fileupdate 'IANA,[Olsson]
|
887
|
+
application/vnd.ecowin.series 'IANA,[Olsson]
|
888
|
+
application/vnd.ecowin.seriesrequest 'IANA,[Olsson]
|
889
|
+
application/vnd.ecowin.seriesupdate 'IANA,[Olsson]
|
890
|
+
application/vnd.enliven 'IANA,[Santinelli]
|
891
|
+
application/vnd.epson.esf 'IANA,[Hoshina]
|
892
|
+
application/vnd.epson.msf 'IANA,[Hoshina]
|
893
|
+
application/vnd.epson.quickanime 'IANA,[Gu]
|
894
|
+
application/vnd.epson.salt 'IANA,[Nagatomo]
|
895
|
+
application/vnd.epson.ssf 'IANA,[Hoshina]
|
896
|
+
application/vnd.ericsson.quickcall 'IANA,[Tidwell]
|
897
|
+
application/vnd.eudora.data 'IANA,[Resnick]
|
898
|
+
application/vnd.fdf 'IANA,[Zilles]
|
899
|
+
application/vnd.ffsns 'IANA,[Holstage]
|
900
|
+
application/vnd.fints 'IANA,[Hammann]
|
901
|
+
application/vnd.fluxtime.clip 'IANA,[Winter]
|
902
|
+
application/vnd.framemaker 'IANA,[Wexler]
|
903
|
+
application/vnd.fsc.weblaunch @fsc :7bit 'IANA,[D.Smith]
|
904
|
+
application/vnd.fujitsu.oasys 'IANA,[Togashi]
|
905
|
+
application/vnd.fujitsu.oasys2 'IANA,[Togashi]
|
906
|
+
application/vnd.fujitsu.oasys3 'IANA,[Okudaira]
|
907
|
+
application/vnd.fujitsu.oasysgp 'IANA,[Sugimoto]
|
908
|
+
application/vnd.fujitsu.oasysprs 'IANA,[Ogita]
|
909
|
+
application/vnd.fujixerox.ddd 'IANA,[Onda]
|
910
|
+
application/vnd.fujixerox.docuworks 'IANA,[Taguchi]
|
911
|
+
application/vnd.fujixerox.docuworks.binder 'IANA,[Matsumoto]
|
912
|
+
application/vnd.fut-misnet 'IANA,[Pruulmann]
|
913
|
+
application/vnd.genomatix.tuxedo @txd 'IANA,[Frey]
|
914
|
+
application/vnd.grafeq 'IANA,[Tupper]
|
915
|
+
application/vnd.groove-account 'IANA,[Joseph]
|
916
|
+
application/vnd.groove-help 'IANA,[Joseph]
|
917
|
+
application/vnd.groove-identity-message 'IANA,[Joseph]
|
918
|
+
application/vnd.groove-injector 'IANA,[Joseph]
|
919
|
+
application/vnd.groove-tool-message 'IANA,[Joseph]
|
920
|
+
application/vnd.groove-tool-template 'IANA,[Joseph]
|
921
|
+
application/vnd.groove-vcard 'IANA,[Joseph]
|
922
|
+
application/vnd.hbci @hbci,hbc,kom,upa,pkd,bpd 'IANA,[Hammann]
|
923
|
+
application/vnd.hcl-bireports 'IANA,[Serres]
|
924
|
+
application/vnd.hhe.lesson-player @les 'IANA,[Jones]
|
925
|
+
application/vnd.hp-HPGL @plt,hpgl 'IANA,[Pentecost]
|
926
|
+
application/vnd.hp-PCL 'IANA,[Pentecost]
|
927
|
+
application/vnd.hp-PCLXL 'IANA,[Pentecost]
|
928
|
+
application/vnd.hp-hpid 'IANA,[Gupta]
|
929
|
+
application/vnd.hp-hps 'IANA,[Aubrey]
|
930
|
+
application/vnd.httphone 'IANA,[Lefevre]
|
931
|
+
application/vnd.hzn-3d-crossword 'IANA,[Minnis]
|
932
|
+
application/vnd.ibm.MiniPay 'IANA,[Herzberg]
|
933
|
+
application/vnd.ibm.afplinedata 'IANA,[Buis]
|
934
|
+
application/vnd.ibm.electronic-media @emm 'IANA,[Tantlinger]
|
935
|
+
application/vnd.ibm.modcap 'IANA,[Hohensee]
|
936
|
+
application/vnd.ibm.rights-management @irm 'IANA,[Tantlinger]
|
937
|
+
application/vnd.ibm.secure-container @sc 'IANA,[Tantlinger]
|
938
|
+
application/vnd.informix-visionary 'IANA,[Gales]
|
939
|
+
application/vnd.intercon.formnet 'IANA,[Gurak]
|
940
|
+
application/vnd.intertrust.digibox 'IANA,[Tomasello]
|
941
|
+
application/vnd.intertrust.nncp 'IANA,[Tomasello]
|
942
|
+
application/vnd.intu.qbo 'IANA,[Scratchley]
|
943
|
+
application/vnd.intu.qfx 'IANA,[Scratchley]
|
944
|
+
application/vnd.ipunplugged.rcprofile @rcprofile 'IANA,[Ersson]
|
945
|
+
application/vnd.irepository.package+xml @irp 'IANA,[Knowles]
|
946
|
+
application/vnd.is-xpr 'IANA,[Natarajan]
|
947
|
+
application/vnd.japannet-directory-service 'IANA,[Fujii]
|
948
|
+
application/vnd.japannet-jpnstore-wakeup 'IANA,[Yoshitake]
|
949
|
+
application/vnd.japannet-payment-wakeup 'IANA,[Fujii]
|
950
|
+
application/vnd.japannet-registration 'IANA,[Yoshitake]
|
951
|
+
application/vnd.japannet-registration-wakeup 'IANA,[Fujii]
|
952
|
+
application/vnd.japannet-setstore-wakeup 'IANA,[Yoshitake]
|
953
|
+
application/vnd.japannet-verification 'IANA,[Yoshitake]
|
954
|
+
application/vnd.japannet-verification-wakeup 'IANA,[Fujii]
|
955
|
+
application/vnd.jisp @jisp 'IANA,[Deckers]
|
956
|
+
application/vnd.kahootz 'IANA,[Macdonald]
|
957
|
+
application/vnd.kde.karbon @karbon 'IANA,[Faure]
|
958
|
+
application/vnd.kde.kchart @chrt 'IANA,[Faure]
|
959
|
+
application/vnd.kde.kformula @kfo 'IANA,[Faure]
|
960
|
+
application/vnd.kde.kivio @flw 'IANA,[Faure]
|
961
|
+
application/vnd.kde.kontour @kon 'IANA,[Faure]
|
962
|
+
application/vnd.kde.kpresenter @kpr,kpt 'IANA,[Faure]
|
963
|
+
application/vnd.kde.kspread @ksp 'IANA,[Faure]
|
964
|
+
application/vnd.kde.kword @kwd,kwt 'IANA,[Faure]
|
965
|
+
application/vnd.kenameaapp @htke 'IANA,[DiGiorgio-Haag]
|
966
|
+
application/vnd.kidspiration @kia 'IANA,[Bennett]
|
967
|
+
application/vnd.koan 'IANA,[Cole]
|
968
|
+
application/vnd.liberty-request+xml 'IANA,[McDowell]
|
969
|
+
application/vnd.llamagraphics.life-balance.desktop @lbd 'IANA,[White]
|
970
|
+
application/vnd.llamagraphics.life-balance.exchange+xml @lbe 'IANA,[White]
|
971
|
+
application/vnd.lotus-1-2-3 @wks,123 'IANA,[Wattenberger]
|
972
|
+
application/vnd.lotus-approach 'IANA,[Wattenberger]
|
973
|
+
application/vnd.lotus-freelance 'IANA,[Wattenberger]
|
974
|
+
application/vnd.lotus-notes 'IANA,[Laramie]
|
975
|
+
application/vnd.lotus-organizer 'IANA,[Wattenberger]
|
976
|
+
application/vnd.lotus-screencam 'IANA,[Wattenberger]
|
977
|
+
application/vnd.lotus-wordpro 'IANA,[Wattenberger]
|
978
|
+
application/vnd.marlin.drm.mdcf 'IANA,[Ellison]
|
979
|
+
application/vnd.mcd @mcd 'IANA,[Gotoh]
|
980
|
+
application/vnd.mediastation.cdkey 'IANA,[Flurry]
|
981
|
+
application/vnd.meridian-slingshot 'IANA,[Wedel]
|
982
|
+
application/vnd.mfmp @mfm 'IANA,[Ikeda]
|
983
|
+
application/vnd.micrografx.flo @flo 'IANA,[Prevo]
|
984
|
+
application/vnd.micrografx.igx @igx 'IANA,[Prevo]
|
985
|
+
application/vnd.mif @mif 'IANA,[Wexler]
|
986
|
+
application/vnd.minisoft-hp3000-save 'IANA,[Bartram]
|
987
|
+
application/vnd.mitsubishi.misty-guard.trustweb 'IANA,[Tanaka]
|
988
|
+
application/vnd.mophun.application @mpn 'IANA,[Wennerstrom]
|
989
|
+
application/vnd.mophun.certificate @mpc 'IANA,[Wennerstrom]
|
990
|
+
application/vnd.motorola.flexsuite 'IANA,[Patton]
|
991
|
+
application/vnd.motorola.flexsuite.adsi 'IANA,[Patton]
|
992
|
+
application/vnd.motorola.flexsuite.fis 'IANA,[Patton]
|
993
|
+
application/vnd.motorola.flexsuite.gotap 'IANA,[Patton]
|
994
|
+
application/vnd.motorola.flexsuite.kmr 'IANA,[Patton]
|
995
|
+
application/vnd.motorola.flexsuite.ttc 'IANA,[Patton]
|
996
|
+
application/vnd.motorola.flexsuite.wem 'IANA,[Patton]
|
997
|
+
application/vnd.mozilla.xul+xml @xul 'IANA,[McDaniel]
|
998
|
+
application/vnd.ms-artgalry @cil 'IANA,[Slawson]
|
999
|
+
application/vnd.ms-asf @asf 'IANA,[Fleischman]
|
1000
|
+
application/vnd.ms-cab-compressed @cab 'IANA,[Scarborough]
|
1001
|
+
application/vnd.ms-excel @xls,xlt :base64 'IANA,[Gill]
|
1002
|
+
application/vnd.ms-fontobject 'IANA,[Scarborough]
|
1003
|
+
application/vnd.ms-ims 'IANA,[Ledoux]
|
1004
|
+
application/vnd.ms-lrm @lrm 'IANA,[Ledoux]
|
1005
|
+
application/vnd.ms-powerpoint @ppt,pps,pot :base64 'IANA,[Gill]
|
1006
|
+
application/vnd.ms-project @mpp :base64 'IANA,[Gill]
|
1007
|
+
application/vnd.ms-tnef :base64 'IANA,[Gill]
|
1008
|
+
application/vnd.ms-works :base64 'IANA,[Gill]
|
1009
|
+
application/vnd.ms-wpl @wpl :base64 'IANA,[Plastina]
|
1010
|
+
application/vnd.mseq @mseq 'IANA,[Le Bodic]
|
1011
|
+
application/vnd.msign 'IANA,[Borcherding]
|
1012
|
+
application/vnd.music-niff 'IANA,[Butler]
|
1013
|
+
application/vnd.musician 'IANA,[Adams]
|
1014
|
+
application/vnd.nervana @ent,entity,req,request,bkm,kcm 'IANA,[Judkins]
|
1015
|
+
application/vnd.netfpx 'IANA,[Mutz]
|
1016
|
+
application/vnd.noblenet-directory 'IANA,[Solomon]
|
1017
|
+
application/vnd.noblenet-sealer 'IANA,[Solomon]
|
1018
|
+
application/vnd.noblenet-web 'IANA,[Solomon]
|
1019
|
+
application/vnd.nokia.landmark+wbxml 'IANA,[Nokia]
|
1020
|
+
application/vnd.nokia.landmark+xml 'IANA,[Nokia]
|
1021
|
+
application/vnd.nokia.landmarkcollection+xml 'IANA,[Nokia]
|
1022
|
+
application/vnd.nokia.radio-preset @rpst 'IANA,[Nokia]
|
1023
|
+
application/vnd.nokia.radio-presets @rpss 'IANA,[Nokia]
|
1024
|
+
application/vnd.novadigm.EDM 'IANA,[Swenson]
|
1025
|
+
application/vnd.novadigm.EDX 'IANA,[Swenson]
|
1026
|
+
application/vnd.novadigm.EXT 'IANA,[Swenson]
|
1027
|
+
application/vnd.obn 'IANA,[Hessling]
|
1028
|
+
application/vnd.omads-email+xml 'IANA,[OMA Data Synchronization Working Group]
|
1029
|
+
application/vnd.omads-file+xml 'IANA,[OMA Data Synchronization Working Group]
|
1030
|
+
application/vnd.omads-folder+xml 'IANA,[OMA Data Synchronization Working Group]
|
1031
|
+
application/vnd.osa.netdeploy 'IANA,[Klos]
|
1032
|
+
application/vnd.osgi.dp 'IANA,[Kriens]
|
1033
|
+
application/vnd.palm @prc,pdb,pqa,oprc :base64 'IANA,[Peacock]
|
1034
|
+
application/vnd.paos.xml 'IANA,[Kemp]
|
1035
|
+
application/vnd.pg.format 'IANA,[Gandert]
|
1036
|
+
application/vnd.pg.osasli 'IANA,[Gandert]
|
1037
|
+
application/vnd.piaccess.application-licence 'IANA,[Maneos]
|
1038
|
+
application/vnd.picsel @efif 'IANA,[Naccarato]
|
1039
|
+
application/vnd.powerbuilder6 'IANA,[Guy]
|
1040
|
+
application/vnd.powerbuilder6-s 'IANA,[Guy]
|
1041
|
+
application/vnd.powerbuilder7 'IANA,[Shilts]
|
1042
|
+
application/vnd.powerbuilder7-s 'IANA,[Shilts]
|
1043
|
+
application/vnd.powerbuilder75 'IANA,[Shilts]
|
1044
|
+
application/vnd.powerbuilder75-s 'IANA,[Shilts]
|
1045
|
+
application/vnd.preminet 'IANA,[Tenhunen]
|
1046
|
+
application/vnd.previewsystems.box 'IANA,[Smolgovsky]
|
1047
|
+
application/vnd.proteus.magazine 'IANA,[Hoch]
|
1048
|
+
application/vnd.publishare-delta-tree 'IANA,[Ben-Kiki]
|
1049
|
+
application/vnd.pvi.ptid1 @pti,ptid 'IANA,[Lamb]
|
1050
|
+
application/vnd.pwg-multiplexed 'RFC3391
|
1051
|
+
application/vnd.pwg-xhtml-print+xml 'IANA,[Wright]
|
1052
|
+
application/vnd.rapid 'IANA,[Szekely]
|
1053
|
+
application/vnd.ruckus.download 'IANA,[Harris]
|
1054
|
+
application/vnd.s3sms 'IANA,[Tarkkala]
|
1055
|
+
application/vnd.sealed.doc @sdoc,sdo,s1w 'IANA,[Petersen]
|
1056
|
+
application/vnd.sealed.eml @seml,sem 'IANA,[Petersen]
|
1057
|
+
application/vnd.sealed.mht @smht,smh 'IANA,[Petersen]
|
1058
|
+
application/vnd.sealed.net 'IANA,[Lambert]
|
1059
|
+
application/vnd.sealed.ppt @sppt,spp,s1p 'IANA,[Petersen]
|
1060
|
+
application/vnd.sealed.xls @sxls,sxl,s1e 'IANA,[Petersen]
|
1061
|
+
application/vnd.sealedmedia.softseal.html @stml,stm,s1h 'IANA,[Petersen]
|
1062
|
+
application/vnd.sealedmedia.softseal.pdf @spdf,spd,s1a 'IANA,[Petersen]
|
1063
|
+
application/vnd.seemail @see 'IANA,[Webb]
|
1064
|
+
application/vnd.sema 'IANA,[Hansson]
|
1065
|
+
application/vnd.shana.informed.formdata 'IANA,[Selzler]
|
1066
|
+
application/vnd.shana.informed.formtemplate 'IANA,[Selzler]
|
1067
|
+
application/vnd.shana.informed.interchange 'IANA,[Selzler]
|
1068
|
+
application/vnd.shana.informed.package 'IANA,[Selzler]
|
1069
|
+
application/vnd.smaf @mmf 'IANA,[Takahashi]
|
1070
|
+
application/vnd.sss-cod 'IANA,[Dani]
|
1071
|
+
application/vnd.sss-dtf 'IANA,[Bruno]
|
1072
|
+
application/vnd.sss-ntf 'IANA,[Bruno]
|
1073
|
+
application/vnd.street-stream 'IANA,[Levitt]
|
1074
|
+
application/vnd.sus-calendar @sus,susp 'IANA,[Niedfeldt]
|
1075
|
+
application/vnd.svd 'IANA,[Becker]
|
1076
|
+
application/vnd.swiftview-ics 'IANA,[Widener]
|
1077
|
+
application/vnd.syncml.+xml 'IANA,[OMA Data Synchronization Working Group]
|
1078
|
+
application/vnd.syncml.ds.notification 'IANA,[OMA Data Synchronization Working Group]
|
1079
|
+
application/vnd.triscape.mxs 'IANA,[Simonoff]
|
1080
|
+
application/vnd.trueapp 'IANA,[Hepler]
|
1081
|
+
application/vnd.truedoc 'IANA,[Chase]
|
1082
|
+
application/vnd.ufdl 'IANA,[Manning]
|
1083
|
+
application/vnd.uiq.theme 'IANA,[Ocock]
|
1084
|
+
application/vnd.uplanet.alert 'IANA,[Martin]
|
1085
|
+
application/vnd.uplanet.alert-wbxml 'IANA,[Martin]
|
1086
|
+
application/vnd.uplanet.bearer-choice 'IANA,[Martin]
|
1087
|
+
application/vnd.uplanet.bearer-choice-wbxml 'IANA,[Martin]
|
1088
|
+
application/vnd.uplanet.cacheop 'IANA,[Martin]
|
1089
|
+
application/vnd.uplanet.cacheop-wbxml 'IANA,[Martin]
|
1090
|
+
application/vnd.uplanet.channel 'IANA,[Martin]
|
1091
|
+
application/vnd.uplanet.channel-wbxml 'IANA,[Martin]
|
1092
|
+
application/vnd.uplanet.list 'IANA,[Martin]
|
1093
|
+
application/vnd.uplanet.list-wbxml 'IANA,[Martin]
|
1094
|
+
application/vnd.uplanet.listcmd 'IANA,[Martin]
|
1095
|
+
application/vnd.uplanet.listcmd-wbxml 'IANA,[Martin]
|
1096
|
+
application/vnd.uplanet.signal 'IANA,[Martin]
|
1097
|
+
application/vnd.vcx 'IANA,[T.Sugimoto]
|
1098
|
+
application/vnd.vectorworks 'IANA,[Pharr]
|
1099
|
+
application/vnd.vidsoft.vidconference @vsc :8bit 'IANA,[Hess]
|
1100
|
+
application/vnd.visio @vsd,vst,vsw,vss 'IANA,[Sandal]
|
1101
|
+
application/vnd.visionary @vis 'IANA,[Aravindakumar]
|
1102
|
+
application/vnd.vividence.scriptfile 'IANA,[Risher]
|
1103
|
+
application/vnd.vsf 'IANA,[Rowe]
|
1104
|
+
application/vnd.wap.sic @sic 'IANA,[WAP-Forum]
|
1105
|
+
application/vnd.wap.slc @slc 'IANA,[WAP-Forum]
|
1106
|
+
application/vnd.wap.wbxml @wbxml 'IANA,[Stark]
|
1107
|
+
application/vnd.wap.wmlc @wmlc 'IANA,[Stark]
|
1108
|
+
application/vnd.wap.wmlscriptc @wmlsc 'IANA,[Stark]
|
1109
|
+
application/vnd.webturbo @wtb 'IANA,[Rehem]
|
1110
|
+
application/vnd.wordperfect @wpd 'IANA,[Scarborough]
|
1111
|
+
application/vnd.wqd @wqd 'IANA,[Bostrom]
|
1112
|
+
application/vnd.wrq-hp3000-labelled 'IANA,[Bartram]
|
1113
|
+
application/vnd.wt.stf 'IANA,[Wohler]
|
1114
|
+
application/vnd.wv.csp+wbxml @wv 'IANA,[Salmi]
|
1115
|
+
application/vnd.wv.csp+xml :8bit 'IANA,[Ingimundarson]
|
1116
|
+
application/vnd.wv.ssp+xml :8bit 'IANA,[Ingimundarson]
|
1117
|
+
application/vnd.xara 'IANA,[Matthewman]
|
1118
|
+
application/vnd.xfdl 'IANA,[Manning]
|
1119
|
+
application/vnd.yamaha.hv-dic @hvd 'IANA,[Yamamoto]
|
1120
|
+
application/vnd.yamaha.hv-script @hvs 'IANA,[Yamamoto]
|
1121
|
+
application/vnd.yamaha.hv-voice @hvp 'IANA,[Yamamoto]
|
1122
|
+
application/vnd.yamaha.smaf-audio @saf 'IANA,[Shinoda]
|
1123
|
+
application/vnd.yamaha.smaf-phrase @spf 'IANA,[Shinoda]
|
1124
|
+
application/vnd.yellowriver-custom-menu 'IANA,[Yellow]
|
1125
|
+
application/vnd.zzazz.deck+xml 'IANA,[Hewett]
|
1126
|
+
application/voicexml+xml 'DRAFT:draft-froumentin-voice-mediatypes
|
1127
|
+
application/watcherinfo+xml @wif 'RFC3858
|
1128
|
+
application/whoispp-query 'RFC2957
|
1129
|
+
application/whoispp-response 'RFC2958
|
1130
|
+
application/wita 'IANA,[Campbell]
|
1131
|
+
application/wordperfect5.1 @wp5,wp 'IANA,[Lindner]
|
1132
|
+
application/x400-bp 'RFC1494
|
1133
|
+
application/xcap-att+xml 'DRAFT:draft-ietf-simple-xcap
|
1134
|
+
application/xcap-caps+xml 'DRAFT:draft-ietf-simple-xcap
|
1135
|
+
application/xcap-el+xml 'DRAFT:draft-ietf-simple-xcap
|
1136
|
+
application/xcap-error+xml 'DRAFT:draft-ietf-simple-xcap
|
1137
|
+
application/xhtml+xml @xhtml :8bit 'RFC3236
|
1138
|
+
application/xml @xml :8bit 'RFC3023
|
1139
|
+
application/xml-dtd :8bit 'RFC3023
|
1140
|
+
application/xml-external-parsed-entity 'RFC3023
|
1141
|
+
application/xmpp+xml 'RFC3923
|
1142
|
+
application/xop+xml 'IANA,[Nottingham]
|
1143
|
+
application/xv+xml 'DRAFT:draft-mccobb-xv-media-type
|
1144
|
+
application/zip @zip :base64 'IANA,[Lindner]
|
1145
|
+
|
1146
|
+
# Registered: audio/*
|
1147
|
+
!audio/vnd.qcelp 'IANA,RFC3625 =use-instead:audio/QCELP
|
1148
|
+
audio/32kadpcm 'RFC2421,RFC2422
|
1149
|
+
audio/3gpp @3gpp 'RFC3839,DRAFT:draft-gellens-bucket
|
1150
|
+
audio/3gpp2 'DRAFT:draft-garudadri-avt-3gpp2-mime
|
1151
|
+
audio/AMR @amr :base64 'RFC3267
|
1152
|
+
audio/AMR-WB @awb :base64 'RFC3267
|
1153
|
+
audio/BV16 'RFC4298
|
1154
|
+
audio/BV32 'RFC4298
|
1155
|
+
audio/CN 'RFC3389
|
1156
|
+
audio/DAT12 'RFC3190
|
1157
|
+
audio/DVI4 'RFC3555
|
1158
|
+
audio/EVRC @evc 'RFC3558
|
1159
|
+
audio/EVRC-QCP 'RFC3625
|
1160
|
+
audio/EVRC0 'RFC3558
|
1161
|
+
audio/G722 'RFC3555
|
1162
|
+
audio/G7221 'RFC3047
|
1163
|
+
audio/G723 'RFC3555
|
1164
|
+
audio/G726-16 'RFC3555
|
1165
|
+
audio/G726-24 'RFC3555
|
1166
|
+
audio/G726-32 'RFC3555
|
1167
|
+
audio/G726-40 'RFC3555
|
1168
|
+
audio/G728 'RFC3555
|
1169
|
+
audio/G729 'RFC3555
|
1170
|
+
audio/G729D 'RFC3555
|
1171
|
+
audio/G729E 'RFC3555
|
1172
|
+
audio/GSM 'RFC3555
|
1173
|
+
audio/GSM-EFR 'RFC3555
|
1174
|
+
audio/L16 @l16 'RFC3555
|
1175
|
+
audio/L20 'RFC3190
|
1176
|
+
audio/L24 'RFC3190
|
1177
|
+
audio/L8 'RFC3555
|
1178
|
+
audio/LPC 'RFC3555
|
1179
|
+
audio/MP4A-LATM 'RFC3016
|
1180
|
+
audio/MPA 'RFC3555
|
1181
|
+
audio/PCMA 'RFC3555
|
1182
|
+
audio/PCMU 'RFC3555
|
1183
|
+
audio/QCELP @qcp 'RFC3555'RFC3625
|
1184
|
+
audio/RED 'RFC3555
|
1185
|
+
audio/SMV @smv 'RFC3558
|
1186
|
+
audio/SMV-QCP 'RFC3625
|
1187
|
+
audio/SMV0 'RFC3558
|
1188
|
+
audio/VDVI 'RFC3555
|
1189
|
+
audio/VMR-WB 'DRAFT:draft-ietf-avt-rtp-vmr-wb,DRAFT:draft-ietf-avt-rtp-vmr-wb-extension
|
1190
|
+
audio/ac3 'RFC4184
|
1191
|
+
audio/amr-wb+ 'DRAFT:draft-ietf-avt-rtp-amrwbplus
|
1192
|
+
audio/basic @au,snd :base64 'RFC2045,RFC2046
|
1193
|
+
audio/clearmode 'RFC4040
|
1194
|
+
audio/dsr-es201108 'RFC3557
|
1195
|
+
audio/dsr-es202050 'RFC4060
|
1196
|
+
audio/dsr-es202211 'RFC4060
|
1197
|
+
audio/dsr-es202212 'RFC4060
|
1198
|
+
audio/iLBC 'RFC3952
|
1199
|
+
audio/mp4 'DRAFT:draft-lim-mpeg4-mime
|
1200
|
+
audio/mpa-robust 'RFC3119
|
1201
|
+
audio/mpeg @mpga,mp2,mp3 :base64 'RFC3003
|
1202
|
+
audio/mpeg4-generic 'RFC3640
|
1203
|
+
audio/parityfec 'RFC3009
|
1204
|
+
audio/prs.sid @sid,psid 'IANA,[Walleij]
|
1205
|
+
audio/rtx 'DRAFT:draft-ietf-avt-rtp-retransmission
|
1206
|
+
audio/t140c 'DRAFT:draft-ietf-avt-audio-t140c
|
1207
|
+
audio/telephone-event 'RFC2833
|
1208
|
+
audio/tone 'RFC2833
|
1209
|
+
audio/vnd.3gpp.iufp 'IANA,[Belling]
|
1210
|
+
audio/vnd.audiokoz 'IANA,[DeBarros]
|
1211
|
+
audio/vnd.cisco.nse 'IANA,[Kumar]
|
1212
|
+
audio/vnd.cmles.radio-events 'IANA,[Goulet]
|
1213
|
+
audio/vnd.cns.anp1 'IANA,[McLaughlin]
|
1214
|
+
audio/vnd.cns.inf1 'IANA,[McLaughlin]
|
1215
|
+
audio/vnd.digital-winds @eol :7bit 'IANA,[Strazds]
|
1216
|
+
audio/vnd.dlna.adts 'IANA,[Heredia]
|
1217
|
+
audio/vnd.everad.plj @plj 'IANA,[Cicelsky]
|
1218
|
+
audio/vnd.lucent.voice @lvp 'IANA,[Vaudreuil]
|
1219
|
+
audio/vnd.nokia.mobile-xmf @mxmf 'IANA,[Nokia Corporation]
|
1220
|
+
audio/vnd.nortel.vbk @vbk 'IANA,[Parsons]
|
1221
|
+
audio/vnd.nuera.ecelp4800 @ecelp4800 'IANA,[Fox]
|
1222
|
+
audio/vnd.nuera.ecelp7470 @ecelp7470 'IANA,[Fox]
|
1223
|
+
audio/vnd.nuera.ecelp9600 @ecelp9600 'IANA,[Fox]
|
1224
|
+
audio/vnd.octel.sbc 'IANA,[Vaudreuil]
|
1225
|
+
audio/vnd.rhetorex.32kadpcm 'IANA,[Vaudreuil]
|
1226
|
+
audio/vnd.sealedmedia.softseal.mpeg @smp3,smp,s1m 'IANA,[Petersen]
|
1227
|
+
audio/vnd.vmx.cvsd 'IANA,[Vaudreuil]
|
1228
|
+
|
1229
|
+
# Registered: image/*
|
1230
|
+
image/cgm 'IANA =Computer Graphics Metafile [Francis]
|
1231
|
+
image/fits 'RFC4047
|
1232
|
+
image/g3fax 'RFC1494
|
1233
|
+
image/gif @gif :base64 'RFC2045,RFC2046
|
1234
|
+
image/ief @ief :base64 'RFC1314 =Image Exchange Format
|
1235
|
+
image/jp2 @jp2 :base64 'IANA,RFC3745
|
1236
|
+
image/jpeg @jpeg,jpg,jpe :base64 'RFC2045,RFC2046
|
1237
|
+
image/jpm @jpm :base64 'IANA,RFC3745
|
1238
|
+
image/jpx @jpx :base64 'IANA,RFC3745
|
1239
|
+
image/naplps 'IANA,[Ferber]
|
1240
|
+
image/png @png :base64 'IANA,[Randers-Pehrson]
|
1241
|
+
image/prs.btif 'IANA,[Simon]
|
1242
|
+
image/prs.pti 'IANA,[Laun]
|
1243
|
+
image/t38 'RFC3362
|
1244
|
+
image/tiff @tiff,tif :base64 'RFC3302 =Tag Image File Format
|
1245
|
+
image/tiff-fx 'RFC3950 =Tag Image File Format Fax eXtended
|
1246
|
+
image/vnd.adobe.photoshop 'IANA,[Scarborough]
|
1247
|
+
image/vnd.cns.inf2 'IANA,[McLaughlin]
|
1248
|
+
image/vnd.djvu @djvu,djv 'IANA,[Bottou]
|
1249
|
+
image/vnd.dwg @dwg 'IANA,[Moline]
|
1250
|
+
image/vnd.dxf 'IANA,[Moline]
|
1251
|
+
image/vnd.fastbidsheet 'IANA,[Becker]
|
1252
|
+
image/vnd.fpx 'IANA,[Spencer]
|
1253
|
+
image/vnd.fst 'IANA,[Fuldseth]
|
1254
|
+
image/vnd.fujixerox.edmics-mmr 'IANA,[Onda]
|
1255
|
+
image/vnd.fujixerox.edmics-rlc 'IANA,[Onda]
|
1256
|
+
image/vnd.globalgraphics.pgb @pgb 'IANA,[Bailey]
|
1257
|
+
image/vnd.microsoft.icon @ico 'IANA,[Butcher]
|
1258
|
+
image/vnd.mix 'IANA,[Reddy]
|
1259
|
+
image/vnd.ms-modi @mdi 'IANA,[Vaughan]
|
1260
|
+
image/vnd.net-fpx 'IANA,[Spencer]
|
1261
|
+
image/vnd.sealed.png @spng,spn,s1n 'IANA,[Petersen]
|
1262
|
+
image/vnd.sealedmedia.softseal.gif @sgif,sgi,s1g 'IANA,[Petersen]
|
1263
|
+
image/vnd.sealedmedia.softseal.jpg @sjpg,sjp,s1j 'IANA,[Petersen]
|
1264
|
+
image/vnd.svf 'IANA,[Moline]
|
1265
|
+
image/vnd.wap.wbmp @wbmp 'IANA,[Stark]
|
1266
|
+
image/vnd.xiff 'IANA,[S.Martin]
|
1267
|
+
|
1268
|
+
# Registered: message/*
|
1269
|
+
message/CPIM 'RFC3862
|
1270
|
+
message/delivery-status 'RFC1894
|
1271
|
+
message/disposition-notification 'RFC2298
|
1272
|
+
message/external-body :8bit 'RFC2046
|
1273
|
+
message/http 'RFC2616
|
1274
|
+
message/news :8bit 'RFC1036,[H.Spencer]
|
1275
|
+
message/partial :8bit 'RFC2046
|
1276
|
+
message/rfc822 :8bit 'RFC2046
|
1277
|
+
message/s-http 'RFC2660
|
1278
|
+
message/sip 'RFC3261
|
1279
|
+
message/sipfrag 'RFC3420
|
1280
|
+
message/tracking-status 'RFC3886
|
1281
|
+
|
1282
|
+
# Registered: model/*
|
1283
|
+
model/iges @igs,iges 'IANA,[Parks]
|
1284
|
+
model/mesh @msh,mesh,silo 'RFC2077
|
1285
|
+
model/vnd.dwf 'IANA,[Pratt]
|
1286
|
+
model/vnd.flatland.3dml 'IANA,[Powers]
|
1287
|
+
model/vnd.gdl 'IANA,[Babits]
|
1288
|
+
model/vnd.gs-gdl 'IANA,[Babits]
|
1289
|
+
model/vnd.gtw 'IANA,[Ozaki]
|
1290
|
+
model/vnd.mts 'IANA,[Rabinovitch]
|
1291
|
+
model/vnd.parasolid.transmit.binary @x_b,xmt_bin 'IANA,[Parasolid]
|
1292
|
+
model/vnd.parasolid.transmit.text @x_t,xmt_txt :quoted-printable 'IANA,[Parasolid]
|
1293
|
+
model/vnd.vtu 'IANA,[Rabinovitch]
|
1294
|
+
model/vrml @wrl,vrml 'RFC2077
|
1295
|
+
|
1296
|
+
# Registered: multipart/*
|
1297
|
+
multipart/alternative :8bit 'RFC2045,RFC2046
|
1298
|
+
multipart/appledouble :8bit 'IANA,[Faltstrom]
|
1299
|
+
multipart/byteranges 'RFC2068
|
1300
|
+
multipart/digest :8bit 'RFC2045,RFC2046
|
1301
|
+
multipart/encrypted 'RFC1847
|
1302
|
+
multipart/form-data 'RFC2388
|
1303
|
+
multipart/header-set 'IANA,[Crocker]
|
1304
|
+
multipart/mixed :8bit 'RFC2045,RFC2046
|
1305
|
+
multipart/parallel :8bit 'RFC2045,RFC2046
|
1306
|
+
multipart/related 'RFC2387
|
1307
|
+
multipart/report 'RFC1892
|
1308
|
+
multipart/signed 'RFC1847
|
1309
|
+
multipart/voice-message 'RFC2421,RFC2423
|
1310
|
+
|
1311
|
+
# Registered: text/*
|
1312
|
+
!text/ecmascript 'DRAFT:draft-hoehrmann-script-types
|
1313
|
+
!text/javascript 'DRAFT:draft-hoehrmann-script-types
|
1314
|
+
text/calendar 'RFC2445
|
1315
|
+
text/css @css :8bit 'RFC2318
|
1316
|
+
text/csv @csv :8bit 'RFC4180
|
1317
|
+
text/directory 'RFC2425
|
1318
|
+
text/dns 'RFC4027
|
1319
|
+
text/enriched 'RFC1896
|
1320
|
+
text/html @html,htm,htmlx,shtml,htx :8bit 'RFC2854
|
1321
|
+
text/parityfec 'RFC3009
|
1322
|
+
text/plain @txt,asc,c,cc,h,hh,cpp,hpp,dat,hlp 'RFC2046,RFC3676
|
1323
|
+
text/prs.fallenstein.rst @rst 'IANA,[Fallenstein]
|
1324
|
+
text/prs.lines.tag 'IANA,[Lines]
|
1325
|
+
text/RED 'RFC4102
|
1326
|
+
text/rfc822-headers 'RFC1892
|
1327
|
+
text/richtext @rtx :8bit 'RFC2045,RFC2046
|
1328
|
+
text/rtf @rtf :8bit 'IANA,[Lindner]
|
1329
|
+
text/rtx 'DRAFT:draft-ietf-avt-rtp-retransmission
|
1330
|
+
text/sgml @sgml,sgm 'RFC1874
|
1331
|
+
text/t140 'RFC4103
|
1332
|
+
text/tab-separated-values @tsv 'IANA,[Lindner]
|
1333
|
+
text/troff @t,tr,roff,troff :8bit 'DRAFT:draft-lilly-text-troff
|
1334
|
+
text/uri-list 'RFC2483
|
1335
|
+
text/vnd.abc 'IANA,[Allen]
|
1336
|
+
text/vnd.curl 'IANA,[Byrnes]
|
1337
|
+
text/vnd.DMClientScript 'IANA,[Bradley]
|
1338
|
+
text/vnd.esmertec.theme-descriptor 'IANA,[Eilemann]
|
1339
|
+
text/vnd.fly 'IANA,[Gurney]
|
1340
|
+
text/vnd.fmi.flexstor 'IANA,[Hurtta]
|
1341
|
+
text/vnd.in3d.3dml 'IANA,[Powers]
|
1342
|
+
text/vnd.in3d.spot 'IANA,[Powers]
|
1343
|
+
text/vnd.IPTC.NewsML '[IPTC]
|
1344
|
+
text/vnd.IPTC.NITF '[IPTC]
|
1345
|
+
text/vnd.latex-z 'IANA,[Lubos]
|
1346
|
+
text/vnd.motorola.reflex 'IANA,[Patton]
|
1347
|
+
text/vnd.ms-mediapackage 'IANA,[Nelson]
|
1348
|
+
text/vnd.net2phone.commcenter.command @ccc 'IANA,[Xie]
|
1349
|
+
text/vnd.sun.j2me.app-descriptor @jad :8bit 'IANA,[G.Adams]
|
1350
|
+
text/vnd.wap.si @si 'IANA,[WAP-Forum]
|
1351
|
+
text/vnd.wap.sl @sl 'IANA,[WAP-Forum]
|
1352
|
+
text/vnd.wap.wml @wml 'IANA,[Stark]
|
1353
|
+
text/vnd.wap.wmlscript @wmls 'IANA,[Stark]
|
1354
|
+
text/xml @xml,dtd :8bit 'RFC3023
|
1355
|
+
text/xml-external-parsed-entity 'RFC3023
|
1356
|
+
vms:text/plain @doc :8bit
|
1357
|
+
|
1358
|
+
# Registered: video/*
|
1359
|
+
video/3gpp @3gp,3gpp 'RFC3839,DRAFT:draft-gellens-mime-bucket
|
1360
|
+
video/3gpp-tt 'DRAFT:draft-ietf-avt-rtp-3gpp-timed-text
|
1361
|
+
video/3gpp2 'DRAFT:draft-garudadri-avt-3gpp2-mime
|
1362
|
+
video/BMPEG 'RFC3555
|
1363
|
+
video/BT656 'RFC3555
|
1364
|
+
video/CelB 'RFC3555
|
1365
|
+
video/DV 'RFC3189
|
1366
|
+
video/H261 'RFC3555
|
1367
|
+
video/H263 'RFC3555
|
1368
|
+
video/H263-1998 'RFC3555
|
1369
|
+
video/H263-2000 'RFC3555
|
1370
|
+
video/H264 'RFC3984
|
1371
|
+
video/JPEG 'RFC3555
|
1372
|
+
video/MJ2 @mj2,mjp2 'RFC3745
|
1373
|
+
video/MP1S 'RFC3555
|
1374
|
+
video/MP2P 'RFC3555
|
1375
|
+
video/MP2T 'RFC3555
|
1376
|
+
video/mp4 'DRAFT:draft-lim-mpeg4-mime
|
1377
|
+
video/MP4V-ES 'RFC3016
|
1378
|
+
video/mpeg @mp2,mpe,mp3g,mpg :base64 'RFC2045,RFC2046
|
1379
|
+
video/mpeg4-generic 'RFC3640
|
1380
|
+
video/MPV 'RFC3555
|
1381
|
+
video/nv 'RFC3555
|
1382
|
+
video/parityfec 'RFC3009
|
1383
|
+
video/pointer 'RFC2862
|
1384
|
+
video/quicktime @qt,mov :base64 'IANA,[Lindner]
|
1385
|
+
video/raw 'RFC4175
|
1386
|
+
video/rtx 'DRAFT:draft-ietf-avt-rtp-retransmission
|
1387
|
+
video/SMPTE292M 'RFC3497
|
1388
|
+
video/vnd.dlna.mpeg-tts 'IANA,[Heredia]
|
1389
|
+
video/vnd.fvt 'IANA,[Fuldseth]
|
1390
|
+
video/vnd.motorola.video 'IANA,[McGinty]
|
1391
|
+
video/vnd.motorola.videop 'IANA,[McGinty]
|
1392
|
+
video/vnd.mpegurl @mxu,m4u :8bit 'IANA,[Recktenwald]
|
1393
|
+
video/vnd.nokia.interleaved-multimedia @nim 'IANA,[Kangaslampi]
|
1394
|
+
video/vnd.objectvideo @mp4 'IANA,[Clark]
|
1395
|
+
video/vnd.sealed.mpeg1 @s11 'IANA,[Petersen]
|
1396
|
+
video/vnd.sealed.mpeg4 @smpg,s14 'IANA,[Petersen]
|
1397
|
+
video/vnd.sealed.swf @sswf,ssw 'IANA,[Petersen]
|
1398
|
+
video/vnd.sealedmedia.softseal.mov @smov,smo,s1q 'IANA,[Petersen]
|
1399
|
+
video/vnd.vivo @viv,vivo 'IANA,[Wolfe]
|
1400
|
+
|
1401
|
+
# Unregistered: application/*
|
1402
|
+
!application/x-troff 'LTSW =use-instead:text/troff
|
1403
|
+
application/x-bcpio @bcpio 'LTSW
|
1404
|
+
application/x-compressed @z,Z :base64 'LTSW
|
1405
|
+
application/x-cpio @cpio :base64 'LTSW
|
1406
|
+
application/x-csh @csh :8bit 'LTSW
|
1407
|
+
application/x-dvi @dvi :base64 'LTSW
|
1408
|
+
application/x-gtar @gtar,tgz,tbz2,tbz :base64 'LTSW
|
1409
|
+
application/x-gzip @gz :base64 'LTSW
|
1410
|
+
application/x-hdf @hdf 'LTSW
|
1411
|
+
application/x-java-archive @jar 'LTSW
|
1412
|
+
application/x-java-jnlp-file @jnlp 'LTSW
|
1413
|
+
application/x-java-serialized-object @ser 'LTSW
|
1414
|
+
application/x-java-vm @class 'LTSW
|
1415
|
+
application/x-latex @ltx,latex :8bit 'LTSW
|
1416
|
+
application/x-mif @mif 'LTSW
|
1417
|
+
application/x-rtf 'LTSW =use-instead:application/rtf
|
1418
|
+
application/x-sh @sh 'LTSW
|
1419
|
+
application/x-shar @shar 'LTSW
|
1420
|
+
application/x-stuffit @sit :base64 'LTSW
|
1421
|
+
application/x-sv4cpio @sv4cpio :base64 'LTSW
|
1422
|
+
application/x-sv4crc @sv4crc :base64 'LTSW
|
1423
|
+
application/x-tar @tar :base64 'LTSW
|
1424
|
+
application/x-tcl @tcl :8bit 'LTSW
|
1425
|
+
application/x-tex @tex :8bit
|
1426
|
+
application/x-texinfo @texinfo,texi :8bit
|
1427
|
+
application/x-troff-man @man :8bit 'LTSW
|
1428
|
+
application/x-troff-me @me 'LTSW
|
1429
|
+
application/x-troff-ms @ms 'LTSW
|
1430
|
+
application/x-ustar @ustar :base64 'LTSW
|
1431
|
+
application/x-wais-source @src 'LTSW
|
1432
|
+
mac:application/x-mac @bin :base64
|
1433
|
+
*!application/cals1840 'LTSW =use-instead:application/cals-1840
|
1434
|
+
*!application/remote_printing 'LTSW =use-instead:application/remote-printing
|
1435
|
+
*!application/x-u-star 'LTSW =use-instead:application/x-ustar
|
1436
|
+
*!application/x400.bp 'LTSW =use-instead:application/x400-bp
|
1437
|
+
*application/acad 'LTSW
|
1438
|
+
*application/clariscad 'LTSW
|
1439
|
+
*application/drafting 'LTSW
|
1440
|
+
*application/dxf 'LTSW
|
1441
|
+
*application/excel @xls,xlt 'LTSW
|
1442
|
+
*application/fractals 'LTSW
|
1443
|
+
*application/i-deas 'LTSW
|
1444
|
+
*application/macbinary 'LTSW
|
1445
|
+
*application/netcdf @nc,cdf 'LTSW
|
1446
|
+
*application/powerpoint @ppt,pps,pot :base64 'LTSW
|
1447
|
+
*application/pro_eng 'LTSW
|
1448
|
+
*application/set 'LTSW
|
1449
|
+
*application/SLA 'LTSW
|
1450
|
+
*application/solids 'LTSW
|
1451
|
+
*application/STEP 'LTSW
|
1452
|
+
*application/vda 'LTSW
|
1453
|
+
*application/word @doc,dot 'LTSW
|
1454
|
+
|
1455
|
+
# Unregistered: audio/*
|
1456
|
+
audio/x-aiff @aif,aifc,aiff :base64
|
1457
|
+
audio/x-midi @mid,midi,kar :base64
|
1458
|
+
audio/x-pn-realaudio @rm,ram :base64
|
1459
|
+
audio/x-pn-realaudio-plugin @rpm
|
1460
|
+
audio/x-realaudio @ra :base64
|
1461
|
+
audio/x-wav @wav :base64
|
1462
|
+
|
1463
|
+
# Unregistered: image/*
|
1464
|
+
*image/vnd.dgn @dgn =use-instead:image/x-vnd.dgn
|
1465
|
+
image/x-bmp @bmp
|
1466
|
+
image/x-cmu-raster @ras
|
1467
|
+
image/x-paintshoppro @psp,pspimage :base64
|
1468
|
+
image/x-pict
|
1469
|
+
image/x-portable-anymap @pnm :base64
|
1470
|
+
image/x-portable-bitmap @pbm :base64
|
1471
|
+
image/x-portable-graymap @pgm :base64
|
1472
|
+
image/x-portable-pixmap @ppm :base64
|
1473
|
+
image/x-rgb @rgb :base64
|
1474
|
+
image/x-targa @tga
|
1475
|
+
image/x-vnd.dgn @dgn
|
1476
|
+
image/x-win-bmp
|
1477
|
+
image/x-xbitmap @xbm :7bit
|
1478
|
+
image/x-xbm @xbm :7bit
|
1479
|
+
image/x-xpixmap @xpm :8bit
|
1480
|
+
image/x-xwindowdump @xwd :base64
|
1481
|
+
*!image/cmu-raster =use-instead:image/x-cmu-raster
|
1482
|
+
*!image/vnd.net.fpx =use-instead:image/vnd.net-fpx
|
1483
|
+
*image/bmp @bmp
|
1484
|
+
*image/targa @tga
|
1485
|
+
|
1486
|
+
# Unregistered: multipart/*
|
1487
|
+
multipart/x-gzip
|
1488
|
+
multipart/x-mixed-replace
|
1489
|
+
multipart/x-tar
|
1490
|
+
multipart/x-ustar
|
1491
|
+
multipart/x-www-form-urlencoded
|
1492
|
+
multipart/x-zip
|
1493
|
+
*!multipart/parallel =use-instead:multipart/parallel
|
1494
|
+
|
1495
|
+
# Unregistered: text/*
|
1496
|
+
*text/comma-separated-values @csv :8bit
|
1497
|
+
*text/vnd.flatland.3dml =use-instead:model/vnd.flatland.3dml
|
1498
|
+
text/x-vnd.flatland.3dml =use-instead:model/vnd.flatland.3dml
|
1499
|
+
text/x-setext @etx
|
1500
|
+
text/x-vcalendar @vcs :8bit
|
1501
|
+
text/x-vcard @vcf :8bit
|
1502
|
+
text/x-yaml @yaml,yml :8bit
|
1503
|
+
|
1504
|
+
# Unregistered: video/*
|
1505
|
+
*video/dl @dl :base64
|
1506
|
+
*video/gl @gl :base64
|
1507
|
+
video/x-msvideo @avi :base64
|
1508
|
+
video/x-sgi-movie @movie :base64
|
1509
|
+
|
1510
|
+
# Unregistered: other/*
|
1511
|
+
x-chemical/x-pdb @pdb
|
1512
|
+
x-chemical/x-xyz @xyz
|
1513
|
+
x-conference/x-cooltalk @ice
|
1514
|
+
x-drawing/dwf @dwf
|
1515
|
+
x-world/x-vrml @wrl,vrml
|
1516
|
+
MIME_TYPES
|
1517
|
+
|
1518
|
+
_re = %r{
|
1519
|
+
^
|
1520
|
+
([*])? # 0: Unregistered?
|
1521
|
+
(!)? # 1: Obsolete?
|
1522
|
+
(?:(\w+):)? # 2: Platform marker
|
1523
|
+
#{MIME::Type::MEDIA_TYPE_RE} # 3,4: Media type
|
1524
|
+
(?:\s@([^\s]+))? # 5: Extensions
|
1525
|
+
(?:\s:(#{MIME::Type::ENCODING_RE}))? # 6: Encoding
|
1526
|
+
(?:\s'(.+))? # 7: URL list
|
1527
|
+
(?:\s=(.+))? # 8: Documentation
|
1528
|
+
$
|
1529
|
+
}x
|
1530
|
+
|
1531
|
+
data_mime_type.each_line do |i|
|
1532
|
+
item = i.chomp.strip.gsub(%r{#.*}o, '')
|
1533
|
+
next if item.empty?
|
1534
|
+
|
1535
|
+
m = _re.match(item).captures
|
1536
|
+
|
1537
|
+
unregistered, obsolete, platform, mediatype, subtype, extensions,
|
1538
|
+
encoding, urls, docs = *m
|
1539
|
+
|
1540
|
+
extensions &&= extensions.split(/,/)
|
1541
|
+
urls &&= urls.split(/,/)
|
1542
|
+
|
1543
|
+
mime_type = MIME::Type.new("#{mediatype}/#{subtype}") do |t|
|
1544
|
+
t.extensions = extensions
|
1545
|
+
t.encoding = encoding
|
1546
|
+
t.system = platform
|
1547
|
+
t.obsolete = obsolete
|
1548
|
+
t.registered = false if unregistered
|
1549
|
+
t.docs = docs
|
1550
|
+
t.url = urls
|
1551
|
+
end
|
1552
|
+
|
1553
|
+
MIME::Types.add_type_variant(mime_type)
|
1554
|
+
MIME::Types.index_extensions(mime_type)
|
1555
|
+
end
|
1556
|
+
|
1557
|
+
_re = nil
|
1558
|
+
data_mime_type = nil
|