summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Chapoton <fchapoton2@gmail.com>2020-11-07 11:43:10 +0000
committerDavid Faure <faure@kde.org>2020-11-07 11:43:10 +0000
commit513d0a33669653ff2957a16c91da7cb0396b4f76 (patch)
treea63e366f6d3830f0241c9947528693f2431be335
parent2fd740138be554de9ae18cf3a97f4f5b72c7b781 (diff)
downloadshared-mime-info-513d0a33669653ff2957a16c91da7cb0396b4f76.tar.gz
Update freedesktop.org.xml.in : add .sage file format for SageMath script files
-rw-r--r--data/freedesktop.org.xml.in5
-rw-r--r--tests/mime-detection/example_mime.sage14
-rw-r--r--tests/mime-detection/list2
3 files changed, 21 insertions, 0 deletions
diff --git a/data/freedesktop.org.xml.in b/data/freedesktop.org.xml.in
index c9705e64..ba33762e 100644
--- a/data/freedesktop.org.xml.in
+++ b/data/freedesktop.org.xml.in
@@ -6331,6 +6331,11 @@ command to generate the output files.
<glob pattern="*.pyx" weight="60"/>
<glob pattern="*.wsgi" weight="60"/>
</mime-type>
+ <mime-type type="text/x-sagemath">
+ <comment>SageMath script</comment>
+ <sub-class-of type="text/x-python"/>
+ <glob pattern="*.sage" weight="60"/>
+ </mime-type>
<mime-type type="text/x-lua">
<comment>Lua script</comment>
<sub-class-of type='application/x-executable'/>
diff --git a/tests/mime-detection/example_mime.sage b/tests/mime-detection/example_mime.sage
new file mode 100644
index 00000000..95855749
--- /dev/null
+++ b/tests/mime-detection/example_mime.sage
@@ -0,0 +1,14 @@
+@cached_function
+def test(n):
+ """
+ An arbitrary recursion, with caching.
+
+ EXAMPLES::
+
+ sage: [test(i) for i in range(7)]
+ [1, 1, 4/3, 5/3, 61/27, 86/27, 10687/2187]
+ """
+ if n == 0 or n == 1:
+ return 1
+ else:
+ return test(n - 1) + test(n - 2)^2 / 3
diff --git a/tests/mime-detection/list b/tests/mime-detection/list
index dd6b4df6..3c28ff2e 100644
--- a/tests/mime-detection/list
+++ b/tests/mime-detection/list
@@ -365,6 +365,8 @@ test3.py text/x-python3 x
test.py3 text/x-python3
# PySide
pyside.py text/x-python
+# SageMath
+example_mime.sage text/x-sagemath oxo
# Perl
test.pl application/x-perl
test.pm application/x-perl