Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for .gpx files #113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions data/custom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@
</magic>
</mime-type>

<mime-type type="application/gpx+xml">
<_comment>GPS Exchange Format (GPX)</_comment>
<sub-class-of type="application/xml" />
<glob pattern="*.gpx" />
<magic priority="50">
<match value="&lt;gpx" type="string" offset="0:4096" />
</magic>
</mime-type>

<mime-type type="video/webm">
<sub-class-of type="application/x-matroska" />

Expand Down
4 changes: 4 additions & 0 deletions lib/marcel/tables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ module Marcel
'gnumeric' => 'application/x-gnumeric',
'go' => 'text/x-go',
'gph' => 'application/vnd.flographit',
'gpx' => 'application/gpx+xml',
'gqf' => 'application/vnd.grafeq',
'gqs' => 'application/vnd.grafeq',
'gram' => 'application/srgs',
Expand Down Expand Up @@ -1280,6 +1281,7 @@ module Marcel
'application/epub+zip' => %w(epub), # Electronic Publication
'application/fits' => %w(fits fit fts), # Flexible Image Transport System
'application/font-tdpfr' => %w(pfr),
'application/gpx+xml' => %w(gpx), # GPS Exchange Format (GPX)
'application/gzip' => %w(gz tgz), # Gzip Compressed Archive
'application/hyperstudio' => %w(stk),
'application/illustrator' => %w(ai), # Adobe Illustrator Artwork
Expand Down Expand Up @@ -2155,6 +2157,7 @@ module Marcel
'application/dita+xml;format=map' => %w(application/dita+xml),
'application/dita+xml;format=topic' => %w(application/dita+xml),
'application/dita+xml;format=val' => %w(application/dita+xml),
'application/gpx+xml' => %w(application/xml),
'application/illustrator' => %w(application/postscript),
'application/java-archive' => %w(application/zip),
'application/javascript' => %w(text/plain),
Expand Down Expand Up @@ -2497,6 +2500,7 @@ module Marcel
['application/dicom', [[128, b['DICM']]]],
['application/epub+zip', [[0, b["PK\003\004"], [[30, b['mimetypeapplication/epub+zip']]]]]],
['application/fits', [[0, b['SIMPLE = T']], [0, b['SIMPLE = T']]]],
['application/gpx+xml', [[0..4096, b['<gpx']]]],
['application/javascript', [[0, b['/* jQuery ']], [0, b['/*! jQuery ']], [0, b['/*!'], [[4..8, b['* jQuery ']]]], [0, b['(function(e,undefined){']], [0, b['!function(window,undefined){']], [0, b['/* Prototype JavaScript ']], [0, b['var Prototype={']], [0, b['function $w(t){']], [0, b['/** @license React']], [0, b['/**'], [[4..8, b['* React ']]]]]],
['application/mac-binhex40', [[11, b['must be converted with BinHex']]]],
['application/mathematica', [[0, b['(**']], [0, b['(* ']]]],
Expand Down
31 changes: 31 additions & 0 deletions test/fixtures/name/application/gpx+xml/gpx.gpx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="Wikipedia"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<!-- Comments look like this -->
<!-- Source: https://en.wikipedia.org/wiki/GPS_Exchange_Format -->
<metadata>
<name>Data name</name>
<desc>Valid GPX example without special characters</desc>
<author>
<name>Author name</name>
</author>
</metadata>
<wpt lat="52.518611" lon="13.376111">
<ele>35.0</ele>
<time>2011-12-31T23:59:59Z</time>
<name>Reichstag (Berlin)</name>
<sym>City</sym>
</wpt>
<wpt lat="48.208031" lon="16.358128">
<ele>179</ele>
<time>2011-12-31T23:59:59Z</time>
<name>Parlament (Wien)</name>
<sym>City</sym>
</wpt>
<wpt lat="46.9466" lon="7.44412">
<time>2011-12-31T23:59:59Z</time>
<name>Bundeshaus (Bern)</name>
<sym>City</sym>
< /wpt>
</gpx>
Loading