diff --git a/.dockerignore b/.dockerignore
index 563df111a..ff023f06a 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,3 +1,4 @@
.git
coverage
node_modules
+.nyc_output
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 591f507c6..8b116b0d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,4 +15,5 @@ node_modules
mathoid*.iml
config.vagrant.yaml
Thumbs.db
-.eslintcache
+# nyc
+.nyc_output
diff --git a/.pipeline/helm.yaml b/.pipeline/helm.yaml
index 061727629..08cd8be76 100644
--- a/.pipeline/helm.yaml
+++ b/.pipeline/helm.yaml
@@ -1 +1 @@
-chart: https://releases.wikimedia.org/charts/mathoid-0.0.17.tgz
+chart: https://releases.wikimedia.org/charts/mathoid-0.0.19.tgz
diff --git a/package.json b/package.json
index d0d2b8026..87f3fb2a1 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
"docker-start": "service-runner docker-start",
"docker-test": "service-runner docker-test",
"test-build": "service-runner docker-test && service-runner build --deploy-repo --force",
- "coverage": "istanbul cover _mocha -- -R spec",
+ "coverage": "nyc --reporter=lcov node_modules/.bin/_mocha",
"coveralls": "cat ./coverage/lcov.info | coveralls"
},
"repository": {
@@ -46,14 +46,14 @@
"compression": "^1.7.1",
"express": "^4.16.2",
"http-shutdown": "^1.2.0",
- "js-yaml": "^3.12.1",
+ "js-yaml": "^3.12.2",
"mathoid-mathjax-node": "^0.7.0",
"mock-express-request": "^0.2.2",
"mock-express-response": "^0.2.2",
"preq": "^0.5.4",
- "service-runner": "^2.6.9",
- "speech-rule-engine": "^2.1.1",
- "svgo": "^1.0.4",
+ "service-runner": "^2.6.17",
+ "speech-rule-engine": "^2.3.2",
+ "svgo": "^1.2.0",
"swagger-router": "^0.7.1",
"texvcinfo": "^0.5.3"
},
@@ -66,15 +66,17 @@
"commander": "^2.9.0",
"coveralls": "^3.0.2",
"dom-compare": "^0.3.1",
- "eslint-config-wikimedia": "^0.10.1",
- "eslint-plugin-jsdoc": "^4.1.0",
- "eslint-plugin-json": "^1.2.0",
+ "eslint-config-wikimedia": "^0.11.0",
+ "eslint-plugin-jsdoc": "^4.1.1",
+ "eslint-plugin-json": "^1.4.0",
+ "eslint": "^5.15.1",
"extend": "^3.0.0",
"istanbul": "^0.4.5",
"microtime": "^3.0.0",
"mocha": "^5.2.0",
"mocha-lcov-reporter": "^1.3.0",
"mock-require": "^3.0.3",
+ "nyc": "^13.3.0",
"rewire": "^4.0.1",
"xmldom": "^0.1.21"
},
diff --git a/routes/mathoid.js b/routes/mathoid.js
index c7812a7a0..b0116b1d0 100644
--- a/routes/mathoid.js
+++ b/routes/mathoid.js
@@ -39,7 +39,7 @@ router.get('/get/:outformat?/:type?/:q?', (req, res) => {
* GET /
* Performs the check get request
*/
-router.get('/zlib/:outformat?/:type?/:q*', (req, res) => {
+router.get('/zlib/:outformat/:type/:q*', (req, res) => {
if (!(req.params.q)) {
emitError('q (query) parameter is missing!');
}
diff --git a/spec.yaml b/spec.yaml
index 7b8fc5cf4..cfefc4f34 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -1,6 +1,5 @@
-swagger: '2.0'
+openapi: 3.0.1
info:
- version: 0.2.8
title: Mathoid
description: Renders TeX to SVG and MathML using MathJax
termsOfService: https://wikimediafoundation.org/wiki/Terms_of_Use
@@ -10,6 +9,11 @@ info:
license:
name: Apache2
url: http://www.apache.org/licenses/LICENSE-2.0
+ version: 0.2.8
+# TODO: uncomment once we have support for removing
+# trailing slashes in service-checker
+#servers:
+# - url: /
paths:
# from routes/root.js
/robots.txt:
@@ -18,14 +22,20 @@ paths:
- Root
- Robots
description: Gets robots.txt
+ responses:
+ 200:
+ description: OK
+ content: {}
x-monitor: false
/:
get:
tags:
- Root
description: The root service end-point
- produces:
- - application/json
+ responses:
+ 200:
+ description: OK
+ content: {}
x-amples:
- title: spec from root
request:
@@ -37,13 +47,19 @@ paths:
tags:
- Render
description: Converts TeX to MathML, SVG, PNG and IMG
- produces:
- - application/json
+ responses:
+ 200:
+ description: OK
+ content: {}
+ 400:
+ description: invalid input
+ content: {}
x-amples:
+ # from routes/info.js
- title: mass-energy equivalence (json)
request:
body:
- q: 'E=mc^2'
+ q: E=mc^2
response:
status: 200
body:
@@ -51,15 +67,17 @@ paths:
success: true
svg: /.+/
mml: /.+/
- # from routes/info.js
/_info:
get:
tags:
- Service information
description: Gets information about the service
- produces:
- - application/json
+ responses:
+ 200:
+ description: OK
+ content: {}
x-amples:
+ # from routes/mathoid.js
- title: retrieve service info
request: {}
response:
@@ -71,23 +89,42 @@ paths:
description: /.+/
version: /.+/
home: /.+/
- # from routes/mathoid.js
/{format}/:
post:
tags:
- Render
- description: Converts TeX to SVG, PNG or MathML depending on the parameter format. The special format 'texvcinfo' returns information about the input without to render anything.
- produces:
- - image/svg+xml
- - application/mathml+xml
- - application/json
+ description: Converts TeX to SVG, PNG or MathML depending on the parameter format.
+ The special format 'texvcinfo' returns information about the input without
+ to render anything.
+ parameters:
+ - name: format
+ in: path
+ description: output type
+ required: true
+ schema:
+ type: string
+ enum:
+ - texvcinfo
+ - speech
+ - mml
+ - svg
+ - png
+ - json
+ - complete
+ responses:
+ 200:
+ description: OK
+ content: {}
+ 400:
+ description: invalid input
+ content: {}
x-amples:
- title: mass-energy equivalence (complete)
request:
params:
format: complete
body:
- q: 'E=mc^2'
+ q: E=mc^2
response:
status: 200
headers:
@@ -108,7 +145,7 @@ paths:
params:
format: svg
body:
- q: 'E=mc^2'
+ q: E=mc^2
response:
status: 200
headers:
@@ -119,7 +156,7 @@ paths:
params:
format: mml
body:
- q: 'E=mc^2'
+ q: E=mc^2
response:
status: 200
headers:
@@ -130,7 +167,7 @@ paths:
params:
format: texvcinfo
body:
- q: 'E = m c^2'
+ q: E = m c^2
response:
status: 200
headers:
@@ -138,13 +175,16 @@ paths:
body:
success: true
checked: /E=mc/
- identifiers: ["E", "m", "c"]
- - title: Invaid command (texvcinfo)
+ identifiers:
+ - E
+ - m
+ - c
+ - title: Invalid command (texvcinfo)
request:
params:
format: texvcinfo
body:
- q: 'a + \invalid = b'
+ q: a + \invalid = b
response:
status: 400
headers:
@@ -157,42 +197,52 @@ paths:
location:
start:
column: 5
- /zlib{/outformat}{/type}/{q}:
+ /zlib/{outformat}/{type}/{q}:
get:
tags:
- zLib
- description: Converts a formula encoded in the URI to TeX to SVG, PNG or MathML depending on the parameter format. The special format 'texvcinfo' returns information about the input without to render anything.
- produces:
- - image/svg+xml
- - application/mathml+xml
- - application/json
+ description: Converts a formula encoded in the URI to TeX to SVG, PNG or MathML
+ depending on the parameter format. The special format 'texvcinfo' returns
+ information about the input without to render anything.
parameters:
- name: outformat
in: path
- type: string
description: output type
- enum:
- - texvcinfo
- - speech
- - mml
- - svg
- - png
- - json
- - complete
+ required: true
+ schema:
+ type: string
+ enum:
+ - texvcinfo
+ - speech
+ - mml
+ - svg
+ - png
+ - json
+ - complete
- name: type
in: path
- type: string
description: input type
- enum:
- - tex
- - inline-tex
- - mml
- - ascii
+ required: true
+ schema:
+ type: string
+ enum:
+ - tex
+ - inline-tex
+ - mml
+ - ascii
- name: q
in: path
- type: string
- required: true
description: compressed input to be converted
+ required: true
+ schema:
+ type: string
+ responses:
+ 200:
+ description: OK
+ content: {}
+ 400:
+ description: Bad request
+ content: {}
# TODO: remove and uncomment the below example
# once T215220 has been resolved
x-monitor: false
@@ -214,3 +264,4 @@ paths:
# - E
# - m
# - c
+components: {}
diff --git a/test/files/mathjax-texvc/mathjax-texvc.json b/test/files/mathjax-texvc/mathjax-texvc.json
index 64238b515..ba4a4f6b1 100644
--- a/test/files/mathjax-texvc/mathjax-texvc.json
+++ b/test/files/mathjax-texvc/mathjax-texvc.json
@@ -468,5 +468,55 @@
"id": 93,
"input": "{\\displaystyle \\left(\\left(\\sum_A\\right)B \\right)}",
"texvcjs": "{\\displaystyle \\left(\\left(\\sum_A\\right)B \\right)}"
+ },
+ {
+ "id": 94,
+ "input": "\\varDelta",
+ "texvcjs": "\\varDelta "
+ },
+ {
+ "id": 95,
+ "input": "\\varGamma",
+ "texvcjs": "\\varGamma "
+ },
+ {
+ "id": 96,
+ "input": "\\varLambda",
+ "texvcjs": "\\varLambda "
+ },
+ {
+ "id": 97,
+ "input": "\\varOmega",
+ "texvcjs": "\\varOmega "
+ },
+ {
+ "id": 98,
+ "input": "\\varPhi",
+ "texvcjs": "\\varPhi "
+ },
+ {
+ "id": 99,
+ "input": "\\varPi",
+ "texvcjs": "\\varPi "
+ },
+ {
+ "id": 100,
+ "input": "\\varSigma",
+ "texvcjs": "\\varSigma "
+ },
+ {
+ "id": 101,
+ "input": "\\varTheta",
+ "texvcjs": "\\varTheta "
+ },
+ {
+ "id": 102,
+ "input": "\\varUpsilon",
+ "texvcjs": "\\varUpsilon "
+ },
+ {
+ "id": 103,
+ "input": "\\varXi",
+ "texvcjs": "\\varXi "
}
]
\ No newline at end of file
diff --git a/test/files/mathjax-texvc/png/100.png b/test/files/mathjax-texvc/png/100.png
new file mode 100644
index 000000000..4b6026eb1
Binary files /dev/null and b/test/files/mathjax-texvc/png/100.png differ
diff --git a/test/files/mathjax-texvc/png/101.png b/test/files/mathjax-texvc/png/101.png
new file mode 100644
index 000000000..6a71207e2
Binary files /dev/null and b/test/files/mathjax-texvc/png/101.png differ
diff --git a/test/files/mathjax-texvc/png/102.png b/test/files/mathjax-texvc/png/102.png
new file mode 100644
index 000000000..eeb1dec33
Binary files /dev/null and b/test/files/mathjax-texvc/png/102.png differ
diff --git a/test/files/mathjax-texvc/png/103.png b/test/files/mathjax-texvc/png/103.png
new file mode 100644
index 000000000..607af0b76
Binary files /dev/null and b/test/files/mathjax-texvc/png/103.png differ
diff --git a/test/files/mathjax-texvc/png/94.png b/test/files/mathjax-texvc/png/94.png
new file mode 100644
index 000000000..52a1f50a0
Binary files /dev/null and b/test/files/mathjax-texvc/png/94.png differ
diff --git a/test/files/mathjax-texvc/png/95.png b/test/files/mathjax-texvc/png/95.png
new file mode 100644
index 000000000..2a8eba8be
Binary files /dev/null and b/test/files/mathjax-texvc/png/95.png differ
diff --git a/test/files/mathjax-texvc/png/96.png b/test/files/mathjax-texvc/png/96.png
new file mode 100644
index 000000000..31802faad
Binary files /dev/null and b/test/files/mathjax-texvc/png/96.png differ
diff --git a/test/files/mathjax-texvc/png/97.png b/test/files/mathjax-texvc/png/97.png
new file mode 100644
index 000000000..9d73a494f
Binary files /dev/null and b/test/files/mathjax-texvc/png/97.png differ
diff --git a/test/files/mathjax-texvc/png/98.png b/test/files/mathjax-texvc/png/98.png
new file mode 100644
index 000000000..484841bea
Binary files /dev/null and b/test/files/mathjax-texvc/png/98.png differ
diff --git a/test/files/mathjax-texvc/png/99.png b/test/files/mathjax-texvc/png/99.png
new file mode 100644
index 000000000..f50b1d0d1
Binary files /dev/null and b/test/files/mathjax-texvc/png/99.png differ
diff --git a/test/files/mathjax-texvc/svg/100.svg b/test/files/mathjax-texvc/svg/100.svg
new file mode 100644
index 000000000..db2669f4b
--- /dev/null
+++ b/test/files/mathjax-texvc/svg/100.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/test/files/mathjax-texvc/svg/101.svg b/test/files/mathjax-texvc/svg/101.svg
new file mode 100644
index 000000000..7810f1a1d
--- /dev/null
+++ b/test/files/mathjax-texvc/svg/101.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/test/files/mathjax-texvc/svg/102.svg b/test/files/mathjax-texvc/svg/102.svg
new file mode 100644
index 000000000..901022fc3
--- /dev/null
+++ b/test/files/mathjax-texvc/svg/102.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/test/files/mathjax-texvc/svg/103.svg b/test/files/mathjax-texvc/svg/103.svg
new file mode 100644
index 000000000..c8c94379c
--- /dev/null
+++ b/test/files/mathjax-texvc/svg/103.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/test/files/mathjax-texvc/svg/94.svg b/test/files/mathjax-texvc/svg/94.svg
new file mode 100644
index 000000000..c5ef10b07
--- /dev/null
+++ b/test/files/mathjax-texvc/svg/94.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/test/files/mathjax-texvc/svg/95.svg b/test/files/mathjax-texvc/svg/95.svg
new file mode 100644
index 000000000..4a67b9b70
--- /dev/null
+++ b/test/files/mathjax-texvc/svg/95.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/test/files/mathjax-texvc/svg/96.svg b/test/files/mathjax-texvc/svg/96.svg
new file mode 100644
index 000000000..e29615b4b
--- /dev/null
+++ b/test/files/mathjax-texvc/svg/96.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/test/files/mathjax-texvc/svg/97.svg b/test/files/mathjax-texvc/svg/97.svg
new file mode 100644
index 000000000..105dc3796
--- /dev/null
+++ b/test/files/mathjax-texvc/svg/97.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/test/files/mathjax-texvc/svg/98.svg b/test/files/mathjax-texvc/svg/98.svg
new file mode 100644
index 000000000..ef207888d
--- /dev/null
+++ b/test/files/mathjax-texvc/svg/98.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/test/files/mathjax-texvc/svg/99.svg b/test/files/mathjax-texvc/svg/99.svg
new file mode 100644
index 000000000..de5880cd4
--- /dev/null
+++ b/test/files/mathjax-texvc/svg/99.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/test/files/mathjax-texvc/test.md b/test/files/mathjax-texvc/test.md
index 92633f82d..820fa3e8e 100644
--- a/test/files/mathjax-texvc/test.md
+++ b/test/files/mathjax-texvc/test.md
@@ -87,4 +87,14 @@
* Test 90 $\pagecolor{red}x$ ($\pagecolor {red}x$) [Test-image-svg](svg/90.svg)
* Test 91 $\vline$ ($\vline $) [Test-image-svg](svg/91.svg)
* Test 92 $\image$ ($\Im $) [Test-image-svg](svg/92.svg)
- * Test 93 ${\displaystyle \left(\left(\sum_A\right)B \right)}$ (${\displaystyle \left(\left(\sum_A\right)B \right)}$) [Test-image-svg](svg/93.svg)
\ No newline at end of file
+ * Test 93 ${\displaystyle \left(\left(\sum_A\right)B \right)}$ (${\displaystyle \left(\left(\sum_A\right)B \right)}$) [Test-image-svg](svg/93.svg)
+ * Test 94 $\varDelta$ ($\varDelta $) [Test-image-svg](svg/94.svg)
+ * Test 95 $\varGamma$ ($\varGamma $) [Test-image-svg](svg/95.svg)
+ * Test 96 $\varLambda$ ($\varLambda $) [Test-image-svg](svg/96.svg)
+ * Test 97 $\varOmega$ ($\varOmega $) [Test-image-svg](svg/97.svg)
+ * Test 98 $\varPhi$ ($\varPhi $) [Test-image-svg](svg/98.svg)
+ * Test 99 $\varPi$ ($\varPi $) [Test-image-svg](svg/99.svg)
+ * Test 100 $\varSigma$ ($\varSigma $) [Test-image-svg](svg/100.svg)
+ * Test 101 $\varTheta$ ($\varTheta $) [Test-image-svg](svg/101.svg)
+ * Test 102 $\varUpsilon$ ($\varUpsilon $) [Test-image-svg](svg/102.svg)
+ * Test 103 $\varXi$ ($\varXi $) [Test-image-svg](svg/103.svg)
\ No newline at end of file