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

UnicodeMath support #28

Open
wants to merge 3 commits into
base: master
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:mantic
FROM ubuntu:24.04

RUN apt-get update && apt-get upgrade -y && apt-get install -y ragel ruby gcc g++ ruby-dev npm git wget make ruby-bundler libyaml-dev && apt-get clean

Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ gem 'rack'
gem 'rackup'
gem 'simplecov'
gem 'ox'
gem 'unitsml'
gem 'monitor'
gem 'mml', "~> 1"
9 changes: 8 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ bundle exec opal --esm -sjruby \
-qerb \
-rcorelib/array/pack \
-ropal-parser \
-gunitsml \
-ghtmlentities \
-goga \
-gparslet \
-gzeitwerk \
-gmonitor \
-sox \
-sox/ox \
-sox.so \
-Ivendor/oga/lib/ \
-Ivendor/oga/xml/ \
-Ivendor/oga/xpath/ \
-Ivendor/oga/ext/pureruby/ \
-Ivendor/ruby-ll/lib/ \
-Ivendor/ruby-ll/ext/pureruby/ \
-Ivendor/plurimath/lib \
-pplurimath \
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"scripts": {
"test": "npm run test:js && npm run test:rb",
"test:js": "npm run build && jest",
"test:rb": "podman run --rm -it -v.:/srv:z plurimath-js /bin/bash -c './setup.sh && env/plurimath'",
"test:rb": "podman run --rm -it -v $(pwd):/srv:z plurimath-js /bin/bash -c './setup.sh && env/plurimath'",
"podman:build": "podman build -t plurimath-js .",
"podman:shell": "podman run --rm -it -v.:/srv:z plurimath-js",
"podman:bundle": "podman run --rm -it -v.:/srv:z plurimath-js /bin/bash -c './setup.sh && ./build.sh'",
"podman:shell": "podman run --rm -it -v $(pwd):/srv:z plurimath-js",
"podman:bundle": "podman run --rm -it -v $(pwd):/srv:z plurimath-js /bin/bash -c './setup.sh && ./build.sh'",
"build": "npm run podman:build && npm run podman:bundle",
"submodule:init": "git submodule init && npm run submodule:update",
"submodule:update": "git submodule update"
Expand Down
9 changes: 9 additions & 0 deletions spec/to-unicodemath.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Plurimath from "../dist"

describe('to unicodemath', () => {
it('', () => {
const math = new Plurimath('∑_𝑥^𝑦 𝑧', 'unicode')

expect(math.toUnicodemath().trim()).toBe('∑_(𝑥)^(𝑦)▒〖𝑧〗')
})
})
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ export default class Plurimath {
toDisplay(lang: string) {
return this.data.$to_display(lang);
}

toUnicodemath() {
return this.data.$to_unicodemath();
}
}
3 changes: 2 additions & 1 deletion src/plurimath-opal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ declare namespace Opal {

namespace Plurimath {
namespace Math {
type Format = 'asciimath' | 'latex' | 'mathml' | 'html' | 'mahtml' | 'omml'
type Format = 'asciimath' | 'latex' | 'mathml' | 'html' | 'unicode' | 'omml'
function $parse(data: string | unknown, format: Format): ParserResult

type TransmuterFunction = () => string
Expand All @@ -17,6 +17,7 @@ declare namespace Opal {
$to_html: TransmuterFunction
$to_omml: TransmuterFunction
$to_display: (string) => string
$to_unicodemath: TransmuterFunction
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion vendor/plurimath
Submodule plurimath updated 3596 files
Loading