From b35110d978d9a2061c59bcca1310b70f6f6011e1 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Wed, 13 Dec 2017 14:20:20 +0100 Subject: Move Namespace to Gitaly using OPT-OUT --- lib/gitlab/shell.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb index a22a63665be..1c48143b3b5 100644 --- a/lib/gitlab/shell.rb +++ b/lib/gitlab/shell.rb @@ -228,7 +228,8 @@ module Gitlab # # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/385 def add_namespace(storage, name) - Gitlab::GitalyClient.migrate(:add_namespace) do |enabled| + Gitlab::GitalyClient.migrate(:add_namespace, + status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |enabled| if enabled gitaly_namespace_client(storage).add(name) else @@ -250,7 +251,8 @@ module Gitlab # # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/385 def rm_namespace(storage, name) - Gitlab::GitalyClient.migrate(:remove_namespace) do |enabled| + Gitlab::GitalyClient.migrate(:remove_namespace, + status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |enabled| if enabled gitaly_namespace_client(storage).remove(name) else @@ -268,7 +270,8 @@ module Gitlab # # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/385 def mv_namespace(storage, old_name, new_name) - Gitlab::GitalyClient.migrate(:rename_namespace) do |enabled| + Gitlab::GitalyClient.migrate(:rename_namespace, + status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |enabled| if enabled gitaly_namespace_client(storage).rename(old_name, new_name) else @@ -302,7 +305,8 @@ module Gitlab # # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/385 def exists?(storage, dir_name) - Gitlab::GitalyClient.migrate(:namespace_exists) do |enabled| + Gitlab::GitalyClient.migrate(:namespace_exists, + status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |enabled| if enabled gitaly_namespace_client(storage).exists?(dir_name) else -- cgit v1.2.1 From 16de14ea980aec9da2b6960adff6d08597bd88b0 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Mon, 11 Dec 2017 13:35:27 -0600 Subject: Updated katex library --- changelogs/unreleased/jivl-update-katex.yml | 5 + vendor/assets/fonts/KaTeX_AMS-Regular.eot | Bin 71656 -> 71656 bytes vendor/assets/fonts/KaTeX_AMS-Regular.ttf | Bin 71428 -> 71428 bytes vendor/assets/fonts/KaTeX_AMS-Regular.woff | Bin 40200 -> 40200 bytes vendor/assets/fonts/KaTeX_AMS-Regular.woff2 | Bin 33188 -> 33212 bytes vendor/assets/fonts/KaTeX_Caligraphic-Bold.eot | Bin 19836 -> 19836 bytes vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf | Bin 19588 -> 19588 bytes vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff | Bin 12136 -> 12136 bytes vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 | Bin 10604 -> 10584 bytes vendor/assets/fonts/KaTeX_Caligraphic-Regular.eot | Bin 19220 -> 19220 bytes vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf | Bin 18960 -> 18960 bytes vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff | Bin 11868 -> 11868 bytes .../assets/fonts/KaTeX_Caligraphic-Regular.woff2 | Bin 10396 -> 10396 bytes vendor/assets/fonts/KaTeX_Fraktur-Bold.eot | Bin 36200 -> 36200 bytes vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf | Bin 35968 -> 35968 bytes vendor/assets/fonts/KaTeX_Fraktur-Bold.woff | Bin 23388 -> 23388 bytes vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 | Bin 20476 -> 20472 bytes vendor/assets/fonts/KaTeX_Fraktur-Regular.eot | Bin 34896 -> 34896 bytes vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf | Bin 34652 -> 34652 bytes vendor/assets/fonts/KaTeX_Fraktur-Regular.woff | Bin 22844 -> 22844 bytes vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 | Bin 19868 -> 19872 bytes vendor/assets/fonts/KaTeX_Main-Bold.eot | Bin 60688 -> 63248 bytes vendor/assets/fonts/KaTeX_Main-Bold.ttf | Bin 60468 -> 63028 bytes vendor/assets/fonts/KaTeX_Main-Bold.woff | Bin 35480 -> 37160 bytes vendor/assets/fonts/KaTeX_Main-Bold.woff2 | Bin 29492 -> 31000 bytes vendor/assets/fonts/KaTeX_Main-Italic.eot | Bin 44132 -> 47864 bytes vendor/assets/fonts/KaTeX_Main-Italic.ttf | Bin 43904 -> 47636 bytes vendor/assets/fonts/KaTeX_Main-Italic.woff | Bin 24880 -> 27092 bytes vendor/assets/fonts/KaTeX_Main-Italic.woff2 | Bin 21032 -> 22972 bytes vendor/assets/fonts/KaTeX_Main-Regular.eot | Bin 68228 -> 71548 bytes vendor/assets/fonts/KaTeX_Main-Regular.ttf | Bin 67996 -> 71316 bytes vendor/assets/fonts/KaTeX_Main-Regular.woff | Bin 37620 -> 39576 bytes vendor/assets/fonts/KaTeX_Main-Regular.woff2 | Bin 31220 -> 32948 bytes vendor/assets/fonts/KaTeX_Math-BoldItalic.eot | Bin 39990 -> 39990 bytes vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf | Bin 39744 -> 39744 bytes vendor/assets/fonts/KaTeX_Math-BoldItalic.woff | Bin 23192 -> 23192 bytes vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 | Bin 20036 -> 20028 bytes vendor/assets/fonts/KaTeX_Math-Italic.eot | Bin 41676 -> 41676 bytes vendor/assets/fonts/KaTeX_Math-Italic.ttf | Bin 41448 -> 41448 bytes vendor/assets/fonts/KaTeX_Math-Italic.woff | Bin 23820 -> 23820 bytes vendor/assets/fonts/KaTeX_Math-Italic.woff2 | Bin 20432 -> 20420 bytes vendor/assets/fonts/KaTeX_Math-Regular.eot | Bin 41536 -> 41536 bytes vendor/assets/fonts/KaTeX_Math-Regular.ttf | Bin 41304 -> 41304 bytes vendor/assets/fonts/KaTeX_Math-Regular.woff | Bin 23712 -> 23712 bytes vendor/assets/fonts/KaTeX_Math-Regular.woff2 | Bin 20344 -> 20384 bytes vendor/assets/fonts/KaTeX_SansSerif-Bold.eot | Bin 34204 -> 34204 bytes vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf | Bin 33964 -> 33964 bytes vendor/assets/fonts/KaTeX_SansSerif-Bold.woff | Bin 19196 -> 19196 bytes vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 | Bin 16020 -> 16000 bytes vendor/assets/fonts/KaTeX_SansSerif-Italic.eot | Bin 31320 -> 31320 bytes vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf | Bin 31072 -> 31072 bytes vendor/assets/fonts/KaTeX_SansSerif-Italic.woff | Bin 18080 -> 18080 bytes vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 | Bin 15152 -> 15144 bytes vendor/assets/fonts/KaTeX_SansSerif-Regular.eot | Bin 30212 -> 30212 bytes vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf | Bin 29960 -> 29960 bytes vendor/assets/fonts/KaTeX_SansSerif-Regular.woff | Bin 16744 -> 16744 bytes vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 | Bin 13908 -> 13900 bytes vendor/assets/fonts/KaTeX_Script-Regular.eot | Bin 25104 -> 25104 bytes vendor/assets/fonts/KaTeX_Script-Regular.ttf | Bin 24864 -> 24864 bytes vendor/assets/fonts/KaTeX_Script-Regular.woff | Bin 13856 -> 13856 bytes vendor/assets/fonts/KaTeX_Script-Regular.woff2 | Bin 12276 -> 12284 bytes vendor/assets/fonts/KaTeX_Size1-Regular.eot | Bin 13408 -> 13408 bytes vendor/assets/fonts/KaTeX_Size1-Regular.ttf | Bin 13172 -> 13172 bytes vendor/assets/fonts/KaTeX_Size1-Regular.woff | Bin 6980 -> 6980 bytes vendor/assets/fonts/KaTeX_Size1-Regular.woff2 | Bin 5820 -> 5812 bytes vendor/assets/fonts/KaTeX_Size2-Regular.eot | Bin 12648 -> 12648 bytes vendor/assets/fonts/KaTeX_Size2-Regular.ttf | Bin 12412 -> 12412 bytes vendor/assets/fonts/KaTeX_Size2-Regular.woff | Bin 6684 -> 6684 bytes vendor/assets/fonts/KaTeX_Size2-Regular.woff2 | Bin 5560 -> 5556 bytes vendor/assets/fonts/KaTeX_Size3-Regular.eot | Bin 8596 -> 8596 bytes vendor/assets/fonts/KaTeX_Size3-Regular.ttf | Bin 8360 -> 8360 bytes vendor/assets/fonts/KaTeX_Size3-Regular.woff | Bin 4776 -> 4776 bytes vendor/assets/fonts/KaTeX_Size3-Regular.woff2 | Bin 3856 -> 3852 bytes vendor/assets/fonts/KaTeX_Size4-Regular.eot | Bin 11520 -> 11520 bytes vendor/assets/fonts/KaTeX_Size4-Regular.ttf | Bin 11284 -> 11284 bytes vendor/assets/fonts/KaTeX_Size4-Regular.woff | Bin 6456 -> 6456 bytes vendor/assets/fonts/KaTeX_Size4-Regular.woff2 | Bin 5172 -> 5168 bytes vendor/assets/fonts/KaTeX_Typewriter-Regular.eot | Bin 35784 -> 35984 bytes vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf | Bin 35528 -> 35728 bytes vendor/assets/fonts/KaTeX_Typewriter-Regular.woff | Bin 20712 -> 20812 bytes vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 | Bin 17344 -> 17360 bytes vendor/assets/javascripts/katex.js | 15018 +++++++++++++------ vendor/assets/stylesheets/katex.scss | 712 +- 83 files changed, 10837 insertions(+), 4898 deletions(-) create mode 100644 changelogs/unreleased/jivl-update-katex.yml mode change 100644 => 100755 vendor/assets/fonts/KaTeX_AMS-Regular.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_AMS-Regular.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_AMS-Regular.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_AMS-Regular.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Caligraphic-Bold.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Caligraphic-Regular.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Fraktur-Bold.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Fraktur-Bold.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Fraktur-Regular.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Fraktur-Regular.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Main-Bold.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Main-Bold.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Main-Bold.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Main-Bold.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Main-Italic.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Main-Italic.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Main-Italic.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Main-Italic.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Main-Regular.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Main-Regular.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Main-Regular.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Main-Regular.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Math-BoldItalic.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Math-BoldItalic.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Math-Italic.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Math-Italic.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Math-Italic.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Math-Italic.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Math-Regular.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Math-Regular.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Math-Regular.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Math-Regular.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_SansSerif-Bold.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_SansSerif-Bold.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_SansSerif-Italic.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_SansSerif-Italic.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_SansSerif-Regular.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_SansSerif-Regular.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Script-Regular.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Script-Regular.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Script-Regular.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Script-Regular.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size1-Regular.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size1-Regular.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size1-Regular.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size1-Regular.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size2-Regular.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size2-Regular.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size2-Regular.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size2-Regular.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size3-Regular.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size3-Regular.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size3-Regular.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size3-Regular.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size4-Regular.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size4-Regular.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size4-Regular.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Size4-Regular.woff2 mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Typewriter-Regular.eot mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Typewriter-Regular.woff mode change 100644 => 100755 vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 diff --git a/changelogs/unreleased/jivl-update-katex.yml b/changelogs/unreleased/jivl-update-katex.yml new file mode 100644 index 00000000000..99b5fe49620 --- /dev/null +++ b/changelogs/unreleased/jivl-update-katex.yml @@ -0,0 +1,5 @@ +--- +title: Updated the katex library +merge_request: 15864 +author: +type: other diff --git a/vendor/assets/fonts/KaTeX_AMS-Regular.eot b/vendor/assets/fonts/KaTeX_AMS-Regular.eot old mode 100644 new mode 100755 index 784276a3cbf..97fd899ab05 Binary files a/vendor/assets/fonts/KaTeX_AMS-Regular.eot and b/vendor/assets/fonts/KaTeX_AMS-Regular.eot differ diff --git a/vendor/assets/fonts/KaTeX_AMS-Regular.ttf b/vendor/assets/fonts/KaTeX_AMS-Regular.ttf old mode 100644 new mode 100755 index 6f1e0be2028..001c30f2f43 Binary files a/vendor/assets/fonts/KaTeX_AMS-Regular.ttf and b/vendor/assets/fonts/KaTeX_AMS-Regular.ttf differ diff --git a/vendor/assets/fonts/KaTeX_AMS-Regular.woff b/vendor/assets/fonts/KaTeX_AMS-Regular.woff old mode 100644 new mode 100755 index 4dded4733b3..c6376aeac46 Binary files a/vendor/assets/fonts/KaTeX_AMS-Regular.woff and b/vendor/assets/fonts/KaTeX_AMS-Regular.woff differ diff --git a/vendor/assets/fonts/KaTeX_AMS-Regular.woff2 b/vendor/assets/fonts/KaTeX_AMS-Regular.woff2 old mode 100644 new mode 100755 index ea81079c4e2..6b43fd937ab Binary files a/vendor/assets/fonts/KaTeX_AMS-Regular.woff2 and b/vendor/assets/fonts/KaTeX_AMS-Regular.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.eot b/vendor/assets/fonts/KaTeX_Caligraphic-Bold.eot old mode 100644 new mode 100755 index 1a0db0c568e..f4613bc7c39 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.eot and b/vendor/assets/fonts/KaTeX_Caligraphic-Bold.eot differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf b/vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf old mode 100644 new mode 100755 index b94907dad11..e92c81860c5 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf and b/vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff b/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff old mode 100644 new mode 100755 index 799fa8122ca..a27cd773c62 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff and b/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 b/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 old mode 100644 new mode 100755 index 73bb5422878..d9ababd7685 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 and b/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.eot b/vendor/assets/fonts/KaTeX_Caligraphic-Regular.eot old mode 100644 new mode 100755 index 6cc83d0922c..b7f66c8e206 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.eot and b/vendor/assets/fonts/KaTeX_Caligraphic-Regular.eot differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf b/vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf old mode 100644 new mode 100755 index cf51e2021e4..e7736624028 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf and b/vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff b/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff old mode 100644 new mode 100755 index f5e5c623577..c6df9639e16 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff and b/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 b/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 old mode 100644 new mode 100755 index dd76d3488d5..d762739df6d Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 and b/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Bold.eot b/vendor/assets/fonts/KaTeX_Fraktur-Bold.eot old mode 100644 new mode 100755 index 1960b106656..ffade5ea4ae Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Bold.eot and b/vendor/assets/fonts/KaTeX_Fraktur-Bold.eot differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf b/vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf old mode 100644 new mode 100755 index 7b0790f1ae8..977b2f9a8f8 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf and b/vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff b/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff old mode 100644 new mode 100755 index dc325713291..fd2d1be5547 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff and b/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 b/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 old mode 100644 new mode 100755 index fdc429227ad..f5b9bc4611b Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 and b/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Regular.eot b/vendor/assets/fonts/KaTeX_Fraktur-Regular.eot old mode 100644 new mode 100755 index e4e73796aea..1676056a3e3 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Regular.eot and b/vendor/assets/fonts/KaTeX_Fraktur-Regular.eot differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf b/vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf old mode 100644 new mode 100755 index 063bc0263eb..a2b86fcf0f0 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf and b/vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff b/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff old mode 100644 new mode 100755 index c4b18d863f3..9088fcd1da8 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff and b/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 b/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 old mode 100644 new mode 100755 index 4318d938e26..748ed0e0688 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 and b/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Main-Bold.eot b/vendor/assets/fonts/KaTeX_Main-Bold.eot old mode 100644 new mode 100755 index 80fbd022363..3af6f51c107 Binary files a/vendor/assets/fonts/KaTeX_Main-Bold.eot and b/vendor/assets/fonts/KaTeX_Main-Bold.eot differ diff --git a/vendor/assets/fonts/KaTeX_Main-Bold.ttf b/vendor/assets/fonts/KaTeX_Main-Bold.ttf old mode 100644 new mode 100755 index 8e10722afae..0a9434d1ed3 Binary files a/vendor/assets/fonts/KaTeX_Main-Bold.ttf and b/vendor/assets/fonts/KaTeX_Main-Bold.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Main-Bold.woff b/vendor/assets/fonts/KaTeX_Main-Bold.woff old mode 100644 new mode 100755 index 43b361a6005..42e687ed86a Binary files a/vendor/assets/fonts/KaTeX_Main-Bold.woff and b/vendor/assets/fonts/KaTeX_Main-Bold.woff differ diff --git a/vendor/assets/fonts/KaTeX_Main-Bold.woff2 b/vendor/assets/fonts/KaTeX_Main-Bold.woff2 old mode 100644 new mode 100755 index af57a96c148..ad0487c9c3c Binary files a/vendor/assets/fonts/KaTeX_Main-Bold.woff2 and b/vendor/assets/fonts/KaTeX_Main-Bold.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Main-Italic.eot b/vendor/assets/fonts/KaTeX_Main-Italic.eot old mode 100644 new mode 100755 index fc770166b5e..0c2537ba89c Binary files a/vendor/assets/fonts/KaTeX_Main-Italic.eot and b/vendor/assets/fonts/KaTeX_Main-Italic.eot differ diff --git a/vendor/assets/fonts/KaTeX_Main-Italic.ttf b/vendor/assets/fonts/KaTeX_Main-Italic.ttf old mode 100644 new mode 100755 index d124495d7b6..a8142a7fe34 Binary files a/vendor/assets/fonts/KaTeX_Main-Italic.ttf and b/vendor/assets/fonts/KaTeX_Main-Italic.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Main-Italic.woff b/vendor/assets/fonts/KaTeX_Main-Italic.woff old mode 100644 new mode 100755 index e623236bc44..0c301bd6787 Binary files a/vendor/assets/fonts/KaTeX_Main-Italic.woff and b/vendor/assets/fonts/KaTeX_Main-Italic.woff differ diff --git a/vendor/assets/fonts/KaTeX_Main-Italic.woff2 b/vendor/assets/fonts/KaTeX_Main-Italic.woff2 old mode 100644 new mode 100755 index 944e9740bdf..9ea376e0986 Binary files a/vendor/assets/fonts/KaTeX_Main-Italic.woff2 and b/vendor/assets/fonts/KaTeX_Main-Italic.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Main-Regular.eot b/vendor/assets/fonts/KaTeX_Main-Regular.eot old mode 100644 new mode 100755 index dc60c090c7a..5c3387fd668 Binary files a/vendor/assets/fonts/KaTeX_Main-Regular.eot and b/vendor/assets/fonts/KaTeX_Main-Regular.eot differ diff --git a/vendor/assets/fonts/KaTeX_Main-Regular.ttf b/vendor/assets/fonts/KaTeX_Main-Regular.ttf old mode 100644 new mode 100755 index da5797ffcce..43145ee90cd Binary files a/vendor/assets/fonts/KaTeX_Main-Regular.ttf and b/vendor/assets/fonts/KaTeX_Main-Regular.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Main-Regular.woff b/vendor/assets/fonts/KaTeX_Main-Regular.woff old mode 100644 new mode 100755 index 37db672e821..4956dc62d35 Binary files a/vendor/assets/fonts/KaTeX_Main-Regular.woff and b/vendor/assets/fonts/KaTeX_Main-Regular.woff differ diff --git a/vendor/assets/fonts/KaTeX_Main-Regular.woff2 b/vendor/assets/fonts/KaTeX_Main-Regular.woff2 old mode 100644 new mode 100755 index 48820424893..89b01e44c46 Binary files a/vendor/assets/fonts/KaTeX_Main-Regular.woff2 and b/vendor/assets/fonts/KaTeX_Main-Regular.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Math-BoldItalic.eot b/vendor/assets/fonts/KaTeX_Math-BoldItalic.eot old mode 100644 new mode 100755 index 52c8b8c6b40..4209732a5dc Binary files a/vendor/assets/fonts/KaTeX_Math-BoldItalic.eot and b/vendor/assets/fonts/KaTeX_Math-BoldItalic.eot differ diff --git a/vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf b/vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf old mode 100644 new mode 100755 index a8b527c7ef6..c40c1003a35 Binary files a/vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf and b/vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff b/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff old mode 100644 new mode 100755 index 8940e0b5801..38c9cf2959a Binary files a/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff and b/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff differ diff --git a/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 b/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 old mode 100644 new mode 100755 index 15cf56d3408..9d33f144720 Binary files a/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 and b/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Math-Italic.eot b/vendor/assets/fonts/KaTeX_Math-Italic.eot old mode 100644 new mode 100755 index 64c8992c477..b6f8cbe8ce1 Binary files a/vendor/assets/fonts/KaTeX_Math-Italic.eot and b/vendor/assets/fonts/KaTeX_Math-Italic.eot differ diff --git a/vendor/assets/fonts/KaTeX_Math-Italic.ttf b/vendor/assets/fonts/KaTeX_Math-Italic.ttf old mode 100644 new mode 100755 index 06f39d3a299..a61089b2258 Binary files a/vendor/assets/fonts/KaTeX_Math-Italic.ttf and b/vendor/assets/fonts/KaTeX_Math-Italic.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Math-Italic.woff b/vendor/assets/fonts/KaTeX_Math-Italic.woff old mode 100644 new mode 100755 index cf3b4b79e5b..465a41f359f Binary files a/vendor/assets/fonts/KaTeX_Math-Italic.woff and b/vendor/assets/fonts/KaTeX_Math-Italic.woff differ diff --git a/vendor/assets/fonts/KaTeX_Math-Italic.woff2 b/vendor/assets/fonts/KaTeX_Math-Italic.woff2 old mode 100644 new mode 100755 index 5f8c4bfa455..3f945bee400 Binary files a/vendor/assets/fonts/KaTeX_Math-Italic.woff2 and b/vendor/assets/fonts/KaTeX_Math-Italic.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Math-Regular.eot b/vendor/assets/fonts/KaTeX_Math-Regular.eot old mode 100644 new mode 100755 index 5521e6a564d..3408ad26bad Binary files a/vendor/assets/fonts/KaTeX_Math-Regular.eot and b/vendor/assets/fonts/KaTeX_Math-Regular.eot differ diff --git a/vendor/assets/fonts/KaTeX_Math-Regular.ttf b/vendor/assets/fonts/KaTeX_Math-Regular.ttf old mode 100644 new mode 100755 index 73127082370..5a5788a58db Binary files a/vendor/assets/fonts/KaTeX_Math-Regular.ttf and b/vendor/assets/fonts/KaTeX_Math-Regular.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Math-Regular.woff b/vendor/assets/fonts/KaTeX_Math-Regular.woff old mode 100644 new mode 100755 index 0e2ebdf18af..34b0e3618b5 Binary files a/vendor/assets/fonts/KaTeX_Math-Regular.woff and b/vendor/assets/fonts/KaTeX_Math-Regular.woff differ diff --git a/vendor/assets/fonts/KaTeX_Math-Regular.woff2 b/vendor/assets/fonts/KaTeX_Math-Regular.woff2 old mode 100644 new mode 100755 index ebe3d028a34..2385fbeb8e6 Binary files a/vendor/assets/fonts/KaTeX_Math-Regular.woff2 and b/vendor/assets/fonts/KaTeX_Math-Regular.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Bold.eot b/vendor/assets/fonts/KaTeX_SansSerif-Bold.eot old mode 100644 new mode 100755 index 1660e76a2b6..2104d2aa29b Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Bold.eot and b/vendor/assets/fonts/KaTeX_SansSerif-Bold.eot differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf b/vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf old mode 100644 new mode 100755 index dbeb7b92ab5..644e8aa3c4d Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf and b/vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff b/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff old mode 100644 new mode 100755 index 8f144a8bb31..126fd8e4b42 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff and b/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 b/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 old mode 100644 new mode 100755 index 329e85557fa..f042002876c Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 and b/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Italic.eot b/vendor/assets/fonts/KaTeX_SansSerif-Italic.eot old mode 100644 new mode 100755 index 289ae3ff8b7..d9633ff5865 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Italic.eot and b/vendor/assets/fonts/KaTeX_SansSerif-Italic.eot differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf b/vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf old mode 100644 new mode 100755 index b3a2f38f224..9eb9d8f0ce6 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf and b/vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff b/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff old mode 100644 new mode 100755 index bddf7ea6579..0fb184ce0ab Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff and b/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 b/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 old mode 100644 new mode 100755 index 5fa767bddd6..cf87ba55541 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 and b/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Regular.eot b/vendor/assets/fonts/KaTeX_SansSerif-Regular.eot old mode 100644 new mode 100755 index 1b38b98a180..190015bf812 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Regular.eot and b/vendor/assets/fonts/KaTeX_SansSerif-Regular.eot differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf b/vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf old mode 100644 new mode 100755 index e4712f84775..4d27eba24b7 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf and b/vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff b/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff old mode 100644 new mode 100755 index 33be368048f..bcaae2cbd1e Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff and b/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 b/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 old mode 100644 new mode 100755 index 4fcb2e29a05..aa1eefc0930 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 and b/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Script-Regular.eot b/vendor/assets/fonts/KaTeX_Script-Regular.eot old mode 100644 new mode 100755 index 7870d7f319b..c41bad3038c Binary files a/vendor/assets/fonts/KaTeX_Script-Regular.eot and b/vendor/assets/fonts/KaTeX_Script-Regular.eot differ diff --git a/vendor/assets/fonts/KaTeX_Script-Regular.ttf b/vendor/assets/fonts/KaTeX_Script-Regular.ttf old mode 100644 new mode 100755 index da4d11308ae..11700094b79 Binary files a/vendor/assets/fonts/KaTeX_Script-Regular.ttf and b/vendor/assets/fonts/KaTeX_Script-Regular.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Script-Regular.woff b/vendor/assets/fonts/KaTeX_Script-Regular.woff old mode 100644 new mode 100755 index d6ae79f998a..03df046d859 Binary files a/vendor/assets/fonts/KaTeX_Script-Regular.woff and b/vendor/assets/fonts/KaTeX_Script-Regular.woff differ diff --git a/vendor/assets/fonts/KaTeX_Script-Regular.woff2 b/vendor/assets/fonts/KaTeX_Script-Regular.woff2 old mode 100644 new mode 100755 index 1b43deb45a8..a6fc2a96b7d Binary files a/vendor/assets/fonts/KaTeX_Script-Regular.woff2 and b/vendor/assets/fonts/KaTeX_Script-Regular.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Size1-Regular.eot b/vendor/assets/fonts/KaTeX_Size1-Regular.eot old mode 100644 new mode 100755 index 29950f95ff6..ebe463e4a3f Binary files a/vendor/assets/fonts/KaTeX_Size1-Regular.eot and b/vendor/assets/fonts/KaTeX_Size1-Regular.eot differ diff --git a/vendor/assets/fonts/KaTeX_Size1-Regular.ttf b/vendor/assets/fonts/KaTeX_Size1-Regular.ttf old mode 100644 new mode 100755 index 194466a655d..7d0a7c5825e Binary files a/vendor/assets/fonts/KaTeX_Size1-Regular.ttf and b/vendor/assets/fonts/KaTeX_Size1-Regular.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Size1-Regular.woff b/vendor/assets/fonts/KaTeX_Size1-Regular.woff old mode 100644 new mode 100755 index 237f271edd1..c1838b2927c Binary files a/vendor/assets/fonts/KaTeX_Size1-Regular.woff and b/vendor/assets/fonts/KaTeX_Size1-Regular.woff differ diff --git a/vendor/assets/fonts/KaTeX_Size1-Regular.woff2 b/vendor/assets/fonts/KaTeX_Size1-Regular.woff2 old mode 100644 new mode 100755 index 39b6f8f746c..450cd7b3866 Binary files a/vendor/assets/fonts/KaTeX_Size1-Regular.woff2 and b/vendor/assets/fonts/KaTeX_Size1-Regular.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Size2-Regular.eot b/vendor/assets/fonts/KaTeX_Size2-Regular.eot old mode 100644 new mode 100755 index b8b0536f967..c0fdba72c89 Binary files a/vendor/assets/fonts/KaTeX_Size2-Regular.eot and b/vendor/assets/fonts/KaTeX_Size2-Regular.eot differ diff --git a/vendor/assets/fonts/KaTeX_Size2-Regular.ttf b/vendor/assets/fonts/KaTeX_Size2-Regular.ttf old mode 100644 new mode 100755 index b41b66a638f..fcff9e13239 Binary files a/vendor/assets/fonts/KaTeX_Size2-Regular.ttf and b/vendor/assets/fonts/KaTeX_Size2-Regular.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Size2-Regular.woff b/vendor/assets/fonts/KaTeX_Size2-Regular.woff old mode 100644 new mode 100755 index 4a3055854ed..5b421fb6f83 Binary files a/vendor/assets/fonts/KaTeX_Size2-Regular.woff and b/vendor/assets/fonts/KaTeX_Size2-Regular.woff differ diff --git a/vendor/assets/fonts/KaTeX_Size2-Regular.woff2 b/vendor/assets/fonts/KaTeX_Size2-Regular.woff2 old mode 100644 new mode 100755 index 3facec1ab89..a0df638b81b Binary files a/vendor/assets/fonts/KaTeX_Size2-Regular.woff2 and b/vendor/assets/fonts/KaTeX_Size2-Regular.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Size3-Regular.eot b/vendor/assets/fonts/KaTeX_Size3-Regular.eot old mode 100644 new mode 100755 index 576b864fae6..a28ebc892c3 Binary files a/vendor/assets/fonts/KaTeX_Size3-Regular.eot and b/vendor/assets/fonts/KaTeX_Size3-Regular.eot differ diff --git a/vendor/assets/fonts/KaTeX_Size3-Regular.ttf b/vendor/assets/fonts/KaTeX_Size3-Regular.ttf old mode 100644 new mode 100755 index 790ddbbc55f..af36ae23ee9 Binary files a/vendor/assets/fonts/KaTeX_Size3-Regular.ttf and b/vendor/assets/fonts/KaTeX_Size3-Regular.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Size3-Regular.woff b/vendor/assets/fonts/KaTeX_Size3-Regular.woff old mode 100644 new mode 100755 index 3a6d062e660..d0d195539e2 Binary files a/vendor/assets/fonts/KaTeX_Size3-Regular.woff and b/vendor/assets/fonts/KaTeX_Size3-Regular.woff differ diff --git a/vendor/assets/fonts/KaTeX_Size3-Regular.woff2 b/vendor/assets/fonts/KaTeX_Size3-Regular.woff2 old mode 100644 new mode 100755 index 2cffafe5018..226186ae5fc Binary files a/vendor/assets/fonts/KaTeX_Size3-Regular.woff2 and b/vendor/assets/fonts/KaTeX_Size3-Regular.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Size4-Regular.eot b/vendor/assets/fonts/KaTeX_Size4-Regular.eot old mode 100644 new mode 100755 index c2b045fc3db..a6753252675 Binary files a/vendor/assets/fonts/KaTeX_Size4-Regular.eot and b/vendor/assets/fonts/KaTeX_Size4-Regular.eot differ diff --git a/vendor/assets/fonts/KaTeX_Size4-Regular.ttf b/vendor/assets/fonts/KaTeX_Size4-Regular.ttf old mode 100644 new mode 100755 index ce660aa7ff9..979a449915d Binary files a/vendor/assets/fonts/KaTeX_Size4-Regular.ttf and b/vendor/assets/fonts/KaTeX_Size4-Regular.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Size4-Regular.woff b/vendor/assets/fonts/KaTeX_Size4-Regular.woff old mode 100644 new mode 100755 index 7826c6c97a1..185e575d6e3 Binary files a/vendor/assets/fonts/KaTeX_Size4-Regular.woff and b/vendor/assets/fonts/KaTeX_Size4-Regular.woff differ diff --git a/vendor/assets/fonts/KaTeX_Size4-Regular.woff2 b/vendor/assets/fonts/KaTeX_Size4-Regular.woff2 old mode 100644 new mode 100755 index c92189812d9..292513c0e09 Binary files a/vendor/assets/fonts/KaTeX_Size4-Regular.woff2 and b/vendor/assets/fonts/KaTeX_Size4-Regular.woff2 differ diff --git a/vendor/assets/fonts/KaTeX_Typewriter-Regular.eot b/vendor/assets/fonts/KaTeX_Typewriter-Regular.eot old mode 100644 new mode 100755 index 4c178f484a8..b713e4cc0e4 Binary files a/vendor/assets/fonts/KaTeX_Typewriter-Regular.eot and b/vendor/assets/fonts/KaTeX_Typewriter-Regular.eot differ diff --git a/vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf b/vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf old mode 100644 new mode 100755 index b0427ad0a56..78640734c50 Binary files a/vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf and b/vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf differ diff --git a/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff b/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff old mode 100644 new mode 100755 index 78e990488a9..c572bf5073f Binary files a/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff and b/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff differ diff --git a/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 b/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 old mode 100644 new mode 100755 index 618de99d480..eddad58f060 Binary files a/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 and b/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 differ diff --git a/vendor/assets/javascripts/katex.js b/vendor/assets/javascripts/katex.js index 6b59a3477a7..92936bb247f 100644 --- a/vendor/assets/javascripts/katex.js +++ b/vendor/assets/javascripts/katex.js @@ -42,47 +42,63 @@ */ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.katex = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o Array#indexOf +// true -> Array#includes +var toIObject = require('./_to-iobject'); +var toLength = require('./_to-length'); +var toAbsoluteIndex = require('./_to-absolute-index'); +module.exports = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIObject($this); + var length = toLength(O.length); + var index = toAbsoluteIndex(fromIndex, length); + var value; + // Array#includes uses SameValueZero equality algorithm + // eslint-disable-next-line no-self-compare + if (IS_INCLUDES && el != el) while (length > index) { + value = O[index++]; + // eslint-disable-next-line no-self-compare + if (value != value) return true; + // Array#indexOf ignores holes, Array#includes - not + } else for (;length > index; index++) if (IS_INCLUDES || index in O) { + if (O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; +}; + +},{"./_to-absolute-index":62,"./_to-iobject":64,"./_to-length":65}],22:[function(require,module,exports){ +// getting tag from 19.1.3.6 Object.prototype.toString() +var cof = require('./_cof'); +var TAG = require('./_wks')('toStringTag'); +// ES3 wrong here +var ARG = cof(function () { return arguments; }()) == 'Arguments'; + +// fallback for IE11 Script Access Denied error +var tryGet = function (it, key) { + try { + return it[key]; + } catch (e) { /* empty */ } +}; + +module.exports = function (it) { + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; +}; + +},{"./_cof":23,"./_wks":69}],23:[function(require,module,exports){ +var toString = {}.toString; + +module.exports = function (it) { + return toString.call(it).slice(8, -1); +}; + +},{}],24:[function(require,module,exports){ +var core = module.exports = { version: '2.5.1' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + +},{}],25:[function(require,module,exports){ +'use strict'; +var $defineProperty = require('./_object-dp'); +var createDesc = require('./_property-desc'); + +module.exports = function (object, index, value) { + if (index in object) $defineProperty.f(object, index, createDesc(0, value)); + else object[index] = value; +}; + +},{"./_object-dp":50,"./_property-desc":56}],26:[function(require,module,exports){ +// optional / simple context binding +var aFunction = require('./_a-function'); +module.exports = function (fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 1: return function (a) { + return fn.call(that, a); + }; + case 2: return function (a, b) { + return fn.call(that, a, b); + }; + case 3: return function (a, b, c) { + return fn.call(that, a, b, c); + }; + } + return function (/* ...args */) { + return fn.apply(that, arguments); + }; +}; + +},{"./_a-function":18}],27:[function(require,module,exports){ +// 7.2.1 RequireObjectCoercible(argument) +module.exports = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; +}; + +},{}],28:[function(require,module,exports){ +// Thank's IE8 for his funny defineProperty +module.exports = !require('./_fails')(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; +}); + +},{"./_fails":32}],29:[function(require,module,exports){ +var isObject = require('./_is-object'); +var document = require('./_global').document; +// typeof document.createElement is 'object' in old IE +var is = isObject(document) && isObject(document.createElement); +module.exports = function (it) { + return is ? document.createElement(it) : {}; +}; + +},{"./_global":33,"./_is-object":40}],30:[function(require,module,exports){ +// IE 8- don't enum bug keys +module.exports = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' +).split(','); + +},{}],31:[function(require,module,exports){ +var global = require('./_global'); +var core = require('./_core'); +var ctx = require('./_ctx'); +var hide = require('./_hide'); +var PROTOTYPE = 'prototype'; + +var $export = function (type, name, source) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var IS_WRAP = type & $export.W; + var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); + var expProto = exports[PROTOTYPE]; + var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]; + var key, own, out; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + if (own && key in exports) continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global) + // wrap global constructors for prevent change them in library + : IS_WRAP && target[key] == out ? (function (C) { + var F = function (a, b, c) { + if (this instanceof C) { + switch (arguments.length) { + case 0: return new C(); + case 1: return new C(a); + case 2: return new C(a, b); + } return new C(a, b, c); + } return C.apply(this, arguments); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% + if (IS_PROTO) { + (exports.virtual || (exports.virtual = {}))[key] = out; + // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% + if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); + } + } +}; +// type bitmap +$export.F = 1; // forced +$export.G = 2; // global +$export.S = 4; // static +$export.P = 8; // proto +$export.B = 16; // bind +$export.W = 32; // wrap +$export.U = 64; // safe +$export.R = 128; // real proto method for `library` +module.exports = $export; + +},{"./_core":24,"./_ctx":26,"./_global":33,"./_hide":35}],32:[function(require,module,exports){ +module.exports = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } +}; + +},{}],33:[function(require,module,exports){ +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef + +},{}],34:[function(require,module,exports){ +var hasOwnProperty = {}.hasOwnProperty; +module.exports = function (it, key) { + return hasOwnProperty.call(it, key); +}; + +},{}],35:[function(require,module,exports){ +var dP = require('./_object-dp'); +var createDesc = require('./_property-desc'); +module.exports = require('./_descriptors') ? function (object, key, value) { + return dP.f(object, key, createDesc(1, value)); +} : function (object, key, value) { + object[key] = value; + return object; +}; + +},{"./_descriptors":28,"./_object-dp":50,"./_property-desc":56}],36:[function(require,module,exports){ +var document = require('./_global').document; +module.exports = document && document.documentElement; + +},{"./_global":33}],37:[function(require,module,exports){ +module.exports = !require('./_descriptors') && !require('./_fails')(function () { + return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7; +}); + +},{"./_descriptors":28,"./_dom-create":29,"./_fails":32}],38:[function(require,module,exports){ +// fallback for non-array-like ES3 and non-enumerable old V8 strings +var cof = require('./_cof'); +// eslint-disable-next-line no-prototype-builtins +module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return cof(it) == 'String' ? it.split('') : Object(it); +}; + +},{"./_cof":23}],39:[function(require,module,exports){ +// check on default Array iterator +var Iterators = require('./_iterators'); +var ITERATOR = require('./_wks')('iterator'); +var ArrayProto = Array.prototype; + +module.exports = function (it) { + return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); +}; + +},{"./_iterators":46,"./_wks":69}],40:[function(require,module,exports){ +module.exports = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; + +},{}],41:[function(require,module,exports){ +// call something on iterator step with safe closing on error +var anObject = require('./_an-object'); +module.exports = function (iterator, fn, value, entries) { + try { + return entries ? fn(anObject(value)[0], value[1]) : fn(value); + // 7.4.6 IteratorClose(iterator, completion) + } catch (e) { + var ret = iterator['return']; + if (ret !== undefined) anObject(ret.call(iterator)); + throw e; + } +}; + +},{"./_an-object":20}],42:[function(require,module,exports){ +'use strict'; +var create = require('./_object-create'); +var descriptor = require('./_property-desc'); +var setToStringTag = require('./_set-to-string-tag'); +var IteratorPrototype = {}; + +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() +require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; }); + +module.exports = function (Constructor, NAME, next) { + Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); + setToStringTag(Constructor, NAME + ' Iterator'); +}; + +},{"./_hide":35,"./_object-create":49,"./_property-desc":56,"./_set-to-string-tag":58,"./_wks":69}],43:[function(require,module,exports){ +'use strict'; +var LIBRARY = require('./_library'); +var $export = require('./_export'); +var redefine = require('./_redefine'); +var hide = require('./_hide'); +var has = require('./_has'); +var Iterators = require('./_iterators'); +var $iterCreate = require('./_iter-create'); +var setToStringTag = require('./_set-to-string-tag'); +var getPrototypeOf = require('./_object-gpo'); +var ITERATOR = require('./_wks')('iterator'); +var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` +var FF_ITERATOR = '@@iterator'; +var KEYS = 'keys'; +var VALUES = 'values'; + +var returnThis = function () { return this; }; + +module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + $iterCreate(Constructor, NAME, next); + var getMethod = function (kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: return function keys() { return new Constructor(this, kind); }; + case VALUES: return function values() { return new Constructor(this, kind); }; + } return function entries() { return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator'; + var DEF_VALUES = DEFAULT == VALUES; + var VALUES_BUG = false; + var proto = Base.prototype; + var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; + var $default = $native || getMethod(DEFAULT); + var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; + var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; + var methods, key, IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { return $native.call(this); }; + } + // Define iterator + if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) for (key in methods) { + if (!(key in proto)) redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; +}; + +},{"./_export":31,"./_has":34,"./_hide":35,"./_iter-create":42,"./_iterators":46,"./_library":47,"./_object-gpo":52,"./_redefine":57,"./_set-to-string-tag":58,"./_wks":69}],44:[function(require,module,exports){ +var ITERATOR = require('./_wks')('iterator'); +var SAFE_CLOSING = false; + +try { + var riter = [7][ITERATOR](); + riter['return'] = function () { SAFE_CLOSING = true; }; + // eslint-disable-next-line no-throw-literal + Array.from(riter, function () { throw 2; }); +} catch (e) { /* empty */ } + +module.exports = function (exec, skipClosing) { + if (!skipClosing && !SAFE_CLOSING) return false; + var safe = false; + try { + var arr = [7]; + var iter = arr[ITERATOR](); + iter.next = function () { return { done: safe = true }; }; + arr[ITERATOR] = function () { return iter; }; + exec(arr); + } catch (e) { /* empty */ } + return safe; +}; + +},{"./_wks":69}],45:[function(require,module,exports){ +module.exports = function (done, value) { + return { value: value, done: !!done }; +}; + +},{}],46:[function(require,module,exports){ +module.exports = {}; + +},{}],47:[function(require,module,exports){ +module.exports = true; + +},{}],48:[function(require,module,exports){ +var META = require('./_uid')('meta'); +var isObject = require('./_is-object'); +var has = require('./_has'); +var setDesc = require('./_object-dp').f; +var id = 0; +var isExtensible = Object.isExtensible || function () { + return true; +}; +var FREEZE = !require('./_fails')(function () { + return isExtensible(Object.preventExtensions({})); +}); +var setMeta = function (it) { + setDesc(it, META, { value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + } }); +}; +var fastKey = function (it, create) { + // return primitive with prefix + if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return 'F'; + // not necessary to add metadata + if (!create) return 'E'; + // add missing metadata + setMeta(it); + // return object ID + } return it[META].i; +}; +var getWeak = function (it, create) { + if (!has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return true; + // not necessary to add metadata + if (!create) return false; + // add missing metadata + setMeta(it); + // return hash weak collections IDs + } return it[META].w; +}; +// add metadata on freeze-family methods calling +var onFreeze = function (it) { + if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); + return it; +}; +var meta = module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze +}; + +},{"./_fails":32,"./_has":34,"./_is-object":40,"./_object-dp":50,"./_uid":68}],49:[function(require,module,exports){ +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +var anObject = require('./_an-object'); +var dPs = require('./_object-dps'); +var enumBugKeys = require('./_enum-bug-keys'); +var IE_PROTO = require('./_shared-key')('IE_PROTO'); +var Empty = function () { /* empty */ }; +var PROTOTYPE = 'prototype'; + +// Create object with fake `null` prototype: use iframe Object with cleared prototype +var createDict = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = require('./_dom-create')('iframe'); + var i = enumBugKeys.length; + var lt = '<'; + var gt = '>'; + var iframeDocument; + iframe.style.display = 'none'; + require('./_html').appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); +}; + +module.exports = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE] = anObject(O); + result = new Empty(); + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); +}; + +},{"./_an-object":20,"./_dom-create":29,"./_enum-bug-keys":30,"./_html":36,"./_object-dps":51,"./_shared-key":59}],50:[function(require,module,exports){ +var anObject = require('./_an-object'); +var IE8_DOM_DEFINE = require('./_ie8-dom-define'); +var toPrimitive = require('./_to-primitive'); +var dP = Object.defineProperty; + +exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (IE8_DOM_DEFINE) try { + return dP(O, P, Attributes); + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; +}; + +},{"./_an-object":20,"./_descriptors":28,"./_ie8-dom-define":37,"./_to-primitive":67}],51:[function(require,module,exports){ +var dP = require('./_object-dp'); +var anObject = require('./_an-object'); +var getKeys = require('./_object-keys'); + +module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) { + anObject(O); + var keys = getKeys(Properties); + var length = keys.length; + var i = 0; + var P; + while (length > i) dP.f(O, P = keys[i++], Properties[P]); + return O; +}; + +},{"./_an-object":20,"./_descriptors":28,"./_object-dp":50,"./_object-keys":54}],52:[function(require,module,exports){ +// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) +var has = require('./_has'); +var toObject = require('./_to-object'); +var IE_PROTO = require('./_shared-key')('IE_PROTO'); +var ObjectProto = Object.prototype; + +module.exports = Object.getPrototypeOf || function (O) { + O = toObject(O); + if (has(O, IE_PROTO)) return O[IE_PROTO]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + } return O instanceof Object ? ObjectProto : null; +}; + +},{"./_has":34,"./_shared-key":59,"./_to-object":66}],53:[function(require,module,exports){ +var has = require('./_has'); +var toIObject = require('./_to-iobject'); +var arrayIndexOf = require('./_array-includes')(false); +var IE_PROTO = require('./_shared-key')('IE_PROTO'); + +module.exports = function (object, names) { + var O = toIObject(object); + var i = 0; + var result = []; + var key; + for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) if (has(O, key = names[i++])) { + ~arrayIndexOf(result, key) || result.push(key); + } + return result; +}; + +},{"./_array-includes":21,"./_has":34,"./_shared-key":59,"./_to-iobject":64}],54:[function(require,module,exports){ +// 19.1.2.14 / 15.2.3.14 Object.keys(O) +var $keys = require('./_object-keys-internal'); +var enumBugKeys = require('./_enum-bug-keys'); + +module.exports = Object.keys || function keys(O) { + return $keys(O, enumBugKeys); +}; + +},{"./_enum-bug-keys":30,"./_object-keys-internal":53}],55:[function(require,module,exports){ +// most Object methods by ES6 should accept primitives +var $export = require('./_export'); +var core = require('./_core'); +var fails = require('./_fails'); +module.exports = function (KEY, exec) { + var fn = (core.Object || {})[KEY] || Object[KEY]; + var exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); +}; + +},{"./_core":24,"./_export":31,"./_fails":32}],56:[function(require,module,exports){ +module.exports = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; +}; + +},{}],57:[function(require,module,exports){ +module.exports = require('./_hide'); + +},{"./_hide":35}],58:[function(require,module,exports){ +var def = require('./_object-dp').f; +var has = require('./_has'); +var TAG = require('./_wks')('toStringTag'); + +module.exports = function (it, tag, stat) { + if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); +}; + +},{"./_has":34,"./_object-dp":50,"./_wks":69}],59:[function(require,module,exports){ +var shared = require('./_shared')('keys'); +var uid = require('./_uid'); +module.exports = function (key) { + return shared[key] || (shared[key] = uid(key)); +}; + +},{"./_shared":60,"./_uid":68}],60:[function(require,module,exports){ +var global = require('./_global'); +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || (global[SHARED] = {}); +module.exports = function (key) { + return store[key] || (store[key] = {}); +}; + +},{"./_global":33}],61:[function(require,module,exports){ +var toInteger = require('./_to-integer'); +var defined = require('./_defined'); +// true -> String#at +// false -> String#codePointAt +module.exports = function (TO_STRING) { + return function (that, pos) { + var s = String(defined(that)); + var i = toInteger(pos); + var l = s.length; + var a, b; + if (i < 0 || i >= l) return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; +}; + +},{"./_defined":27,"./_to-integer":63}],62:[function(require,module,exports){ +var toInteger = require('./_to-integer'); +var max = Math.max; +var min = Math.min; +module.exports = function (index, length) { + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); +}; + +},{"./_to-integer":63}],63:[function(require,module,exports){ +// 7.1.4 ToInteger +var ceil = Math.ceil; +var floor = Math.floor; +module.exports = function (it) { + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +}; + +},{}],64:[function(require,module,exports){ +// to indexed object, toObject with fallback for non-array-like ES3 strings +var IObject = require('./_iobject'); +var defined = require('./_defined'); +module.exports = function (it) { + return IObject(defined(it)); +}; + +},{"./_defined":27,"./_iobject":38}],65:[function(require,module,exports){ +// 7.1.15 ToLength +var toInteger = require('./_to-integer'); +var min = Math.min; +module.exports = function (it) { + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +}; + +},{"./_to-integer":63}],66:[function(require,module,exports){ +// 7.1.13 ToObject(argument) +var defined = require('./_defined'); +module.exports = function (it) { + return Object(defined(it)); +}; + +},{"./_defined":27}],67:[function(require,module,exports){ +// 7.1.1 ToPrimitive(input [, PreferredType]) +var isObject = require('./_is-object'); +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +module.exports = function (it, S) { + if (!isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); +}; + +},{"./_is-object":40}],68:[function(require,module,exports){ +var id = 0; +var px = Math.random(); +module.exports = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; + +},{}],69:[function(require,module,exports){ +var store = require('./_shared')('wks'); +var uid = require('./_uid'); +var Symbol = require('./_global').Symbol; +var USE_SYMBOL = typeof Symbol == 'function'; + +var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); +}; + +$exports.store = store; + +},{"./_global":33,"./_shared":60,"./_uid":68}],70:[function(require,module,exports){ +var classof = require('./_classof'); +var ITERATOR = require('./_wks')('iterator'); +var Iterators = require('./_iterators'); +module.exports = require('./_core').getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR] + || it['@@iterator'] + || Iterators[classof(it)]; +}; + +},{"./_classof":22,"./_core":24,"./_iterators":46,"./_wks":69}],71:[function(require,module,exports){ +var anObject = require('./_an-object'); +var get = require('./core.get-iterator-method'); +module.exports = require('./_core').getIterator = function (it) { + var iterFn = get(it); + if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!'); + return anObject(iterFn.call(it)); +}; + +},{"./_an-object":20,"./_core":24,"./core.get-iterator-method":70}],72:[function(require,module,exports){ +var classof = require('./_classof'); +var ITERATOR = require('./_wks')('iterator'); +var Iterators = require('./_iterators'); +module.exports = require('./_core').isIterable = function (it) { + var O = Object(it); + return O[ITERATOR] !== undefined + || '@@iterator' in O + // eslint-disable-next-line no-prototype-builtins + || Iterators.hasOwnProperty(classof(O)); +}; + +},{"./_classof":22,"./_core":24,"./_iterators":46,"./_wks":69}],73:[function(require,module,exports){ +'use strict'; +var ctx = require('./_ctx'); +var $export = require('./_export'); +var toObject = require('./_to-object'); +var call = require('./_iter-call'); +var isArrayIter = require('./_is-array-iter'); +var toLength = require('./_to-length'); +var createProperty = require('./_create-property'); +var getIterFn = require('./core.get-iterator-method'); + +$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', { + // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) + from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { + var O = toObject(arrayLike); + var C = typeof this == 'function' ? this : Array; + var aLen = arguments.length; + var mapfn = aLen > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var index = 0; + var iterFn = getIterFn(O); + var length, result, step, iterator; + if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); + // if object isn't iterable or it's array with default iterator - use simple case + if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) { + for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { + createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); + } + } else { + length = toLength(O.length); + for (result = new C(length); length > index; index++) { + createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); + } + } + result.length = index; + return result; + } +}); + +},{"./_create-property":25,"./_ctx":26,"./_export":31,"./_is-array-iter":39,"./_iter-call":41,"./_iter-detect":44,"./_to-length":65,"./_to-object":66,"./core.get-iterator-method":70}],74:[function(require,module,exports){ +'use strict'; +var addToUnscopables = require('./_add-to-unscopables'); +var step = require('./_iter-step'); +var Iterators = require('./_iterators'); +var toIObject = require('./_to-iobject'); + +// 22.1.3.4 Array.prototype.entries() +// 22.1.3.13 Array.prototype.keys() +// 22.1.3.29 Array.prototype.values() +// 22.1.3.30 Array.prototype[@@iterator]() +module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) { + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind +// 22.1.5.2.1 %ArrayIteratorPrototype%.next() +}, function () { + var O = this._t; + var kind = this._k; + var index = this._i++; + if (!O || index >= O.length) { + this._t = undefined; + return step(1); + } + if (kind == 'keys') return step(0, index); + if (kind == 'values') return step(0, O[index]); + return step(0, [index, O[index]]); +}, 'values'); + +// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) +Iterators.Arguments = Iterators.Array; + +addToUnscopables('keys'); +addToUnscopables('values'); +addToUnscopables('entries'); + +},{"./_add-to-unscopables":19,"./_iter-define":43,"./_iter-step":45,"./_iterators":46,"./_to-iobject":64}],75:[function(require,module,exports){ +var $export = require('./_export'); +// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) +$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f }); + +},{"./_descriptors":28,"./_export":31,"./_object-dp":50}],76:[function(require,module,exports){ +// 19.1.2.5 Object.freeze(O) +var isObject = require('./_is-object'); +var meta = require('./_meta').onFreeze; + +require('./_object-sap')('freeze', function ($freeze) { + return function freeze(it) { + return $freeze && isObject(it) ? $freeze(meta(it)) : it; + }; +}); + +},{"./_is-object":40,"./_meta":48,"./_object-sap":55}],77:[function(require,module,exports){ +'use strict'; +var $at = require('./_string-at')(true); + +// 21.1.3.27 String.prototype[@@iterator]() +require('./_iter-define')(String, 'String', function (iterated) { + this._t = String(iterated); // target + this._i = 0; // next index +// 21.1.5.2.1 %StringIteratorPrototype%.next() +}, function () { + var O = this._t; + var index = this._i; + var point; + if (index >= O.length) return { value: undefined, done: true }; + point = $at(O, index); + this._i += point.length; + return { value: point, done: false }; +}); + +},{"./_iter-define":43,"./_string-at":61}],78:[function(require,module,exports){ +require('./es6.array.iterator'); +var global = require('./_global'); +var hide = require('./_hide'); +var Iterators = require('./_iterators'); +var TO_STRING_TAG = require('./_wks')('toStringTag'); + +var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' + + 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' + + 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' + + 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' + + 'TextTrackList,TouchList').split(','); + +for (var i = 0; i < DOMIterables.length; i++) { + var NAME = DOMIterables[i]; + var Collection = global[NAME]; + var proto = Collection && Collection.prototype; + if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = Iterators.Array; +} + +},{"./_global":33,"./_hide":35,"./_iterators":46,"./_wks":69,"./es6.array.iterator":74}],79:[function(require,module,exports){ function getRelocatable(re) { // In the future, this could use a WeakMap instead of an expando. if (!re.__matchAtRelocatable) { // Disjunctions are the lowest-precedence operator, so we can make any // pattern match the empty string by appending `|()` to it: // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-patterns - var source = re.source + "|()"; + var source = re.source + '|()'; // We always make the new regex global. - var flags = "g" + (re.ignoreCase ? "i" : "") + (re.multiline ? "m" : "") + (re.unicode ? "u" : "") + var flags = 'g' + (re.ignoreCase ? 'i' : '') + (re.multiline ? 'm' : '') + (re.unicode ? 'u' : '') // sticky (/.../y) doesn't make sense in conjunction with our relocation // logic, so we ignore it here. ; @@ -143,7 +1191,7 @@ function getRelocatable(re) { function matchAt(re, str, pos) { if (re.global || re.sticky) { - throw new Error("matchAt(...): Only non-global regexes are supported"); + throw new Error('matchAt(...): Only non-global regexes are supported'); } var reloc = getRelocatable(re); reloc.lastIndex = pos; @@ -160,72 +1208,133 @@ function matchAt(re, str, pos) { } module.exports = matchAt; -},{}],3:[function(require,module,exports){ -/** - * The Lexer class handles tokenizing the input in various ways. Since our - * parser expects us to be able to backtrack, the lexer allows lexing from any - * given starting point. - * - * Its main exposed function is the `lex` function, which takes a position to - * lex from and a type of token to lex. It defers to the appropriate `_innerLex` - * function. - * - * The various `_innerLex` functions perform the actual lexing of different - * kinds. - */ +},{}],80:[function(require,module,exports){ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ -var matchAt = require("match-at"); +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; -var ParseError = require("./ParseError"); +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } -// The main lexer class -function Lexer(input) { - this.input = input; - this.pos = 0; + return Object(val); } -/** - * The resulting token returned from `lex`. - * - * It consists of the token text plus some position information. - * The position information is essentially a range in an input string, - * but instead of referencing the bare input string, we refer to the lexer. - * That way it is possible to attach extra metadata to the input string, - * like for example a file name or similar. - * - * The position information (all three parameters) is optional, - * so it is OK to construct synthetic tokens if appropriate. - * Not providing available position information may lead to - * degraded error reporting, though. - * - * @param {string} text the text of this token - * @param {number=} start the start offset, zero-based inclusive - * @param {number=} end the end offset, zero-based exclusive - * @param {Lexer=} lexer the lexer which in turn holds the input string - */ -function Token(text, start, end, lexer) { - this.text = text; - this.start = start; - this.end = end; - this.lexer = lexer; +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } } -/** - * Given a pair of tokens (this and endToken), compute a “Token” encompassing - * the whole input range enclosed by these two. - * - * @param {Token} endToken last token of the range, inclusive - * @param {string} text the text of the newly constructed token - */ -Token.prototype.range = function(endToken, text) { - if (endToken.lexer !== this.lexer) { - return new Token(text); // sorry, no position information available - } - return new Token(text, this.start, endToken.end, this.lexer); +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; }; +},{}],81:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.controlWordRegex = undefined; + +var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = require("babel-runtime/helpers/createClass"); + +var _createClass3 = _interopRequireDefault(_createClass2); + +var _matchAt = require("match-at"); + +var _matchAt2 = _interopRequireDefault(_matchAt); + +var _ParseError = require("./ParseError"); + +var _ParseError2 = _interopRequireDefault(_ParseError); + +var _SourceLocation = require("./SourceLocation"); + +var _SourceLocation2 = _interopRequireDefault(_SourceLocation); + +var _Token = require("./Token"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /* The following tokenRegex * - matches typical whitespace (but not NBSP etc.) using its first group + * - matches comments (must have trailing newlines) * - does not match any control character \x00-\x1f except whitespace * - does not match a bare backslash * - matches any ASCII character except those just mentioned @@ -239,229 +1348,677 @@ Token.prototype.range = function(endToken, text) { * If there is no matching function or symbol definition, the Parser will * still reject the input. */ -var tokenRegex = new RegExp( - "([ \r\n\t]+)|" + // whitespace - "([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + // single codepoint - "|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair - "|\\\\(?:[a-zA-Z]+|[^\uD800-\uDFFF])" + // function name - ")" -); /** - * This function lexes a single token. + * The Lexer class handles tokenizing the input in various ways. Since our + * parser expects us to be able to backtrack, the lexer allows lexing from any + * given starting point. + * + * Its main exposed function is the `lex` function, which takes a position to + * lex from and a type of token to lex. It defers to the appropriate `_innerLex` + * function. + * + * The various `_innerLex` functions perform the actual lexing of different + * kinds. */ -Lexer.prototype.lex = function() { - var input = this.input; - var pos = this.pos; - if (pos === input.length) { - return new Token("EOF", pos, pos, this); - } - var match = matchAt(tokenRegex, input, pos); - if (match === null) { - throw new ParseError( - "Unexpected character: '" + input[pos] + "'", - new Token(input[pos], pos, pos + 1, this)); - } - var text = match[2] || " "; - var start = this.pos; - this.pos += match[0].length; - var end = this.pos; - return new Token(text, start, end, this); -}; -module.exports = Lexer; +var commentRegexString = "%[^\n]*[\n]"; +var controlWordRegexString = "\\\\[a-zA-Z@]+"; +var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]"; +var tokenRegex = new RegExp("([ \r\n\t]+)|" + ( // whitespace +"(" + commentRegexString + "|") + // comments +"[!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + // single codepoint +"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair +"|\\\\verb\\*([^]).*?\\3" + // \verb* +"|\\\\verb([^*a-zA-Z]).*?\\4" + ( // \verb unstarred +"|" + controlWordRegexString) + ( // \macroName +"|" + controlSymbolRegexString) + // \\, \', etc. +")"); -},{"./ParseError":6,"match-at":2}],4:[function(require,module,exports){ -/** - * This file contains the “gullet” where macros are expanded - * until only non-macro tokens remain. - */ +// tokenRegex has no ^ marker, as required by matchAt. +// These regexs are for matching results from tokenRegex, +// so they do have ^ markers. +var controlWordRegex = exports.controlWordRegex = new RegExp("^" + controlWordRegexString); +var commentRegex = new RegExp("^" + commentRegexString); -var Lexer = require("./Lexer"); +/** Main Lexer class */ -function MacroExpander(input, macros) { - this.lexer = new Lexer(input); - this.macros = macros; - this.stack = []; // contains tokens in REVERSE order - this.discardedWhiteSpace = []; -} +var Lexer = function () { + function Lexer(input) { + (0, _classCallCheck3.default)(this, Lexer); -/** - * Recursively expand first token, then return first non-expandable token. - */ -MacroExpander.prototype.nextToken = function() { - for (;;) { - if (this.stack.length === 0) { - this.stack.push(this.lexer.lex()); - } - var topToken = this.stack.pop(); - var name = topToken.text; - if (!(name.charAt(0) === "\\" && this.macros.hasOwnProperty(name))) { - return topToken; - } - var expansion = this.macros[name]; - if (typeof expansion === "string") { - var bodyLexer = new Lexer(expansion); - expansion = []; - var tok = bodyLexer.lex(); - while (tok.text !== "EOF") { - expansion.push(tok); - tok = bodyLexer.lex(); - } - expansion.reverse(); // to fit in with stack using push and pop - this.macros[name] = expansion; - } - this.stack = this.stack.concat(expansion); + this.input = input; + this.pos = 0; } -}; -MacroExpander.prototype.get = function(ignoreSpace) { - this.discardedWhiteSpace = []; - var token = this.nextToken(); - if (ignoreSpace) { - while (token.text === " ") { - this.discardedWhiteSpace.push(token); - token = this.nextToken(); + /** + * This function lexes a single token. + */ + + + (0, _createClass3.default)(Lexer, [{ + key: "lex", + value: function lex() { + var input = this.input; + var pos = this.pos; + if (pos === input.length) { + return new _Token.Token("EOF", new _SourceLocation2.default(this, pos, pos)); + } + var match = (0, _matchAt2.default)(tokenRegex, input, pos); + if (match === null) { + throw new _ParseError2.default("Unexpected character: '" + input[pos] + "'", new _Token.Token(input[pos], new _SourceLocation2.default(this, pos, pos + 1))); + } + var text = match[2] || " "; + var start = this.pos; + this.pos += match[0].length; + var end = this.pos; + + if (commentRegex.test(text)) { + return this.lex(); + } else { + return new _Token.Token(text, new _SourceLocation2.default(this, start, end)); + } } - } - return token; -}; + }]); + return Lexer; +}(); -/** - * Undo the effect of the preceding call to the get method. - * A call to this method MUST be immediately preceded and immediately followed - * by a call to get. Only used during mode switching, i.e. after one token - * was got in the old mode but should get got again in a new mode - * with possibly different whitespace handling. - */ -MacroExpander.prototype.unget = function(token) { - this.stack.push(token); - while (this.discardedWhiteSpace.length !== 0) { - this.stack.push(this.discardedWhiteSpace.pop()); - } -}; +exports.default = Lexer; -module.exports = MacroExpander; +},{"./ParseError":84,"./SourceLocation":88,"./Token":90,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9,"match-at":79}],82:[function(require,module,exports){ +"use strict"; -},{"./Lexer":3}],5:[function(require,module,exports){ -/** - * This file contains information about the options that the Parser carries - * around with it while parsing. Data is held in an `Options` object, and when - * recursing, a new `Options` object can be created with the `.with*` and - * `.reset` functions. - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); -/** - * This is the main options class. It contains the style, size, color, and font - * of the current parse level. It also contains the style and size of the parent - * parse level, so size changes can be handled efficiently. - * - * Each of the `.with*` and `.reset` functions passes its current style and size - * as the parentStyle and parentSize of the new options class, so parent - * handling is taken care of automatically. - */ -function Options(data) { - this.style = data.style; - this.color = data.color; - this.size = data.size; - this.phantom = data.phantom; - this.font = data.font; - - if (data.parentStyle === undefined) { - this.parentStyle = data.style; - } else { - this.parentStyle = data.parentStyle; - } +var _toConsumableArray2 = require("babel-runtime/helpers/toConsumableArray"); - if (data.parentSize === undefined) { - this.parentSize = data.size; - } else { - this.parentSize = data.parentSize; - } -} +var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); -/** - * Returns a new options object with the same properties as "this". Properties - * from "extension" will be copied to the new options object. - */ -Options.prototype.extend = function(extension) { - var data = { - style: this.style, - size: this.size, - color: this.color, - parentStyle: this.style, - parentSize: this.size, - phantom: this.phantom, - font: this.font, - }; +var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - for (var key in extension) { - if (extension.hasOwnProperty(key)) { - data[key] = extension[key]; - } - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - return new Options(data); -}; +var _createClass2 = require("babel-runtime/helpers/createClass"); -/** - * Create a new options object with the given style. - */ -Options.prototype.withStyle = function(style) { - return this.extend({ - style: style, - }); -}; +var _createClass3 = _interopRequireDefault(_createClass2); -/** - * Create a new options object with the given size. - */ -Options.prototype.withSize = function(size) { - return this.extend({ - size: size, - }); -}; +var _Lexer = require("./Lexer"); -/** - * Create a new options object with the given color. - */ -Options.prototype.withColor = function(color) { - return this.extend({ - color: color, - }); -}; +var _Lexer2 = _interopRequireDefault(_Lexer); -/** - * Create a new options object with "phantom" set to true. - */ -Options.prototype.withPhantom = function() { - return this.extend({ - phantom: true, - }); -}; +var _Token = require("./Token"); + +var _macros = require("./macros"); + +var _macros2 = _interopRequireDefault(_macros); + +var _ParseError = require("./ParseError"); + +var _ParseError2 = _interopRequireDefault(_ParseError); + +var _objectAssign = require("object-assign"); + +var _objectAssign2 = _interopRequireDefault(_objectAssign); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var MacroExpander = function () { + function MacroExpander(input, macros) { + (0, _classCallCheck3.default)(this, MacroExpander); + + this.lexer = new _Lexer2.default(input); + this.macros = (0, _objectAssign2.default)({}, _macros2.default, macros); + this.stack = []; // contains tokens in REVERSE order + } + + /** + * Returns the topmost token on the stack, without expanding it. + * Similar in behavior to TeX's `\futurelet`. + */ + + + (0, _createClass3.default)(MacroExpander, [{ + key: "future", + value: function future() { + if (this.stack.length === 0) { + this.pushToken(this.lexer.lex()); + } + return this.stack[this.stack.length - 1]; + } + + /** + * Remove and return the next unexpanded token. + */ + + }, { + key: "popToken", + value: function popToken() { + this.future(); // ensure non-empty stack + return this.stack.pop(); + } + + /** + * Add a given token to the token stack. In particular, this get be used + * to put back a token returned from one of the other methods. + */ + + }, { + key: "pushToken", + value: function pushToken(token) { + this.stack.push(token); + } + + /** + * Append an array of tokens to the token stack. + */ + + }, { + key: "pushTokens", + value: function pushTokens(tokens) { + var _stack; + + (_stack = this.stack).push.apply(_stack, (0, _toConsumableArray3.default)(tokens)); + } + + /** + * Consume all following space tokens, without expansion. + */ + + }, { + key: "consumeSpaces", + value: function consumeSpaces() { + for (;;) { + var token = this.future(); + if (token.text === " ") { + this.stack.pop(); + } else { + break; + } + } + } + + /** + * Consume the specified number of arguments from the token stream, + * and return the resulting array of arguments. + */ + + }, { + key: "consumeArgs", + value: function consumeArgs(numArgs) { + var args = []; + // obtain arguments, either single token or balanced {…} group + for (var i = 0; i < numArgs; ++i) { + this.consumeSpaces(); // ignore spaces before each argument + var startOfArg = this.popToken(); + if (startOfArg.text === "{") { + var arg = []; + var depth = 1; + while (depth !== 0) { + var tok = this.popToken(); + arg.push(tok); + if (tok.text === "{") { + ++depth; + } else if (tok.text === "}") { + --depth; + } else if (tok.text === "EOF") { + throw new _ParseError2.default("End of input in macro argument", startOfArg); + } + } + arg.pop(); // remove last } + arg.reverse(); // like above, to fit in with stack order + args[i] = arg; + } else if (startOfArg.text === "EOF") { + throw new _ParseError2.default("End of input expecting macro argument"); + } else { + args[i] = [startOfArg]; + } + } + return args; + } + + /** + * Expand the next token only once if possible. + * + * If the token is expanded, the resulting tokens will be pushed onto + * the stack in reverse order and will be returned as an array, + * also in reverse order. + * + * If not, the next token will be returned without removing it + * from the stack. This case can be detected by a `Token` return value + * instead of an `Array` return value. + * + * In either case, the next token will be on the top of the stack, + * or the stack will be empty. + * + * Used to implement `expandAfterFuture` and `expandNextToken`. + * + * At the moment, macro expansion doesn't handle delimited macros, + * i.e. things like those defined by \def\foo#1\end{…}. + * See the TeX book page 202ff. for details on how those should behave. + */ + + }, { + key: "expandOnce", + value: function expandOnce() { + var topToken = this.popToken(); + var name = topToken.text; + var isMacro = name.charAt(0) === "\\"; + if (isMacro && _Lexer.controlWordRegex.test(name)) { + // Consume all spaces after \macro (but not \\, \', etc.) + this.consumeSpaces(); + } + if (!this.macros.hasOwnProperty(name)) { + // Fully expanded + this.pushToken(topToken); + return topToken; + } + + var _getExpansion2 = this._getExpansion(name), + tokens = _getExpansion2.tokens, + numArgs = _getExpansion2.numArgs; + + var expansion = tokens; + if (numArgs) { + var args = this.consumeArgs(numArgs); + // paste arguments in place of the placeholders + expansion = expansion.slice(); // make a shallow copy + for (var i = expansion.length - 1; i >= 0; --i) { + var tok = expansion[i]; + if (tok.text === "#") { + if (i === 0) { + throw new _ParseError2.default("Incomplete placeholder at end of macro body", tok); + } + tok = expansion[--i]; // next token on stack + if (tok.text === "#") { + // ## → # + expansion.splice(i + 1, 1); // drop first # + } else if (/^[1-9]$/.test(tok.text)) { + var _expansion; + + // replace the placeholder with the indicated argument + (_expansion = expansion).splice.apply(_expansion, [i, 2].concat((0, _toConsumableArray3.default)(args[+tok.text - 1]))); + } else { + throw new _ParseError2.default("Not a valid argument number", tok); + } + } + } + } + // Concatenate expansion onto top of stack. + this.pushTokens(expansion); + return expansion; + } + + /** + * Expand the next token only once (if possible), and return the resulting + * top token on the stack (without removing anything from the stack). + * Similar in behavior to TeX's `\expandafter\futurelet`. + * Equivalent to expandOnce() followed by future(). + */ + + }, { + key: "expandAfterFuture", + value: function expandAfterFuture() { + this.expandOnce(); + return this.future(); + } + + /** + * Recursively expand first token, then return first non-expandable token. + */ + + }, { + key: "expandNextToken", + value: function expandNextToken() { + for (;;) { + var expanded = this.expandOnce(); + // expandOnce returns Token if and only if it's fully expanded. + if (expanded instanceof _Token.Token) { + // \relax stops the expansion, but shouldn't get returned (a + // null return value couldn't get implemented as a function). + if (expanded.text === "\\relax") { + this.stack.pop(); + } else { + return this.stack.pop(); // === expanded + } + } + } + + // Flow unable to figure out that this pathway is impossible. + // https://github.com/facebook/flow/issues/4808 + throw new Error(); // eslint-disable-line no-unreachable + } + + /** + * Returns the expanded macro as a reversed array of tokens and a macro + * argument count. + * Caches macro expansions for those that were defined simple TeX strings. + */ + + }, { + key: "_getExpansion", + value: function _getExpansion(name) { + var definition = this.macros[name]; + var expansion = typeof definition === "function" ? definition(this) : definition; + if (typeof expansion === "string") { + var numArgs = 0; + if (expansion.indexOf("#") !== -1) { + var stripped = expansion.replace(/##/g, ""); + while (stripped.indexOf("#" + (numArgs + 1)) !== -1) { + ++numArgs; + } + } + var bodyLexer = new _Lexer2.default(expansion); + var tokens = []; + var tok = bodyLexer.lex(); + while (tok.text !== "EOF") { + tokens.push(tok); + tok = bodyLexer.lex(); + } + tokens.reverse(); // to fit in with stack using push and pop + var expanded = { tokens: tokens, numArgs: numArgs }; + // Cannot cache a macro defined using a function since it relies on + // parser context. + if (typeof definition !== "function") { + this.macros[name] = expanded; + } + return expanded; + } + return expansion; + } + }]); + return MacroExpander; +}(); /** - * Create a new options objects with the give font. + * This file contains the “gullet” where macros are expanded + * until only non-macro tokens remain. */ -Options.prototype.withFont = function(font) { - return this.extend({ - font: font, - }); -}; +exports.default = MacroExpander; + +},{"./Lexer":81,"./ParseError":84,"./Token":90,"./macros":120,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9,"babel-runtime/helpers/toConsumableArray":11,"object-assign":80}],83:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = require("babel-runtime/helpers/createClass"); + +var _createClass3 = _interopRequireDefault(_createClass2); + +var _fontMetrics2 = require("./fontMetrics"); + +var _fontMetrics3 = _interopRequireDefault(_fontMetrics2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var sizeStyleMap = [ +// Each element contains [textsize, scriptsize, scriptscriptsize]. +// The size mappings are taken from TeX with \normalsize=10pt. +[1, 1, 1], // size1: [5, 5, 5] \tiny +[2, 1, 1], // size2: [6, 5, 5] +[3, 1, 1], // size3: [7, 5, 5] \scriptsize +[4, 2, 1], // size4: [8, 6, 5] \footnotesize +[5, 2, 1], // size5: [9, 6, 5] \small +[6, 3, 1], // size6: [10, 7, 5] \normalsize +[7, 4, 2], // size7: [12, 8, 6] \large +[8, 6, 3], // size8: [14.4, 10, 7] \Large +[9, 7, 6], // size9: [17.28, 12, 10] \LARGE +[10, 8, 7], // size10: [20.74, 14.4, 12] \huge +[11, 10, 9]]; /** - * Create a new options object with the same style, size, and color. This is - * used so that parent style and size changes are handled correctly. + * This file contains information about the options that the Parser carries + * around with it while parsing. Data is held in an `Options` object, and when + * recursing, a new `Options` object can be created with the `.with*` and + * `.reset` functions. */ -Options.prototype.reset = function() { - return this.extend({}); + +var sizeMultipliers = [ +// fontMetrics.js:getFontMetrics also uses size indexes, so if +// you change size indexes, change that function. +0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488]; + +var sizeAtStyle = function sizeAtStyle(size, style) { + return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1]; }; /** - * A map of color names to CSS colors. - * TODO(emily): Remove this when we have real macros + * This is the main options class. It contains the current style, size, color, + * and font. + * + * Options objects should not be modified. To create a new Options with + * different properties, call a `.having*` method. */ -var colorMap = { +var Options = function () { + function Options(data) { + (0, _classCallCheck3.default)(this, Options); + + this.style = data.style; + this.color = data.color; + this.size = data.size || Options.BASESIZE; + this.textSize = data.textSize || this.size; + this.phantom = !!data.phantom; + this.font = data.font; + this.sizeMultiplier = sizeMultipliers[this.size - 1]; + this.maxSize = data.maxSize; + this._fontMetrics = undefined; + } + + /** + * Returns a new options object with the same properties as "this". Properties + * from "extension" will be copied to the new options object. + */ + + + /** + * The base size index. + */ + + + (0, _createClass3.default)(Options, [{ + key: "extend", + value: function extend(extension) { + var data = { + style: this.style, + size: this.size, + textSize: this.textSize, + color: this.color, + phantom: this.phantom, + font: this.font, + maxSize: this.maxSize + }; + + for (var key in extension) { + if (extension.hasOwnProperty(key)) { + data[key] = extension[key]; + } + } + + return new Options(data); + } + + /** + * Return an options object with the given style. If `this.style === style`, + * returns `this`. + */ + + }, { + key: "havingStyle", + value: function havingStyle(style) { + if (this.style === style) { + return this; + } else { + return this.extend({ + style: style, + size: sizeAtStyle(this.textSize, style) + }); + } + } + + /** + * Return an options object with a cramped version of the current style. If + * the current style is cramped, returns `this`. + */ + + }, { + key: "havingCrampedStyle", + value: function havingCrampedStyle() { + return this.havingStyle(this.style.cramp()); + } + + /** + * Return an options object with the given size and in at least `\textstyle`. + * Returns `this` if appropriate. + */ + + }, { + key: "havingSize", + value: function havingSize(size) { + if (this.size === size && this.textSize === size) { + return this; + } else { + return this.extend({ + style: this.style.text(), + size: size, + textSize: size + }); + } + } + + /** + * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted, + * changes to at least `\textstyle`. + */ + + }, { + key: "havingBaseStyle", + value: function havingBaseStyle(style) { + style = style || this.style.text(); + var wantSize = sizeAtStyle(Options.BASESIZE, style); + if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) { + return this; + } else { + return this.extend({ + style: style, + size: wantSize + }); + } + } + + /** + * Create a new options object with the given color. + */ + + }, { + key: "withColor", + value: function withColor(color) { + return this.extend({ + color: color + }); + } + + /** + * Create a new options object with "phantom" set to true. + */ + + }, { + key: "withPhantom", + value: function withPhantom() { + return this.extend({ + phantom: true + }); + } + + /** + * Create a new options objects with the give font. + */ + + }, { + key: "withFont", + value: function withFont(font) { + return this.extend({ + font: font || this.font + }); + } + + /** + * Return the CSS sizing classes required to switch from enclosing options + * `oldOptions` to `this`. Returns an array of classes. + */ + + }, { + key: "sizingClasses", + value: function sizingClasses(oldOptions) { + if (oldOptions.size !== this.size) { + return ["sizing", "reset-size" + oldOptions.size, "size" + this.size]; + } else { + return []; + } + } + + /** + * Return the CSS sizing classes required to switch to the base size. Like + * `this.havingSize(BASESIZE).sizingClasses(this)`. + */ + + }, { + key: "baseSizingClasses", + value: function baseSizingClasses() { + if (this.size !== Options.BASESIZE) { + return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE]; + } else { + return []; + } + } + + /** + * Return the font metrics for this size. + */ + + }, { + key: "fontMetrics", + value: function fontMetrics() { + if (!this._fontMetrics) { + this._fontMetrics = _fontMetrics3.default.getFontMetrics(this.size); + } + return this._fontMetrics; + } + + /** + * A map of color names to CSS colors. + * TODO(emily): Remove this when we have real macros + */ + + }, { + key: "getColor", + + + /** + * Gets the CSS color of the current options object, accounting for the + * `colorMap`. + */ + value: function getColor() { + if (this.phantom) { + return "transparent"; + } else if (this.color != null && Options.colorMap.hasOwnProperty(this.color)) { + return Options.colorMap[this.color]; + } else { + return this.color; + } + } + }]); + return Options; +}(); + +Options.BASESIZE = 6; +Options.colorMap = { "katex-blue": "#6495ed", "katex-orange": "#ffa500", "katex-pink": "#ff00af", @@ -517,24 +2074,29 @@ var colorMap = { "katex-grayH": "#3b3e40", "katex-grayI": "#21242c", "katex-kaBlue": "#314453", - "katex-kaGreen": "#71B307", + "katex-kaGreen": "#71B307" }; +exports.default = Options; -/** - * Gets the CSS color of the current options object, accounting for the - * `colorMap`. - */ -Options.prototype.getColor = function() { - if (this.phantom) { - return "transparent"; - } else { - return colorMap[this.color] || this.color; - } -}; +},{"./fontMetrics":101,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],84:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _ParseNode = require("./ParseNode"); -module.exports = Options; +var _ParseNode2 = _interopRequireDefault(_ParseNode); + +var _Token = require("./Token"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -},{}],6:[function(require,module,exports){ /** * This is the ParseError class, which is the main error thrown by KaTeX * functions when something has gone wrong. This is used to distinguish internal @@ -542,24 +2104,28 @@ module.exports = Options; * * If possible, a caller should provide a Token or ParseNode with information * about where in the source string the problem occurred. - * - * @param {string} message The error message - * @param {(Token|ParseNode)=} token An object providing position information */ -function ParseError(message, token) { +var ParseError = +// Error position based on passed-in Token or ParseNode. + +function ParseError(message, // The error message +token) // An object providing position information +{ + (0, _classCallCheck3.default)(this, ParseError); + var error = "KaTeX parse error: " + message; - var start; - var end; + var start = void 0; - if (token && token.lexer && token.start <= token.end) { + var loc = token && token.loc; + if (loc && loc.start <= loc.end) { // If we have the input and a position, make the error a bit fancier // Get the input - var input = token.lexer.input; + var input = loc.lexer.input; // Prepend some information - start = token.start; - end = token.end; + start = loc.start; + var end = loc.end; if (start === input.length) { error += " at end of input: "; } else { @@ -570,13 +2136,13 @@ function ParseError(message, token) { var underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332"); // Extract some context from the input and add it to the error - var left; + var left = void 0; if (start > 15) { left = "…" + input.slice(start - 15, start); } else { left = input.slice(0, start); } - var right; + var right = void 0; if (end + 15 < input.length) { right = input.slice(end, end + 15) + "…"; } else { @@ -589,28 +2155,112 @@ function ParseError(message, token) { // See http://stackoverflow.com/a/8460753 var self = new Error(error); self.name = "ParseError"; + // $FlowFixMe self.__proto__ = ParseError.prototype; - + // $FlowFixMe self.position = start; return self; -} +}; + +// $FlowFixMe More hackery + -// More hackery ParseError.prototype.__proto__ = Error.prototype; -module.exports = ParseError; +exports.default = ParseError; -},{}],7:[function(require,module,exports){ -/* eslint no-constant-condition:0 */ -var functions = require("./functions"); -var environments = require("./environments"); -var MacroExpander = require("./MacroExpander"); -var symbols = require("./symbols"); -var utils = require("./utils"); -var cjkRegex = require("./unicodeRegexes").cjkRegex; +},{"./ParseNode":85,"./Token":90,"babel-runtime/helpers/classCallCheck":8}],85:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _Token = require("./Token"); + +var _SourceLocation = require("./SourceLocation"); + +var _SourceLocation2 = _interopRequireDefault(_SourceLocation); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The resulting parse tree nodes of the parse tree. + * + * It is possible to provide position information, so that a `ParseNode` can + * fulfill a role similar to a `Token` in error reporting. + * For details on the corresponding properties see `Token` constructor. + * Providing such information can lead to better error reporting. + */ +var ParseNode = function ParseNode(type, // type of node, like e.g. "ordgroup" +value, // type-specific representation of the node +mode, // parse mode in action for this node, "math" or "text" +firstToken, // first token of the input for this node, +lastToken) // last token of the input for this node, +// will default to firstToken if unset +{ + (0, _classCallCheck3.default)(this, ParseNode); + + this.type = type; + this.value = value; + this.mode = mode; + this.loc = _SourceLocation2.default.range(firstToken, lastToken); +}; + +exports.default = ParseNode; + +},{"./SourceLocation":88,"./Token":90,"babel-runtime/helpers/classCallCheck":8}],86:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = require("babel-runtime/helpers/createClass"); + +var _createClass3 = _interopRequireDefault(_createClass2); + +var _functions = require("./functions"); + +var _functions2 = _interopRequireDefault(_functions); + +var _environments = require("./environments"); + +var _environments2 = _interopRequireDefault(_environments); -var parseData = require("./parseData"); -var ParseError = require("./ParseError"); +var _MacroExpander = require("./MacroExpander"); + +var _MacroExpander2 = _interopRequireDefault(_MacroExpander); + +var _symbols = require("./symbols"); + +var _symbols2 = _interopRequireDefault(_symbols); + +var _utils = require("./utils"); + +var _utils2 = _interopRequireDefault(_utils); + +var _units = require("./units"); + +var _unicodeRegexes = require("./unicodeRegexes"); + +var _ParseNode = require("./ParseNode"); + +var _ParseNode2 = _interopRequireDefault(_ParseNode); + +var _ParseError = require("./ParseError"); + +var _ParseError2 = _interopRequireDefault(_ParseError); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * This file contains the parser used to parse out a TeX expression from the @@ -641,809 +2291,1196 @@ var ParseError = require("./ParseError"); * * The earlier functions return ParseNodes. * The later functions (which are called deeper in the parse) sometimes return - * ParseFuncOrArgument, which contain a ParseNode as well as some data about + * ParsedFuncOrArgOrDollar, which contain a ParseNode as well as some data about * whether the parsed object is a function which is missing some arguments, or a * standalone object which can be used as an argument to another function. */ +/* TODO: Uncomment when porting to flow. +type ParsedType = "fn" | "arg" | "$" +type ParsedFunc = {| + type: "fn", + result: string, // Function name defined via defineFunction (e.g. "\\frac"). + token: Token, +|}; +type ParsedArg = {| + type: "arg", + result: ParseNode, + token: Token, +|}; +type ParsedDollar = {| + // Math mode switch + type: "$", + result: "$", + token: Token, +|}; +type ParsedFuncOrArgOrDollar = ParsedFunc | ParsedArg | ParsedDollar; +*/ + /** - * Main Parser class + * @param {ParseNode} result + * @param {Token} token + * @return {ParsedArg} */ -function Parser(input, settings) { - // Create a new macro expander (gullet) and (indirectly via that) also a - // new lexer (mouth) for this parser (stomach, in the language of TeX) - this.gullet = new MacroExpander(input, settings.macros); - // Store the settings for use in parsing - this.settings = settings; +function newArgument(result, token) { + return { type: "arg", result: result, token: token }; } -var ParseNode = parseData.ParseNode; +/** + * @param {Token} token + * @return {ParsedFunc} + */ +/* eslint no-constant-condition:0 */ +function newFunction(token) { + return { type: "fn", result: token.text, token: token }; +} /** - * An initial function (without its arguments), or an argument to a function. - * The `result` argument should be a ParseNode. + * @param {Token} token + * @return {ParsedDollar} */ -function ParseFuncOrArgument(result, isFunction, token) { - this.result = result; - // Is this a function (i.e. is it something defined in functions.js)? - this.isFunction = isFunction; - this.token = token; +function newDollar(token) { + return { type: "$", result: "$", token: token }; } /** - * Checks a result to make sure it has the right type, and throws an - * appropriate error otherwise. - * - * @param {boolean=} consume whether to consume the expected token, - * defaults to true + * @param {ParsedFuncOrArgOrDollar} parsed + * @return {ParsedFuncOrArg} */ -Parser.prototype.expect = function(text, consume) { - if (this.nextToken.text !== text) { - throw new ParseError( - "Expected '" + text + "', got '" + this.nextToken.text + "'", - this.nextToken - ); +function assertFuncOrArg(parsed) { + if (parsed.type === "$") { + throw new _ParseError2.default("Unexpected $", parsed.token); } - if (consume !== false) { - this.consume(); + return parsed; +} + +var Parser = function () { + function Parser(input, settings) { + (0, _classCallCheck3.default)(this, Parser); + + // Create a new macro expander (gullet) and (indirectly via that) also a + // new lexer (mouth) for this parser (stomach, in the language of TeX) + this.gullet = new _MacroExpander2.default(input, settings.macros); + // Use old \color behavior (same as LaTeX's \textcolor) if requested. + // We do this after the macros object has been copied by MacroExpander. + if (settings.colorIsTextColor) { + this.gullet.macros["\\color"] = "\\textcolor"; + } + // Store the settings for use in parsing + this.settings = settings; + // Count leftright depth (for \middle errors) + this.leftrightDepth = 0; } -}; -/** - * Considers the current look ahead token as consumed, - * and fetches the one after that as the new look ahead. - */ -Parser.prototype.consume = function() { - this.nextToken = this.gullet.get(this.mode === "math"); -}; + /** + * Checks a result to make sure it has the right type, and throws an + * appropriate error otherwise. + * + * @param {boolean=} consume whether to consume the expected token, + * defaults to true + */ -Parser.prototype.switchMode = function(newMode) { - this.gullet.unget(this.nextToken); - this.mode = newMode; - this.consume(); -}; -/** - * Main parsing function, which parses an entire input. - * - * @return {?Array.} - */ -Parser.prototype.parse = function() { - // Try to parse the input - this.mode = "math"; - this.consume(); - var parse = this.parseInput(); - return parse; -}; + (0, _createClass3.default)(Parser, [{ + key: "expect", + value: function expect(text, consume) { + if (this.nextToken.text !== text) { + throw new _ParseError2.default("Expected '" + text + "', got '" + this.nextToken.text + "'", this.nextToken); + } + if (consume !== false) { + this.consume(); + } + } -/** - * Parses an entire input tree. - */ -Parser.prototype.parseInput = function() { - // Parse an expression - var expression = this.parseExpression(false); - // If we succeeded, make sure there's an EOF at the end - this.expect("EOF", false); - return expression; -}; + /** + * Considers the current look ahead token as consumed, + * and fetches the one after that as the new look ahead. + */ -var endOfExpression = ["}", "\\end", "\\right", "&", "\\\\", "\\cr"]; + }, { + key: "consume", + value: function consume() { + this.nextToken = this.gullet.expandNextToken(); + } -/** - * Parses an "expression", which is a list of atoms. - * - * @param {boolean} breakOnInfix Should the parsing stop when we hit infix - * nodes? This happens when functions have higher precendence - * than infix nodes in implicit parses. - * - * @param {?string} breakOnTokenText The text of the token that the expression - * should end with, or `null` if something else should end the - * expression. - * - * @return {ParseNode} - */ -Parser.prototype.parseExpression = function(breakOnInfix, breakOnTokenText) { - var body = []; - // Keep adding atoms to the body until we can't parse any more atoms (either - // we reached the end, a }, or a \right) - while (true) { - var lex = this.nextToken; - if (endOfExpression.indexOf(lex.text) !== -1) { - break; + /** + * Switches between "text" and "math" modes. + */ + + }, { + key: "switchMode", + value: function switchMode(newMode) { + this.mode = newMode; } - if (breakOnTokenText && lex.text === breakOnTokenText) { - break; + + /** + * Main parsing function, which parses an entire input. + * + * @return {Array.} + */ + + }, { + key: "parse", + value: function parse() { + // Try to parse the input + this.mode = "math"; + this.consume(); + var parse = this.parseInput(); + return parse; } - if (breakOnInfix && functions[lex.text] && functions[lex.text].infix) { - break; + + /** + * Parses an entire input tree. + */ + + }, { + key: "parseInput", + value: function parseInput() { + // Parse an expression + var expression = this.parseExpression(false); + // If we succeeded, make sure there's an EOF at the end + this.expect("EOF", false); + return expression; } - var atom = this.parseAtom(); - if (!atom) { - if (!this.settings.throwOnError && lex.text[0] === "\\") { - var errorNode = this.handleUnsupportedCmd(); - body.push(errorNode); - continue; - } + }, { + key: "parseExpression", + + + /** + * Parses an "expression", which is a list of atoms. + * + * @param {boolean} breakOnInfix Should the parsing stop when we hit infix + * nodes? This happens when functions have higher precendence + * than infix nodes in implicit parses. + * + * @param {?string} breakOnTokenText The text of the token that the expression + * should end with, or `null` if something else should end the + * expression. + * + * @return {Array} + */ + value: function parseExpression(breakOnInfix, breakOnTokenText) { + var body = []; + // Keep adding atoms to the body until we can't parse any more atoms (either + // we reached the end, a }, or a \right) + while (true) { + // Ignore spaces in math mode + if (this.mode === "math") { + this.consumeSpaces(); + } + var lex = this.nextToken; + if (Parser.endOfExpression.indexOf(lex.text) !== -1) { + break; + } + if (breakOnTokenText && lex.text === breakOnTokenText) { + break; + } + if (breakOnInfix && _functions2.default[lex.text] && _functions2.default[lex.text].infix) { + break; + } + var atom = this.parseAtom(breakOnTokenText); + if (!atom) { + if (!this.settings.throwOnError && lex.text[0] === "\\") { + var errorNode = this.handleUnsupportedCmd(); + body.push(errorNode); + continue; + } - break; + break; + } + body.push(atom); + } + return this.handleInfixNodes(body); } - body.push(atom); - } - return this.handleInfixNodes(body); -}; -/** - * Rewrites infix operators such as \over with corresponding commands such - * as \frac. - * - * There can only be one infix operator per group. If there's more than one - * then the expression is ambiguous. This can be resolved by adding {}. - * - * @returns {Array} - */ -Parser.prototype.handleInfixNodes = function(body) { - var overIndex = -1; - var funcName; + /** + * Rewrites infix operators such as \over with corresponding commands such + * as \frac. + * + * There can only be one infix operator per group. If there's more than one + * then the expression is ambiguous. This can be resolved by adding {}. + * + * @param {Array} body + * @return {Array} + */ + + }, { + key: "handleInfixNodes", + value: function handleInfixNodes(body) { + var overIndex = -1; + var funcName = void 0; + + for (var i = 0; i < body.length; i++) { + var node = body[i]; + if (node.type === "infix") { + if (overIndex !== -1) { + throw new _ParseError2.default("only one infix operator per group", node.value.token); + } + overIndex = i; + funcName = node.value.replaceWith; + } + } - for (var i = 0; i < body.length; i++) { - var node = body[i]; - if (node.type === "infix") { if (overIndex !== -1) { - throw new ParseError( - "only one infix operator per group", - node.value.token); + var numerNode = void 0; + var denomNode = void 0; + + var numerBody = body.slice(0, overIndex); + var denomBody = body.slice(overIndex + 1); + + if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { + numerNode = numerBody[0]; + } else { + numerNode = new _ParseNode2.default("ordgroup", numerBody, this.mode); + } + + if (denomBody.length === 1 && denomBody[0].type === "ordgroup") { + denomNode = denomBody[0]; + } else { + denomNode = new _ParseNode2.default("ordgroup", denomBody, this.mode); + } + + var value = this.callFunction(funcName, [numerNode, denomNode], []); + return [new _ParseNode2.default(value.type, value, this.mode)]; + } else { + return body; } - overIndex = i; - funcName = node.value.replaceWith; } - } - if (overIndex !== -1) { - var numerNode; - var denomNode; + // The greediness of a superscript or subscript - var numerBody = body.slice(0, overIndex); - var denomBody = body.slice(overIndex + 1); + }, { + key: "handleSupSubscript", - if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { - numerNode = numerBody[0]; - } else { - numerNode = new ParseNode("ordgroup", numerBody, this.mode); - } - if (denomBody.length === 1 && denomBody[0].type === "ordgroup") { - denomNode = denomBody[0]; - } else { - denomNode = new ParseNode("ordgroup", denomBody, this.mode); + /** + * Handle a subscript or superscript with nice errors. + * @param {string} name For error reporting. + * @return {ParsedNode} + */ + value: function handleSupSubscript(name) { + var symbolToken = this.nextToken; + var symbol = symbolToken.text; + this.consume(); + this.consumeSpaces(); // ignore spaces before sup/subscript argument + var group = this.parseGroup(); + + if (!group) { + if (!this.settings.throwOnError && this.nextToken.text[0] === "\\") { + return this.handleUnsupportedCmd(); + } else { + throw new _ParseError2.default("Expected group after '" + symbol + "'", symbolToken); + } + } + + var arg = assertFuncOrArg(group); + if (arg.type === "fn") { + // ^ and _ have a greediness, so handle interactions with functions' + // greediness + var funcGreediness = _functions2.default[group.result].greediness; + if (funcGreediness > Parser.SUPSUB_GREEDINESS) { + return this.parseGivenFunction(group); + } else { + throw new _ParseError2.default("Got function '" + group.result + "' with no arguments " + "as " + name, symbolToken); + } + } else { + return group.result; + } } - var value = this.callFunction( - funcName, [numerNode, denomNode], null); - return [new ParseNode(value.type, value, this.mode)]; - } else { - return body; - } -}; + /** + * Converts the textual input of an unsupported command into a text node + * contained within a color node whose color is determined by errorColor + */ -// The greediness of a superscript or subscript -var SUPSUB_GREEDINESS = 1; + }, { + key: "handleUnsupportedCmd", + value: function handleUnsupportedCmd() { + var text = this.nextToken.text; + var textordArray = []; -/** - * Handle a subscript or superscript with nice errors. - */ -Parser.prototype.handleSupSubscript = function(name) { - var symbolToken = this.nextToken; - var symbol = symbolToken.text; - this.consume(); - var group = this.parseGroup(); + for (var i = 0; i < text.length; i++) { + textordArray.push(new _ParseNode2.default("textord", text[i], "text")); + } - if (!group) { - if (!this.settings.throwOnError && this.nextToken.text[0] === "\\") { - return this.handleUnsupportedCmd(); - } else { - throw new ParseError( - "Expected group after '" + symbol + "'", - symbolToken - ); - } - } else if (group.isFunction) { - // ^ and _ have a greediness, so handle interactions with functions' - // greediness - var funcGreediness = functions[group.result].greediness; - if (funcGreediness > SUPSUB_GREEDINESS) { - return this.parseFunction(group); - } else { - throw new ParseError( - "Got function '" + group.result + "' with no arguments " + - "as " + name, symbolToken); + var textNode = new _ParseNode2.default("text", { + body: textordArray, + type: "text" + }, this.mode); + + var colorNode = new _ParseNode2.default("color", { + color: this.settings.errorColor, + value: [textNode], + type: "color" + }, this.mode); + + this.consume(); + return colorNode; } - } else { - return group.result; - } -}; -/** - * Converts the textual input of an unsupported command into a text node - * contained within a color node whose color is determined by errorColor - */ -Parser.prototype.handleUnsupportedCmd = function() { - var text = this.nextToken.text; - var textordArray = []; + /** + * Parses a group with optional super/subscripts. + * + * @param {"]" | "}"} breakOnTokenText - character to stop parsing the group on. + * @return {?ParseNode} + */ + + }, { + key: "parseAtom", + value: function parseAtom(breakOnTokenText) { + // The body of an atom is an implicit group, so that things like + // \left(x\right)^2 work correctly. + var base = this.parseImplicitGroup(breakOnTokenText); + + // In text mode, we don't have superscripts or subscripts + if (this.mode === "text") { + return base; + } - for (var i = 0; i < text.length; i++) { - textordArray.push(new ParseNode("textord", text[i], "text")); - } + // Note that base may be empty (i.e. null) at this point. + + var superscript = void 0; + var subscript = void 0; + while (true) { + // Guaranteed in math mode, so eat any spaces first. + this.consumeSpaces(); + + // Lex the first token + var lex = this.nextToken; + + if (lex.text === "\\limits" || lex.text === "\\nolimits") { + // We got a limit control + if (!base || base.type !== "op") { + throw new _ParseError2.default("Limit controls must follow a math operator", lex); + } else { + var limits = lex.text === "\\limits"; + base.value.limits = limits; + base.value.alwaysHandleSupSub = true; + } + this.consume(); + } else if (lex.text === "^") { + // We got a superscript start + if (superscript) { + throw new _ParseError2.default("Double superscript", lex); + } + superscript = this.handleSupSubscript("superscript"); + } else if (lex.text === "_") { + // We got a subscript start + if (subscript) { + throw new _ParseError2.default("Double subscript", lex); + } + subscript = this.handleSupSubscript("subscript"); + } else if (lex.text === "'") { + // We got a prime + if (superscript) { + throw new _ParseError2.default("Double superscript", lex); + } + var prime = new _ParseNode2.default("textord", "\\prime", this.mode); + + // Many primes can be grouped together, so we handle this here + var primes = [prime]; + this.consume(); + // Keep lexing tokens until we get something that's not a prime + while (this.nextToken.text === "'") { + // For each one, add another prime to the list + primes.push(prime); + this.consume(); + } + // If there's a superscript following the primes, combine that + // superscript in with the primes. + if (this.nextToken.text === "^") { + primes.push(this.handleSupSubscript("superscript")); + } + // Put everything into an ordgroup as the superscript + superscript = new _ParseNode2.default("ordgroup", primes, this.mode); + } else { + // If it wasn't ^, _, or ', stop parsing super/subscripts + break; + } + } - var textNode = new ParseNode( - "text", - { - body: textordArray, - type: "text", - }, - this.mode); + if (superscript || subscript) { + // If we got either a superscript or subscript, create a supsub + return new _ParseNode2.default("supsub", { + base: base, + sup: superscript, + sub: subscript + }, this.mode); + } else { + // Otherwise return the original body + return base; + } + } - var colorNode = new ParseNode( - "color", - { - color: this.settings.errorColor, - value: [textNode], - type: "color", - }, - this.mode); + // A list of the size-changing functions, for use in parseImplicitGroup - this.consume(); - return colorNode; -}; -/** - * Parses a group with optional super/subscripts. - * - * @return {?ParseNode} - */ -Parser.prototype.parseAtom = function() { - // The body of an atom is an implicit group, so that things like - // \left(x\right)^2 work correctly. - var base = this.parseImplicitGroup(); + // A list of the style-changing functions, for use in parseImplicitGroup - // In text mode, we don't have superscripts or subscripts - if (this.mode === "text") { - return base; - } - // Note that base may be empty (i.e. null) at this point. + // Old font functions - var superscript; - var subscript; - while (true) { - // Lex the first token - var lex = this.nextToken; - - if (lex.text === "\\limits" || lex.text === "\\nolimits") { - // We got a limit control - if (!base || base.type !== "op") { - throw new ParseError( - "Limit controls must follow a math operator", - lex); - } else { - var limits = lex.text === "\\limits"; - base.value.limits = limits; - base.value.alwaysHandleSupSub = true; + }, { + key: "parseImplicitGroup", + + + /** + * Parses an implicit group, which is a group that starts at the end of a + * specified, and ends right before a higher explicit group ends, or at EOL. It + * is used for functions that appear to affect the current style, like \Large or + * \textrm, where instead of keeping a style we just pretend that there is an + * implicit grouping after it until the end of the group. E.g. + * small text {\Large large text} small text again + * It is also used for \left and \right to get the correct grouping. + * + * @param {"]" | "}"} breakOnTokenText - character to stop parsing the group on. + * @return {?ParseNode} + */ + value: function parseImplicitGroup(breakOnTokenText) { + var start = this.parseSymbol(); + + if (start == null) { + // If we didn't get anything we handle, fall back to parseFunction + return this.parseFunction(); } - this.consume(); - } else if (lex.text === "^") { - // We got a superscript start - if (superscript) { - throw new ParseError("Double superscript", lex); - } - superscript = this.handleSupSubscript("superscript"); - } else if (lex.text === "_") { - // We got a subscript start - if (subscript) { - throw new ParseError("Double subscript", lex); - } - subscript = this.handleSupSubscript("subscript"); - } else if (lex.text === "'") { - // We got a prime - var prime = new ParseNode("textord", "\\prime", this.mode); - - // Many primes can be grouped together, so we handle this here - var primes = [prime]; - this.consume(); - // Keep lexing tokens until we get something that's not a prime - while (this.nextToken.text === "'") { - // For each one, add another prime to the list - primes.push(prime); + + var func = start.result; + + if (func === "\\left") { + // If we see a left: + // Parse the entire left function (including the delimiter) + var left = this.parseGivenFunction(start); + // Parse out the implicit body + ++this.leftrightDepth; + var body = this.parseExpression(false); + --this.leftrightDepth; + // Check the next token + this.expect("\\right", false); + var right = this.parseFunction(); + return new _ParseNode2.default("leftright", { + body: body, + left: left.value.value, + right: right.value.value + }, this.mode); + } else if (func === "\\begin") { + // begin...end is similar to left...right + var begin = this.parseGivenFunction(start); + var envName = begin.value.name; + if (!_environments2.default.has(envName)) { + throw new _ParseError2.default("No such environment: " + envName, begin.value.nameGroup); + } + // Build the environment object. Arguments and other information will + // be made available to the begin and end methods using properties. + var env = _environments2.default.get(envName); + + var _parseArguments = this.parseArguments("\\begin{" + envName + "}", env), + args = _parseArguments.args, + optArgs = _parseArguments.optArgs; + + var context = { + mode: this.mode, + envName: envName, + parser: this + }; + var result = env.handler(context, args, optArgs); + this.expect("\\end", false); + var endNameToken = this.nextToken; + var end = this.parseFunction(); + if (end.value.name !== envName) { + throw new _ParseError2.default("Mismatch: \\begin{" + envName + "} matched " + "by \\end{" + end.value.name + "}", endNameToken); + } + result.position = end.position; + return result; + } else if (_utils2.default.contains(Parser.sizeFuncs, func)) { + // If we see a sizing function, parse out the implicit body + this.consumeSpaces(); + var _body = this.parseExpression(false, breakOnTokenText); + return new _ParseNode2.default("sizing", { + // Figure out what size to use based on the list of functions above + size: _utils2.default.indexOf(Parser.sizeFuncs, func) + 1, + value: _body + }, this.mode); + } else if (_utils2.default.contains(Parser.styleFuncs, func)) { + // If we see a styling function, parse out the implicit body + this.consumeSpaces(); + var _body2 = this.parseExpression(true, breakOnTokenText); + return new _ParseNode2.default("styling", { + // Figure out what style to use by pulling out the style from + // the function name + style: func.slice(1, func.length - 5), + value: _body2 + }, this.mode); + } else if (func in Parser.oldFontFuncs) { + var style = Parser.oldFontFuncs[func]; + // If we see an old font function, parse out the implicit body + this.consumeSpaces(); + var _body3 = this.parseExpression(true, breakOnTokenText); + if (style.slice(0, 4) === 'text') { + return new _ParseNode2.default("text", { + style: style, + body: new _ParseNode2.default("ordgroup", _body3, this.mode) + }, this.mode); + } else { + return new _ParseNode2.default("font", { + font: style, + body: new _ParseNode2.default("ordgroup", _body3, this.mode) + }, this.mode); + } + } else if (func === "\\color") { + // If we see a styling function, parse out the implicit body + var color = this.parseColorGroup(false); + if (!color) { + throw new _ParseError2.default("\\color not followed by color"); + } + var _body4 = this.parseExpression(true, breakOnTokenText); + return new _ParseNode2.default("color", { + type: "color", + color: color.result.value, + value: _body4 + }, this.mode); + } else if (func === "$") { + if (this.mode === "math") { + throw new _ParseError2.default("$ within math mode"); + } this.consume(); + var outerMode = this.mode; + this.switchMode("math"); + var _body5 = this.parseExpression(false, "$"); + this.expect("$", true); + this.switchMode(outerMode); + return new _ParseNode2.default("styling", { + style: "text", + value: _body5 + }, "math"); + } else { + // Defer to parseGivenFunction if it's not a function we handle + return this.parseGivenFunction(start); } - // Put them into an ordgroup as the superscript - superscript = new ParseNode("ordgroup", primes, this.mode); - } else { - // If it wasn't ^, _, or ', stop parsing super/subscripts - break; } - } - if (superscript || subscript) { - // If we got either a superscript or subscript, create a supsub - return new ParseNode("supsub", { - base: base, - sup: superscript, - sub: subscript, - }, this.mode); - } else { - // Otherwise return the original body - return base; - } -}; + /** + * Parses an entire function, including its base and all of its arguments. + * It also handles the case where the parsed node is not a function. + * + * @return {?ParseNode} + */ + + }, { + key: "parseFunction", + value: function parseFunction() { + var baseGroup = this.parseGroup(); + return baseGroup ? this.parseGivenFunction(baseGroup) : null; + } -// A list of the size-changing functions, for use in parseImplicitGroup -var sizeFuncs = [ - "\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", - "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge", -]; + /** + * Same as parseFunction(), except that the base is provided, guaranteeing a + * non-nullable result. + * + * @param {ParsedFuncOrArgOrDollar} baseGroup + * @return {ParseNode} + */ + + }, { + key: "parseGivenFunction", + value: function parseGivenFunction(baseGroup) { + baseGroup = assertFuncOrArg(baseGroup); + if (baseGroup.type === "fn") { + var func = baseGroup.result; + var funcData = _functions2.default[func]; + if (this.mode === "text" && !funcData.allowedInText) { + throw new _ParseError2.default("Can't use function '" + func + "' in text mode", baseGroup.token); + } else if (this.mode === "math" && funcData.allowedInMath === false) { + throw new _ParseError2.default("Can't use function '" + func + "' in math mode", baseGroup.token); + } -// A list of the style-changing functions, for use in parseImplicitGroup -var styleFuncs = [ - "\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle", -]; + var _parseArguments2 = this.parseArguments(func, funcData), + args = _parseArguments2.args, + optArgs = _parseArguments2.optArgs; -/** - * Parses an implicit group, which is a group that starts at the end of a - * specified, and ends right before a higher explicit group ends, or at EOL. It - * is used for functions that appear to affect the current style, like \Large or - * \textrm, where instead of keeping a style we just pretend that there is an - * implicit grouping after it until the end of the group. E.g. - * small text {\Large large text} small text again - * It is also used for \left and \right to get the correct grouping. - * - * @return {?ParseNode} - */ -Parser.prototype.parseImplicitGroup = function() { - var start = this.parseSymbol(); - - if (start == null) { - // If we didn't get anything we handle, fall back to parseFunction - return this.parseFunction(); - } - - var func = start.result; - var body; - - if (func === "\\left") { - // If we see a left: - // Parse the entire left function (including the delimiter) - var left = this.parseFunction(start); - // Parse out the implicit body - body = this.parseExpression(false); - // Check the next token - this.expect("\\right", false); - var right = this.parseFunction(); - return new ParseNode("leftright", { - body: body, - left: left.value.value, - right: right.value.value, - }, this.mode); - } else if (func === "\\begin") { - // begin...end is similar to left...right - var begin = this.parseFunction(start); - var envName = begin.value.name; - if (!environments.hasOwnProperty(envName)) { - throw new ParseError( - "No such environment: " + envName, begin.value.nameGroup); - } - // Build the environment object. Arguments and other information will - // be made available to the begin and end methods using properties. - var env = environments[envName]; - var args = this.parseArguments("\\begin{" + envName + "}", env); - var context = { - mode: this.mode, - envName: envName, - parser: this, - positions: args.pop(), - }; - var result = env.handler(context, args); - this.expect("\\end", false); - var endNameToken = this.nextToken; - var end = this.parseFunction(); - if (end.value.name !== envName) { - throw new ParseError( - "Mismatch: \\begin{" + envName + "} matched " + - "by \\end{" + end.value.name + "}", - endNameToken); - } - result.position = end.position; - return result; - } else if (utils.contains(sizeFuncs, func)) { - // If we see a sizing function, parse out the implict body - body = this.parseExpression(false); - return new ParseNode("sizing", { - // Figure out what size to use based on the list of functions above - size: "size" + (utils.indexOf(sizeFuncs, func) + 1), - value: body, - }, this.mode); - } else if (utils.contains(styleFuncs, func)) { - // If we see a styling function, parse out the implict body - body = this.parseExpression(true); - return new ParseNode("styling", { - // Figure out what style to use by pulling out the style from - // the function name - style: func.slice(1, func.length - 5), - value: body, - }, this.mode); - } else { - // Defer to parseFunction if it's not a function we handle - return this.parseFunction(start); - } -}; + var token = baseGroup.token; + var result = this.callFunction(func, args, optArgs, token); + return new _ParseNode2.default(result.type, result, this.mode); + } else { + return baseGroup.result; + } + } -/** - * Parses an entire function, including its base and all of its arguments. - * The base might either have been parsed already, in which case - * it is provided as an argument, or it's the next group in the input. - * - * @param {ParseFuncOrArgument=} baseGroup optional as described above - * @return {?ParseNode} - */ -Parser.prototype.parseFunction = function(baseGroup) { - if (!baseGroup) { - baseGroup = this.parseGroup(); - } + /** + * Call a function handler with a suitable context and arguments. + * @param {string} name + * @param {Array} args + * @param {Array} optArgs + * @param {Token=} token + */ + + }, { + key: "callFunction", + value: function callFunction(name, args, optArgs, token) { + var context = { + funcName: name, + parser: this, + token: token + }; + return _functions2.default[name].handler(context, args, optArgs); + } - if (baseGroup) { - if (baseGroup.isFunction) { - var func = baseGroup.result; - var funcData = functions[func]; - if (this.mode === "text" && !funcData.allowedInText) { - throw new ParseError( - "Can't use function '" + func + "' in text mode", - baseGroup.token); + /** + * Parses the arguments of a function or environment + * + * @param {string} func "\name" or "\begin{name}" + * @param {{ + * numArgs: number, + * numOptionalArgs: (number|undefined), + * }} funcData + * @return {{ + * args: Array, + * optArgs: Array, + * }} + */ + + }, { + key: "parseArguments", + value: function parseArguments(func, funcData) { + var totalArgs = funcData.numArgs + funcData.numOptionalArgs; + if (totalArgs === 0) { + return { args: [], optArgs: [] }; } - var args = this.parseArguments(func, funcData); - var token = baseGroup.token; - var result = this.callFunction(func, args, args.pop(), token); - return new ParseNode(result.type, result, this.mode); - } else { - return baseGroup.result; + var baseGreediness = funcData.greediness; + var args = []; + var optArgs = []; + + for (var i = 0; i < totalArgs; i++) { + var argType = funcData.argTypes && funcData.argTypes[i]; + var isOptional = i < funcData.numOptionalArgs; + // Ignore spaces between arguments. As the TeXbook says: + // "After you have said ‘\def\row#1#2{...}’, you are allowed to + // put spaces between the arguments (e.g., ‘\row x n’), because + // TeX doesn’t use single spaces as undelimited arguments." + if (i > 0 && !isOptional) { + this.consumeSpaces(); + } + // Also consume leading spaces in math mode, as parseSymbol + // won't know what to do with them. This can only happen with + // macros, e.g. \frac\foo\foo where \foo expands to a space symbol. + // In LaTeX, the \foo's get treated as (blank) arguments). + // In KaTeX, for now, both spaces will get consumed. + // TODO(edemaine) + if (i === 0 && !isOptional && this.mode === "math") { + this.consumeSpaces(); + } + var nextToken = this.nextToken; + var arg = argType ? this.parseGroupOfType(argType, isOptional) : this.parseGroup(isOptional); + if (!arg) { + if (isOptional) { + optArgs.push(null); + continue; + } + if (!this.settings.throwOnError && this.nextToken.text[0] === "\\") { + arg = newArgument(this.handleUnsupportedCmd(), nextToken); + } else { + throw new _ParseError2.default("Expected group after '" + func + "'", nextToken); + } + } + var argNode = void 0; + arg = assertFuncOrArg(arg); + if (arg.type === "fn") { + var argGreediness = _functions2.default[arg.result].greediness; + if (argGreediness > baseGreediness) { + argNode = this.parseGivenFunction(arg); + } else { + throw new _ParseError2.default("Got function '" + arg.result + "' as " + "argument to '" + func + "'", nextToken); + } + } else { + argNode = arg.result; + } + (isOptional ? optArgs : args).push(argNode); + } + + return { args: args, optArgs: optArgs }; } - } else { - return null; - } -}; -/** - * Call a function handler with a suitable context and arguments. - */ -Parser.prototype.callFunction = function(name, args, positions, token) { - var context = { - funcName: name, - parser: this, - positions: positions, - token: token, - }; - return functions[name].handler(context, args); -}; + /** + * Parses a group when the mode is changing. + * + * @return {?ParsedFuncOrArgOrDollar} + */ + + }, { + key: "parseGroupOfType", + value: function parseGroupOfType(innerMode, optional) { + var outerMode = this.mode; + // Handle `original` argTypes + if (innerMode === "original") { + innerMode = outerMode; + } -/** - * Parses the arguments of a function or environment - * - * @param {string} func "\name" or "\begin{name}" - * @param {{numArgs:number,numOptionalArgs:number|undefined}} funcData - * @return the array of arguments, with the list of positions as last element - */ -Parser.prototype.parseArguments = function(func, funcData) { - var totalArgs = funcData.numArgs + funcData.numOptionalArgs; - if (totalArgs === 0) { - return [[this.pos]]; - } - - var baseGreediness = funcData.greediness; - var positions = [this.pos]; - var args = []; - - for (var i = 0; i < totalArgs; i++) { - var nextToken = this.nextToken; - var argType = funcData.argTypes && funcData.argTypes[i]; - var arg; - if (i < funcData.numOptionalArgs) { - if (argType) { - arg = this.parseGroupOfType(argType, true); - } else { - arg = this.parseGroup(true); + if (innerMode === "color") { + return this.parseColorGroup(optional); } - if (!arg) { - args.push(null); - positions.push(this.pos); - continue; + if (innerMode === "size") { + return this.parseSizeGroup(optional); } - } else { - if (argType) { - arg = this.parseGroupOfType(argType); - } else { - arg = this.parseGroup(); - } - if (!arg) { - if (!this.settings.throwOnError && - this.nextToken.text[0] === "\\") { - arg = new ParseFuncOrArgument( - this.handleUnsupportedCmd(this.nextToken.text), - false); - } else { - throw new ParseError( - "Expected group after '" + func + "'", nextToken); + if (innerMode === "url") { + return this.parseUrlGroup(optional); + } + + // By the time we get here, innerMode is one of "text" or "math". + // We switch the mode of the parser, recurse, then restore the old mode. + this.switchMode(innerMode); + var res = this.parseGroup(optional); + this.switchMode(outerMode); + return res; + } + }, { + key: "consumeSpaces", + value: function consumeSpaces() { + while (this.nextToken.text === " ") { + this.consume(); + } + } + + /** + * Parses a group, essentially returning the string formed by the + * brace-enclosed tokens plus some position information. + * + * @param {string} modeName Used to describe the mode in error messages + * @param {boolean=} optional Whether the group is optional or required + * @return {?Token} + */ + + }, { + key: "parseStringGroup", + value: function parseStringGroup(modeName, optional) { + if (optional && this.nextToken.text !== "[") { + return null; + } + var outerMode = this.mode; + this.mode = "text"; + this.expect(optional ? "[" : "{"); + var str = ""; + var firstToken = this.nextToken; + var lastToken = firstToken; + while (this.nextToken.text !== (optional ? "]" : "}")) { + if (this.nextToken.text === "EOF") { + throw new _ParseError2.default("Unexpected end of input in " + modeName, firstToken.range(this.nextToken, str)); } + lastToken = this.nextToken; + str += lastToken.text; + this.consume(); } + this.mode = outerMode; + this.expect(optional ? "]" : "}"); + return firstToken.range(lastToken, str); } - var argNode; - if (arg.isFunction) { - var argGreediness = - functions[arg.result].greediness; - if (argGreediness > baseGreediness) { - argNode = this.parseFunction(arg); - } else { - throw new ParseError( - "Got function '" + arg.result + "' as " + - "argument to '" + func + "'", nextToken); + + /** + * Parses a group, essentially returning the string formed by the + * brace-enclosed tokens plus some position information, possibly + * with nested braces. + * + * @param {string} modeName Used to describe the mode in error messages + * @param {boolean=} optional Whether the group is optional or required + * @return {?Token} + */ + + }, { + key: "parseStringGroupWithBalancedBraces", + value: function parseStringGroupWithBalancedBraces(modeName, optional) { + if (optional && this.nextToken.text !== "[") { + return null; } - } else { - argNode = arg.result; + var outerMode = this.mode; + this.mode = "text"; + this.expect(optional ? "[" : "{"); + var str = ""; + var nest = 0; + var firstToken = this.nextToken; + var lastToken = firstToken; + while (nest > 0 || this.nextToken.text !== (optional ? "]" : "}")) { + if (this.nextToken.text === "EOF") { + throw new _ParseError2.default("Unexpected end of input in " + modeName, firstToken.range(this.nextToken, str)); + } + lastToken = this.nextToken; + str += lastToken.text; + if (lastToken.text === "{") { + nest += 1; + } else if (lastToken.text === "}") { + if (nest <= 0) { + throw new _ParseError2.default("Unbalanced brace of input in " + modeName, firstToken.range(this.nextToken, str)); + } else { + nest -= 1; + } + } + this.consume(); + } + this.mode = outerMode; + this.expect(optional ? "]" : "}"); + return firstToken.range(lastToken, str); + } + + /** + * Parses a regex-delimited group: the largest sequence of tokens + * whose concatenated strings match `regex`. Returns the string + * formed by the tokens plus some position information. + * + * @param {RegExp} regex + * @param {string} modeName Used to describe the mode in error messages + * @return {Token} + */ + + }, { + key: "parseRegexGroup", + value: function parseRegexGroup(regex, modeName) { + var outerMode = this.mode; + this.mode = "text"; + var firstToken = this.nextToken; + var lastToken = firstToken; + var str = ""; + while (this.nextToken.text !== "EOF" && regex.test(str + this.nextToken.text)) { + lastToken = this.nextToken; + str += lastToken.text; + this.consume(); + } + if (str === "") { + throw new _ParseError2.default("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken); + } + this.mode = outerMode; + return firstToken.range(lastToken, str); } - args.push(argNode); - positions.push(this.pos); - } - args.push(positions); + /** + * Parses a color description. + */ - return args; -}; + }, { + key: "parseColorGroup", + value: function parseColorGroup(optional) { + var res = this.parseStringGroup("color", optional); + if (!res) { + return null; + } + var match = /^(#[a-f0-9]{3}|#[a-f0-9]{6}|[a-z]+)$/i.exec(res.text); + if (!match) { + throw new _ParseError2.default("Invalid color: '" + res.text + "'", res); + } + return newArgument(new _ParseNode2.default("color", match[0], this.mode), res); + } + /** + * Parses a url string. + */ -/** - * Parses a group when the mode is changing. - * - * @return {?ParseFuncOrArgument} - */ -Parser.prototype.parseGroupOfType = function(innerMode, optional) { - var outerMode = this.mode; - // Handle `original` argTypes - if (innerMode === "original") { - innerMode = outerMode; - } + }, { + key: "parseUrlGroup", + value: function parseUrlGroup(optional) { + var res = this.parseStringGroupWithBalancedBraces("url", optional); + if (!res) { + return null; + } + var raw = res.text; + // hyperref package allows backslashes alone in href, but doesn't generate + // valid links in such cases; we interpret this as "undefiend" behaviour, + // and keep them as-is. Some browser will replace backslashes with + // forward slashes. + var url = raw.replace(/\\([#$%&~_^{}])/g, '$1'); + return newArgument(new _ParseNode2.default("url", url, this.mode), res); + } - if (innerMode === "color") { - return this.parseColorGroup(optional); - } - if (innerMode === "size") { - return this.parseSizeGroup(optional); - } + /** + * Parses a size specification, consisting of magnitude and unit. + */ - this.switchMode(innerMode); - if (innerMode === "text") { - // text mode is special because it should ignore the whitespace before - // it - while (this.nextToken.text === " ") { - this.consume(); + }, { + key: "parseSizeGroup", + value: function parseSizeGroup(optional) { + var res = void 0; + if (!optional && this.nextToken.text !== "{") { + res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size"); + } else { + res = this.parseStringGroup("size", optional); + } + if (!res) { + return null; + } + var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text); + if (!match) { + throw new _ParseError2.default("Invalid size: '" + res.text + "'", res); + } + var data = { + number: +(match[1] + match[2]), // sign + magnitude, cast to number + unit: match[3] + }; + if (!(0, _units.validUnit)(data)) { + throw new _ParseError2.default("Invalid unit: '" + data.unit + "'", res); + } + return newArgument(new _ParseNode2.default("size", data, this.mode), res); } - } - // By the time we get here, innerMode is one of "text" or "math". - // We switch the mode of the parser, recurse, then restore the old mode. - var res = this.parseGroup(optional); - this.switchMode(outerMode); - return res; -}; -/** - * Parses a group, essentially returning the string formed by the - * brace-enclosed tokens plus some position information. - * - * @param {string} modeName Used to describe the mode in error messages - * @param {boolean=} optional Whether the group is optional or required - */ -Parser.prototype.parseStringGroup = function(modeName, optional) { - if (optional && this.nextToken.text !== "[") { - return null; - } - var outerMode = this.mode; - this.mode = "text"; - this.expect(optional ? "[" : "{"); - var str = ""; - var firstToken = this.nextToken; - var lastToken = firstToken; - while (this.nextToken.text !== (optional ? "]" : "}")) { - if (this.nextToken.text === "EOF") { - throw new ParseError( - "Unexpected end of input in " + modeName, - firstToken.range(this.nextToken, str)); + /** + * If the argument is false or absent, this parses an ordinary group, + * which is either a single nucleus (like "x") or an expression + * in braces (like "{x+y}"). + * If the argument is true, it parses either a bracket-delimited expression + * (like "[x+y]") or returns null to indicate the absence of a + * bracket-enclosed group. + * + * @param {boolean=} optional Whether the group is optional or required + * @return {?ParsedFuncOrArgOrDollar} + */ + + }, { + key: "parseGroup", + value: function parseGroup(optional) { + var firstToken = this.nextToken; + // Try to parse an open brace + if (this.nextToken.text === (optional ? "[" : "{")) { + // If we get a brace, parse an expression + this.consume(); + var expression = this.parseExpression(false, optional ? "]" : "}"); + var lastToken = this.nextToken; + // Make sure we get a close brace + this.expect(optional ? "]" : "}"); + if (this.mode === "text") { + this.formLigatures(expression); + } + return newArgument(new _ParseNode2.default("ordgroup", expression, this.mode, firstToken, lastToken), firstToken.range(lastToken, firstToken.text)); + } else { + // Otherwise, just return a nucleus, or nothing for an optional group + return optional ? null : this.parseSymbol(); + } } - lastToken = this.nextToken; - str += lastToken.text; - this.consume(); - } - this.mode = outerMode; - this.expect(optional ? "]" : "}"); - return firstToken.range(lastToken, str); -}; -/** - * Parses a color description. - */ -Parser.prototype.parseColorGroup = function(optional) { - var res = this.parseStringGroup("color", optional); - if (!res) { - return null; - } - var match = (/^(#[a-z0-9]+|[a-z]+)$/i).exec(res.text); - if (!match) { - throw new ParseError("Invalid color: '" + res.text + "'", res); - } - return new ParseFuncOrArgument( - new ParseNode("color", match[0], this.mode), - false); -}; + /** + * Form ligature-like combinations of characters for text mode. + * This includes inputs like "--", "---", "``" and "''". + * The result will simply replace multiple textord nodes with a single + * character in each value by a single textord node having multiple + * characters in its value. The representation is still ASCII source. + * + * @param {Array.} group the nodes of this group, + * list will be moified in place + */ + + }, { + key: "formLigatures", + value: function formLigatures(group) { + var n = group.length - 1; + for (var i = 0; i < n; ++i) { + var a = group[i]; + var v = a.value; + if (v === "-" && group[i + 1].value === "-") { + if (i + 1 < n && group[i + 2].value === "-") { + group.splice(i, 3, new _ParseNode2.default("textord", "---", "text", a, group[i + 2])); + n -= 2; + } else { + group.splice(i, 2, new _ParseNode2.default("textord", "--", "text", a, group[i + 1])); + n -= 1; + } + } + if ((v === "'" || v === "`") && group[i + 1].value === v) { + group.splice(i, 2, new _ParseNode2.default("textord", v + v, "text", a, group[i + 1])); + n -= 1; + } + } + } -/** - * Parses a size specification, consisting of magnitude and unit. - */ -Parser.prototype.parseSizeGroup = function(optional) { - var res = this.parseStringGroup("size", optional); - if (!res) { - return null; - } - var match = (/(-?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/).exec(res.text); - if (!match) { - throw new ParseError("Invalid size: '" + res.text + "'", res); - } - var data = { - number: +(match[1] + match[2]), // sign + magnitude, cast to number - unit: match[3], - }; - if (data.unit !== "em" && data.unit !== "ex") { - throw new ParseError("Invalid unit: '" + data.unit + "'", res); - } - return new ParseFuncOrArgument( - new ParseNode("color", data, this.mode), - false); -}; + /** + * Parse a single symbol out of the string. Here, we handle both the functions + * we have defined, as well as the single character symbols + * + * @return {?ParsedFuncOrArgOrDollar} + */ -/** - * If the argument is false or absent, this parses an ordinary group, - * which is either a single nucleus (like "x") or an expression - * in braces (like "{x+y}"). - * If the argument is true, it parses either a bracket-delimited expression - * (like "[x+y]") or returns null to indicate the absence of a - * bracket-enclosed group. - * - * @param {boolean=} optional Whether the group is optional or required - * @return {?ParseFuncOrArgument} - */ -Parser.prototype.parseGroup = function(optional) { - var firstToken = this.nextToken; - // Try to parse an open brace - if (this.nextToken.text === (optional ? "[" : "{")) { - // If we get a brace, parse an expression - this.consume(); - var expression = this.parseExpression(false, optional ? "]" : null); - var lastToken = this.nextToken; - // Make sure we get a close brace - this.expect(optional ? "]" : "}"); - if (this.mode === "text") { - this.formLigatures(expression); - } - return new ParseFuncOrArgument( - new ParseNode("ordgroup", expression, this.mode, - firstToken, lastToken), - false); - } else { - // Otherwise, just return a nucleus, or nothing for an optional group - return optional ? null : this.parseSymbol(); - } -}; + }, { + key: "parseSymbol", + value: function parseSymbol() { + var nucleus = this.nextToken; -/** - * Form ligature-like combinations of characters for text mode. - * This includes inputs like "--", "---", "``" and "''". - * The result will simply replace multiple textord nodes with a single - * character in each value by a single textord node having multiple - * characters in its value. The representation is still ASCII source. - * - * @param {Array.} group the nodes of this group, - * list will be moified in place - */ -Parser.prototype.formLigatures = function(group) { - var i; - var n = group.length - 1; - for (i = 0; i < n; ++i) { - var a = group[i]; - var v = a.value; - if (v === "-" && group[i + 1].value === "-") { - if (i + 1 < n && group[i + 2].value === "-") { - group.splice(i, 3, new ParseNode( - "textord", "---", "text", a, group[i + 2])); - n -= 2; + if (_functions2.default[nucleus.text]) { + this.consume(); + // If there exists a function with this name, we return the function and + // say that it is a function. + return newFunction(nucleus); + } else if (_symbols2.default[this.mode][nucleus.text]) { + this.consume(); + // Otherwise if this is a no-argument function, find the type it + // corresponds to in the symbols map + return newArgument(new _ParseNode2.default(_symbols2.default[this.mode][nucleus.text].group, nucleus.text, this.mode, nucleus), nucleus); + } else if (this.mode === "text" && _unicodeRegexes.cjkRegex.test(nucleus.text)) { + this.consume(); + return newArgument(new _ParseNode2.default("textord", nucleus.text, this.mode, nucleus), nucleus); + } else if (nucleus.text === "$") { + return newDollar(nucleus); + } else if (/^\\verb[^a-zA-Z]/.test(nucleus.text)) { + this.consume(); + var arg = nucleus.text.slice(5); + var star = arg.charAt(0) === "*"; + if (star) { + arg = arg.slice(1); + } + // Lexer's tokenRegex is constructed to always have matching + // first/last characters. + if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) { + throw new _ParseError2.default("\\verb assertion failed --\n please report what input caused this bug"); + } + arg = arg.slice(1, -1); // remove first and last char + return newArgument(new _ParseNode2.default("verb", { + body: arg, + star: star + }, "text"), nucleus); } else { - group.splice(i, 2, new ParseNode( - "textord", "--", "text", a, group[i + 1])); - n -= 1; + return null; } } - if ((v === "'" || v === "`") && group[i + 1].value === v) { - group.splice(i, 2, new ParseNode( - "textord", v + v, "text", a, group[i + 1])); - n -= 1; - } - } -}; + }]); + return Parser; +}(); + +Parser.endOfExpression = ["}", "\\end", "\\right", "&", "\\\\", "\\cr"]; +Parser.SUPSUB_GREEDINESS = 1; +Parser.sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"]; +Parser.styleFuncs = ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"]; +Parser.oldFontFuncs = { + "\\rm": "mathrm", + "\\sf": "mathsf", + "\\tt": "mathtt", + "\\bf": "mathbf", + "\\it": "mathit" + //"\\sl": "textsl", + //"\\sc": "textsc", +}; +exports.default = Parser; + +},{"./MacroExpander":82,"./ParseError":84,"./ParseNode":85,"./environments":99,"./functions":103,"./symbols":125,"./unicodeRegexes":126,"./units":127,"./utils":128,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],87:[function(require,module,exports){ +"use strict"; -/** - * Parse a single symbol out of the string. Here, we handle both the functions - * we have defined, as well as the single character symbols - * - * @return {?ParseFuncOrArgument} - */ -Parser.prototype.parseSymbol = function() { - var nucleus = this.nextToken; - - if (functions[nucleus.text]) { - this.consume(); - // If there exists a function with this name, we return the function and - // say that it is a function. - return new ParseFuncOrArgument( - nucleus.text, - true, nucleus); - } else if (symbols[this.mode][nucleus.text]) { - this.consume(); - // Otherwise if this is a no-argument function, find the type it - // corresponds to in the symbols map - return new ParseFuncOrArgument( - new ParseNode(symbols[this.mode][nucleus.text].group, - nucleus.text, this.mode, nucleus), - false, nucleus); - } else if (this.mode === "text" && cjkRegex.test(nucleus.text)) { - this.consume(); - return new ParseFuncOrArgument( - new ParseNode("textord", nucleus.text, this.mode, nucleus), - false, nucleus); - } else { - return null; - } -}; +Object.defineProperty(exports, "__esModule", { + value: true +}); -Parser.prototype.ParseNode = ParseNode; +var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); -module.exports = Parser; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -},{"./MacroExpander":4,"./ParseError":6,"./environments":16,"./functions":19,"./parseData":21,"./symbols":23,"./unicodeRegexes":24,"./utils":25}],8:[function(require,module,exports){ -/** - * This is a module for storing settings passed into KaTeX. It correctly handles - * default settings. - */ +var _utils = require("./utils"); -/** - * Helper function for getting a default value if the value is undefined - */ -function get(option, defaultValue) { - return option === undefined ? defaultValue : option; -} +var _utils2 = _interopRequireDefault(_utils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * The main Settings object * * The current options stored are: - * - displayMode: Whether the expression should be typeset by default in - * textstyle or displaystyle (default false) + * - displayMode: Whether the expression should be typeset as inline math + * (false, the default), meaning that the math starts in + * \textstyle and is placed in an inline-block); or as display + * math (true), meaning that the math starts in \displaystyle + * and is placed in a block with vertical margin. */ -function Settings(options) { +var Settings = function Settings(options) { + (0, _classCallCheck3.default)(this, Settings); + // allow null options options = options || {}; - this.displayMode = get(options.displayMode, false); - this.throwOnError = get(options.throwOnError, true); - this.errorColor = get(options.errorColor, "#cc0000"); + this.displayMode = _utils2.default.deflt(options.displayMode, false); + this.throwOnError = _utils2.default.deflt(options.throwOnError, true); + this.errorColor = _utils2.default.deflt(options.errorColor, "#cc0000"); this.macros = options.macros || {}; -} + this.colorIsTextColor = _utils2.default.deflt(options.colorIsTextColor, false); + this.maxSize = Math.max(0, _utils2.default.deflt(options.maxSize, Infinity)); +}; +/** + * This is a module for storing settings passed into KaTeX. It correctly handles + * default settings. + */ -module.exports = Settings; +exports.default = Settings; + +},{"./utils":128,"babel-runtime/helpers/classCallCheck":8}],88:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _freeze = require("babel-runtime/core-js/object/freeze"); + +var _freeze2 = _interopRequireDefault(_freeze); + +var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = require("babel-runtime/helpers/createClass"); + +var _createClass3 = _interopRequireDefault(_createClass2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Lexing or parsing positional information for error reporting. + * This object is immutable. + */ +var SourceLocation = function () { + // End offset, zero-based exclusive. + + // Lexer holding the input string. + function SourceLocation(lexer, start, end) { + (0, _classCallCheck3.default)(this, SourceLocation); + + this.lexer = lexer; + this.start = start; + this.end = end; + (0, _freeze2.default)(this); // Immutable to allow sharing in range(). + } + + /** + * Merges two `SourceLocation`s from location providers, given they are + * provided in order of appearance. + * - Returns the first one's location if only the first is provided. + * - Returns a merged range of the first and the last if both are provided + * and their lexers match. + * - Otherwise, returns null. + */ + // Start offset, zero-based inclusive. + + + (0, _createClass3.default)(SourceLocation, null, [{ + key: "range", + value: function range(first, second) { + if (!second) { + return first && first.loc; + } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) { + return null; + } else { + return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end); + } + } + }]); + return SourceLocation; +}(); + +exports.default = SourceLocation; + +},{"babel-runtime/core-js/object/freeze":7,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],89:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = require("babel-runtime/helpers/createClass"); + +var _createClass3 = _interopRequireDefault(_createClass2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -},{}],9:[function(require,module,exports){ /** * This file contains information and classes for the various kinds of styles * used in TeX. It provides a generic `Style` class, which holds information @@ -1454,68 +3491,97 @@ module.exports = Settings; /** * The main style class. Contains a unique id for the style, a size (which is - * the same for cramped and uncramped version of a style), a cramped flag, and a - * size multiplier, which gives the size difference between a style and - * textstyle. + * the same for cramped and uncramped version of a style), and a cramped flag. */ -function Style(id, size, multiplier, cramped) { - this.id = id; - this.size = size; - this.cramped = cramped; - this.sizeMultiplier = multiplier; -} +var Style = function () { + function Style(id, size, cramped) { + (0, _classCallCheck3.default)(this, Style); -/** - * Get the style of a superscript given a base in the current style. - */ -Style.prototype.sup = function() { - return styles[sup[this.id]]; -}; + this.id = id; + this.size = size; + this.cramped = cramped; + } -/** - * Get the style of a subscript given a base in the current style. - */ -Style.prototype.sub = function() { - return styles[sub[this.id]]; -}; + /** + * Get the style of a superscript given a base in the current style. + */ -/** - * Get the style of a fraction numerator given the fraction in the current - * style. - */ -Style.prototype.fracNum = function() { - return styles[fracNum[this.id]]; -}; -/** - * Get the style of a fraction denominator given the fraction in the current - * style. - */ -Style.prototype.fracDen = function() { - return styles[fracDen[this.id]]; -}; + (0, _createClass3.default)(Style, [{ + key: "sup", + value: function sup() { + return styles[_sup[this.id]]; + } -/** - * Get the cramped version of a style (in particular, cramping a cramped style - * doesn't change the style). - */ -Style.prototype.cramp = function() { - return styles[cramp[this.id]]; -}; + /** + * Get the style of a subscript given a base in the current style. + */ -/** - * HTML class name, like "displaystyle cramped" - */ -Style.prototype.cls = function() { - return sizeNames[this.size] + (this.cramped ? " cramped" : " uncramped"); -}; + }, { + key: "sub", + value: function sub() { + return styles[_sub[this.id]]; + } + + /** + * Get the style of a fraction numerator given the fraction in the current + * style. + */ + + }, { + key: "fracNum", + value: function fracNum() { + return styles[_fracNum[this.id]]; + } + + /** + * Get the style of a fraction denominator given the fraction in the current + * style. + */ + + }, { + key: "fracDen", + value: function fracDen() { + return styles[_fracDen[this.id]]; + } + + /** + * Get the cramped version of a style (in particular, cramping a cramped style + * doesn't change the style). + */ + + }, { + key: "cramp", + value: function cramp() { + return styles[_cramp[this.id]]; + } + + /** + * Get a text or display version of this style. + */ + + }, { + key: "text", + value: function text() { + return styles[_text[this.id]]; + } + + /** + * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle) + */ + + }, { + key: "isTight", + value: function isTight() { + return this.size >= 2; + } + }]); + return Style; +}(); + +// Export an interface for type checking, but don't expose the implementation. +// This way, no more styles can be generated. -/** - * HTML Reset class name, like "reset-textstyle" - */ -Style.prototype.reset = function() { - return resetNames[this.size]; -}; // IDs of the different styles var D = 0; @@ -1527,111 +3593,191 @@ var Sc = 5; var SS = 6; var SSc = 7; -// String names for the different sizes -var sizeNames = [ - "displaystyle textstyle", - "textstyle", - "scriptstyle", - "scriptscriptstyle", -]; - -// Reset names for the different sizes -var resetNames = [ - "reset-textstyle", - "reset-textstyle", - "reset-scriptstyle", - "reset-scriptscriptstyle", -]; - // Instances of the different styles -var styles = [ - new Style(D, 0, 1.0, false), - new Style(Dc, 0, 1.0, true), - new Style(T, 1, 1.0, false), - new Style(Tc, 1, 1.0, true), - new Style(S, 2, 0.7, false), - new Style(Sc, 2, 0.7, true), - new Style(SS, 3, 0.5, false), - new Style(SSc, 3, 0.5, true), -]; +var styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)]; // Lookup tables for switching from one style to another -var sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; -var sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; -var fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; -var fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; -var cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; - -// We only export some of the styles. Also, we don't export the `Style` class so -// no more styles can be generated. -module.exports = { +var _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; +var _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; +var _fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; +var _fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; +var _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; +var _text = [D, Dc, T, Tc, T, Tc, T, Tc]; + +// We only export some of the styles. +exports.default = { DISPLAY: styles[D], TEXT: styles[T], SCRIPT: styles[S], - SCRIPTSCRIPT: styles[SS], + SCRIPTSCRIPT: styles[SS] }; -},{}],10:[function(require,module,exports){ +},{"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],90:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Token = undefined; + +var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = require("babel-runtime/helpers/createClass"); + +var _createClass3 = _interopRequireDefault(_createClass2); + +var _SourceLocation = require("./SourceLocation"); + +var _SourceLocation2 = _interopRequireDefault(_SourceLocation); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The resulting token returned from `lex`. + * + * It consists of the token text plus some position information. + * The position information is essentially a range in an input string, + * but instead of referencing the bare input string, we refer to the lexer. + * That way it is possible to attach extra metadata to the input string, + * like for example a file name or similar. + * + * The position information is optional, so it is OK to construct synthetic + * tokens if appropriate. Not providing available position information may + * lead to degraded error reporting, though. + */ + + +/** + * Interface required to break circular dependency between Token, Lexer, and + * ParseError. + */ +var Token = exports.Token = function () { + function Token(text, // the text of this token + loc) { + (0, _classCallCheck3.default)(this, Token); + + this.text = text; + this.loc = loc; + } + + /** + * Given a pair of tokens (this and endToken), compute a `Token` encompassing + * the whole input range enclosed by these two. + */ + + + (0, _createClass3.default)(Token, [{ + key: "range", + value: function range(endToken, // last token of the range, inclusive + text) // the text of the newly constructed token + { + return new Token(text, _SourceLocation2.default.range(this, endToken)); + } + }]); + return Token; +}(); + +},{"./SourceLocation":88,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],91:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _getIterator2 = require("babel-runtime/core-js/get-iterator"); + +var _getIterator3 = _interopRequireDefault(_getIterator2); + +var _domTree = require("./domTree"); + +var _domTree2 = _interopRequireDefault(_domTree); + +var _fontMetrics = require("./fontMetrics"); + +var _fontMetrics2 = _interopRequireDefault(_fontMetrics); + +var _symbols = require("./symbols"); + +var _symbols2 = _interopRequireDefault(_symbols); + +var _utils = require("./utils"); + +var _utils2 = _interopRequireDefault(_utils); + +var _stretchy = require("./stretchy"); + +var _stretchy2 = _interopRequireDefault(_stretchy); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// The following have to be loaded from Main-Italic font, using class mainit +var mainitLetters = ["\\imath", // dotless i +"\\jmath", // dotless j +"\\pounds"]; + +/** + * Looks up the given symbol in fontMetrics, after applying any symbol + * replacements defined in symbol.js + */ + /* eslint no-console:0 */ /** * This module contains general functions that can be used for building * different kinds of domTree nodes in a consistent manner. */ -var domTree = require("./domTree"); -var fontMetrics = require("./fontMetrics"); -var symbols = require("./symbols"); -var utils = require("./utils"); - -var greekCapitals = [ - "\\Gamma", - "\\Delta", - "\\Theta", - "\\Lambda", - "\\Xi", - "\\Pi", - "\\Sigma", - "\\Upsilon", - "\\Phi", - "\\Psi", - "\\Omega", -]; - -// The following have to be loaded from Main-Italic font, using class mainit -var mainitLetters = [ - "\u0131", // dotless i, \imath - "\u0237", // dotless j, \jmath - "\u00a3", // \pounds -]; +var lookupSymbol = function lookupSymbol(value, +// TODO(#963): Use a union type for this. +fontFamily, mode) { + // Replace the value with its replaced value from symbol.js + if (_symbols2.default[mode][value] && _symbols2.default[mode][value].replace) { + value = _symbols2.default[mode][value].replace; + } + return { + value: value, + metrics: _fontMetrics2.default.getCharacterMetrics(value, fontFamily) + }; +}; /** * Makes a symbolNode after translation via the list of symbols in symbols.js. * Correctly pulls out metrics for the character, and optionally takes a list of * classes to be attached to the node. + * + * TODO: make argument order closer to makeSpan + * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which + * should if present come first in `classes`. + * TODO(#953): Make `options` mandatory and always pass it in. */ -var makeSymbol = function(value, style, mode, color, classes) { - // Replace the value with its replaced value from symbol.js - if (symbols[mode][value] && symbols[mode][value].replace) { - value = symbols[mode][value].replace; - } - - var metrics = fontMetrics.getCharacterMetrics(value, style); +var makeSymbol = function makeSymbol(value, fontFamily, mode, options, classes) { + var lookup = lookupSymbol(value, fontFamily, mode); + var metrics = lookup.metrics; + value = lookup.value; - var symbolNode; + var symbolNode = void 0; if (metrics) { - symbolNode = new domTree.symbolNode( - value, metrics.height, metrics.depth, metrics.italic, metrics.skew, - classes); + var italic = metrics.italic; + if (mode === "text") { + italic = 0; + } + symbolNode = new _domTree2.default.symbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, classes); } else { // TODO(emily): Figure out a good way to only print this in development - typeof console !== "undefined" && console.warn( - "No character metrics for '" + value + "' in style '" + - style + "'"); - symbolNode = new domTree.symbolNode(value, 0, 0, 0, 0, classes); + typeof console !== "undefined" && console.warn("No character metrics for '" + value + "' in style '" + fontFamily + "'"); + symbolNode = new _domTree2.default.symbolNode(value, 0, 0, 0, 0, classes); } - if (color) { - symbolNode.style.color = color; + if (options) { + symbolNode.maxFontSize = options.sizeMultiplier; + if (options.style.isTight()) { + symbolNode.classes.push("mtight"); + } + var color = options.getColor(); + if (color) { + symbolNode.style.color = color; + } } return symbolNode; @@ -1640,103 +3786,147 @@ var makeSymbol = function(value, style, mode, color, classes) { /** * Makes a symbol in Main-Regular or AMS-Regular. * Used for rel, bin, open, close, inner, and punct. + * + * TODO(#953): Make `options` mandatory and always pass it in. */ -var mathsym = function(value, mode, color, classes) { +var mathsym = function mathsym(value, mode, options) { + var classes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; + // Decide what font to render the symbol in by its entry in the symbols // table. // Have a special case for when the value = \ because the \ is used as a // textord in unsupported command errors but cannot be parsed as a regular // text ordinal and is therefore not present as a symbol in the symbols // table for text - if (value === "\\" || symbols[mode][value].font === "main") { - return makeSymbol(value, "Main-Regular", mode, color, classes); + if (value === "\\" || _symbols2.default[mode][value].font === "main") { + return makeSymbol(value, "Main-Regular", mode, options, classes); } else { - return makeSymbol( - value, "AMS-Regular", mode, color, classes.concat(["amsrm"])); + return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"])); } }; /** * Makes a symbol in the default font for mathords and textords. */ -var mathDefault = function(value, mode, color, classes, type) { +var mathDefault = function mathDefault(value, mode, options, classes, type) { if (type === "mathord") { - return mathit(value, mode, color, classes); + var fontLookup = mathit(value, mode, options, classes); + return makeSymbol(value, fontLookup.fontName, mode, options, classes.concat([fontLookup.fontClass])); } else if (type === "textord") { - return makeSymbol( - value, "Main-Regular", mode, color, classes.concat(["mathrm"])); + var font = _symbols2.default[mode][value] && _symbols2.default[mode][value].font; + if (font === "ams") { + return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"])); + } else { + // if (font === "main") { + return makeSymbol(value, "Main-Regular", mode, options, classes.concat(["mathrm"])); + } } else { throw new Error("unexpected type: " + type + " in mathDefault"); } }; /** - * Makes a symbol in the italic math font. + * Determines which of the two font names (Main-Italic and Math-Italic) and + * corresponding style tags (mainit or mathit) to use for font "mathit", + * depending on the symbol. Use this function instead of fontMap for font + * "mathit". */ -var mathit = function(value, mode, color, classes) { +var mathit = function mathit(value, mode, options, classes) { if (/[0-9]/.test(value.charAt(0)) || - // glyphs for \imath and \jmath do not exist in Math-Italic so we - // need to use Main-Italic instead - utils.contains(mainitLetters, value) || - utils.contains(greekCapitals, value)) { - return makeSymbol( - value, "Main-Italic", mode, color, classes.concat(["mainit"])); + // glyphs for \imath and \jmath do not exist in Math-Italic so we + // need to use Main-Italic instead + _utils2.default.contains(mainitLetters, value)) { + return { + fontName: "Main-Italic", + fontClass: "mainit" + }; } else { - return makeSymbol( - value, "Math-Italic", mode, color, classes.concat(["mathit"])); + return { + fontName: "Math-Italic", + fontClass: "mathit" + }; } }; /** * Makes either a mathord or textord in the correct font and color. */ -var makeOrd = function(group, options, type) { +var makeOrd = function makeOrd(group, options, type) { var mode = group.mode; var value = group.value; - if (symbols[mode][value] && symbols[mode][value].replace) { - value = symbols[mode][value].replace; - } var classes = ["mord"]; - var color = options.getColor(); var font = options.font; if (font) { - if (font === "mathit" || utils.contains(mainitLetters, value)) { - return mathit(value, mode, color, classes); + var fontLookup = void 0; + if (font === "mathit" || _utils2.default.contains(mainitLetters, value)) { + fontLookup = mathit(value, mode, options, classes); } else { - var fontName = fontMap[font].fontName; - if (fontMetrics.getCharacterMetrics(value, fontName)) { - return makeSymbol( - value, fontName, mode, color, classes.concat([font])); - } else { - return mathDefault(value, mode, color, classes, type); - } + fontLookup = fontMap[font]; + } + if (lookupSymbol(value, fontLookup.fontName, mode).metrics) { + return makeSymbol(value, fontLookup.fontName, mode, options, classes.concat([fontLookup.fontClass || font])); + } else { + return mathDefault(value, mode, options, classes, type); } } else { - return mathDefault(value, mode, color, classes, type); + return mathDefault(value, mode, options, classes, type); + } +}; + +/** + * Combine as many characters as possible in the given array of characters + * via their tryCombine method. + */ +var tryCombineChars = function tryCombineChars(chars) { + for (var i = 0; i < chars.length - 1; i++) { + if (chars[i].tryCombine(chars[i + 1])) { + chars.splice(i + 1, 1); + i--; + } } + return chars; }; /** * Calculate the height, depth, and maxFontSize of an element based on its * children. */ -var sizeElementFromChildren = function(elem) { +var sizeElementFromChildren = function sizeElementFromChildren(elem) { var height = 0; var depth = 0; var maxFontSize = 0; - if (elem.children) { - for (var i = 0; i < elem.children.length; i++) { - if (elem.children[i].height > height) { - height = elem.children[i].height; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = (0, _getIterator3.default)(elem.children), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var child = _step.value; + + if (child.height > height) { + height = child.height; } - if (elem.children[i].depth > depth) { - depth = elem.children[i].depth; + if (child.depth > depth) { + depth = child.depth; } - if (elem.children[i].maxFontSize > maxFontSize) { - maxFontSize = elem.children[i].maxFontSize; + if (child.maxFontSize > maxFontSize) { + maxFontSize = child.maxFontSize; + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; } } } @@ -1747,222 +3937,323 @@ var sizeElementFromChildren = function(elem) { }; /** - * Makes a span with the given list of classes, list of children, and color. + * Makes a span with the given list of classes, list of children, and options. + * + * TODO(#953): Ensure that `options` is always provided (currently some call + * sites don't pass it) and make the type below mandatory. + * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which + * should if present come first in `classes`. */ -var makeSpan = function(classes, children, color) { - var span = new domTree.span(classes, children); +var makeSpan = function makeSpan(classes, children, options) { + var span = new _domTree2.default.span(classes, children, options); sizeElementFromChildren(span); - if (color) { - span.style.color = color; - } - return span; }; +var makeLineSpan = function makeLineSpan(className, options) { + // Fill the entire span instead of just a border. That way, the min-height + // value in katex.less will ensure that at least one screen pixel displays. + var line = _stretchy2.default.ruleSpan(className, options); + line.height = options.fontMetrics().defaultRuleThickness; + line.style.height = line.height + "em"; + line.maxFontSize = 1.0; + return line; +}; + /** - * Makes a document fragment with the given list of children. + * Makes an anchor with the given href, list of classes, list of children, + * and options. */ -var makeFragment = function(children) { - var fragment = new domTree.documentFragment(children); +var makeAnchor = function makeAnchor(href, classes, children, options) { + var anchor = new _domTree2.default.anchor(href, classes, children, options); - sizeElementFromChildren(fragment); + sizeElementFromChildren(anchor); - return fragment; + return anchor; }; /** - * Makes an element placed in each of the vlist elements to ensure that each - * element has the same max font size. To do this, we create a zero-width space - * with the correct font size. + * Prepends the given children to the given span, updating height, depth, and + * maxFontSize. */ -var makeFontSizer = function(options, fontSize) { - var fontSizeInner = makeSpan([], [new domTree.symbolNode("\u200b")]); - fontSizeInner.style.fontSize = - (fontSize / options.style.sizeMultiplier) + "em"; - - var fontSizer = makeSpan( - ["fontsize-ensurer", "reset-" + options.size, "size5"], - [fontSizeInner]); +var prependChildren = function prependChildren(span, children) { + span.children = children.concat(span.children); - return fontSizer; + sizeElementFromChildren(span); }; /** - * Makes a vertical list by stacking elements and kerns on top of each other. - * Allows for many different ways of specifying the positioning method. - * - * Arguments: - * - children: A list of child or kern nodes to be stacked on top of each other - * (i.e. the first element will be at the bottom, and the last at - * the top). Element nodes are specified as - * {type: "elem", elem: node} - * while kern nodes are specified as - * {type: "kern", size: size} - * - positionType: The method by which the vlist should be positioned. Valid - * values are: - * - "individualShift": The children list only contains elem - * nodes, and each node contains an extra - * "shift" value of how much it should be - * shifted (note that shifting is always - * moving downwards). positionData is - * ignored. - * - "top": The positionData specifies the topmost point of - * the vlist (note this is expected to be a height, - * so positive values move up) - * - "bottom": The positionData specifies the bottommost point - * of the vlist (note this is expected to be a - * depth, so positive values move down - * - "shift": The vlist will be positioned such that its - * baseline is positionData away from the baseline - * of the first child. Positive values move - * downwards. - * - "firstBaseline": The vlist will be positioned such that - * its baseline is aligned with the - * baseline of the first child. - * positionData is ignored. (this is - * equivalent to "shift" with - * positionData=0) - * - positionData: Data used in different ways depending on positionType - * - options: An Options object - * + * Makes a document fragment with the given list of children. */ -var makeVList = function(children, positionType, positionData, options) { - var depth; - var currPos; - var i; - if (positionType === "individualShift") { - var oldChildren = children; - children = [oldChildren[0]]; - - // Add in kerns to the list of children to get each element to be +var makeFragment = function makeFragment(children) { + var fragment = new _domTree2.default.documentFragment(children); + + sizeElementFromChildren(fragment); + + return fragment; +}; + +// These are exact object types to catch typos in the names of the optional fields. + + +// A list of child or kern nodes to be stacked on top of each other (i.e. the +// first element will be at the bottom, and the last at the top). + + +// Computes the updated `children` list and the overall depth. +// +// This helper function for makeVList makes it easier to enforce type safety by +// allowing early exits (returns) in the logic. +var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { + if (params.positionType === "individualShift") { + var oldChildren = params.children; + var _children = [oldChildren[0]]; + + // Add in kerns to the list of params.children to get each element to be // shifted to the correct specified shift - depth = -oldChildren[0].shift - oldChildren[0].elem.depth; - currPos = depth; - for (i = 1; i < oldChildren.length; i++) { - var diff = -oldChildren[i].shift - currPos - - oldChildren[i].elem.depth; - var size = diff - - (oldChildren[i - 1].elem.height + - oldChildren[i - 1].elem.depth); + var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth; + var currPos = _depth; + for (var i = 1; i < oldChildren.length; i++) { + var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth; + var _size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth); currPos = currPos + diff; - children.push({type: "kern", size: size}); - children.push(oldChildren[i]); + _children.push({ type: "kern", size: _size }); + _children.push(oldChildren[i]); } - } else if (positionType === "top") { + + return { children: _children, depth: _depth }; + } + + var depth = void 0; + if (params.positionType === "top") { // We always start at the bottom, so calculate the bottom by adding up // all the sizes - var bottom = positionData; - for (i = 0; i < children.length; i++) { - if (children[i].type === "kern") { - bottom -= children[i].size; - } else { - bottom -= children[i].elem.height + children[i].elem.depth; + var bottom = params.positionData; + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for (var _iterator2 = (0, _getIterator3.default)(params.children), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var child = _step2.value; + + bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth; + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } } } + depth = bottom; - } else if (positionType === "bottom") { - depth = -positionData; - } else if (positionType === "shift") { - depth = -children[0].elem.depth - positionData; - } else if (positionType === "firstBaseline") { - depth = -children[0].elem.depth; + } else if (params.positionType === "bottom") { + depth = -params.positionData; } else { - depth = 0; + var firstChild = params.children[0]; + if (firstChild.type !== "elem") { + throw new Error('First child must have type "elem".'); + } + if (params.positionType === "shift") { + depth = -firstChild.elem.depth - params.positionData; + } else if (params.positionType === "firstBaseline") { + depth = -firstChild.elem.depth; + } else { + throw new Error("Invalid positionType " + params.positionType + "."); + } } + return { children: params.children, depth: depth }; +}; - // Make the fontSizer - var maxFontSize = 0; - for (i = 0; i < children.length; i++) { - if (children[i].type === "elem") { - maxFontSize = Math.max(maxFontSize, children[i].elem.maxFontSize); +/** + * Makes a vertical list by stacking elements and kerns on top of each other. + * Allows for many different ways of specifying the positioning method. + * + * See VListParam documentation above. + */ +var makeVList = function makeVList(params, options) { + var _getVListChildrenAndD = getVListChildrenAndDepth(params), + children = _getVListChildrenAndD.children, + depth = _getVListChildrenAndD.depth; + + // Create a strut that is taller than any list item. The strut is added to + // each item, where it will determine the item's baseline. Since it has + // `overflow:hidden`, the strut's top edge will sit on the item's line box's + // top edge and the strut's bottom edge will sit on the item's baseline, + // with no additional line-height spacing. This allows the item baseline to + // be positioned precisely without worrying about font ascent and + // line-height. + + + var pstrutSize = 0; + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + + try { + for (var _iterator3 = (0, _getIterator3.default)(children), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var child = _step3.value; + + if (child.type === "elem") { + var _elem = child.elem; + pstrutSize = Math.max(pstrutSize, _elem.maxFontSize, _elem.height); + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } } } - var fontSizer = makeFontSizer(options, maxFontSize); + + pstrutSize += 2; + var pstrut = makeSpan(["pstrut"], []); + pstrut.style.height = pstrutSize + "em"; // Create a new list of actual children at the correct offsets var realChildren = []; - currPos = depth; - for (i = 0; i < children.length; i++) { - if (children[i].type === "kern") { - currPos += children[i].size; - } else { - var child = children[i].elem; + var minPos = depth; + var maxPos = depth; + var currPos = depth; + var _iteratorNormalCompletion4 = true; + var _didIteratorError4 = false; + var _iteratorError4 = undefined; + + try { + for (var _iterator4 = (0, _getIterator3.default)(children), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { + var _child = _step4.value; + + if (_child.type === "kern") { + currPos += _child.size; + } else { + var _elem2 = _child.elem; - var shift = -child.depth - currPos; - currPos += child.height + child.depth; + var childWrap = makeSpan([], [pstrut, _elem2]); + childWrap.style.top = -pstrutSize - currPos - _elem2.depth + "em"; + if (_child.marginLeft) { + childWrap.style.marginLeft = _child.marginLeft; + } + if (_child.marginRight) { + childWrap.style.marginRight = _child.marginRight; + } - var childWrap = makeSpan([], [fontSizer, child]); - childWrap.height -= shift; - childWrap.depth += shift; - childWrap.style.top = shift + "em"; + realChildren.push(childWrap); + currPos += _elem2.height + _elem2.depth; + } + minPos = Math.min(minPos, currPos); + maxPos = Math.max(maxPos, currPos); + } - realChildren.push(childWrap); + // The vlist contents go in a table-cell with `vertical-align:bottom`. + // This cell's bottom edge will determine the containing table's baseline + // without overly expanding the containing line-box. + } catch (err) { + _didIteratorError4 = true; + _iteratorError4 = err; + } finally { + try { + if (!_iteratorNormalCompletion4 && _iterator4.return) { + _iterator4.return(); + } + } finally { + if (_didIteratorError4) { + throw _iteratorError4; + } } } - // Add in an element at the end with no offset to fix the calculation of - // baselines in some browsers (namely IE, sometimes safari) - var baselineFix = makeSpan( - ["baseline-fix"], [fontSizer, new domTree.symbolNode("\u200b")]); - realChildren.push(baselineFix); - var vlist = makeSpan(["vlist"], realChildren); - // Fix the final height and depth, in case there were kerns at the ends - // since the makeSpan calculation won't take that in to account. - vlist.height = Math.max(currPos, vlist.height); - vlist.depth = Math.max(-depth, vlist.depth); - return vlist; -}; - -// A table of size -> font size for the different sizing functions -var sizingMultiplier = { - size1: 0.5, - size2: 0.7, - size3: 0.8, - size4: 0.9, - size5: 1.0, - size6: 1.2, - size7: 1.44, - size8: 1.73, - size9: 2.07, - size10: 2.49, -}; + vlist.style.height = maxPos + "em"; -// A map of spacing functions to their attributes, like size and corresponding -// CSS class -var spacingFunctions = { + // A second row is used if necessary to represent the vlist's depth. + var rows = void 0; + if (minPos < 0) { + var depthStrut = makeSpan(["vlist"], []); + depthStrut.style.height = -minPos + "em"; + + // Safari wants the first row to have inline content; otherwise it + // puts the bottom of the *second* row on the baseline. + var topStrut = makeSpan(["vlist-s"], [new _domTree2.default.symbolNode("\u200B")]); + + rows = [makeSpan(["vlist-r"], [vlist, topStrut]), makeSpan(["vlist-r"], [depthStrut])]; + } else { + rows = [makeSpan(["vlist-r"], [vlist])]; + } + + var vtable = makeSpan(["vlist-t"], rows); + if (rows.length === 2) { + vtable.classes.push("vlist-t2"); + } + vtable.height = maxPos; + vtable.depth = -minPos; + return vtable; +}; + +// Converts verb group into body string, dealing with \verb* form +var makeVerb = function makeVerb(group, options) { + // TODO(#892): Make ParseNode type-safe and confirm `group.type` to guarantee + // that `group.value.body` is of type string. + var text = group.value.body; + if (group.value.star) { + text = text.replace(/ /g, "\u2423"); // Open Box + } else { + text = text.replace(/ /g, '\xA0'); // No-Break Space + // (so that, in particular, spaces don't coalesce) + } + return text; +}; + +// A map of spacing functions to their attributes, like size and corresponding +// CSS class +var spacingFunctions = { "\\qquad": { size: "2em", - className: "qquad", + className: "qquad" }, "\\quad": { size: "1em", - className: "quad", + className: "quad" }, "\\enspace": { size: "0.5em", - className: "enspace", + className: "enspace" }, "\\;": { size: "0.277778em", - className: "thickspace", + className: "thickspace" }, "\\:": { size: "0.22222em", - className: "mediumspace", + className: "mediumspace" }, "\\,": { size: "0.16667em", - className: "thinspace", + className: "thinspace" }, "\\!": { size: "-0.16667em", - className: "negativethinspace", - }, + className: "negativethinspace" + } }; /** @@ -1975,11 +4266,15 @@ var fontMap = { // styles "mathbf": { variant: "bold", - fontName: "Main-Bold", + fontName: "Main-Bold" }, "mathrm": { variant: "normal", - fontName: "Main-Regular", + fontName: "Main-Regular" + }, + "textit": { + variant: "italic", + fontName: "Main-Italic" }, // "mathit" is missing because it requires the use of two fonts: Main-Italic @@ -1989,136 +4284,249 @@ var fontMap = { // families "mathbb": { variant: "double-struck", - fontName: "AMS-Regular", + fontName: "AMS-Regular" }, "mathcal": { variant: "script", - fontName: "Caligraphic-Regular", + fontName: "Caligraphic-Regular" }, "mathfrak": { variant: "fraktur", - fontName: "Fraktur-Regular", + fontName: "Fraktur-Regular" }, "mathscr": { variant: "script", - fontName: "Script-Regular", + fontName: "Script-Regular" }, "mathsf": { variant: "sans-serif", - fontName: "SansSerif-Regular", + fontName: "SansSerif-Regular" }, "mathtt": { variant: "monospace", - fontName: "Typewriter-Regular", - }, + fontName: "Typewriter-Regular" + } }; -module.exports = { +exports.default = { fontMap: fontMap, makeSymbol: makeSymbol, mathsym: mathsym, makeSpan: makeSpan, + makeLineSpan: makeLineSpan, + makeAnchor: makeAnchor, makeFragment: makeFragment, makeVList: makeVList, makeOrd: makeOrd, - sizingMultiplier: sizingMultiplier, - spacingFunctions: spacingFunctions, + makeVerb: makeVerb, + tryCombineChars: tryCombineChars, + prependChildren: prependChildren, + spacingFunctions: spacingFunctions }; -},{"./domTree":15,"./fontMetrics":17,"./symbols":23,"./utils":25}],11:[function(require,module,exports){ -/* eslint no-console:0 */ +},{"./domTree":98,"./fontMetrics":101,"./stretchy":123,"./symbols":125,"./utils":128,"babel-runtime/core-js/get-iterator":3}],92:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.buildGroup = exports.groupTypes = exports.makeNullDelimiter = exports.getTypeOfDomTree = exports.buildExpression = exports.spliceSpaces = undefined; + +var _stringify = require("babel-runtime/core-js/json/stringify"); + +var _stringify2 = _interopRequireDefault(_stringify); + +exports.default = buildHTML; + +var _ParseError = require("./ParseError"); + +var _ParseError2 = _interopRequireDefault(_ParseError); + +var _Style = require("./Style"); + +var _Style2 = _interopRequireDefault(_Style); + +var _buildCommon = require("./buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _delimiter = require("./delimiter"); + +var _delimiter2 = _interopRequireDefault(_delimiter); + +var _domTree = require("./domTree"); + +var _domTree2 = _interopRequireDefault(_domTree); + +var _units = require("./units"); + +var _utils = require("./utils"); + +var _utils2 = _interopRequireDefault(_utils); + +var _stretchy = require("./stretchy"); + +var _stretchy2 = _interopRequireDefault(_stretchy); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** + * WARNING: New methods on groupTypes should be added to src/functions. + * * This file does the main work of building a domTree structure from a parse * tree. The entry point is the `buildHTML` function, which takes a parse tree. * Then, the buildExpression, buildGroup, and various groupTypes functions are * called, to produce a final HTML tree. */ -var ParseError = require("./ParseError"); -var Style = require("./Style"); +var makeSpan = _buildCommon2.default.makeSpan; + +var isSpace = function isSpace(node) { + return node instanceof _domTree2.default.span && node.classes[0] === "mspace"; +}; + +// Binary atoms (first class `mbin`) change into ordinary atoms (`mord`) +// depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6, +// and the text before Rule 19. +var isBin = function isBin(node) { + return node && node.classes[0] === "mbin"; +}; + +var isBinLeftCanceller = function isBinLeftCanceller(node, isRealGroup) { + // TODO: This code assumes that a node's math class is the first element + // of its `classes` array. A later cleanup should ensure this, for + // instance by changing the signature of `makeSpan`. + if (node) { + return _utils2.default.contains(["mbin", "mopen", "mrel", "mop", "mpunct"], node.classes[0]); + } else { + return isRealGroup; + } +}; -var buildCommon = require("./buildCommon"); -var delimiter = require("./delimiter"); -var domTree = require("./domTree"); -var fontMetrics = require("./fontMetrics"); -var utils = require("./utils"); +var isBinRightCanceller = function isBinRightCanceller(node, isRealGroup) { + if (node) { + return _utils2.default.contains(["mrel", "mclose", "mpunct"], node.classes[0]); + } else { + return isRealGroup; + } +}; -var makeSpan = buildCommon.makeSpan; +/** + * Splice out any spaces from `children` starting at position `i`, and return + * the spliced-out array. Returns null if `children[i]` does not exist or is not + * a space. + */ +var spliceSpaces = exports.spliceSpaces = function spliceSpaces(children, i) { + var j = i; + while (j < children.length && isSpace(children[j])) { + j++; + } + if (j === i) { + return null; + } else { + return children.splice(i, j - i); + } +}; /** * Take a list of nodes, build them in order, and return a list of the built - * nodes. This function handles the `prev` node correctly, and passes the - * previous element from the list as the prev of the next element. + * nodes. documentFragments are flattened into their contents, so the + * returned list contains no fragments. `isRealGroup` is true if `expression` + * is a real group (no atoms will be added on either side), as opposed to + * a partial group (e.g. one created by \color). */ -var buildExpression = function(expression, options, prev) { +var buildExpression = exports.buildExpression = function buildExpression(expression, options, isRealGroup) { + // Parse expressions into `groups`. var groups = []; for (var i = 0; i < expression.length; i++) { var group = expression[i]; - groups.push(buildGroup(group, options, prev)); - prev = group; + var output = buildGroup(group, options); + if (output instanceof _domTree2.default.documentFragment) { + Array.prototype.push.apply(groups, output.children); + } else { + groups.push(output); + } + } + // At this point `groups` consists entirely of `symbolNode`s and `span`s. + + // Explicit spaces (e.g., \;, \,) should be ignored with respect to atom + // spacing (e.g., "add thick space between mord and mrel"). Since CSS + // adjacency rules implement atom spacing, spaces should be invisible to + // CSS. So we splice them out of `groups` and into the atoms themselves. + for (var _i = 0; _i < groups.length; _i++) { + var spaces = spliceSpaces(groups, _i); + if (spaces) { + // Splicing of spaces may have removed all remaining groups. + if (_i < groups.length) { + // If there is a following group, move space within it. + if (groups[_i] instanceof _domTree2.default.symbolNode) { + groups[_i] = makeSpan([].concat(groups[_i].classes), [groups[_i]]); + } + _buildCommon2.default.prependChildren(groups[_i], spaces); + } else { + // Otherwise, put any spaces back at the end of the groups. + Array.prototype.push.apply(groups, spaces); + break; + } + } + } + + // Binary operators change to ordinary symbols in some contexts. + for (var _i2 = 0; _i2 < groups.length; _i2++) { + if (isBin(groups[_i2]) && (isBinLeftCanceller(groups[_i2 - 1], isRealGroup) || isBinRightCanceller(groups[_i2 + 1], isRealGroup))) { + groups[_i2].classes[0] = "mord"; + } + } + + // Process \\not commands within the group. + // TODO(kevinb): Handle multiple \\not commands in a row. + // TODO(kevinb): Handle \\not{abc} correctly. The \\not should appear over + // the 'a' instead of the 'c'. + for (var _i3 = 0; _i3 < groups.length; _i3++) { + if (groups[_i3].value === "\u0338" && _i3 + 1 < groups.length) { + var children = groups.slice(_i3, _i3 + 2); + + children[0].classes = ["mainrm"]; + // \u0338 is a combining glyph so we could reorder the children so + // that it comes after the other glyph. This works correctly on + // most browsers except for Safari. Instead we absolutely position + // the glyph and set its right side to match that of the other + // glyph which is visually equivalent. + children[0].style.position = "absolute"; + children[0].style.right = "0"; + + // Copy the classes from the second glyph to the new container. + // This is so it behaves the same as though there was no \\not. + var classes = groups[_i3 + 1].classes; + var container = makeSpan(classes, children); + + // LaTeX adds a space between ords separated by a \\not. + if (classes.indexOf("mord") !== -1) { + // \glue(\thickmuskip) 2.77771 plus 2.77771 + container.style.paddingLeft = "0.277771em"; + } + + // Ensure that the \u0338 is positioned relative to the container. + container.style.position = "relative"; + groups.splice(_i3, 2, container); + } } - return groups; -}; -// List of types used by getTypeOfGroup, -// see https://github.com/Khan/KaTeX/wiki/Examining-TeX#group-types -var groupToType = { - mathord: "mord", - textord: "mord", - bin: "mbin", - rel: "mrel", - text: "mord", - open: "mopen", - close: "mclose", - inner: "minner", - genfrac: "mord", - array: "mord", - spacing: "mord", - punct: "mpunct", - ordgroup: "mord", - op: "mop", - katex: "mord", - overline: "mord", - underline: "mord", - rule: "mord", - leftright: "minner", - sqrt: "mord", - accent: "mord", + return groups; }; -/** - * Gets the final math type of an expression, given its group type. This type is - * used to determine spacing between elements, and affects bin elements by - * causing them to change depending on what types are around them. This type - * must be attached to the outermost node of an element as a CSS class so that - * spacing with its surrounding elements works correctly. - * - * Some elements can be mapped one-to-one from group type to math type, and - * those are listed in the `groupToType` table. - * - * Others (usually elements that wrap around other elements) often have - * recursive definitions, and thus call `getTypeOfGroup` on their inner - * elements. - */ -var getTypeOfGroup = function(group) { - if (group == null) { - // Like when typesetting $^3$ - return groupToType.mathord; - } else if (group.type === "supsub") { - return getTypeOfGroup(group.value.base); - } else if (group.type === "llap" || group.type === "rlap") { - return getTypeOfGroup(group.value); - } else if (group.type === "color") { - return getTypeOfGroup(group.value.value); - } else if (group.type === "sizing") { - return getTypeOfGroup(group.value.value); - } else if (group.type === "styling") { - return getTypeOfGroup(group.value.value); - } else if (group.type === "delimsizing") { - return groupToType[group.value.delimType]; +// Return math atom class (mclass) of a domTree. +var getTypeOfDomTree = exports.getTypeOfDomTree = function getTypeOfDomTree(node) { + if (node instanceof _domTree2.default.documentFragment) { + if (node.children.length) { + return getTypeOfDomTree(node.children[node.children.length - 1]); + } } else { - return groupToType[group.type]; + if (_utils2.default.contains(["mord", "mop", "mbin", "mrel", "mopen", "mclose", "mpunct", "minner"], node.classes[0])) { + return node.classes[0]; + } } + return null; }; /** @@ -2127,19 +4535,23 @@ var getTypeOfGroup = function(group) { * its inner element should handle the superscripts and subscripts instead of * handling them itself. */ -var shouldHandleSupSub = function(group, options) { - if (!group) { +var shouldHandleSupSub = function shouldHandleSupSub(group, options) { + if (!group.value.base) { return false; - } else if (group.type === "op") { - // Operators handle supsubs differently when they have limits - // (e.g. `\displaystyle\sum_2^3`) - return group.value.limits && - (options.style.size === Style.DISPLAY.size || - group.value.alwaysHandleSupSub); - } else if (group.type === "accent") { - return isCharacterBox(group.value.base); } else { - return null; + var base = group.value.base; + if (base.type === "op") { + // Operators handle supsubs differently when they have limits + // (e.g. `\displaystyle\sum_2^3`) + return base.value.limits && (options.style.size === _Style2.default.DISPLAY.size || base.value.alwaysHandleSupSub); + } else if (base.type === "accent") { + return isCharacterBox(base.value.base); + } else if (base.type === "horizBrace") { + var isSup = group.value.sub ? false : true; + return isSup === base.value.isOver; + } else { + return null; + } } }; @@ -2148,7 +4560,7 @@ var shouldHandleSupSub = function(group, options) { * cases, this will just be the group itself, but when ordgroups and colors have * a single element, we want to pull that out. */ -var getBaseElem = function(group) { +var getBaseElem = function getBaseElem(group) { if (!group) { return false; } else if (group.type === "ordgroup") { @@ -2175,1315 +4587,836 @@ var getBaseElem = function(group) { * with a single character in them. To decide if something is a character box, * we find its innermost group, and see if it is a single character. */ -var isCharacterBox = function(group) { +var isCharacterBox = function isCharacterBox(group) { var baseElem = getBaseElem(group); // These are all they types of groups which hold single characters - return baseElem.type === "mathord" || - baseElem.type === "textord" || - baseElem.type === "bin" || - baseElem.type === "rel" || - baseElem.type === "inner" || - baseElem.type === "open" || - baseElem.type === "close" || - baseElem.type === "punct"; + return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "bin" || baseElem.type === "rel" || baseElem.type === "inner" || baseElem.type === "open" || baseElem.type === "close" || baseElem.type === "punct"; }; -var makeNullDelimiter = function(options) { - return makeSpan([ - "sizing", "reset-" + options.size, "size5", - options.style.reset(), Style.TEXT.cls(), - "nulldelimiter", - ]); +var makeNullDelimiter = exports.makeNullDelimiter = function makeNullDelimiter(options, classes) { + var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses()); + return makeSpan(classes.concat(moreClasses)); }; /** * This is a map of group types to the function used to handle that type. * Simpler types come at the beginning, while complicated types come afterwards. */ -var groupTypes = {}; - -groupTypes.mathord = function(group, options, prev) { - return buildCommon.makeOrd(group, options, "mathord"); -}; +var groupTypes = exports.groupTypes = {}; -groupTypes.textord = function(group, options, prev) { - return buildCommon.makeOrd(group, options, "textord"); +groupTypes.mathord = function (group, options) { + return _buildCommon2.default.makeOrd(group, options, "mathord"); }; -groupTypes.bin = function(group, options, prev) { - var className = "mbin"; - // Pull out the most recent element. Do some special handling to find - // things at the end of a \color group. Note that we don't use the same - // logic for ordgroups (which count as ords). - var prevAtom = prev; - while (prevAtom && prevAtom.type === "color") { - var atoms = prevAtom.value.value; - prevAtom = atoms[atoms.length - 1]; - } - // See TeXbook pg. 442-446, Rules 5 and 6, and the text before Rule 19. - // Here, we determine whether the bin should turn into an ord. We - // currently only apply Rule 5. - if (!prev || utils.contains(["mbin", "mopen", "mrel", "mop", "mpunct"], - getTypeOfGroup(prevAtom))) { - group.type = "textord"; - className = "mord"; - } - - return buildCommon.mathsym( - group.value, group.mode, options.getColor(), [className]); -}; - -groupTypes.rel = function(group, options, prev) { - return buildCommon.mathsym( - group.value, group.mode, options.getColor(), ["mrel"]); +groupTypes.textord = function (group, options) { + return _buildCommon2.default.makeOrd(group, options, "textord"); }; -groupTypes.open = function(group, options, prev) { - return buildCommon.mathsym( - group.value, group.mode, options.getColor(), ["mopen"]); +groupTypes.bin = function (group, options) { + return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mbin"]); }; -groupTypes.close = function(group, options, prev) { - return buildCommon.mathsym( - group.value, group.mode, options.getColor(), ["mclose"]); +groupTypes.rel = function (group, options) { + return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mrel"]); }; -groupTypes.inner = function(group, options, prev) { - return buildCommon.mathsym( - group.value, group.mode, options.getColor(), ["minner"]); +groupTypes.open = function (group, options) { + return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mopen"]); }; -groupTypes.punct = function(group, options, prev) { - return buildCommon.mathsym( - group.value, group.mode, options.getColor(), ["mpunct"]); +groupTypes.close = function (group, options) { + return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mclose"]); }; -groupTypes.ordgroup = function(group, options, prev) { - return makeSpan( - ["mord", options.style.cls()], - buildExpression(group.value, options.reset()) - ); +groupTypes.inner = function (group, options) { + return _buildCommon2.default.mathsym(group.value, group.mode, options, ["minner"]); }; -groupTypes.text = function(group, options, prev) { - return makeSpan(["text", "mord", options.style.cls()], - buildExpression(group.value.body, options.reset())); +groupTypes.punct = function (group, options) { + return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mpunct"]); }; -groupTypes.color = function(group, options, prev) { - var elements = buildExpression( - group.value.value, - options.withColor(group.value.color), - prev - ); - - // \color isn't supposed to affect the type of the elements it contains. - // To accomplish this, we wrap the results in a fragment, so the inner - // elements will be able to directly interact with their neighbors. For - // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3` - return new buildCommon.makeFragment(elements); +groupTypes.ordgroup = function (group, options) { + return makeSpan(["mord"], buildExpression(group.value, options, true), options); }; -groupTypes.supsub = function(group, options, prev) { +groupTypes.supsub = function (group, options) { // Superscript and subscripts are handled in the TeXbook on page // 445-446, rules 18(a-f). // Here is where we defer to the inner group if it should handle // superscripts and subscripts itself. - if (shouldHandleSupSub(group.value.base, options)) { - return groupTypes[group.value.base.type](group, options, prev); + if (shouldHandleSupSub(group, options)) { + return groupTypes[group.value.base.type](group, options); } - var base = buildGroup(group.value.base, options.reset()); - var supmid; - var submid; - var sup; - var sub; + var base = buildGroup(group.value.base, options); + var supm = void 0; + var subm = void 0; + + var metrics = options.fontMetrics(); + var newOptions = void 0; + + // Rule 18a + var supShift = 0; + var subShift = 0; if (group.value.sup) { - sup = buildGroup(group.value.sup, - options.withStyle(options.style.sup())); - supmid = makeSpan( - [options.style.reset(), options.style.sup().cls()], [sup]); + newOptions = options.havingStyle(options.style.sup()); + supm = buildGroup(group.value.sup, newOptions, options); + if (!isCharacterBox(group.value.base)) { + supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier; + } } if (group.value.sub) { - sub = buildGroup(group.value.sub, - options.withStyle(options.style.sub())); - submid = makeSpan( - [options.style.reset(), options.style.sub().cls()], [sub]); - } - - // Rule 18a - var supShift; - var subShift; - if (isCharacterBox(group.value.base)) { - supShift = 0; - subShift = 0; - } else { - supShift = base.height - fontMetrics.metrics.supDrop; - subShift = base.depth + fontMetrics.metrics.subDrop; + newOptions = options.havingStyle(options.style.sub()); + subm = buildGroup(group.value.sub, newOptions, options); + if (!isCharacterBox(group.value.base)) { + subShift = base.depth + newOptions.fontMetrics().subDrop * newOptions.sizeMultiplier / options.sizeMultiplier; + } } // Rule 18c - var minSupShift; - if (options.style === Style.DISPLAY) { - minSupShift = fontMetrics.metrics.sup1; + var minSupShift = void 0; + if (options.style === _Style2.default.DISPLAY) { + minSupShift = metrics.sup1; } else if (options.style.cramped) { - minSupShift = fontMetrics.metrics.sup3; + minSupShift = metrics.sup3; } else { - minSupShift = fontMetrics.metrics.sup2; + minSupShift = metrics.sup2; } // scriptspace is a font-size-independent size, so scale it // appropriately - var multiplier = Style.TEXT.sizeMultiplier * - options.style.sizeMultiplier; - var scriptspace = - (0.5 / fontMetrics.metrics.ptPerEm) / multiplier + "em"; + var multiplier = options.sizeMultiplier; + var scriptspace = 0.5 / metrics.ptPerEm / multiplier + "em"; - var supsub; + var supsub = void 0; if (!group.value.sup) { // Rule 18b - subShift = Math.max( - subShift, fontMetrics.metrics.sub1, - sub.height - 0.8 * fontMetrics.metrics.xHeight); - - supsub = buildCommon.makeVList([ - {type: "elem", elem: submid}, - ], "shift", subShift, options); - - supsub.children[0].style.marginRight = scriptspace; + subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight); + var vlistElem = [{ type: "elem", elem: subm, marginRight: scriptspace }]; // Subscripts shouldn't be shifted by the base's italic correction. // Account for that by shifting the subscript back the appropriate // amount. Note we only do this when the base is a single symbol. - if (base instanceof domTree.symbolNode) { - supsub.children[0].style.marginLeft = -base.italic + "em"; + if (base instanceof _domTree2.default.symbolNode) { + vlistElem[0].marginLeft = -base.italic + "em"; } + + supsub = _buildCommon2.default.makeVList({ + positionType: "shift", + positionData: subShift, + children: vlistElem + }, options); } else if (!group.value.sub) { // Rule 18c, d - supShift = Math.max(supShift, minSupShift, - sup.depth + 0.25 * fontMetrics.metrics.xHeight); + supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); - supsub = buildCommon.makeVList([ - {type: "elem", elem: supmid}, - ], "shift", -supShift, options); - - supsub.children[0].style.marginRight = scriptspace; + supsub = _buildCommon2.default.makeVList({ + positionType: "shift", + positionData: -supShift, + children: [{ type: "elem", elem: supm, marginRight: scriptspace }] + }, options); } else { - supShift = Math.max( - supShift, minSupShift, - sup.depth + 0.25 * fontMetrics.metrics.xHeight); - subShift = Math.max(subShift, fontMetrics.metrics.sub2); + supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); + subShift = Math.max(subShift, metrics.sub2); - var ruleWidth = fontMetrics.metrics.defaultRuleThickness; + var ruleWidth = metrics.defaultRuleThickness; // Rule 18e - if ((supShift - sup.depth) - (sub.height - subShift) < - 4 * ruleWidth) { - subShift = 4 * ruleWidth - (supShift - sup.depth) + sub.height; - var psi = 0.8 * fontMetrics.metrics.xHeight - - (supShift - sup.depth); + if (supShift - supm.depth - (subm.height - subShift) < 4 * ruleWidth) { + subShift = 4 * ruleWidth - (supShift - supm.depth) + subm.height; + var psi = 0.8 * metrics.xHeight - (supShift - supm.depth); if (psi > 0) { supShift += psi; subShift -= psi; } } - supsub = buildCommon.makeVList([ - {type: "elem", elem: submid, shift: subShift}, - {type: "elem", elem: supmid, shift: -supShift}, - ], "individualShift", null, options); - + var _vlistElem = [{ type: "elem", elem: subm, shift: subShift, marginRight: scriptspace }, { type: "elem", elem: supm, shift: -supShift, marginRight: scriptspace }]; // See comment above about subscripts not being shifted - if (base instanceof domTree.symbolNode) { - supsub.children[0].style.marginLeft = -base.italic + "em"; + if (base instanceof _domTree2.default.symbolNode) { + _vlistElem[0].marginLeft = -base.italic + "em"; } - supsub.children[0].style.marginRight = scriptspace; - supsub.children[1].style.marginRight = scriptspace; + supsub = _buildCommon2.default.makeVList({ + positionType: "individualShift", + children: _vlistElem + }, options); } // We ensure to wrap the supsub vlist in a span.msupsub to reset text-align - return makeSpan([getTypeOfGroup(group.value.base)], - [base, makeSpan(["msupsub"], [supsub])]); + var mclass = getTypeOfDomTree(base) || "mord"; + return makeSpan([mclass], [base, makeSpan(["msupsub"], [supsub])], options); }; -groupTypes.genfrac = function(group, options, prev) { - // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e). - // Figure out what style this fraction should be in based on the - // function used - var fstyle = options.style; - if (group.value.size === "display") { - fstyle = Style.DISPLAY; - } else if (group.value.size === "text") { - fstyle = Style.TEXT; +groupTypes.spacing = function (group, options) { + if (group.value === "\\ " || group.value === "\\space" || group.value === " " || group.value === "~") { + // Spaces are generated by adding an actual space. Each of these + // things has an entry in the symbols table, so these will be turned + // into appropriate outputs. + if (group.mode === "text") { + return _buildCommon2.default.makeOrd(group, options, "textord"); + } else { + return makeSpan(["mspace"], [_buildCommon2.default.mathsym(group.value, group.mode, options)], options); + } + } else { + // Other kinds of spaces are of arbitrary width. We use CSS to + // generate these. + return makeSpan(["mspace", _buildCommon2.default.spacingFunctions[group.value].className], [], options); } +}; - var nstyle = fstyle.fracNum(); - var dstyle = fstyle.fracDen(); - - var numer = buildGroup(group.value.numer, options.withStyle(nstyle)); - var numerreset = makeSpan([fstyle.reset(), nstyle.cls()], [numer]); - - var denom = buildGroup(group.value.denom, options.withStyle(dstyle)); - var denomreset = makeSpan([fstyle.reset(), dstyle.cls()], [denom]); +groupTypes.sqrt = function (group, options) { + // Square roots are handled in the TeXbook pg. 443, Rule 11. - var ruleWidth; - if (group.value.hasBarLine) { - ruleWidth = fontMetrics.metrics.defaultRuleThickness / - options.style.sizeMultiplier; - } else { - ruleWidth = 0; + // First, we do the same steps as in overline to build the inner group + // and line + var inner = buildGroup(group.value.body, options.havingCrampedStyle()); + if (inner.height === 0) { + // Render a small surd. + inner.height = options.fontMetrics().xHeight; } - // Rule 15b - var numShift; - var clearance; - var denomShift; - if (fstyle.size === Style.DISPLAY.size) { - numShift = fontMetrics.metrics.num1; - if (ruleWidth > 0) { - clearance = 3 * ruleWidth; - } else { - clearance = 7 * fontMetrics.metrics.defaultRuleThickness; - } - denomShift = fontMetrics.metrics.denom1; - } else { - if (ruleWidth > 0) { - numShift = fontMetrics.metrics.num2; - clearance = ruleWidth; - } else { - numShift = fontMetrics.metrics.num3; - clearance = 3 * fontMetrics.metrics.defaultRuleThickness; - } - denomShift = fontMetrics.metrics.denom2; + // Some groups can return document fragments. Handle those by wrapping + // them in a span. + if (inner instanceof _domTree2.default.documentFragment) { + inner = makeSpan([], [inner], options); } - var frac; - if (ruleWidth === 0) { - // Rule 15c - var candiateClearance = - (numShift - numer.depth) - (denom.height - denomShift); - if (candiateClearance < clearance) { - numShift += 0.5 * (clearance - candiateClearance); - denomShift += 0.5 * (clearance - candiateClearance); - } - - frac = buildCommon.makeVList([ - {type: "elem", elem: denomreset, shift: denomShift}, - {type: "elem", elem: numerreset, shift: -numShift}, - ], "individualShift", null, options); - } else { - // Rule 15d - var axisHeight = fontMetrics.metrics.axisHeight; + // Calculate the minimum size for the \surd delimiter + var metrics = options.fontMetrics(); + var theta = metrics.defaultRuleThickness; - if ((numShift - numer.depth) - (axisHeight + 0.5 * ruleWidth) < - clearance) { - numShift += - clearance - ((numShift - numer.depth) - - (axisHeight + 0.5 * ruleWidth)); - } + var phi = theta; + if (options.style.id < _Style2.default.TEXT.id) { + phi = options.fontMetrics().xHeight; + } - if ((axisHeight - 0.5 * ruleWidth) - (denom.height - denomShift) < - clearance) { - denomShift += - clearance - ((axisHeight - 0.5 * ruleWidth) - - (denom.height - denomShift)); - } + // Calculate the clearance between the body and line + var lineClearance = theta + phi / 4; - var mid = makeSpan( - [options.style.reset(), Style.TEXT.cls(), "frac-line"]); - // Manually set the height of the line because its height is - // created in CSS - mid.height = ruleWidth; + var minDelimiterHeight = (inner.height + inner.depth + lineClearance + theta) * options.sizeMultiplier; - var midShift = -(axisHeight - 0.5 * ruleWidth); + // Create a sqrt SVG of the required minimum size - frac = buildCommon.makeVList([ - {type: "elem", elem: denomreset, shift: denomShift}, - {type: "elem", elem: mid, shift: midShift}, - {type: "elem", elem: numerreset, shift: -numShift}, - ], "individualShift", null, options); - } + var _delimiter$sqrtImage = _delimiter2.default.sqrtImage(minDelimiterHeight, options), + img = _delimiter$sqrtImage.span, + ruleWidth = _delimiter$sqrtImage.ruleWidth; - // Since we manually change the style sometimes (with \dfrac or \tfrac), - // account for the possible size change here. - frac.height *= fstyle.sizeMultiplier / options.style.sizeMultiplier; - frac.depth *= fstyle.sizeMultiplier / options.style.sizeMultiplier; + var delimDepth = img.height - ruleWidth; - // Rule 15e - var delimSize; - if (fstyle.size === Style.DISPLAY.size) { - delimSize = fontMetrics.metrics.delim1; - } else { - delimSize = fontMetrics.metrics.getDelim2(fstyle); + // Adjust the clearance based on the delimiter size + if (delimDepth > inner.height + inner.depth + lineClearance) { + lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2; } - var leftDelim; - var rightDelim; - if (group.value.leftDelim == null) { - leftDelim = makeNullDelimiter(options); - } else { - leftDelim = delimiter.customSizedDelim( - group.value.leftDelim, delimSize, true, - options.withStyle(fstyle), group.mode); - } - if (group.value.rightDelim == null) { - rightDelim = makeNullDelimiter(options); - } else { - rightDelim = delimiter.customSizedDelim( - group.value.rightDelim, delimSize, true, - options.withStyle(fstyle), group.mode); - } + // Shift the sqrt image + var imgShift = img.height - inner.height - lineClearance - ruleWidth; - return makeSpan( - ["mord", options.style.reset(), fstyle.cls()], - [leftDelim, makeSpan(["mfrac"], [frac]), rightDelim], - options.getColor()); -}; + inner.style.paddingLeft = img.advanceWidth + "em"; -groupTypes.array = function(group, options, prev) { - var r; - var c; - var nr = group.value.body.length; - var nc = 0; - var body = new Array(nr); + // Overlay the image and the argument. + var body = _buildCommon2.default.makeVList({ + positionType: "firstBaseline", + children: [{ type: "elem", elem: inner }, { type: "kern", size: -(inner.height + imgShift) }, { type: "elem", elem: img }, { type: "kern", size: ruleWidth }] + }, options); + body.children[0].children[0].classes.push("svg-align"); - // Horizontal spacing - var pt = 1 / fontMetrics.metrics.ptPerEm; - var arraycolsep = 5 * pt; // \arraycolsep in article.cls + if (!group.value.index) { + return makeSpan(["mord", "sqrt"], [body], options); + } else { + // Handle the optional root index - // Vertical spacing - var baselineskip = 12 * pt; // see size10.clo - // Default \arraystretch from lttab.dtx - // TODO(gagern): may get redefined once we have user-defined macros - var arraystretch = utils.deflt(group.value.arraystretch, 1); - var arrayskip = arraystretch * baselineskip; - var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and - var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx + // The index is always in scriptscript style + var newOptions = options.havingStyle(_Style2.default.SCRIPTSCRIPT); + var rootm = buildGroup(group.value.index, newOptions, options); - var totalHeight = 0; - for (r = 0; r < group.value.body.length; ++r) { - var inrow = group.value.body[r]; - var height = arstrutHeight; // \@array adds an \@arstrut - var depth = arstrutDepth; // to each tow (via the template) + // The amount the index is shifted by. This is taken from the TeX + // source, in the definition of `\r@@t`. + var toShift = 0.6 * (body.height - body.depth); - if (nc < inrow.length) { - nc = inrow.length; - } + // Build a VList with the superscript shifted up correctly + var rootVList = _buildCommon2.default.makeVList({ + positionType: "shift", + positionData: -toShift, + children: [{ type: "elem", elem: rootm }] + }, options); + // Add a class surrounding it so we can add on the appropriate + // kerning + var rootVListWrap = makeSpan(["root"], [rootVList]); - var outrow = new Array(inrow.length); - for (c = 0; c < inrow.length; ++c) { - var elt = buildGroup(inrow[c], options); - if (depth < elt.depth) { - depth = elt.depth; - } - if (height < elt.height) { - height = elt.height; - } - outrow[c] = elt; - } + return makeSpan(["mord", "sqrt"], [rootVListWrap, body], options); + } +}; - var gap = 0; - if (group.value.rowGaps[r]) { - gap = group.value.rowGaps[r].value; - switch (gap.unit) { - case "em": - gap = gap.number; - break; - case "ex": - gap = gap.number * fontMetrics.metrics.emPerEx; - break; - default: - console.error("Can't handle unit " + gap.unit); - gap = 0; - } - if (gap > 0) { // \@argarraycr - gap += arstrutDepth; - if (depth < gap) { - depth = gap; // \@xargarraycr - } - gap = 0; - } +function sizingGroup(value, options, baseOptions) { + var inner = buildExpression(value, options, false); + var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; + + // Add size-resetting classes to the inner list and set maxFontSize + // manually. Handle nested size changes. + for (var i = 0; i < inner.length; i++) { + var pos = _utils2.default.indexOf(inner[i].classes, "sizing"); + if (pos < 0) { + Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions)); + } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) { + // This is a nested size change: e.g., inner[i] is the "b" in + // `\Huge a \small b`. Override the old size (the `reset-` class) + // but not the new size. + inner[i].classes[pos + 1] = "reset-size" + baseOptions.size; } - outrow.height = height; - outrow.depth = depth; - totalHeight += height; - outrow.pos = totalHeight; - totalHeight += depth + gap; // \@yargarraycr - body[r] = outrow; + inner[i].height *= multiplier; + inner[i].depth *= multiplier; } - var offset = totalHeight / 2 + fontMetrics.metrics.axisHeight; - var colDescriptions = group.value.cols || []; - var cols = []; - var colSep; - var colDescrNum; - for (c = 0, colDescrNum = 0; - // Continue while either there are more columns or more column - // descriptions, so trailing separators don't get lost. - c < nc || colDescrNum < colDescriptions.length; - ++c, ++colDescrNum) { + return _buildCommon2.default.makeFragment(inner); +} - var colDescr = colDescriptions[colDescrNum] || {}; +groupTypes.sizing = function (group, options) { + // Handle sizing operators like \Huge. Real TeX doesn't actually allow + // these functions inside of math expressions, so we do some special + // handling. + var newOptions = options.havingSize(group.value.size); + return sizingGroup(group.value.value, newOptions, options); +}; - var firstSeparator = true; - while (colDescr.type === "separator") { - // If there is more than one separator in a row, add a space - // between them. - if (!firstSeparator) { - colSep = makeSpan(["arraycolsep"], []); - colSep.style.width = - fontMetrics.metrics.doubleRuleSep + "em"; - cols.push(colSep); - } +groupTypes.styling = function (group, options) { + // Style changes are handled in the TeXbook on pg. 442, Rule 3. - if (colDescr.separator === "|") { - var separator = makeSpan( - ["vertical-separator"], - []); - separator.style.height = totalHeight + "em"; - separator.style.verticalAlign = - -(totalHeight - offset) + "em"; - - cols.push(separator); - } else { - throw new ParseError( - "Invalid separator type: " + colDescr.separator); - } + // Figure out what style we're changing to. + var styleMap = { + "display": _Style2.default.DISPLAY, + "text": _Style2.default.TEXT, + "script": _Style2.default.SCRIPT, + "scriptscript": _Style2.default.SCRIPTSCRIPT + }; - colDescrNum++; - colDescr = colDescriptions[colDescrNum] || {}; - firstSeparator = false; - } + var newStyle = styleMap[group.value.style]; + var newOptions = options.havingStyle(newStyle); + return sizingGroup(group.value.value, newOptions, options); +}; - if (c >= nc) { - continue; - } +groupTypes.font = function (group, options) { + var font = group.value.font; + return buildGroup(group.value.body, options.withFont(font)); +}; - var sepwidth; - if (c > 0 || group.value.hskipBeforeAndAfter) { - sepwidth = utils.deflt(colDescr.pregap, arraycolsep); - if (sepwidth !== 0) { - colSep = makeSpan(["arraycolsep"], []); - colSep.style.width = sepwidth + "em"; - cols.push(colSep); - } +groupTypes.verb = function (group, options) { + var text = _buildCommon2.default.makeVerb(group, options); + var body = []; + // \verb enters text mode and therefore is sized like \textstyle + var newOptions = options.havingStyle(options.style.text()); + for (var i = 0; i < text.length; i++) { + if (text[i] === '\xA0') { + // spaces appear as nonbreaking space + // The space character isn't in the Typewriter-Regular font, + // so we implement it as a kern of the same size as a character. + // 0.525 is the width of a texttt character in LaTeX. + // It automatically gets scaled by the font size. + var rule = makeSpan(["mord", "rule"], [], newOptions); + rule.style.marginLeft = "0.525em"; + body.push(rule); + } else { + body.push(_buildCommon2.default.makeSymbol(text[i], "Typewriter-Regular", group.mode, newOptions, ["mathtt"])); } + } + _buildCommon2.default.tryCombineChars(body); + return makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), body, newOptions); +}; - var col = []; - for (r = 0; r < nr; ++r) { - var row = body[r]; - var elem = row[c]; - if (!elem) { - continue; - } - var shift = row.pos - offset; - elem.depth = row.depth; - elem.height = row.height; - col.push({type: "elem", elem: elem, shift: shift}); - } +groupTypes.accent = function (group, options) { + // Accents are handled in the TeXbook pg. 443, rule 12. + var base = group.value.base; - col = buildCommon.makeVList(col, "individualShift", null, options); - col = makeSpan( - ["col-align-" + (colDescr.align || "c")], - [col]); - cols.push(col); + var supsubGroup = void 0; + if (group.type === "supsub") { + // If our base is a character box, and we have superscripts and + // subscripts, the supsub will defer to us. In particular, we want + // to attach the superscripts and subscripts to the inner body (so + // that the position of the superscripts and subscripts won't be + // affected by the height of the accent). We accomplish this by + // sticking the base of the accent into the base of the supsub, and + // rendering that, while keeping track of where the accent is. - if (c < nc - 1 || group.value.hskipBeforeAndAfter) { - sepwidth = utils.deflt(colDescr.postgap, arraycolsep); - if (sepwidth !== 0) { - colSep = makeSpan(["arraycolsep"], []); - colSep.style.width = sepwidth + "em"; - cols.push(colSep); - } - } - } - body = makeSpan(["mtable"], cols); - return makeSpan(["mord"], [body], options.getColor()); -}; + // The supsub group is the group that was passed in + var supsub = group; + // The real accent group is the base of the supsub group + group = supsub.value.base; + // The character box is the base of the accent group + base = group.value.base; + // Stick the character box into the base of the supsub group + supsub.value.base = base; -groupTypes.spacing = function(group, options, prev) { - if (group.value === "\\ " || group.value === "\\space" || - group.value === " " || group.value === "~") { - // Spaces are generated by adding an actual space. Each of these - // things has an entry in the symbols table, so these will be turned - // into appropriate outputs. - return makeSpan( - ["mord", "mspace"], - [buildCommon.mathsym(group.value, group.mode)] - ); - } else { - // Other kinds of spaces are of arbitrary width. We use CSS to - // generate these. - return makeSpan( - ["mord", "mspace", - buildCommon.spacingFunctions[group.value].className]); + // Rerender the supsub group with its new base, and store that + // result. + supsubGroup = buildGroup(supsub, options); } -}; -groupTypes.llap = function(group, options, prev) { - var inner = makeSpan( - ["inner"], [buildGroup(group.value.body, options.reset())]); - var fix = makeSpan(["fix"], []); - return makeSpan( - ["llap", options.style.cls()], [inner, fix]); -}; + // Build the base group + var body = buildGroup(base, options.havingCrampedStyle()); -groupTypes.rlap = function(group, options, prev) { - var inner = makeSpan( - ["inner"], [buildGroup(group.value.body, options.reset())]); - var fix = makeSpan(["fix"], []); - return makeSpan( - ["rlap", options.style.cls()], [inner, fix]); -}; + // Does the accent need to shift for the skew of a character? + var mustShift = group.value.isShifty && isCharacterBox(base); -groupTypes.op = function(group, options, prev) { - // Operators are handled in the TeXbook pg. 443-444, rule 13(a). - var supGroup; - var subGroup; - var hasLimits = false; - if (group.type === "supsub" ) { - // If we have limits, supsub will pass us its group to handle. Pull - // out the superscript and subscript and set the group to the op in - // its base. - supGroup = group.value.sup; - subGroup = group.value.sub; - group = group.value.base; - hasLimits = true; + // Calculate the skew of the accent. This is based on the line "If the + // nucleus is not a single character, let s = 0; otherwise set s to the + // kern amount for the nucleus followed by the \skewchar of its font." + // Note that our skew metrics are just the kern between each character + // and the skewchar. + var skew = 0; + if (mustShift) { + // If the base is a character box, then we want the skew of the + // innermost character. To do that, we find the innermost character: + var baseChar = getBaseElem(base); + // Then, we render its group to get the symbol inside it + var baseGroup = buildGroup(baseChar, options.havingCrampedStyle()); + // Finally, we pull the skew off of the symbol. + skew = baseGroup.skew; + // Note that we now throw away baseGroup, because the layers we + // removed with getBaseElem might contain things like \color which + // we can't get rid of. + // TODO(emily): Find a better way to get the skew } - // Most operators have a large successor symbol, but these don't. - var noSuccessor = [ - "\\smallint", - ]; - - var large = false; - if (options.style.size === Style.DISPLAY.size && - group.value.symbol && - !utils.contains(noSuccessor, group.value.body)) { + // calculate the amount of space between the body and the accent + var clearance = Math.min(body.height, options.fontMetrics().xHeight); - // Most symbol operators get larger in displaystyle (rule 13) - large = true; - } + // Build the accent + var accentBody = void 0; + if (!group.value.isStretchy) { + var accent = _buildCommon2.default.makeSymbol(group.value.label, "Main-Regular", group.mode, options); + // Remove the italic correction of the accent, because it only serves to + // shift the accent over to a place we don't want. + accent.italic = 0; + + // The \vec character that the fonts use is a combining character, and + // thus shows up much too far to the left. To account for this, we add a + // specific class which shifts the accent over to where we want it. + // TODO(emily): Fix this in a better way, like by changing the font + // Similarly, text accent \H is a combining character and + // requires a different adjustment. + var accentClass = null; + if (group.value.label === "\\vec") { + accentClass = "accent-vec"; + } else if (group.value.label === '\\H') { + accentClass = "accent-hungarian"; + } - var base; - var baseShift = 0; - var slant = 0; - if (group.value.symbol) { - // If this is a symbol, create the symbol. - var style = large ? "Size2-Regular" : "Size1-Regular"; - base = buildCommon.makeSymbol( - group.value.body, style, "math", options.getColor(), - ["op-symbol", large ? "large-op" : "small-op", "mop"]); + accentBody = makeSpan([], [accent]); + accentBody = makeSpan(["accent-body", accentClass], [accentBody]); - // Shift the symbol so its center lies on the axis (rule 13). It - // appears that our fonts have the centers of the symbols already - // almost on the axis, so these numbers are very small. Note we - // don't actually apply this here, but instead it is used either in - // the vlist creation or separately when there are no limits. - baseShift = (base.height - base.depth) / 2 - - fontMetrics.metrics.axisHeight * - options.style.sizeMultiplier; + // Shift the accent over by the skew. Note we shift by twice the skew + // because we are centering the accent, so by adding 2*skew to the left, + // we shift it to the right by 1*skew. + accentBody.style.marginLeft = 2 * skew + "em"; - // The slant of the symbol is just its italic correction. - slant = base.italic; + accentBody = _buildCommon2.default.makeVList({ + positionType: "firstBaseline", + children: [{ type: "elem", elem: body }, { type: "kern", size: -clearance }, { type: "elem", elem: accentBody }] + }, options); } else { - // Otherwise, this is a text operator. Build the text from the - // operator's name. - // TODO(emily): Add a space in the middle of some of these - // operators, like \limsup - var output = []; - for (var i = 1; i < group.value.body.length; i++) { - output.push(buildCommon.mathsym(group.value.body[i], group.mode)); + accentBody = _stretchy2.default.svgSpan(group, options); + + accentBody = _buildCommon2.default.makeVList({ + positionType: "firstBaseline", + children: [{ type: "elem", elem: body }, { type: "elem", elem: accentBody }] + }, options); + + var styleSpan = accentBody.children[0].children[0].children[1]; + styleSpan.classes.push("svg-align"); // text-align: left; + if (skew > 0) { + // Shorten the accent and nudge it to the right. + styleSpan.style.width = "calc(100% - " + 2 * skew + "em)"; + styleSpan.style.marginLeft = 2 * skew + "em"; } - base = makeSpan(["mop"], output, options.getColor()); } - if (hasLimits) { - // IE 8 clips \int if it is in a display: inline-block. We wrap it - // in a new span so it is an inline, and works. - base = makeSpan([], [base]); - - var supmid; - var supKern; - var submid; - var subKern; - // We manually have to handle the superscripts and subscripts. This, - // aside from the kern calculations, is copied from supsub. - if (supGroup) { - var sup = buildGroup( - supGroup, options.withStyle(options.style.sup())); - supmid = makeSpan( - [options.style.reset(), options.style.sup().cls()], [sup]); + var accentWrap = makeSpan(["mord", "accent"], [accentBody], options); - supKern = Math.max( - fontMetrics.metrics.bigOpSpacing1, - fontMetrics.metrics.bigOpSpacing3 - sup.depth); - } + if (supsubGroup) { + // Here, we replace the "base" child of the supsub with our newly + // generated accent. + supsubGroup.children[0] = accentWrap; - if (subGroup) { - var sub = buildGroup( - subGroup, options.withStyle(options.style.sub())); - submid = makeSpan( - [options.style.reset(), options.style.sub().cls()], - [sub]); + // Since we don't rerun the height calculation after replacing the + // accent, we manually recalculate height. + supsubGroup.height = Math.max(accentWrap.height, supsubGroup.height); - subKern = Math.max( - fontMetrics.metrics.bigOpSpacing2, - fontMetrics.metrics.bigOpSpacing4 - sub.height); - } + // Accents should always be ords, even when their innards are not. + supsubGroup.classes[0] = "mord"; - // Build the final group as a vlist of the possible subscript, base, - // and possible superscript. - var finalGroup; - var top; - var bottom; - if (!supGroup) { - top = base.height - baseShift; - - finalGroup = buildCommon.makeVList([ - {type: "kern", size: fontMetrics.metrics.bigOpSpacing5}, - {type: "elem", elem: submid}, - {type: "kern", size: subKern}, - {type: "elem", elem: base}, - ], "top", top, options); - - // Here, we shift the limits by the slant of the symbol. Note - // that we are supposed to shift the limits by 1/2 of the slant, - // but since we are centering the limits adding a full slant of - // margin will shift by 1/2 that. - finalGroup.children[0].style.marginLeft = -slant + "em"; - } else if (!subGroup) { - bottom = base.depth + baseShift; - - finalGroup = buildCommon.makeVList([ - {type: "elem", elem: base}, - {type: "kern", size: supKern}, - {type: "elem", elem: supmid}, - {type: "kern", size: fontMetrics.metrics.bigOpSpacing5}, - ], "bottom", bottom, options); - - // See comment above about slants - finalGroup.children[1].style.marginLeft = slant + "em"; - } else if (!supGroup && !subGroup) { - // This case probably shouldn't occur (this would mean the - // supsub was sending us a group with no superscript or - // subscript) but be safe. - return base; - } else { - bottom = fontMetrics.metrics.bigOpSpacing5 + - submid.height + submid.depth + - subKern + - base.depth + baseShift; - - finalGroup = buildCommon.makeVList([ - {type: "kern", size: fontMetrics.metrics.bigOpSpacing5}, - {type: "elem", elem: submid}, - {type: "kern", size: subKern}, - {type: "elem", elem: base}, - {type: "kern", size: supKern}, - {type: "elem", elem: supmid}, - {type: "kern", size: fontMetrics.metrics.bigOpSpacing5}, - ], "bottom", bottom, options); - - // See comment above about slants - finalGroup.children[0].style.marginLeft = -slant + "em"; - finalGroup.children[2].style.marginLeft = slant + "em"; - } - - return makeSpan(["mop", "op-limits"], [finalGroup]); + return supsubGroup; } else { - if (group.value.symbol) { - base.style.top = baseShift + "em"; - } - - return base; + return accentWrap; } }; -groupTypes.katex = function(group, options, prev) { - // The KaTeX logo. The offsets for the K and a were chosen to look - // good, but the offsets for the T, E, and X were taken from the - // definition of \TeX in TeX (see TeXbook pg. 356) - var k = makeSpan( - ["k"], [buildCommon.mathsym("K", group.mode)]); - var a = makeSpan( - ["a"], [buildCommon.mathsym("A", group.mode)]); - - a.height = (a.height + 0.2) * 0.75; - a.depth = (a.height - 0.2) * 0.75; - - var t = makeSpan( - ["t"], [buildCommon.mathsym("T", group.mode)]); - var e = makeSpan( - ["e"], [buildCommon.mathsym("E", group.mode)]); +groupTypes.horizBrace = function (group, options) { + var style = options.style; - e.height = (e.height - 0.2155); - e.depth = (e.depth + 0.2155); + var hasSupSub = group.type === "supsub"; + var supSubGroup = void 0; + var newOptions = void 0; + if (hasSupSub) { + // Ref: LaTeX source2e: }}}}\limits} + // i.e. LaTeX treats the brace similar to an op and passes it + // with \limits, so we need to assign supsub style. + if (group.value.sup) { + newOptions = options.havingStyle(style.sup()); + supSubGroup = buildGroup(group.value.sup, newOptions, options); + } else { + newOptions = options.havingStyle(style.sub()); + supSubGroup = buildGroup(group.value.sub, newOptions, options); + } + group = group.value.base; + } - var x = makeSpan( - ["x"], [buildCommon.mathsym("X", group.mode)]); + // Build the base group + var body = buildGroup(group.value.base, options.havingBaseStyle(_Style2.default.DISPLAY)); + + // Create the stretchy element + var braceBody = _stretchy2.default.svgSpan(group, options); + + // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓ + // This first vlist contains the subject matter and the brace: equation + var vlist = void 0; + if (group.value.isOver) { + vlist = _buildCommon2.default.makeVList({ + positionType: "firstBaseline", + children: [{ type: "elem", elem: body }, { type: "kern", size: 0.1 }, { type: "elem", elem: braceBody }] + }, options); + vlist.children[0].children[0].children[1].classes.push("svg-align"); + } else { + vlist = _buildCommon2.default.makeVList({ + positionType: "bottom", + positionData: body.depth + 0.1 + braceBody.height, + children: [{ type: "elem", elem: braceBody }, { type: "kern", size: 0.1 }, { type: "elem", elem: body }] + }, options); + vlist.children[0].children[0].children[0].classes.push("svg-align"); + } + + if (hasSupSub) { + // In order to write the supsub, wrap the first vlist in another vlist: + // They can't all go in the same vlist, because the note might be wider + // than the equation. We want the equation to control the brace width. + + // note long note long note + // ┏━━━━━━━━┓ or ┏━━━┓ not ┏━━━━━━━━━┓ + // equation eqn eqn + + var vSpan = makeSpan(["mord", group.value.isOver ? "mover" : "munder"], [vlist], options); + + if (group.value.isOver) { + vlist = _buildCommon2.default.makeVList({ + positionType: "firstBaseline", + children: [{ type: "elem", elem: vSpan }, { type: "kern", size: 0.2 }, { type: "elem", elem: supSubGroup }] + }, options); + } else { + vlist = _buildCommon2.default.makeVList({ + positionType: "bottom", + positionData: vSpan.depth + 0.2 + supSubGroup.height, + children: [{ type: "elem", elem: supSubGroup }, { type: "kern", size: 0.2 }, { type: "elem", elem: vSpan }] + }, options); + } + } - return makeSpan( - ["katex-logo", "mord"], [k, a, t, e, x], options.getColor()); + return makeSpan(["mord", group.value.isOver ? "mover" : "munder"], [vlist], options); }; -groupTypes.overline = function(group, options, prev) { - // Overlines are handled in the TeXbook pg 443, Rule 9. - - // Build the inner group in the cramped style. - var innerGroup = buildGroup(group.value.body, - options.withStyle(options.style.cramp())); +groupTypes.accentUnder = function (group, options) { + // Treat under accents much like underlines. + var innerGroup = buildGroup(group.value.base, options); - var ruleWidth = fontMetrics.metrics.defaultRuleThickness / - options.style.sizeMultiplier; - - // Create the line above the body - var line = makeSpan( - [options.style.reset(), Style.TEXT.cls(), "overline-line"]); - line.height = ruleWidth; - line.maxFontSize = 1.0; + var accentBody = _stretchy2.default.svgSpan(group, options); + var kern = /tilde/.test(group.value.label) ? 0.12 : 0; // Generate the vlist, with the appropriate kerns - var vlist = buildCommon.makeVList([ - {type: "elem", elem: innerGroup}, - {type: "kern", size: 3 * ruleWidth}, - {type: "elem", elem: line}, - {type: "kern", size: ruleWidth}, - ], "firstBaseline", null, options); + var vlist = _buildCommon2.default.makeVList({ + positionType: "bottom", + positionData: accentBody.height + kern, + children: [{ type: "elem", elem: accentBody }, { type: "kern", size: kern }, { type: "elem", elem: innerGroup }] + }, options); - return makeSpan(["overline", "mord"], [vlist], options.getColor()); -}; + vlist.children[0].children[0].children[0].classes.push("svg-align"); -groupTypes.underline = function(group, options, prev) { - // Underlines are handled in the TeXbook pg 443, Rule 10. + return makeSpan(["mord", "accentunder"], [vlist], options); +}; - // Build the inner group. - var innerGroup = buildGroup(group.value.body, options); +groupTypes.enclose = function (group, options) { + // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox + var inner = buildGroup(group.value.body, options); - var ruleWidth = fontMetrics.metrics.defaultRuleThickness / - options.style.sizeMultiplier; + var label = group.value.label.substr(1); + var scale = options.sizeMultiplier; + var img = void 0; + var imgShift = 0; + var isColorbox = /color/.test(label); - // Create the line above the body - var line = makeSpan( - [options.style.reset(), Style.TEXT.cls(), "underline-line"]); - line.height = ruleWidth; - line.maxFontSize = 1.0; + if (label === "sout") { + img = makeSpan(["stretchy", "sout"]); + img.height = options.fontMetrics().defaultRuleThickness / scale; + imgShift = -0.5 * options.fontMetrics().xHeight; + } else { + // Add horizontal padding + inner.classes.push(/cancel/.test(label) ? "cancel-pad" : "boxpad"); + + // Add vertical padding + var vertPad = 0; + // ref: LaTeX source2e: \fboxsep = 3pt; \fboxrule = .4pt + // ref: cancel package: \advance\totalheight2\p@ % "+2" + if (/box/.test(label)) { + vertPad = label === "colorbox" ? 0.3 : 0.34; + } else { + vertPad = isCharacterBox(group.value.body) ? 0.2 : 0; + } - // Generate the vlist, with the appropriate kerns - var vlist = buildCommon.makeVList([ - {type: "kern", size: ruleWidth}, - {type: "elem", elem: line}, - {type: "kern", size: 3 * ruleWidth}, - {type: "elem", elem: innerGroup}, - ], "top", innerGroup.height, options); + img = _stretchy2.default.encloseSpan(inner, label, vertPad, options); + imgShift = inner.depth + vertPad; - return makeSpan(["underline", "mord"], [vlist], options.getColor()); -}; + if (isColorbox) { + img.style.backgroundColor = group.value.backgroundColor.value; + if (label === "fcolorbox") { + img.style.borderColor = group.value.borderColor.value; + } + } + } -groupTypes.sqrt = function(group, options, prev) { - // Square roots are handled in the TeXbook pg. 443, Rule 11. + var vlist = void 0; + if (isColorbox) { + vlist = _buildCommon2.default.makeVList({ + positionType: "individualShift", + children: [ + // Put the color background behind inner; + { type: "elem", elem: img, shift: imgShift }, { type: "elem", elem: inner, shift: 0 }] + }, options); + } else { + vlist = _buildCommon2.default.makeVList({ + positionType: "individualShift", + children: [ + // Write the \cancel stroke on top of inner. + { type: "elem", elem: inner, shift: 0 }, { type: "elem", elem: img, shift: imgShift }] + }, options); + } - // First, we do the same steps as in overline to build the inner group - // and line - var inner = buildGroup(group.value.body, - options.withStyle(options.style.cramp())); + if (/cancel/.test(label)) { + vlist.children[0].children[0].children[1].classes.push("svg-align"); - var ruleWidth = fontMetrics.metrics.defaultRuleThickness / - options.style.sizeMultiplier; + // cancel does not create horiz space for its line extension. + // That is, not when adjacent to a mord. + return makeSpan(["mord", "cancel-lap"], [vlist], options); + } else { + return makeSpan(["mord"], [vlist], options); + } +}; - var line = makeSpan( - [options.style.reset(), Style.TEXT.cls(), "sqrt-line"], [], - options.getColor()); - line.height = ruleWidth; - line.maxFontSize = 1.0; +groupTypes.xArrow = function (group, options) { + var style = options.style; - var phi = ruleWidth; - if (options.style.id < Style.TEXT.id) { - phi = fontMetrics.metrics.xHeight; - } + // Build the argument groups in the appropriate style. + // Ref: amsmath.dtx: \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}% - // Calculate the clearance between the body and line - var lineClearance = ruleWidth + phi / 4; + var newOptions = options.havingStyle(style.sup()); + var upperGroup = buildGroup(group.value.body, newOptions, options); + upperGroup.classes.push("x-arrow-pad"); - var innerHeight = - (inner.height + inner.depth) * options.style.sizeMultiplier; - var minDelimiterHeight = innerHeight + lineClearance + ruleWidth; + var lowerGroup = void 0; + if (group.value.below) { + // Build the lower group + newOptions = options.havingStyle(style.sub()); + lowerGroup = buildGroup(group.value.below, newOptions, options); + lowerGroup.classes.push("x-arrow-pad"); + } - // Create a \surd delimiter of the required minimum size - var delim = makeSpan(["sqrt-sign"], [ - delimiter.customSizedDelim("\\surd", minDelimiterHeight, - false, options, group.mode)], - options.getColor()); + var arrowBody = _stretchy2.default.svgSpan(group, options); - var delimDepth = (delim.height + delim.depth) - ruleWidth; + // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0. + // The point we want on the math axis is at 0.5 * arrowBody.height. + var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; + // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi + var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; - // Adjust the clearance based on the delimiter size - if (delimDepth > inner.height + inner.depth + lineClearance) { - lineClearance = - (lineClearance + delimDepth - inner.height - inner.depth) / 2; - } - - // Shift the delimiter so that its top lines up with the top of the line - var delimShift = -(inner.height + lineClearance + ruleWidth) + delim.height; - delim.style.top = delimShift + "em"; - delim.height -= delimShift; - delim.depth += delimShift; - - // We add a special case here, because even when `inner` is empty, we - // still get a line. So, we use a simple heuristic to decide if we - // should omit the body entirely. (note this doesn't work for something - // like `\sqrt{\rlap{x}}`, but if someone is doing that they deserve for - // it not to work. - var body; - if (inner.height === 0 && inner.depth === 0) { - body = makeSpan(); + // Generate the vlist + var vlist = void 0; + if (group.value.below) { + var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111; + vlist = _buildCommon2.default.makeVList({ + positionType: "individualShift", + children: [{ type: "elem", elem: upperGroup, shift: upperShift }, { type: "elem", elem: arrowBody, shift: arrowShift }, { type: "elem", elem: lowerGroup, shift: lowerShift }] + }, options); } else { - body = buildCommon.makeVList([ - {type: "elem", elem: inner}, - {type: "kern", size: lineClearance}, - {type: "elem", elem: line}, - {type: "kern", size: ruleWidth}, - ], "firstBaseline", null, options); + vlist = _buildCommon2.default.makeVList({ + positionType: "individualShift", + children: [{ type: "elem", elem: upperGroup, shift: upperShift }, { type: "elem", elem: arrowBody, shift: arrowShift }] + }, options); } - if (!group.value.index) { - return makeSpan(["sqrt", "mord"], [delim, body]); - } else { - // Handle the optional root index - - // The index is always in scriptscript style - var root = buildGroup( - group.value.index, - options.withStyle(Style.SCRIPTSCRIPT)); - var rootWrap = makeSpan( - [options.style.reset(), Style.SCRIPTSCRIPT.cls()], - [root]); - - // Figure out the height and depth of the inner part - var innerRootHeight = Math.max(delim.height, body.height); - var innerRootDepth = Math.max(delim.depth, body.depth); + vlist.children[0].children[0].children[1].classes.push("svg-align"); - // The amount the index is shifted by. This is taken from the TeX - // source, in the definition of `\r@@t`. - var toShift = 0.6 * (innerRootHeight - innerRootDepth); + return makeSpan(["mrel", "x-arrow"], [vlist], options); +}; - // Build a VList with the superscript shifted up correctly - var rootVList = buildCommon.makeVList( - [{type: "elem", elem: rootWrap}], - "shift", -toShift, options); - // Add a class surrounding it so we can add on the appropriate - // kerning - var rootVListWrap = makeSpan(["root"], [rootVList]); +groupTypes.mclass = function (group, options) { + var elements = buildExpression(group.value.value, options, true); - return makeSpan(["sqrt", "mord"], [rootVListWrap, delim, body]); - } + return makeSpan([group.value.mclass], elements, options); }; -groupTypes.sizing = function(group, options, prev) { - // Handle sizing operators like \Huge. Real TeX doesn't actually allow - // these functions inside of math expressions, so we do some special - // handling. - var inner = buildExpression(group.value.value, - options.withSize(group.value.size), prev); +groupTypes.raisebox = function (group, options) { + var body = groupTypes.sizing({ value: { + value: [{ + type: "text", + value: { + body: group.value.value, + font: "mathrm" // simulate \textrm + } + }], + size: 6 // simulate \normalsize + } }, options); + var dy = (0, _units.calculateSize)(group.value.dy.value, options); + return _buildCommon2.default.makeVList({ + positionType: "shift", + positionData: -dy, + children: [{ type: "elem", elem: body }] + }, options); +}; - var span = makeSpan(["mord"], - [makeSpan(["sizing", "reset-" + options.size, group.value.size, - options.style.cls()], - inner)]); +/** + * buildGroup is the function that takes a group and calls the correct groupType + * function for it. It also handles the interaction of size and style changes + * between parents and children. + */ +var buildGroup = exports.buildGroup = function buildGroup(group, options, baseOptions) { + if (!group) { + return makeSpan(); + } - // Calculate the correct maxFontSize manually - var fontSize = buildCommon.sizingMultiplier[group.value.size]; - span.maxFontSize = fontSize * options.style.sizeMultiplier; + if (groupTypes[group.type]) { + // Call the groupTypes function + var groupNode = groupTypes[group.type](group, options); - return span; -}; + // If the size changed between the parent and the current group, account + // for that size difference. + if (baseOptions && options.size !== baseOptions.size) { + groupNode = makeSpan(options.sizingClasses(baseOptions), [groupNode], options); -groupTypes.styling = function(group, options, prev) { - // Style changes are handled in the TeXbook on pg. 442, Rule 3. + var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; - // Figure out what style we're changing to. - var style = { - "display": Style.DISPLAY, - "text": Style.TEXT, - "script": Style.SCRIPT, - "scriptscript": Style.SCRIPTSCRIPT, - }; + groupNode.height *= multiplier; + groupNode.depth *= multiplier; + } - var newStyle = style[group.value.style]; + return groupNode; + } else { + throw new _ParseError2.default("Got group of unknown type: '" + group.type + "'"); + } +}; - // Build the inner expression in the new style. - var inner = buildExpression( - group.value.value, options.withStyle(newStyle), prev); +/** + * Take an entire parse tree, and build it into an appropriate set of HTML + * nodes. + */ +function buildHTML(tree, options) { + // buildExpression is destructive, so we need to make a clone + // of the incoming tree so that it isn't accidentally changed + tree = JSON.parse((0, _stringify2.default)(tree)); - return makeSpan([options.style.reset(), newStyle.cls()], inner); -}; + // Build the expression contained in the tree + var expression = buildExpression(tree, options, true); + var body = makeSpan(["base"], expression, options); -groupTypes.font = function(group, options, prev) { - var font = group.value.font; - return buildGroup(group.value.body, options.withFont(font), prev); -}; + // Add struts, which ensure that the top of the HTML element falls at the + // height of the expression, and the bottom of the HTML element falls at the + // depth of the expression. + var topStrut = makeSpan(["strut"]); + var bottomStrut = makeSpan(["strut", "bottom"]); -groupTypes.delimsizing = function(group, options, prev) { - var delim = group.value.value; + topStrut.style.height = body.height + "em"; + bottomStrut.style.height = body.height + body.depth + "em"; + // We'd like to use `vertical-align: top` but in IE 9 this lowers the + // baseline of the box to the bottom of this strut (instead staying in the + // normal place) so we use an absolute value for vertical-align instead + bottomStrut.style.verticalAlign = -body.depth + "em"; - if (delim === ".") { - // Empty delimiters still count as elements, even though they don't - // show anything. - return makeSpan([groupToType[group.value.delimType]]); - } + // Wrap the struts and body together + var htmlNode = makeSpan(["katex-html"], [topStrut, bottomStrut, body]); - // Use delimiter.sizedDelim to generate the delimiter. - return makeSpan( - [groupToType[group.value.delimType]], - [delimiter.sizedDelim( - delim, group.value.size, options, group.mode)]); -}; + htmlNode.setAttribute("aria-hidden", "true"); -groupTypes.leftright = function(group, options, prev) { - // Build the inner expression - var inner = buildExpression(group.value.body, options.reset()); + return htmlNode; +} - var innerHeight = 0; - var innerDepth = 0; +},{"./ParseError":84,"./Style":89,"./buildCommon":91,"./delimiter":97,"./domTree":98,"./stretchy":123,"./units":127,"./utils":128,"babel-runtime/core-js/json/stringify":5}],93:[function(require,module,exports){ +"use strict"; - // Calculate its height and depth - for (var i = 0; i < inner.length; i++) { - innerHeight = Math.max(inner[i].height, innerHeight); - innerDepth = Math.max(inner[i].depth, innerDepth); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.buildGroup = exports.buildExpression = exports.groupTypes = exports.makeText = undefined; +exports.default = buildMathML; - // The size of delimiters is the same, regardless of what style we are - // in. Thus, to correctly calculate the size of delimiter we need around - // a group, we scale down the inner size based on the size. - innerHeight *= options.style.sizeMultiplier; - innerDepth *= options.style.sizeMultiplier; +var _buildCommon = require("./buildCommon"); - var leftDelim; - if (group.value.left === ".") { - // Empty delimiters in \left and \right make null delimiter spaces. - leftDelim = makeNullDelimiter(options); - } else { - // Otherwise, use leftRightDelim to generate the correct sized - // delimiter. - leftDelim = delimiter.leftRightDelim( - group.value.left, innerHeight, innerDepth, options, - group.mode); - } - // Add it to the beginning of the expression - inner.unshift(leftDelim); - - var rightDelim; - // Same for the right delimiter - if (group.value.right === ".") { - rightDelim = makeNullDelimiter(options); - } else { - rightDelim = delimiter.leftRightDelim( - group.value.right, innerHeight, innerDepth, options, - group.mode); - } - // Add it to the end of the expression. - inner.push(rightDelim); +var _buildCommon2 = _interopRequireDefault(_buildCommon); - return makeSpan( - ["minner", options.style.cls()], inner, options.getColor()); -}; +var _fontMetrics = require("./fontMetrics"); -groupTypes.rule = function(group, options, prev) { - // Make an empty span for the rule - var rule = makeSpan(["mord", "rule"], [], options.getColor()); +var _fontMetrics2 = _interopRequireDefault(_fontMetrics); - // Calculate the shift, width, and height of the rule, and account for units - var shift = 0; - if (group.value.shift) { - shift = group.value.shift.number; - if (group.value.shift.unit === "ex") { - shift *= fontMetrics.metrics.xHeight; - } - } +var _mathMLTree = require("./mathMLTree"); - var width = group.value.width.number; - if (group.value.width.unit === "ex") { - width *= fontMetrics.metrics.xHeight; - } +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - var height = group.value.height.number; - if (group.value.height.unit === "ex") { - height *= fontMetrics.metrics.xHeight; - } +var _ParseError = require("./ParseError"); - // The sizes of rules are absolute, so make it larger if we are in a - // smaller style. - shift /= options.style.sizeMultiplier; - width /= options.style.sizeMultiplier; - height /= options.style.sizeMultiplier; +var _ParseError2 = _interopRequireDefault(_ParseError); - // Style the rule to the right size - rule.style.borderRightWidth = width + "em"; - rule.style.borderTopWidth = height + "em"; - rule.style.bottom = shift + "em"; +var _Style = require("./Style"); - // Record the height and width - rule.width = width; - rule.height = height + shift; - rule.depth = -shift; +var _Style2 = _interopRequireDefault(_Style); - return rule; -}; +var _symbols = require("./symbols"); -groupTypes.kern = function(group, options, prev) { - // Make an empty span for the rule - var rule = makeSpan(["mord", "rule"], [], options.getColor()); +var _symbols2 = _interopRequireDefault(_symbols); - var dimension = 0; - if (group.value.dimension) { - dimension = group.value.dimension.number; - if (group.value.dimension.unit === "ex") { - dimension *= fontMetrics.metrics.xHeight; - } - } +var _utils = require("./utils"); - dimension /= options.style.sizeMultiplier; +var _utils2 = _interopRequireDefault(_utils); - rule.style.marginLeft = dimension + "em"; +var _stretchy = require("./stretchy"); - return rule; -}; +var _stretchy2 = _interopRequireDefault(_stretchy); -groupTypes.accent = function(group, options, prev) { - // Accents are handled in the TeXbook pg. 443, rule 12. - var base = group.value.base; - - var supsubGroup; - if (group.type === "supsub") { - // If our base is a character box, and we have superscripts and - // subscripts, the supsub will defer to us. In particular, we want - // to attach the superscripts and subscripts to the inner body (so - // that the position of the superscripts and subscripts won't be - // affected by the height of the accent). We accomplish this by - // sticking the base of the accent into the base of the supsub, and - // rendering that, while keeping track of where the accent is. - - // The supsub group is the group that was passed in - var supsub = group; - // The real accent group is the base of the supsub group - group = supsub.value.base; - // The character box is the base of the accent group - base = group.value.base; - // Stick the character box into the base of the supsub group - supsub.value.base = base; - - // Rerender the supsub group with its new base, and store that - // result. - supsubGroup = buildGroup( - supsub, options.reset(), prev); - } - - // Build the base group - var body = buildGroup( - base, options.withStyle(options.style.cramp())); - - // Calculate the skew of the accent. This is based on the line "If the - // nucleus is not a single character, let s = 0; otherwise set s to the - // kern amount for the nucleus followed by the \skewchar of its font." - // Note that our skew metrics are just the kern between each character - // and the skewchar. - var skew; - if (isCharacterBox(base)) { - // If the base is a character box, then we want the skew of the - // innermost character. To do that, we find the innermost character: - var baseChar = getBaseElem(base); - // Then, we render its group to get the symbol inside it - var baseGroup = buildGroup( - baseChar, options.withStyle(options.style.cramp())); - // Finally, we pull the skew off of the symbol. - skew = baseGroup.skew; - // Note that we now throw away baseGroup, because the layers we - // removed with getBaseElem might contain things like \color which - // we can't get rid of. - // TODO(emily): Find a better way to get the skew - } else { - skew = 0; - } - - // calculate the amount of space between the body and the accent - var clearance = Math.min(body.height, fontMetrics.metrics.xHeight); - - // Build the accent - var accent = buildCommon.makeSymbol( - group.value.accent, "Main-Regular", "math", options.getColor()); - // Remove the italic correction of the accent, because it only serves to - // shift the accent over to a place we don't want. - accent.italic = 0; - - // The \vec character that the fonts use is a combining character, and - // thus shows up much too far to the left. To account for this, we add a - // specific class which shifts the accent over to where we want it. - // TODO(emily): Fix this in a better way, like by changing the font - var vecClass = group.value.accent === "\\vec" ? "accent-vec" : null; - - var accentBody = makeSpan(["accent-body", vecClass], [ - makeSpan([], [accent])]); - - accentBody = buildCommon.makeVList([ - {type: "elem", elem: body}, - {type: "kern", size: -clearance}, - {type: "elem", elem: accentBody}, - ], "firstBaseline", null, options); - - // Shift the accent over by the skew. Note we shift by twice the skew - // because we are centering the accent, so by adding 2*skew to the left, - // we shift it to the right by 1*skew. - accentBody.children[1].style.marginLeft = 2 * skew + "em"; - - var accentWrap = makeSpan(["mord", "accent"], [accentBody]); - - if (supsubGroup) { - // Here, we replace the "base" child of the supsub with our newly - // generated accent. - supsubGroup.children[0] = accentWrap; - - // Since we don't rerun the height calculation after replacing the - // accent, we manually recalculate height. - supsubGroup.height = Math.max(accentWrap.height, supsubGroup.height); - - // Accents should always be ords, even when their innards are not. - supsubGroup.classes[0] = "mord"; - - return supsubGroup; - } else { - return accentWrap; - } -}; - -groupTypes.phantom = function(group, options, prev) { - var elements = buildExpression( - group.value.value, - options.withPhantom(), - prev - ); - - // \phantom isn't supposed to affect the elements it contains. - // See "color" for more details. - return new buildCommon.makeFragment(elements); -}; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** - * buildGroup is the function that takes a group and calls the correct groupType - * function for it. It also handles the interaction of size and style changes - * between parents and children. - */ -var buildGroup = function(group, options, prev) { - if (!group) { - return makeSpan(); - } - - if (groupTypes[group.type]) { - // Call the groupTypes function - var groupNode = groupTypes[group.type](group, options, prev); - var multiplier; - - // If the style changed between the parent and the current group, - // account for the size difference - if (options.style !== options.parentStyle) { - multiplier = options.style.sizeMultiplier / - options.parentStyle.sizeMultiplier; - - groupNode.height *= multiplier; - groupNode.depth *= multiplier; - } - - // If the size changed between the parent and the current group, account - // for that size difference. - if (options.size !== options.parentSize) { - multiplier = buildCommon.sizingMultiplier[options.size] / - buildCommon.sizingMultiplier[options.parentSize]; - - groupNode.height *= multiplier; - groupNode.depth *= multiplier; - } - - return groupNode; - } else { - throw new ParseError( - "Got group of unknown type: '" + group.type + "'"); - } -}; - -/** - * Take an entire parse tree, and build it into an appropriate set of HTML - * nodes. + * Takes a symbol and converts it into a MathML text node after performing + * optional replacement from symbols.js. */ -var buildHTML = function(tree, options) { - // buildExpression is destructive, so we need to make a clone - // of the incoming tree so that it isn't accidentally changed - tree = JSON.parse(JSON.stringify(tree)); - - // Build the expression contained in the tree - var expression = buildExpression(tree, options); - var body = makeSpan(["base", options.style.cls()], expression); - - // Add struts, which ensure that the top of the HTML element falls at the - // height of the expression, and the bottom of the HTML element falls at the - // depth of the expression. - var topStrut = makeSpan(["strut"]); - var bottomStrut = makeSpan(["strut", "bottom"]); - - topStrut.style.height = body.height + "em"; - bottomStrut.style.height = (body.height + body.depth) + "em"; - // We'd like to use `vertical-align: top` but in IE 9 this lowers the - // baseline of the box to the bottom of this strut (instead staying in the - // normal place) so we use an absolute value for vertical-align instead - bottomStrut.style.verticalAlign = -body.depth + "em"; - - // Wrap the struts and body together - var htmlNode = makeSpan(["katex-html"], [topStrut, bottomStrut, body]); - - htmlNode.setAttribute("aria-hidden", "true"); - - return htmlNode; -}; - -module.exports = buildHTML; - -},{"./ParseError":6,"./Style":9,"./buildCommon":10,"./delimiter":14,"./domTree":15,"./fontMetrics":17,"./utils":25}],12:[function(require,module,exports){ /** + * WARNING: New methods on groupTypes should be added to src/functions. + * * This file converts a parse tree into a cooresponding MathML tree. The main * entry point is the `buildMathML` function, which takes a parse tree from the * parser. */ -var buildCommon = require("./buildCommon"); -var fontMetrics = require("./fontMetrics"); -var mathMLTree = require("./mathMLTree"); -var ParseError = require("./ParseError"); -var symbols = require("./symbols"); -var utils = require("./utils"); - -var makeSpan = buildCommon.makeSpan; -var fontMap = buildCommon.fontMap; - -/** - * Takes a symbol and converts it into a MathML text node after performing - * optional replacement from symbols.js. - */ -var makeText = function(text, mode) { - if (symbols[mode][text] && symbols[mode][text].replace) { - text = symbols[mode][text].replace; +var makeText = exports.makeText = function makeText(text, mode) { + if (_symbols2.default[mode][text] && _symbols2.default[mode][text].replace) { + text = _symbols2.default[mode][text].replace; } - return new mathMLTree.TextNode(text); + return new _mathMLTree2.default.TextNode(text); }; /** * Returns the math variant as a string or null if none is required. */ -var getVariant = function(group, options) { +var getVariant = function getVariant(group, options) { var font = options.font; if (!font) { return null; @@ -3495,17 +5428,17 @@ var getVariant = function(group, options) { } var value = group.value; - if (utils.contains(["\\imath", "\\jmath"], value)) { + if (_utils2.default.contains(["\\imath", "\\jmath"], value)) { return null; } - if (symbols[mode][value] && symbols[mode][value].replace) { - value = symbols[mode][value].replace; + if (_symbols2.default[mode][value] && _symbols2.default[mode][value].replace) { + value = _symbols2.default[mode][value].replace; } - var fontName = fontMap[font].fontName; - if (fontMetrics.getCharacterMetrics(value, fontName)) { - return fontMap[options.font].variant; + var fontName = _buildCommon2.default.fontMap[font].fontName; + if (_fontMetrics2.default.getCharacterMetrics(value, fontName)) { + return _buildCommon2.default.fontMap[options.font].variant; } return null; @@ -3515,327 +5448,209 @@ var getVariant = function(group, options) { * Functions for handling the different types of groups found in the parse * tree. Each function should take a parse group and return a MathML node. */ -var groupTypes = {}; +var groupTypes = exports.groupTypes = {}; + +var defaultVariant = { + "mi": "italic", + "mn": "normal", + "mtext": "normal" +}; -groupTypes.mathord = function(group, options) { - var node = new mathMLTree.MathNode( - "mi", - [makeText(group.value, group.mode)]); +groupTypes.mathord = function (group, options) { + var node = new _mathMLTree2.default.MathNode("mi", [makeText(group.value, group.mode)]); - var variant = getVariant(group, options); - if (variant) { + var variant = getVariant(group, options) || "italic"; + if (variant !== defaultVariant[node.type]) { node.setAttribute("mathvariant", variant); } return node; }; -groupTypes.textord = function(group, options) { +groupTypes.textord = function (group, options) { var text = makeText(group.value, group.mode); var variant = getVariant(group, options) || "normal"; - var node; - if (/[0-9]/.test(group.value)) { + var node = void 0; + if (group.mode === 'text') { + node = new _mathMLTree2.default.MathNode("mtext", [text]); + } else if (/[0-9]/.test(group.value)) { // TODO(kevinb) merge adjacent nodes // do it as a post processing step - node = new mathMLTree.MathNode("mn", [text]); - if (options.font) { - node.setAttribute("mathvariant", variant); - } + node = new _mathMLTree2.default.MathNode("mn", [text]); + } else if (group.value === "\\prime") { + node = new _mathMLTree2.default.MathNode("mo", [text]); } else { - node = new mathMLTree.MathNode("mi", [text]); + node = new _mathMLTree2.default.MathNode("mi", [text]); + } + if (variant !== defaultVariant[node.type]) { node.setAttribute("mathvariant", variant); } return node; }; -groupTypes.bin = function(group) { - var node = new mathMLTree.MathNode( - "mo", [makeText(group.value, group.mode)]); +groupTypes.bin = function (group) { + var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]); return node; }; -groupTypes.rel = function(group) { - var node = new mathMLTree.MathNode( - "mo", [makeText(group.value, group.mode)]); +groupTypes.rel = function (group) { + var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]); return node; }; -groupTypes.open = function(group) { - var node = new mathMLTree.MathNode( - "mo", [makeText(group.value, group.mode)]); +groupTypes.open = function (group) { + var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]); return node; }; -groupTypes.close = function(group) { - var node = new mathMLTree.MathNode( - "mo", [makeText(group.value, group.mode)]); +groupTypes.close = function (group) { + var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]); return node; }; -groupTypes.inner = function(group) { - var node = new mathMLTree.MathNode( - "mo", [makeText(group.value, group.mode)]); +groupTypes.inner = function (group) { + var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]); return node; }; -groupTypes.punct = function(group) { - var node = new mathMLTree.MathNode( - "mo", [makeText(group.value, group.mode)]); +groupTypes.punct = function (group) { + var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]); node.setAttribute("separator", "true"); return node; }; -groupTypes.ordgroup = function(group, options) { +groupTypes.ordgroup = function (group, options) { var inner = buildExpression(group.value, options); - var node = new mathMLTree.MathNode("mrow", inner); - - return node; -}; - -groupTypes.text = function(group, options) { - var inner = buildExpression(group.value.body, options); - - var node = new mathMLTree.MathNode("mtext", inner); + var node = new _mathMLTree2.default.MathNode("mrow", inner); return node; }; -groupTypes.color = function(group, options) { - var inner = buildExpression(group.value.value, options); - - var node = new mathMLTree.MathNode("mstyle", inner); - - node.setAttribute("mathcolor", group.value.color); - - return node; -}; +groupTypes.supsub = function (group, options) { + // Is the inner group a relevant horizonal brace? + var isBrace = false; + var isOver = void 0; + var isSup = void 0; + if (group.value.base) { + if (group.value.base.value.type === "horizBrace") { + isSup = group.value.sup ? true : false; + if (isSup === group.value.base.value.isOver) { + isBrace = true; + isOver = group.value.base.value.isOver; + } + } + } -groupTypes.supsub = function(group, options) { - var children = [buildGroup(group.value.base, options)]; + var removeUnnecessaryRow = true; + var children = [buildGroup(group.value.base, options, removeUnnecessaryRow)]; if (group.value.sub) { - children.push(buildGroup(group.value.sub, options)); + children.push(buildGroup(group.value.sub, options, removeUnnecessaryRow)); } if (group.value.sup) { - children.push(buildGroup(group.value.sup, options)); + children.push(buildGroup(group.value.sup, options, removeUnnecessaryRow)); } - var nodeType; - if (!group.value.sub) { + var nodeType = void 0; + if (isBrace) { + nodeType = isOver ? "mover" : "munder"; + } else if (!group.value.sub) { nodeType = "msup"; } else if (!group.value.sup) { nodeType = "msub"; } else { - nodeType = "msubsup"; - } - - var node = new mathMLTree.MathNode(nodeType, children); - - return node; -}; - -groupTypes.genfrac = function(group, options) { - var node = new mathMLTree.MathNode( - "mfrac", - [buildGroup(group.value.numer, options), - buildGroup(group.value.denom, options)]); - - if (!group.value.hasBarLine) { - node.setAttribute("linethickness", "0px"); - } - - if (group.value.leftDelim != null || group.value.rightDelim != null) { - var withDelims = []; - - if (group.value.leftDelim != null) { - var leftOp = new mathMLTree.MathNode( - "mo", [new mathMLTree.TextNode(group.value.leftDelim)]); - - leftOp.setAttribute("fence", "true"); - - withDelims.push(leftOp); - } - - withDelims.push(node); - - if (group.value.rightDelim != null) { - var rightOp = new mathMLTree.MathNode( - "mo", [new mathMLTree.TextNode(group.value.rightDelim)]); - - rightOp.setAttribute("fence", "true"); - - withDelims.push(rightOp); + var base = group.value.base; + if (base && base.value.limits && options.style === _Style2.default.DISPLAY) { + nodeType = "munderover"; + } else { + nodeType = "msubsup"; } - - var outerNode = new mathMLTree.MathNode("mrow", withDelims); - - return outerNode; } - return node; -}; + var node = new _mathMLTree2.default.MathNode(nodeType, children); -groupTypes.array = function(group, options) { - return new mathMLTree.MathNode( - "mtable", group.value.body.map(function(row) { - return new mathMLTree.MathNode( - "mtr", row.map(function(cell) { - return new mathMLTree.MathNode( - "mtd", [buildGroup(cell, options)]); - })); - })); + return node; }; -groupTypes.sqrt = function(group, options) { - var node; +groupTypes.sqrt = function (group, options) { + var node = void 0; if (group.value.index) { - node = new mathMLTree.MathNode( - "mroot", [ - buildGroup(group.value.body, options), - buildGroup(group.value.index, options), - ]); + node = new _mathMLTree2.default.MathNode("mroot", [buildGroup(group.value.body, options), buildGroup(group.value.index, options)]); } else { - node = new mathMLTree.MathNode( - "msqrt", [buildGroup(group.value.body, options)]); + node = new _mathMLTree2.default.MathNode("msqrt", [buildGroup(group.value.body, options)]); } return node; }; -groupTypes.leftright = function(group, options) { - var inner = buildExpression(group.value.body, options); - - if (group.value.left !== ".") { - var leftNode = new mathMLTree.MathNode( - "mo", [makeText(group.value.left, group.mode)]); - - leftNode.setAttribute("fence", "true"); - - inner.unshift(leftNode); - } - - if (group.value.right !== ".") { - var rightNode = new mathMLTree.MathNode( - "mo", [makeText(group.value.right, group.mode)]); - - rightNode.setAttribute("fence", "true"); - - inner.push(rightNode); +groupTypes.accent = function (group, options) { + var accentNode = void 0; + if (group.value.isStretchy) { + accentNode = _stretchy2.default.mathMLnode(group.value.label); + } else { + accentNode = new _mathMLTree2.default.MathNode("mo", [makeText(group.value.label, group.mode)]); } - var outerNode = new mathMLTree.MathNode("mrow", inner); - - return outerNode; -}; - -groupTypes.accent = function(group, options) { - var accentNode = new mathMLTree.MathNode( - "mo", [makeText(group.value.accent, group.mode)]); - - var node = new mathMLTree.MathNode( - "mover", - [buildGroup(group.value.base, options), - accentNode]); + var node = new _mathMLTree2.default.MathNode("mover", [buildGroup(group.value.base, options), accentNode]); node.setAttribute("accent", "true"); return node; }; -groupTypes.spacing = function(group) { - var node; +groupTypes.spacing = function (group) { + var node = void 0; - if (group.value === "\\ " || group.value === "\\space" || - group.value === " " || group.value === "~") { - node = new mathMLTree.MathNode( - "mtext", [new mathMLTree.TextNode("\u00a0")]); + if (group.value === "\\ " || group.value === "\\space" || group.value === " " || group.value === "~") { + node = new _mathMLTree2.default.MathNode("mtext", [new _mathMLTree2.default.TextNode("\xA0")]); } else { - node = new mathMLTree.MathNode("mspace"); - - node.setAttribute( - "width", buildCommon.spacingFunctions[group.value].size); - } - - return node; -}; - -groupTypes.op = function(group) { - var node; - - // TODO(emily): handle big operators using the `largeop` attribute + node = new _mathMLTree2.default.MathNode("mspace"); - if (group.value.symbol) { - // This is a symbol. Just add the symbol. - node = new mathMLTree.MathNode( - "mo", [makeText(group.value.body, group.mode)]); - } else { - // This is a text operator. Add all of the characters from the - // operator's name. - // TODO(emily): Add a space in the middle of some of these - // operators, like \limsup. - node = new mathMLTree.MathNode( - "mi", [new mathMLTree.TextNode(group.value.body.slice(1))]); + node.setAttribute("width", _buildCommon2.default.spacingFunctions[group.value].size); } return node; }; -groupTypes.katex = function(group) { - var node = new mathMLTree.MathNode( - "mtext", [new mathMLTree.TextNode("KaTeX")]); - - return node; -}; - -groupTypes.font = function(group, options) { +groupTypes.font = function (group, options) { var font = group.value.font; return buildGroup(group.value.body, options.withFont(font)); }; -groupTypes.delimsizing = function(group) { - var children = []; - - if (group.value.value !== ".") { - children.push(makeText(group.value.value, group.mode)); - } - - var node = new mathMLTree.MathNode("mo", children); - - if (group.value.delimType === "open" || - group.value.delimType === "close") { - // Only some of the delimsizing functions act as fences, and they - // return "open" or "close" delimTypes. - node.setAttribute("fence", "true"); - } else { - // Explicitly disable fencing if it's not a fence, to override the - // defaults. - node.setAttribute("fence", "false"); - } +groupTypes.styling = function (group, options) { + // Figure out what style we're changing to. + // TODO(kevinb): dedupe this with buildHTML.js + // This will be easier of handling of styling nodes is in the same file. + var styleMap = { + "display": _Style2.default.DISPLAY, + "text": _Style2.default.TEXT, + "script": _Style2.default.SCRIPT, + "scriptscript": _Style2.default.SCRIPTSCRIPT + }; - return node; -}; + var newStyle = styleMap[group.value.style]; + var newOptions = options.havingStyle(newStyle); -groupTypes.styling = function(group, options) { - var inner = buildExpression(group.value.value, options); + var inner = buildExpression(group.value.value, newOptions); - var node = new mathMLTree.MathNode("mstyle", inner); + var node = new _mathMLTree2.default.MathNode("mstyle", inner); var styleAttributes = { "display": ["0", "true"], "text": ["0", "false"], "script": ["1", "false"], - "scriptscript": ["2", "false"], + "scriptscript": ["2", "false"] }; var attr = styleAttributes[group.value.style]; @@ -3846,87 +5661,103 @@ groupTypes.styling = function(group, options) { return node; }; -groupTypes.sizing = function(group, options) { - var inner = buildExpression(group.value.value, options); +groupTypes.sizing = function (group, options) { + var newOptions = options.havingSize(group.value.size); + var inner = buildExpression(group.value.value, newOptions); - var node = new mathMLTree.MathNode("mstyle", inner); + var node = new _mathMLTree2.default.MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size // changes, because we don't keep state of what style we're currently // in, so we can't reset the size to normal before changing it. Now // that we're passing an options parameter we should be able to fix // this. - node.setAttribute( - "mathsize", buildCommon.sizingMultiplier[group.value.size] + "em"); + node.setAttribute("mathsize", newOptions.sizeMultiplier + "em"); return node; }; -groupTypes.overline = function(group, options) { - var operator = new mathMLTree.MathNode( - "mo", [new mathMLTree.TextNode("\u203e")]); - operator.setAttribute("stretchy", "true"); - - var node = new mathMLTree.MathNode( - "mover", - [buildGroup(group.value.body, options), - operator]); - node.setAttribute("accent", "true"); - +groupTypes.verb = function (group, options) { + var text = new _mathMLTree2.default.TextNode(_buildCommon2.default.makeVerb(group, options)); + var node = new _mathMLTree2.default.MathNode("mtext", [text]); + node.setAttribute("mathvariant", _buildCommon2.default.fontMap["mathtt"].variant); return node; }; -groupTypes.underline = function(group, options) { - var operator = new mathMLTree.MathNode( - "mo", [new mathMLTree.TextNode("\u203e")]); - operator.setAttribute("stretchy", "true"); - - var node = new mathMLTree.MathNode( - "munder", - [buildGroup(group.value.body, options), - operator]); +groupTypes.accentUnder = function (group, options) { + var accentNode = _stretchy2.default.mathMLnode(group.value.label); + var node = new _mathMLTree2.default.MathNode("munder", [buildGroup(group.value.body, options), accentNode]); node.setAttribute("accentunder", "true"); - return node; }; -groupTypes.rule = function(group) { - // TODO(emily): Figure out if there's an actual way to draw black boxes - // in MathML. - var node = new mathMLTree.MathNode("mrow"); - +groupTypes.enclose = function (group, options) { + var node = new _mathMLTree2.default.MathNode("menclose", [buildGroup(group.value.body, options)]); + switch (group.value.label) { + case "\\cancel": + node.setAttribute("notation", "updiagonalstrike"); + break; + case "\\bcancel": + node.setAttribute("notation", "downdiagonalstrike"); + break; + case "\\sout": + node.setAttribute("notation", "horizontalstrike"); + break; + case "\\fbox": + node.setAttribute("notation", "box"); + break; + case "\\colorbox": + node.setAttribute("mathbackground", group.value.backgroundColor.value); + break; + case "\\fcolorbox": + node.setAttribute("mathbackground", group.value.backgroundColor.value); + // TODO(ron): I don't know any way to set the border color. + node.setAttribute("notation", "box"); + break; + default: + // xcancel + node.setAttribute("notation", "updiagonalstrike downdiagonalstrike"); + } return node; }; -groupTypes.kern = function(group) { - // TODO(kevin): Figure out if there's a way to add space in MathML - var node = new mathMLTree.MathNode("mrow"); - - return node; +groupTypes.horizBrace = function (group, options) { + var accentNode = _stretchy2.default.mathMLnode(group.value.label); + return new _mathMLTree2.default.MathNode(group.value.isOver ? "mover" : "munder", [buildGroup(group.value.base, options), accentNode]); }; -groupTypes.llap = function(group, options) { - var node = new mathMLTree.MathNode( - "mpadded", [buildGroup(group.value.body, options)]); - - node.setAttribute("lspace", "-1width"); - node.setAttribute("width", "0px"); +groupTypes.xArrow = function (group, options) { + var arrowNode = _stretchy2.default.mathMLnode(group.value.label); + var node = void 0; + var lowerNode = void 0; + if (group.value.body) { + var upperNode = buildGroup(group.value.body, options); + if (group.value.below) { + lowerNode = buildGroup(group.value.below, options); + node = new _mathMLTree2.default.MathNode("munderover", [arrowNode, lowerNode, upperNode]); + } else { + node = new _mathMLTree2.default.MathNode("mover", [arrowNode, upperNode]); + } + } else if (group.value.below) { + lowerNode = buildGroup(group.value.below, options); + node = new _mathMLTree2.default.MathNode("munder", [arrowNode, lowerNode]); + } else { + node = new _mathMLTree2.default.MathNode("mover", [arrowNode]); + } return node; }; -groupTypes.rlap = function(group, options) { - var node = new mathMLTree.MathNode( - "mpadded", [buildGroup(group.value.body, options)]); - - node.setAttribute("width", "0px"); - - return node; +groupTypes.mclass = function (group, options) { + var inner = buildExpression(group.value.value, options); + return new _mathMLTree2.default.MathNode("mstyle", inner); }; -groupTypes.phantom = function(group, options, prev) { - var inner = buildExpression(group.value.value, options); - return new mathMLTree.MathNode("mphantom", inner); +groupTypes.raisebox = function (group, options) { + var node = new _mathMLTree2.default.MathNode("mpadded", [buildGroup(group.value.body, options)]); + var dy = group.value.dy.value.number + group.value.dy.value.unit; + node.setAttribute("voffset", dy); + return node; }; /** @@ -3934,12 +5765,15 @@ groupTypes.phantom = function(group, options, prev) { * MathML nodes. A little simpler than the HTML version because we don't do any * previous-node handling. */ -var buildExpression = function(expression, options) { +var buildExpression = exports.buildExpression = function buildExpression(expression, options) { var groups = []; for (var i = 0; i < expression.length; i++) { var group = expression[i]; groups.push(buildGroup(group, options)); } + + // TODO(kevinb): combine \\not with mrels and mords + return groups; }; @@ -3947,17 +5781,24 @@ var buildExpression = function(expression, options) { * Takes a group from the parser and calls the appropriate groupTypes function * on it to produce a MathML node. */ -var buildGroup = function(group, options) { +var buildGroup = exports.buildGroup = function buildGroup(group, options) { + var removeUnnecessaryRow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + if (!group) { - return new mathMLTree.MathNode("mrow"); + return new _mathMLTree2.default.MathNode("mrow"); } if (groupTypes[group.type]) { // Call the groupTypes function - return groupTypes[group.type](group, options); + var result = groupTypes[group.type](group, options); + if (removeUnnecessaryRow) { + if (result.type === "mrow" && result.children.length === 1) { + return result.children[0]; + } + } + return result; } else { - throw new ParseError( - "Got group of unknown type: '" + group.type + "'"); + throw new _ParseError2.default("Got group of unknown type: '" + group.type + "'"); } }; @@ -3969,73 +5810,309 @@ var buildGroup = function(group, options) { * Note that we actually return a domTree element with a `` inside it so * we can do appropriate styling. */ -var buildMathML = function(tree, texExpression, options) { +function buildMathML(tree, texExpression, options) { var expression = buildExpression(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics // tag correctly. - var wrapper = new mathMLTree.MathNode("mrow", expression); + var wrapper = new _mathMLTree2.default.MathNode("mrow", expression); // Build a TeX annotation of the source - var annotation = new mathMLTree.MathNode( - "annotation", [new mathMLTree.TextNode(texExpression)]); + var annotation = new _mathMLTree2.default.MathNode("annotation", [new _mathMLTree2.default.TextNode(texExpression)]); annotation.setAttribute("encoding", "application/x-tex"); - var semantics = new mathMLTree.MathNode( - "semantics", [wrapper, annotation]); + var semantics = new _mathMLTree2.default.MathNode("semantics", [wrapper, annotation]); - var math = new mathMLTree.MathNode("math", [semantics]); + var math = new _mathMLTree2.default.MathNode("math", [semantics]); // You can't style nodes, so we wrap the node in a span. - return makeSpan(["katex-mathml"], [math]); -}; + return _buildCommon2.default.makeSpan(["katex-mathml"], [math]); +} -module.exports = buildMathML; +},{"./ParseError":84,"./Style":89,"./buildCommon":91,"./fontMetrics":101,"./mathMLTree":121,"./stretchy":123,"./symbols":125,"./utils":128}],94:[function(require,module,exports){ +"use strict"; -},{"./ParseError":6,"./buildCommon":10,"./fontMetrics":17,"./mathMLTree":20,"./symbols":23,"./utils":25}],13:[function(require,module,exports){ -var buildHTML = require("./buildHTML"); -var buildMathML = require("./buildMathML"); -var buildCommon = require("./buildCommon"); -var Options = require("./Options"); -var Settings = require("./Settings"); -var Style = require("./Style"); +Object.defineProperty(exports, "__esModule", { + value: true +}); -var makeSpan = buildCommon.makeSpan; +var _buildHTML = require("./buildHTML"); -var buildTree = function(tree, expression, settings) { - settings = settings || new Settings({}); +var _buildHTML2 = _interopRequireDefault(_buildHTML); - var startStyle = Style.TEXT; +var _buildMathML = require("./buildMathML"); + +var _buildMathML2 = _interopRequireDefault(_buildMathML); + +var _buildCommon = require("./buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _Options = require("./Options"); + +var _Options2 = _interopRequireDefault(_Options); + +var _Settings = require("./Settings"); + +var _Settings2 = _interopRequireDefault(_Settings); + +var _Style = require("./Style"); + +var _Style2 = _interopRequireDefault(_Style); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var buildTree = function buildTree(tree, expression, settings) { + settings = settings || new _Settings2.default({}); + + var startStyle = _Style2.default.TEXT; if (settings.displayMode) { - startStyle = Style.DISPLAY; + startStyle = _Style2.default.DISPLAY; } // Setup the default options - var options = new Options({ + var options = new _Options2.default({ style: startStyle, - size: "size5", + maxSize: settings.maxSize }); // `buildHTML` sometimes messes with the parse tree (like turning bins -> // ords), so we build the MathML version first. - var mathMLNode = buildMathML(tree, expression, options); - var htmlNode = buildHTML(tree, options); + var mathMLNode = (0, _buildMathML2.default)(tree, expression, options); + var htmlNode = (0, _buildHTML2.default)(tree, options); - var katexNode = makeSpan(["katex"], [ - mathMLNode, htmlNode, - ]); + var katexNode = _buildCommon2.default.makeSpan(["katex"], [mathMLNode, htmlNode]); if (settings.displayMode) { - return makeSpan(["katex-display"], [katexNode]); + return _buildCommon2.default.makeSpan(["katex-display"], [katexNode]); } else { return katexNode; } }; -module.exports = buildTree; +exports.default = buildTree; + +},{"./Options":83,"./Settings":87,"./Style":89,"./buildCommon":91,"./buildHTML":92,"./buildMathML":93}],95:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports._environments = undefined; +exports.default = defineEnvironment; + +var _buildHTML = require("./buildHTML"); + +var _buildMathML = require("./buildMathML"); + +var _Options = require("./Options"); + +var _Options2 = _interopRequireDefault(_Options); + +var _ParseNode = require("./ParseNode"); + +var _ParseNode2 = _interopRequireDefault(_ParseNode); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * All registered environments. + * `environments.js` exports this same dictionary again and makes it public. + * `Parser.js` requires this dictionary via `environments.js`. + */ + + +/** + * The context contains the following properties: + * - mode: current parsing mode. + * - envName: the name of the environment, one of the listed names. + * - parser: the parser object. + */ + + +/** + * - context: information and references provided by the parser + * - args: an array of arguments passed to \begin{name} + * - optArgs: an array of optional arguments passed to \begin{name} + */ + + +/** + * - numArgs: (default 0) The number of arguments after the \begin{name} function. + * - argTypes: (optional) Just like for a function + * - allowedInText: (default false) Whether or not the environment is allowed + * inside text mode (not enforced yet). + * - numOptionalArgs: (default 0) Just like for a function + */ + + +/** + * Final enviornment spec for use at parse time. + * This is almost identical to `EnvDefSpec`, except it + * 1. includes the function handler + * 2. requires all arguments except argType + * It is generated by `defineEnvironment()` below. + */ +var _environments = exports._environments = {}; + +function defineEnvironment(_ref) { + var type = _ref.type, + names = _ref.names, + props = _ref.props, + handler = _ref.handler, + htmlBuilder = _ref.htmlBuilder, + mathmlBuilder = _ref.mathmlBuilder; + + // Set default values of environments + var data = { + numArgs: props.numArgs || 0, + greediness: 1, + allowedInText: false, + numOptionalArgs: 0, + handler: handler + }; + for (var i = 0; i < names.length; ++i) { + _environments[names[i]] = data; + } + if (htmlBuilder) { + _buildHTML.groupTypes[type] = htmlBuilder; + } + if (mathmlBuilder) { + _buildMathML.groupTypes[type] = mathmlBuilder; + } +} + +},{"./Options":83,"./ParseNode":85,"./buildHTML":92,"./buildMathML":93}],96:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.ordargument = exports._functions = undefined; +exports.default = defineFunction; + +var _buildHTML = require("./buildHTML"); + +var _buildMathML = require("./buildMathML"); + +/** + * All registered functions. + * `functions.js` just exports this same dictionary again and makes it public. + * `Parser.js` requires this dictionary. + */ + + +/** Context provided to function handlers for error messages. */ + + +// TODO: Enumerate all allowed output types. + + +/** + * Final function spec for use at parse time. + * This is almost identical to `FunctionPropSpec`, except it + * 1. includes the function handler, and + * 2. requires all arguments except argTypes. + * It is generated by `defineFunction()` below. + */ +var _functions = exports._functions = {}; + +function defineFunction(_ref) { + var type = _ref.type, + names = _ref.names, + props = _ref.props, + handler = _ref.handler, + htmlBuilder = _ref.htmlBuilder, + mathmlBuilder = _ref.mathmlBuilder; + + // Set default values of functions + var data = { + numArgs: props.numArgs, + argTypes: props.argTypes, + greediness: props.greediness === undefined ? 1 : props.greediness, + allowedInText: !!props.allowedInText, + allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath, + numOptionalArgs: props.numOptionalArgs || 0, + infix: !!props.infix, + handler: handler + }; + for (var i = 0; i < names.length; ++i) { + _functions[names[i]] = data; + } + if (type) { + if (htmlBuilder) { + _buildHTML.groupTypes[type] = htmlBuilder; + } + if (mathmlBuilder) { + _buildMathML.groupTypes[type] = mathmlBuilder; + } + } +} + +// Since the corresponding buildHTML/buildMathML function expects a +// list of elements, we normalize for different kinds of arguments +var ordargument = exports.ordargument = function ordargument(arg) { + if (arg.type === "ordgroup") { + return arg.value; + } else { + return [arg]; + } +}; + +},{"./buildHTML":92,"./buildMathML":93}],97:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _ParseError = require("./ParseError"); + +var _ParseError2 = _interopRequireDefault(_ParseError); + +var _Style = require("./Style"); + +var _Style2 = _interopRequireDefault(_Style); + +var _domTree = require("./domTree"); + +var _domTree2 = _interopRequireDefault(_domTree); + +var _buildCommon = require("./buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _fontMetrics = require("./fontMetrics"); + +var _fontMetrics2 = _interopRequireDefault(_fontMetrics); + +var _symbols = require("./symbols"); + +var _symbols2 = _interopRequireDefault(_symbols); -},{"./Options":5,"./Settings":8,"./Style":9,"./buildCommon":10,"./buildHTML":11,"./buildMathML":12}],14:[function(require,module,exports){ +var _utils = require("./utils"); + +var _utils2 = _interopRequireDefault(_utils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Get the metrics for a given symbol and font, after transformation (i.e. + * after following replacement from symbols.js) + */ +var getMetrics = function getMetrics(symbol, font) { + if (_symbols2.default.math[symbol] && _symbols2.default.math[symbol].replace) { + return _fontMetrics2.default.getCharacterMetrics(_symbols2.default.math[symbol].replace, font); + } else { + return _fontMetrics2.default.getCharacterMetrics(symbol, font); + } +}; + +/** + * Puts a delimiter span in a given style, and adds appropriate height, depth, + * and maxFontSizes. + */ /** * This file deals with creating delimiters of various sizes. The TeXbook * discusses these routines on page 441-442, in the "Another subroutine sets box @@ -4058,52 +6135,27 @@ module.exports = buildTree; * used in `\left` and `\right`. */ -var ParseError = require("./ParseError"); -var Style = require("./Style"); - -var buildCommon = require("./buildCommon"); -var fontMetrics = require("./fontMetrics"); -var symbols = require("./symbols"); -var utils = require("./utils"); +var styleWrap = function styleWrap(delim, toStyle, options, classes) { + var newOptions = options.havingBaseStyle(toStyle); -var makeSpan = buildCommon.makeSpan; + var span = _buildCommon2.default.makeSpan((classes || []).concat(newOptions.sizingClasses(options)), [delim], options); -/** - * Get the metrics for a given symbol and font, after transformation (i.e. - * after following replacement from symbols.js) - */ -var getMetrics = function(symbol, font) { - if (symbols.math[symbol] && symbols.math[symbol].replace) { - return fontMetrics.getCharacterMetrics( - symbols.math[symbol].replace, font); - } else { - return fontMetrics.getCharacterMetrics( - symbol, font); - } -}; + span.delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; + span.height *= span.delimSizeMultiplier; + span.depth *= span.delimSizeMultiplier; + span.maxFontSize = newOptions.sizeMultiplier; -/** - * Builds a symbol in the given font size (note size is an integer) - */ -var mathrmSize = function(value, size, mode) { - return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode); + return span; }; -/** - * Puts a delimiter span in a given style, and adds appropriate height, depth, - * and maxFontSizes. - */ -var styleWrap = function(delim, toStyle, options) { - var span = makeSpan( - ["style-wrap", options.style.reset(), toStyle.cls()], [delim]); - - var multiplier = toStyle.sizeMultiplier / options.style.sizeMultiplier; +var centerSpan = function centerSpan(span, options, style) { + var newOptions = options.havingBaseStyle(style); + var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight; - span.height *= multiplier; - span.depth *= multiplier; - span.maxFontSize = toStyle.sizeMultiplier; - - return span; + span.classes.push("delimcenter"); + span.style.top = shift + "em"; + span.height -= shift; + span.depth += shift; }; /** @@ -4111,45 +6163,32 @@ var styleWrap = function(delim, toStyle, options) { * font, but is restyled to either be in textstyle, scriptstyle, or * scriptscriptstyle. */ -var makeSmallDelim = function(delim, style, center, options, mode) { - var text = buildCommon.makeSymbol(delim, "Main-Regular", mode); - - var span = styleWrap(text, style, options); - +var makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) { + var text = _buildCommon2.default.makeSymbol(delim, "Main-Regular", mode, options); + var span = styleWrap(text, style, options, classes); if (center) { - var shift = - (1 - options.style.sizeMultiplier / style.sizeMultiplier) * - fontMetrics.metrics.axisHeight; - - span.style.top = shift + "em"; - span.height -= shift; - span.depth += shift; + centerSpan(span, options, style); } - return span; }; +/** + * Builds a symbol in the given font size (note size is an integer) + */ +var mathrmSize = function mathrmSize(value, size, mode, options) { + return _buildCommon2.default.makeSymbol(value, "Size" + size + "-Regular", mode, options); +}; + /** * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2, * Size3, or Size4 fonts. It is always rendered in textstyle. */ -var makeLargeDelim = function(delim, size, center, options, mode) { - var inner = mathrmSize(delim, size, mode); - - var span = styleWrap( - makeSpan(["delimsizing", "size" + size], - [inner], options.getColor()), - Style.TEXT, options); - +var makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) { + var inner = mathrmSize(delim, size, mode, options); + var span = styleWrap(_buildCommon2.default.makeSpan(["delimsizing", "size" + size], [inner], options), _Style2.default.TEXT, options, classes); if (center) { - var shift = (1 - options.style.sizeMultiplier) * - fontMetrics.metrics.axisHeight; - - span.style.top = shift + "em"; - span.height -= shift; - span.depth += shift; + centerSpan(span, options, _Style2.default.TEXT); } - return span; }; @@ -4157,8 +6196,8 @@ var makeLargeDelim = function(delim, size, center, options, mode) { * Make an inner span with the given offset and in the given font. This is used * in `makeStackedDelim` to make the stacking pieces for the delimiter. */ -var makeInner = function(symbol, font, mode) { - var sizeClass; +var makeInner = function makeInner(symbol, font, mode) { + var sizeClass = void 0; // Apply the correct CSS class to choose the right font. if (font === "Size1-Regular") { sizeClass = "delim-size1"; @@ -4166,26 +6205,24 @@ var makeInner = function(symbol, font, mode) { sizeClass = "delim-size4"; } - var inner = makeSpan( - ["delimsizinginner", sizeClass], - [makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); + var inner = _buildCommon2.default.makeSpan(["delimsizinginner", sizeClass], [_buildCommon2.default.makeSpan([], [_buildCommon2.default.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element // in the appropriate tag that VList uses. - return {type: "elem", elem: inner}; + return { type: "elem", elem: inner }; }; /** * Make a stacked delimiter out of a given delimiter, with the total height at * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook. */ -var makeStackedDelim = function(delim, heightTotal, center, options, mode) { +var makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) { // There are four parts, the top, an optional middle, a repeated part, and a // bottom. - var top; - var middle; - var repeat; - var bottom; + var top = void 0; + var middle = void 0; + var repeat = void 0; + var bottom = void 0; top = repeat = bottom = delim; middle = null; // Also keep track of what font the delimiters are in @@ -4195,93 +6232,88 @@ var makeStackedDelim = function(delim, heightTotal, center, options, mode) { // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the // repeats of the arrows if (delim === "\\uparrow") { - repeat = bottom = "\u23d0"; + repeat = bottom = "\u23D0"; } else if (delim === "\\Uparrow") { repeat = bottom = "\u2016"; } else if (delim === "\\downarrow") { - top = repeat = "\u23d0"; + top = repeat = "\u23D0"; } else if (delim === "\\Downarrow") { top = repeat = "\u2016"; } else if (delim === "\\updownarrow") { top = "\\uparrow"; - repeat = "\u23d0"; + repeat = "\u23D0"; bottom = "\\downarrow"; } else if (delim === "\\Updownarrow") { top = "\\Uparrow"; repeat = "\u2016"; bottom = "\\Downarrow"; } else if (delim === "[" || delim === "\\lbrack") { - top = "\u23a1"; - repeat = "\u23a2"; - bottom = "\u23a3"; + top = "\u23A1"; + repeat = "\u23A2"; + bottom = "\u23A3"; font = "Size4-Regular"; } else if (delim === "]" || delim === "\\rbrack") { - top = "\u23a4"; - repeat = "\u23a5"; - bottom = "\u23a6"; + top = "\u23A4"; + repeat = "\u23A5"; + bottom = "\u23A6"; font = "Size4-Regular"; } else if (delim === "\\lfloor") { - repeat = top = "\u23a2"; - bottom = "\u23a3"; + repeat = top = "\u23A2"; + bottom = "\u23A3"; font = "Size4-Regular"; } else if (delim === "\\lceil") { - top = "\u23a1"; - repeat = bottom = "\u23a2"; + top = "\u23A1"; + repeat = bottom = "\u23A2"; font = "Size4-Regular"; } else if (delim === "\\rfloor") { - repeat = top = "\u23a5"; - bottom = "\u23a6"; + repeat = top = "\u23A5"; + bottom = "\u23A6"; font = "Size4-Regular"; } else if (delim === "\\rceil") { - top = "\u23a4"; - repeat = bottom = "\u23a5"; + top = "\u23A4"; + repeat = bottom = "\u23A5"; font = "Size4-Regular"; } else if (delim === "(") { - top = "\u239b"; - repeat = "\u239c"; - bottom = "\u239d"; + top = "\u239B"; + repeat = "\u239C"; + bottom = "\u239D"; font = "Size4-Regular"; } else if (delim === ")") { - top = "\u239e"; - repeat = "\u239f"; - bottom = "\u23a0"; + top = "\u239E"; + repeat = "\u239F"; + bottom = "\u23A0"; font = "Size4-Regular"; } else if (delim === "\\{" || delim === "\\lbrace") { - top = "\u23a7"; - middle = "\u23a8"; - bottom = "\u23a9"; - repeat = "\u23aa"; + top = "\u23A7"; + middle = "\u23A8"; + bottom = "\u23A9"; + repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\}" || delim === "\\rbrace") { - top = "\u23ab"; - middle = "\u23ac"; - bottom = "\u23ad"; - repeat = "\u23aa"; + top = "\u23AB"; + middle = "\u23AC"; + bottom = "\u23AD"; + repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\lgroup") { - top = "\u23a7"; - bottom = "\u23a9"; - repeat = "\u23aa"; + top = "\u23A7"; + bottom = "\u23A9"; + repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\rgroup") { - top = "\u23ab"; - bottom = "\u23ad"; - repeat = "\u23aa"; + top = "\u23AB"; + bottom = "\u23AD"; + repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\lmoustache") { - top = "\u23a7"; - bottom = "\u23ad"; - repeat = "\u23aa"; + top = "\u23A7"; + bottom = "\u23AD"; + repeat = "\u23AA"; font = "Size4-Regular"; } else if (delim === "\\rmoustache") { - top = "\u23ab"; - bottom = "\u23a9"; - repeat = "\u23aa"; - font = "Size4-Regular"; - } else if (delim === "\\surd") { - top = "\ue001"; - bottom = "\u23b7"; - repeat = "\ue000"; + top = "\u23AB"; + bottom = "\u23A9"; + repeat = "\u23AA"; font = "Size4-Regular"; } @@ -4305,20 +6337,18 @@ var makeStackedDelim = function(delim, heightTotal, center, options, mode) { var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need - var repeatCount = Math.ceil( - (heightTotal - minHeight) / (middleFactor * repeatHeightTotal)); + var repeatCount = Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal)); // Compute the total height of the delimiter including all the symbols - var realHeightTotal = - minHeight + repeatCount * middleFactor * repeatHeightTotal; + var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note // that in this context, "center" means that the delimiter should be // centered around the axis in the current style, while normally it is // centered around the axis in textstyle. - var axisHeight = fontMetrics.metrics.axisHeight; + var axisHeight = options.fontMetrics().axisHeight; if (center) { - axisHeight *= options.style.sizeMultiplier; + axisHeight *= options.sizeMultiplier; } // Calculate the depth var depth = realHeightTotal / 2 - axisHeight; @@ -4331,20 +6361,19 @@ var makeStackedDelim = function(delim, heightTotal, center, options, mode) { // Add the bottom symbol inners.push(makeInner(bottom, font, mode)); - var i; if (middle === null) { // Add that many symbols - for (i = 0; i < repeatCount; i++) { + for (var i = 0; i < repeatCount; i++) { inners.push(makeInner(repeat, font, mode)); } } else { // When there is a middle bit, we need the middle part and two repeated // sections - for (i = 0; i < repeatCount; i++) { + for (var _i = 0; _i < repeatCount; _i++) { inners.push(makeInner(repeat, font, mode)); } inners.push(makeInner(middle, font, mode)); - for (i = 0; i < repeatCount; i++) { + for (var _i2 = 0; _i2 < repeatCount; _i2++) { inners.push(makeInner(repeat, font, mode)); } } @@ -4353,35 +6382,99 @@ var makeStackedDelim = function(delim, heightTotal, center, options, mode) { inners.push(makeInner(top, font, mode)); // Finally, build the vlist - var inner = buildCommon.makeVList(inners, "bottom", depth, options); + var newOptions = options.havingBaseStyle(_Style2.default.TEXT); + var inner = _buildCommon2.default.makeVList({ + positionType: "bottom", + positionData: depth, + children: inners + }, newOptions); + + return styleWrap(_buildCommon2.default.makeSpan(["delimsizing", "mult"], [inner], newOptions), _Style2.default.TEXT, options, classes); +}; + +var sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, options) { + var alternate = void 0; + if (sqrtName === "sqrtTall") { + // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular + // One path edge has a variable length. It runs from the viniculumn + // to a point near (14 units) the bottom of the surd. The viniculum + // is 40 units thick. So the length of the line in question is: + var vertSegment = viewBoxHeight - 54; + alternate = "M702 0H400000v40H742v" + vertSegment + "l-4 4-4 4c-.667.667\n-2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1h-12l-28-84c-16.667-52-96.667\n-294.333-240-727l-212 -643 -85 170c-4-3.333-8.333-7.667-13 -13l-13-13l77-155\n 77-156c66 199.333 139 419.667 219 661 l218 661zM702 0H400000v40H742z"; + } + var pathNode = new _domTree2.default.pathNode(sqrtName, alternate); + + var svg = new _domTree2.default.svgNode([pathNode], { + // Note: 1000:1 ratio of viewBox to document em width. + "width": "400em", + "height": height + "em", + "viewBox": "0 0 400000 " + viewBoxHeight, + "preserveAspectRatio": "xMinYMin slice" + }); + + return _buildCommon2.default.makeSpan(["hide-tail"], [svg], options); +}; + +/** + * Make a sqrt image of the given height, + */ +var makeSqrtImage = function makeSqrtImage(height, options) { + var delim = traverseSequence("\\surd", height, stackLargeDelimiterSequence, options); + + // Create a span containing an SVG image of a sqrt symbol. + var span = void 0; + var sizeMultiplier = options.sizeMultiplier; // default + var spanHeight = void 0; + var viewBoxHeight = void 0; + + if (delim.type === "small") { + // Get an SVG that is derived from glyph U+221A in font KaTeX-Main. + viewBoxHeight = 1000; // from font + var newOptions = options.havingBaseStyle(delim.style); + sizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; + spanHeight = 1 * sizeMultiplier; + span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, options); + span.style.minWidth = "0.853em"; + span.advanceWidth = 0.833 * sizeMultiplier; // from the font. + } else if (delim.type === "large") { + // These SVGs come from fonts: KaTeX_Size1, _Size2, etc. + viewBoxHeight = 1000 * sizeToMaxHeight[delim.size]; + spanHeight = sizeToMaxHeight[delim.size] / sizeMultiplier; + span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, options); + span.style.minWidth = "1.02em"; + span.advanceWidth = 1.0 / sizeMultiplier; // from the font + } else { + // Tall sqrt. In TeX, this would be stacked using multiple glyphs. + // We'll use a single SVG to accomplish the same thing. + spanHeight = height / sizeMultiplier; + viewBoxHeight = Math.floor(1000 * height); + span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, options); + span.style.minWidth = "0.742em"; + span.advanceWidth = 1.056 / sizeMultiplier; + } - return styleWrap( - makeSpan(["delimsizing", "mult"], [inner], options.getColor()), - Style.TEXT, options); + span.height = spanHeight; + span.style.height = spanHeight + "em"; + + return { + span: span, + // Calculate the actual line width. + // This actually should depend on the chosen font -- e.g. \boldmath + // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and + // have thicker rules. + ruleWidth: options.fontMetrics().sqrtRuleThickness * sizeMultiplier + }; }; // There are three kinds of delimiters, delimiters that stack when they become // too large -var stackLargeDelimiters = [ - "(", ")", "[", "\\lbrack", "]", "\\rbrack", - "\\{", "\\lbrace", "\\}", "\\rbrace", - "\\lfloor", "\\rfloor", "\\lceil", "\\rceil", - "\\surd", -]; +var stackLargeDelimiters = ["(", ")", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\\lceil", "\\rceil", "\\surd"]; // delimiters that always stack -var stackAlwaysDelimiters = [ - "\\uparrow", "\\downarrow", "\\updownarrow", - "\\Uparrow", "\\Downarrow", "\\Updownarrow", - "|", "\\|", "\\vert", "\\Vert", - "\\lvert", "\\rvert", "\\lVert", "\\rVert", - "\\lgroup", "\\rgroup", "\\lmoustache", "\\rmoustache", -]; +var stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\\lmoustache", "\\rmoustache"]; // and delimiters that never stack -var stackNeverDelimiters = [ - "<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt", -]; +var stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of // $\bigl| // \Bigl| \biggl| \Biggl| \showlists$ @@ -4391,7 +6484,7 @@ var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0]; /** * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4. */ -var makeSizedDelim = function(delim, size, options, mode) { +var makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) { // < and > turn into \langle and \rangle in delimiters if (delim === "<" || delim === "\\lt") { delim = "\\langle"; @@ -4400,14 +6493,12 @@ var makeSizedDelim = function(delim, size, options, mode) { } // Sized delimiters are never centered. - if (utils.contains(stackLargeDelimiters, delim) || - utils.contains(stackNeverDelimiters, delim)) { - return makeLargeDelim(delim, size, false, options, mode); - } else if (utils.contains(stackAlwaysDelimiters, delim)) { - return makeStackedDelim( - delim, sizeToMaxHeight[size], false, options, mode); + if (_utils2.default.contains(stackLargeDelimiters, delim) || _utils2.default.contains(stackNeverDelimiters, delim)) { + return makeLargeDelim(delim, size, false, options, mode, classes); + } else if (_utils2.default.contains(stackAlwaysDelimiters, delim)) { + return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes); } else { - throw new ParseError("Illegal delimiter: '" + delim + "'"); + throw new _ParseError2.default("Illegal delimiter: '" + delim + "'"); } }; @@ -4424,41 +6515,19 @@ var makeSizedDelim = function(delim, size, options, mode) { */ // Delimiters that never stack try small delimiters and large delimiters only -var stackNeverDelimiterSequence = [ - {type: "small", style: Style.SCRIPTSCRIPT}, - {type: "small", style: Style.SCRIPT}, - {type: "small", style: Style.TEXT}, - {type: "large", size: 1}, - {type: "large", size: 2}, - {type: "large", size: 3}, - {type: "large", size: 4}, -]; +var stackNeverDelimiterSequence = [{ type: "small", style: _Style2.default.SCRIPTSCRIPT }, { type: "small", style: _Style2.default.SCRIPT }, { type: "small", style: _Style2.default.TEXT }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }]; // Delimiters that always stack try the small delimiters first, then stack -var stackAlwaysDelimiterSequence = [ - {type: "small", style: Style.SCRIPTSCRIPT}, - {type: "small", style: Style.SCRIPT}, - {type: "small", style: Style.TEXT}, - {type: "stack"}, -]; +var stackAlwaysDelimiterSequence = [{ type: "small", style: _Style2.default.SCRIPTSCRIPT }, { type: "small", style: _Style2.default.SCRIPT }, { type: "small", style: _Style2.default.TEXT }, { type: "stack" }]; // Delimiters that stack when large try the small and then large delimiters, and // stack afterwards -var stackLargeDelimiterSequence = [ - {type: "small", style: Style.SCRIPTSCRIPT}, - {type: "small", style: Style.SCRIPT}, - {type: "small", style: Style.TEXT}, - {type: "large", size: 1}, - {type: "large", size: 2}, - {type: "large", size: 3}, - {type: "large", size: 4}, - {type: "stack"}, -]; +var stackLargeDelimiterSequence = [{ type: "small", style: _Style2.default.SCRIPTSCRIPT }, { type: "small", style: _Style2.default.SCRIPT }, { type: "small", style: _Style2.default.TEXT }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }, { type: "stack" }]; /** * Get the font used in a delimiter based on what kind of delimiter it is. */ -var delimTypeToFont = function(type) { +var delimTypeToFont = function delimTypeToFont(type) { if (type.type === "small") { return "Main-Regular"; } else if (type.type === "large") { @@ -4472,7 +6541,7 @@ var delimTypeToFont = function(type) { * Traverse a sequence of types of delimiters to decide what kind of delimiter * should be used to create a delimiter of the given height+depth. */ -var traverseSequence = function(delim, height, sequence, options) { +var traverseSequence = function traverseSequence(delim, height, sequence, options) { // Here, we choose the index we should start at in the sequences. In smaller // sizes (which correspond to larger numbers in style.size) we start earlier // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts @@ -4491,7 +6560,8 @@ var traverseSequence = function(delim, height, sequence, options) { // account for the style change size. if (sequence[i].type === "small") { - heightDepth *= sequence[i].style.sizeMultiplier; + var newOptions = options.havingBaseStyle(sequence[i].style); + heightDepth *= newOptions.sizeMultiplier; } // Check if the delimiter at this size works for the given height. @@ -4508,7 +6578,7 @@ var traverseSequence = function(delim, height, sequence, options) { * Make a delimiter of a given height+depth, with optional centering. Here, we * traverse the sequences, and create a delimiter that the sequence tells us to. */ -var makeCustomSizedDelim = function(delim, height, center, options, mode) { +var makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) { if (delim === "<" || delim === "\\lt") { delim = "\\langle"; } else if (delim === ">" || delim === "\\gt") { @@ -4516,10 +6586,10 @@ var makeCustomSizedDelim = function(delim, height, center, options, mode) { } // Decide what sequence to use - var sequence; - if (utils.contains(stackNeverDelimiters, delim)) { + var sequence = void 0; + if (_utils2.default.contains(stackNeverDelimiters, delim)) { sequence = stackNeverDelimiterSequence; - } else if (utils.contains(stackLargeDelimiters, delim)) { + } else if (_utils2.default.contains(stackLargeDelimiters, delim)) { sequence = stackLargeDelimiterSequence; } else { sequence = stackAlwaysDelimiterSequence; @@ -4528,75 +6598,92 @@ var makeCustomSizedDelim = function(delim, height, center, options, mode) { // Look through the sequence var delimType = traverseSequence(delim, height, sequence, options); - // Depending on the sequence element we decided on, call the appropriate - // function. + // Get the delimiter from font glyphs. + // Depending on the sequence element we decided on, call the + // appropriate function. if (delimType.type === "small") { - return makeSmallDelim(delim, delimType.style, center, options, mode); + return makeSmallDelim(delim, delimType.style, center, options, mode, classes); } else if (delimType.type === "large") { - return makeLargeDelim(delim, delimType.size, center, options, mode); - } else if (delimType.type === "stack") { - return makeStackedDelim(delim, height, center, options, mode); - } + return makeLargeDelim(delim, delimType.size, center, options, mode, classes); + } else /* if (delimType.type === "stack") */{ + return makeStackedDelim(delim, height, center, options, mode, classes); + } }; /** * Make a delimiter for use with `\left` and `\right`, given a height and depth * of an expression that the delimiters surround. */ -var makeLeftRightDelim = function(delim, height, depth, options, mode) { +var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) { // We always center \left/\right delimiters, so the axis is always shifted - var axisHeight = - fontMetrics.metrics.axisHeight * options.style.sizeMultiplier; + var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right var delimiterFactor = 901; - var delimiterExtend = 5.0 / fontMetrics.metrics.ptPerEm; + var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm; - var maxDistFromAxis = Math.max( - height - axisHeight, depth + axisHeight); + var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight); var totalHeight = Math.max( - // In real TeX, calculations are done using integral values which are - // 65536 per pt, or 655360 per em. So, the division here truncates in - // TeX but doesn't here, producing different results. If we wanted to - // exactly match TeX's calculation, we could do - // Math.floor(655360 * maxDistFromAxis / 500) * - // delimiterFactor / 655360 - // (To see the difference, compare - // x^{x^{\left(\rule{0.1em}{0.68em}\right)}} - // in TeX and KaTeX) - maxDistFromAxis / 500 * delimiterFactor, - 2 * maxDistFromAxis - delimiterExtend); + // In real TeX, calculations are done using integral values which are + // 65536 per pt, or 655360 per em. So, the division here truncates in + // TeX but doesn't here, producing different results. If we wanted to + // exactly match TeX's calculation, we could do + // Math.floor(655360 * maxDistFromAxis / 500) * + // delimiterFactor / 655360 + // (To see the difference, compare + // x^{x^{\left(\rule{0.1em}{0.68em}\right)}} + // in TeX and KaTeX) + maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total // height - return makeCustomSizedDelim(delim, totalHeight, true, options, mode); + return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes); }; -module.exports = { +exports.default = { + sqrtImage: makeSqrtImage, sizedDelim: makeSizedDelim, customSizedDelim: makeCustomSizedDelim, - leftRightDelim: makeLeftRightDelim, + leftRightDelim: makeLeftRightDelim }; -},{"./ParseError":6,"./Style":9,"./buildCommon":10,"./fontMetrics":17,"./symbols":23,"./utils":25}],15:[function(require,module,exports){ -/** - * These objects store the data about the DOM nodes we create, as well as some - * extra data. They can then be transformed into real DOM nodes with the - * `toNode` function or HTML markup using `toMarkup`. They are useful for both - * storing extra properties on the nodes, as well as providing a way to easily - * work with the DOM. - * - * Similar functions for working with MathML nodes exist in mathMLTree.js. - */ -var unicodeRegexes = require("./unicodeRegexes"); -var utils = require("./utils"); +},{"./ParseError":84,"./Style":89,"./buildCommon":91,"./domTree":98,"./fontMetrics":101,"./symbols":125,"./utils":128}],98:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _getIterator2 = require("babel-runtime/core-js/get-iterator"); + +var _getIterator3 = _interopRequireDefault(_getIterator2); + +var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = require("babel-runtime/helpers/createClass"); + +var _createClass3 = _interopRequireDefault(_createClass2); + +var _unicodeRegexes = require("./unicodeRegexes"); + +var _utils = require("./utils"); + +var _utils2 = _interopRequireDefault(_utils); + +var _svgGeometry = require("./svgGeometry"); + +var _svgGeometry2 = _interopRequireDefault(_svgGeometry); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Create an HTML className based on a list of classes. In addition to joining * with spaces, we also remove null or empty classes. */ -var createClass = function(classes) { +var createClass = function createClass(classes) { classes = classes.slice(); for (var i = classes.length - 1; i >= 0; i--) { if (!classes[i]) { @@ -4607,156 +6694,381 @@ var createClass = function(classes) { return classes.join(" "); }; +// To ensure that all nodes have compatible signatures for these methods. + + /** - * This node represents a span node, with a className, a list of children, and - * an inline style. It also contains information about its height, depth, and - * maxFontSize. + * All `DomChildNode`s MUST have `height`, `depth`, and `maxFontSize` numeric + * fields. + * + * `DomChildNode` is not defined as an interface since `documentFragment` also + * has these fields but should not be considered a `DomChildNode`. */ -function span(classes, children, height, depth, maxFontSize, style) { - this.classes = classes || []; - this.children = children || []; - this.height = height || 0; - this.depth = depth || 0; - this.maxFontSize = maxFontSize || 0; - this.style = style || {}; - this.attributes = {}; -} /** - * Sets an arbitrary attribute on the span. Warning: use this wisely. Not all - * browsers support attributes the same, and having too many custom attributes - * is probably bad. + * These objects store the data about the DOM nodes we create, as well as some + * extra data. They can then be transformed into real DOM nodes with the + * `toNode` function or HTML markup using `toMarkup`. They are useful for both + * storing extra properties on the nodes, as well as providing a way to easily + * work with the DOM. + * + * Similar functions for working with MathML nodes exist in mathMLTree.js. */ -span.prototype.setAttribute = function(attribute, value) { - this.attributes[attribute] = value; -}; /** - * Convert the span into an HTML node + * This node represents a span node, with a className, a list of children, and + * an inline style. It also contains information about its height, depth, and + * maxFontSize. */ -span.prototype.toNode = function() { - var span = document.createElement("span"); - - // Apply the class - span.className = createClass(this.classes); - - // Apply inline styles - for (var style in this.style) { - if (Object.prototype.hasOwnProperty.call(this.style, style)) { - span.style[style] = this.style[style]; +var span = function () { + function span(classes, children, options) { + (0, _classCallCheck3.default)(this, span); + + this.classes = classes || []; + this.children = children || []; + this.height = 0; + this.depth = 0; + this.maxFontSize = 0; + this.style = {}; + this.attributes = {}; + if (options) { + if (options.style.isTight()) { + this.classes.push("mtight"); + } + var color = options.getColor(); + if (color) { + this.style.color = color; + } } } - // Apply attributes - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - span.setAttribute(attr, this.attributes[attr]); - } - } + /** + * Sets an arbitrary attribute on the span. Warning: use this wisely. Not all + * browsers support attributes the same, and having too many custom attributes + * is probably bad. + */ - // Append the children, also as HTML nodes - for (var i = 0; i < this.children.length; i++) { - span.appendChild(this.children[i].toNode()); - } - return span; -}; + (0, _createClass3.default)(span, [{ + key: "setAttribute", + value: function setAttribute(attribute, value) { + this.attributes[attribute] = value; + } + }, { + key: "tryCombine", + value: function tryCombine(sibling) { + return false; + } -/** - * Convert the span into an HTML markup string - */ -span.prototype.toMarkup = function() { - var markup = ") element with a hyperlink, a list of classes, + * a list of children, and an inline style. It also contains information about its + * height, depth, and maxFontSize. */ -documentFragment.prototype.toMarkup = function() { - var markup = ""; - // Simply concatenate the markup for the children together - for (var i = 0; i < this.children.length; i++) { - markup += this.children[i].toMarkup(); + +var anchor = function () { + function anchor(href, classes, children, options) { + (0, _classCallCheck3.default)(this, anchor); + + this.href = href; + this.classes = classes; + this.children = children; + this.height = 0; + this.depth = 0; + this.maxFontSize = 0; + this.style = {}; + this.attributes = {}; + if (options.style.isTight()) { + this.classes.push("mtight"); + } + var color = options.getColor(); + if (color) { + this.style.color = color; + } } - return markup; -}; + /** + * Sets an arbitrary attribute on the anchor. Warning: use this wisely. Not all + * browsers support attributes the same, and having too many custom attributes + * is probably bad. + */ + + + (0, _createClass3.default)(anchor, [{ + key: "setAttribute", + value: function setAttribute(attribute, value) { + this.attributes[attribute] = value; + } + }, { + key: "tryCombine", + value: function tryCombine(sibling) { + return false; + } + + /** + * Convert the anchor into an HTML node + */ + + }, { + key: "toNode", + value: function toNode() { + var a = document.createElement("a"); + + // Apply the href + a.setAttribute('href', this.href); + + // Apply the class + if (this.classes.length) { + a.className = createClass(this.classes); + } + + // Apply inline styles + for (var style in this.style) { + if (Object.prototype.hasOwnProperty.call(this.style, style)) { + // $FlowFixMe Flow doesn't seem to understand a.style's type. + a.style[style] = this.style[style]; + } + } + + // Apply attributes + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + a.setAttribute(attr, this.attributes[attr]); + } + } + + // Append the children, also as HTML nodes + for (var i = 0; i < this.children.length; i++) { + a.appendChild(this.children[i].toNode()); + } + + return a; + } + + /** + * Convert the a into an HTML markup string + */ + + }, { + key: "toMarkup", + value: function toMarkup() { + var markup = " 0 || createClass(this.classes) !== createClass(sibling.classes) || this.skew !== sibling.skew || this.maxFontSize !== sibling.maxFontSize) { + return false; + } + for (var style in this.style) { + if (this.style.hasOwnProperty(style) && this.style[style] !== sibling.style[style]) { + return false; + } + } + for (var _style in sibling.style) { + if (sibling.style.hasOwnProperty(_style) && this.style[_style] !== sibling.style[_style]) { + return false; + } + } + this.value += sibling.value; + this.height = Math.max(this.height, sibling.height); + this.depth = Math.max(this.depth, sibling.depth); + this.italic = sibling.italic; + return true; + } - if (this.italic > 0) { - span = document.createElement("span"); - span.style.marginRight = this.italic + "em"; - } + /** + * Creates a text node or span from a symbol node. Note that a span is only + * created if it is needed. + */ - if (this.classes.length > 0) { - span = span || document.createElement("span"); - span.className = createClass(this.classes); - } + }, { + key: "toNode", + value: function toNode() { + var node = document.createTextNode(this.value); + var span = null; + + if (this.italic > 0) { + span = document.createElement("span"); + span.style.marginRight = this.italic + "em"; + } + + if (this.classes.length > 0) { + span = span || document.createElement("span"); + span.className = createClass(this.classes); + } + + for (var style in this.style) { + if (this.style.hasOwnProperty(style)) { + span = span || document.createElement("span"); + // $FlowFixMe Flow doesn't seem to understand span.style's type. + span.style[style] = this.style[style]; + } + } - for (var style in this.style) { - if (this.style.hasOwnProperty(style)) { - span = span || document.createElement("span"); - span.style[style] = this.style[style]; + if (span) { + span.appendChild(node); + return span; + } else { + return node; + } } - } - if (span) { - span.appendChild(node); - return span; - } else { - return node; - } -}; + /** + * Creates markup for a symbol node. + */ + + }, { + key: "toMarkup", + value: function toMarkup() { + // TODO(alpert): More duplication than I'd like from + // span.prototype.toMarkup and symbolNode.prototype.toNode... + var needsSpan = false; + + var markup = " 0) { + styles += "margin-right:" + this.italic + "em;"; + } + for (var style in this.style) { + if (this.style.hasOwnProperty(style)) { + styles += _utils2.default.hyphenate(style) + ":" + this.style[style] + ";"; + } + } + + if (styles) { + needsSpan = true; + markup += " style=\"" + _utils2.default.escape(styles) + "\""; + } + + var escaped = _utils2.default.escape(this.value); + if (needsSpan) { + markup += ">"; + markup += escaped; + markup += ""; + return markup; + } else { + return escaped; + } + } + }]); + return symbolNode; +}(); /** - * Creates markup for a symbol node. + * SVG nodes are used to render stretchy wide elements. */ -symbolNode.prototype.toMarkup = function() { - // TODO(alpert): More duplication than I'd like from - // span.prototype.toMarkup and symbolNode.prototype.toNode... - var needsSpan = false; - var markup = " 0) { - styles += "margin-right:" + this.italic + "em;"; - } - for (var style in this.style) { - if (this.style.hasOwnProperty(style)) { - styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; + (0, _createClass3.default)(svgNode, [{ + key: "toNode", + value: function toNode() { + var svgNS = "http://www.w3.org/2000/svg"; + var node = document.createElementNS(svgNS, "svg"); + + // Apply attributes + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + + for (var i = 0; i < this.children.length; i++) { + node.appendChild(this.children[i].toNode()); + } + return node; } - } + }, { + key: "toMarkup", + value: function toMarkup() { + var markup = ""; + } else { + return ""; + } + } + }]); + return pathNode; +}(); + +var lineNode = function () { + function lineNode(attributes) { + (0, _classCallCheck3.default)(this, lineNode); + + this.attributes = attributes || {}; } -}; -module.exports = { + (0, _createClass3.default)(lineNode, [{ + key: "toNode", + value: function toNode() { + var svgNS = "http://www.w3.org/2000/svg"; + var node = document.createElementNS(svgNS, "line"); + + // Apply attributes + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + + return node; + } + }, { + key: "toMarkup", + value: function toMarkup() { + var markup = " 1 && lastRow.length === 1 && lastRow[0].value.value[0].value.length === 0) { + body.pop(); + } break; } else if (next === "\\\\" || next === "\\cr") { var cr = parser.parseFunction(); @@ -4908,201 +7478,447 @@ function parseArray(parser, result) { row = []; body.push(row); } else { - throw new ParseError("Expected & or \\\\ or \\end", - parser.nextToken); + throw new _ParseError2.default("Expected & or \\\\ or \\end", parser.nextToken); } } result.body = body; result.rowGaps = rowGaps; - return new ParseNode(result.type, result, parser.mode); + return new _ParseNode2.default(result.type, result, parser.mode); } -/* - * An environment definition is very similar to a function definition: - * it is declared with a name or a list of names, a set of properties - * and a handler containing the actual implementation. - * - * The properties include: - * - numArgs: The number of arguments after the \begin{name} function. - * - argTypes: (optional) Just like for a function - * - allowedInText: (optional) Whether or not the environment is allowed inside - * text mode (default false) (not enforced yet) - * - numOptionalArgs: (optional) Just like for a function - * A bare number instead of that object indicates the numArgs value. - * - * The handler function will receive two arguments - * - context: information and references provided by the parser - * - args: an array of arguments passed to \begin{name} - * The context contains the following properties: - * - envName: the name of the environment, one of the listed names. - * - parser: the parser object - * - lexer: the lexer object - * - positions: the positions associated with these arguments from args. - * The handler must return a ParseResult. - */ - -function defineEnvironment(names, props, handler) { - if (typeof names === "string") { - names = [names]; - } - if (typeof props === "number") { - props = { numArgs: props }; - } - // Set default values of environments - var data = { - numArgs: props.numArgs || 0, - argTypes: props.argTypes, - greediness: 1, - allowedInText: !!props.allowedInText, - numOptionalArgs: props.numOptionalArgs || 0, - handler: handler, - }; - for (var i = 0; i < names.length; ++i) { - module.exports[names[i]] = data; +// Decides on a style for cells in an array according to whether the given +// environment name starts with the letter 'd'. +function dCellStyle(envName) { + if (envName.substr(0, 1) === "d") { + return "display"; + } else { + return "text"; } } -// Arrays are part of LaTeX, defined in lttab.dtx so its documentation -// is part of the source2e.pdf file of LaTeX2e source documentation. -defineEnvironment("array", { - numArgs: 1, -}, function(context, args) { - var colalign = args[0]; - colalign = colalign.value.map ? colalign.value : [colalign]; - var cols = colalign.map(function(node) { - var ca = node.value; - if ("lcr".indexOf(ca) !== -1) { - return { - type: "align", - align: ca, - }; - } else if (ca === "|") { - return { - type: "separator", - separator: "|", - }; - } - throw new ParseError( - "Unknown column alignment: " + node.value, - node); - }); - var res = { - type: "array", - cols: cols, - hskipBeforeAndAfter: true, // \@preamble in lttab.dtx - }; - res = parseArray(context.parser, res); - return res; -}); +var htmlBuilder = function htmlBuilder(group, options) { + var r = void 0; + var c = void 0; + var nr = group.value.body.length; + var nc = 0; + var body = new Array(nr); -// The matrix environments of amsmath builds on the array environment -// of LaTeX, which is discussed above. -defineEnvironment([ - "matrix", - "pmatrix", - "bmatrix", - "Bmatrix", - "vmatrix", - "Vmatrix", -], { -}, function(context) { - var delimiters = { - "matrix": null, - "pmatrix": ["(", ")"], - "bmatrix": ["[", "]"], - "Bmatrix": ["\\{", "\\}"], - "vmatrix": ["|", "|"], - "Vmatrix": ["\\Vert", "\\Vert"], - }[context.envName]; - var res = { - type: "array", - hskipBeforeAndAfter: false, // \hskip -\arraycolsep in amsmath - }; - res = parseArray(context.parser, res); - if (delimiters) { - res = new ParseNode("leftright", { - body: [res], - left: delimiters[0], - right: delimiters[1], - }, context.mode); - } - return res; -}); + // Horizontal spacing + var pt = 1 / options.fontMetrics().ptPerEm; + var arraycolsep = 5 * pt; // \arraycolsep in article.cls -// A cases environment (in amsmath.sty) is almost equivalent to -// \def\arraystretch{1.2}% -// \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right. -defineEnvironment("cases", { -}, function(context) { - var res = { - type: "array", - arraystretch: 1.2, - cols: [{ - type: "align", - align: "l", - pregap: 0, - postgap: fontMetrics.metrics.quad, - }, { - type: "align", - align: "l", - pregap: 0, - postgap: 0, - }], - }; - res = parseArray(context.parser, res); - res = new ParseNode("leftright", { - body: [res], - left: "\\{", - right: ".", - }, context.mode); - return res; -}); + // Vertical spacing + var baselineskip = 12 * pt; // see size10.clo + // Default \jot from ltmath.dtx + // TODO(edemaine): allow overriding \jot via \setlength (#687) + var jot = 3 * pt; + // Default \arraystretch from lttab.dtx + // TODO(gagern): may get redefined once we have user-defined macros + var arraystretch = _utils2.default.deflt(group.value.arraystretch, 1); + var arrayskip = arraystretch * baselineskip; + var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and + var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx -// An aligned environment is like the align* environment -// except it operates within math mode. -// Note that we assume \nomallineskiplimit to be zero, -// so that \strut@ is the same as \strut. -defineEnvironment("aligned", { -}, function(context) { + var totalHeight = 0; + for (r = 0; r < group.value.body.length; ++r) { + var inrow = group.value.body[r]; + var _height = arstrutHeight; // \@array adds an \@arstrut + var _depth = arstrutDepth; // to each tow (via the template) + + if (nc < inrow.length) { + nc = inrow.length; + } + + var outrow = new Array(inrow.length); + for (c = 0; c < inrow.length; ++c) { + var elt = html.buildGroup(inrow[c], options); + if (_depth < elt.depth) { + _depth = elt.depth; + } + if (_height < elt.height) { + _height = elt.height; + } + outrow[c] = elt; + } + + var gap = 0; + if (group.value.rowGaps[r]) { + gap = (0, _units.calculateSize)(group.value.rowGaps[r].value, options); + if (gap > 0) { + // \@argarraycr + gap += arstrutDepth; + if (_depth < gap) { + _depth = gap; // \@xargarraycr + } + gap = 0; + } + } + // In AMS multiline environments such as aligned and gathered, rows + // correspond to lines that have additional \jot added to the + // \baselineskip via \openup. + if (group.value.addJot) { + _depth += jot; + } + + outrow.height = _height; + outrow.depth = _depth; + totalHeight += _height; + outrow.pos = totalHeight; + totalHeight += _depth + gap; // \@yargarraycr + body[r] = outrow; + } + + var offset = totalHeight / 2 + options.fontMetrics().axisHeight; + var colDescriptions = group.value.cols || []; + var cols = []; + var colSep = void 0; + var colDescrNum = void 0; + for (c = 0, colDescrNum = 0; + // Continue while either there are more columns or more column + // descriptions, so trailing separators don't get lost. + c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) { + + var colDescr = colDescriptions[colDescrNum] || {}; + + var firstSeparator = true; + while (colDescr.type === "separator") { + // If there is more than one separator in a row, add a space + // between them. + if (!firstSeparator) { + colSep = _buildCommon2.default.makeSpan(["arraycolsep"], []); + colSep.style.width = options.fontMetrics().doubleRuleSep + "em"; + cols.push(colSep); + } + + if (colDescr.separator === "|") { + var _separator = _stretchy2.default.ruleSpan("vertical-separator", options); + _separator.style.height = totalHeight + "em"; + _separator.style.verticalAlign = -(totalHeight - offset) + "em"; + + cols.push(_separator); + } else { + throw new _ParseError2.default("Invalid separator type: " + colDescr.separator); + } + + colDescrNum++; + colDescr = colDescriptions[colDescrNum] || {}; + firstSeparator = false; + } + + if (c >= nc) { + continue; + } + + var sepwidth = void 0; + if (c > 0 || group.value.hskipBeforeAndAfter) { + sepwidth = _utils2.default.deflt(colDescr.pregap, arraycolsep); + if (sepwidth !== 0) { + colSep = _buildCommon2.default.makeSpan(["arraycolsep"], []); + colSep.style.width = sepwidth + "em"; + cols.push(colSep); + } + } + + var col = []; + for (r = 0; r < nr; ++r) { + var row = body[r]; + var elem = row[c]; + if (!elem) { + continue; + } + var shift = row.pos - offset; + elem.depth = row.depth; + elem.height = row.height; + col.push({ type: "elem", elem: elem, shift: shift }); + } + + col = _buildCommon2.default.makeVList({ + positionType: "individualShift", + children: col + }, options); + col = _buildCommon2.default.makeSpan(["col-align-" + (colDescr.align || "c")], [col]); + cols.push(col); + + if (c < nc - 1 || group.value.hskipBeforeAndAfter) { + sepwidth = _utils2.default.deflt(colDescr.postgap, arraycolsep); + if (sepwidth !== 0) { + colSep = _buildCommon2.default.makeSpan(["arraycolsep"], []); + colSep.style.width = sepwidth + "em"; + cols.push(colSep); + } + } + } + body = _buildCommon2.default.makeSpan(["mtable"], cols); + return _buildCommon2.default.makeSpan(["mord"], [body], options); +}; + +var mathmlBuilder = function mathmlBuilder(group, options) { + return new _mathMLTree2.default.MathNode("mtable", group.value.body.map(function (row) { + return new _mathMLTree2.default.MathNode("mtr", row.map(function (cell) { + return new _mathMLTree2.default.MathNode("mtd", [mml.buildGroup(cell, options)]); + })); + })); +}; + +// Convinient function for aligned and alignedat environments. +var alignedHandler = function alignedHandler(context, args) { var res = { type: "array", cols: [], + addJot: true }; - res = parseArray(context.parser, res); - var emptyGroup = new ParseNode("ordgroup", [], context.mode); + res = parseArray(context.parser, res, "display"); + + // Determining number of columns. + // 1. If the first argument is given, we use it as a number of columns, + // and makes sure that each row doesn't exceed that number. + // 2. Otherwise, just count number of columns = maximum number + // of cells in each row ("aligned" mode -- isAligned will be true). + // + // At the same time, prepend empty group {} at beginning of every second + // cell in each row (starting with second cell) so that operators become + // binary. This behavior is implemented in amsmath's \start@aligned. + var numMaths = void 0; var numCols = 0; - res.value.body.forEach(function(row) { - var i; - for (i = 1; i < row.length; i += 2) { - row[i].value.unshift(emptyGroup); + var emptyGroup = new _ParseNode2.default("ordgroup", [], context.mode); + if (args[0] && args[0].value) { + var arg0 = ""; + for (var i = 0; i < args[0].value.length; i++) { + arg0 += args[0].value[i].value; } - if (numCols < row.length) { + numMaths = Number(arg0); + numCols = numMaths * 2; + } + var isAligned = !numCols; + res.value.body.forEach(function (row) { + for (var _i = 1; _i < row.length; _i += 2) { + // Modify ordgroup node within styling node + var ordgroup = row[_i].value.value[0]; + ordgroup.value.unshift(emptyGroup); + } + if (!isAligned) { + // Case 1 + var curMaths = row.length / 2; + if (numMaths < curMaths) { + throw new _ParseError2.default("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row); + } + } else if (numCols < row.length) { + // Case 2 numCols = row.length; } }); - for (var i = 0; i < numCols; ++i) { - var align = "r"; - var pregap = 0; - if (i % 2 === 1) { - align = "l"; - } else if (i > 0) { - pregap = 2; // one \qquad between columns - } - res.value.cols[i] = { + + // Adjusting alignment. + // In aligned mode, we add one \qquad between columns; + // otherwise we add nothing. + for (var _i2 = 0; _i2 < numCols; ++_i2) { + var _align = "r"; + var _pregap = 0; + if (_i2 % 2 === 1) { + _align = "l"; + } else if (_i2 > 0 && isAligned) { + // "aligned" mode. + _pregap = 1; // add one \quad + } + res.value.cols[_i2] = { type: "align", - align: align, - pregap: pregap, - postgap: 0, + align: _align, + pregap: _pregap, + postgap: 0 }; } return res; +}; + +// Arrays are part of LaTeX, defined in lttab.dtx so its documentation +// is part of the source2e.pdf file of LaTeX2e source documentation. +// {darray} is an {array} environment where cells are set in \displaystyle, +// as defined in nccmath.sty. +(0, _defineEnvironment2.default)({ + type: "array", + names: ["array", "darray"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var colalign = args[0]; + colalign = colalign.value.map ? colalign.value : [colalign]; + var cols = colalign.map(function (node) { + var ca = node.value; + if ("lcr".indexOf(ca) !== -1) { + return { + type: "align", + align: ca + }; + } else if (ca === "|") { + return { + type: "separator", + separator: "|" + }; + } + throw new _ParseError2.default("Unknown column alignment: " + node.value, node); + }); + var res = { + type: "array", + cols: cols, + hskipBeforeAndAfter: true // \@preamble in lttab.dtx + }; + res = parseArray(context.parser, res, dCellStyle(context.envName)); + return res; + }, + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder +}); + +// The matrix environments of amsmath builds on the array environment +// of LaTeX, which is discussed above. +(0, _defineEnvironment2.default)({ + type: "array", + names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix"], + props: { + numArgs: 0 + }, + handler: function handler(context) { + var delimiters = { + "matrix": null, + "pmatrix": ["(", ")"], + "bmatrix": ["[", "]"], + "Bmatrix": ["\\{", "\\}"], + "vmatrix": ["|", "|"], + "Vmatrix": ["\\Vert", "\\Vert"] + }[context.envName]; + var res = { + type: "array", + hskipBeforeAndAfter: false // \hskip -\arraycolsep in amsmath + }; + res = parseArray(context.parser, res, dCellStyle(context.envName)); + if (delimiters) { + res = new _ParseNode2.default("leftright", { + body: [res], + left: delimiters[0], + right: delimiters[1] + }, context.mode); + } + return res; + }, + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder +}); + +// A cases environment (in amsmath.sty) is almost equivalent to +// \def\arraystretch{1.2}% +// \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right. +// {dcases} is a {cases} environment where cells are set in \displaystyle, +// as defined in mathtools.sty. +(0, _defineEnvironment2.default)({ + type: "array", + names: ["cases", "dcases"], + props: { + numArgs: 0 + }, + handler: function handler(context) { + var res = { + type: "array", + arraystretch: 1.2, + cols: [{ + type: "align", + align: "l", + pregap: 0, + // TODO(kevinb) get the current style. + // For now we use the metrics for TEXT style which is what we were + // doing before. Before attempting to get the current style we + // should look at TeX's behavior especially for \over and matrices. + postgap: 1.0 /* 1em quad */ + }, { + type: "align", + align: "l", + pregap: 0, + postgap: 0 + }] + }; + res = parseArray(context.parser, res, dCellStyle(context.envName)); + res = new _ParseNode2.default("leftright", { + body: [res], + left: "\\{", + right: "." + }, context.mode); + return res; + }, + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder +}); + +// An aligned environment is like the align* environment +// except it operates within math mode. +// Note that we assume \nomallineskiplimit to be zero, +// so that \strut@ is the same as \strut. +(0, _defineEnvironment2.default)({ + type: "array", + names: ["aligned"], + props: { + numArgs: 0 + }, + handler: alignedHandler, + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder +}); + +// A gathered environment is like an array environment with one centered +// column, but where rows are considered lines so get \jot line spacing +// and contents are set in \displaystyle. +(0, _defineEnvironment2.default)({ + type: "array", + names: ["gathered"], + props: { + numArgs: 0 + }, + handler: function handler(context) { + var res = { + type: "array", + cols: [{ + type: "align", + align: "c" + }], + addJot: true + }; + res = parseArray(context.parser, res, "display"); + return res; + }, + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder +}); + +// alignat environment is like an align environment, but one must explicitly +// specify maximum number of columns in each row, and can adjust spacing between +// each columns. +(0, _defineEnvironment2.default)({ + type: "array", + names: ["alignedat"], + // One for numbered and for unnumbered; + // but, KaTeX doesn't supports math numbering yet, + // they make no difference for now. + props: { + numArgs: 1 + }, + handler: alignedHandler, + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder }); -},{"./ParseError":6,"./fontMetrics":17,"./parseData":21}],17:[function(require,module,exports){ -/* eslint no-unused-vars:0 */ +},{"../ParseError":84,"../ParseNode":85,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineEnvironment":95,"../mathMLTree":121,"../stretchy":123,"../units":127,"../utils":128}],101:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _unicodeRegexes = require("./unicodeRegexes"); -var Style = require("./Style"); -var cjkRegex = require("./unicodeRegexes").cjkRegex; +var _fontMetricsData = require("./fontMetricsData"); + +var _fontMetricsData2 = _interopRequireDefault(_fontMetricsData); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * This file contains metrics regarding fonts and individual symbols. The sigma @@ -5111,117 +7927,85 @@ var cjkRegex = require("./unicodeRegexes").cjkRegex; * `metrics` variable and the getCharacterMetrics function. */ -// These font metrics are extracted from TeX by using -// \font\a=cmmi10 -// \showthe\fontdimenX\a -// where X is the corresponding variable number. These correspond to the font -// parameters of the symbol fonts. In TeX, there are actually three sets of -// dimensions, one for each of textstyle, scriptstyle, and scriptscriptstyle, -// but we only use the textstyle ones, and scale certain dimensions accordingly. -// See the TeXbook, page 441. -var sigma1 = 0.025; -var sigma2 = 0; -var sigma3 = 0; -var sigma4 = 0; -var sigma5 = 0.431; -var sigma6 = 1; -var sigma7 = 0; -var sigma8 = 0.677; -var sigma9 = 0.394; -var sigma10 = 0.444; -var sigma11 = 0.686; -var sigma12 = 0.345; -var sigma13 = 0.413; -var sigma14 = 0.363; -var sigma15 = 0.289; -var sigma16 = 0.150; -var sigma17 = 0.247; -var sigma18 = 0.386; -var sigma19 = 0.050; -var sigma20 = 2.390; -var sigma21 = 1.01; -var sigma21Script = 0.81; -var sigma21ScriptScript = 0.71; -var sigma22 = 0.250; - -// These font metrics are extracted from TeX by using -// \font\a=cmex10 -// \showthe\fontdimenX\a -// where X is the corresponding variable number. These correspond to the font -// parameters of the extension fonts (family 3). See the TeXbook, page 441. -var xi1 = 0; -var xi2 = 0; -var xi3 = 0; -var xi4 = 0; -var xi5 = 0.431; -var xi6 = 1; -var xi7 = 0; -var xi8 = 0.04; -var xi9 = 0.111; -var xi10 = 0.166; -var xi11 = 0.2; -var xi12 = 0.6; -var xi13 = 0.1; - -// This value determines how large a pt is, for metrics which are defined in -// terms of pts. -// This value is also used in katex.less; if you change it make sure the values -// match. -var ptPerEm = 10.0; - -// The space between adjacent `|` columns in an array definition. From -// `\showthe\doublerulesep` in LaTeX. -var doubleRuleSep = 2.0 / ptPerEm; - -/** - * This is just a mapping from common names to real metrics - */ -var metrics = { - xHeight: sigma5, - quad: sigma6, - num1: sigma8, - num2: sigma9, - num3: sigma10, - denom1: sigma11, - denom2: sigma12, - sup1: sigma13, - sup2: sigma14, - sup3: sigma15, - sub1: sigma16, - sub2: sigma17, - supDrop: sigma18, - subDrop: sigma19, - axisHeight: sigma22, - defaultRuleThickness: xi8, - bigOpSpacing1: xi9, - bigOpSpacing2: xi10, - bigOpSpacing3: xi11, - bigOpSpacing4: xi12, - bigOpSpacing5: xi13, - ptPerEm: ptPerEm, - emPerEx: sigma5 / sigma6, - doubleRuleSep: doubleRuleSep, - - // TODO(alpert): Missing parallel structure here. We should probably add - // style-specific metrics for all of these. - delim1: sigma20, - getDelim2: function(style) { - if (style.size === Style.TEXT.size) { - return sigma21; - } else if (style.size === Style.SCRIPT.size) { - return sigma21Script; - } else if (style.size === Style.SCRIPTSCRIPT.size) { - return sigma21ScriptScript; - } - throw new Error("Unexpected style size: " + style.size); - }, +// In TeX, there are actually three sets of dimensions, one for each of +// textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4: +// 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are +// provided in the the arrays below, in that order. +// +// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively. +// This was determined by running the following script: +// +// latex -interaction=nonstopmode \ +// '\documentclass{article}\usepackage{amsmath}\begin{document}' \ +// '$a$ \expandafter\show\the\textfont2' \ +// '\expandafter\show\the\scriptfont2' \ +// '\expandafter\show\the\scriptscriptfont2' \ +// '\stop' +// +// The metrics themselves were retreived using the following commands: +// +// tftopl cmsy10 +// tftopl cmsy7 +// tftopl cmsy5 +// +// The output of each of these commands is quite lengthy. The only part we +// care about is the FONTDIMEN section. Each value is measured in EMs. +var sigmasAndXis = { + slant: [0.250, 0.250, 0.250], // sigma1 + space: [0.000, 0.000, 0.000], // sigma2 + stretch: [0.000, 0.000, 0.000], // sigma3 + shrink: [0.000, 0.000, 0.000], // sigma4 + xHeight: [0.431, 0.431, 0.431], // sigma5 + quad: [1.000, 1.171, 1.472], // sigma6 + extraSpace: [0.000, 0.000, 0.000], // sigma7 + num1: [0.677, 0.732, 0.925], // sigma8 + num2: [0.394, 0.384, 0.387], // sigma9 + num3: [0.444, 0.471, 0.504], // sigma10 + denom1: [0.686, 0.752, 1.025], // sigma11 + denom2: [0.345, 0.344, 0.532], // sigma12 + sup1: [0.413, 0.503, 0.504], // sigma13 + sup2: [0.363, 0.431, 0.404], // sigma14 + sup3: [0.289, 0.286, 0.294], // sigma15 + sub1: [0.150, 0.143, 0.200], // sigma16 + sub2: [0.247, 0.286, 0.400], // sigma17 + supDrop: [0.386, 0.353, 0.494], // sigma18 + subDrop: [0.050, 0.071, 0.100], // sigma19 + delim1: [2.390, 1.700, 1.980], // sigma20 + delim2: [1.010, 1.157, 1.420], // sigma21 + axisHeight: [0.250, 0.250, 0.250], // sigma22 + + // These font metrics are extracted from TeX by using tftopl on cmex10.tfm; + // they correspond to the font parameters of the extension fonts (family 3). + // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to + // match cmex7, we'd use cmex7.tfm values for script and scriptscript + // values. + defaultRuleThickness: [0.04, 0.049, 0.049], // xi8; cmex7: 0.049 + bigOpSpacing1: [0.111, 0.111, 0.111], // xi9 + bigOpSpacing2: [0.166, 0.166, 0.166], // xi10 + bigOpSpacing3: [0.2, 0.2, 0.2], // xi11 + bigOpSpacing4: [0.6, 0.611, 0.611], // xi12; cmex7: 0.611 + bigOpSpacing5: [0.1, 0.143, 0.143], // xi13; cmex7: 0.143 + + // The \sqrt rule width is taken from the height of the surd character. + // Since we use the same font at all sizes, this thickness doesn't scale. + sqrtRuleThickness: [0.04, 0.04, 0.04], + + // This value determines how large a pt is, for metrics which are defined + // in terms of pts. + // This value is also used in katex.less; if you change it make sure the + // values match. + ptPerEm: [10.0, 10.0, 10.0], + + // The space between adjacent `|` columns in an array definition. From + // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm. + doubleRuleSep: [0.2, 0.2, 0.2] }; // This map contains a mapping from font name and character code to character // metrics, including height, depth, italic correction, and skew (kern from the // character to the corresponding \skewchar) // This map is generated via `make metrics`. It should not be changed manually. -var metricMap = require("./fontMetricsData"); + // These are very rough approximations. We default to Times New Roman which // should have Latin-1 and Cyrillic characters, but may not depending on the @@ -5359,42 +8143,74 @@ var extraCharacterMap = { 'ь': 'a', 'э': 'e', 'ю': 'm', - 'я': 'r', + 'я': 'r' }; /** * This function is a convenience function for looking up information in the - * metricMap table. It takes a character as a string, and a style. + * metricMap table. It takes a character as a string, and a font. * * Note: the `width` property may be undefined if fontMetricsData.js wasn't * built using `Make extended_metrics`. */ -var getCharacterMetrics = function(character, style) { +var getCharacterMetrics = function getCharacterMetrics(character, font) { var ch = character.charCodeAt(0); if (character[0] in extraCharacterMap) { ch = extraCharacterMap[character[0]].charCodeAt(0); - } else if (cjkRegex.test(character[0])) { + } else if (_unicodeRegexes.cjkRegex.test(character[0])) { ch = 'M'.charCodeAt(0); } - var metrics = metricMap[style][ch]; + var metrics = _fontMetricsData2.default[font]['' + ch]; if (metrics) { return { depth: metrics[0], height: metrics[1], italic: metrics[2], skew: metrics[3], - width: metrics[4], + width: metrics[4] }; } }; -module.exports = { - metrics: metrics, - getCharacterMetrics: getCharacterMetrics, +var fontMetricsBySizeIndex = {}; + +/** + * Get the font metrics for a given size. + */ +var getFontMetrics = function getFontMetrics(size) { + var sizeIndex = void 0; + if (size >= 5) { + sizeIndex = 0; + } else if (size >= 3) { + sizeIndex = 1; + } else { + sizeIndex = 2; + } + if (!fontMetricsBySizeIndex[sizeIndex]) { + var metrics = fontMetricsBySizeIndex[sizeIndex] = { + cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18 + }; + for (var key in sigmasAndXis) { + if (sigmasAndXis.hasOwnProperty(key)) { + metrics[key] = sigmasAndXis[key][sizeIndex]; + } + } + } + return fontMetricsBySizeIndex[sizeIndex]; }; -},{"./Style":9,"./fontMetricsData":18,"./unicodeRegexes":24}],18:[function(require,module,exports){ -module.exports = { +exports.default = { + getFontMetrics: getFontMetrics, + getCharacterMetrics: getCharacterMetrics +}; + +},{"./fontMetricsData":102,"./unicodeRegexes":126}],102:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var fontMetricsData = { "AMS-Regular": { "65": [0, 0.68889, 0, 0], "66": [0, 0.68889, 0, 0], @@ -5650,7 +8466,7 @@ module.exports = { "57368": [0.25142, 0.75726, 0, 0], "57369": [0.25142, 0.75726, 0, 0], "57370": [0.13597, 0.63597, 0, 0], - "57371": [0.13597, 0.63597, 0, 0], + "57371": [0.13597, 0.63597, 0, 0] }, "Caligraphic-Regular": { "48": [0, 0.43056, 0, 0], @@ -5688,7 +8504,7 @@ module.exports = { "87": [0, 0.68333, 0.08222, 0.08334], "88": [0, 0.68333, 0.14643, 0.13889], "89": [0.09722, 0.68333, 0.08222, 0.08334], - "90": [0, 0.68333, 0.07944, 0.13889], + "90": [0, 0.68333, 0.07944, 0.13889] }, "Fraktur-Regular": { "33": [0, 0.69141, 0, 0], @@ -5781,7 +8597,7 @@ module.exports = { "58116": [0.18906, 0.47534, 0, 0], "58117": [0, 0.69141, 0, 0], "58118": [0, 0.62119, 0, 0], - "58119": [0, 0.47534, 0, 0], + "58119": [0, 0.47534, 0, 0] }, "Main-Bold": { "33": [0, 0.69444, 0, 0], @@ -6036,7 +8852,7 @@ module.exports = { "10217": [0.25, 0.75, 0, 0], "10815": [0, 0.68611, 0, 0], "10927": [0.19667, 0.69667, 0, 0], - "10928": [0.19667, 0.69667, 0, 0], + "10928": [0.19667, 0.69667, 0, 0] }, "Main-Italic": { "33": [0, 0.69444, 0.12417, 0], @@ -6156,7 +8972,7 @@ module.exports = { "8217": [0, 0.69444, 0.12417, 0], "8220": [0, 0.69444, 0.1685, 0], "8221": [0, 0.69444, 0.06961, 0], - "8463": [0, 0.68889, 0, 0], + "8463": [0, 0.68889, 0, 0] }, "Main-Regular": { "32": [0, 0, 0, 0], @@ -6437,7 +9253,7 @@ module.exports = { "10236": [0.011, 0.511, 0, 0], "10815": [0, 0.68333, 0, 0], "10927": [0.13597, 0.63597, 0, 0], - "10928": [0.13597, 0.63597, 0, 0], + "10928": [0.13597, 0.63597, 0, 0] }, "Math-BoldItalic": { "47": [0.19444, 0.69444, 0, 0], @@ -6533,7 +9349,7 @@ module.exports = { "981": [0.19444, 0.69444, 0, 0], "982": [0, 0.44444, 0.03194, 0], "1009": [0.19444, 0.44444, 0, 0], - "1013": [0, 0.44444, 0, 0], + "1013": [0, 0.44444, 0, 0] }, "Math-Italic": { "47": [0.19444, 0.69444, 0, 0], @@ -6629,7 +9445,7 @@ module.exports = { "981": [0.19444, 0.69444, 0, 0.08334], "982": [0, 0.43056, 0.02778, 0], "1009": [0.19444, 0.43056, 0, 0.08334], - "1013": [0, 0.43056, 0, 0.05556], + "1013": [0, 0.43056, 0, 0.05556] }, "Math-Regular": { "65": [0, 0.68333, 0, 0.13889], @@ -6724,7 +9540,7 @@ module.exports = { "981": [0.19444, 0.69444, 0, 0.08334], "982": [0, 0.43056, 0.02778, 0], "1009": [0.19444, 0.43056, 0, 0.08334], - "1013": [0, 0.43056, 0, 0.05556], + "1013": [0, 0.43056, 0, 0.05556] }, "SansSerif-Regular": { "33": [0, 0.69444, 0, 0], @@ -6843,7 +9659,7 @@ module.exports = { "8216": [0, 0.69444, 0, 0], "8217": [0, 0.69444, 0, 0], "8220": [0, 0.69444, 0, 0], - "8221": [0, 0.69444, 0, 0], + "8221": [0, 0.69444, 0, 0] }, "Script-Regular": { "65": [0, 0.7, 0.22925, 0], @@ -6871,7 +9687,7 @@ module.exports = { "87": [0, 0.7, 0.27523, 0], "88": [0, 0.7, 0.26006, 0], "89": [0, 0.7, 0.2939, 0], - "90": [0, 0.7, 0.24037, 0], + "90": [0, 0.7, 0.24037, 0] }, "Size1-Regular": { "40": [0.35001, 0.85, 0, 0], @@ -6916,7 +9732,7 @@ module.exports = { "10753": [0.25001, 0.75, 0, 0], "10754": [0.25001, 0.75, 0, 0], "10756": [0.25001, 0.75, 0, 0], - "10758": [0.25001, 0.75, 0, 0], + "10758": [0.25001, 0.75, 0, 0] }, "Size2-Regular": { "40": [0.65002, 1.15, 0, 0], @@ -6953,7 +9769,7 @@ module.exports = { "10753": [0.55001, 1.05, 0, 0], "10754": [0.55001, 1.05, 0, 0], "10756": [0.55001, 1.05, 0, 0], - "10758": [0.55001, 1.05, 0, 0], + "10758": [0.55001, 1.05, 0, 0] }, "Size3-Regular": { "40": [0.95003, 1.45, 0, 0], @@ -6974,7 +9790,7 @@ module.exports = { "8970": [0.95003, 1.45, 0, 0], "8971": [0.95003, 1.45, 0, 0], "10216": [0.95003, 1.45, 0, 0], - "10217": [0.95003, 1.45, 0, 0], + "10217": [0.95003, 1.45, 0, 0] }, "Size4-Regular": { "40": [1.25003, 1.75, 0, 0], @@ -7021,7 +9837,7 @@ module.exports = { "57680": [0, 0.12, 0, 0], "57681": [0, 0.12, 0, 0], "57682": [0, 0.12, 0, 0], - "57683": [0, 0.12, 0, 0], + "57683": [0, 0.12, 0, 0] }, "Typewriter-Regular": { "33": [0, 0.61111, 0, 0], @@ -7143,553 +9959,369 @@ module.exports = { "937": [0, 0.61111, 0, 0], "2018": [0, 0.61111, 0, 0], "2019": [0, 0.61111, 0, 0], + "8216": [0, 0.61111, 0, 0], + "8217": [0, 0.61111, 0, 0], "8242": [0, 0.61111, 0, 0], - }, + "9251": [0.11111, 0.21944, 0, 0] + } }; -},{}],19:[function(require,module,exports){ -var utils = require("./utils"); -var ParseError = require("./ParseError"); +exports.default = fontMetricsData; -/* This file contains a list of functions that we parse, identified by - * the calls to defineFunction. - * - * The first argument to defineFunction is a single name or a list of names. - * All functions named in such a list will share a single implementation. - * - * Each declared function can have associated properties, which - * include the following: - * - * - numArgs: The number of arguments the function takes. - * If this is the only property, it can be passed as a number - * instead of an element of a properties object. - * - argTypes: (optional) An array corresponding to each argument of the - * function, giving the type of argument that should be parsed. Its - * length should be equal to `numArgs + numOptionalArgs`. Valid - * types: - * - "size": A size-like thing, such as "1em" or "5ex" - * - "color": An html color, like "#abc" or "blue" - * - "original": The same type as the environment that the - * function being parsed is in (e.g. used for the - * bodies of functions like \color where the first - * argument is special and the second argument is - * parsed normally) - * Other possible types (probably shouldn't be used) - * - "text": Text-like (e.g. \text) - * - "math": Normal math - * If undefined, this will be treated as an appropriate length - * array of "original" strings - * - greediness: (optional) The greediness of the function to use ungrouped - * arguments. - * - * E.g. if you have an expression - * \sqrt \frac 1 2 - * since \frac has greediness=2 vs \sqrt's greediness=1, \frac - * will use the two arguments '1' and '2' as its two arguments, - * then that whole function will be used as the argument to - * \sqrt. On the other hand, the expressions - * \frac \frac 1 2 3 - * and - * \frac \sqrt 1 2 - * will fail because \frac and \frac have equal greediness - * and \sqrt has a lower greediness than \frac respectively. To - * make these parse, we would have to change them to: - * \frac {\frac 1 2} 3 - * and - * \frac {\sqrt 1} 2 - * - * The default value is `1` - * - allowedInText: (optional) Whether or not the function is allowed inside - * text mode (default false) - * - numOptionalArgs: (optional) The number of optional arguments the function - * should parse. If the optional arguments aren't found, - * `null` will be passed to the handler in their place. - * (default 0) - * - infix: (optional) Must be true if the function is an infix operator. - * - * The last argument is that implementation, the handler for the function(s). - * It is called to handle these functions and their arguments. - * It receives two arguments: - * - context contains information and references provided by the parser - * - args is an array of arguments obtained from TeX input - * The context contains the following properties: - * - funcName: the text (i.e. name) of the function, including \ - * - parser: the parser object - * - lexer: the lexer object - * - positions: the positions in the overall string of the function - * and the arguments. - * The latter three should only be used to produce error messages. - * - * The function should return an object with the following keys: - * - type: The type of element that this is. This is then used in - * buildHTML/buildMathML to determine which function - * should be called to build this node into a DOM node - * Any other data can be added to the object, which will be passed - * in to the function in buildHTML/buildMathML as `group.value`. - */ +},{}],103:[function(require,module,exports){ +"use strict"; -function defineFunction(names, props, handler) { - if (typeof names === "string") { - names = [names]; - } - if (typeof props === "number") { - props = { numArgs: props }; - } - // Set default values of functions - var data = { - numArgs: props.numArgs, - argTypes: props.argTypes, - greediness: (props.greediness === undefined) ? 1 : props.greediness, - allowedInText: !!props.allowedInText, - numOptionalArgs: props.numOptionalArgs || 0, - infix: !!props.infix, - handler: handler, - }; - for (var i = 0; i < names.length; ++i) { - module.exports[names[i]] = data; - } -} +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _utils = require("./utils"); + +var _utils2 = _interopRequireDefault(_utils); + +var _ParseError = require("./ParseError"); + +var _ParseError2 = _interopRequireDefault(_ParseError); + +var _ParseNode = require("./ParseNode"); + +var _ParseNode2 = _interopRequireDefault(_ParseNode); + +var _defineFunction2 = require("./defineFunction"); + +var _defineFunction3 = _interopRequireDefault(_defineFunction2); + +require("./functions/color"); + +require("./functions/text"); + +require("./functions/overline"); + +require("./functions/underline"); + +require("./functions/rule"); + +require("./functions/kern"); + +require("./functions/phantom"); + +require("./functions/mod"); + +require("./functions/op"); + +require("./functions/operatorname"); + +require("./functions/genfrac"); + +require("./functions/lap"); + +require("./functions/smash"); + +require("./functions/delimsizing"); + +require("./functions/href"); + +require("./functions/mathchoice"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// WARNING: New functions should be added to src/functions and imported here. + +/** Include this to ensure that all functions are defined. */ +var functions = _defineFunction2._functions; +exports.default = functions; + +// Define a convenience function that mimcs the old semantics of defineFunction +// to support existing code so that we can migrate it a little bit at a time. + +var defineFunction = function defineFunction(names, props, handler) // null only if handled in parser +{ + (0, _defineFunction3.default)({ names: names, props: props, handler: handler }); +}; // A normal square root -defineFunction("\\sqrt", { +defineFunction(["\\sqrt"], { numArgs: 1, - numOptionalArgs: 1, -}, function(context, args) { - var index = args[0]; - var body = args[1]; + numOptionalArgs: 1 +}, function (context, args, optArgs) { + var index = optArgs[0]; + var body = args[0]; return { type: "sqrt", body: body, - index: index, + index: index }; }); -// Some non-mathy text -defineFunction("\\text", { +// \color is handled in Parser.js's parseImplicitGroup +defineFunction(["\\color"], { numArgs: 1, - argTypes: ["text"], - greediness: 2, -}, function(context, args) { - var body = args[0]; - // Since the corresponding buildHTML/buildMathML function expects a - // list of elements, we normalize for different kinds of arguments - // TODO(emily): maybe this should be done somewhere else - var inner; - if (body.type === "ordgroup") { - inner = body.value; - } else { - inner = [body]; - } + allowedInText: true, + greediness: 3, + argTypes: ["color"] +}, null); - return { - type: "text", - body: inner, - }; -}); - -// A two-argument custom color -defineFunction("\\color", { +// colorbox +defineFunction(["\\colorbox"], { numArgs: 2, allowedInText: true, greediness: 3, - argTypes: ["color", "original"], -}, function(context, args) { + argTypes: ["color", "text"] +}, function (context, args) { var color = args[0]; var body = args[1]; - // Normalize the different kinds of bodies (see \text above) - var inner; - if (body.type === "ordgroup") { - inner = body.value; - } else { - inner = [body]; - } - return { - type: "color", - color: color.value, - value: inner, + type: "enclose", + label: context.funcName, + backgroundColor: color, + body: body }; }); -// An overline -defineFunction("\\overline", { - numArgs: 1, -}, function(context, args) { - var body = args[0]; +// fcolorbox +defineFunction(["\\fcolorbox"], { + numArgs: 3, + allowedInText: true, + greediness: 3, + argTypes: ["color", "color", "text"] +}, function (context, args) { + var borderColor = args[0]; + var backgroundColor = args[1]; + var body = args[2]; return { - type: "overline", - body: body, + type: "enclose", + label: context.funcName, + backgroundColor: backgroundColor, + borderColor: borderColor, + body: body }; }); -// An underline -defineFunction("\\underline", { - numArgs: 1, -}, function(context, args) { +// Math class commands except \mathop +defineFunction(["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], { + numArgs: 1 +}, function (context, args) { var body = args[0]; return { - type: "underline", - body: body, - }; -}); - -// A box of the width and height -defineFunction("\\rule", { - numArgs: 2, - numOptionalArgs: 1, - argTypes: ["size", "size", "size"], -}, function(context, args) { - var shift = args[0]; - var width = args[1]; - var height = args[2]; - return { - type: "rule", - shift: shift && shift.value, - width: width.value, - height: height.value, + type: "mclass", + mclass: "m" + context.funcName.substr(5), + value: (0, _defineFunction2.ordargument)(body) }; }); -defineFunction("\\kern", { - numArgs: 1, - argTypes: ["size"], -}, function(context, args) { - return { - type: "kern", - dimension: args[0].value, - }; -}); +// Build a relation by placing one symbol on top of another +defineFunction(["\\stackrel"], { + numArgs: 2 +}, function (context, args) { + var top = args[0]; + var bottom = args[1]; -// A KaTeX logo -defineFunction("\\KaTeX", { - numArgs: 0, -}, function(context) { - return { - type: "katex", - }; -}); + var bottomop = new _ParseNode2.default("op", { + type: "op", + limits: true, + alwaysHandleSupSub: true, + symbol: false, + value: (0, _defineFunction2.ordargument)(bottom) + }, bottom.mode); -defineFunction("\\phantom", { - numArgs: 1, -}, function(context, args) { - var body = args[0]; - var inner; - if (body.type === "ordgroup") { - inner = body.value; - } else { - inner = [body]; - } + var supsub = new _ParseNode2.default("supsub", { + base: bottomop, + sup: top, + sub: null + }, top.mode); return { - type: "phantom", - value: inner, + type: "mclass", + mclass: "mrel", + value: [supsub] }; }); -// Extra data needed for the delimiter handler down below -var delimiterSizes = { - "\\bigl" : {type: "open", size: 1}, - "\\Bigl" : {type: "open", size: 2}, - "\\biggl": {type: "open", size: 3}, - "\\Biggl": {type: "open", size: 4}, - "\\bigr" : {type: "close", size: 1}, - "\\Bigr" : {type: "close", size: 2}, - "\\biggr": {type: "close", size: 3}, - "\\Biggr": {type: "close", size: 4}, - "\\bigm" : {type: "rel", size: 1}, - "\\Bigm" : {type: "rel", size: 2}, - "\\biggm": {type: "rel", size: 3}, - "\\Biggm": {type: "rel", size: 4}, - "\\big" : {type: "textord", size: 1}, - "\\Big" : {type: "textord", size: 2}, - "\\bigg" : {type: "textord", size: 3}, - "\\Bigg" : {type: "textord", size: 4}, -}; - -var delimiters = [ - "(", ")", "[", "\\lbrack", "]", "\\rbrack", - "\\{", "\\lbrace", "\\}", "\\rbrace", - "\\lfloor", "\\rfloor", "\\lceil", "\\rceil", - "<", ">", "\\langle", "\\rangle", "\\lt", "\\gt", - "\\lvert", "\\rvert", "\\lVert", "\\rVert", - "\\lgroup", "\\rgroup", "\\lmoustache", "\\rmoustache", - "/", "\\backslash", - "|", "\\vert", "\\|", "\\Vert", - "\\uparrow", "\\Uparrow", - "\\downarrow", "\\Downarrow", - "\\updownarrow", "\\Updownarrow", - ".", -]; - var fontAliases = { "\\Bbb": "\\mathbb", "\\bold": "\\mathbf", - "\\frak": "\\mathfrak", + "\\frak": "\\mathfrak" }; -// Single-argument color functions -defineFunction([ - "\\blue", "\\orange", "\\pink", "\\red", - "\\green", "\\gray", "\\purple", - "\\blueA", "\\blueB", "\\blueC", "\\blueD", "\\blueE", - "\\tealA", "\\tealB", "\\tealC", "\\tealD", "\\tealE", - "\\greenA", "\\greenB", "\\greenC", "\\greenD", "\\greenE", - "\\goldA", "\\goldB", "\\goldC", "\\goldD", "\\goldE", - "\\redA", "\\redB", "\\redC", "\\redD", "\\redE", - "\\maroonA", "\\maroonB", "\\maroonC", "\\maroonD", "\\maroonE", - "\\purpleA", "\\purpleB", "\\purpleC", "\\purpleD", "\\purpleE", - "\\mintA", "\\mintB", "\\mintC", - "\\grayA", "\\grayB", "\\grayC", "\\grayD", "\\grayE", - "\\grayF", "\\grayG", "\\grayH", "\\grayI", - "\\kaBlue", "\\kaGreen", -], { - numArgs: 1, - allowedInText: true, - greediness: 3, -}, function(context, args) { - var body = args[0]; - var atoms; - if (body.type === "ordgroup") { - atoms = body.value; - } else { - atoms = [body]; - } - - return { - type: "color", - color: "katex-" + context.funcName.slice(1), - value: atoms, - }; -}); +var singleCharIntegrals = { + "\u222B": "\\int", + "\u222C": "\\iint", + "\u222D": "\\iiint", + "\u222E": "\\oint" +}; // There are 2 flags for operators; whether they produce limits in // displaystyle, and whether they are symbols and should grow in // displaystyle. These four groups cover the four possible choices. // No limits, not symbols -defineFunction([ - "\\arcsin", "\\arccos", "\\arctan", "\\arg", "\\cos", "\\cosh", - "\\cot", "\\coth", "\\csc", "\\deg", "\\dim", "\\exp", "\\hom", - "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", - "\\tan", "\\tanh", -], { - numArgs: 0, -}, function(context) { +defineFunction(["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"], { + numArgs: 0 +}, function (context) { return { type: "op", limits: false, symbol: false, - body: context.funcName, + body: context.funcName }; }); // Limits, not symbols -defineFunction([ - "\\det", "\\gcd", "\\inf", "\\lim", "\\liminf", "\\limsup", "\\max", - "\\min", "\\Pr", "\\sup", -], { - numArgs: 0, -}, function(context) { +defineFunction(["\\det", "\\gcd", "\\inf", "\\lim", "\\liminf", "\\limsup", "\\max", "\\min", "\\Pr", "\\sup"], { + numArgs: 0 +}, function (context) { return { type: "op", limits: true, symbol: false, - body: context.funcName, + body: context.funcName }; }); // No limits, symbols -defineFunction([ - "\\int", "\\iint", "\\iiint", "\\oint", -], { - numArgs: 0, -}, function(context) { +defineFunction(["\\int", "\\iint", "\\iiint", "\\oint", "\u222B", "\u222C", "\u222D", "\u222E"], { + numArgs: 0 +}, function (context) { + var fName = context.funcName; + if (fName.length === 1) { + fName = singleCharIntegrals[fName]; + } return { type: "op", limits: false, symbol: true, - body: context.funcName, + body: fName }; }); -// Limits, symbols +// Sizing functions (handled in Parser.js explicitly, hence no handler) +defineFunction(["\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"], { numArgs: 0 }, null); + +// Style changing functions (handled in Parser.js explicitly, hence no +// handler) +defineFunction(["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], { numArgs: 0 }, null); + +// Old font changing functions +defineFunction(["\\rm", "\\sf", "\\tt", "\\bf", "\\it"], { numArgs: 0 }, null); + defineFunction([ - "\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", - "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", - "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", -], { - numArgs: 0, -}, function(context) { +// styles +"\\mathrm", "\\mathit", "\\mathbf", + +// families +"\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt", + +// aliases +"\\Bbb", "\\bold", "\\frak"], { + numArgs: 1, + greediness: 2 +}, function (context, args) { + var body = args[0]; + var func = context.funcName; + if (func in fontAliases) { + func = fontAliases[func]; + } return { - type: "op", - limits: true, - symbol: true, - body: context.funcName, + type: "font", + font: func.slice(1), + body: body }; }); -// Fractions -defineFunction([ - "\\dfrac", "\\frac", "\\tfrac", - "\\dbinom", "\\binom", "\\tbinom", -], { - numArgs: 2, - greediness: 2, -}, function(context, args) { - var numer = args[0]; - var denom = args[1]; - var hasBarLine; - var leftDelim = null; - var rightDelim = null; - var size = "auto"; +// Accents +defineFunction(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"], { + numArgs: 1 +}, function (context, args) { + var base = args[0]; - switch (context.funcName) { - case "\\dfrac": - case "\\frac": - case "\\tfrac": - hasBarLine = true; - break; - case "\\dbinom": - case "\\binom": - case "\\tbinom": - hasBarLine = false; - leftDelim = "("; - rightDelim = ")"; - break; - default: - throw new Error("Unrecognized genfrac command"); - } + var isStretchy = !_utils2.default.contains(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot"], context.funcName); - switch (context.funcName) { - case "\\dfrac": - case "\\dbinom": - size = "display"; - break; - case "\\tfrac": - case "\\tbinom": - size = "text"; - break; - } + var isShifty = !isStretchy || _utils2.default.contains(["\\widehat", "\\widetilde"], context.funcName); return { - type: "genfrac", - numer: numer, - denom: denom, - hasBarLine: hasBarLine, - leftDelim: leftDelim, - rightDelim: rightDelim, - size: size, + type: "accent", + label: context.funcName, + isStretchy: isStretchy, + isShifty: isShifty, + base: base }; }); -// Left and right overlap functions -defineFunction(["\\llap", "\\rlap"], { +// Text-mode accents +defineFunction(["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v"], { numArgs: 1, allowedInText: true, -}, function(context, args) { - var body = args[0]; + allowedInMath: false +}, function (context, args) { + var base = args[0]; + return { - type: context.funcName.slice(1), - body: body, + type: "accent", + label: context.funcName, + isStretchy: false, + isShifty: true, + base: base }; }); -// Delimiter functions -defineFunction([ - "\\bigl", "\\Bigl", "\\biggl", "\\Biggl", - "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", - "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", - "\\big", "\\Big", "\\bigg", "\\Bigg", - "\\left", "\\right", -], { - numArgs: 1, -}, function(context, args) { - var delim = args[0]; - if (!utils.contains(delimiters, delim.value)) { - throw new ParseError( - "Invalid delimiter: '" + delim.value + "' after '" + - context.funcName + "'", delim); - } - - // \left and \right are caught somewhere in Parser.js, which is - // why this data doesn't match what is in buildHTML. - if (context.funcName === "\\left" || context.funcName === "\\right") { - return { - type: "leftright", - value: delim.value, - }; - } else { - return { - type: "delimsizing", - size: delimiterSizes[context.funcName].size, - delimType: delimiterSizes[context.funcName].type, - value: delim.value, - }; - } +// Horizontal stretchy braces +defineFunction(["\\overbrace", "\\underbrace"], { + numArgs: 1 +}, function (context, args) { + var base = args[0]; + return { + type: "horizBrace", + label: context.funcName, + isOver: /^\\over/.test(context.funcName), + base: base + }; }); -// Sizing functions (handled in Parser.js explicitly, hence no handler) -defineFunction([ - "\\tiny", "\\scriptsize", "\\footnotesize", "\\small", - "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge", -], 0, null); - -// Style changing functions (handled in Parser.js explicitly, hence no -// handler) -defineFunction([ - "\\displaystyle", "\\textstyle", "\\scriptstyle", - "\\scriptscriptstyle", -], 0, null); - -defineFunction([ - // styles - "\\mathrm", "\\mathit", "\\mathbf", - - // families - "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", - "\\mathtt", +// Stretchy accents under the body +defineFunction(["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"], { + numArgs: 1 +}, function (context, args) { + var base = args[0]; + return { + type: "accentUnder", + label: context.funcName, + base: base + }; +}); - // aliases - "\\Bbb", "\\bold", "\\frak", -], { +// Stretchy arrows with an optional argument +defineFunction(["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom"], { numArgs: 1, - greediness: 2, -}, function(context, args) { + numOptionalArgs: 1 +}, function (context, args, optArgs) { + var below = optArgs[0]; var body = args[0]; - var func = context.funcName; - if (func in fontAliases) { - func = fontAliases[func]; - } return { - type: "font", - font: func.slice(1), + type: "xArrow", // x for extensible + label: context.funcName, body: body, + below: below }; }); -// Accents -defineFunction([ - "\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", - "\\check", "\\hat", "\\vec", "\\dot", - // We don't support expanding accents yet - // "\\widetilde", "\\widehat" -], { - numArgs: 1, -}, function(context, args) { - var base = args[0]; +// enclose +defineFunction(["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\fbox"], { + numArgs: 1 +}, function (context, args) { + var body = args[0]; return { - type: "accent", - accent: context.funcName, - base: base, + type: "enclose", + label: context.funcName, + body: body }; }); // Infix generalized fractions -defineFunction(["\\over", "\\choose"], { +defineFunction(["\\over", "\\choose", "\\atop"], { numArgs: 0, - infix: true, -}, function(context) { - var replaceWith; + infix: true +}, function (context) { + var replaceWith = void 0; switch (context.funcName) { case "\\over": replaceWith = "\\frac"; @@ -7697,50 +10329,2547 @@ defineFunction(["\\over", "\\choose"], { case "\\choose": replaceWith = "\\binom"; break; + case "\\atop": + replaceWith = "\\\\atopfrac"; + break; default: throw new Error("Unrecognized infix genfrac command"); } return { type: "infix", replaceWith: replaceWith, - token: context.token, + token: context.token + }; +}); + +// Row breaks for aligned data +defineFunction(["\\\\", "\\cr"], { + numArgs: 0, + numOptionalArgs: 1, + argTypes: ["size"] +}, function (context, args, optArgs) { + var size = optArgs[0]; + return { + type: "cr", + size: size + }; +}); + +// Environment delimiters +defineFunction(["\\begin", "\\end"], { + numArgs: 1, + argTypes: ["text"] +}, function (context, args) { + var nameGroup = args[0]; + if (nameGroup.type !== "ordgroup") { + throw new _ParseError2.default("Invalid environment name", nameGroup); + } + var name = ""; + for (var i = 0; i < nameGroup.value.length; ++i) { + name += nameGroup.value[i].value; + } + return { + type: "environment", + name: name, + nameGroup: nameGroup + }; +}); + +// Box manipulation +defineFunction(["\\raisebox"], { + numArgs: 2, + argTypes: ["size", "text"], + allowedInText: true +}, function (context, args) { + var amount = args[0]; + var body = args[1]; + return { + type: "raisebox", + dy: amount, + body: body, + value: (0, _defineFunction2.ordargument)(body) }; }); -// Row breaks for aligned data -defineFunction(["\\\\", "\\cr"], { - numArgs: 0, - numOptionalArgs: 1, - argTypes: ["size"], -}, function(context, args) { - var size = args[0]; - return { - type: "cr", - size: size, - }; -}); +// \verb and \verb* are dealt with directly in Parser.js. +// If we end up here, it's because of a failure to match the two delimiters +// in the regex in Lexer.js. LaTeX raises the following error when \verb is +// terminated by end of line (or file). +defineFunction(["\\verb"], { + numArgs: 0, + allowedInText: true +}, function (context) { + throw new _ParseError2.default("\\verb ended by end of line instead of matching delimiter"); +}); + +// Hyperlinks + + +// MathChoice + +},{"./ParseError":84,"./ParseNode":85,"./defineFunction":96,"./functions/color":104,"./functions/delimsizing":105,"./functions/genfrac":106,"./functions/href":107,"./functions/kern":108,"./functions/lap":109,"./functions/mathchoice":110,"./functions/mod":111,"./functions/op":112,"./functions/operatorname":113,"./functions/overline":114,"./functions/phantom":115,"./functions/rule":116,"./functions/smash":117,"./functions/text":118,"./functions/underline":119,"./utils":128}],104:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var htmlBuilder = function htmlBuilder(group, options) { + var elements = html.buildExpression(group.value.value, options.withColor(group.value.color), false); + + // \color isn't supposed to affect the type of the elements it contains. + // To accomplish this, we wrap the results in a fragment, so the inner + // elements will be able to directly interact with their neighbors. For + // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3` + return new _buildCommon2.default.makeFragment(elements); +}; + + +var mathmlBuilder = function mathmlBuilder(group, options) { + var inner = mml.buildExpression(group.value.value, options); + + var node = new _mathMLTree2.default.MathNode("mstyle", inner); + + node.setAttribute("mathcolor", group.value.color); + + return node; +}; + +(0, _defineFunction2.default)({ + type: "color", + names: ["\\textcolor"], + props: { + numArgs: 2, + allowedInText: true, + greediness: 3, + argTypes: ["color", "original"] + }, + handler: function handler(context, args) { + var color = args[0]; + var body = args[1]; + return { + type: "color", + color: color.value, + value: (0, _defineFunction.ordargument)(body) + }; + }, + + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder +}); + +// TODO(kevinb): define these using macros +(0, _defineFunction2.default)({ + type: "color", + names: ["\\blue", "\\orange", "\\pink", "\\red", "\\green", "\\gray", "\\purple", "\\blueA", "\\blueB", "\\blueC", "\\blueD", "\\blueE", "\\tealA", "\\tealB", "\\tealC", "\\tealD", "\\tealE", "\\greenA", "\\greenB", "\\greenC", "\\greenD", "\\greenE", "\\goldA", "\\goldB", "\\goldC", "\\goldD", "\\goldE", "\\redA", "\\redB", "\\redC", "\\redD", "\\redE", "\\maroonA", "\\maroonB", "\\maroonC", "\\maroonD", "\\maroonE", "\\purpleA", "\\purpleB", "\\purpleC", "\\purpleD", "\\purpleE", "\\mintA", "\\mintB", "\\mintC", "\\grayA", "\\grayB", "\\grayC", "\\grayD", "\\grayE", "\\grayF", "\\grayG", "\\grayH", "\\grayI", "\\kaBlue", "\\kaGreen"], + props: { + numArgs: 1, + allowedInText: true, + greediness: 3 + }, + handler: function handler(context, args) { + var body = args[0]; + return { + type: "color", + color: "katex-" + context.funcName.slice(1), + value: (0, _defineFunction.ordargument)(body) + }; + }, + + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder +}); + +},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],105:[function(require,module,exports){ +"use strict"; + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _delimiter = require("../delimiter"); + +var _delimiter2 = _interopRequireDefault(_delimiter); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _ParseError = require("../ParseError"); + +var _ParseError2 = _interopRequireDefault(_ParseError); + +var _utils = require("../utils"); + +var _utils2 = _interopRequireDefault(_utils); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// Extra data needed for the delimiter handler down below +var delimiterSizes = { + "\\bigl": { mclass: "mopen", size: 1 }, + "\\Bigl": { mclass: "mopen", size: 2 }, + "\\biggl": { mclass: "mopen", size: 3 }, + "\\Biggl": { mclass: "mopen", size: 4 }, + "\\bigr": { mclass: "mclose", size: 1 }, + "\\Bigr": { mclass: "mclose", size: 2 }, + "\\biggr": { mclass: "mclose", size: 3 }, + "\\Biggr": { mclass: "mclose", size: 4 }, + "\\bigm": { mclass: "mrel", size: 1 }, + "\\Bigm": { mclass: "mrel", size: 2 }, + "\\biggm": { mclass: "mrel", size: 3 }, + "\\Biggm": { mclass: "mrel", size: 4 }, + "\\big": { mclass: "mord", size: 1 }, + "\\Big": { mclass: "mord", size: 2 }, + "\\bigg": { mclass: "mord", size: 3 }, + "\\Bigg": { mclass: "mord", size: 4 } +}; + +var delimiters = ["(", ")", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\\lceil", "\\rceil", "<", ">", "\\langle", "\\rangle", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\\lmoustache", "\\rmoustache", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]; + +// Delimiter functions +function checkDelimiter(delim, context) { + if (_utils2.default.contains(delimiters, delim.value)) { + return delim; + } else { + throw new _ParseError2.default("Invalid delimiter: '" + delim.value + "' after '" + context.funcName + "'", delim); + } +} + +(0, _defineFunction2.default)({ + type: "delimsizing", + names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var delim = checkDelimiter(args[0], context); + + return { + type: "delimsizing", + size: delimiterSizes[context.funcName].size, + mclass: delimiterSizes[context.funcName].mclass, + value: delim.value + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var delim = group.value.value; + + if (delim === ".") { + // Empty delimiters still count as elements, even though they don't + // show anything. + return _buildCommon2.default.makeSpan([group.value.mclass]); + } + + // Use delimiter.sizedDelim to generate the delimiter. + return _delimiter2.default.sizedDelim(delim, group.value.size, options, group.mode, [group.value.mclass]); + }, + mathmlBuilder: function mathmlBuilder(group) { + var children = []; + + if (group.value.value !== ".") { + children.push(mml.makeText(group.value.value, group.mode)); + } + + var node = new _mathMLTree2.default.MathNode("mo", children); + + if (group.value.mclass === "mopen" || group.value.mclass === "mclose") { + // Only some of the delimsizing functions act as fences, and they + // return "mopen" or "mclose" mclass. + node.setAttribute("fence", "true"); + } else { + // Explicitly disable fencing if it's not a fence, to override the + // defaults. + node.setAttribute("fence", "false"); + } + + return node; + } +}); + +(0, _defineFunction2.default)({ + type: "leftright", + names: ["\\left", "\\right"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var delim = checkDelimiter(args[0], context); + + // \left and \right are caught somewhere in Parser.js, which is + // why this data doesn't match what is in buildHTML. + return { + type: "leftright", + value: delim.value + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Build the inner expression + var inner = html.buildExpression(group.value.body, options, true); + + var innerHeight = 0; + var innerDepth = 0; + var hadMiddle = false; + + // Calculate its height and depth + for (var i = 0; i < inner.length; i++) { + if (inner[i].isMiddle) { + hadMiddle = true; + } else { + innerHeight = Math.max(inner[i].height, innerHeight); + innerDepth = Math.max(inner[i].depth, innerDepth); + } + } + + // The size of delimiters is the same, regardless of what style we are + // in. Thus, to correctly calculate the size of delimiter we need around + // a group, we scale down the inner size based on the size. + innerHeight *= options.sizeMultiplier; + innerDepth *= options.sizeMultiplier; + + var leftDelim = void 0; + if (group.value.left === ".") { + // Empty delimiters in \left and \right make null delimiter spaces. + leftDelim = html.makeNullDelimiter(options, ["mopen"]); + } else { + // Otherwise, use leftRightDelim to generate the correct sized + // delimiter. + leftDelim = _delimiter2.default.leftRightDelim(group.value.left, innerHeight, innerDepth, options, group.mode, ["mopen"]); + } + // Add it to the beginning of the expression + inner.unshift(leftDelim); + + // Handle middle delimiters + if (hadMiddle) { + for (var _i = 1; _i < inner.length; _i++) { + var middleDelim = inner[_i]; + if (middleDelim.isMiddle) { + // Apply the options that were active when \middle was called + inner[_i] = _delimiter2.default.leftRightDelim(middleDelim.isMiddle.value, innerHeight, innerDepth, middleDelim.isMiddle.options, group.mode, []); + // Add back spaces shifted into the delimiter + var spaces = html.spliceSpaces(middleDelim.children, 0); + if (spaces) { + _buildCommon2.default.prependChildren(inner[_i], spaces); + } + } + } + } + + var rightDelim = void 0; + // Same for the right delimiter + if (group.value.right === ".") { + rightDelim = html.makeNullDelimiter(options, ["mclose"]); + } else { + rightDelim = _delimiter2.default.leftRightDelim(group.value.right, innerHeight, innerDepth, options, group.mode, ["mclose"]); + } + // Add it to the end of the expression. + inner.push(rightDelim); + + return _buildCommon2.default.makeSpan(["minner"], inner, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var inner = mml.buildExpression(group.value.body, options); + + if (group.value.left !== ".") { + var leftNode = new _mathMLTree2.default.MathNode("mo", [mml.makeText(group.value.left, group.mode)]); + + leftNode.setAttribute("fence", "true"); + + inner.unshift(leftNode); + } + + if (group.value.right !== ".") { + var rightNode = new _mathMLTree2.default.MathNode("mo", [mml.makeText(group.value.right, group.mode)]); + + rightNode.setAttribute("fence", "true"); + + inner.push(rightNode); + } + + var outerNode = new _mathMLTree2.default.MathNode("mrow", inner); + + return outerNode; + } +}); + +(0, _defineFunction2.default)({ + type: "middle", + names: ["\\middle"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var delim = checkDelimiter(args[0], context); + if (!context.parser.leftrightDepth) { + throw new _ParseError2.default("\\middle without preceding \\left", delim); + } + + return { + type: "middle", + value: delim.value + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var middleDelim = void 0; + if (group.value.value === ".") { + middleDelim = html.makeNullDelimiter(options, []); + } else { + middleDelim = _delimiter2.default.sizedDelim(group.value.value, 1, options, group.mode, []); + middleDelim.isMiddle = { value: group.value.value, options: options }; + } + return middleDelim; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var middleNode = new _mathMLTree2.default.MathNode("mo", [mml.makeText(group.value.middle, group.mode)]); + middleNode.setAttribute("fence", "true"); + return middleNode; + } +}); + +},{"../ParseError":84,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../delimiter":97,"../mathMLTree":121,"../utils":128}],106:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _delimiter = require("../delimiter"); + +var _delimiter2 = _interopRequireDefault(_delimiter); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _Style = require("../Style"); + +var _Style2 = _interopRequireDefault(_Style); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _defineFunction2.default)({ + type: "genfrac", + names: ["\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac"], + props: { + numArgs: 2, + greediness: 2 + }, + handler: function handler(context, args) { + var numer = args[0]; + var denom = args[1]; + var hasBarLine = void 0; + var leftDelim = null; + var rightDelim = null; + var size = "auto"; + + switch (context.funcName) { + case "\\dfrac": + case "\\frac": + case "\\tfrac": + hasBarLine = true; + break; + case "\\\\atopfrac": + hasBarLine = false; + break; + case "\\dbinom": + case "\\binom": + case "\\tbinom": + hasBarLine = false; + leftDelim = "("; + rightDelim = ")"; + break; + default: + throw new Error("Unrecognized genfrac command"); + } + + switch (context.funcName) { + case "\\dfrac": + case "\\dbinom": + size = "display"; + break; + case "\\tfrac": + case "\\tbinom": + size = "text"; + break; + } + + return { + type: "genfrac", + numer: numer, + denom: denom, + hasBarLine: hasBarLine, + leftDelim: leftDelim, + rightDelim: rightDelim, + size: size + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e). + // Figure out what style this fraction should be in based on the + // function used + var style = options.style; + if (group.value.size === "display") { + style = _Style2.default.DISPLAY; + } else if (group.value.size === "text") { + style = _Style2.default.TEXT; + } + + var nstyle = style.fracNum(); + var dstyle = style.fracDen(); + var newOptions = void 0; + + newOptions = options.havingStyle(nstyle); + var numerm = html.buildGroup(group.value.numer, newOptions, options); + + newOptions = options.havingStyle(dstyle); + var denomm = html.buildGroup(group.value.denom, newOptions, options); + + var rule = void 0; + var ruleWidth = void 0; + var ruleSpacing = void 0; + if (group.value.hasBarLine) { + rule = _buildCommon2.default.makeLineSpan("frac-line", options); + ruleWidth = rule.height; + ruleSpacing = rule.height; + } else { + rule = null; + ruleWidth = 0; + ruleSpacing = options.fontMetrics().defaultRuleThickness; + } + + // Rule 15b + var numShift = void 0; + var clearance = void 0; + var denomShift = void 0; + if (style.size === _Style2.default.DISPLAY.size) { + numShift = options.fontMetrics().num1; + if (ruleWidth > 0) { + clearance = 3 * ruleSpacing; + } else { + clearance = 7 * ruleSpacing; + } + denomShift = options.fontMetrics().denom1; + } else { + if (ruleWidth > 0) { + numShift = options.fontMetrics().num2; + clearance = ruleSpacing; + } else { + numShift = options.fontMetrics().num3; + clearance = 3 * ruleSpacing; + } + denomShift = options.fontMetrics().denom2; + } + + var frac = void 0; + if (ruleWidth === 0) { + // Rule 15c + var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift); + if (candidateClearance < clearance) { + numShift += 0.5 * (clearance - candidateClearance); + denomShift += 0.5 * (clearance - candidateClearance); + } + + frac = _buildCommon2.default.makeVList({ + positionType: "individualShift", + children: [{ type: "elem", elem: denomm, shift: denomShift }, { type: "elem", elem: numerm, shift: -numShift }] + }, options); + } else { + // Rule 15d + var axisHeight = options.fontMetrics().axisHeight; + + if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) { + numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth)); + } + + if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) { + denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift)); + } + + var midShift = -(axisHeight - 0.5 * ruleWidth); + + frac = _buildCommon2.default.makeVList({ + positionType: "individualShift", + children: [{ type: "elem", elem: denomm, shift: denomShift }, + // $FlowFixMe `rule` cannot be `null` here. + { type: "elem", elem: rule, shift: midShift }, { type: "elem", elem: numerm, shift: -numShift }] + }, options); + } + + // Since we manually change the style sometimes (with \dfrac or \tfrac), + // account for the possible size change here. + newOptions = options.havingStyle(style); + frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier; + frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; + + // Rule 15e + var delimSize = void 0; + if (style.size === _Style2.default.DISPLAY.size) { + delimSize = options.fontMetrics().delim1; + } else { + delimSize = options.fontMetrics().delim2; + } + + var leftDelim = void 0; + var rightDelim = void 0; + if (group.value.leftDelim == null) { + leftDelim = html.makeNullDelimiter(options, ["mopen"]); + } else { + leftDelim = _delimiter2.default.customSizedDelim(group.value.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]); + } + if (group.value.rightDelim == null) { + rightDelim = html.makeNullDelimiter(options, ["mclose"]); + } else { + rightDelim = _delimiter2.default.customSizedDelim(group.value.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]); + } + + return _buildCommon2.default.makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, _buildCommon2.default.makeSpan(["mfrac"], [frac]), rightDelim], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new _mathMLTree2.default.MathNode("mfrac", [mml.buildGroup(group.value.numer, options), mml.buildGroup(group.value.denom, options)]); + + if (!group.value.hasBarLine) { + node.setAttribute("linethickness", "0px"); + } + + if (group.value.leftDelim != null || group.value.rightDelim != null) { + var withDelims = []; + + if (group.value.leftDelim != null) { + var leftOp = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode(group.value.leftDelim)]); + + leftOp.setAttribute("fence", "true"); + + withDelims.push(leftOp); + } + + withDelims.push(node); + + if (group.value.rightDelim != null) { + var rightOp = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode(group.value.rightDelim)]); + + rightOp.setAttribute("fence", "true"); + + withDelims.push(rightOp); + } + + var outerNode = new _mathMLTree2.default.MathNode("mrow", withDelims); + + return outerNode; + } + + return node; + } +}); + +},{"../Style":89,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../delimiter":97,"../mathMLTree":121}],107:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _defineFunction2.default)({ + type: "href", + names: ["\\href"], + props: { + numArgs: 2, + argTypes: ["url", "original"] + }, + handler: function handler(context, args) { + var body = args[1]; + var href = args[0].value; + return { + type: "href", + href: href, + body: (0, _defineFunction.ordargument)(body) + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var elements = html.buildExpression(group.value.body, options, false); + + var href = group.value.href; + + /** + * Determining class for anchors. + * 1. if it has the only element, use its class; + * 2. if it has more than two elements, and the classes + * of its first and last elements coincide, then use it; + * 3. otherwise, we will inject an empty s at both ends, + * with the same classes of both ends of elements, with the + * first span having the same class as the first element of body, + * and the second one the same as the last. + */ + + var classes = []; // Default behaviour for Case 3. + var first = void 0; // mathtype of the first child + var last = void 0; // mathtype of the last child + // Invariants: both first and last must be non-null if classes is null. + if (elements.length === 1) { + // Case 1 + classes = elements[0].classes; + } else if (elements.length >= 2) { + first = html.getTypeOfDomTree(elements[0]) || 'mord'; + last = html.getTypeOfDomTree(elements[elements.length - 1]) || 'mord'; + if (first === last) { + // Case 2 : type of both ends coincides + classes = [first]; + } else { + // Case 3: both ends have different types. + var anc = _buildCommon2.default.makeAnchor(href, [], elements, options); + return new _buildCommon2.default.makeFragment([new _buildCommon2.default.makeSpan([first], [], options), anc, new _buildCommon2.default.makeSpan([last], [], options)]); + } + } + return new _buildCommon2.default.makeAnchor(href, classes, elements, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var inner = mml.buildExpression(group.value.body, options); + var math = new _mathMLTree2.default.MathNode("mrow", inner); + math.setAttribute("href", group.value.href); + return math; + } +}); + +},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],108:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _units = require("../units"); + +var _ParseError = require("../ParseError"); + +var _ParseError2 = _interopRequireDefault(_ParseError); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// TODO: \hskip and \mskip should support plus and minus in lengths + +(0, _defineFunction2.default)({ + type: "kern", + names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"], + props: { + numArgs: 1, + argTypes: ["size"], + allowedInText: true + }, + handler: function handler(context, args) { + var mathFunction = context.funcName[1] === 'm'; // \mkern, \mskip + var muUnit = args[0].value.unit === 'mu'; + if (mathFunction) { + if (!muUnit) { + typeof console !== "undefined" && console.warn("In LaTeX, " + context.funcName + " supports only mu units, " + ("not " + args[0].value.unit + " units")); + } + if (context.parser.mode !== "math") { + throw new _ParseError2.default("Can't use function '" + context.funcName + "' in text mode"); + } + } else { + // !mathFunction + if (muUnit) { + typeof console !== "undefined" && console.warn("In LaTeX, " + context.funcName + " does not support mu units"); + } + } + return { + type: "kern", + dimension: args[0].value + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Make an empty span for the rule + var rule = _buildCommon2.default.makeSpan(["mord", "rule"], [], options); + + if (group.value.dimension) { + var dimension = (0, _units.calculateSize)(group.value.dimension, options); + rule.style.marginLeft = dimension + "em"; + } + + return rule; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new _mathMLTree2.default.MathNode("mspace"); + + if (group.value.dimension) { + var dimension = (0, _units.calculateSize)(group.value.dimension, options); + node.setAttribute("width", dimension + "em"); + } + + return node; + } +}); +/* eslint no-console:0 */ +// Horizontal spacing commands + +},{"../ParseError":84,"../buildCommon":91,"../defineFunction":96,"../mathMLTree":121,"../units":127}],109:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _defineFunction2.default)({ + type: "lap", + names: ["\\mathllap", "\\mathrlap", "\\mathclap"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: function handler(context, args) { + var body = args[0]; + return { + type: "lap", + alignment: context.funcName.slice(5), + body: body + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // mathllap, mathrlap, mathclap + var inner = void 0; + if (group.value.alignment === "clap") { + // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/ + inner = _buildCommon2.default.makeSpan([], [html.buildGroup(group.value.body, options)]); + // wrap, since CSS will center a .clap > .inner > span + inner = _buildCommon2.default.makeSpan(["inner"], [inner], options); + } else { + inner = _buildCommon2.default.makeSpan(["inner"], [html.buildGroup(group.value.body, options)]); + } + var fix = _buildCommon2.default.makeSpan(["fix"], []); + return _buildCommon2.default.makeSpan(["mord", group.value.alignment], [inner, fix], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + // mathllap, mathrlap, mathclap + var node = new _mathMLTree2.default.MathNode("mpadded", [mml.buildGroup(group.value.body, options)]); + + if (group.value.alignment !== "rlap") { + var offset = group.value.alignment === "llap" ? "-1" : "-0.5"; + node.setAttribute("lspace", offset + "width"); + } + node.setAttribute("width", "0px"); + + return node; + } +}); +// Horizontal overlap functions + +},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],110:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _Style = require("../Style"); + +var _Style2 = _interopRequireDefault(_Style); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var chooseMathStyle = function chooseMathStyle(group, options) { + var style = options.style; + if (style.size === _Style2.default.DISPLAY.size) { + return group.value.display; + } else if (style.size === _Style2.default.TEXT.size) { + return group.value.text; + } else if (style.size === _Style2.default.SCRIPT.size) { + return group.value.script; + } else if (style.size === _Style2.default.SCRIPTSCRIPT.size) { + return group.value.scriptscript; + } + return group.value.text; +}; + +(0, _defineFunction2.default)({ + type: "mathchoice", + names: ["\\mathchoice"], + props: { + numArgs: 4 + }, + handler: function handler(context, args) { + return { + type: "mathchoice", + display: (0, _defineFunction.ordargument)(args[0]), + text: (0, _defineFunction.ordargument)(args[1]), + script: (0, _defineFunction.ordargument)(args[2]), + scriptscript: (0, _defineFunction.ordargument)(args[3]) + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var body = chooseMathStyle(group, options); + var elements = html.buildExpression(body, options, false); + return new _buildCommon2.default.makeFragment(elements); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var body = chooseMathStyle(group, options); + var elements = mml.buildExpression(body, options, false); + return new _mathMLTree2.default.MathNode("mrow", elements); + } +}); + +},{"../Style":89,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],111:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _Style = require("../Style"); + +var _Style2 = _interopRequireDefault(_Style); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// \mod-type functions +var htmlModBuilder = function htmlModBuilder(group, options) { + var inner = []; + + if (group.value.modType === "bmod") { + // “\nonscript\mskip-\medmuskip\mkern5mu”, where \medmuskip is + // 4mu plus 2mu minus 1mu, translates to 1mu space in + // display/textstyle and 5mu space in script/scriptscriptstyle. + if (!options.style.isTight()) { + inner.push(_buildCommon2.default.makeSpan(["mspace", "muspace"], [], options)); + } else { + inner.push(_buildCommon2.default.makeSpan(["mspace", "thickspace"], [], options)); + } + } else if (options.style.size === _Style2.default.DISPLAY.size) { + inner.push(_buildCommon2.default.makeSpan(["mspace", "quad"], [], options)); + } else if (group.value.modType === "mod") { + inner.push(_buildCommon2.default.makeSpan(["mspace", "twelvemuspace"], [], options)); + } else { + inner.push(_buildCommon2.default.makeSpan(["mspace", "eightmuspace"], [], options)); + } + + if (group.value.modType === "pod" || group.value.modType === "pmod") { + inner.push(_buildCommon2.default.mathsym("(", group.mode)); + } + + if (group.value.modType !== "pod") { + var modInner = [_buildCommon2.default.mathsym("m", group.mode), _buildCommon2.default.mathsym("o", group.mode), _buildCommon2.default.mathsym("d", group.mode)]; + if (group.value.modType === "bmod") { + inner.push(_buildCommon2.default.makeSpan(["mbin"], modInner, options)); + // “\mkern5mu\nonscript\mskip-\medmuskip” as above + if (!options.style.isTight()) { + inner.push(_buildCommon2.default.makeSpan(["mspace", "muspace"], [], options)); + } else { + inner.push(_buildCommon2.default.makeSpan(["mspace", "thickspace"], [], options)); + } + } else { + Array.prototype.push.apply(inner, modInner); + inner.push(_buildCommon2.default.makeSpan(["mspace", "sixmuspace"], [], options)); + } + } + + if (group.value.value) { + Array.prototype.push.apply(inner, html.buildExpression(group.value.value, options, false)); + } + + if (group.value.modType === "pod" || group.value.modType === "pmod") { + inner.push(_buildCommon2.default.mathsym(")", group.mode)); + } + + return _buildCommon2.default.makeFragment(inner); +}; + +var mmlModBuilder = function mmlModBuilder(group, options) { + var inner = []; + + if (group.value.modType === "pod" || group.value.modType === "pmod") { + inner.push(new _mathMLTree2.default.MathNode("mo", [mml.makeText("(", group.mode)])); + } + if (group.value.modType !== "pod") { + inner.push(new _mathMLTree2.default.MathNode("mo", [mml.makeText("mod", group.mode)])); + } + if (group.value.value) { + var space = new _mathMLTree2.default.MathNode("mspace"); + space.setAttribute("width", "0.333333em"); + inner.push(space); + inner = inner.concat(mml.buildExpression(group.value.value, options)); + } + if (group.value.modType === "pod" || group.value.modType === "pmod") { + inner.push(new _mathMLTree2.default.MathNode("mo", [mml.makeText(")", group.mode)])); + } + + return new _mathMLTree2.default.MathNode("mo", inner); +}; + +(0, _defineFunction2.default)({ + type: "mod", + names: ["\\bmod"], + props: { + numArgs: 0 + }, + handler: function handler(context, args) { + return { + type: "mod", + modType: "bmod", + value: null + }; + }, + htmlBuilder: htmlModBuilder, + mathmlBuilder: mmlModBuilder +}); + +// Note: calling defineFunction with a type that's already been defined only +// works because the same htmlBuilder and mathmlBuilder are being used. +(0, _defineFunction2.default)({ + type: "mod", + names: ["\\pod", "\\pmod", "\\mod"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var body = args[0]; + return { + type: "mod", + modType: context.funcName.substr(1), + value: (0, _defineFunction.ordargument)(body) + }; + }, + htmlBuilder: htmlModBuilder, + mathmlBuilder: mmlModBuilder +}); + +},{"../Style":89,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],112:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _domTree = require("../domTree"); + +var _domTree2 = _interopRequireDefault(_domTree); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _utils = require("../utils"); + +var _utils2 = _interopRequireDefault(_utils); + +var _Style = require("../Style"); + +var _Style2 = _interopRequireDefault(_Style); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// Limits, symbols +var htmlBuilder = function htmlBuilder(group, options) { + // Operators are handled in the TeXbook pg. 443-444, rule 13(a). + var supGroup = void 0; + var subGroup = void 0; + var hasLimits = false; + if (group.type === "supsub") { + // If we have limits, supsub will pass us its group to handle. Pull + // out the superscript and subscript and set the group to the op in + // its base. + supGroup = group.value.sup; + subGroup = group.value.sub; + group = group.value.base; + hasLimits = true; + } + + var style = options.style; + + // Most operators have a large successor symbol, but these don't. + var noSuccessor = ["\\smallint"]; + + var large = false; + if (style.size === _Style2.default.DISPLAY.size && group.value.symbol && !_utils2.default.contains(noSuccessor, group.value.body)) { + + // Most symbol operators get larger in displaystyle (rule 13) + large = true; + } + + var base = void 0; + if (group.value.symbol) { + // If this is a symbol, create the symbol. + var fontName = large ? "Size2-Regular" : "Size1-Regular"; + base = _buildCommon2.default.makeSymbol(group.value.body, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]); + } else if (group.value.value) { + // If this is a list, compose that list. + var inner = html.buildExpression(group.value.value, options, true); + if (inner.length === 1 && inner[0] instanceof _domTree2.default.symbolNode) { + base = inner[0]; + base.classes[0] = "mop"; // replace old mclass + } else { + base = _buildCommon2.default.makeSpan(["mop"], inner, options); + } + } else { + // Otherwise, this is a text operator. Build the text from the + // operator's name. + // TODO(emily): Add a space in the middle of some of these + // operators, like \limsup + var output = []; + for (var i = 1; i < group.value.body.length; i++) { + output.push(_buildCommon2.default.mathsym(group.value.body[i], group.mode)); + } + base = _buildCommon2.default.makeSpan(["mop"], output, options); + } + + // If content of op is a single symbol, shift it vertically. + var baseShift = 0; + var slant = 0; + if (base instanceof _domTree2.default.symbolNode) { + // Shift the symbol so its center lies on the axis (rule 13). It + // appears that our fonts have the centers of the symbols already + // almost on the axis, so these numbers are very small. Note we + // don't actually apply this here, but instead it is used either in + // the vlist creation or separately when there are no limits. + baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; + + // The slant of the symbol is just its italic correction. + slant = base.italic; + } + + if (hasLimits) { + // IE 8 clips \int if it is in a display: inline-block. We wrap it + // in a new span so it is an inline, and works. + base = _buildCommon2.default.makeSpan([], [base]); + + var sub = void 0; + var sup = void 0; + // We manually have to handle the superscripts and subscripts. This, + // aside from the kern calculations, is copied from supsub. + if (supGroup) { + var elem = html.buildGroup(supGroup, options.havingStyle(style.sup()), options); + + sup = { + elem: elem, + kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth) + }; + } + + if (subGroup) { + var _elem = html.buildGroup(subGroup, options.havingStyle(style.sub()), options); + + sub = { + elem: _elem, + kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height) + }; + } + + // Build the final group as a vlist of the possible subscript, base, + // and possible superscript. + var finalGroup = void 0; + if (sup && sub) { + var bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift; + + finalGroup = _buildCommon2.default.makeVList({ + positionType: "bottom", + positionData: bottom, + children: [{ type: "kern", size: options.fontMetrics().bigOpSpacing5 }, { type: "elem", elem: sub.elem, marginLeft: -slant + "em" }, { type: "kern", size: sub.kern }, { type: "elem", elem: base }, { type: "kern", size: sup.kern }, { type: "elem", elem: sup.elem, marginLeft: slant + "em" }, { type: "kern", size: options.fontMetrics().bigOpSpacing5 }] + }, options); + } else if (sub) { + var top = base.height - baseShift; + + // Shift the limits by the slant of the symbol. Note + // that we are supposed to shift the limits by 1/2 of the slant, + // but since we are centering the limits adding a full slant of + // margin will shift by 1/2 that. + finalGroup = _buildCommon2.default.makeVList({ + positionType: "top", + positionData: top, + children: [{ type: "kern", size: options.fontMetrics().bigOpSpacing5 }, { type: "elem", elem: sub.elem, marginLeft: -slant + "em" }, { type: "kern", size: sub.kern }, { type: "elem", elem: base }] + }, options); + } else if (sup) { + var _bottom = base.depth + baseShift; + + finalGroup = _buildCommon2.default.makeVList({ + positionType: "bottom", + positionData: _bottom, + children: [{ type: "elem", elem: base }, { type: "kern", size: sup.kern }, { type: "elem", elem: sup.elem, marginLeft: slant + "em" }, { type: "kern", size: options.fontMetrics().bigOpSpacing5 }] + }, options); + } else { + // This case probably shouldn't occur (this would mean the + // supsub was sending us a group with no superscript or + // subscript) but be safe. + return base; + } + + return _buildCommon2.default.makeSpan(["mop", "op-limits"], [finalGroup], options); + } else { + if (baseShift) { + base.style.position = "relative"; + base.style.top = baseShift + "em"; + } + + return base; + } +}; + +var mathmlBuilder = function mathmlBuilder(group, options) { + var node = void 0; + + // TODO(emily): handle big operators using the `largeop` attribute + + if (group.value.symbol) { + // This is a symbol. Just add the symbol. + node = new _mathMLTree2.default.MathNode("mo", [mml.makeText(group.value.body, group.mode)]); + } else if (group.value.value) { + // This is an operator with children. Add them. + node = new _mathMLTree2.default.MathNode("mo", mml.buildExpression(group.value.value, options)); + } else { + // This is a text operator. Add all of the characters from the + // operator's name. + // TODO(emily): Add a space in the middle of some of these + // operators, like \limsup. + node = new _mathMLTree2.default.MathNode("mi", [new _mathMLTree2.default.TextNode(group.value.body.slice(1))]); + + // Append an . + // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4 + var operator = new _mathMLTree2.default.MathNode("mo", [mml.makeText("\u2061", "text")]); + + return new _domTree2.default.documentFragment([node, operator]); + } + + return node; +}; + +var singleCharBigOps = { + "\u220F": "\\prod", + "\u2210": "\\coprod", + "\u2211": "\\sum", + "\u22C0": "\\bigwedge", + "\u22C1": "\\bigvee", + "\u22C2": "\\bigcap", + "\u22C3": "\\bigcap", + "\u2A00": "\\bigodot", + "\u2A01": "\\bigoplus", + "\u2A02": "\\bigotimes", + "\u2A04": "\\biguplus", + "\u2A06": "\\bigsqcup" +}; + +(0, _defineFunction2.default)({ + type: "op", + names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22C0", "\u22C1", "\u22C2", "\u22C3", "\u2A00", "\u2A01", "\u2A02", "\u2A04", "\u2A06"], + props: { + numArgs: 0 + }, + handler: function handler(context, args) { + var fName = context.funcName; + if (fName.length === 1) { + fName = singleCharBigOps[fName]; + } + return { + type: "op", + limits: true, + symbol: true, + body: fName + }; + }, + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder +}); + +// Note: calling defineFunction with a type that's already been defined only +// works because the same htmlBuilder and mathmlBuilder are being used. +(0, _defineFunction2.default)({ + type: "op", + names: ["\\mathop"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var body = args[0]; + return { + type: "op", + limits: false, + symbol: false, + value: (0, _defineFunction.ordargument)(body) + }; + }, + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder +}); + +},{"../Style":89,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../domTree":98,"../mathMLTree":121,"../utils":128}],113:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _domTree = require("../domTree"); + +var _domTree2 = _interopRequireDefault(_domTree); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// \operatorname +// amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@ +(0, _defineFunction2.default)({ + type: "operatorname", + names: ["\\operatorname"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var body = args[0]; + return { + type: "operatorname", + value: (0, _defineFunction.ordargument)(body) + }; + }, + + htmlBuilder: function htmlBuilder(group, options) { + var output = []; + if (group.value.value.length > 0) { + var letter = ""; + var mode = ""; + + // Consolidate Greek letter function names into symbol characters. + var temp = html.buildExpression(group.value.value, options, true); + + // All we want from temp are the letters. With them, we'll + // create a text operator similar to \tan or \cos. + for (var i = 0; i < temp.length; i++) { + letter = temp[i].value; + + // In the amsopn package, \newmcodes@ changes four + // characters, *-/:’, from math operators back into text. + // Given what is in temp, we have to address two of them. + letter = letter.replace(/\u2212/, "-"); // minus => hyphen + letter = letter.replace(/\u2217/, "*"); + + // Use math mode for Greek letters + mode = /[\u0391-\u03D7]/.test(letter) ? "math" : "text"; + output.push(_buildCommon2.default.mathsym(letter, mode)); + } + } + return _buildCommon2.default.makeSpan(["mop"], output, options); + }, + + mathmlBuilder: function mathmlBuilder(group, options) { + // The steps taken here are similar to the html version. + var output = []; + if (group.value.value.length > 0) { + var temp = mml.buildExpression(group.value.value, options); + + var word = ""; + for (var i = 0; i < temp.length; i++) { + word += temp[i].children[0].text; + } + word = word.replace(/\u2212/g, "-"); + word = word.replace(/\u2217/g, "*"); + output = [new _mathMLTree2.default.TextNode(word)]; + } + var identifier = new _mathMLTree2.default.MathNode("mi", output); + identifier.setAttribute("mathvariant", "normal"); + + // \u2061 is the same as ⁡ + // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp + var operator = new _mathMLTree2.default.MathNode("mo", [mml.makeText("\u2061", "text")]); + + return new _domTree2.default.documentFragment([identifier, operator]); + } +}); + +},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../domTree":98,"../mathMLTree":121}],114:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _defineFunction2.default)({ + type: "overline", + names: ["\\overline"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var body = args[0]; + return { + type: "overline", + body: body + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Overlines are handled in the TeXbook pg 443, Rule 9. + + // Build the inner group in the cramped style. + var innerGroup = html.buildGroup(group.value.body, options.havingCrampedStyle()); + + // Create the line above the body + var line = _buildCommon2.default.makeLineSpan("overline-line", options); + + // Generate the vlist, with the appropriate kerns + var vlist = _buildCommon2.default.makeVList({ + positionType: "firstBaseline", + children: [{ type: "elem", elem: innerGroup }, { type: "kern", size: 3 * line.height }, { type: "elem", elem: line }, { type: "kern", size: line.height }] + }, options); + + return _buildCommon2.default.makeSpan(["mord", "overline"], [vlist], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var operator = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode("\u203E")]); + operator.setAttribute("stretchy", "true"); + + var node = new _mathMLTree2.default.MathNode("mover", [mml.buildGroup(group.value.body, options), operator]); + node.setAttribute("accent", "true"); + + return node; + } +}); + +},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],115:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _defineFunction2.default)({ + type: "phantom", + names: ["\\phantom"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var body = args[0]; + return { + type: "phantom", + value: (0, _defineFunction.ordargument)(body) + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var elements = html.buildExpression(group.value.value, options.withPhantom(), false); + + // \phantom isn't supposed to affect the elements it contains. + // See "color" for more details. + return new _buildCommon2.default.makeFragment(elements); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var inner = mml.buildExpression(group.value.value, options); + return new _mathMLTree2.default.MathNode("mphantom", inner); + } +}); + + +(0, _defineFunction2.default)({ + type: "hphantom", + names: ["\\hphantom"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var body = args[0]; + return { + type: "hphantom", + value: (0, _defineFunction.ordargument)(body), + body: body + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var node = _buildCommon2.default.makeSpan([], [html.buildGroup(group.value.body, options.withPhantom())]); + node.height = 0; + node.depth = 0; + if (node.children) { + for (var i = 0; i < node.children.length; i++) { + node.children[i].height = 0; + node.children[i].depth = 0; + } + } + + // See smash for comment re: use of makeVList + node = _buildCommon2.default.makeVList({ + positionType: "firstBaseline", + children: [{ type: "elem", elem: node }] + }, options); + + return node; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var inner = mml.buildExpression(group.value.value, options); + var node = new _mathMLTree2.default.MathNode("mphantom", inner); + node.setAttribute("height", "0px"); + return node; + } +}); + +(0, _defineFunction2.default)({ + type: "vphantom", + names: ["\\vphantom"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var body = args[0]; + return { + type: "vphantom", + value: (0, _defineFunction.ordargument)(body), + body: body + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var inner = _buildCommon2.default.makeSpan(["inner"], [html.buildGroup(group.value.body, options.withPhantom())]); + var fix = _buildCommon2.default.makeSpan(["fix"], []); + return _buildCommon2.default.makeSpan(["mord", "rlap"], [inner, fix], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var inner = mml.buildExpression(group.value.value, options); + var node = new _mathMLTree2.default.MathNode("mphantom", inner); + node.setAttribute("width", "0px"); + return node; + } +}); + +},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],116:[function(require,module,exports){ +"use strict"; + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _units = require("../units"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _defineFunction2.default)({ + type: "rule", + names: ["\\rule"], + props: { + numArgs: 2, + numOptionalArgs: 1, + argTypes: ["size", "size", "size"] + }, + handler: function handler(context, args, optArgs) { + var shift = optArgs[0]; + var width = args[0]; + var height = args[1]; + return { + type: "rule", + shift: shift && shift.value, + width: width.value, + height: height.value + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Make an empty span for the rule + var rule = _buildCommon2.default.makeSpan(["mord", "rule"], [], options); + + // Calculate the shift, width, and height of the rule, and account for units + var shift = 0; + if (group.value.shift) { + shift = (0, _units.calculateSize)(group.value.shift, options); + } + + var width = (0, _units.calculateSize)(group.value.width, options); + var height = (0, _units.calculateSize)(group.value.height, options); + + // Style the rule to the right size + rule.style.borderRightWidth = width + "em"; + rule.style.borderTopWidth = height + "em"; + rule.style.bottom = shift + "em"; + + // Record the height and width + rule.width = width; + rule.height = height + shift; + rule.depth = -shift; + // Font size is the number large enough that the browser will + // reserve at least `absHeight` space above the baseline. + // The 1.125 factor was empirically determined + rule.maxFontSize = height * 1.125 * options.sizeMultiplier; + + return rule; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + // TODO(emily): Figure out if there's an actual way to draw black boxes + // in MathML. + var node = new _mathMLTree2.default.MathNode("mrow"); + + return node; + } +}); + +},{"../buildCommon":91,"../defineFunction":96,"../mathMLTree":121,"../units":127}],117:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _defineFunction2.default)({ + type: "smash", + names: ["\\smash"], + props: { + numArgs: 1, + numOptionalArgs: 1, + allowedInText: true + }, + handler: function handler(context, args, optArgs) { + var smashHeight = false; + var smashDepth = false; + var tbArg = optArgs[0]; + if (tbArg) { + // Optional [tb] argument is engaged. + // ref: amsmath: \renewcommand{\smash}[1][tb]{% + // def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% + var letter = ""; + for (var i = 0; i < tbArg.value.length; ++i) { + letter = tbArg.value[i].value; + if (letter === "t") { + smashHeight = true; + } else if (letter === "b") { + smashDepth = true; + } else { + smashHeight = false; + smashDepth = false; + break; + } + } + } else { + smashHeight = true; + smashDepth = true; + } + + var body = args[0]; + return { + type: "smash", + body: body, + smashHeight: smashHeight, + smashDepth: smashDepth + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var node = _buildCommon2.default.makeSpan(["mord"], [html.buildGroup(group.value.body, options)]); + + if (!group.value.smashHeight && !group.value.smashDepth) { + return node; + } + + if (group.value.smashHeight) { + node.height = 0; + // In order to influence makeVList, we have to reset the children. + if (node.children) { + for (var i = 0; i < node.children.length; i++) { + node.children[i].height = 0; + } + } + } + + if (group.value.smashDepth) { + node.depth = 0; + if (node.children) { + for (var _i = 0; _i < node.children.length; _i++) { + node.children[_i].depth = 0; + } + } + } + + // At this point, we've reset the TeX-like height and depth values. + // But the span still has an HTML line height. + // makeVList applies "display: table-cell", which prevents the browser + // from acting on that line height. So we'll call makeVList now. + + return _buildCommon2.default.makeVList({ + positionType: "firstBaseline", + children: [{ type: "elem", elem: node }] + }, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new _mathMLTree2.default.MathNode("mpadded", [mml.buildGroup(group.value.body, options)]); + + if (group.value.smashHeight) { + node.setAttribute("height", "0px"); + } + + if (group.value.smashDepth) { + node.setAttribute("depth", "0px"); + } + + return node; + } +}); +// smash, with optional [tb], as in AMS + +},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],118:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// Non-mathy text, possibly in a font +var textFunctionFonts = { + "\\text": undefined, "\\textrm": "mathrm", "\\textsf": "mathsf", + "\\texttt": "mathtt", "\\textnormal": "mathrm", "\\textbf": "mathbf", + "\\textit": "textit" +}; + + +(0, _defineFunction2.default)({ + type: "text", + names: ["\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", "\\textbf", "\\textit"], + props: { + numArgs: 1, + argTypes: ["text"], + greediness: 2, + allowedInText: true + }, + handler: function handler(context, args) { + var body = args[0]; + return { + type: "text", + body: (0, _defineFunction.ordargument)(body), + font: textFunctionFonts[context.funcName] + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var newOptions = options.withFont(group.value.font); + var inner = html.buildExpression(group.value.body, newOptions, true); + _buildCommon2.default.tryCombineChars(inner); + return _buildCommon2.default.makeSpan(["mord", "text"], inner, newOptions); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var body = group.value.body; + + // Convert each element of the body into MathML, and combine consecutive + // outputs into a single tag. In this way, we don't + // nest non-text items (e.g., $nested-math$) within an . + var inner = []; + var currentText = null; + for (var i = 0; i < body.length; i++) { + var _group = mml.buildGroup(body[i], options); + if (_group.type === 'mtext' && currentText != null) { + Array.prototype.push.apply(currentText.children, _group.children); + } else { + inner.push(_group); + if (_group.type === 'mtext') { + currentText = _group; + } + } + } + + // If there is a single tag in the end (presumably ), + // just return it. Otherwise, wrap them in an . + if (inner.length === 1) { + return inner[0]; + } else { + return new _mathMLTree2.default.MathNode("mrow", inner); + } + } +}); + +},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],119:[function(require,module,exports){ +"use strict"; + +var _defineFunction = require("../defineFunction"); + +var _defineFunction2 = _interopRequireDefault(_defineFunction); + +var _buildCommon = require("../buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("../mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _buildHTML = require("../buildHTML"); + +var html = _interopRequireWildcard(_buildHTML); + +var _buildMathML = require("../buildMathML"); + +var mml = _interopRequireWildcard(_buildMathML); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _defineFunction2.default)({ + type: "underline", + names: ["\\underline"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var body = args[0]; + return { + type: "underline", + body: body + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Underlines are handled in the TeXbook pg 443, Rule 10. + // Build the inner group. + var innerGroup = html.buildGroup(group.value.body, options); + + // Create the line above the body + var line = _buildCommon2.default.makeLineSpan("underline-line", options); + + // Generate the vlist, with the appropriate kerns + var vlist = _buildCommon2.default.makeVList({ + positionType: "top", + positionData: innerGroup.height, + children: [{ type: "kern", size: line.height }, { type: "elem", elem: line }, { type: "kern", size: 3 * line.height }, { type: "elem", elem: innerGroup }] + }, options); + + return _buildCommon2.default.makeSpan(["mord", "underline"], [vlist], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var operator = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode("\u203E")]); + operator.setAttribute("stretchy", "true"); + + var node = new _mathMLTree2.default.MathNode("munder", [mml.buildGroup(group.value.body, options), operator]); + node.setAttribute("accentunder", "true"); + + return node; + } +}); + +},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],120:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _fontMetricsData = require("./fontMetricsData"); + +var _fontMetricsData2 = _interopRequireDefault(_fontMetricsData); + +var _symbols = require("./symbols"); + +var _symbols2 = _interopRequireDefault(_symbols); + +var _utils = require("./utils"); + +var _utils2 = _interopRequireDefault(_utils); + +var _Token = require("./Token"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Provides context to macros defined by functions. Implemented by + * MacroExpander. + */ + + +/** Macro tokens (in reverse order). */ + +/** + * Predefined macros for KaTeX. + * This can be used to define some commands in terms of others. + */ + +var builtinMacros = {}; +exports.default = builtinMacros; + +// This function might one day accept an additional argument and do more things. + +function defineMacro(name, body) { + builtinMacros[name] = body; +} + +////////////////////////////////////////////////////////////////////// +// macro tools + +defineMacro("\\@firstoftwo", function (context) { + var args = context.consumeArgs(2); + return { tokens: args[0], numArgs: 0 }; +}); + +defineMacro("\\@ifnextchar", function (context) { + var args = context.consumeArgs(3); // symbol, if, else + var nextToken = context.future(); + if (args[0].length === 1 && args[0][0].text === nextToken.text) { + return { tokens: args[1], numArgs: 0 }; + } else { + return { tokens: args[2], numArgs: 0 }; + } +}); + +// \def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}} +defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); + +////////////////////////////////////////////////////////////////////// +// basics +defineMacro("\\bgroup", "{"); +defineMacro("\\egroup", "}"); +defineMacro("\\begingroup", "{"); +defineMacro("\\endgroup", "}"); + +// Unicode double-struck letters +defineMacro("\u2102", "\\mathbb{C}"); +defineMacro("\u210D", "\\mathbb{H}"); +defineMacro("\u2115", "\\mathbb{N}"); +defineMacro("\u2119", "\\mathbb{P}"); +defineMacro("\u211A", "\\mathbb{Q}"); +defineMacro("\u211D", "\\mathbb{R}"); +defineMacro("\u2124", "\\mathbb{Z}"); + +// \llap and \rlap render their contents in text mode +defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); +defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); +defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); + +////////////////////////////////////////////////////////////////////// +// amsmath.sty +// http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf + +// \def\overset#1#2{\binrel@{#2}\binrel@@{\mathop{\kern\z@#2}\limits^{#1}}} +defineMacro("\\overset", "\\mathop{#2}\\limits^{#1}"); +defineMacro("\\underset", "\\mathop{#2}\\limits_{#1}"); + +// \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} +defineMacro("\\boxed", "\\fbox{\\displaystyle{#1}}"); + +// \def\iff{\DOTSB\;\Longleftrightarrow\;} +// \def\implies{\DOTSB\;\Longrightarrow\;} +// \def\impliedby{\DOTSB\;\Longleftarrow\;} +defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); +defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); +defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); + +// AMSMath's automatic \dots, based on \mdots@@ macro. +var dotsByToken = { + ',': '\\dotsc', + '\\not': '\\dotsb', + // \keybin@ checks for the following: + '+': '\\dotsb', + '=': '\\dotsb', + '<': '\\dotsb', + '>': '\\dotsb', + '-': '\\dotsb', + '*': '\\dotsb', + ':': '\\dotsb', + // Symbols whose definition starts with \DOTSB: + '\\DOTSB': '\\dotsb', + '\\coprod': '\\dotsb', + '\\bigvee': '\\dotsb', + '\\bigwedge': '\\dotsb', + '\\biguplus': '\\dotsb', + '\\bigcap': '\\dotsb', + '\\bigcup': '\\dotsb', + '\\prod': '\\dotsb', + '\\sum': '\\dotsb', + '\\bigotimes': '\\dotsb', + '\\bigoplus': '\\dotsb', + '\\bigodot': '\\dotsb', + '\\bigsqcup': '\\dotsb', + '\\implies': '\\dotsb', + '\\impliedby': '\\dotsb', + '\\And': '\\dotsb', + '\\longrightarrow': '\\dotsb', + '\\Longrightarrow': '\\dotsb', + '\\longleftarrow': '\\dotsb', + '\\Longleftarrow': '\\dotsb', + '\\longleftrightarrow': '\\dotsb', + '\\Longleftrightarrow': '\\dotsb', + '\\mapsto': '\\dotsb', + '\\longmapsto': '\\dotsb', + '\\hookrightarrow': '\\dotsb', + '\\iff': '\\dotsb', + '\\doteq': '\\dotsb', + // Symbols whose definition starts with \mathbin: + '\\mathbin': '\\dotsb', + '\\bmod': '\\dotsb', + // Symbols whose definition starts with \mathrel: + '\\mathrel': '\\dotsb', + '\\relbar': '\\dotsb', + '\\Relbar': '\\dotsb', + '\\xrightarrow': '\\dotsb', + '\\xleftarrow': '\\dotsb', + // Symbols whose definition starts with \DOTSI: + '\\DOTSI': '\\dotsi', + '\\int': '\\dotsi', + '\\oint': '\\dotsi', + '\\iint': '\\dotsi', + '\\iiint': '\\dotsi', + '\\iiiint': '\\dotsi', + '\\idotsint': '\\dotsi', + // Symbols whose definition starts with \DOTSX: + '\\DOTSX': '\\dotsx' +}; + +defineMacro("\\dots", function (context) { + // TODO: If used in text mode, should expand to \textellipsis. + // However, in KaTeX, \textellipsis and \ldots behave the same + // (in text mode), and it's unlikely we'd see any of the math commands + // that affect the behavior of \dots when in text mode. So fine for now + // (until we support \ifmmode ... \else ... \fi). + var thedots = '\\dotso'; + var next = context.expandAfterFuture().text; + if (next in dotsByToken) { + thedots = dotsByToken[next]; + } else if (next.substr(0, 4) === '\\not') { + thedots = '\\dotsb'; + } else if (next in _symbols2.default.math) { + if (_utils2.default.contains(['bin', 'rel'], _symbols2.default.math[next].group)) { + thedots = '\\dotsb'; + } + } + return thedots; +}); + +var spaceAfterDots = { + // \rightdelim@ checks for the following: + ')': true, + ']': true, + '\\rbrack': true, + '\\}': true, + '\\rbrace': true, + '\\rangle': true, + '\\rceil': true, + '\\rfloor': true, + '\\rgroup': true, + '\\rmoustache': true, + '\\right': true, + '\\bigr': true, + '\\biggr': true, + '\\Bigr': true, + '\\Biggr': true, + // \extra@ also tests for the following: + '$': true, + // \extrap@ checks for the following: + ';': true, + '.': true, + ',': true +}; + +defineMacro("\\dotso", function (context) { + var next = context.future().text; + if (next in spaceAfterDots) { + return "\\ldots\\,"; + } else { + return "\\ldots"; + } +}); + +defineMacro("\\dotsc", function (context) { + var next = context.future().text; + // \dotsc uses \extra@ but not \extrap@, instead specially checking for + // ';' and '.', but doesn't check for ','. + if (next in spaceAfterDots && next !== ',') { + return "\\ldots\\,"; + } else { + return "\\ldots"; + } +}); + +defineMacro("\\cdots", function (context) { + var next = context.future().text; + if (next in spaceAfterDots) { + return "\\@cdots\\,"; + } else { + return "\\@cdots"; + } +}); + +defineMacro("\\dotsb", "\\cdots"); +defineMacro("\\dotsm", "\\cdots"); +defineMacro("\\dotsi", "\\!\\cdots"); +// amsmath doesn't actually define \dotsx, but \dots followed by a macro +// starting with \DOTSX implies \dotso, and then \extra@ detects this case +// and forces the added `\,`. +defineMacro("\\dotsx", "\\ldots\\,"); + +// \let\DOTSI\relax +// \let\DOTSB\relax +// \let\DOTSX\relax +defineMacro("\\DOTSI", "\\relax"); +defineMacro("\\DOTSB", "\\relax"); +defineMacro("\\DOTSX", "\\relax"); + +// http://texdoc.net/texmf-dist/doc/latex/amsmath/amsmath.pdf +defineMacro("\\thinspace", "\\,"); // \let\thinspace\, +defineMacro("\\medspace", "\\:"); // \let\medspace\: +defineMacro("\\thickspace", "\\;"); // \let\thickspace\; + +////////////////////////////////////////////////////////////////////// +// LaTeX source2e + +// \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} +// TODO: Doesn't normally work in math mode because \@ fails. KaTeX doesn't +// support \@ yet, so that's omitted, and we add \text so that the result +// doesn't look funny in math mode. +defineMacro("\\TeX", "\\textrm{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}"); + +// \DeclareRobustCommand{\LaTeX}{L\kern-.36em% +// {\sbox\z@ T% +// \vbox to\ht\z@{\hbox{\check@mathfonts +// \fontsize\sf@size\z@ +// \math@fontsfalse\selectfont +// A}% +// \vss}% +// }% +// \kern-.15em% +// \TeX} +// This code aligns the top of the A with the T (from the perspective of TeX's +// boxes, though visually the A appears to extend above slightly). +// We compute the corresponding \raisebox when A is rendered at \scriptsize, +// which is size3, which has a scale factor of 0.7 (see Options.js). +var latexRaiseA = _fontMetricsData2.default['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * _fontMetricsData2.default['Main-Regular']["A".charCodeAt(0)][1] + "em"; +defineMacro("\\LaTeX", "\\textrm{L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptsize A}" + "\\kern-.15em\\TeX}"); + +// New KaTeX logo based on tweaking LaTeX logo +defineMacro("\\KaTeX", "\\textrm{K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptsize A}" + "\\kern-.15em\\TeX}"); + +// \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace} +// \def\@hspace#1{\hskip #1\relax} +// KaTeX doesn't do line breaks, so \hspace and \hspace* are the same as \kern +defineMacro("\\hspace", "\\@ifstar\\kern\\kern"); + +////////////////////////////////////////////////////////////////////// +// mathtools.sty + +//\providecommand\ordinarycolon{:} +defineMacro("\\ordinarycolon", ":"); +//\def\vcentcolon{\mathrel{\mathop\ordinarycolon}} +//TODO(edemaine): Not yet centered. Fix via \raisebox or #726 +defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); +// \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon} +defineMacro("\\dblcolon", "\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon"); +// \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=} +defineMacro("\\coloneqq", "\\vcentcolon\\mathrel{\\mkern-1.2mu}="); +// \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=} +defineMacro("\\Coloneqq", "\\dblcolon\\mathrel{\\mkern-1.2mu}="); +// \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}} +defineMacro("\\coloneq", "\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}"); +// \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}} +defineMacro("\\Coloneq", "\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}"); +// \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon} +defineMacro("\\eqqcolon", "=\\mathrel{\\mkern-1.2mu}\\vcentcolon"); +// \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon} +defineMacro("\\Eqqcolon", "=\\mathrel{\\mkern-1.2mu}\\dblcolon"); +// \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon} +defineMacro("\\eqcolon", "\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon"); +// \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon} +defineMacro("\\Eqcolon", "\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon"); +// \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx} +defineMacro("\\colonapprox", "\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx"); +// \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx} +defineMacro("\\Colonapprox", "\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx"); +// \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim} +defineMacro("\\colonsim", "\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim"); +// \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim} +defineMacro("\\Colonsim", "\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim"); + +////////////////////////////////////////////////////////////////////// +// colonequals.sty + +// Alternate names for mathtools's macros: +defineMacro("\\ratio", "\\vcentcolon"); +defineMacro("\\coloncolon", "\\dblcolon"); +defineMacro("\\colonequals", "\\coloneqq"); +defineMacro("\\coloncolonequals", "\\Coloneqq"); +defineMacro("\\equalscolon", "\\eqqcolon"); +defineMacro("\\equalscoloncolon", "\\Eqqcolon"); +defineMacro("\\colonminus", "\\coloneq"); +defineMacro("\\coloncolonminus", "\\Coloneq"); +defineMacro("\\minuscolon", "\\eqcolon"); +defineMacro("\\minuscoloncolon", "\\Eqcolon"); +// \colonapprox name is same in mathtools and colonequals. +defineMacro("\\coloncolonapprox", "\\Colonapprox"); +// \colonsim name is same in mathtools and colonequals. +defineMacro("\\coloncolonsim", "\\Colonsim"); + +// Additional macros, implemented by analogy with mathtools definitions: +defineMacro("\\simcolon", "\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon"); +defineMacro("\\simcoloncolon", "\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon"); +defineMacro("\\approxcolon", "\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon"); +defineMacro("\\approxcoloncolon", "\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon"); + +// Present in newtxmath, pxfonts and txfonts +// TODO: The unicode character U+220C ∌ should be added to the font, and this +// macro turned into a propper defineSymbol in symbols.js. That way, the +// MathML result will be much cleaner. +defineMacro("\\notni", "\\not\\ni"); + +},{"./Token":90,"./fontMetricsData":102,"./symbols":125,"./utils":128}],121:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _getIterator2 = require("babel-runtime/core-js/get-iterator"); + +var _getIterator3 = _interopRequireDefault(_getIterator2); + +var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = require("babel-runtime/helpers/createClass"); + +var _createClass3 = _interopRequireDefault(_createClass2); + +var _utils = require("./utils"); + +var _utils2 = _interopRequireDefault(_utils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * This node represents a general purpose MathML node of any type. The + * constructor requires the type of node to create (for example, `"mo"` or + * `"mspace"`, corresponding to `` and `` tags). + */ + + +/** + * MathML node types used in KaTeX. For a complete list of MathML nodes, see + * https://developer.mozilla.org/en-US/docs/Web/MathML/Element. + */ +var MathNode = function () { + function MathNode(type, children) { + (0, _classCallCheck3.default)(this, MathNode); + + this.type = type; + this.attributes = {}; + this.children = children || []; + } + + /** + * Sets an attribute on a MathML node. MathML depends on attributes to convey a + * semantic content, so this is used heavily. + */ + + + (0, _createClass3.default)(MathNode, [{ + key: "setAttribute", + value: function setAttribute(name, value) { + this.attributes[name] = value; + } + + /** + * Converts the math node into a MathML-namespaced DOM element. + */ + + }, { + key: "toNode", + value: function toNode() { + var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type); + + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = (0, _getIterator3.default)(this.children), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var child = _step.value; + + node.appendChild(child.toNode()); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + return node; + } -// Environment delimiters -defineFunction(["\\begin", "\\end"], { - numArgs: 1, - argTypes: ["text"], -}, function(context, args) { - var nameGroup = args[0]; - if (nameGroup.type !== "ordgroup") { - throw new ParseError("Invalid environment name", nameGroup); - } - var name = ""; - for (var i = 0; i < nameGroup.value.length; ++i) { - name += nameGroup.value[i].value; - } - return { - type: "environment", - name: name, - nameGroup: nameGroup, - }; -}); + /** + * Converts the math node into an HTML markup string. + */ + + }, { + key: "toMarkup", + value: function toMarkup() { + var markup = "<" + this.type; + + // Add the attributes + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + markup += " " + attr + "=\""; + markup += _utils2.default.escape(this.attributes[attr]); + markup += "\""; + } + } + + markup += ">"; + + for (var i = 0; i < this.children.length; i++) { + markup += this.children[i].toMarkup(); + } + + markup += ""; + + return markup; + } + }]); + return MathNode; +}(); + +/** + * This node represents a piece of text. + */ -},{"./ParseError":6,"./utils":25}],20:[function(require,module,exports){ /** * These objects store data about MathML nodes. This is the MathML equivalent * of the types in domTree.js. Since MathML handles its own rendering, and @@ -7751,156 +12880,562 @@ defineFunction(["\\begin", "\\end"], { * domTree.js, creating namespaced DOM nodes and HTML text markup respectively. */ -var utils = require("./utils"); +var TextNode = function () { + function TextNode(text) { + (0, _classCallCheck3.default)(this, TextNode); + + this.text = text; + } + + /** + * Converts the text node into a DOM text node. + */ + + + (0, _createClass3.default)(TextNode, [{ + key: "toNode", + value: function toNode() { + return document.createTextNode(this.text); + } + + /** + * Converts the text node into HTML markup (which is just the text itself). + */ + + }, { + key: "toMarkup", + value: function toMarkup() { + return _utils2.default.escape(this.text); + } + }]); + return TextNode; +}(); + +exports.default = { + MathNode: MathNode, + TextNode: TextNode +}; + +},{"./utils":128,"babel-runtime/core-js/get-iterator":3,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],122:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _Parser = require("./Parser"); + +var _Parser2 = _interopRequireDefault(_Parser); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** - * This node represents a general purpose MathML node of any type. The - * constructor requires the type of node to create (for example, `"mo"` or - * `"mspace"`, corresponding to `` and `` tags). + * Parses an expression using a Parser, then returns the parsed result. */ -function MathNode(type, children) { - this.type = type; - this.attributes = {}; - this.children = children || []; -} +var parseTree = function parseTree(toParse, settings) { + if (!(typeof toParse === 'string' || toParse instanceof String)) { + throw new TypeError('KaTeX can only parse string typed expression'); + } + var parser = new _Parser2.default(toParse, settings); + return parser.parse(); +}; /** - * Sets an attribute on a MathML node. MathML depends on attributes to convey a - * semantic content, so this is used heavily. + * Provides a single function for parsing an expression using a Parser + * TODO(emily): Remove this */ -MathNode.prototype.setAttribute = function(name, value) { - this.attributes[name] = value; -}; + +exports.default = parseTree; + +},{"./Parser":86}],123:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _slicedToArray2 = require("babel-runtime/helpers/slicedToArray"); + +var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); + +var _domTree = require("./domTree"); + +var _domTree2 = _interopRequireDefault(_domTree); + +var _buildCommon = require("./buildCommon"); + +var _buildCommon2 = _interopRequireDefault(_buildCommon); + +var _mathMLTree = require("./mathMLTree"); + +var _mathMLTree2 = _interopRequireDefault(_mathMLTree); + +var _utils = require("./utils"); + +var _utils2 = _interopRequireDefault(_utils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** - * Converts the math node into a MathML-namespaced DOM element. + * This file provides support to buildMathML.js and buildHTML.js + * for stretchy wide elements rendered from SVG files + * and other CSS trickery. */ -MathNode.prototype.toNode = function() { - var node = document.createElementNS( - "http://www.w3.org/1998/Math/MathML", this.type); - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - node.setAttribute(attr, this.attributes[attr]); +var stretchyCodePoint = { + widehat: "^", + widetilde: "~", + utilde: "~", + overleftarrow: "\u2190", + underleftarrow: "\u2190", + xleftarrow: "\u2190", + overrightarrow: "\u2192", + underrightarrow: "\u2192", + xrightarrow: "\u2192", + underbrace: "\u23B5", + overbrace: "\u23DE", + overleftrightarrow: "\u2194", + underleftrightarrow: "\u2194", + xleftrightarrow: "\u2194", + Overrightarrow: "\u21D2", + xRightarrow: "\u21D2", + overleftharpoon: "\u21BC", + xleftharpoonup: "\u21BC", + overrightharpoon: "\u21C0", + xrightharpoonup: "\u21C0", + xLeftarrow: "\u21D0", + xLeftrightarrow: "\u21D4", + xhookleftarrow: "\u21A9", + xhookrightarrow: "\u21AA", + xmapsto: "\u21A6", + xrightharpoondown: "\u21C1", + xleftharpoondown: "\u21BD", + xrightleftharpoons: "\u21CC", + xleftrightharpoons: "\u21CB", + xtwoheadleftarrow: "\u219E", + xtwoheadrightarrow: "\u21A0", + xlongequal: "=", + xtofrom: "\u21C4" +}; + +var mathMLnode = function mathMLnode(label) { + var node = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode(stretchyCodePoint[label.substr(1)])]); + node.setAttribute("stretchy", "true"); + return node; +}; + +// Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts. +// Copyright (c) 2009-2010, Design Science, Inc. () +// Copyright (c) 2014-2017 Khan Academy () +// Licensed under the SIL Open Font License, Version 1.1. +// See \nhttp://scripts.sil.org/OFL + +// Very Long SVGs +// Many of the KaTeX stretchy wide elements use a long SVG image and an +// overflow: hidden tactic to achieve a stretchy image while avoiding +// distortion of arrowheads or brace corners. + +// The SVG typically contains a very long (400 em) arrow. + +// The SVG is in a container span that has overflow: hidden, so the span +// acts like a window that exposes only part of the SVG. + +// The SVG always has a longer, thinner aspect ratio than the container span. +// After the SVG fills 100% of the height of the container span, +// there is a long arrow shaft left over. That left-over shaft is not shown. +// Instead, it is sliced off because the span's CSS has overflow: hidden. + +// Thus, the reader sees an arrow that matches the subject matter width +// without distortion. + +// Some functions, such as \cancel, need to vary their aspect ratio. These +// functions do not get the overflow SVG treatment. + +// Second Brush Stroke +// Low resolution monitors struggle to display images in fine detail. +// So browsers apply anti-aliasing. A long straight arrow shaft therefore +// will sometimes appear as if it has a blurred edge. + +// To mitigate this, these SVG files contain a second "brush-stroke" on the +// arrow shafts. That is, a second long thin rectangular SVG path has been +// written directly on top of each arrow shaft. This reinforcement causes +// some of the screen pixels to display as black instead of the anti-aliased +// gray pixel that a single path would generate. So we get arrow shafts +// whose edges appear to be sharper. + +// In the katexImagesData object just below, the dimensions all +// correspond to path geometry inside the relevant SVG. +// For example, \overrightarrow uses the same arrowhead as glyph U+2192 +// from the KaTeX Main font. The scaling factor is 1000. +// That is, inside the font, that arrowhead is 522 units tall, which +// corresponds to 0.522 em inside the document. + +var katexImagesData = { + // path(s), minWidth, height, align + overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], + overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], + underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], + underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], + xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], + xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], + Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], + xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], + xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], + overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"], + xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"], + xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"], + overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"], + xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], + xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], + xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], + xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], + xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], + + overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], + overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548], + underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548], + underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], + xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522], + xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], + xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716], + xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716], + xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522], + xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522], + overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], + underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], + overgroup: [["leftgroup", "rightgroup"], 0.888, 342], + undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342], + xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522], + xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528] +}; + +var groupLength = function groupLength(arg) { + if (arg.type === "ordgroup") { + return arg.value.length; + } else { + return 1; + } +}; + +var svgSpan = function svgSpan(group, options) { + // Create a span with inline SVG for the element. + function buildSvgSpan_() { + var viewBoxWidth = 400000; // default + var label = group.value.label.substr(1); + if (_utils2.default.contains(["widehat", "widetilde", "utilde"], label)) { + // There are four SVG images available for each function. + // Choose a taller image when there are more characters. + var numChars = groupLength(group.value.base); + var viewBoxHeight = void 0; + var pathName = void 0; + var _height = void 0; + + if (numChars > 5) { + viewBoxHeight = label === "widehat" ? 420 : 312; + viewBoxWidth = label === "widehat" ? 2364 : 2340; + // Next get the span height, in 1000 ems + _height = label === "widehat" ? 0.42 : 0.34; + pathName = (label === "widehat" ? "widehat" : "tilde") + "4"; + } else { + var imgIndex = [1, 1, 2, 2, 3, 3][numChars]; + if (label === "widehat") { + viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex]; + viewBoxHeight = [0, 239, 300, 360, 420][imgIndex]; + _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex]; + pathName = "widehat" + imgIndex; + } else { + viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex]; + viewBoxHeight = [0, 260, 286, 306, 312][imgIndex]; + _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex]; + pathName = "tilde" + imgIndex; + } + } + var path = new _domTree2.default.pathNode(pathName); + var svgNode = new _domTree2.default.svgNode([path], { + "width": "100%", + "height": _height + "em", + "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight, + "preserveAspectRatio": "none" + }); + return { + span: _buildCommon2.default.makeSpan([], [svgNode], options), + minWidth: 0, + height: _height + }; + } else { + var spans = []; + + var _katexImagesData$labe = (0, _slicedToArray3.default)(katexImagesData[label], 4), + paths = _katexImagesData$labe[0], + _minWidth = _katexImagesData$labe[1], + _viewBoxHeight = _katexImagesData$labe[2], + align1 = _katexImagesData$labe[3]; + + var _height2 = _viewBoxHeight / 1000; + + var numSvgChildren = paths.length; + var widthClasses = void 0; + var aligns = void 0; + if (numSvgChildren === 1) { + widthClasses = ["hide-tail"]; + aligns = [align1]; + } else if (numSvgChildren === 2) { + widthClasses = ["halfarrow-left", "halfarrow-right"]; + aligns = ["xMinYMin", "xMaxYMin"]; + } else if (numSvgChildren === 3) { + widthClasses = ["brace-left", "brace-center", "brace-right"]; + aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"]; + } else { + throw new Error("Correct katexImagesData or update code here to support\n " + numSvgChildren + " children."); + } + + for (var i = 0; i < numSvgChildren; i++) { + var _path = new _domTree2.default.pathNode(paths[i]); + + var _svgNode = new _domTree2.default.svgNode([_path], { + "width": "400em", + "height": _height2 + "em", + "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight, + "preserveAspectRatio": aligns[i] + " slice" + }); + + var _span = _buildCommon2.default.makeSpan([widthClasses[i]], [_svgNode], options); + if (numSvgChildren === 1) { + return { span: _span, minWidth: _minWidth, height: _height2 }; + } else { + _span.style.height = _height2 + "em"; + spans.push(_span); + } + } + + return { + span: _buildCommon2.default.makeSpan(["stretchy"], spans, options), + minWidth: _minWidth, + height: _height2 + }; } - } + } // buildSvgSpan_() - for (var i = 0; i < this.children.length; i++) { - node.appendChild(this.children[i].toNode()); + var _buildSvgSpan_ = buildSvgSpan_(), + span = _buildSvgSpan_.span, + minWidth = _buildSvgSpan_.minWidth, + height = _buildSvgSpan_.height; + + // Note that we are returning span.depth = 0. + // Any adjustments relative to the baseline must be done in buildHTML. + + + span.height = height; + span.style.height = height + "em"; + if (minWidth > 0) { + span.style.minWidth = minWidth + "em"; } - return node; + return span; }; -/** - * Converts the math node into an HTML markup string. - */ -MathNode.prototype.toMarkup = function() { - var markup = "<" + this.type; +var encloseSpan = function encloseSpan(inner, label, pad, options) { + // Return an image span for \cancel, \bcancel, \xcancel, or \fbox + var img = void 0; + var totalHeight = inner.height + inner.depth + 2 * pad; + + if (/fbox|color/.test(label)) { + img = _buildCommon2.default.makeSpan(["stretchy", label], [], options); - // Add the attributes - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - markup += " " + attr + "=\""; - markup += utils.escape(this.attributes[attr]); - markup += "\""; + if (label === "fbox") { + var color = options.color && options.getColor(); + if (color) { + img.style.borderColor = color; + } + } + } else { + // \cancel, \bcancel, or \xcancel + // Since \cancel's SVG is inline and it omits the viewBox attribute, + // its stroke-width will not vary with span area. + + var lines = []; + if (/^[bx]cancel$/.test(label)) { + lines.push(new _domTree2.default.lineNode({ + "x1": "0", + "y1": "0", + "x2": "100%", + "y2": "100%", + "stroke-width": "0.046em" + })); } - } - markup += ">"; + if (/^x?cancel$/.test(label)) { + lines.push(new _domTree2.default.lineNode({ + "x1": "0", + "y1": "100%", + "x2": "100%", + "y2": "0", + "stroke-width": "0.046em" + })); + } + + var svgNode = new _domTree2.default.svgNode(lines, { + "width": "100%", + "height": totalHeight + "em" + }); - for (var i = 0; i < this.children.length; i++) { - markup += this.children[i].toMarkup(); + img = _buildCommon2.default.makeSpan([], [svgNode], options); } - markup += ""; + img.height = totalHeight; + img.style.height = totalHeight + "em"; - return markup; + return img; }; -/** - * This node represents a piece of text. - */ -function TextNode(text) { - this.text = text; -} - -/** - * Converts the text node into a DOM text node. - */ -TextNode.prototype.toNode = function() { - return document.createTextNode(this.text); +var ruleSpan = function ruleSpan(className, options) { + // Get a big square image. The parent span will hide the overflow. + var pathNode = new _domTree2.default.pathNode('bigRule'); + var svg = new _domTree2.default.svgNode([pathNode], { + "width": "400em", + "height": "400em", + "viewBox": "0 0 400000 400000", + "preserveAspectRatio": "xMinYMin slice" + }); + return _buildCommon2.default.makeSpan([className, "hide-tail"], [svg], options); }; -/** - * Converts the text node into HTML markup (which is just the text itself). - */ -TextNode.prototype.toMarkup = function() { - return utils.escape(this.text); +exports.default = { + encloseSpan: encloseSpan, + mathMLnode: mathMLnode, + ruleSpan: ruleSpan, + svgSpan: svgSpan }; -module.exports = { - MathNode: MathNode, - TextNode: TextNode, -}; +},{"./buildCommon":91,"./domTree":98,"./mathMLTree":121,"./utils":128,"babel-runtime/helpers/slicedToArray":10}],124:[function(require,module,exports){ +'use strict'; -},{"./utils":25}],21:[function(require,module,exports){ -/** - * The resulting parse tree nodes of the parse tree. - * - * It is possible to provide position information, so that a ParseNode can - * fulfil a role similar to a Token in error reporting. - * For details on the corresponding properties see Token constructor. - * Providing such information can lead to better error reporting. - * - * @param {string} type type of node, like e.g. "ordgroup" - * @param {?object} value type-specific representation of the node - * @param {string} mode parse mode in action for this node, - * "math" or "text" - * @param {Token=} firstToken first token of the input for this node, - * will omit position information if unset - * @param {Token=} lastToken last token of the input for this node, - * will default to firstToken if unset - */ -function ParseNode(type, value, mode, firstToken, lastToken) { - this.type = type; - this.value = value; - this.mode = mode; - if (firstToken && (!lastToken || lastToken.lexer === firstToken.lexer)) { - this.lexer = firstToken.lexer; - this.start = firstToken.start; - this.end = (lastToken || firstToken).end; - } -} +Object.defineProperty(exports, "__esModule", { + value: true +}); +var path = { + // bigRule provides a big square image for frac-lines, etc. + // The actual rendered rule is smaller, controlled by overflow:hidden. + bigRule: 'M0 0 h400000 v400000 h-400000z M0 0 h400000 v400000 h-400000z', -module.exports = { - ParseNode: ParseNode, -}; + // sqrtMain path geometry is from glyph U221A in the font KaTeX Main + sqrtMain: 'M95 622c-2.667 0-7.167-2.667-13.5\n-8S72 604 72 600c0-2 .333-3.333 1-4 1.333-2.667 23.833-20.667 67.5-54s\n65.833-50.333 66.5-51c1.333-1.333 3-2 5-2 4.667 0 8.667 3.333 12 10l173\n378c.667 0 35.333-71 104-213s137.5-285 206.5-429S812 17.333 812 14c5.333\n-9.333 12-14 20-14h399166v40H845.272L620 507 385 993c-2.667 4.667-9 7-19\n7-6 0-10-1-12-3L160 575l-65 47zM834 0h399166v40H845z', + // size1 is from glyph U221A in the font KaTeX_Size1-Regular + sqrtSize1: 'M263 601c.667 0 18 39.667 52 119s68.167\n 158.667 102.5 238 51.833 119.333 52.5 120C810 373.333 980.667 17.667 982 11\nc4.667-7.333 11-11 19-11h398999v40H1012.333L741 607c-38.667 80.667-84 175-136\n 283s-89.167 185.333-111.5 232-33.833 70.333-34.5 71c-4.667 4.667-12.333 7-23\n 7l-12-1-109-253c-72.667-168-109.333-252-110-252-10.667 8-22 16.667-34 26-22\n 17.333-33.333 26-34 26l-26-26 76-59 76-60zM1001 0h398999v40H1012z', -},{}],22:[function(require,module,exports){ -/** - * Provides a single function for parsing an expression using a Parser - * TODO(emily): Remove this - */ + // size2 is from glyph U221A in the font KaTeX_Size2-Regular + sqrtSize2: 'M1001 0h398999v40H1013.084S929.667 308 749\n 880s-277 876.333-289 913c-4.667 4.667-12.667 7-24 7h-12c-1.333-3.333-3.667\n-11.667-7-25-35.333-125.333-106.667-373.333-214-744-10 12-21 25-33 39l-32 39\nc-6-5.333-15-14-27-26l25-30c26.667-32.667 52-63 76-91l52-60 208 722c56-175.333\n 126.333-397.333 211-666s153.833-488.167 207.5-658.5C944.167 129.167 975 32.667\n 983 10c4-6.667 10-10 18-10zm0 0h398999v40H1013z', -var Parser = require("./Parser"); + // size3 is from glyph U221A in the font KaTeX_Size3-Regular + sqrtSize3: 'M424 2398c-1.333-.667-38.5-172-111.5-514 S202.667 1370.667 202\n 1370c0-2-10.667 14.333-32 49-4.667 7.333-9.833 15.667-15.5 25s-9.833 16-12.5\n 20l-5 7c-4-3.333-8.333-7.667-13-13l-13-13 76-122 77-121 209 968c0-2 84.667\n-361.667 254-1079C896.333 373.667 981.667 13.333 983 10c4-6.667 10-10 18-10\nh398999v40H1014.622S927.332 418.667 742 1206c-185.333 787.333-279.333 1182.333\n-282 1185-2 6-10 9-24 9-8 0-12-.667-12-2zM1001 0h398999v40H1014z', -/** - * Parses an expression using a Parser, then returns the parsed result. - */ -var parseTree = function(toParse, settings) { - if (!(typeof toParse === 'string' || toParse instanceof String)) { - throw new TypeError('KaTeX can only parse string typed expression'); - } - var parser = new Parser(toParse, settings); + // size4 is from glyph U221A in the font KaTeX_Size4-Regular + sqrtSize4: 'M473 2713C812.333 913.667 982.333 13 983 11c3.333-7.333 9.333\n-11 18-11h399110v40H1017.698S927.168 518 741.5 1506C555.833 2494 462 2989 460\n 2991c-2 6-10 9-24 9-8 0-12-.667-12-2s-5.333-32-16-92c-50.667-293.333-119.667\n-693.333-207-1200 0-1.333-5.333 8.667-16 30l-32 64-16 33-26-26 76-153 77-151\nc.667.667 35.667 202 105 604 67.333 400.667 102 602.667 104 606z\nM1001 0h398999v40H1017z', + + // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main + doubleleftarrow: 'M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z', + + // doublerightarrow is from glyph U+21D2 in font KaTeX Main + doublerightarrow: 'M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z', + + // leftarrow is from glyph U+2190 in font KaTeX Main + leftarrow: 'M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z', + + // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular + leftbrace: 'M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z', + + leftbraceunder: 'M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z', + + // overgroup is from the MnSymbol package (public domain) + leftgroup: 'M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z', + + leftgroupunder: 'M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z', + + // Harpoons are from glyph U+21BD in font KaTeX Main + leftharpoon: 'M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z', + + leftharpoonplus: 'M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z', + + leftharpoondown: 'M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z', + + leftharpoondownplus: 'M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z', + + // hook is from glyph U+21A9 in font KaTeX Main + lefthook: 'M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z', + + leftlinesegment: 'M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z', + + leftmapsto: 'M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z', + + // tofrom is from glyph U+21C4 in font KaTeX AMS Regular + leftToFrom: 'M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z', + + longequal: 'M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z', + + midbrace: 'M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z', + + midbraceunder: 'M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z', + + rightarrow: 'M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z', + + rightbrace: 'M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z', + + rightbraceunder: 'M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z', + + rightgroup: 'M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z', + + rightgroupunder: 'M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z', + + rightharpoon: 'M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z', + + rightharpoonplus: 'M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z', + + rightharpoondown: 'M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z', + + rightharpoondownplus: 'M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z', + + righthook: 'M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z', + + rightlinesegment: 'M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z', + + rightToFrom: 'M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z', + + // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular + twoheadleftarrow: 'M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z', - return parser.parse(); + twoheadrightarrow: 'M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z', + + // tilde1 is a modified version of a glyph from the MnSymbol package + tilde1: 'M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z', + + // ditto tilde2, tilde3, & tilde4 + tilde2: 'M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z', + + tilde3: 'M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z', + + tilde4: 'M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z', + + // widehat1 is a modified version of a glyph from the MnSymbol package + widehat1: 'M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z', + + // ditto widehat2, widehat3, & widehat4 + widehat2: 'M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z', + + widehat3: 'M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z', + + widehat4: 'M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z' }; -module.exports = parseTree; +exports.default = { path: path }; + +},{}],125:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); -},{"./Parser":7}],23:[function(require,module,exports){ /** * This file holds a list of all no-argument functions and single-character * symbols (like 'a' or ';'). @@ -7919,17 +13454,20 @@ module.exports = parseTree; * accepted in (e.g. "math" or "text"). */ -module.exports = { - math: {}, - text: {}, +var symbols = { + "math": {}, + "text": {} }; +exports.default = symbols; -function defineSymbol(mode, font, group, replace, name) { - module.exports[mode][name] = { - font: font, - group: group, - replace: replace, - }; +/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */ + +function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) { + symbols[mode][name] = { font: font, group: group, replace: replace }; + + if (acceptUnicodeChar && replace) { + symbols[mode][replace] = symbols[mode][name]; + } } // Some abbreviations for commonly used strings. @@ -7959,621 +13497,810 @@ var textord = "textord"; // Now comes the symbol table // Relation Symbols -defineSymbol(math, main, rel, "\u2261", "\\equiv"); -defineSymbol(math, main, rel, "\u227a", "\\prec"); -defineSymbol(math, main, rel, "\u227b", "\\succ"); -defineSymbol(math, main, rel, "\u223c", "\\sim"); -defineSymbol(math, main, rel, "\u22a5", "\\perp"); -defineSymbol(math, main, rel, "\u2aaf", "\\preceq"); -defineSymbol(math, main, rel, "\u2ab0", "\\succeq"); -defineSymbol(math, main, rel, "\u2243", "\\simeq"); -defineSymbol(math, main, rel, "\u2223", "\\mid"); -defineSymbol(math, main, rel, "\u226a", "\\ll"); -defineSymbol(math, main, rel, "\u226b", "\\gg"); -defineSymbol(math, main, rel, "\u224d", "\\asymp"); +defineSymbol(math, main, rel, "\u2261", "\\equiv", true); +defineSymbol(math, main, rel, "\u227A", "\\prec", true); +defineSymbol(math, main, rel, "\u227B", "\\succ", true); +defineSymbol(math, main, rel, "\u223C", "\\sim", true); +defineSymbol(math, main, rel, "\u22A5", "\\perp"); +defineSymbol(math, main, rel, "\u2AAF", "\\preceq", true); +defineSymbol(math, main, rel, "\u2AB0", "\\succeq", true); +defineSymbol(math, main, rel, "\u2243", "\\simeq", true); +defineSymbol(math, main, rel, "\u2223", "\\mid", true); +defineSymbol(math, main, rel, "\u226A", "\\ll"); +defineSymbol(math, main, rel, "\u226B", "\\gg", true); +defineSymbol(math, main, rel, "\u224D", "\\asymp", true); defineSymbol(math, main, rel, "\u2225", "\\parallel"); -defineSymbol(math, main, rel, "\u22c8", "\\bowtie"); -defineSymbol(math, main, rel, "\u2323", "\\smile"); -defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq"); -defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq"); -defineSymbol(math, main, rel, "\u2250", "\\doteq"); -defineSymbol(math, main, rel, "\u2322", "\\frown"); -defineSymbol(math, main, rel, "\u220b", "\\ni"); -defineSymbol(math, main, rel, "\u221d", "\\propto"); -defineSymbol(math, main, rel, "\u22a2", "\\vdash"); -defineSymbol(math, main, rel, "\u22a3", "\\dashv"); -defineSymbol(math, main, rel, "\u220b", "\\owns"); +defineSymbol(math, main, rel, "\u22C8", "\\bowtie", true); +defineSymbol(math, main, rel, "\u2323", "\\smile", true); +defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true); +defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true); +defineSymbol(math, main, rel, "\u2250", "\\doteq", true); +defineSymbol(math, main, rel, "\u2322", "\\frown", true); +defineSymbol(math, main, rel, "\u220B", "\\ni", true); +defineSymbol(math, main, rel, "\u221D", "\\propto", true); +defineSymbol(math, main, rel, "\u22A2", "\\vdash", true); +defineSymbol(math, main, rel, "\u22A3", "\\dashv", true); +defineSymbol(math, main, rel, "\u220B", "\\owns"); // Punctuation -defineSymbol(math, main, punct, "\u002e", "\\ldotp"); -defineSymbol(math, main, punct, "\u22c5", "\\cdotp"); +defineSymbol(math, main, punct, ".", "\\ldotp"); +defineSymbol(math, main, punct, "\u22C5", "\\cdotp"); // Misc Symbols -defineSymbol(math, main, textord, "\u0023", "\\#"); -defineSymbol(math, main, textord, "\u0026", "\\&"); -defineSymbol(math, main, textord, "\u2135", "\\aleph"); -defineSymbol(math, main, textord, "\u2200", "\\forall"); -defineSymbol(math, main, textord, "\u210f", "\\hbar"); -defineSymbol(math, main, textord, "\u2203", "\\exists"); -defineSymbol(math, main, textord, "\u2207", "\\nabla"); -defineSymbol(math, main, textord, "\u266d", "\\flat"); -defineSymbol(math, main, textord, "\u2113", "\\ell"); -defineSymbol(math, main, textord, "\u266e", "\\natural"); -defineSymbol(math, main, textord, "\u2663", "\\clubsuit"); -defineSymbol(math, main, textord, "\u2118", "\\wp"); -defineSymbol(math, main, textord, "\u266f", "\\sharp"); -defineSymbol(math, main, textord, "\u2662", "\\diamondsuit"); -defineSymbol(math, main, textord, "\u211c", "\\Re"); -defineSymbol(math, main, textord, "\u2661", "\\heartsuit"); -defineSymbol(math, main, textord, "\u2111", "\\Im"); -defineSymbol(math, main, textord, "\u2660", "\\spadesuit"); +defineSymbol(math, main, textord, "#", "\\#"); +defineSymbol(text, main, textord, "#", "\\#"); +defineSymbol(math, main, textord, "&", "\\&"); +defineSymbol(text, main, textord, "&", "\\&"); +defineSymbol(math, main, textord, "\u2135", "\\aleph", true); +defineSymbol(math, main, textord, "\u2200", "\\forall", true); +defineSymbol(math, main, textord, "\u210F", "\\hbar"); +defineSymbol(math, main, textord, "\u2203", "\\exists", true); +defineSymbol(math, main, textord, "\u2207", "\\nabla", true); +defineSymbol(math, main, textord, "\u266D", "\\flat", true); +defineSymbol(math, main, textord, "\u2113", "\\ell", true); +defineSymbol(math, main, textord, "\u266E", "\\natural", true); +defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true); +defineSymbol(math, main, textord, "\u2118", "\\wp", true); +defineSymbol(math, main, textord, "\u266F", "\\sharp", true); +defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true); +defineSymbol(math, main, textord, "\u211C", "\\Re", true); +defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true); +defineSymbol(math, main, textord, "\u2111", "\\Im", true); +defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true); // Math and Text defineSymbol(math, main, textord, "\u2020", "\\dag"); +defineSymbol(text, main, textord, "\u2020", "\\dag"); +defineSymbol(text, main, textord, "\u2020", "\\textdagger"); defineSymbol(math, main, textord, "\u2021", "\\ddag"); +defineSymbol(text, main, textord, "\u2021", "\\ddag"); +defineSymbol(text, main, textord, "\u2020", "\\textdaggerdbl"); // Large Delimiters -defineSymbol(math, main, close, "\u23b1", "\\rmoustache"); -defineSymbol(math, main, open, "\u23b0", "\\lmoustache"); -defineSymbol(math, main, close, "\u27ef", "\\rgroup"); -defineSymbol(math, main, open, "\u27ee", "\\lgroup"); +defineSymbol(math, main, close, "\u23B1", "\\rmoustache"); +defineSymbol(math, main, open, "\u23B0", "\\lmoustache"); +defineSymbol(math, main, close, "\u27EF", "\\rgroup"); +defineSymbol(math, main, open, "\u27EE", "\\lgroup"); // Binary Operators -defineSymbol(math, main, bin, "\u2213", "\\mp"); -defineSymbol(math, main, bin, "\u2296", "\\ominus"); -defineSymbol(math, main, bin, "\u228e", "\\uplus"); -defineSymbol(math, main, bin, "\u2293", "\\sqcap"); +defineSymbol(math, main, bin, "\u2213", "\\mp", true); +defineSymbol(math, main, bin, "\u2296", "\\ominus", true); +defineSymbol(math, main, bin, "\u228E", "\\uplus", true); +defineSymbol(math, main, bin, "\u2293", "\\sqcap", true); defineSymbol(math, main, bin, "\u2217", "\\ast"); -defineSymbol(math, main, bin, "\u2294", "\\sqcup"); -defineSymbol(math, main, bin, "\u25ef", "\\bigcirc"); +defineSymbol(math, main, bin, "\u2294", "\\sqcup", true); +defineSymbol(math, main, bin, "\u25EF", "\\bigcirc"); defineSymbol(math, main, bin, "\u2219", "\\bullet"); defineSymbol(math, main, bin, "\u2021", "\\ddagger"); -defineSymbol(math, main, bin, "\u2240", "\\wr"); -defineSymbol(math, main, bin, "\u2a3f", "\\amalg"); +defineSymbol(math, main, bin, "\u2240", "\\wr", true); +defineSymbol(math, main, bin, "\u2A3F", "\\amalg"); +defineSymbol(math, main, bin, "&", "\\And"); // from amsmath // Arrow Symbols -defineSymbol(math, main, rel, "\u27f5", "\\longleftarrow"); -defineSymbol(math, main, rel, "\u21d0", "\\Leftarrow"); -defineSymbol(math, main, rel, "\u27f8", "\\Longleftarrow"); -defineSymbol(math, main, rel, "\u27f6", "\\longrightarrow"); -defineSymbol(math, main, rel, "\u21d2", "\\Rightarrow"); -defineSymbol(math, main, rel, "\u27f9", "\\Longrightarrow"); -defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow"); -defineSymbol(math, main, rel, "\u27f7", "\\longleftrightarrow"); -defineSymbol(math, main, rel, "\u21d4", "\\Leftrightarrow"); -defineSymbol(math, main, rel, "\u27fa", "\\Longleftrightarrow"); -defineSymbol(math, main, rel, "\u21a6", "\\mapsto"); -defineSymbol(math, main, rel, "\u27fc", "\\longmapsto"); -defineSymbol(math, main, rel, "\u2197", "\\nearrow"); -defineSymbol(math, main, rel, "\u21a9", "\\hookleftarrow"); -defineSymbol(math, main, rel, "\u21aa", "\\hookrightarrow"); -defineSymbol(math, main, rel, "\u2198", "\\searrow"); -defineSymbol(math, main, rel, "\u21bc", "\\leftharpoonup"); -defineSymbol(math, main, rel, "\u21c0", "\\rightharpoonup"); -defineSymbol(math, main, rel, "\u2199", "\\swarrow"); -defineSymbol(math, main, rel, "\u21bd", "\\leftharpoondown"); -defineSymbol(math, main, rel, "\u21c1", "\\rightharpoondown"); -defineSymbol(math, main, rel, "\u2196", "\\nwarrow"); -defineSymbol(math, main, rel, "\u21cc", "\\rightleftharpoons"); +defineSymbol(math, main, rel, "\u27F5", "\\longleftarrow", true); +defineSymbol(math, main, rel, "\u21D0", "\\Leftarrow", true); +defineSymbol(math, main, rel, "\u27F8", "\\Longleftarrow", true); +defineSymbol(math, main, rel, "\u27F6", "\\longrightarrow", true); +defineSymbol(math, main, rel, "\u21D2", "\\Rightarrow", true); +defineSymbol(math, main, rel, "\u27F9", "\\Longrightarrow", true); +defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true); +defineSymbol(math, main, rel, "\u27F7", "\\longleftrightarrow", true); +defineSymbol(math, main, rel, "\u21D4", "\\Leftrightarrow", true); +defineSymbol(math, main, rel, "\u27FA", "\\Longleftrightarrow", true); +defineSymbol(math, main, rel, "\u21A6", "\\mapsto", true); +defineSymbol(math, main, rel, "\u27FC", "\\longmapsto", true); +defineSymbol(math, main, rel, "\u2197", "\\nearrow", true); +defineSymbol(math, main, rel, "\u21A9", "\\hookleftarrow", true); +defineSymbol(math, main, rel, "\u21AA", "\\hookrightarrow", true); +defineSymbol(math, main, rel, "\u2198", "\\searrow", true); +defineSymbol(math, main, rel, "\u21BC", "\\leftharpoonup", true); +defineSymbol(math, main, rel, "\u21C0", "\\rightharpoonup", true); +defineSymbol(math, main, rel, "\u2199", "\\swarrow", true); +defineSymbol(math, main, rel, "\u21BD", "\\leftharpoondown", true); +defineSymbol(math, main, rel, "\u21C1", "\\rightharpoondown", true); +defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true); +defineSymbol(math, main, rel, "\u21CC", "\\rightleftharpoons", true); // AMS Negated Binary Relations -defineSymbol(math, ams, rel, "\u226e", "\\nless"); -defineSymbol(math, ams, rel, "\ue010", "\\nleqslant"); -defineSymbol(math, ams, rel, "\ue011", "\\nleqq"); -defineSymbol(math, ams, rel, "\u2a87", "\\lneq"); -defineSymbol(math, ams, rel, "\u2268", "\\lneqq"); -defineSymbol(math, ams, rel, "\ue00c", "\\lvertneqq"); -defineSymbol(math, ams, rel, "\u22e6", "\\lnsim"); -defineSymbol(math, ams, rel, "\u2a89", "\\lnapprox"); -defineSymbol(math, ams, rel, "\u2280", "\\nprec"); -defineSymbol(math, ams, rel, "\u22e0", "\\npreceq"); -defineSymbol(math, ams, rel, "\u22e8", "\\precnsim"); -defineSymbol(math, ams, rel, "\u2ab9", "\\precnapprox"); -defineSymbol(math, ams, rel, "\u2241", "\\nsim"); -defineSymbol(math, ams, rel, "\ue006", "\\nshortmid"); -defineSymbol(math, ams, rel, "\u2224", "\\nmid"); -defineSymbol(math, ams, rel, "\u22ac", "\\nvdash"); -defineSymbol(math, ams, rel, "\u22ad", "\\nvDash"); -defineSymbol(math, ams, rel, "\u22ea", "\\ntriangleleft"); -defineSymbol(math, ams, rel, "\u22ec", "\\ntrianglelefteq"); -defineSymbol(math, ams, rel, "\u228a", "\\subsetneq"); -defineSymbol(math, ams, rel, "\ue01a", "\\varsubsetneq"); -defineSymbol(math, ams, rel, "\u2acb", "\\subsetneqq"); -defineSymbol(math, ams, rel, "\ue017", "\\varsubsetneqq"); -defineSymbol(math, ams, rel, "\u226f", "\\ngtr"); -defineSymbol(math, ams, rel, "\ue00f", "\\ngeqslant"); -defineSymbol(math, ams, rel, "\ue00e", "\\ngeqq"); -defineSymbol(math, ams, rel, "\u2a88", "\\gneq"); -defineSymbol(math, ams, rel, "\u2269", "\\gneqq"); -defineSymbol(math, ams, rel, "\ue00d", "\\gvertneqq"); -defineSymbol(math, ams, rel, "\u22e7", "\\gnsim"); -defineSymbol(math, ams, rel, "\u2a8a", "\\gnapprox"); -defineSymbol(math, ams, rel, "\u2281", "\\nsucc"); -defineSymbol(math, ams, rel, "\u22e1", "\\nsucceq"); -defineSymbol(math, ams, rel, "\u22e9", "\\succnsim"); -defineSymbol(math, ams, rel, "\u2aba", "\\succnapprox"); -defineSymbol(math, ams, rel, "\u2246", "\\ncong"); -defineSymbol(math, ams, rel, "\ue007", "\\nshortparallel"); -defineSymbol(math, ams, rel, "\u2226", "\\nparallel"); -defineSymbol(math, ams, rel, "\u22af", "\\nVDash"); -defineSymbol(math, ams, rel, "\u22eb", "\\ntriangleright"); -defineSymbol(math, ams, rel, "\u22ed", "\\ntrianglerighteq"); -defineSymbol(math, ams, rel, "\ue018", "\\nsupseteqq"); -defineSymbol(math, ams, rel, "\u228b", "\\supsetneq"); -defineSymbol(math, ams, rel, "\ue01b", "\\varsupsetneq"); -defineSymbol(math, ams, rel, "\u2acc", "\\supsetneqq"); -defineSymbol(math, ams, rel, "\ue019", "\\varsupsetneqq"); -defineSymbol(math, ams, rel, "\u22ae", "\\nVdash"); -defineSymbol(math, ams, rel, "\u2ab5", "\\precneqq"); -defineSymbol(math, ams, rel, "\u2ab6", "\\succneqq"); -defineSymbol(math, ams, rel, "\ue016", "\\nsubseteqq"); -defineSymbol(math, ams, bin, "\u22b4", "\\unlhd"); -defineSymbol(math, ams, bin, "\u22b5", "\\unrhd"); +defineSymbol(math, ams, rel, "\u226E", "\\nless", true); +defineSymbol(math, ams, rel, "\uE010", "\\nleqslant"); +defineSymbol(math, ams, rel, "\uE011", "\\nleqq"); +defineSymbol(math, ams, rel, "\u2A87", "\\lneq", true); +defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true); +defineSymbol(math, ams, rel, "\uE00C", "\\lvertneqq"); +defineSymbol(math, ams, rel, "\u22E6", "\\lnsim", true); +defineSymbol(math, ams, rel, "\u2A89", "\\lnapprox", true); +defineSymbol(math, ams, rel, "\u2280", "\\nprec", true); +// unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym. +defineSymbol(math, ams, rel, "\u22E0", "\\npreceq", true); +defineSymbol(math, ams, rel, "\u22E8", "\\precnsim", true); +defineSymbol(math, ams, rel, "\u2AB9", "\\precnapprox", true); +defineSymbol(math, ams, rel, "\u2241", "\\nsim", true); +defineSymbol(math, ams, rel, "\uE006", "\\nshortmid"); +defineSymbol(math, ams, rel, "\u2224", "\\nmid", true); +defineSymbol(math, ams, rel, "\u22AC", "\\nvdash", true); +defineSymbol(math, ams, rel, "\u22AD", "\\nvDash", true); +defineSymbol(math, ams, rel, "\u22EA", "\\ntriangleleft"); +defineSymbol(math, ams, rel, "\u22EC", "\\ntrianglelefteq", true); +defineSymbol(math, ams, rel, "\u228A", "\\subsetneq", true); +defineSymbol(math, ams, rel, "\uE01A", "\\varsubsetneq"); +defineSymbol(math, ams, rel, "\u2ACB", "\\subsetneqq", true); +defineSymbol(math, ams, rel, "\uE017", "\\varsubsetneqq"); +defineSymbol(math, ams, rel, "\u226F", "\\ngtr", true); +defineSymbol(math, ams, rel, "\uE00F", "\\ngeqslant"); +defineSymbol(math, ams, rel, "\uE00E", "\\ngeqq"); +defineSymbol(math, ams, rel, "\u2A88", "\\gneq", true); +defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true); +defineSymbol(math, ams, rel, "\uE00D", "\\gvertneqq"); +defineSymbol(math, ams, rel, "\u22E7", "\\gnsim", true); +defineSymbol(math, ams, rel, "\u2A8A", "\\gnapprox", true); +defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true); +// unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym. +defineSymbol(math, ams, rel, "\u22E1", "\\nsucceq", true); +defineSymbol(math, ams, rel, "\u22E9", "\\succnsim", true); +defineSymbol(math, ams, rel, "\u2ABA", "\\succnapprox", true); +// unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym. +defineSymbol(math, ams, rel, "\u2246", "\\ncong", true); +defineSymbol(math, ams, rel, "\uE007", "\\nshortparallel"); +defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true); +defineSymbol(math, ams, rel, "\u22AF", "\\nVDash", true); +defineSymbol(math, ams, rel, "\u22EB", "\\ntriangleright"); +defineSymbol(math, ams, rel, "\u22ED", "\\ntrianglerighteq", true); +defineSymbol(math, ams, rel, "\uE018", "\\nsupseteqq"); +defineSymbol(math, ams, rel, "\u228B", "\\supsetneq", true); +defineSymbol(math, ams, rel, "\uE01B", "\\varsupsetneq"); +defineSymbol(math, ams, rel, "\u2ACC", "\\supsetneqq", true); +defineSymbol(math, ams, rel, "\uE019", "\\varsupsetneqq"); +defineSymbol(math, ams, rel, "\u22AE", "\\nVdash", true); +defineSymbol(math, ams, rel, "\u2AB5", "\\precneqq", true); +defineSymbol(math, ams, rel, "\u2AB6", "\\succneqq", true); +defineSymbol(math, ams, rel, "\uE016", "\\nsubseteqq"); +defineSymbol(math, ams, bin, "\u22B4", "\\unlhd"); +defineSymbol(math, ams, bin, "\u22B5", "\\unrhd"); // AMS Negated Arrows -defineSymbol(math, ams, rel, "\u219a", "\\nleftarrow"); -defineSymbol(math, ams, rel, "\u219b", "\\nrightarrow"); -defineSymbol(math, ams, rel, "\u21cd", "\\nLeftarrow"); -defineSymbol(math, ams, rel, "\u21cf", "\\nRightarrow"); -defineSymbol(math, ams, rel, "\u21ae", "\\nleftrightarrow"); -defineSymbol(math, ams, rel, "\u21ce", "\\nLeftrightarrow"); +defineSymbol(math, ams, rel, "\u219A", "\\nleftarrow", true); +defineSymbol(math, ams, rel, "\u219B", "\\nrightarrow", true); +defineSymbol(math, ams, rel, "\u21CD", "\\nLeftarrow", true); +defineSymbol(math, ams, rel, "\u21CF", "\\nRightarrow", true); +defineSymbol(math, ams, rel, "\u21AE", "\\nleftrightarrow", true); +defineSymbol(math, ams, rel, "\u21CE", "\\nLeftrightarrow", true); // AMS Misc -defineSymbol(math, ams, rel, "\u25b3", "\\vartriangle"); -defineSymbol(math, ams, textord, "\u210f", "\\hslash"); -defineSymbol(math, ams, textord, "\u25bd", "\\triangledown"); -defineSymbol(math, ams, textord, "\u25ca", "\\lozenge"); -defineSymbol(math, ams, textord, "\u24c8", "\\circledS"); -defineSymbol(math, ams, textord, "\u00ae", "\\circledR"); -defineSymbol(math, ams, textord, "\u2221", "\\measuredangle"); +defineSymbol(math, ams, rel, "\u25B3", "\\vartriangle"); +defineSymbol(math, ams, textord, "\u210F", "\\hslash"); +defineSymbol(math, ams, textord, "\u25BD", "\\triangledown"); +defineSymbol(math, ams, textord, "\u25CA", "\\lozenge"); +defineSymbol(math, ams, textord, "\u24C8", "\\circledS"); +defineSymbol(math, ams, textord, "\xAE", "\\circledR"); +defineSymbol(text, ams, textord, "\xAE", "\\circledR"); +defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true); defineSymbol(math, ams, textord, "\u2204", "\\nexists"); defineSymbol(math, ams, textord, "\u2127", "\\mho"); -defineSymbol(math, ams, textord, "\u2132", "\\Finv"); -defineSymbol(math, ams, textord, "\u2141", "\\Game"); -defineSymbol(math, ams, textord, "\u006b", "\\Bbbk"); +defineSymbol(math, ams, textord, "\u2132", "\\Finv", true); +defineSymbol(math, ams, textord, "\u2141", "\\Game", true); +defineSymbol(math, ams, textord, "k", "\\Bbbk"); defineSymbol(math, ams, textord, "\u2035", "\\backprime"); -defineSymbol(math, ams, textord, "\u25b2", "\\blacktriangle"); -defineSymbol(math, ams, textord, "\u25bc", "\\blacktriangledown"); -defineSymbol(math, ams, textord, "\u25a0", "\\blacksquare"); -defineSymbol(math, ams, textord, "\u29eb", "\\blacklozenge"); +defineSymbol(math, ams, textord, "\u25B2", "\\blacktriangle"); +defineSymbol(math, ams, textord, "\u25BC", "\\blacktriangledown"); +defineSymbol(math, ams, textord, "\u25A0", "\\blacksquare"); +defineSymbol(math, ams, textord, "\u29EB", "\\blacklozenge"); defineSymbol(math, ams, textord, "\u2605", "\\bigstar"); -defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle"); -defineSymbol(math, ams, textord, "\u2201", "\\complement"); -defineSymbol(math, ams, textord, "\u00f0", "\\eth"); +defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true); +defineSymbol(math, ams, textord, "\u2201", "\\complement", true); +// unicode-math maps U+F0 to \matheth. We map to AMS function \eth +defineSymbol(math, ams, textord, "\xF0", "\\eth", true); defineSymbol(math, ams, textord, "\u2571", "\\diagup"); defineSymbol(math, ams, textord, "\u2572", "\\diagdown"); -defineSymbol(math, ams, textord, "\u25a1", "\\square"); -defineSymbol(math, ams, textord, "\u25a1", "\\Box"); -defineSymbol(math, ams, textord, "\u25ca", "\\Diamond"); -defineSymbol(math, ams, textord, "\u00a5", "\\yen"); -defineSymbol(math, ams, textord, "\u2713", "\\checkmark"); +defineSymbol(math, ams, textord, "\u25A1", "\\square"); +defineSymbol(math, ams, textord, "\u25A1", "\\Box"); +defineSymbol(math, ams, textord, "\u25CA", "\\Diamond"); +// unicode-math maps U+A5 to \mathyen. We map to AMS function \yen +defineSymbol(math, ams, textord, "\xA5", "\\yen", true); +defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true); +defineSymbol(text, ams, textord, "\u2713", "\\checkmark"); // AMS Hebrew -defineSymbol(math, ams, textord, "\u2136", "\\beth"); -defineSymbol(math, ams, textord, "\u2138", "\\daleth"); -defineSymbol(math, ams, textord, "\u2137", "\\gimel"); +defineSymbol(math, ams, textord, "\u2136", "\\beth", true); +defineSymbol(math, ams, textord, "\u2138", "\\daleth", true); +defineSymbol(math, ams, textord, "\u2137", "\\gimel", true); // AMS Greek -defineSymbol(math, ams, textord, "\u03dd", "\\digamma"); -defineSymbol(math, ams, textord, "\u03f0", "\\varkappa"); +defineSymbol(math, ams, textord, "\u03DD", "\\digamma"); +defineSymbol(math, ams, textord, "\u03F0", "\\varkappa"); // AMS Delimiters -defineSymbol(math, ams, open, "\u250c", "\\ulcorner"); +defineSymbol(math, ams, open, "\u250C", "\\ulcorner"); defineSymbol(math, ams, close, "\u2510", "\\urcorner"); defineSymbol(math, ams, open, "\u2514", "\\llcorner"); defineSymbol(math, ams, close, "\u2518", "\\lrcorner"); // AMS Binary Relations -defineSymbol(math, ams, rel, "\u2266", "\\leqq"); -defineSymbol(math, ams, rel, "\u2a7d", "\\leqslant"); -defineSymbol(math, ams, rel, "\u2a95", "\\eqslantless"); +defineSymbol(math, ams, rel, "\u2266", "\\leqq", true); +defineSymbol(math, ams, rel, "\u2A7D", "\\leqslant"); +defineSymbol(math, ams, rel, "\u2A95", "\\eqslantless", true); defineSymbol(math, ams, rel, "\u2272", "\\lesssim"); -defineSymbol(math, ams, rel, "\u2a85", "\\lessapprox"); -defineSymbol(math, ams, rel, "\u224a", "\\approxeq"); -defineSymbol(math, ams, bin, "\u22d6", "\\lessdot"); -defineSymbol(math, ams, rel, "\u22d8", "\\lll"); +defineSymbol(math, ams, rel, "\u2A85", "\\lessapprox"); +defineSymbol(math, ams, rel, "\u224A", "\\approxeq", true); +defineSymbol(math, ams, bin, "\u22D6", "\\lessdot"); +defineSymbol(math, ams, rel, "\u22D8", "\\lll"); defineSymbol(math, ams, rel, "\u2276", "\\lessgtr"); -defineSymbol(math, ams, rel, "\u22da", "\\lesseqgtr"); -defineSymbol(math, ams, rel, "\u2a8b", "\\lesseqqgtr"); +defineSymbol(math, ams, rel, "\u22DA", "\\lesseqgtr"); +defineSymbol(math, ams, rel, "\u2A8B", "\\lesseqqgtr"); defineSymbol(math, ams, rel, "\u2251", "\\doteqdot"); -defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq"); -defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq"); -defineSymbol(math, ams, rel, "\u223d", "\\backsim"); -defineSymbol(math, ams, rel, "\u22cd", "\\backsimeq"); -defineSymbol(math, ams, rel, "\u2ac5", "\\subseteqq"); -defineSymbol(math, ams, rel, "\u22d0", "\\Subset"); -defineSymbol(math, ams, rel, "\u228f", "\\sqsubset"); -defineSymbol(math, ams, rel, "\u227c", "\\preccurlyeq"); -defineSymbol(math, ams, rel, "\u22de", "\\curlyeqprec"); -defineSymbol(math, ams, rel, "\u227e", "\\precsim"); -defineSymbol(math, ams, rel, "\u2ab7", "\\precapprox"); -defineSymbol(math, ams, rel, "\u22b2", "\\vartriangleleft"); -defineSymbol(math, ams, rel, "\u22b4", "\\trianglelefteq"); -defineSymbol(math, ams, rel, "\u22a8", "\\vDash"); -defineSymbol(math, ams, rel, "\u22aa", "\\Vvdash"); +defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq", true); +defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq", true); +defineSymbol(math, ams, rel, "\u223D", "\\backsim", true); +defineSymbol(math, ams, rel, "\u22CD", "\\backsimeq", true); +defineSymbol(math, ams, rel, "\u2AC5", "\\subseteqq", true); +defineSymbol(math, ams, rel, "\u22D0", "\\Subset", true); +defineSymbol(math, ams, rel, "\u228F", "\\sqsubset", true); +defineSymbol(math, ams, rel, "\u227C", "\\preccurlyeq", true); +defineSymbol(math, ams, rel, "\u22DE", "\\curlyeqprec", true); +defineSymbol(math, ams, rel, "\u227E", "\\precsim", true); +defineSymbol(math, ams, rel, "\u2AB7", "\\precapprox", true); +defineSymbol(math, ams, rel, "\u22B2", "\\vartriangleleft"); +defineSymbol(math, ams, rel, "\u22B4", "\\trianglelefteq"); +defineSymbol(math, ams, rel, "\u22A8", "\\vDash"); +defineSymbol(math, ams, rel, "\u22AA", "\\Vvdash", true); defineSymbol(math, ams, rel, "\u2323", "\\smallsmile"); defineSymbol(math, ams, rel, "\u2322", "\\smallfrown"); -defineSymbol(math, ams, rel, "\u224f", "\\bumpeq"); -defineSymbol(math, ams, rel, "\u224e", "\\Bumpeq"); -defineSymbol(math, ams, rel, "\u2267", "\\geqq"); -defineSymbol(math, ams, rel, "\u2a7e", "\\geqslant"); -defineSymbol(math, ams, rel, "\u2a96", "\\eqslantgtr"); -defineSymbol(math, ams, rel, "\u2273", "\\gtrsim"); -defineSymbol(math, ams, rel, "\u2a86", "\\gtrapprox"); -defineSymbol(math, ams, bin, "\u22d7", "\\gtrdot"); -defineSymbol(math, ams, rel, "\u22d9", "\\ggg"); -defineSymbol(math, ams, rel, "\u2277", "\\gtrless"); -defineSymbol(math, ams, rel, "\u22db", "\\gtreqless"); -defineSymbol(math, ams, rel, "\u2a8c", "\\gtreqqless"); -defineSymbol(math, ams, rel, "\u2256", "\\eqcirc"); -defineSymbol(math, ams, rel, "\u2257", "\\circeq"); -defineSymbol(math, ams, rel, "\u225c", "\\triangleq"); -defineSymbol(math, ams, rel, "\u223c", "\\thicksim"); +defineSymbol(math, ams, rel, "\u224F", "\\bumpeq", true); +defineSymbol(math, ams, rel, "\u224E", "\\Bumpeq", true); +defineSymbol(math, ams, rel, "\u2267", "\\geqq", true); +defineSymbol(math, ams, rel, "\u2A7E", "\\geqslant", true); +defineSymbol(math, ams, rel, "\u2A96", "\\eqslantgtr", true); +defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true); +defineSymbol(math, ams, rel, "\u2A86", "\\gtrapprox", true); +defineSymbol(math, ams, bin, "\u22D7", "\\gtrdot"); +defineSymbol(math, ams, rel, "\u22D9", "\\ggg", true); +defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true); +defineSymbol(math, ams, rel, "\u22DB", "\\gtreqless", true); +defineSymbol(math, ams, rel, "\u2A8C", "\\gtreqqless", true); +defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true); +defineSymbol(math, ams, rel, "\u2257", "\\circeq", true); +defineSymbol(math, ams, rel, "\u225C", "\\triangleq", true); +defineSymbol(math, ams, rel, "\u223C", "\\thicksim"); defineSymbol(math, ams, rel, "\u2248", "\\thickapprox"); -defineSymbol(math, ams, rel, "\u2ac6", "\\supseteqq"); -defineSymbol(math, ams, rel, "\u22d1", "\\Supset"); -defineSymbol(math, ams, rel, "\u2290", "\\sqsupset"); -defineSymbol(math, ams, rel, "\u227d", "\\succcurlyeq"); -defineSymbol(math, ams, rel, "\u22df", "\\curlyeqsucc"); -defineSymbol(math, ams, rel, "\u227f", "\\succsim"); -defineSymbol(math, ams, rel, "\u2ab8", "\\succapprox"); -defineSymbol(math, ams, rel, "\u22b3", "\\vartriangleright"); -defineSymbol(math, ams, rel, "\u22b5", "\\trianglerighteq"); -defineSymbol(math, ams, rel, "\u22a9", "\\Vdash"); +defineSymbol(math, ams, rel, "\u2AC6", "\\supseteqq", true); +defineSymbol(math, ams, rel, "\u22D1", "\\Supset", true); +defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true); +defineSymbol(math, ams, rel, "\u227D", "\\succcurlyeq", true); +defineSymbol(math, ams, rel, "\u22DF", "\\curlyeqsucc", true); +defineSymbol(math, ams, rel, "\u227F", "\\succsim", true); +defineSymbol(math, ams, rel, "\u2AB8", "\\succapprox", true); +defineSymbol(math, ams, rel, "\u22B3", "\\vartriangleright"); +defineSymbol(math, ams, rel, "\u22B5", "\\trianglerighteq"); +defineSymbol(math, ams, rel, "\u22A9", "\\Vdash", true); defineSymbol(math, ams, rel, "\u2223", "\\shortmid"); defineSymbol(math, ams, rel, "\u2225", "\\shortparallel"); -defineSymbol(math, ams, rel, "\u226c", "\\between"); -defineSymbol(math, ams, rel, "\u22d4", "\\pitchfork"); -defineSymbol(math, ams, rel, "\u221d", "\\varpropto"); -defineSymbol(math, ams, rel, "\u25c0", "\\blacktriangleleft"); -defineSymbol(math, ams, rel, "\u2234", "\\therefore"); -defineSymbol(math, ams, rel, "\u220d", "\\backepsilon"); -defineSymbol(math, ams, rel, "\u25b6", "\\blacktriangleright"); -defineSymbol(math, ams, rel, "\u2235", "\\because"); -defineSymbol(math, ams, rel, "\u22d8", "\\llless"); -defineSymbol(math, ams, rel, "\u22d9", "\\gggtr"); -defineSymbol(math, ams, bin, "\u22b2", "\\lhd"); -defineSymbol(math, ams, bin, "\u22b3", "\\rhd"); -defineSymbol(math, ams, rel, "\u2242", "\\eqsim"); -defineSymbol(math, main, rel, "\u22c8", "\\Join"); -defineSymbol(math, ams, rel, "\u2251", "\\Doteq"); +defineSymbol(math, ams, rel, "\u226C", "\\between", true); +defineSymbol(math, ams, rel, "\u22D4", "\\pitchfork", true); +defineSymbol(math, ams, rel, "\u221D", "\\varpropto"); +defineSymbol(math, ams, rel, "\u25C0", "\\blacktriangleleft"); +// unicode-math says that \therefore is a mathord atom. +// We kept the amssymb atom type, which is rel. +defineSymbol(math, ams, rel, "\u2234", "\\therefore", true); +defineSymbol(math, ams, rel, "\u220D", "\\backepsilon"); +defineSymbol(math, ams, rel, "\u25B6", "\\blacktriangleright"); +// unicode-math says that \because is a mathord atom. +// We kept the amssymb atom type, which is rel. +defineSymbol(math, ams, rel, "\u2235", "\\because", true); +defineSymbol(math, ams, rel, "\u22D8", "\\llless"); +defineSymbol(math, ams, rel, "\u22D9", "\\gggtr"); +defineSymbol(math, ams, bin, "\u22B2", "\\lhd"); +defineSymbol(math, ams, bin, "\u22B3", "\\rhd"); +defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true); +defineSymbol(math, main, rel, "\u22C8", "\\Join"); +defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators -defineSymbol(math, ams, bin, "\u2214", "\\dotplus"); +defineSymbol(math, ams, bin, "\u2214", "\\dotplus", true); defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus"); -defineSymbol(math, ams, bin, "\u22d2", "\\Cap"); -defineSymbol(math, ams, bin, "\u22d3", "\\Cup"); -defineSymbol(math, ams, bin, "\u2a5e", "\\doublebarwedge"); -defineSymbol(math, ams, bin, "\u229f", "\\boxminus"); -defineSymbol(math, ams, bin, "\u229e", "\\boxplus"); -defineSymbol(math, ams, bin, "\u22c7", "\\divideontimes"); -defineSymbol(math, ams, bin, "\u22c9", "\\ltimes"); -defineSymbol(math, ams, bin, "\u22ca", "\\rtimes"); -defineSymbol(math, ams, bin, "\u22cb", "\\leftthreetimes"); -defineSymbol(math, ams, bin, "\u22cc", "\\rightthreetimes"); -defineSymbol(math, ams, bin, "\u22cf", "\\curlywedge"); -defineSymbol(math, ams, bin, "\u22ce", "\\curlyvee"); -defineSymbol(math, ams, bin, "\u229d", "\\circleddash"); -defineSymbol(math, ams, bin, "\u229b", "\\circledast"); -defineSymbol(math, ams, bin, "\u22c5", "\\centerdot"); -defineSymbol(math, ams, bin, "\u22ba", "\\intercal"); -defineSymbol(math, ams, bin, "\u22d2", "\\doublecap"); -defineSymbol(math, ams, bin, "\u22d3", "\\doublecup"); -defineSymbol(math, ams, bin, "\u22a0", "\\boxtimes"); +defineSymbol(math, ams, bin, "\u22D2", "\\Cap", true); +defineSymbol(math, ams, bin, "\u22D3", "\\Cup", true); +defineSymbol(math, ams, bin, "\u2A5E", "\\doublebarwedge", true); +defineSymbol(math, ams, bin, "\u229F", "\\boxminus", true); +defineSymbol(math, ams, bin, "\u229E", "\\boxplus", true); +defineSymbol(math, ams, bin, "\u22C7", "\\divideontimes", true); +defineSymbol(math, ams, bin, "\u22C9", "\\ltimes", true); +defineSymbol(math, ams, bin, "\u22CA", "\\rtimes", true); +defineSymbol(math, ams, bin, "\u22CB", "\\leftthreetimes", true); +defineSymbol(math, ams, bin, "\u22CC", "\\rightthreetimes", true); +defineSymbol(math, ams, bin, "\u22CF", "\\curlywedge", true); +defineSymbol(math, ams, bin, "\u22CE", "\\curlyvee", true); +defineSymbol(math, ams, bin, "\u229D", "\\circleddash", true); +defineSymbol(math, ams, bin, "\u229B", "\\circledast", true); +defineSymbol(math, ams, bin, "\u22C5", "\\centerdot"); +defineSymbol(math, ams, bin, "\u22BA", "\\intercal", true); +defineSymbol(math, ams, bin, "\u22D2", "\\doublecap"); +defineSymbol(math, ams, bin, "\u22D3", "\\doublecup"); +defineSymbol(math, ams, bin, "\u22A0", "\\boxtimes", true); // AMS Arrows -defineSymbol(math, ams, rel, "\u21e2", "\\dashrightarrow"); -defineSymbol(math, ams, rel, "\u21e0", "\\dashleftarrow"); -defineSymbol(math, ams, rel, "\u21c7", "\\leftleftarrows"); -defineSymbol(math, ams, rel, "\u21c6", "\\leftrightarrows"); -defineSymbol(math, ams, rel, "\u21da", "\\Lleftarrow"); -defineSymbol(math, ams, rel, "\u219e", "\\twoheadleftarrow"); -defineSymbol(math, ams, rel, "\u21a2", "\\leftarrowtail"); -defineSymbol(math, ams, rel, "\u21ab", "\\looparrowleft"); -defineSymbol(math, ams, rel, "\u21cb", "\\leftrightharpoons"); -defineSymbol(math, ams, rel, "\u21b6", "\\curvearrowleft"); -defineSymbol(math, ams, rel, "\u21ba", "\\circlearrowleft"); -defineSymbol(math, ams, rel, "\u21b0", "\\Lsh"); -defineSymbol(math, ams, rel, "\u21c8", "\\upuparrows"); -defineSymbol(math, ams, rel, "\u21bf", "\\upharpoonleft"); -defineSymbol(math, ams, rel, "\u21c3", "\\downharpoonleft"); -defineSymbol(math, ams, rel, "\u22b8", "\\multimap"); -defineSymbol(math, ams, rel, "\u21ad", "\\leftrightsquigarrow"); -defineSymbol(math, ams, rel, "\u21c9", "\\rightrightarrows"); -defineSymbol(math, ams, rel, "\u21c4", "\\rightleftarrows"); -defineSymbol(math, ams, rel, "\u21a0", "\\twoheadrightarrow"); -defineSymbol(math, ams, rel, "\u21a3", "\\rightarrowtail"); -defineSymbol(math, ams, rel, "\u21ac", "\\looparrowright"); -defineSymbol(math, ams, rel, "\u21b7", "\\curvearrowright"); -defineSymbol(math, ams, rel, "\u21bb", "\\circlearrowright"); -defineSymbol(math, ams, rel, "\u21b1", "\\Rsh"); -defineSymbol(math, ams, rel, "\u21ca", "\\downdownarrows"); -defineSymbol(math, ams, rel, "\u21be", "\\upharpoonright"); -defineSymbol(math, ams, rel, "\u21c2", "\\downharpoonright"); -defineSymbol(math, ams, rel, "\u21dd", "\\rightsquigarrow"); -defineSymbol(math, ams, rel, "\u21dd", "\\leadsto"); -defineSymbol(math, ams, rel, "\u21db", "\\Rrightarrow"); -defineSymbol(math, ams, rel, "\u21be", "\\restriction"); +// Note: unicode-math maps \u21e2 to their own function \rightdasharrow. +// We'll map it to AMS function \dashrightarrow. It produces the same atom. +defineSymbol(math, ams, rel, "\u21E2", "\\dashrightarrow", true); +// unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym. +defineSymbol(math, ams, rel, "\u21E0", "\\dashleftarrow", true); +defineSymbol(math, ams, rel, "\u21C7", "\\leftleftarrows", true); +defineSymbol(math, ams, rel, "\u21C6", "\\leftrightarrows", true); +defineSymbol(math, ams, rel, "\u21DA", "\\Lleftarrow", true); +defineSymbol(math, ams, rel, "\u219E", "\\twoheadleftarrow", true); +defineSymbol(math, ams, rel, "\u21A2", "\\leftarrowtail", true); +defineSymbol(math, ams, rel, "\u21AB", "\\looparrowleft", true); +defineSymbol(math, ams, rel, "\u21CB", "\\leftrightharpoons", true); +defineSymbol(math, ams, rel, "\u21B6", "\\curvearrowleft", true); +// unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym. +defineSymbol(math, ams, rel, "\u21BA", "\\circlearrowleft", true); +defineSymbol(math, ams, rel, "\u21B0", "\\Lsh", true); +defineSymbol(math, ams, rel, "\u21C8", "\\upuparrows", true); +defineSymbol(math, ams, rel, "\u21BF", "\\upharpoonleft", true); +defineSymbol(math, ams, rel, "\u21C3", "\\downharpoonleft", true); +defineSymbol(math, ams, rel, "\u22B8", "\\multimap", true); +defineSymbol(math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true); +defineSymbol(math, ams, rel, "\u21C9", "\\rightrightarrows", true); +defineSymbol(math, ams, rel, "\u21C4", "\\rightleftarrows", true); +defineSymbol(math, ams, rel, "\u21A0", "\\twoheadrightarrow", true); +defineSymbol(math, ams, rel, "\u21A3", "\\rightarrowtail", true); +defineSymbol(math, ams, rel, "\u21AC", "\\looparrowright", true); +defineSymbol(math, ams, rel, "\u21B7", "\\curvearrowright", true); +// unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym. +defineSymbol(math, ams, rel, "\u21BB", "\\circlearrowright", true); +defineSymbol(math, ams, rel, "\u21B1", "\\Rsh", true); +defineSymbol(math, ams, rel, "\u21CA", "\\downdownarrows", true); +defineSymbol(math, ams, rel, "\u21BE", "\\upharpoonright", true); +defineSymbol(math, ams, rel, "\u21C2", "\\downharpoonright", true); +defineSymbol(math, ams, rel, "\u21DD", "\\rightsquigarrow", true); +defineSymbol(math, ams, rel, "\u21DD", "\\leadsto"); +defineSymbol(math, ams, rel, "\u21DB", "\\Rrightarrow", true); +defineSymbol(math, ams, rel, "\u21BE", "\\restriction"); defineSymbol(math, main, textord, "\u2018", "`"); defineSymbol(math, main, textord, "$", "\\$"); +defineSymbol(text, main, textord, "$", "\\$"); +defineSymbol(text, main, textord, "$", "\\textdollar"); defineSymbol(math, main, textord, "%", "\\%"); +defineSymbol(text, main, textord, "%", "\\%"); defineSymbol(math, main, textord, "_", "\\_"); -defineSymbol(math, main, textord, "\u2220", "\\angle"); -defineSymbol(math, main, textord, "\u221e", "\\infty"); +defineSymbol(text, main, textord, "_", "\\_"); +defineSymbol(text, main, textord, "_", "\\textunderscore"); +defineSymbol(math, main, textord, "\u2220", "\\angle", true); +defineSymbol(math, main, textord, "\u221E", "\\infty", true); defineSymbol(math, main, textord, "\u2032", "\\prime"); -defineSymbol(math, main, textord, "\u25b3", "\\triangle"); -defineSymbol(math, main, textord, "\u0393", "\\Gamma"); -defineSymbol(math, main, textord, "\u0394", "\\Delta"); -defineSymbol(math, main, textord, "\u0398", "\\Theta"); -defineSymbol(math, main, textord, "\u039b", "\\Lambda"); -defineSymbol(math, main, textord, "\u039e", "\\Xi"); -defineSymbol(math, main, textord, "\u03a0", "\\Pi"); -defineSymbol(math, main, textord, "\u03a3", "\\Sigma"); -defineSymbol(math, main, textord, "\u03a5", "\\Upsilon"); -defineSymbol(math, main, textord, "\u03a6", "\\Phi"); -defineSymbol(math, main, textord, "\u03a8", "\\Psi"); -defineSymbol(math, main, textord, "\u03a9", "\\Omega"); -defineSymbol(math, main, textord, "\u00ac", "\\neg"); -defineSymbol(math, main, textord, "\u00ac", "\\lnot"); -defineSymbol(math, main, textord, "\u22a4", "\\top"); -defineSymbol(math, main, textord, "\u22a5", "\\bot"); +defineSymbol(math, main, textord, "\u25B3", "\\triangle"); +defineSymbol(math, main, textord, "\u0393", "\\Gamma", true); +defineSymbol(math, main, textord, "\u0394", "\\Delta", true); +defineSymbol(math, main, textord, "\u0398", "\\Theta", true); +defineSymbol(math, main, textord, "\u039B", "\\Lambda", true); +defineSymbol(math, main, textord, "\u039E", "\\Xi", true); +defineSymbol(math, main, textord, "\u03A0", "\\Pi", true); +defineSymbol(math, main, textord, "\u03A3", "\\Sigma", true); +defineSymbol(math, main, textord, "\u03A5", "\\Upsilon", true); +defineSymbol(math, main, textord, "\u03A6", "\\Phi", true); +defineSymbol(math, main, textord, "\u03A8", "\\Psi", true); +defineSymbol(math, main, textord, "\u03A9", "\\Omega", true); +defineSymbol(math, main, textord, "\xAC", "\\neg"); +defineSymbol(math, main, textord, "\xAC", "\\lnot"); +defineSymbol(math, main, textord, "\u22A4", "\\top"); +defineSymbol(math, main, textord, "\u22A5", "\\bot"); defineSymbol(math, main, textord, "\u2205", "\\emptyset"); defineSymbol(math, ams, textord, "\u2205", "\\varnothing"); -defineSymbol(math, main, mathord, "\u03b1", "\\alpha"); -defineSymbol(math, main, mathord, "\u03b2", "\\beta"); -defineSymbol(math, main, mathord, "\u03b3", "\\gamma"); -defineSymbol(math, main, mathord, "\u03b4", "\\delta"); -defineSymbol(math, main, mathord, "\u03f5", "\\epsilon"); -defineSymbol(math, main, mathord, "\u03b6", "\\zeta"); -defineSymbol(math, main, mathord, "\u03b7", "\\eta"); -defineSymbol(math, main, mathord, "\u03b8", "\\theta"); -defineSymbol(math, main, mathord, "\u03b9", "\\iota"); -defineSymbol(math, main, mathord, "\u03ba", "\\kappa"); -defineSymbol(math, main, mathord, "\u03bb", "\\lambda"); -defineSymbol(math, main, mathord, "\u03bc", "\\mu"); -defineSymbol(math, main, mathord, "\u03bd", "\\nu"); -defineSymbol(math, main, mathord, "\u03be", "\\xi"); -defineSymbol(math, main, mathord, "o", "\\omicron"); -defineSymbol(math, main, mathord, "\u03c0", "\\pi"); -defineSymbol(math, main, mathord, "\u03c1", "\\rho"); -defineSymbol(math, main, mathord, "\u03c3", "\\sigma"); -defineSymbol(math, main, mathord, "\u03c4", "\\tau"); -defineSymbol(math, main, mathord, "\u03c5", "\\upsilon"); -defineSymbol(math, main, mathord, "\u03d5", "\\phi"); -defineSymbol(math, main, mathord, "\u03c7", "\\chi"); -defineSymbol(math, main, mathord, "\u03c8", "\\psi"); -defineSymbol(math, main, mathord, "\u03c9", "\\omega"); -defineSymbol(math, main, mathord, "\u03b5", "\\varepsilon"); -defineSymbol(math, main, mathord, "\u03d1", "\\vartheta"); -defineSymbol(math, main, mathord, "\u03d6", "\\varpi"); -defineSymbol(math, main, mathord, "\u03f1", "\\varrho"); -defineSymbol(math, main, mathord, "\u03c2", "\\varsigma"); -defineSymbol(math, main, mathord, "\u03c6", "\\varphi"); +defineSymbol(math, main, mathord, "\u03B1", "\\alpha", true); +defineSymbol(math, main, mathord, "\u03B2", "\\beta", true); +defineSymbol(math, main, mathord, "\u03B3", "\\gamma", true); +defineSymbol(math, main, mathord, "\u03B4", "\\delta", true); +defineSymbol(math, main, mathord, "\u03F5", "\\epsilon", true); +defineSymbol(math, main, mathord, "\u03B6", "\\zeta", true); +defineSymbol(math, main, mathord, "\u03B7", "\\eta", true); +defineSymbol(math, main, mathord, "\u03B8", "\\theta", true); +defineSymbol(math, main, mathord, "\u03B9", "\\iota", true); +defineSymbol(math, main, mathord, "\u03BA", "\\kappa", true); +defineSymbol(math, main, mathord, "\u03BB", "\\lambda", true); +defineSymbol(math, main, mathord, "\u03BC", "\\mu", true); +defineSymbol(math, main, mathord, "\u03BD", "\\nu", true); +defineSymbol(math, main, mathord, "\u03BE", "\\xi", true); +defineSymbol(math, main, mathord, "\u03BF", "\\omicron", true); +defineSymbol(math, main, mathord, "\u03C0", "\\pi", true); +defineSymbol(math, main, mathord, "\u03C1", "\\rho", true); +defineSymbol(math, main, mathord, "\u03C3", "\\sigma", true); +defineSymbol(math, main, mathord, "\u03C4", "\\tau", true); +defineSymbol(math, main, mathord, "\u03C5", "\\upsilon", true); +defineSymbol(math, main, mathord, "\u03D5", "\\phi", true); +defineSymbol(math, main, mathord, "\u03C7", "\\chi", true); +defineSymbol(math, main, mathord, "\u03C8", "\\psi", true); +defineSymbol(math, main, mathord, "\u03C9", "\\omega", true); +defineSymbol(math, main, mathord, "\u03B5", "\\varepsilon", true); +defineSymbol(math, main, mathord, "\u03D1", "\\vartheta", true); +defineSymbol(math, main, mathord, "\u03D6", "\\varpi", true); +defineSymbol(math, main, mathord, "\u03F1", "\\varrho", true); +defineSymbol(math, main, mathord, "\u03C2", "\\varsigma", true); +defineSymbol(math, main, mathord, "\u03C6", "\\varphi", true); defineSymbol(math, main, bin, "\u2217", "*"); defineSymbol(math, main, bin, "+", "+"); defineSymbol(math, main, bin, "\u2212", "-"); -defineSymbol(math, main, bin, "\u22c5", "\\cdot"); +defineSymbol(math, main, bin, "\u22C5", "\\cdot"); defineSymbol(math, main, bin, "\u2218", "\\circ"); -defineSymbol(math, main, bin, "\u00f7", "\\div"); -defineSymbol(math, main, bin, "\u00b1", "\\pm"); -defineSymbol(math, main, bin, "\u00d7", "\\times"); -defineSymbol(math, main, bin, "\u2229", "\\cap"); -defineSymbol(math, main, bin, "\u222a", "\\cup"); +defineSymbol(math, main, bin, "\xF7", "\\div", true); +defineSymbol(math, main, bin, "\xB1", "\\pm", true); +defineSymbol(math, main, bin, "\xD7", "\\times", true); +defineSymbol(math, main, bin, "\u2229", "\\cap", true); +defineSymbol(math, main, bin, "\u222A", "\\cup", true); defineSymbol(math, main, bin, "\u2216", "\\setminus"); defineSymbol(math, main, bin, "\u2227", "\\land"); defineSymbol(math, main, bin, "\u2228", "\\lor"); -defineSymbol(math, main, bin, "\u2227", "\\wedge"); -defineSymbol(math, main, bin, "\u2228", "\\vee"); -defineSymbol(math, main, textord, "\u221a", "\\surd"); +defineSymbol(math, main, bin, "\u2227", "\\wedge", true); +defineSymbol(math, main, bin, "\u2228", "\\vee", true); +defineSymbol(math, main, textord, "\u221A", "\\surd"); defineSymbol(math, main, open, "(", "("); defineSymbol(math, main, open, "[", "["); -defineSymbol(math, main, open, "\u27e8", "\\langle"); +defineSymbol(math, main, open, "\u27E8", "\\langle"); defineSymbol(math, main, open, "\u2223", "\\lvert"); defineSymbol(math, main, open, "\u2225", "\\lVert"); defineSymbol(math, main, close, ")", ")"); defineSymbol(math, main, close, "]", "]"); defineSymbol(math, main, close, "?", "?"); defineSymbol(math, main, close, "!", "!"); -defineSymbol(math, main, close, "\u27e9", "\\rangle"); +defineSymbol(math, main, close, "\u27E9", "\\rangle"); defineSymbol(math, main, close, "\u2223", "\\rvert"); defineSymbol(math, main, close, "\u2225", "\\rVert"); defineSymbol(math, main, rel, "=", "="); defineSymbol(math, main, rel, "<", "<"); defineSymbol(math, main, rel, ">", ">"); defineSymbol(math, main, rel, ":", ":"); -defineSymbol(math, main, rel, "\u2248", "\\approx"); -defineSymbol(math, main, rel, "\u2245", "\\cong"); +defineSymbol(math, main, rel, "\u2248", "\\approx", true); +defineSymbol(math, main, rel, "\u2245", "\\cong", true); defineSymbol(math, main, rel, "\u2265", "\\ge"); -defineSymbol(math, main, rel, "\u2265", "\\geq"); +defineSymbol(math, main, rel, "\u2265", "\\geq", true); defineSymbol(math, main, rel, "\u2190", "\\gets"); defineSymbol(math, main, rel, ">", "\\gt"); -defineSymbol(math, main, rel, "\u2208", "\\in"); -defineSymbol(math, main, rel, "\u2209", "\\notin"); -defineSymbol(math, main, rel, "\u2282", "\\subset"); -defineSymbol(math, main, rel, "\u2283", "\\supset"); -defineSymbol(math, main, rel, "\u2286", "\\subseteq"); -defineSymbol(math, main, rel, "\u2287", "\\supseteq"); -defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq"); -defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq"); -defineSymbol(math, main, rel, "\u22a8", "\\models"); -defineSymbol(math, main, rel, "\u2190", "\\leftarrow"); +defineSymbol(math, main, rel, "\u2208", "\\in", true); +defineSymbol(math, main, rel, "\u2209", "\\notin", true); +defineSymbol(math, main, rel, "\u0338", "\\not"); +defineSymbol(math, main, rel, "\u2282", "\\subset", true); +defineSymbol(math, main, rel, "\u2283", "\\supset", true); +defineSymbol(math, main, rel, "\u2286", "\\subseteq", true); +defineSymbol(math, main, rel, "\u2287", "\\supseteq", true); +defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true); +defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true); +defineSymbol(math, main, rel, "\u22A8", "\\models"); +defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true); defineSymbol(math, main, rel, "\u2264", "\\le"); -defineSymbol(math, main, rel, "\u2264", "\\leq"); +defineSymbol(math, main, rel, "\u2264", "\\leq", true); defineSymbol(math, main, rel, "<", "\\lt"); -defineSymbol(math, main, rel, "\u2260", "\\ne"); +defineSymbol(math, main, rel, "\u2260", "\\ne", true); defineSymbol(math, main, rel, "\u2260", "\\neq"); -defineSymbol(math, main, rel, "\u2192", "\\rightarrow"); +defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true); defineSymbol(math, main, rel, "\u2192", "\\to"); -defineSymbol(math, ams, rel, "\u2271", "\\ngeq"); -defineSymbol(math, ams, rel, "\u2270", "\\nleq"); +defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true); +defineSymbol(math, ams, rel, "\u2270", "\\nleq", true); defineSymbol(math, main, spacing, null, "\\!"); -defineSymbol(math, main, spacing, "\u00a0", "\\ "); -defineSymbol(math, main, spacing, "\u00a0", "~"); +defineSymbol(math, main, spacing, "\xA0", "\\ "); +defineSymbol(math, main, spacing, "\xA0", "~"); defineSymbol(math, main, spacing, null, "\\,"); defineSymbol(math, main, spacing, null, "\\:"); defineSymbol(math, main, spacing, null, "\\;"); defineSymbol(math, main, spacing, null, "\\enspace"); defineSymbol(math, main, spacing, null, "\\qquad"); defineSymbol(math, main, spacing, null, "\\quad"); -defineSymbol(math, main, spacing, "\u00a0", "\\space"); +defineSymbol(math, main, spacing, "\xA0", "\\space"); defineSymbol(math, main, punct, ",", ","); defineSymbol(math, main, punct, ";", ";"); defineSymbol(math, main, punct, ":", "\\colon"); -defineSymbol(math, ams, bin, "\u22bc", "\\barwedge"); -defineSymbol(math, ams, bin, "\u22bb", "\\veebar"); -defineSymbol(math, main, bin, "\u2299", "\\odot"); -defineSymbol(math, main, bin, "\u2295", "\\oplus"); -defineSymbol(math, main, bin, "\u2297", "\\otimes"); -defineSymbol(math, main, textord, "\u2202", "\\partial"); -defineSymbol(math, main, bin, "\u2298", "\\oslash"); -defineSymbol(math, ams, bin, "\u229a", "\\circledcirc"); -defineSymbol(math, ams, bin, "\u22a1", "\\boxdot"); -defineSymbol(math, main, bin, "\u25b3", "\\bigtriangleup"); -defineSymbol(math, main, bin, "\u25bd", "\\bigtriangledown"); +defineSymbol(math, ams, bin, "\u22BC", "\\barwedge", true); +defineSymbol(math, ams, bin, "\u22BB", "\\veebar", true); +defineSymbol(math, main, bin, "\u2299", "\\odot", true); +defineSymbol(math, main, bin, "\u2295", "\\oplus", true); +defineSymbol(math, main, bin, "\u2297", "\\otimes", true); +defineSymbol(math, main, textord, "\u2202", "\\partial", true); +defineSymbol(math, main, bin, "\u2298", "\\oslash", true); +defineSymbol(math, ams, bin, "\u229A", "\\circledcirc", true); +defineSymbol(math, ams, bin, "\u22A1", "\\boxdot", true); +defineSymbol(math, main, bin, "\u25B3", "\\bigtriangleup"); +defineSymbol(math, main, bin, "\u25BD", "\\bigtriangledown"); defineSymbol(math, main, bin, "\u2020", "\\dagger"); -defineSymbol(math, main, bin, "\u22c4", "\\diamond"); -defineSymbol(math, main, bin, "\u22c6", "\\star"); -defineSymbol(math, main, bin, "\u25c3", "\\triangleleft"); -defineSymbol(math, main, bin, "\u25b9", "\\triangleright"); +defineSymbol(math, main, bin, "\u22C4", "\\diamond"); +defineSymbol(math, main, bin, "\u22C6", "\\star"); +defineSymbol(math, main, bin, "\u25C3", "\\triangleleft"); +defineSymbol(math, main, bin, "\u25B9", "\\triangleright"); defineSymbol(math, main, open, "{", "\\{"); +defineSymbol(text, main, textord, "{", "\\{"); +defineSymbol(text, main, textord, "{", "\\textbraceleft"); defineSymbol(math, main, close, "}", "\\}"); +defineSymbol(text, main, textord, "}", "\\}"); +defineSymbol(text, main, textord, "}", "\\textbraceright"); defineSymbol(math, main, open, "{", "\\lbrace"); defineSymbol(math, main, close, "}", "\\rbrace"); defineSymbol(math, main, open, "[", "\\lbrack"); defineSymbol(math, main, close, "]", "\\rbrack"); -defineSymbol(math, main, open, "\u230a", "\\lfloor"); -defineSymbol(math, main, close, "\u230b", "\\rfloor"); +defineSymbol(text, main, textord, "<", "\\textless"); // in T1 fontenc +defineSymbol(text, main, textord, ">", "\\textgreater"); // in T1 fontenc +defineSymbol(math, main, open, "\u230A", "\\lfloor"); +defineSymbol(math, main, close, "\u230B", "\\rfloor"); defineSymbol(math, main, open, "\u2308", "\\lceil"); defineSymbol(math, main, close, "\u2309", "\\rceil"); defineSymbol(math, main, textord, "\\", "\\backslash"); defineSymbol(math, main, textord, "\u2223", "|"); defineSymbol(math, main, textord, "\u2223", "\\vert"); +defineSymbol(text, main, textord, "|", "\\textbar"); // in T1 fontenc defineSymbol(math, main, textord, "\u2225", "\\|"); defineSymbol(math, main, textord, "\u2225", "\\Vert"); -defineSymbol(math, main, rel, "\u2191", "\\uparrow"); -defineSymbol(math, main, rel, "\u21d1", "\\Uparrow"); -defineSymbol(math, main, rel, "\u2193", "\\downarrow"); -defineSymbol(math, main, rel, "\u21d3", "\\Downarrow"); -defineSymbol(math, main, rel, "\u2195", "\\updownarrow"); -defineSymbol(math, main, rel, "\u21d5", "\\Updownarrow"); -defineSymbol(math, math, op, "\u2210", "\\coprod"); -defineSymbol(math, math, op, "\u22c1", "\\bigvee"); -defineSymbol(math, math, op, "\u22c0", "\\bigwedge"); -defineSymbol(math, math, op, "\u2a04", "\\biguplus"); -defineSymbol(math, math, op, "\u22c2", "\\bigcap"); -defineSymbol(math, math, op, "\u22c3", "\\bigcup"); -defineSymbol(math, math, op, "\u222b", "\\int"); -defineSymbol(math, math, op, "\u222b", "\\intop"); -defineSymbol(math, math, op, "\u222c", "\\iint"); -defineSymbol(math, math, op, "\u222d", "\\iiint"); -defineSymbol(math, math, op, "\u220f", "\\prod"); -defineSymbol(math, math, op, "\u2211", "\\sum"); -defineSymbol(math, math, op, "\u2a02", "\\bigotimes"); -defineSymbol(math, math, op, "\u2a01", "\\bigoplus"); -defineSymbol(math, math, op, "\u2a00", "\\bigodot"); -defineSymbol(math, math, op, "\u222e", "\\oint"); -defineSymbol(math, math, op, "\u2a06", "\\bigsqcup"); -defineSymbol(math, math, op, "\u222b", "\\smallint"); -defineSymbol(math, main, inner, "\u2026", "\\ldots"); -defineSymbol(math, main, inner, "\u22ef", "\\cdots"); -defineSymbol(math, main, inner, "\u22f1", "\\ddots"); -defineSymbol(math, main, textord, "\u22ee", "\\vdots"); -defineSymbol(math, main, accent, "\u00b4", "\\acute"); -defineSymbol(math, main, accent, "\u0060", "\\grave"); -defineSymbol(math, main, accent, "\u00a8", "\\ddot"); -defineSymbol(math, main, accent, "\u007e", "\\tilde"); -defineSymbol(math, main, accent, "\u00af", "\\bar"); -defineSymbol(math, main, accent, "\u02d8", "\\breve"); -defineSymbol(math, main, accent, "\u02c7", "\\check"); -defineSymbol(math, main, accent, "\u005e", "\\hat"); -defineSymbol(math, main, accent, "\u20d7", "\\vec"); -defineSymbol(math, main, accent, "\u02d9", "\\dot"); +defineSymbol(text, main, textord, "\u2225", "\\textbardbl"); +defineSymbol(math, main, rel, "\u2191", "\\uparrow", true); +defineSymbol(math, main, rel, "\u21D1", "\\Uparrow", true); +defineSymbol(math, main, rel, "\u2193", "\\downarrow", true); +defineSymbol(math, main, rel, "\u21D3", "\\Downarrow", true); +defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true); +defineSymbol(math, main, rel, "\u21D5", "\\Updownarrow", true); +defineSymbol(math, main, op, "\u2210", "\\coprod"); +defineSymbol(math, main, op, "\u22C1", "\\bigvee"); +defineSymbol(math, main, op, "\u22C0", "\\bigwedge"); +defineSymbol(math, main, op, "\u2A04", "\\biguplus"); +defineSymbol(math, main, op, "\u22C2", "\\bigcap"); +defineSymbol(math, main, op, "\u22C3", "\\bigcup"); +defineSymbol(math, main, op, "\u222B", "\\int"); +defineSymbol(math, main, op, "\u222B", "\\intop"); +defineSymbol(math, main, op, "\u222C", "\\iint"); +defineSymbol(math, main, op, "\u222D", "\\iiint"); +defineSymbol(math, main, op, "\u220F", "\\prod"); +defineSymbol(math, main, op, "\u2211", "\\sum"); +defineSymbol(math, main, op, "\u2A02", "\\bigotimes"); +defineSymbol(math, main, op, "\u2A01", "\\bigoplus"); +defineSymbol(math, main, op, "\u2A00", "\\bigodot"); +defineSymbol(math, main, op, "\u222E", "\\oint"); +defineSymbol(math, main, op, "\u2A06", "\\bigsqcup"); +defineSymbol(math, main, op, "\u222B", "\\smallint"); +defineSymbol(text, main, inner, "\u2026", "\\textellipsis"); +defineSymbol(math, main, inner, "\u2026", "\\mathellipsis"); +defineSymbol(text, main, inner, "\u2026", "\\ldots", true); +defineSymbol(math, main, inner, "\u2026", "\\ldots", true); +defineSymbol(math, main, inner, "\u22EF", "\\@cdots", true); +defineSymbol(math, main, inner, "\u22F1", "\\ddots", true); +defineSymbol(math, main, textord, "\u22EE", "\\vdots", true); +defineSymbol(math, main, accent, "\xB4", "\\acute"); +defineSymbol(math, main, accent, "`", "\\grave"); +defineSymbol(math, main, accent, "\xA8", "\\ddot"); +defineSymbol(math, main, accent, "~", "\\tilde"); +defineSymbol(math, main, accent, "\xAF", "\\bar"); +defineSymbol(math, main, accent, "\u02D8", "\\breve"); +defineSymbol(math, main, accent, "\u02C7", "\\check"); +defineSymbol(math, main, accent, "^", "\\hat"); +defineSymbol(math, main, accent, "\u20D7", "\\vec"); +defineSymbol(math, main, accent, "\u02D9", "\\dot"); defineSymbol(math, main, mathord, "\u0131", "\\imath"); defineSymbol(math, main, mathord, "\u0237", "\\jmath"); +defineSymbol(text, main, accent, "\u02CA", "\\'"); // acute +defineSymbol(text, main, accent, "\u02CB", "\\`"); // grave +defineSymbol(text, main, accent, "\u02C6", "\\^"); // circumflex +defineSymbol(text, main, accent, "\u02DC", "\\~"); // tilde +defineSymbol(text, main, accent, "\u02C9", "\\="); // macron +defineSymbol(text, main, accent, "\u02D8", "\\u"); // breve +defineSymbol(text, main, accent, "\u02D9", "\\."); // dot above +defineSymbol(text, main, accent, "\u02DA", "\\r"); // ring above +defineSymbol(text, main, accent, "\u02C7", "\\v"); // caron +defineSymbol(text, main, accent, "\xA8", '\\"'); // diaresis +defineSymbol(text, main, accent, "\u030B", "\\H"); // double acute defineSymbol(text, main, textord, "\u2013", "--"); +defineSymbol(text, main, textord, "\u2013", "\\textendash"); defineSymbol(text, main, textord, "\u2014", "---"); +defineSymbol(text, main, textord, "\u2014", "\\textemdash"); defineSymbol(text, main, textord, "\u2018", "`"); +defineSymbol(text, main, textord, "\u2018", "\\textquoteleft"); defineSymbol(text, main, textord, "\u2019", "'"); -defineSymbol(text, main, textord, "\u201c", "``"); -defineSymbol(text, main, textord, "\u201d", "''"); -defineSymbol(math, main, textord, "\u00b0", "\\degree"); -defineSymbol(text, main, textord, "\u00b0", "\\degree"); -defineSymbol(math, main, mathord, "\u00a3", "\\pounds"); +defineSymbol(text, main, textord, "\u2019", "\\textquoteright"); +defineSymbol(text, main, textord, "\u201C", "``"); +defineSymbol(text, main, textord, "\u201C", "\\textquotedblleft"); +defineSymbol(text, main, textord, "\u201D", "''"); +defineSymbol(text, main, textord, "\u201D", "\\textquotedblright"); +defineSymbol(math, main, textord, "\xB0", "\\degree"); +defineSymbol(text, main, textord, "\xB0", "\\degree"); +// TODO: In LaTeX, \pounds can generate a different character in text and math +// mode, but among our fonts, only Main-Italic defines this character "163". +defineSymbol(math, main, mathord, "\xA3", "\\pounds"); +defineSymbol(math, main, mathord, "\xA3", "\\mathsterling", true); +defineSymbol(text, main, mathord, "\xA3", "\\pounds"); +defineSymbol(text, main, mathord, "\xA3", "\\textsterling"); defineSymbol(math, ams, textord, "\u2720", "\\maltese"); defineSymbol(text, ams, textord, "\u2720", "\\maltese"); -defineSymbol(text, main, spacing, "\u00a0", "\\ "); -defineSymbol(text, main, spacing, "\u00a0", " "); -defineSymbol(text, main, spacing, "\u00a0", "~"); +defineSymbol(text, main, spacing, "\xA0", "\\ "); +defineSymbol(text, main, spacing, "\xA0", " "); +defineSymbol(text, main, spacing, "\xA0", "~"); // There are lots of symbols which are the same, so we add them in afterwards. -var i; -var ch; // All of these are textords in math mode var mathTextSymbols = "0123456789/@.\""; -for (i = 0; i < mathTextSymbols.length; i++) { - ch = mathTextSymbols.charAt(i); +for (var i = 0; i < mathTextSymbols.length; i++) { + var ch = mathTextSymbols.charAt(i); defineSymbol(math, main, textord, ch, ch); } // All of these are textords in text mode -var textSymbols = "0123456789!@*()-=+[]\";:?/.,"; -for (i = 0; i < textSymbols.length; i++) { - ch = textSymbols.charAt(i); - defineSymbol(text, main, textord, ch, ch); +var textSymbols = "0123456789!@*()-=+[]<>|\";:?/.,"; +for (var _i = 0; _i < textSymbols.length; _i++) { + var _ch = textSymbols.charAt(_i); + defineSymbol(text, main, textord, _ch, _ch); } // All of these are textords in text mode, and mathords in math mode var letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; -for (i = 0; i < letters.length; i++) { - ch = letters.charAt(i); - defineSymbol(math, main, mathord, ch, ch); - defineSymbol(text, main, textord, ch, ch); +for (var _i2 = 0; _i2 < letters.length; _i2++) { + var _ch2 = letters.charAt(_i2); + defineSymbol(math, main, mathord, _ch2, _ch2); + defineSymbol(text, main, textord, _ch2, _ch2); } // Latin-1 letters -for (i = 0x00C0; i <= 0x00D6; i++) { - ch = String.fromCharCode(i); - defineSymbol(text, main, textord, ch, ch); +for (var _i3 = 0x00C0; _i3 <= 0x00D6; _i3++) { + var _ch3 = String.fromCharCode(_i3); + defineSymbol(math, main, mathord, _ch3, _ch3); + defineSymbol(text, main, textord, _ch3, _ch3); } -for (i = 0x00D8; i <= 0x00F6; i++) { - ch = String.fromCharCode(i); - defineSymbol(text, main, textord, ch, ch); +for (var _i4 = 0x00D8; _i4 <= 0x00F6; _i4++) { + var _ch4 = String.fromCharCode(_i4); + defineSymbol(math, main, mathord, _ch4, _ch4); + defineSymbol(text, main, textord, _ch4, _ch4); } -for (i = 0x00F8; i <= 0x00FF; i++) { - ch = String.fromCharCode(i); - defineSymbol(text, main, textord, ch, ch); +for (var _i5 = 0x00F8; _i5 <= 0x00FF; _i5++) { + var _ch5 = String.fromCharCode(_i5); + defineSymbol(math, main, mathord, _ch5, _ch5); + defineSymbol(text, main, textord, _ch5, _ch5); } // Cyrillic -for (i = 0x0410; i <= 0x044F; i++) { - ch = String.fromCharCode(i); - defineSymbol(text, main, textord, ch, ch); +for (var _i6 = 0x0410; _i6 <= 0x044F; _i6++) { + var _ch6 = String.fromCharCode(_i6); + defineSymbol(text, main, textord, _ch6, _ch6); } -},{}],24:[function(require,module,exports){ -var hangulRegex = /[\uAC00-\uD7AF]/; +// Unicode versions of existing characters +defineSymbol(text, main, textord, "\u2013", "–"); +defineSymbol(text, main, textord, "\u2014", "—"); +defineSymbol(text, main, textord, "\u2018", "‘"); +defineSymbol(text, main, textord, "\u2019", "’"); +defineSymbol(text, main, textord, "\u201C", "“"); +defineSymbol(text, main, textord, "\u201D", "”"); + +},{}],126:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var hangulRegex = exports.hangulRegex = /[\uAC00-\uD7AF]/; // This regex combines +// - CJK symbols and punctuation: [\u3000-\u303F] // - Hiragana: [\u3040-\u309F] // - Katakana: [\u30A0-\u30FF] // - CJK ideograms: [\u4E00-\u9FAF] // - Hangul syllables: [\uAC00-\uD7AF] +// - Fullwidth punctuation: [\uFF00-\uFF60] // Notably missing are halfwidth Katakana and Romanji glyphs. -var cjkRegex = - /[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/; +var cjkRegex = exports.cjkRegex = /[\u3000-\u30FF\u4E00-\u9FAF\uAC00-\uD7AF\uFF00-\uFF60]/; -module.exports = { - cjkRegex: cjkRegex, - hangulRegex: hangulRegex, +},{}],127:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.calculateSize = exports.validUnit = undefined; + +var _ParseError = require("./ParseError"); + +var _ParseError2 = _interopRequireDefault(_ParseError); + +var _Options = require("./Options"); + +var _Options2 = _interopRequireDefault(_Options); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// This table gives the number of TeX pts in one of each *absolute* TeX unit. +// Thus, multiplying a length by this number converts the length from units +// into pts. Dividing the result by ptPerEm gives the number of ems +// *assuming* a font size of ptPerEm (normal size, normal style). + + +/** + * This file does conversion between units. In particular, it provides + * calculateSize to convert other units into ems. + */ + +var ptPerUnit = { + // https://en.wikibooks.org/wiki/LaTeX/Lengths and + // https://tex.stackexchange.com/a/8263 + "pt": 1, // TeX point + "mm": 7227 / 2540, // millimeter + "cm": 7227 / 254, // centimeter + "in": 72.27, // inch + "bp": 803 / 800, // big (PostScript) points + "pc": 12, // pica + "dd": 1238 / 1157, // didot + "cc": 14856 / 1157, // cicero (12 didot) + "nd": 685 / 642, // new didot + "nc": 1370 / 107, // new cicero (12 new didot) + "sp": 1 / 65536, // scaled point (TeX's internal smallest unit) + // https://tex.stackexchange.com/a/41371 + "px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX }; -},{}],25:[function(require,module,exports){ +// Dictionary of relative units, for fast validity testing. +var relativeUnit = { + "ex": true, + "em": true, + "mu": true +}; + +/** + * Determine whether the specified unit (either a string defining the unit + * or a "size" parse node containing a unit field) is valid. + */ +var validUnit = exports.validUnit = function validUnit(unit) { + if (typeof unit !== "string") { + unit = unit.unit; + } + return unit in ptPerUnit || unit in relativeUnit || unit === "ex"; +}; + +/* + * Convert a "size" parse node (with numeric "number" and string "unit" fields, + * as parsed by functions.js argType "size") into a CSS em value for the + * current style/scale. `options` gives the current options. + */ +var calculateSize = exports.calculateSize = function calculateSize(sizeValue, options) { + var scale = void 0; + if (sizeValue.unit in ptPerUnit) { + // Absolute units + scale = ptPerUnit[sizeValue.unit] // Convert unit to pt + / options.fontMetrics().ptPerEm // Convert pt to CSS em + / options.sizeMultiplier; // Unscale to make absolute units + } else if (sizeValue.unit === "mu") { + // `mu` units scale with scriptstyle/scriptscriptstyle. + scale = options.fontMetrics().cssEmPerMu; + } else { + // Other relative units always refer to the *textstyle* font + // in the current size. + var unitOptions = void 0; + if (options.style.isTight()) { + // isTight() means current style is script/scriptscript. + unitOptions = options.havingStyle(options.style.text()); + } else { + unitOptions = options; + } + // TODO: In TeX these units are relative to the quad of the current + // *text* font, e.g. cmr10. KaTeX instead uses values from the + // comparably-sized *Computer Modern symbol* font. At 10pt, these + // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641; + // cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$. + // TeX \showlists shows a kern of 1.13889 * fontsize; + // KaTeX shows a kern of 1.171 * fontsize. + if (sizeValue.unit === "ex") { + scale = unitOptions.fontMetrics().xHeight; + } else if (sizeValue.unit === "em") { + scale = unitOptions.fontMetrics().quad; + } else { + throw new _ParseError2.default("Invalid unit: '" + sizeValue.unit + "'"); + } + if (unitOptions !== options) { + scale *= unitOptions.sizeMultiplier / options.sizeMultiplier; + } + } + return Math.min(sizeValue.number * scale, options.maxSize); +}; + +},{"./Options":83,"./ParseError":84}],128:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + /** * This file contains a list of utility functions which are useful in other * files. @@ -8584,16 +14311,15 @@ module.exports = { * possible. */ var nativeIndexOf = Array.prototype.indexOf; -var indexOf = function(list, elem) { +var indexOf = function indexOf(list, elem) { if (list == null) { return -1; } if (nativeIndexOf && list.indexOf === nativeIndexOf) { return list.indexOf(elem); } - var i = 0; var l = list.length; - for (; i < l; i++) { + for (var i = 0; i < l; i++) { if (list[i] === elem) { return i; } @@ -8604,21 +14330,22 @@ var indexOf = function(list, elem) { /** * Return whether an element is contained in a list */ -var contains = function(list, elem) { +var contains = function contains(list, elem) { return indexOf(list, elem) !== -1; }; /** * Provide a default value if a setting is undefined + * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022. */ -var deflt = function(setting, defaultIfUndefined) { +var deflt = function deflt(setting, defaultIfUndefined) { return setting === undefined ? defaultIfUndefined : setting; }; // hyphenate and escape adapted from Facebook's React under Apache 2 license var uppercase = /([A-Z])/g; -var hyphenate = function(str) { +var hyphenate = function hyphenate(str) { return str.replace(uppercase, "-$1").toLowerCase(); }; @@ -8627,38 +14354,33 @@ var ESCAPE_LOOKUP = { ">": ">", "<": "<", "\"": """, - "'": "'", + "'": "'" }; var ESCAPE_REGEX = /[&><"']/g; -function escaper(match) { - return ESCAPE_LOOKUP[match]; -} - /** * Escapes text to prevent scripting attacks. - * - * @param {*} text Text value to escape. - * @return {string} An escaped string. */ function escape(text) { - return ("" + text).replace(ESCAPE_REGEX, escaper); + return String(text).replace(ESCAPE_REGEX, function (match) { + return ESCAPE_LOOKUP[match]; + }); } /** * A function to set the text content of a DOM element in all supported * browsers. Note that we don't define this if there is no document. */ -var setTextContent; +var setTextContent = void 0; if (typeof document !== "undefined") { var testNode = document.createElement("span"); if ("textContent" in testNode) { - setTextContent = function(node, text) { + setTextContent = function setTextContent(node, text) { node.textContent = text; }; } else { - setTextContent = function(node, text) { + setTextContent = function setTextContent(node, text) { node.innerText = text; }; } @@ -8671,14 +14393,14 @@ function clearNode(node) { setTextContent(node, ""); } -module.exports = { +exports.default = { contains: contains, deflt: deflt, escape: escape, hyphenate: hyphenate, indexOf: indexOf, setTextContent: setTextContent, - clearNode: clearNode, + clearNode: clearNode }; },{}]},{},[1])(1) diff --git a/vendor/assets/stylesheets/katex.scss b/vendor/assets/stylesheets/katex.scss index b45836716f2..937a67ddc42 100644 --- a/vendor/assets/stylesheets/katex.scss +++ b/vendor/assets/stylesheets/katex.scss @@ -1,32 +1,32 @@ /* -The MIT License (MIT) + The MIT License (MIT) -Copyright (c) 2015 Khan Academy + Copyright (c) 2015 Khan Academy -This software also uses portions of the underscore.js project, which is -MIT licensed with the following copyright: + This software also uses portions of the underscore.js project, which is + MIT licensed with the following copyright: -Copyright (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative -Reporters & Editors + Copyright (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative + Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ /* Here is how to build a version of KaTeX that works with gitlab. @@ -45,112 +45,112 @@ SOFTWARE. font-family: 'KaTeX_AMS'; src: url(font-path('KaTeX_AMS-Regular.eot')); src: url(font-path('KaTeX_AMS-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_AMS-Regular.woff2')) format('woff2'), url(font-path('KaTeX_AMS-Regular.woff')) format('woff'), url(font-path('KaTeX_AMS-Regular.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Caligraphic'; src: url(font-path('KaTeX_Caligraphic-Bold.eot')); src: url(font-path('KaTeX_Caligraphic-Bold.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Caligraphic-Bold.woff2')) format('woff2'), url(font-path('KaTeX_Caligraphic-Bold.woff')) format('woff'), url(font-path('KaTeX_Caligraphic-Bold.ttf')) format('truetype'); - font-weight: 600; + font-weight: bold; font-style: normal; } @font-face { font-family: 'KaTeX_Caligraphic'; src: url(font-path('KaTeX_Caligraphic-Regular.eot')); src: url(font-path('KaTeX_Caligraphic-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Caligraphic-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Caligraphic-Regular.woff')) format('woff'), url(font-path('KaTeX_Caligraphic-Regular.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Fraktur'; src: url(font-path('KaTeX_Fraktur-Bold.eot')); src: url(font-path('KaTeX_Fraktur-Bold.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Fraktur-Bold.woff2')) format('woff2'), url(font-path('KaTeX_Fraktur-Bold.woff')) format('woff'), url(font-path('KaTeX_Fraktur-Bold.ttf')) format('truetype'); - font-weight: 600; + font-weight: bold; font-style: normal; } @font-face { font-family: 'KaTeX_Fraktur'; src: url(font-path('KaTeX_Fraktur-Regular.eot')); src: url(font-path('KaTeX_Fraktur-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Fraktur-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Fraktur-Regular.woff')) format('woff'), url(font-path('KaTeX_Fraktur-Regular.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Main'; src: url(font-path('KaTeX_Main-Bold.eot')); src: url(font-path('KaTeX_Main-Bold.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Main-Bold.woff2')) format('woff2'), url(font-path('KaTeX_Main-Bold.woff')) format('woff'), url(font-path('KaTeX_Main-Bold.ttf')) format('truetype'); - font-weight: 600; + font-weight: bold; font-style: normal; } @font-face { font-family: 'KaTeX_Main'; src: url(font-path('KaTeX_Main-Italic.eot')); src: url(font-path('KaTeX_Main-Italic.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Main-Italic.woff2')) format('woff2'), url(font-path('KaTeX_Main-Italic.woff')) format('woff'), url(font-path('KaTeX_Main-Italic.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: italic; } @font-face { font-family: 'KaTeX_Main'; src: url(font-path('KaTeX_Main-Regular.eot')); src: url(font-path('KaTeX_Main-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Main-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Main-Regular.woff')) format('woff'), url(font-path('KaTeX_Main-Regular.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Math'; src: url(font-path('KaTeX_Math-Italic.eot')); src: url(font-path('KaTeX_Math-Italic.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Math-Italic.woff2')) format('woff2'), url(font-path('KaTeX_Math-Italic.woff')) format('woff'), url(font-path('KaTeX_Math-Italic.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: italic; } @font-face { font-family: 'KaTeX_SansSerif'; src: url(font-path('KaTeX_SansSerif-Regular.eot')); src: url(font-path('KaTeX_SansSerif-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_SansSerif-Regular.woff2')) format('woff2'), url(font-path('KaTeX_SansSerif-Regular.woff')) format('woff'), url(font-path('KaTeX_SansSerif-Regular.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Script'; src: url(font-path('KaTeX_Script-Regular.eot')); src: url(font-path('KaTeX_Script-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Script-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Script-Regular.woff')) format('woff'), url(font-path('KaTeX_Script-Regular.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Size1'; src: url(font-path('KaTeX_Size1-Regular.eot')); src: url(font-path('KaTeX_Size1-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Size1-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Size1-Regular.woff')) format('woff'), url(font-path('KaTeX_Size1-Regular.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Size2'; src: url(font-path('KaTeX_Size2-Regular.eot')); src: url(font-path('KaTeX_Size2-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Size2-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Size2-Regular.woff')) format('woff'), url(font-path('KaTeX_Size2-Regular.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Size3'; src: url(font-path('KaTeX_Size3-Regular.eot')); src: url(font-path('KaTeX_Size3-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Size3-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Size3-Regular.woff')) format('woff'), url(font-path('KaTeX_Size3-Regular.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Size4'; src: url(font-path('KaTeX_Size4-Regular.eot')); src: url(font-path('KaTeX_Size4-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Size4-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Size4-Regular.woff')) format('woff'), url(font-path('KaTeX_Size4-Regular.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: normal; } @font-face { font-family: 'KaTeX_Typewriter'; src: url(font-path('KaTeX_Typewriter-Regular.eot')); src: url(font-path('KaTeX_Typewriter-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Typewriter-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Typewriter-Regular.woff')) format('woff'), url(font-path('KaTeX_Typewriter-Regular.ttf')) format('truetype'); - font-weight: 400; + font-weight: normal; font-style: normal; } .katex-display { @@ -167,6 +167,10 @@ SOFTWARE. line-height: 1.2; white-space: nowrap; text-indent: 0; + text-rendering: auto; +} +.katex * { + -ms-high-contrast-adjust: none !important; } .katex .katex-html { display: inline-block; @@ -181,18 +185,25 @@ SOFTWARE. overflow: hidden; } .katex .base { + position: relative; display: inline-block; } .katex .strut { display: inline-block; } +.katex .mathrm { + font-style: normal; +} +.katex .textit { + font-style: italic; +} .katex .mathit { font-family: KaTeX_Math; font-style: italic; } .katex .mathbf { font-family: KaTeX_Main; - font-weight: 600; + font-weight: bold; } .katex .amsrm { font-family: KaTeX_AMS; @@ -219,155 +230,162 @@ SOFTWARE. font-family: KaTeX_Main; font-style: italic; } -.katex .textstyle > .mord + .mop { +.katex .mainrm { + font-family: KaTeX_Main; + font-style: normal; +} +.katex .mord + .mop { margin-left: 0.16667em; } -.katex .textstyle > .mord + .mbin { +.katex .mord + .mbin { margin-left: 0.22222em; } -.katex .textstyle > .mord + .mrel { +.katex .mord + .mrel { margin-left: 0.27778em; } -.katex .textstyle > .mord + .minner { +.katex .mord + .minner { margin-left: 0.16667em; } -.katex .textstyle > .mop + .mord { +.katex .mop + .mord { margin-left: 0.16667em; } -.katex .textstyle > .mop + .mop { +.katex .mop + .mop { margin-left: 0.16667em; } -.katex .textstyle > .mop + .mrel { +.katex .mop + .mrel { margin-left: 0.27778em; } -.katex .textstyle > .mop + .minner { +.katex .mop + .minner { margin-left: 0.16667em; } -.katex .textstyle > .mbin + .mord { +.katex .mbin + .mord { margin-left: 0.22222em; } -.katex .textstyle > .mbin + .mop { +.katex .mbin + .mop { margin-left: 0.22222em; } -.katex .textstyle > .mbin + .mopen { +.katex .mbin + .mopen { margin-left: 0.22222em; } -.katex .textstyle > .mbin + .minner { +.katex .mbin + .minner { margin-left: 0.22222em; } -.katex .textstyle > .mrel + .mord { +.katex .mrel + .mord { margin-left: 0.27778em; } -.katex .textstyle > .mrel + .mop { +.katex .mrel + .mop { margin-left: 0.27778em; } -.katex .textstyle > .mrel + .mopen { +.katex .mrel + .mopen { margin-left: 0.27778em; } -.katex .textstyle > .mrel + .minner { +.katex .mrel + .minner { margin-left: 0.27778em; } -.katex .textstyle > .mclose + .mop { +.katex .mclose + .mop { margin-left: 0.16667em; } -.katex .textstyle > .mclose + .mbin { +.katex .mclose + .mbin { margin-left: 0.22222em; } -.katex .textstyle > .mclose + .mrel { +.katex .mclose + .mrel { margin-left: 0.27778em; } -.katex .textstyle > .mclose + .minner { +.katex .mclose + .minner { margin-left: 0.16667em; } -.katex .textstyle > .mpunct + .mord { +.katex .mpunct + .mord { margin-left: 0.16667em; } -.katex .textstyle > .mpunct + .mop { +.katex .mpunct + .mop { margin-left: 0.16667em; } -.katex .textstyle > .mpunct + .mrel { +.katex .mpunct + .mrel { margin-left: 0.16667em; } -.katex .textstyle > .mpunct + .mopen { +.katex .mpunct + .mopen { margin-left: 0.16667em; } -.katex .textstyle > .mpunct + .mclose { +.katex .mpunct + .mclose { margin-left: 0.16667em; } -.katex .textstyle > .mpunct + .mpunct { +.katex .mpunct + .mpunct { margin-left: 0.16667em; } -.katex .textstyle > .mpunct + .minner { +.katex .mpunct + .minner { margin-left: 0.16667em; } -.katex .textstyle > .minner + .mord { +.katex .minner + .mord { margin-left: 0.16667em; } -.katex .textstyle > .minner + .mop { +.katex .minner + .mop { margin-left: 0.16667em; } -.katex .textstyle > .minner + .mbin { +.katex .minner + .mbin { margin-left: 0.22222em; } -.katex .textstyle > .minner + .mrel { +.katex .minner + .mrel { margin-left: 0.27778em; } -.katex .textstyle > .minner + .mopen { +.katex .minner + .mopen { margin-left: 0.16667em; } -.katex .textstyle > .minner + .mpunct { +.katex .minner + .mpunct { margin-left: 0.16667em; } -.katex .textstyle > .minner + .minner { +.katex .minner + .minner { margin-left: 0.16667em; } -.katex .mord + .mop { - margin-left: 0.16667em; +.katex .mord.mtight { + margin-left: 0; } -.katex .mop + .mord { - margin-left: 0.16667em; +.katex .mop.mtight { + margin-left: 0; } -.katex .mop + .mop { - margin-left: 0.16667em; +.katex .mbin.mtight { + margin-left: 0; } -.katex .mclose + .mop { - margin-left: 0.16667em; +.katex .mrel.mtight { + margin-left: 0; } -.katex .minner + .mop { - margin-left: 0.16667em; +.katex .mopen.mtight { + margin-left: 0; } -.katex .reset-textstyle.textstyle { - font-size: 1em; +.katex .mclose.mtight { + margin-left: 0; } -.katex .reset-textstyle.scriptstyle { - font-size: 0.7em; +.katex .mpunct.mtight { + margin-left: 0; } -.katex .reset-textstyle.scriptscriptstyle { - font-size: 0.5em; +.katex .minner.mtight { + margin-left: 0; } -.katex .reset-scriptstyle.textstyle { - font-size: 1.42857em; +.katex .mord + .mop.mtight { + margin-left: 0.16667em; } -.katex .reset-scriptstyle.scriptstyle { - font-size: 1em; +.katex .mop + .mord.mtight { + margin-left: 0.16667em; } -.katex .reset-scriptstyle.scriptscriptstyle { - font-size: 0.71429em; +.katex .mop + .mop.mtight { + margin-left: 0.16667em; } -.katex .reset-scriptscriptstyle.textstyle { - font-size: 2em; +.katex .mclose + .mop.mtight { + margin-left: 0.16667em; } -.katex .reset-scriptscriptstyle.scriptstyle { - font-size: 1.4em; +.katex .minner + .mop.mtight { + margin-left: 0.16667em; } -.katex .reset-scriptscriptstyle.scriptscriptstyle { - font-size: 1em; +.katex .vlist-t { + display: inline-table; + table-layout: fixed; } -.katex .style-wrap { - position: relative; +.katex .vlist-r { + display: table-row; } .katex .vlist { - display: inline-block; + display: table-cell; + vertical-align: bottom; + position: relative; } .katex .vlist > span { display: block; @@ -377,9 +395,18 @@ SOFTWARE. .katex .vlist > span > span { display: inline-block; } -.katex .vlist .baseline-fix { - display: inline-table; - table-layout: fixed; +.katex .vlist > span > .pstrut { + overflow: hidden; + width: 0; +} +.katex .vlist-t2 { + margin-right: -2px; +} +.katex .vlist-s { + display: table-cell; + vertical-align: bottom; + font-size: 1px; + width: 2px; } .katex .msupsub { text-align: left; @@ -388,20 +415,22 @@ SOFTWARE. text-align: center; } .katex .mfrac .frac-line { + display: inline-block; width: 100%; } -.katex .mfrac .frac-line:before { - border-bottom-style: solid; - border-bottom-width: 1px; - content: ""; - display: block; +@media screen { + .katex .mfrac .frac-line, + .katex .overline .overline-line, + .katex .underline .underline-line { + min-height: 1px; + } } -.katex .mfrac .frac-line:after { - border-bottom-style: solid; - border-bottom-width: 0.04em; - content: ""; - display: block; - margin-top: -1px; +@media screen and (-webkit-min-device-pixel-ratio: 2), screen and (min-resolution: 192dpi) { + .katex .mfrac .frac-line, + .katex .overline .overline-line, + .katex .underline .underline-line { + min-height: 0.5px; + } } .katex .mspace { display: inline-block; @@ -409,18 +438,33 @@ SOFTWARE. .katex .mspace.negativethinspace { margin-left: -0.16667em; } +.katex .mspace.muspace { + width: 0.055556em; +} .katex .mspace.thinspace { width: 0.16667em; } +.katex .mspace.negativemediumspace { + margin-left: -0.22222em; +} .katex .mspace.mediumspace { width: 0.22222em; } .katex .mspace.thickspace { width: 0.27778em; } +.katex .mspace.sixmuspace { + width: 0.333333em; +} +.katex .mspace.eightmuspace { + width: 0.444444em; +} .katex .mspace.enspace { width: 0.5em; } +.katex .mspace.twelvemuspace { + width: 0.666667em; +} .katex .mspace.quad { width: 1em; } @@ -428,24 +472,32 @@ SOFTWARE. width: 2em; } .katex .llap, -.katex .rlap { +.katex .rlap, +.katex .clap { width: 0; position: relative; } .katex .llap > .inner, -.katex .rlap > .inner { +.katex .rlap > .inner, +.katex .clap > .inner { position: absolute; } .katex .llap > .fix, -.katex .rlap > .fix { +.katex .rlap > .fix, +.katex .clap > .fix { display: inline-block; } .katex .llap > .inner { right: 0; } -.katex .rlap > .inner { +.katex .rlap > .inner, +.katex .clap > .inner { left: 0; } +.katex .clap > .inner > span { + margin-left: -50%; + margin-right: 50%; +} .katex .katex-logo .a { font-size: 0.75em; margin-left: -0.32em; @@ -470,42 +522,9 @@ SOFTWARE. } .katex .overline .overline-line, .katex .underline .underline-line { + display: inline-block; width: 100%; } -.katex .overline .overline-line:before, -.katex .underline .underline-line:before { - border-bottom-style: solid; - border-bottom-width: 1px; - content: ""; - display: block; -} -.katex .overline .overline-line:after, -.katex .underline .underline-line:after { - border-bottom-style: solid; - border-bottom-width: 0.04em; - content: ""; - display: block; - margin-top: -1px; -} -.katex .sqrt > .sqrt-sign { - position: relative; -} -.katex .sqrt .sqrt-line { - width: 100%; -} -.katex .sqrt .sqrt-line:before { - border-bottom-style: solid; - border-bottom-width: 1px; - content: ""; - display: block; -} -.katex .sqrt .sqrt-line:after { - border-bottom-style: solid; - border-bottom-width: 0.04em; - content: ""; - display: block; - margin-top: -1px; -} .katex .sqrt > .root { margin-left: 0.27777778em; margin-right: -0.55555556em; @@ -520,43 +539,47 @@ SOFTWARE. } .katex .sizing.reset-size1.size2, .katex .fontsize-ensurer.reset-size1.size2 { - font-size: 1.4em; + font-size: 1.2em; } .katex .sizing.reset-size1.size3, .katex .fontsize-ensurer.reset-size1.size3 { - font-size: 1.6em; + font-size: 1.4em; } .katex .sizing.reset-size1.size4, .katex .fontsize-ensurer.reset-size1.size4 { - font-size: 1.8em; + font-size: 1.6em; } .katex .sizing.reset-size1.size5, .katex .fontsize-ensurer.reset-size1.size5 { - font-size: 2em; + font-size: 1.8em; } .katex .sizing.reset-size1.size6, .katex .fontsize-ensurer.reset-size1.size6 { - font-size: 2.4em; + font-size: 2em; } .katex .sizing.reset-size1.size7, .katex .fontsize-ensurer.reset-size1.size7 { - font-size: 2.88em; + font-size: 2.4em; } .katex .sizing.reset-size1.size8, .katex .fontsize-ensurer.reset-size1.size8 { - font-size: 3.46em; + font-size: 2.88em; } .katex .sizing.reset-size1.size9, .katex .fontsize-ensurer.reset-size1.size9 { - font-size: 4.14em; + font-size: 3.456em; } .katex .sizing.reset-size1.size10, .katex .fontsize-ensurer.reset-size1.size10 { - font-size: 4.98em; + font-size: 4.148em; +} +.katex .sizing.reset-size1.size11, +.katex .fontsize-ensurer.reset-size1.size11 { + font-size: 4.976em; } .katex .sizing.reset-size2.size1, .katex .fontsize-ensurer.reset-size2.size1 { - font-size: 0.71428571em; + font-size: 0.83333333em; } .katex .sizing.reset-size2.size2, .katex .fontsize-ensurer.reset-size2.size2 { @@ -564,43 +587,47 @@ SOFTWARE. } .katex .sizing.reset-size2.size3, .katex .fontsize-ensurer.reset-size2.size3 { - font-size: 1.14285714em; + font-size: 1.16666667em; } .katex .sizing.reset-size2.size4, .katex .fontsize-ensurer.reset-size2.size4 { - font-size: 1.28571429em; + font-size: 1.33333333em; } .katex .sizing.reset-size2.size5, .katex .fontsize-ensurer.reset-size2.size5 { - font-size: 1.42857143em; + font-size: 1.5em; } .katex .sizing.reset-size2.size6, .katex .fontsize-ensurer.reset-size2.size6 { - font-size: 1.71428571em; + font-size: 1.66666667em; } .katex .sizing.reset-size2.size7, .katex .fontsize-ensurer.reset-size2.size7 { - font-size: 2.05714286em; + font-size: 2em; } .katex .sizing.reset-size2.size8, .katex .fontsize-ensurer.reset-size2.size8 { - font-size: 2.47142857em; + font-size: 2.4em; } .katex .sizing.reset-size2.size9, .katex .fontsize-ensurer.reset-size2.size9 { - font-size: 2.95714286em; + font-size: 2.88em; } .katex .sizing.reset-size2.size10, .katex .fontsize-ensurer.reset-size2.size10 { - font-size: 3.55714286em; + font-size: 3.45666667em; +} +.katex .sizing.reset-size2.size11, +.katex .fontsize-ensurer.reset-size2.size11 { + font-size: 4.14666667em; } .katex .sizing.reset-size3.size1, .katex .fontsize-ensurer.reset-size3.size1 { - font-size: 0.625em; + font-size: 0.71428571em; } .katex .sizing.reset-size3.size2, .katex .fontsize-ensurer.reset-size3.size2 { - font-size: 0.875em; + font-size: 0.85714286em; } .katex .sizing.reset-size3.size3, .katex .fontsize-ensurer.reset-size3.size3 { @@ -608,43 +635,47 @@ SOFTWARE. } .katex .sizing.reset-size3.size4, .katex .fontsize-ensurer.reset-size3.size4 { - font-size: 1.125em; + font-size: 1.14285714em; } .katex .sizing.reset-size3.size5, .katex .fontsize-ensurer.reset-size3.size5 { - font-size: 1.25em; + font-size: 1.28571429em; } .katex .sizing.reset-size3.size6, .katex .fontsize-ensurer.reset-size3.size6 { - font-size: 1.5em; + font-size: 1.42857143em; } .katex .sizing.reset-size3.size7, .katex .fontsize-ensurer.reset-size3.size7 { - font-size: 1.8em; + font-size: 1.71428571em; } .katex .sizing.reset-size3.size8, .katex .fontsize-ensurer.reset-size3.size8 { - font-size: 2.1625em; + font-size: 2.05714286em; } .katex .sizing.reset-size3.size9, .katex .fontsize-ensurer.reset-size3.size9 { - font-size: 2.5875em; + font-size: 2.46857143em; } .katex .sizing.reset-size3.size10, .katex .fontsize-ensurer.reset-size3.size10 { - font-size: 3.1125em; + font-size: 2.96285714em; +} +.katex .sizing.reset-size3.size11, +.katex .fontsize-ensurer.reset-size3.size11 { + font-size: 3.55428571em; } .katex .sizing.reset-size4.size1, .katex .fontsize-ensurer.reset-size4.size1 { - font-size: 0.55555556em; + font-size: 0.625em; } .katex .sizing.reset-size4.size2, .katex .fontsize-ensurer.reset-size4.size2 { - font-size: 0.77777778em; + font-size: 0.75em; } .katex .sizing.reset-size4.size3, .katex .fontsize-ensurer.reset-size4.size3 { - font-size: 0.88888889em; + font-size: 0.875em; } .katex .sizing.reset-size4.size4, .katex .fontsize-ensurer.reset-size4.size4 { @@ -652,43 +683,47 @@ SOFTWARE. } .katex .sizing.reset-size4.size5, .katex .fontsize-ensurer.reset-size4.size5 { - font-size: 1.11111111em; + font-size: 1.125em; } .katex .sizing.reset-size4.size6, .katex .fontsize-ensurer.reset-size4.size6 { - font-size: 1.33333333em; + font-size: 1.25em; } .katex .sizing.reset-size4.size7, .katex .fontsize-ensurer.reset-size4.size7 { - font-size: 1.6em; + font-size: 1.5em; } .katex .sizing.reset-size4.size8, .katex .fontsize-ensurer.reset-size4.size8 { - font-size: 1.92222222em; + font-size: 1.8em; } .katex .sizing.reset-size4.size9, .katex .fontsize-ensurer.reset-size4.size9 { - font-size: 2.3em; + font-size: 2.16em; } .katex .sizing.reset-size4.size10, .katex .fontsize-ensurer.reset-size4.size10 { - font-size: 2.76666667em; + font-size: 2.5925em; +} +.katex .sizing.reset-size4.size11, +.katex .fontsize-ensurer.reset-size4.size11 { + font-size: 3.11em; } .katex .sizing.reset-size5.size1, .katex .fontsize-ensurer.reset-size5.size1 { - font-size: 0.5em; + font-size: 0.55555556em; } .katex .sizing.reset-size5.size2, .katex .fontsize-ensurer.reset-size5.size2 { - font-size: 0.7em; + font-size: 0.66666667em; } .katex .sizing.reset-size5.size3, .katex .fontsize-ensurer.reset-size5.size3 { - font-size: 0.8em; + font-size: 0.77777778em; } .katex .sizing.reset-size5.size4, .katex .fontsize-ensurer.reset-size5.size4 { - font-size: 0.9em; + font-size: 0.88888889em; } .katex .sizing.reset-size5.size5, .katex .fontsize-ensurer.reset-size5.size5 { @@ -696,43 +731,47 @@ SOFTWARE. } .katex .sizing.reset-size5.size6, .katex .fontsize-ensurer.reset-size5.size6 { - font-size: 1.2em; + font-size: 1.11111111em; } .katex .sizing.reset-size5.size7, .katex .fontsize-ensurer.reset-size5.size7 { - font-size: 1.44em; + font-size: 1.33333333em; } .katex .sizing.reset-size5.size8, .katex .fontsize-ensurer.reset-size5.size8 { - font-size: 1.73em; + font-size: 1.6em; } .katex .sizing.reset-size5.size9, .katex .fontsize-ensurer.reset-size5.size9 { - font-size: 2.07em; + font-size: 1.92em; } .katex .sizing.reset-size5.size10, .katex .fontsize-ensurer.reset-size5.size10 { - font-size: 2.49em; + font-size: 2.30444444em; +} +.katex .sizing.reset-size5.size11, +.katex .fontsize-ensurer.reset-size5.size11 { + font-size: 2.76444444em; } .katex .sizing.reset-size6.size1, .katex .fontsize-ensurer.reset-size6.size1 { - font-size: 0.41666667em; + font-size: 0.5em; } .katex .sizing.reset-size6.size2, .katex .fontsize-ensurer.reset-size6.size2 { - font-size: 0.58333333em; + font-size: 0.6em; } .katex .sizing.reset-size6.size3, .katex .fontsize-ensurer.reset-size6.size3 { - font-size: 0.66666667em; + font-size: 0.7em; } .katex .sizing.reset-size6.size4, .katex .fontsize-ensurer.reset-size6.size4 { - font-size: 0.75em; + font-size: 0.8em; } .katex .sizing.reset-size6.size5, .katex .fontsize-ensurer.reset-size6.size5 { - font-size: 0.83333333em; + font-size: 0.9em; } .katex .sizing.reset-size6.size6, .katex .fontsize-ensurer.reset-size6.size6 { @@ -744,35 +783,39 @@ SOFTWARE. } .katex .sizing.reset-size6.size8, .katex .fontsize-ensurer.reset-size6.size8 { - font-size: 1.44166667em; + font-size: 1.44em; } .katex .sizing.reset-size6.size9, .katex .fontsize-ensurer.reset-size6.size9 { - font-size: 1.725em; + font-size: 1.728em; } .katex .sizing.reset-size6.size10, .katex .fontsize-ensurer.reset-size6.size10 { - font-size: 2.075em; + font-size: 2.074em; +} +.katex .sizing.reset-size6.size11, +.katex .fontsize-ensurer.reset-size6.size11 { + font-size: 2.488em; } .katex .sizing.reset-size7.size1, .katex .fontsize-ensurer.reset-size7.size1 { - font-size: 0.34722222em; + font-size: 0.41666667em; } .katex .sizing.reset-size7.size2, .katex .fontsize-ensurer.reset-size7.size2 { - font-size: 0.48611111em; + font-size: 0.5em; } .katex .sizing.reset-size7.size3, .katex .fontsize-ensurer.reset-size7.size3 { - font-size: 0.55555556em; + font-size: 0.58333333em; } .katex .sizing.reset-size7.size4, .katex .fontsize-ensurer.reset-size7.size4 { - font-size: 0.625em; + font-size: 0.66666667em; } .katex .sizing.reset-size7.size5, .katex .fontsize-ensurer.reset-size7.size5 { - font-size: 0.69444444em; + font-size: 0.75em; } .katex .sizing.reset-size7.size6, .katex .fontsize-ensurer.reset-size7.size6 { @@ -784,43 +827,47 @@ SOFTWARE. } .katex .sizing.reset-size7.size8, .katex .fontsize-ensurer.reset-size7.size8 { - font-size: 1.20138889em; + font-size: 1.2em; } .katex .sizing.reset-size7.size9, .katex .fontsize-ensurer.reset-size7.size9 { - font-size: 1.4375em; + font-size: 1.44em; } .katex .sizing.reset-size7.size10, .katex .fontsize-ensurer.reset-size7.size10 { - font-size: 1.72916667em; + font-size: 1.72833333em; +} +.katex .sizing.reset-size7.size11, +.katex .fontsize-ensurer.reset-size7.size11 { + font-size: 2.07333333em; } .katex .sizing.reset-size8.size1, .katex .fontsize-ensurer.reset-size8.size1 { - font-size: 0.28901734em; + font-size: 0.34722222em; } .katex .sizing.reset-size8.size2, .katex .fontsize-ensurer.reset-size8.size2 { - font-size: 0.40462428em; + font-size: 0.41666667em; } .katex .sizing.reset-size8.size3, .katex .fontsize-ensurer.reset-size8.size3 { - font-size: 0.46242775em; + font-size: 0.48611111em; } .katex .sizing.reset-size8.size4, .katex .fontsize-ensurer.reset-size8.size4 { - font-size: 0.52023121em; + font-size: 0.55555556em; } .katex .sizing.reset-size8.size5, .katex .fontsize-ensurer.reset-size8.size5 { - font-size: 0.57803468em; + font-size: 0.625em; } .katex .sizing.reset-size8.size6, .katex .fontsize-ensurer.reset-size8.size6 { - font-size: 0.69364162em; + font-size: 0.69444444em; } .katex .sizing.reset-size8.size7, .katex .fontsize-ensurer.reset-size8.size7 { - font-size: 0.83236994em; + font-size: 0.83333333em; } .katex .sizing.reset-size8.size8, .katex .fontsize-ensurer.reset-size8.size8 { @@ -828,43 +875,47 @@ SOFTWARE. } .katex .sizing.reset-size8.size9, .katex .fontsize-ensurer.reset-size8.size9 { - font-size: 1.19653179em; + font-size: 1.2em; } .katex .sizing.reset-size8.size10, .katex .fontsize-ensurer.reset-size8.size10 { - font-size: 1.43930636em; + font-size: 1.44027778em; +} +.katex .sizing.reset-size8.size11, +.katex .fontsize-ensurer.reset-size8.size11 { + font-size: 1.72777778em; } .katex .sizing.reset-size9.size1, .katex .fontsize-ensurer.reset-size9.size1 { - font-size: 0.24154589em; + font-size: 0.28935185em; } .katex .sizing.reset-size9.size2, .katex .fontsize-ensurer.reset-size9.size2 { - font-size: 0.33816425em; + font-size: 0.34722222em; } .katex .sizing.reset-size9.size3, .katex .fontsize-ensurer.reset-size9.size3 { - font-size: 0.38647343em; + font-size: 0.40509259em; } .katex .sizing.reset-size9.size4, .katex .fontsize-ensurer.reset-size9.size4 { - font-size: 0.43478261em; + font-size: 0.46296296em; } .katex .sizing.reset-size9.size5, .katex .fontsize-ensurer.reset-size9.size5 { - font-size: 0.48309179em; + font-size: 0.52083333em; } .katex .sizing.reset-size9.size6, .katex .fontsize-ensurer.reset-size9.size6 { - font-size: 0.57971014em; + font-size: 0.5787037em; } .katex .sizing.reset-size9.size7, .katex .fontsize-ensurer.reset-size9.size7 { - font-size: 0.69565217em; + font-size: 0.69444444em; } .katex .sizing.reset-size9.size8, .katex .fontsize-ensurer.reset-size9.size8 { - font-size: 0.83574879em; + font-size: 0.83333333em; } .katex .sizing.reset-size9.size9, .katex .fontsize-ensurer.reset-size9.size9 { @@ -872,48 +923,100 @@ SOFTWARE. } .katex .sizing.reset-size9.size10, .katex .fontsize-ensurer.reset-size9.size10 { - font-size: 1.20289855em; + font-size: 1.20023148em; +} +.katex .sizing.reset-size9.size11, +.katex .fontsize-ensurer.reset-size9.size11 { + font-size: 1.43981481em; } .katex .sizing.reset-size10.size1, .katex .fontsize-ensurer.reset-size10.size1 { - font-size: 0.20080321em; + font-size: 0.24108004em; } .katex .sizing.reset-size10.size2, .katex .fontsize-ensurer.reset-size10.size2 { - font-size: 0.2811245em; + font-size: 0.28929605em; } .katex .sizing.reset-size10.size3, .katex .fontsize-ensurer.reset-size10.size3 { - font-size: 0.32128514em; + font-size: 0.33751205em; } .katex .sizing.reset-size10.size4, .katex .fontsize-ensurer.reset-size10.size4 { - font-size: 0.36144578em; + font-size: 0.38572806em; } .katex .sizing.reset-size10.size5, .katex .fontsize-ensurer.reset-size10.size5 { - font-size: 0.40160643em; + font-size: 0.43394407em; } .katex .sizing.reset-size10.size6, .katex .fontsize-ensurer.reset-size10.size6 { - font-size: 0.48192771em; + font-size: 0.48216008em; } .katex .sizing.reset-size10.size7, .katex .fontsize-ensurer.reset-size10.size7 { - font-size: 0.57831325em; + font-size: 0.57859209em; } .katex .sizing.reset-size10.size8, .katex .fontsize-ensurer.reset-size10.size8 { - font-size: 0.69477912em; + font-size: 0.69431051em; } .katex .sizing.reset-size10.size9, .katex .fontsize-ensurer.reset-size10.size9 { - font-size: 0.8313253em; + font-size: 0.83317261em; } .katex .sizing.reset-size10.size10, .katex .fontsize-ensurer.reset-size10.size10 { font-size: 1em; } +.katex .sizing.reset-size10.size11, +.katex .fontsize-ensurer.reset-size10.size11 { + font-size: 1.19961427em; +} +.katex .sizing.reset-size11.size1, +.katex .fontsize-ensurer.reset-size11.size1 { + font-size: 0.20096463em; +} +.katex .sizing.reset-size11.size2, +.katex .fontsize-ensurer.reset-size11.size2 { + font-size: 0.24115756em; +} +.katex .sizing.reset-size11.size3, +.katex .fontsize-ensurer.reset-size11.size3 { + font-size: 0.28135048em; +} +.katex .sizing.reset-size11.size4, +.katex .fontsize-ensurer.reset-size11.size4 { + font-size: 0.32154341em; +} +.katex .sizing.reset-size11.size5, +.katex .fontsize-ensurer.reset-size11.size5 { + font-size: 0.36173633em; +} +.katex .sizing.reset-size11.size6, +.katex .fontsize-ensurer.reset-size11.size6 { + font-size: 0.40192926em; +} +.katex .sizing.reset-size11.size7, +.katex .fontsize-ensurer.reset-size11.size7 { + font-size: 0.48231511em; +} +.katex .sizing.reset-size11.size8, +.katex .fontsize-ensurer.reset-size11.size8 { + font-size: 0.57877814em; +} +.katex .sizing.reset-size11.size9, +.katex .fontsize-ensurer.reset-size11.size9 { + font-size: 0.69453376em; +} +.katex .sizing.reset-size11.size10, +.katex .fontsize-ensurer.reset-size11.size10 { + font-size: 0.83360129em; +} +.katex .sizing.reset-size11.size11, +.katex .fontsize-ensurer.reset-size11.size11 { + font-size: 1em; +} .katex .delimsizing.size1 { font-family: KaTeX_Size1; } @@ -936,6 +1039,9 @@ SOFTWARE. display: inline-block; width: 0.12em; } +.katex .delimcenter { + position: relative; +} .katex .op-symbol { position: relative; } @@ -945,10 +1051,10 @@ SOFTWARE. .katex .op-symbol.large-op { font-family: KaTeX_Size2; } -.katex .op-limits > .vlist > span { +.katex .op-limits > .vlist-t { text-align: center; } -.katex .accent > .vlist > span { +.katex .accent > .vlist-t { text-align: center; } .katex .accent .accent-body > span { @@ -958,20 +1064,126 @@ SOFTWARE. position: relative; left: 0.326em; } +.katex .accent .accent-body.accent-hungarian > span { + position: relative; + left: 0.250em; +} .katex .mtable .vertical-separator { display: inline-block; margin: 0 -0.025em; - border-right: 0.05em solid black; + width: 0.05em; +} +@media screen { + .katex .mtable .vertical-separator { + min-width: 1px; + } +} +@media screen and (-webkit-min-device-pixel-ratio: 2), screen and (min-resolution: 192dpi) { + .katex .mtable .vertical-separator { + min-width: 0.5px; + } } .katex .mtable .arraycolsep { display: inline-block; } -.katex .mtable .col-align-c > .vlist { +.katex .mtable .col-align-c > .vlist-t { text-align: center; } -.katex .mtable .col-align-l > .vlist { +.katex .mtable .col-align-l > .vlist-t { text-align: left; } -.katex .mtable .col-align-r > .vlist { +.katex .mtable .col-align-r > .vlist-t { text-align: right; } +.katex .svg-align { + text-align: left; +} +.katex svg { + display: block; + position: absolute; + width: 100%; +} +.katex svg path { + fill: currentColor; +} +.katex svg line { + stroke: currentColor; +} +.katex .stretchy { + width: 100%; + display: block; +} +.katex .stretchy:before, +.katex .stretchy:after { + content: ""; +} +.katex .hide-tail { + width: 100%; + position: relative; + overflow: hidden; +} +.katex .halfarrow-left { + position: absolute; + left: 0; + width: 50.1%; + overflow: hidden; +} +.katex .halfarrow-right { + position: absolute; + right: 0; + width: 50%; + overflow: hidden; +} +.katex .brace-left { + position: absolute; + left: 0; + width: 25.1%; + overflow: hidden; +} +.katex .brace-center { + position: absolute; + left: 25%; + width: 50%; + overflow: hidden; +} +.katex .brace-right { + position: absolute; + right: 0; + width: 25.1%; + overflow: hidden; +} +.katex .x-arrow-pad { + padding: 0 0.5em; +} +.katex .x-arrow, +.katex .mover, +.katex .munder { + text-align: center; +} +.katex .boxpad { + padding: 0 0.3em 0 0.3em; +} +.katex .fbox { + box-sizing: border-box; + border: 0.04em solid black; +} +.katex .fcolorbox { + box-sizing: border-box; + border: 0.04em solid; +} +.katex .cancel-pad { + padding: 0 0.2em 0 0.2em; +} +.katex .mord + .cancel-lap, +.katex .mbin + .cancel-lap { + margin-left: -0.2em; +} +.katex .cancel-lap + .mord, +.katex .cancel-lap + .mbin, +.katex .cancel-lap + .msupsub { + margin-left: -0.2em; +} +.katex .sout { + border-bottom-style: solid; + border-bottom-width: 0.08em; +} -- cgit v1.2.1 From ad9e3dfe5d3d8136ae659b4de9f37af9f6b5462f Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Thu, 14 Dec 2017 17:16:55 -0600 Subject: added katex.js and load it via webpack --- app/assets/javascripts/render_math.js | 22 +- lib/gitlab/gon_helper.rb | 1 - package.json | 1 + spec/javascripts/notebook/cells/markdown_spec.js | 2 +- vendor/assets/javascripts/katex.js | 14407 --------------------- yarn.lock | 10 + 6 files changed, 20 insertions(+), 14423 deletions(-) delete mode 100644 vendor/assets/javascripts/katex.js diff --git a/app/assets/javascripts/render_math.js b/app/assets/javascripts/render_math.js index a759992cd54..2e68a9642e7 100644 --- a/app/assets/javascripts/render_math.js +++ b/app/assets/javascripts/render_math.js @@ -1,4 +1,5 @@ -/* global katex */ +// import katex from 'katex'; +import Flash from './flash'; // Renders math using KaTeX in any element with the // `js-render-math` class @@ -7,11 +8,9 @@ // // // - // Only load once -let katexLoaded = false; // Loop over all math elements and render math -function renderWithKaTeX(elements) { +function renderWithKaTeX(elements, katex) { elements.each(function katexElementsLoop() { const mathNode = $(''); const $this = $(this); @@ -30,9 +29,7 @@ function renderWithKaTeX(elements) { export default function renderMath($els) { if (!$els.length) return; - if (katexLoaded) { - renderWithKaTeX($els); - } else { + import(/* webpackChunkName: 'katex' */ 'katex').then((katex) => { $.get(gon.katex_css_url, () => { const css = $('', { rel: 'stylesheet', @@ -40,12 +37,9 @@ export default function renderMath($els) { href: gon.katex_css_url, }); css.appendTo('head'); - - // Load KaTeX js - $.getScript(gon.katex_js_url, () => { - katexLoaded = true; - renderWithKaTeX($els); // Run KaTeX - }); + renderWithKaTeX($els, katex); }); - } + }).catch((err) => { + Flash(`Can't load katex module: ${err}`); + }); } diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index dfcdfc307b6..f91be9a7142 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -15,7 +15,6 @@ module Gitlab gon.shortcuts_path = help_page_path('shortcuts') gon.user_color_scheme = Gitlab::ColorSchemes.for_user(current_user).css_class gon.katex_css_url = ActionController::Base.helpers.asset_path('katex.css') - gon.katex_js_url = ActionController::Base.helpers.asset_path('katex.js') gon.sentry_dsn = current_application_settings.clientside_sentry_dsn if current_application_settings.clientside_sentry_enabled gon.gitlab_url = Gitlab.config.gitlab.url gon.revision = Gitlab::REVISION diff --git a/package.json b/package.json index aa4e4e79f49..a50364d0929 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "js-cookie": "^2.1.3", "jszip": "^3.1.3", "jszip-utils": "^0.0.2", + "katex": "^0.9.0-alpha2", "marked": "^0.3.6", "monaco-editor": "0.10.0", "mousetrap": "^1.4.6", diff --git a/spec/javascripts/notebook/cells/markdown_spec.js b/spec/javascripts/notebook/cells/markdown_spec.js index a88e9ed3d99..58f4fbc5791 100644 --- a/spec/javascripts/notebook/cells/markdown_spec.js +++ b/spec/javascripts/notebook/cells/markdown_spec.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import MarkdownComponent from '~/notebook/cells/markdown.vue'; -import katex from 'vendor/katex'; +import katex from 'katex'; const Component = Vue.extend(MarkdownComponent); diff --git a/vendor/assets/javascripts/katex.js b/vendor/assets/javascripts/katex.js deleted file mode 100644 index 92936bb247f..00000000000 --- a/vendor/assets/javascripts/katex.js +++ /dev/null @@ -1,14407 +0,0 @@ -/* - The MIT License (MIT) - - Copyright (c) 2015 Khan Academy - - This software also uses portions of the underscore.js project, which is - MIT licensed with the following copyright: - - Copyright (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative - Reporters & Editors - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - */ - -/* - Here is how to build a version of KaTeX that works with gitlab. - - The problem is that the standard procedure for changing font location doesn't work for the empty string. - - 1. Clone KaTeX. Anything later than 4fb9445a9 (is merged into master) will do. - 2. make (requires node) - 3. sed -e 's,fonts/,,' -e 's/url\(([^)]*)\)/url(font-path\1)/g' build/katex.css > build/katex.scss - 4. Copy build/katex.js to gitlab/vendor/assets/javascripts/katex.js, - build/katex.scss to gitlab/vendor/assets/stylesheets/katex.scss and - fonts/* to gitlab/vendor/assets/fonts/. -*/ - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.katex = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o Array#indexOf -// true -> Array#includes -var toIObject = require('./_to-iobject'); -var toLength = require('./_to-length'); -var toAbsoluteIndex = require('./_to-absolute-index'); -module.exports = function (IS_INCLUDES) { - return function ($this, el, fromIndex) { - var O = toIObject($this); - var length = toLength(O.length); - var index = toAbsoluteIndex(fromIndex, length); - var value; - // Array#includes uses SameValueZero equality algorithm - // eslint-disable-next-line no-self-compare - if (IS_INCLUDES && el != el) while (length > index) { - value = O[index++]; - // eslint-disable-next-line no-self-compare - if (value != value) return true; - // Array#indexOf ignores holes, Array#includes - not - } else for (;length > index; index++) if (IS_INCLUDES || index in O) { - if (O[index] === el) return IS_INCLUDES || index || 0; - } return !IS_INCLUDES && -1; - }; -}; - -},{"./_to-absolute-index":62,"./_to-iobject":64,"./_to-length":65}],22:[function(require,module,exports){ -// getting tag from 19.1.3.6 Object.prototype.toString() -var cof = require('./_cof'); -var TAG = require('./_wks')('toStringTag'); -// ES3 wrong here -var ARG = cof(function () { return arguments; }()) == 'Arguments'; - -// fallback for IE11 Script Access Denied error -var tryGet = function (it, key) { - try { - return it[key]; - } catch (e) { /* empty */ } -}; - -module.exports = function (it) { - var O, T, B; - return it === undefined ? 'Undefined' : it === null ? 'Null' - // @@toStringTag case - : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T - // builtinTag case - : ARG ? cof(O) - // ES3 arguments fallback - : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; -}; - -},{"./_cof":23,"./_wks":69}],23:[function(require,module,exports){ -var toString = {}.toString; - -module.exports = function (it) { - return toString.call(it).slice(8, -1); -}; - -},{}],24:[function(require,module,exports){ -var core = module.exports = { version: '2.5.1' }; -if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef - -},{}],25:[function(require,module,exports){ -'use strict'; -var $defineProperty = require('./_object-dp'); -var createDesc = require('./_property-desc'); - -module.exports = function (object, index, value) { - if (index in object) $defineProperty.f(object, index, createDesc(0, value)); - else object[index] = value; -}; - -},{"./_object-dp":50,"./_property-desc":56}],26:[function(require,module,exports){ -// optional / simple context binding -var aFunction = require('./_a-function'); -module.exports = function (fn, that, length) { - aFunction(fn); - if (that === undefined) return fn; - switch (length) { - case 1: return function (a) { - return fn.call(that, a); - }; - case 2: return function (a, b) { - return fn.call(that, a, b); - }; - case 3: return function (a, b, c) { - return fn.call(that, a, b, c); - }; - } - return function (/* ...args */) { - return fn.apply(that, arguments); - }; -}; - -},{"./_a-function":18}],27:[function(require,module,exports){ -// 7.2.1 RequireObjectCoercible(argument) -module.exports = function (it) { - if (it == undefined) throw TypeError("Can't call method on " + it); - return it; -}; - -},{}],28:[function(require,module,exports){ -// Thank's IE8 for his funny defineProperty -module.exports = !require('./_fails')(function () { - return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; -}); - -},{"./_fails":32}],29:[function(require,module,exports){ -var isObject = require('./_is-object'); -var document = require('./_global').document; -// typeof document.createElement is 'object' in old IE -var is = isObject(document) && isObject(document.createElement); -module.exports = function (it) { - return is ? document.createElement(it) : {}; -}; - -},{"./_global":33,"./_is-object":40}],30:[function(require,module,exports){ -// IE 8- don't enum bug keys -module.exports = ( - 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' -).split(','); - -},{}],31:[function(require,module,exports){ -var global = require('./_global'); -var core = require('./_core'); -var ctx = require('./_ctx'); -var hide = require('./_hide'); -var PROTOTYPE = 'prototype'; - -var $export = function (type, name, source) { - var IS_FORCED = type & $export.F; - var IS_GLOBAL = type & $export.G; - var IS_STATIC = type & $export.S; - var IS_PROTO = type & $export.P; - var IS_BIND = type & $export.B; - var IS_WRAP = type & $export.W; - var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); - var expProto = exports[PROTOTYPE]; - var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]; - var key, own, out; - if (IS_GLOBAL) source = name; - for (key in source) { - // contains in native - own = !IS_FORCED && target && target[key] !== undefined; - if (own && key in exports) continue; - // export native or passed - out = own ? target[key] : source[key]; - // prevent global pollution for namespaces - exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] - // bind timers to global for call from export context - : IS_BIND && own ? ctx(out, global) - // wrap global constructors for prevent change them in library - : IS_WRAP && target[key] == out ? (function (C) { - var F = function (a, b, c) { - if (this instanceof C) { - switch (arguments.length) { - case 0: return new C(); - case 1: return new C(a); - case 2: return new C(a, b); - } return new C(a, b, c); - } return C.apply(this, arguments); - }; - F[PROTOTYPE] = C[PROTOTYPE]; - return F; - // make static versions for prototype methods - })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% - if (IS_PROTO) { - (exports.virtual || (exports.virtual = {}))[key] = out; - // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% - if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); - } - } -}; -// type bitmap -$export.F = 1; // forced -$export.G = 2; // global -$export.S = 4; // static -$export.P = 8; // proto -$export.B = 16; // bind -$export.W = 32; // wrap -$export.U = 64; // safe -$export.R = 128; // real proto method for `library` -module.exports = $export; - -},{"./_core":24,"./_ctx":26,"./_global":33,"./_hide":35}],32:[function(require,module,exports){ -module.exports = function (exec) { - try { - return !!exec(); - } catch (e) { - return true; - } -}; - -},{}],33:[function(require,module,exports){ -// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 -var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self - // eslint-disable-next-line no-new-func - : Function('return this')(); -if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef - -},{}],34:[function(require,module,exports){ -var hasOwnProperty = {}.hasOwnProperty; -module.exports = function (it, key) { - return hasOwnProperty.call(it, key); -}; - -},{}],35:[function(require,module,exports){ -var dP = require('./_object-dp'); -var createDesc = require('./_property-desc'); -module.exports = require('./_descriptors') ? function (object, key, value) { - return dP.f(object, key, createDesc(1, value)); -} : function (object, key, value) { - object[key] = value; - return object; -}; - -},{"./_descriptors":28,"./_object-dp":50,"./_property-desc":56}],36:[function(require,module,exports){ -var document = require('./_global').document; -module.exports = document && document.documentElement; - -},{"./_global":33}],37:[function(require,module,exports){ -module.exports = !require('./_descriptors') && !require('./_fails')(function () { - return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7; -}); - -},{"./_descriptors":28,"./_dom-create":29,"./_fails":32}],38:[function(require,module,exports){ -// fallback for non-array-like ES3 and non-enumerable old V8 strings -var cof = require('./_cof'); -// eslint-disable-next-line no-prototype-builtins -module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { - return cof(it) == 'String' ? it.split('') : Object(it); -}; - -},{"./_cof":23}],39:[function(require,module,exports){ -// check on default Array iterator -var Iterators = require('./_iterators'); -var ITERATOR = require('./_wks')('iterator'); -var ArrayProto = Array.prototype; - -module.exports = function (it) { - return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); -}; - -},{"./_iterators":46,"./_wks":69}],40:[function(require,module,exports){ -module.exports = function (it) { - return typeof it === 'object' ? it !== null : typeof it === 'function'; -}; - -},{}],41:[function(require,module,exports){ -// call something on iterator step with safe closing on error -var anObject = require('./_an-object'); -module.exports = function (iterator, fn, value, entries) { - try { - return entries ? fn(anObject(value)[0], value[1]) : fn(value); - // 7.4.6 IteratorClose(iterator, completion) - } catch (e) { - var ret = iterator['return']; - if (ret !== undefined) anObject(ret.call(iterator)); - throw e; - } -}; - -},{"./_an-object":20}],42:[function(require,module,exports){ -'use strict'; -var create = require('./_object-create'); -var descriptor = require('./_property-desc'); -var setToStringTag = require('./_set-to-string-tag'); -var IteratorPrototype = {}; - -// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() -require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; }); - -module.exports = function (Constructor, NAME, next) { - Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); - setToStringTag(Constructor, NAME + ' Iterator'); -}; - -},{"./_hide":35,"./_object-create":49,"./_property-desc":56,"./_set-to-string-tag":58,"./_wks":69}],43:[function(require,module,exports){ -'use strict'; -var LIBRARY = require('./_library'); -var $export = require('./_export'); -var redefine = require('./_redefine'); -var hide = require('./_hide'); -var has = require('./_has'); -var Iterators = require('./_iterators'); -var $iterCreate = require('./_iter-create'); -var setToStringTag = require('./_set-to-string-tag'); -var getPrototypeOf = require('./_object-gpo'); -var ITERATOR = require('./_wks')('iterator'); -var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` -var FF_ITERATOR = '@@iterator'; -var KEYS = 'keys'; -var VALUES = 'values'; - -var returnThis = function () { return this; }; - -module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { - $iterCreate(Constructor, NAME, next); - var getMethod = function (kind) { - if (!BUGGY && kind in proto) return proto[kind]; - switch (kind) { - case KEYS: return function keys() { return new Constructor(this, kind); }; - case VALUES: return function values() { return new Constructor(this, kind); }; - } return function entries() { return new Constructor(this, kind); }; - }; - var TAG = NAME + ' Iterator'; - var DEF_VALUES = DEFAULT == VALUES; - var VALUES_BUG = false; - var proto = Base.prototype; - var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; - var $default = $native || getMethod(DEFAULT); - var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; - var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; - var methods, key, IteratorPrototype; - // Fix native - if ($anyNative) { - IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); - if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { - // Set @@toStringTag to native iterators - setToStringTag(IteratorPrototype, TAG, true); - // fix for some old engines - if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); - } - } - // fix Array#{values, @@iterator}.name in V8 / FF - if (DEF_VALUES && $native && $native.name !== VALUES) { - VALUES_BUG = true; - $default = function values() { return $native.call(this); }; - } - // Define iterator - if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { - hide(proto, ITERATOR, $default); - } - // Plug for library - Iterators[NAME] = $default; - Iterators[TAG] = returnThis; - if (DEFAULT) { - methods = { - values: DEF_VALUES ? $default : getMethod(VALUES), - keys: IS_SET ? $default : getMethod(KEYS), - entries: $entries - }; - if (FORCED) for (key in methods) { - if (!(key in proto)) redefine(proto, key, methods[key]); - } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); - } - return methods; -}; - -},{"./_export":31,"./_has":34,"./_hide":35,"./_iter-create":42,"./_iterators":46,"./_library":47,"./_object-gpo":52,"./_redefine":57,"./_set-to-string-tag":58,"./_wks":69}],44:[function(require,module,exports){ -var ITERATOR = require('./_wks')('iterator'); -var SAFE_CLOSING = false; - -try { - var riter = [7][ITERATOR](); - riter['return'] = function () { SAFE_CLOSING = true; }; - // eslint-disable-next-line no-throw-literal - Array.from(riter, function () { throw 2; }); -} catch (e) { /* empty */ } - -module.exports = function (exec, skipClosing) { - if (!skipClosing && !SAFE_CLOSING) return false; - var safe = false; - try { - var arr = [7]; - var iter = arr[ITERATOR](); - iter.next = function () { return { done: safe = true }; }; - arr[ITERATOR] = function () { return iter; }; - exec(arr); - } catch (e) { /* empty */ } - return safe; -}; - -},{"./_wks":69}],45:[function(require,module,exports){ -module.exports = function (done, value) { - return { value: value, done: !!done }; -}; - -},{}],46:[function(require,module,exports){ -module.exports = {}; - -},{}],47:[function(require,module,exports){ -module.exports = true; - -},{}],48:[function(require,module,exports){ -var META = require('./_uid')('meta'); -var isObject = require('./_is-object'); -var has = require('./_has'); -var setDesc = require('./_object-dp').f; -var id = 0; -var isExtensible = Object.isExtensible || function () { - return true; -}; -var FREEZE = !require('./_fails')(function () { - return isExtensible(Object.preventExtensions({})); -}); -var setMeta = function (it) { - setDesc(it, META, { value: { - i: 'O' + ++id, // object ID - w: {} // weak collections IDs - } }); -}; -var fastKey = function (it, create) { - // return primitive with prefix - if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if (!has(it, META)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return 'F'; - // not necessary to add metadata - if (!create) return 'E'; - // add missing metadata - setMeta(it); - // return object ID - } return it[META].i; -}; -var getWeak = function (it, create) { - if (!has(it, META)) { - // can't set metadata to uncaught frozen object - if (!isExtensible(it)) return true; - // not necessary to add metadata - if (!create) return false; - // add missing metadata - setMeta(it); - // return hash weak collections IDs - } return it[META].w; -}; -// add metadata on freeze-family methods calling -var onFreeze = function (it) { - if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); - return it; -}; -var meta = module.exports = { - KEY: META, - NEED: false, - fastKey: fastKey, - getWeak: getWeak, - onFreeze: onFreeze -}; - -},{"./_fails":32,"./_has":34,"./_is-object":40,"./_object-dp":50,"./_uid":68}],49:[function(require,module,exports){ -// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) -var anObject = require('./_an-object'); -var dPs = require('./_object-dps'); -var enumBugKeys = require('./_enum-bug-keys'); -var IE_PROTO = require('./_shared-key')('IE_PROTO'); -var Empty = function () { /* empty */ }; -var PROTOTYPE = 'prototype'; - -// Create object with fake `null` prototype: use iframe Object with cleared prototype -var createDict = function () { - // Thrash, waste and sodomy: IE GC bug - var iframe = require('./_dom-create')('iframe'); - var i = enumBugKeys.length; - var lt = '<'; - var gt = '>'; - var iframeDocument; - iframe.style.display = 'none'; - require('./_html').appendChild(iframe); - iframe.src = 'javascript:'; // eslint-disable-line no-script-url - // createDict = iframe.contentWindow.Object; - // html.removeChild(iframe); - iframeDocument = iframe.contentWindow.document; - iframeDocument.open(); - iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); - iframeDocument.close(); - createDict = iframeDocument.F; - while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; - return createDict(); -}; - -module.exports = Object.create || function create(O, Properties) { - var result; - if (O !== null) { - Empty[PROTOTYPE] = anObject(O); - result = new Empty(); - Empty[PROTOTYPE] = null; - // add "__proto__" for Object.getPrototypeOf polyfill - result[IE_PROTO] = O; - } else result = createDict(); - return Properties === undefined ? result : dPs(result, Properties); -}; - -},{"./_an-object":20,"./_dom-create":29,"./_enum-bug-keys":30,"./_html":36,"./_object-dps":51,"./_shared-key":59}],50:[function(require,module,exports){ -var anObject = require('./_an-object'); -var IE8_DOM_DEFINE = require('./_ie8-dom-define'); -var toPrimitive = require('./_to-primitive'); -var dP = Object.defineProperty; - -exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) { - anObject(O); - P = toPrimitive(P, true); - anObject(Attributes); - if (IE8_DOM_DEFINE) try { - return dP(O, P, Attributes); - } catch (e) { /* empty */ } - if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); - if ('value' in Attributes) O[P] = Attributes.value; - return O; -}; - -},{"./_an-object":20,"./_descriptors":28,"./_ie8-dom-define":37,"./_to-primitive":67}],51:[function(require,module,exports){ -var dP = require('./_object-dp'); -var anObject = require('./_an-object'); -var getKeys = require('./_object-keys'); - -module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) { - anObject(O); - var keys = getKeys(Properties); - var length = keys.length; - var i = 0; - var P; - while (length > i) dP.f(O, P = keys[i++], Properties[P]); - return O; -}; - -},{"./_an-object":20,"./_descriptors":28,"./_object-dp":50,"./_object-keys":54}],52:[function(require,module,exports){ -// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) -var has = require('./_has'); -var toObject = require('./_to-object'); -var IE_PROTO = require('./_shared-key')('IE_PROTO'); -var ObjectProto = Object.prototype; - -module.exports = Object.getPrototypeOf || function (O) { - O = toObject(O); - if (has(O, IE_PROTO)) return O[IE_PROTO]; - if (typeof O.constructor == 'function' && O instanceof O.constructor) { - return O.constructor.prototype; - } return O instanceof Object ? ObjectProto : null; -}; - -},{"./_has":34,"./_shared-key":59,"./_to-object":66}],53:[function(require,module,exports){ -var has = require('./_has'); -var toIObject = require('./_to-iobject'); -var arrayIndexOf = require('./_array-includes')(false); -var IE_PROTO = require('./_shared-key')('IE_PROTO'); - -module.exports = function (object, names) { - var O = toIObject(object); - var i = 0; - var result = []; - var key; - for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); - // Don't enum bug & hidden keys - while (names.length > i) if (has(O, key = names[i++])) { - ~arrayIndexOf(result, key) || result.push(key); - } - return result; -}; - -},{"./_array-includes":21,"./_has":34,"./_shared-key":59,"./_to-iobject":64}],54:[function(require,module,exports){ -// 19.1.2.14 / 15.2.3.14 Object.keys(O) -var $keys = require('./_object-keys-internal'); -var enumBugKeys = require('./_enum-bug-keys'); - -module.exports = Object.keys || function keys(O) { - return $keys(O, enumBugKeys); -}; - -},{"./_enum-bug-keys":30,"./_object-keys-internal":53}],55:[function(require,module,exports){ -// most Object methods by ES6 should accept primitives -var $export = require('./_export'); -var core = require('./_core'); -var fails = require('./_fails'); -module.exports = function (KEY, exec) { - var fn = (core.Object || {})[KEY] || Object[KEY]; - var exp = {}; - exp[KEY] = exec(fn); - $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); -}; - -},{"./_core":24,"./_export":31,"./_fails":32}],56:[function(require,module,exports){ -module.exports = function (bitmap, value) { - return { - enumerable: !(bitmap & 1), - configurable: !(bitmap & 2), - writable: !(bitmap & 4), - value: value - }; -}; - -},{}],57:[function(require,module,exports){ -module.exports = require('./_hide'); - -},{"./_hide":35}],58:[function(require,module,exports){ -var def = require('./_object-dp').f; -var has = require('./_has'); -var TAG = require('./_wks')('toStringTag'); - -module.exports = function (it, tag, stat) { - if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); -}; - -},{"./_has":34,"./_object-dp":50,"./_wks":69}],59:[function(require,module,exports){ -var shared = require('./_shared')('keys'); -var uid = require('./_uid'); -module.exports = function (key) { - return shared[key] || (shared[key] = uid(key)); -}; - -},{"./_shared":60,"./_uid":68}],60:[function(require,module,exports){ -var global = require('./_global'); -var SHARED = '__core-js_shared__'; -var store = global[SHARED] || (global[SHARED] = {}); -module.exports = function (key) { - return store[key] || (store[key] = {}); -}; - -},{"./_global":33}],61:[function(require,module,exports){ -var toInteger = require('./_to-integer'); -var defined = require('./_defined'); -// true -> String#at -// false -> String#codePointAt -module.exports = function (TO_STRING) { - return function (that, pos) { - var s = String(defined(that)); - var i = toInteger(pos); - var l = s.length; - var a, b; - if (i < 0 || i >= l) return TO_STRING ? '' : undefined; - a = s.charCodeAt(i); - return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff - ? TO_STRING ? s.charAt(i) : a - : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; - }; -}; - -},{"./_defined":27,"./_to-integer":63}],62:[function(require,module,exports){ -var toInteger = require('./_to-integer'); -var max = Math.max; -var min = Math.min; -module.exports = function (index, length) { - index = toInteger(index); - return index < 0 ? max(index + length, 0) : min(index, length); -}; - -},{"./_to-integer":63}],63:[function(require,module,exports){ -// 7.1.4 ToInteger -var ceil = Math.ceil; -var floor = Math.floor; -module.exports = function (it) { - return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); -}; - -},{}],64:[function(require,module,exports){ -// to indexed object, toObject with fallback for non-array-like ES3 strings -var IObject = require('./_iobject'); -var defined = require('./_defined'); -module.exports = function (it) { - return IObject(defined(it)); -}; - -},{"./_defined":27,"./_iobject":38}],65:[function(require,module,exports){ -// 7.1.15 ToLength -var toInteger = require('./_to-integer'); -var min = Math.min; -module.exports = function (it) { - return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 -}; - -},{"./_to-integer":63}],66:[function(require,module,exports){ -// 7.1.13 ToObject(argument) -var defined = require('./_defined'); -module.exports = function (it) { - return Object(defined(it)); -}; - -},{"./_defined":27}],67:[function(require,module,exports){ -// 7.1.1 ToPrimitive(input [, PreferredType]) -var isObject = require('./_is-object'); -// instead of the ES6 spec version, we didn't implement @@toPrimitive case -// and the second argument - flag - preferred type is a string -module.exports = function (it, S) { - if (!isObject(it)) return it; - var fn, val; - if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; - if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; - if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; - throw TypeError("Can't convert object to primitive value"); -}; - -},{"./_is-object":40}],68:[function(require,module,exports){ -var id = 0; -var px = Math.random(); -module.exports = function (key) { - return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); -}; - -},{}],69:[function(require,module,exports){ -var store = require('./_shared')('wks'); -var uid = require('./_uid'); -var Symbol = require('./_global').Symbol; -var USE_SYMBOL = typeof Symbol == 'function'; - -var $exports = module.exports = function (name) { - return store[name] || (store[name] = - USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); -}; - -$exports.store = store; - -},{"./_global":33,"./_shared":60,"./_uid":68}],70:[function(require,module,exports){ -var classof = require('./_classof'); -var ITERATOR = require('./_wks')('iterator'); -var Iterators = require('./_iterators'); -module.exports = require('./_core').getIteratorMethod = function (it) { - if (it != undefined) return it[ITERATOR] - || it['@@iterator'] - || Iterators[classof(it)]; -}; - -},{"./_classof":22,"./_core":24,"./_iterators":46,"./_wks":69}],71:[function(require,module,exports){ -var anObject = require('./_an-object'); -var get = require('./core.get-iterator-method'); -module.exports = require('./_core').getIterator = function (it) { - var iterFn = get(it); - if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!'); - return anObject(iterFn.call(it)); -}; - -},{"./_an-object":20,"./_core":24,"./core.get-iterator-method":70}],72:[function(require,module,exports){ -var classof = require('./_classof'); -var ITERATOR = require('./_wks')('iterator'); -var Iterators = require('./_iterators'); -module.exports = require('./_core').isIterable = function (it) { - var O = Object(it); - return O[ITERATOR] !== undefined - || '@@iterator' in O - // eslint-disable-next-line no-prototype-builtins - || Iterators.hasOwnProperty(classof(O)); -}; - -},{"./_classof":22,"./_core":24,"./_iterators":46,"./_wks":69}],73:[function(require,module,exports){ -'use strict'; -var ctx = require('./_ctx'); -var $export = require('./_export'); -var toObject = require('./_to-object'); -var call = require('./_iter-call'); -var isArrayIter = require('./_is-array-iter'); -var toLength = require('./_to-length'); -var createProperty = require('./_create-property'); -var getIterFn = require('./core.get-iterator-method'); - -$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', { - // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) - from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { - var O = toObject(arrayLike); - var C = typeof this == 'function' ? this : Array; - var aLen = arguments.length; - var mapfn = aLen > 1 ? arguments[1] : undefined; - var mapping = mapfn !== undefined; - var index = 0; - var iterFn = getIterFn(O); - var length, result, step, iterator; - if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); - // if object isn't iterable or it's array with default iterator - use simple case - if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) { - for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { - createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); - } - } else { - length = toLength(O.length); - for (result = new C(length); length > index; index++) { - createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); - } - } - result.length = index; - return result; - } -}); - -},{"./_create-property":25,"./_ctx":26,"./_export":31,"./_is-array-iter":39,"./_iter-call":41,"./_iter-detect":44,"./_to-length":65,"./_to-object":66,"./core.get-iterator-method":70}],74:[function(require,module,exports){ -'use strict'; -var addToUnscopables = require('./_add-to-unscopables'); -var step = require('./_iter-step'); -var Iterators = require('./_iterators'); -var toIObject = require('./_to-iobject'); - -// 22.1.3.4 Array.prototype.entries() -// 22.1.3.13 Array.prototype.keys() -// 22.1.3.29 Array.prototype.values() -// 22.1.3.30 Array.prototype[@@iterator]() -module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) { - this._t = toIObject(iterated); // target - this._i = 0; // next index - this._k = kind; // kind -// 22.1.5.2.1 %ArrayIteratorPrototype%.next() -}, function () { - var O = this._t; - var kind = this._k; - var index = this._i++; - if (!O || index >= O.length) { - this._t = undefined; - return step(1); - } - if (kind == 'keys') return step(0, index); - if (kind == 'values') return step(0, O[index]); - return step(0, [index, O[index]]); -}, 'values'); - -// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) -Iterators.Arguments = Iterators.Array; - -addToUnscopables('keys'); -addToUnscopables('values'); -addToUnscopables('entries'); - -},{"./_add-to-unscopables":19,"./_iter-define":43,"./_iter-step":45,"./_iterators":46,"./_to-iobject":64}],75:[function(require,module,exports){ -var $export = require('./_export'); -// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) -$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f }); - -},{"./_descriptors":28,"./_export":31,"./_object-dp":50}],76:[function(require,module,exports){ -// 19.1.2.5 Object.freeze(O) -var isObject = require('./_is-object'); -var meta = require('./_meta').onFreeze; - -require('./_object-sap')('freeze', function ($freeze) { - return function freeze(it) { - return $freeze && isObject(it) ? $freeze(meta(it)) : it; - }; -}); - -},{"./_is-object":40,"./_meta":48,"./_object-sap":55}],77:[function(require,module,exports){ -'use strict'; -var $at = require('./_string-at')(true); - -// 21.1.3.27 String.prototype[@@iterator]() -require('./_iter-define')(String, 'String', function (iterated) { - this._t = String(iterated); // target - this._i = 0; // next index -// 21.1.5.2.1 %StringIteratorPrototype%.next() -}, function () { - var O = this._t; - var index = this._i; - var point; - if (index >= O.length) return { value: undefined, done: true }; - point = $at(O, index); - this._i += point.length; - return { value: point, done: false }; -}); - -},{"./_iter-define":43,"./_string-at":61}],78:[function(require,module,exports){ -require('./es6.array.iterator'); -var global = require('./_global'); -var hide = require('./_hide'); -var Iterators = require('./_iterators'); -var TO_STRING_TAG = require('./_wks')('toStringTag'); - -var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' + - 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' + - 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' + - 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' + - 'TextTrackList,TouchList').split(','); - -for (var i = 0; i < DOMIterables.length; i++) { - var NAME = DOMIterables[i]; - var Collection = global[NAME]; - var proto = Collection && Collection.prototype; - if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); - Iterators[NAME] = Iterators.Array; -} - -},{"./_global":33,"./_hide":35,"./_iterators":46,"./_wks":69,"./es6.array.iterator":74}],79:[function(require,module,exports){ -function getRelocatable(re) { - // In the future, this could use a WeakMap instead of an expando. - if (!re.__matchAtRelocatable) { - // Disjunctions are the lowest-precedence operator, so we can make any - // pattern match the empty string by appending `|()` to it: - // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-patterns - var source = re.source + '|()'; - - // We always make the new regex global. - var flags = 'g' + (re.ignoreCase ? 'i' : '') + (re.multiline ? 'm' : '') + (re.unicode ? 'u' : '') - // sticky (/.../y) doesn't make sense in conjunction with our relocation - // logic, so we ignore it here. - ; - - re.__matchAtRelocatable = new RegExp(source, flags); - } - return re.__matchAtRelocatable; -} - -function matchAt(re, str, pos) { - if (re.global || re.sticky) { - throw new Error('matchAt(...): Only non-global regexes are supported'); - } - var reloc = getRelocatable(re); - reloc.lastIndex = pos; - var match = reloc.exec(str); - // Last capturing group is our sentinel that indicates whether the regex - // matched at the given location. - if (match[match.length - 1] == null) { - // Original regex matched. - match.length = match.length - 1; - return match; - } else { - return null; - } -} - -module.exports = matchAt; -},{}],80:[function(require,module,exports){ -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ - -'use strict'; -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); -} - -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} - -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; -}; - -},{}],81:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.controlWordRegex = undefined; - -var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _createClass2 = require("babel-runtime/helpers/createClass"); - -var _createClass3 = _interopRequireDefault(_createClass2); - -var _matchAt = require("match-at"); - -var _matchAt2 = _interopRequireDefault(_matchAt); - -var _ParseError = require("./ParseError"); - -var _ParseError2 = _interopRequireDefault(_ParseError); - -var _SourceLocation = require("./SourceLocation"); - -var _SourceLocation2 = _interopRequireDefault(_SourceLocation); - -var _Token = require("./Token"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/* The following tokenRegex - * - matches typical whitespace (but not NBSP etc.) using its first group - * - matches comments (must have trailing newlines) - * - does not match any control character \x00-\x1f except whitespace - * - does not match a bare backslash - * - matches any ASCII character except those just mentioned - * - does not match the BMP private use area \uE000-\uF8FF - * - does not match bare surrogate code units - * - matches any BMP character except for those just described - * - matches any valid Unicode surrogate pair - * - matches a backslash followed by one or more letters - * - matches a backslash followed by any BMP character, including newline - * Just because the Lexer matches something doesn't mean it's valid input: - * If there is no matching function or symbol definition, the Parser will - * still reject the input. - */ - -/** - * The Lexer class handles tokenizing the input in various ways. Since our - * parser expects us to be able to backtrack, the lexer allows lexing from any - * given starting point. - * - * Its main exposed function is the `lex` function, which takes a position to - * lex from and a type of token to lex. It defers to the appropriate `_innerLex` - * function. - * - * The various `_innerLex` functions perform the actual lexing of different - * kinds. - */ - -var commentRegexString = "%[^\n]*[\n]"; -var controlWordRegexString = "\\\\[a-zA-Z@]+"; -var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]"; -var tokenRegex = new RegExp("([ \r\n\t]+)|" + ( // whitespace -"(" + commentRegexString + "|") + // comments -"[!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + // single codepoint -"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair -"|\\\\verb\\*([^]).*?\\3" + // \verb* -"|\\\\verb([^*a-zA-Z]).*?\\4" + ( // \verb unstarred -"|" + controlWordRegexString) + ( // \macroName -"|" + controlSymbolRegexString) + // \\, \', etc. -")"); - -// tokenRegex has no ^ marker, as required by matchAt. -// These regexs are for matching results from tokenRegex, -// so they do have ^ markers. -var controlWordRegex = exports.controlWordRegex = new RegExp("^" + controlWordRegexString); -var commentRegex = new RegExp("^" + commentRegexString); - -/** Main Lexer class */ - -var Lexer = function () { - function Lexer(input) { - (0, _classCallCheck3.default)(this, Lexer); - - this.input = input; - this.pos = 0; - } - - /** - * This function lexes a single token. - */ - - - (0, _createClass3.default)(Lexer, [{ - key: "lex", - value: function lex() { - var input = this.input; - var pos = this.pos; - if (pos === input.length) { - return new _Token.Token("EOF", new _SourceLocation2.default(this, pos, pos)); - } - var match = (0, _matchAt2.default)(tokenRegex, input, pos); - if (match === null) { - throw new _ParseError2.default("Unexpected character: '" + input[pos] + "'", new _Token.Token(input[pos], new _SourceLocation2.default(this, pos, pos + 1))); - } - var text = match[2] || " "; - var start = this.pos; - this.pos += match[0].length; - var end = this.pos; - - if (commentRegex.test(text)) { - return this.lex(); - } else { - return new _Token.Token(text, new _SourceLocation2.default(this, start, end)); - } - } - }]); - return Lexer; -}(); - -exports.default = Lexer; - -},{"./ParseError":84,"./SourceLocation":88,"./Token":90,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9,"match-at":79}],82:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _toConsumableArray2 = require("babel-runtime/helpers/toConsumableArray"); - -var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); - -var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _createClass2 = require("babel-runtime/helpers/createClass"); - -var _createClass3 = _interopRequireDefault(_createClass2); - -var _Lexer = require("./Lexer"); - -var _Lexer2 = _interopRequireDefault(_Lexer); - -var _Token = require("./Token"); - -var _macros = require("./macros"); - -var _macros2 = _interopRequireDefault(_macros); - -var _ParseError = require("./ParseError"); - -var _ParseError2 = _interopRequireDefault(_ParseError); - -var _objectAssign = require("object-assign"); - -var _objectAssign2 = _interopRequireDefault(_objectAssign); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var MacroExpander = function () { - function MacroExpander(input, macros) { - (0, _classCallCheck3.default)(this, MacroExpander); - - this.lexer = new _Lexer2.default(input); - this.macros = (0, _objectAssign2.default)({}, _macros2.default, macros); - this.stack = []; // contains tokens in REVERSE order - } - - /** - * Returns the topmost token on the stack, without expanding it. - * Similar in behavior to TeX's `\futurelet`. - */ - - - (0, _createClass3.default)(MacroExpander, [{ - key: "future", - value: function future() { - if (this.stack.length === 0) { - this.pushToken(this.lexer.lex()); - } - return this.stack[this.stack.length - 1]; - } - - /** - * Remove and return the next unexpanded token. - */ - - }, { - key: "popToken", - value: function popToken() { - this.future(); // ensure non-empty stack - return this.stack.pop(); - } - - /** - * Add a given token to the token stack. In particular, this get be used - * to put back a token returned from one of the other methods. - */ - - }, { - key: "pushToken", - value: function pushToken(token) { - this.stack.push(token); - } - - /** - * Append an array of tokens to the token stack. - */ - - }, { - key: "pushTokens", - value: function pushTokens(tokens) { - var _stack; - - (_stack = this.stack).push.apply(_stack, (0, _toConsumableArray3.default)(tokens)); - } - - /** - * Consume all following space tokens, without expansion. - */ - - }, { - key: "consumeSpaces", - value: function consumeSpaces() { - for (;;) { - var token = this.future(); - if (token.text === " ") { - this.stack.pop(); - } else { - break; - } - } - } - - /** - * Consume the specified number of arguments from the token stream, - * and return the resulting array of arguments. - */ - - }, { - key: "consumeArgs", - value: function consumeArgs(numArgs) { - var args = []; - // obtain arguments, either single token or balanced {…} group - for (var i = 0; i < numArgs; ++i) { - this.consumeSpaces(); // ignore spaces before each argument - var startOfArg = this.popToken(); - if (startOfArg.text === "{") { - var arg = []; - var depth = 1; - while (depth !== 0) { - var tok = this.popToken(); - arg.push(tok); - if (tok.text === "{") { - ++depth; - } else if (tok.text === "}") { - --depth; - } else if (tok.text === "EOF") { - throw new _ParseError2.default("End of input in macro argument", startOfArg); - } - } - arg.pop(); // remove last } - arg.reverse(); // like above, to fit in with stack order - args[i] = arg; - } else if (startOfArg.text === "EOF") { - throw new _ParseError2.default("End of input expecting macro argument"); - } else { - args[i] = [startOfArg]; - } - } - return args; - } - - /** - * Expand the next token only once if possible. - * - * If the token is expanded, the resulting tokens will be pushed onto - * the stack in reverse order and will be returned as an array, - * also in reverse order. - * - * If not, the next token will be returned without removing it - * from the stack. This case can be detected by a `Token` return value - * instead of an `Array` return value. - * - * In either case, the next token will be on the top of the stack, - * or the stack will be empty. - * - * Used to implement `expandAfterFuture` and `expandNextToken`. - * - * At the moment, macro expansion doesn't handle delimited macros, - * i.e. things like those defined by \def\foo#1\end{…}. - * See the TeX book page 202ff. for details on how those should behave. - */ - - }, { - key: "expandOnce", - value: function expandOnce() { - var topToken = this.popToken(); - var name = topToken.text; - var isMacro = name.charAt(0) === "\\"; - if (isMacro && _Lexer.controlWordRegex.test(name)) { - // Consume all spaces after \macro (but not \\, \', etc.) - this.consumeSpaces(); - } - if (!this.macros.hasOwnProperty(name)) { - // Fully expanded - this.pushToken(topToken); - return topToken; - } - - var _getExpansion2 = this._getExpansion(name), - tokens = _getExpansion2.tokens, - numArgs = _getExpansion2.numArgs; - - var expansion = tokens; - if (numArgs) { - var args = this.consumeArgs(numArgs); - // paste arguments in place of the placeholders - expansion = expansion.slice(); // make a shallow copy - for (var i = expansion.length - 1; i >= 0; --i) { - var tok = expansion[i]; - if (tok.text === "#") { - if (i === 0) { - throw new _ParseError2.default("Incomplete placeholder at end of macro body", tok); - } - tok = expansion[--i]; // next token on stack - if (tok.text === "#") { - // ## → # - expansion.splice(i + 1, 1); // drop first # - } else if (/^[1-9]$/.test(tok.text)) { - var _expansion; - - // replace the placeholder with the indicated argument - (_expansion = expansion).splice.apply(_expansion, [i, 2].concat((0, _toConsumableArray3.default)(args[+tok.text - 1]))); - } else { - throw new _ParseError2.default("Not a valid argument number", tok); - } - } - } - } - // Concatenate expansion onto top of stack. - this.pushTokens(expansion); - return expansion; - } - - /** - * Expand the next token only once (if possible), and return the resulting - * top token on the stack (without removing anything from the stack). - * Similar in behavior to TeX's `\expandafter\futurelet`. - * Equivalent to expandOnce() followed by future(). - */ - - }, { - key: "expandAfterFuture", - value: function expandAfterFuture() { - this.expandOnce(); - return this.future(); - } - - /** - * Recursively expand first token, then return first non-expandable token. - */ - - }, { - key: "expandNextToken", - value: function expandNextToken() { - for (;;) { - var expanded = this.expandOnce(); - // expandOnce returns Token if and only if it's fully expanded. - if (expanded instanceof _Token.Token) { - // \relax stops the expansion, but shouldn't get returned (a - // null return value couldn't get implemented as a function). - if (expanded.text === "\\relax") { - this.stack.pop(); - } else { - return this.stack.pop(); // === expanded - } - } - } - - // Flow unable to figure out that this pathway is impossible. - // https://github.com/facebook/flow/issues/4808 - throw new Error(); // eslint-disable-line no-unreachable - } - - /** - * Returns the expanded macro as a reversed array of tokens and a macro - * argument count. - * Caches macro expansions for those that were defined simple TeX strings. - */ - - }, { - key: "_getExpansion", - value: function _getExpansion(name) { - var definition = this.macros[name]; - var expansion = typeof definition === "function" ? definition(this) : definition; - if (typeof expansion === "string") { - var numArgs = 0; - if (expansion.indexOf("#") !== -1) { - var stripped = expansion.replace(/##/g, ""); - while (stripped.indexOf("#" + (numArgs + 1)) !== -1) { - ++numArgs; - } - } - var bodyLexer = new _Lexer2.default(expansion); - var tokens = []; - var tok = bodyLexer.lex(); - while (tok.text !== "EOF") { - tokens.push(tok); - tok = bodyLexer.lex(); - } - tokens.reverse(); // to fit in with stack using push and pop - var expanded = { tokens: tokens, numArgs: numArgs }; - // Cannot cache a macro defined using a function since it relies on - // parser context. - if (typeof definition !== "function") { - this.macros[name] = expanded; - } - return expanded; - } - - return expansion; - } - }]); - return MacroExpander; -}(); -/** - * This file contains the “gullet” where macros are expanded - * until only non-macro tokens remain. - */ - -exports.default = MacroExpander; - -},{"./Lexer":81,"./ParseError":84,"./Token":90,"./macros":120,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9,"babel-runtime/helpers/toConsumableArray":11,"object-assign":80}],83:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _createClass2 = require("babel-runtime/helpers/createClass"); - -var _createClass3 = _interopRequireDefault(_createClass2); - -var _fontMetrics2 = require("./fontMetrics"); - -var _fontMetrics3 = _interopRequireDefault(_fontMetrics2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var sizeStyleMap = [ -// Each element contains [textsize, scriptsize, scriptscriptsize]. -// The size mappings are taken from TeX with \normalsize=10pt. -[1, 1, 1], // size1: [5, 5, 5] \tiny -[2, 1, 1], // size2: [6, 5, 5] -[3, 1, 1], // size3: [7, 5, 5] \scriptsize -[4, 2, 1], // size4: [8, 6, 5] \footnotesize -[5, 2, 1], // size5: [9, 6, 5] \small -[6, 3, 1], // size6: [10, 7, 5] \normalsize -[7, 4, 2], // size7: [12, 8, 6] \large -[8, 6, 3], // size8: [14.4, 10, 7] \Large -[9, 7, 6], // size9: [17.28, 12, 10] \LARGE -[10, 8, 7], // size10: [20.74, 14.4, 12] \huge -[11, 10, 9]]; -/** - * This file contains information about the options that the Parser carries - * around with it while parsing. Data is held in an `Options` object, and when - * recursing, a new `Options` object can be created with the `.with*` and - * `.reset` functions. - */ - -var sizeMultipliers = [ -// fontMetrics.js:getFontMetrics also uses size indexes, so if -// you change size indexes, change that function. -0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488]; - -var sizeAtStyle = function sizeAtStyle(size, style) { - return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1]; -}; - -/** - * This is the main options class. It contains the current style, size, color, - * and font. - * - * Options objects should not be modified. To create a new Options with - * different properties, call a `.having*` method. - */ -var Options = function () { - function Options(data) { - (0, _classCallCheck3.default)(this, Options); - - this.style = data.style; - this.color = data.color; - this.size = data.size || Options.BASESIZE; - this.textSize = data.textSize || this.size; - this.phantom = !!data.phantom; - this.font = data.font; - this.sizeMultiplier = sizeMultipliers[this.size - 1]; - this.maxSize = data.maxSize; - this._fontMetrics = undefined; - } - - /** - * Returns a new options object with the same properties as "this". Properties - * from "extension" will be copied to the new options object. - */ - - - /** - * The base size index. - */ - - - (0, _createClass3.default)(Options, [{ - key: "extend", - value: function extend(extension) { - var data = { - style: this.style, - size: this.size, - textSize: this.textSize, - color: this.color, - phantom: this.phantom, - font: this.font, - maxSize: this.maxSize - }; - - for (var key in extension) { - if (extension.hasOwnProperty(key)) { - data[key] = extension[key]; - } - } - - return new Options(data); - } - - /** - * Return an options object with the given style. If `this.style === style`, - * returns `this`. - */ - - }, { - key: "havingStyle", - value: function havingStyle(style) { - if (this.style === style) { - return this; - } else { - return this.extend({ - style: style, - size: sizeAtStyle(this.textSize, style) - }); - } - } - - /** - * Return an options object with a cramped version of the current style. If - * the current style is cramped, returns `this`. - */ - - }, { - key: "havingCrampedStyle", - value: function havingCrampedStyle() { - return this.havingStyle(this.style.cramp()); - } - - /** - * Return an options object with the given size and in at least `\textstyle`. - * Returns `this` if appropriate. - */ - - }, { - key: "havingSize", - value: function havingSize(size) { - if (this.size === size && this.textSize === size) { - return this; - } else { - return this.extend({ - style: this.style.text(), - size: size, - textSize: size - }); - } - } - - /** - * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted, - * changes to at least `\textstyle`. - */ - - }, { - key: "havingBaseStyle", - value: function havingBaseStyle(style) { - style = style || this.style.text(); - var wantSize = sizeAtStyle(Options.BASESIZE, style); - if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) { - return this; - } else { - return this.extend({ - style: style, - size: wantSize - }); - } - } - - /** - * Create a new options object with the given color. - */ - - }, { - key: "withColor", - value: function withColor(color) { - return this.extend({ - color: color - }); - } - - /** - * Create a new options object with "phantom" set to true. - */ - - }, { - key: "withPhantom", - value: function withPhantom() { - return this.extend({ - phantom: true - }); - } - - /** - * Create a new options objects with the give font. - */ - - }, { - key: "withFont", - value: function withFont(font) { - return this.extend({ - font: font || this.font - }); - } - - /** - * Return the CSS sizing classes required to switch from enclosing options - * `oldOptions` to `this`. Returns an array of classes. - */ - - }, { - key: "sizingClasses", - value: function sizingClasses(oldOptions) { - if (oldOptions.size !== this.size) { - return ["sizing", "reset-size" + oldOptions.size, "size" + this.size]; - } else { - return []; - } - } - - /** - * Return the CSS sizing classes required to switch to the base size. Like - * `this.havingSize(BASESIZE).sizingClasses(this)`. - */ - - }, { - key: "baseSizingClasses", - value: function baseSizingClasses() { - if (this.size !== Options.BASESIZE) { - return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE]; - } else { - return []; - } - } - - /** - * Return the font metrics for this size. - */ - - }, { - key: "fontMetrics", - value: function fontMetrics() { - if (!this._fontMetrics) { - this._fontMetrics = _fontMetrics3.default.getFontMetrics(this.size); - } - return this._fontMetrics; - } - - /** - * A map of color names to CSS colors. - * TODO(emily): Remove this when we have real macros - */ - - }, { - key: "getColor", - - - /** - * Gets the CSS color of the current options object, accounting for the - * `colorMap`. - */ - value: function getColor() { - if (this.phantom) { - return "transparent"; - } else if (this.color != null && Options.colorMap.hasOwnProperty(this.color)) { - return Options.colorMap[this.color]; - } else { - return this.color; - } - } - }]); - return Options; -}(); - -Options.BASESIZE = 6; -Options.colorMap = { - "katex-blue": "#6495ed", - "katex-orange": "#ffa500", - "katex-pink": "#ff00af", - "katex-red": "#df0030", - "katex-green": "#28ae7b", - "katex-gray": "gray", - "katex-purple": "#9d38bd", - "katex-blueA": "#ccfaff", - "katex-blueB": "#80f6ff", - "katex-blueC": "#63d9ea", - "katex-blueD": "#11accd", - "katex-blueE": "#0c7f99", - "katex-tealA": "#94fff5", - "katex-tealB": "#26edd5", - "katex-tealC": "#01d1c1", - "katex-tealD": "#01a995", - "katex-tealE": "#208170", - "katex-greenA": "#b6ffb0", - "katex-greenB": "#8af281", - "katex-greenC": "#74cf70", - "katex-greenD": "#1fab54", - "katex-greenE": "#0d923f", - "katex-goldA": "#ffd0a9", - "katex-goldB": "#ffbb71", - "katex-goldC": "#ff9c39", - "katex-goldD": "#e07d10", - "katex-goldE": "#a75a05", - "katex-redA": "#fca9a9", - "katex-redB": "#ff8482", - "katex-redC": "#f9685d", - "katex-redD": "#e84d39", - "katex-redE": "#bc2612", - "katex-maroonA": "#ffbde0", - "katex-maroonB": "#ff92c6", - "katex-maroonC": "#ed5fa6", - "katex-maroonD": "#ca337c", - "katex-maroonE": "#9e034e", - "katex-purpleA": "#ddd7ff", - "katex-purpleB": "#c6b9fc", - "katex-purpleC": "#aa87ff", - "katex-purpleD": "#7854ab", - "katex-purpleE": "#543b78", - "katex-mintA": "#f5f9e8", - "katex-mintB": "#edf2df", - "katex-mintC": "#e0e5cc", - "katex-grayA": "#f6f7f7", - "katex-grayB": "#f0f1f2", - "katex-grayC": "#e3e5e6", - "katex-grayD": "#d6d8da", - "katex-grayE": "#babec2", - "katex-grayF": "#888d93", - "katex-grayG": "#626569", - "katex-grayH": "#3b3e40", - "katex-grayI": "#21242c", - "katex-kaBlue": "#314453", - "katex-kaGreen": "#71B307" -}; -exports.default = Options; - -},{"./fontMetrics":101,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],84:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _ParseNode = require("./ParseNode"); - -var _ParseNode2 = _interopRequireDefault(_ParseNode); - -var _Token = require("./Token"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * This is the ParseError class, which is the main error thrown by KaTeX - * functions when something has gone wrong. This is used to distinguish internal - * errors from errors in the expression that the user provided. - * - * If possible, a caller should provide a Token or ParseNode with information - * about where in the source string the problem occurred. - */ -var ParseError = -// Error position based on passed-in Token or ParseNode. - -function ParseError(message, // The error message -token) // An object providing position information -{ - (0, _classCallCheck3.default)(this, ParseError); - - var error = "KaTeX parse error: " + message; - var start = void 0; - - var loc = token && token.loc; - if (loc && loc.start <= loc.end) { - // If we have the input and a position, make the error a bit fancier - - // Get the input - var input = loc.lexer.input; - - // Prepend some information - start = loc.start; - var end = loc.end; - if (start === input.length) { - error += " at end of input: "; - } else { - error += " at position " + (start + 1) + ": "; - } - - // Underline token in question using combining underscores - var underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332"); - - // Extract some context from the input and add it to the error - var left = void 0; - if (start > 15) { - left = "…" + input.slice(start - 15, start); - } else { - left = input.slice(0, start); - } - var right = void 0; - if (end + 15 < input.length) { - right = input.slice(end, end + 15) + "…"; - } else { - right = input.slice(end); - } - error += left + underlined + right; - } - - // Some hackery to make ParseError a prototype of Error - // See http://stackoverflow.com/a/8460753 - var self = new Error(error); - self.name = "ParseError"; - // $FlowFixMe - self.__proto__ = ParseError.prototype; - // $FlowFixMe - self.position = start; - return self; -}; - -// $FlowFixMe More hackery - - -ParseError.prototype.__proto__ = Error.prototype; - -exports.default = ParseError; - -},{"./ParseNode":85,"./Token":90,"babel-runtime/helpers/classCallCheck":8}],85:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _Token = require("./Token"); - -var _SourceLocation = require("./SourceLocation"); - -var _SourceLocation2 = _interopRequireDefault(_SourceLocation); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The resulting parse tree nodes of the parse tree. - * - * It is possible to provide position information, so that a `ParseNode` can - * fulfill a role similar to a `Token` in error reporting. - * For details on the corresponding properties see `Token` constructor. - * Providing such information can lead to better error reporting. - */ -var ParseNode = function ParseNode(type, // type of node, like e.g. "ordgroup" -value, // type-specific representation of the node -mode, // parse mode in action for this node, "math" or "text" -firstToken, // first token of the input for this node, -lastToken) // last token of the input for this node, -// will default to firstToken if unset -{ - (0, _classCallCheck3.default)(this, ParseNode); - - this.type = type; - this.value = value; - this.mode = mode; - this.loc = _SourceLocation2.default.range(firstToken, lastToken); -}; - -exports.default = ParseNode; - -},{"./SourceLocation":88,"./Token":90,"babel-runtime/helpers/classCallCheck":8}],86:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _createClass2 = require("babel-runtime/helpers/createClass"); - -var _createClass3 = _interopRequireDefault(_createClass2); - -var _functions = require("./functions"); - -var _functions2 = _interopRequireDefault(_functions); - -var _environments = require("./environments"); - -var _environments2 = _interopRequireDefault(_environments); - -var _MacroExpander = require("./MacroExpander"); - -var _MacroExpander2 = _interopRequireDefault(_MacroExpander); - -var _symbols = require("./symbols"); - -var _symbols2 = _interopRequireDefault(_symbols); - -var _utils = require("./utils"); - -var _utils2 = _interopRequireDefault(_utils); - -var _units = require("./units"); - -var _unicodeRegexes = require("./unicodeRegexes"); - -var _ParseNode = require("./ParseNode"); - -var _ParseNode2 = _interopRequireDefault(_ParseNode); - -var _ParseError = require("./ParseError"); - -var _ParseError2 = _interopRequireDefault(_ParseError); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * This file contains the parser used to parse out a TeX expression from the - * input. Since TeX isn't context-free, standard parsers don't work particularly - * well. - * - * The strategy of this parser is as such: - * - * The main functions (the `.parse...` ones) take a position in the current - * parse string to parse tokens from. The lexer (found in Lexer.js, stored at - * this.lexer) also supports pulling out tokens at arbitrary places. When - * individual tokens are needed at a position, the lexer is called to pull out a - * token, which is then used. - * - * The parser has a property called "mode" indicating the mode that - * the parser is currently in. Currently it has to be one of "math" or - * "text", which denotes whether the current environment is a math-y - * one or a text-y one (e.g. inside \text). Currently, this serves to - * limit the functions which can be used in text mode. - * - * The main functions then return an object which contains the useful data that - * was parsed at its given point, and a new position at the end of the parsed - * data. The main functions can call each other and continue the parsing by - * using the returned position as a new starting point. - * - * There are also extra `.handle...` functions, which pull out some reused - * functionality into self-contained functions. - * - * The earlier functions return ParseNodes. - * The later functions (which are called deeper in the parse) sometimes return - * ParsedFuncOrArgOrDollar, which contain a ParseNode as well as some data about - * whether the parsed object is a function which is missing some arguments, or a - * standalone object which can be used as an argument to another function. - */ - -/* TODO: Uncomment when porting to flow. -type ParsedType = "fn" | "arg" | "$" -type ParsedFunc = {| - type: "fn", - result: string, // Function name defined via defineFunction (e.g. "\\frac"). - token: Token, -|}; -type ParsedArg = {| - type: "arg", - result: ParseNode, - token: Token, -|}; -type ParsedDollar = {| - // Math mode switch - type: "$", - result: "$", - token: Token, -|}; -type ParsedFuncOrArgOrDollar = ParsedFunc | ParsedArg | ParsedDollar; -*/ - -/** - * @param {ParseNode} result - * @param {Token} token - * @return {ParsedArg} - */ -function newArgument(result, token) { - return { type: "arg", result: result, token: token }; -} - -/** - * @param {Token} token - * @return {ParsedFunc} - */ -/* eslint no-constant-condition:0 */ -function newFunction(token) { - return { type: "fn", result: token.text, token: token }; -} - -/** - * @param {Token} token - * @return {ParsedDollar} - */ -function newDollar(token) { - return { type: "$", result: "$", token: token }; -} - -/** - * @param {ParsedFuncOrArgOrDollar} parsed - * @return {ParsedFuncOrArg} - */ -function assertFuncOrArg(parsed) { - if (parsed.type === "$") { - throw new _ParseError2.default("Unexpected $", parsed.token); - } - return parsed; -} - -var Parser = function () { - function Parser(input, settings) { - (0, _classCallCheck3.default)(this, Parser); - - // Create a new macro expander (gullet) and (indirectly via that) also a - // new lexer (mouth) for this parser (stomach, in the language of TeX) - this.gullet = new _MacroExpander2.default(input, settings.macros); - // Use old \color behavior (same as LaTeX's \textcolor) if requested. - // We do this after the macros object has been copied by MacroExpander. - if (settings.colorIsTextColor) { - this.gullet.macros["\\color"] = "\\textcolor"; - } - // Store the settings for use in parsing - this.settings = settings; - // Count leftright depth (for \middle errors) - this.leftrightDepth = 0; - } - - /** - * Checks a result to make sure it has the right type, and throws an - * appropriate error otherwise. - * - * @param {boolean=} consume whether to consume the expected token, - * defaults to true - */ - - - (0, _createClass3.default)(Parser, [{ - key: "expect", - value: function expect(text, consume) { - if (this.nextToken.text !== text) { - throw new _ParseError2.default("Expected '" + text + "', got '" + this.nextToken.text + "'", this.nextToken); - } - if (consume !== false) { - this.consume(); - } - } - - /** - * Considers the current look ahead token as consumed, - * and fetches the one after that as the new look ahead. - */ - - }, { - key: "consume", - value: function consume() { - this.nextToken = this.gullet.expandNextToken(); - } - - /** - * Switches between "text" and "math" modes. - */ - - }, { - key: "switchMode", - value: function switchMode(newMode) { - this.mode = newMode; - } - - /** - * Main parsing function, which parses an entire input. - * - * @return {Array.} - */ - - }, { - key: "parse", - value: function parse() { - // Try to parse the input - this.mode = "math"; - this.consume(); - var parse = this.parseInput(); - return parse; - } - - /** - * Parses an entire input tree. - */ - - }, { - key: "parseInput", - value: function parseInput() { - // Parse an expression - var expression = this.parseExpression(false); - // If we succeeded, make sure there's an EOF at the end - this.expect("EOF", false); - return expression; - } - }, { - key: "parseExpression", - - - /** - * Parses an "expression", which is a list of atoms. - * - * @param {boolean} breakOnInfix Should the parsing stop when we hit infix - * nodes? This happens when functions have higher precendence - * than infix nodes in implicit parses. - * - * @param {?string} breakOnTokenText The text of the token that the expression - * should end with, or `null` if something else should end the - * expression. - * - * @return {Array} - */ - value: function parseExpression(breakOnInfix, breakOnTokenText) { - var body = []; - // Keep adding atoms to the body until we can't parse any more atoms (either - // we reached the end, a }, or a \right) - while (true) { - // Ignore spaces in math mode - if (this.mode === "math") { - this.consumeSpaces(); - } - var lex = this.nextToken; - if (Parser.endOfExpression.indexOf(lex.text) !== -1) { - break; - } - if (breakOnTokenText && lex.text === breakOnTokenText) { - break; - } - if (breakOnInfix && _functions2.default[lex.text] && _functions2.default[lex.text].infix) { - break; - } - var atom = this.parseAtom(breakOnTokenText); - if (!atom) { - if (!this.settings.throwOnError && lex.text[0] === "\\") { - var errorNode = this.handleUnsupportedCmd(); - body.push(errorNode); - continue; - } - - break; - } - body.push(atom); - } - return this.handleInfixNodes(body); - } - - /** - * Rewrites infix operators such as \over with corresponding commands such - * as \frac. - * - * There can only be one infix operator per group. If there's more than one - * then the expression is ambiguous. This can be resolved by adding {}. - * - * @param {Array} body - * @return {Array} - */ - - }, { - key: "handleInfixNodes", - value: function handleInfixNodes(body) { - var overIndex = -1; - var funcName = void 0; - - for (var i = 0; i < body.length; i++) { - var node = body[i]; - if (node.type === "infix") { - if (overIndex !== -1) { - throw new _ParseError2.default("only one infix operator per group", node.value.token); - } - overIndex = i; - funcName = node.value.replaceWith; - } - } - - if (overIndex !== -1) { - var numerNode = void 0; - var denomNode = void 0; - - var numerBody = body.slice(0, overIndex); - var denomBody = body.slice(overIndex + 1); - - if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { - numerNode = numerBody[0]; - } else { - numerNode = new _ParseNode2.default("ordgroup", numerBody, this.mode); - } - - if (denomBody.length === 1 && denomBody[0].type === "ordgroup") { - denomNode = denomBody[0]; - } else { - denomNode = new _ParseNode2.default("ordgroup", denomBody, this.mode); - } - - var value = this.callFunction(funcName, [numerNode, denomNode], []); - return [new _ParseNode2.default(value.type, value, this.mode)]; - } else { - return body; - } - } - - // The greediness of a superscript or subscript - - }, { - key: "handleSupSubscript", - - - /** - * Handle a subscript or superscript with nice errors. - * @param {string} name For error reporting. - * @return {ParsedNode} - */ - value: function handleSupSubscript(name) { - var symbolToken = this.nextToken; - var symbol = symbolToken.text; - this.consume(); - this.consumeSpaces(); // ignore spaces before sup/subscript argument - var group = this.parseGroup(); - - if (!group) { - if (!this.settings.throwOnError && this.nextToken.text[0] === "\\") { - return this.handleUnsupportedCmd(); - } else { - throw new _ParseError2.default("Expected group after '" + symbol + "'", symbolToken); - } - } - - var arg = assertFuncOrArg(group); - if (arg.type === "fn") { - // ^ and _ have a greediness, so handle interactions with functions' - // greediness - var funcGreediness = _functions2.default[group.result].greediness; - if (funcGreediness > Parser.SUPSUB_GREEDINESS) { - return this.parseGivenFunction(group); - } else { - throw new _ParseError2.default("Got function '" + group.result + "' with no arguments " + "as " + name, symbolToken); - } - } else { - return group.result; - } - } - - /** - * Converts the textual input of an unsupported command into a text node - * contained within a color node whose color is determined by errorColor - */ - - }, { - key: "handleUnsupportedCmd", - value: function handleUnsupportedCmd() { - var text = this.nextToken.text; - var textordArray = []; - - for (var i = 0; i < text.length; i++) { - textordArray.push(new _ParseNode2.default("textord", text[i], "text")); - } - - var textNode = new _ParseNode2.default("text", { - body: textordArray, - type: "text" - }, this.mode); - - var colorNode = new _ParseNode2.default("color", { - color: this.settings.errorColor, - value: [textNode], - type: "color" - }, this.mode); - - this.consume(); - return colorNode; - } - - /** - * Parses a group with optional super/subscripts. - * - * @param {"]" | "}"} breakOnTokenText - character to stop parsing the group on. - * @return {?ParseNode} - */ - - }, { - key: "parseAtom", - value: function parseAtom(breakOnTokenText) { - // The body of an atom is an implicit group, so that things like - // \left(x\right)^2 work correctly. - var base = this.parseImplicitGroup(breakOnTokenText); - - // In text mode, we don't have superscripts or subscripts - if (this.mode === "text") { - return base; - } - - // Note that base may be empty (i.e. null) at this point. - - var superscript = void 0; - var subscript = void 0; - while (true) { - // Guaranteed in math mode, so eat any spaces first. - this.consumeSpaces(); - - // Lex the first token - var lex = this.nextToken; - - if (lex.text === "\\limits" || lex.text === "\\nolimits") { - // We got a limit control - if (!base || base.type !== "op") { - throw new _ParseError2.default("Limit controls must follow a math operator", lex); - } else { - var limits = lex.text === "\\limits"; - base.value.limits = limits; - base.value.alwaysHandleSupSub = true; - } - this.consume(); - } else if (lex.text === "^") { - // We got a superscript start - if (superscript) { - throw new _ParseError2.default("Double superscript", lex); - } - superscript = this.handleSupSubscript("superscript"); - } else if (lex.text === "_") { - // We got a subscript start - if (subscript) { - throw new _ParseError2.default("Double subscript", lex); - } - subscript = this.handleSupSubscript("subscript"); - } else if (lex.text === "'") { - // We got a prime - if (superscript) { - throw new _ParseError2.default("Double superscript", lex); - } - var prime = new _ParseNode2.default("textord", "\\prime", this.mode); - - // Many primes can be grouped together, so we handle this here - var primes = [prime]; - this.consume(); - // Keep lexing tokens until we get something that's not a prime - while (this.nextToken.text === "'") { - // For each one, add another prime to the list - primes.push(prime); - this.consume(); - } - // If there's a superscript following the primes, combine that - // superscript in with the primes. - if (this.nextToken.text === "^") { - primes.push(this.handleSupSubscript("superscript")); - } - // Put everything into an ordgroup as the superscript - superscript = new _ParseNode2.default("ordgroup", primes, this.mode); - } else { - // If it wasn't ^, _, or ', stop parsing super/subscripts - break; - } - } - - if (superscript || subscript) { - // If we got either a superscript or subscript, create a supsub - return new _ParseNode2.default("supsub", { - base: base, - sup: superscript, - sub: subscript - }, this.mode); - } else { - // Otherwise return the original body - return base; - } - } - - // A list of the size-changing functions, for use in parseImplicitGroup - - - // A list of the style-changing functions, for use in parseImplicitGroup - - - // Old font functions - - }, { - key: "parseImplicitGroup", - - - /** - * Parses an implicit group, which is a group that starts at the end of a - * specified, and ends right before a higher explicit group ends, or at EOL. It - * is used for functions that appear to affect the current style, like \Large or - * \textrm, where instead of keeping a style we just pretend that there is an - * implicit grouping after it until the end of the group. E.g. - * small text {\Large large text} small text again - * It is also used for \left and \right to get the correct grouping. - * - * @param {"]" | "}"} breakOnTokenText - character to stop parsing the group on. - * @return {?ParseNode} - */ - value: function parseImplicitGroup(breakOnTokenText) { - var start = this.parseSymbol(); - - if (start == null) { - // If we didn't get anything we handle, fall back to parseFunction - return this.parseFunction(); - } - - var func = start.result; - - if (func === "\\left") { - // If we see a left: - // Parse the entire left function (including the delimiter) - var left = this.parseGivenFunction(start); - // Parse out the implicit body - ++this.leftrightDepth; - var body = this.parseExpression(false); - --this.leftrightDepth; - // Check the next token - this.expect("\\right", false); - var right = this.parseFunction(); - return new _ParseNode2.default("leftright", { - body: body, - left: left.value.value, - right: right.value.value - }, this.mode); - } else if (func === "\\begin") { - // begin...end is similar to left...right - var begin = this.parseGivenFunction(start); - var envName = begin.value.name; - if (!_environments2.default.has(envName)) { - throw new _ParseError2.default("No such environment: " + envName, begin.value.nameGroup); - } - // Build the environment object. Arguments and other information will - // be made available to the begin and end methods using properties. - var env = _environments2.default.get(envName); - - var _parseArguments = this.parseArguments("\\begin{" + envName + "}", env), - args = _parseArguments.args, - optArgs = _parseArguments.optArgs; - - var context = { - mode: this.mode, - envName: envName, - parser: this - }; - var result = env.handler(context, args, optArgs); - this.expect("\\end", false); - var endNameToken = this.nextToken; - var end = this.parseFunction(); - if (end.value.name !== envName) { - throw new _ParseError2.default("Mismatch: \\begin{" + envName + "} matched " + "by \\end{" + end.value.name + "}", endNameToken); - } - result.position = end.position; - return result; - } else if (_utils2.default.contains(Parser.sizeFuncs, func)) { - // If we see a sizing function, parse out the implicit body - this.consumeSpaces(); - var _body = this.parseExpression(false, breakOnTokenText); - return new _ParseNode2.default("sizing", { - // Figure out what size to use based on the list of functions above - size: _utils2.default.indexOf(Parser.sizeFuncs, func) + 1, - value: _body - }, this.mode); - } else if (_utils2.default.contains(Parser.styleFuncs, func)) { - // If we see a styling function, parse out the implicit body - this.consumeSpaces(); - var _body2 = this.parseExpression(true, breakOnTokenText); - return new _ParseNode2.default("styling", { - // Figure out what style to use by pulling out the style from - // the function name - style: func.slice(1, func.length - 5), - value: _body2 - }, this.mode); - } else if (func in Parser.oldFontFuncs) { - var style = Parser.oldFontFuncs[func]; - // If we see an old font function, parse out the implicit body - this.consumeSpaces(); - var _body3 = this.parseExpression(true, breakOnTokenText); - if (style.slice(0, 4) === 'text') { - return new _ParseNode2.default("text", { - style: style, - body: new _ParseNode2.default("ordgroup", _body3, this.mode) - }, this.mode); - } else { - return new _ParseNode2.default("font", { - font: style, - body: new _ParseNode2.default("ordgroup", _body3, this.mode) - }, this.mode); - } - } else if (func === "\\color") { - // If we see a styling function, parse out the implicit body - var color = this.parseColorGroup(false); - if (!color) { - throw new _ParseError2.default("\\color not followed by color"); - } - var _body4 = this.parseExpression(true, breakOnTokenText); - return new _ParseNode2.default("color", { - type: "color", - color: color.result.value, - value: _body4 - }, this.mode); - } else if (func === "$") { - if (this.mode === "math") { - throw new _ParseError2.default("$ within math mode"); - } - this.consume(); - var outerMode = this.mode; - this.switchMode("math"); - var _body5 = this.parseExpression(false, "$"); - this.expect("$", true); - this.switchMode(outerMode); - return new _ParseNode2.default("styling", { - style: "text", - value: _body5 - }, "math"); - } else { - // Defer to parseGivenFunction if it's not a function we handle - return this.parseGivenFunction(start); - } - } - - /** - * Parses an entire function, including its base and all of its arguments. - * It also handles the case where the parsed node is not a function. - * - * @return {?ParseNode} - */ - - }, { - key: "parseFunction", - value: function parseFunction() { - var baseGroup = this.parseGroup(); - return baseGroup ? this.parseGivenFunction(baseGroup) : null; - } - - /** - * Same as parseFunction(), except that the base is provided, guaranteeing a - * non-nullable result. - * - * @param {ParsedFuncOrArgOrDollar} baseGroup - * @return {ParseNode} - */ - - }, { - key: "parseGivenFunction", - value: function parseGivenFunction(baseGroup) { - baseGroup = assertFuncOrArg(baseGroup); - if (baseGroup.type === "fn") { - var func = baseGroup.result; - var funcData = _functions2.default[func]; - if (this.mode === "text" && !funcData.allowedInText) { - throw new _ParseError2.default("Can't use function '" + func + "' in text mode", baseGroup.token); - } else if (this.mode === "math" && funcData.allowedInMath === false) { - throw new _ParseError2.default("Can't use function '" + func + "' in math mode", baseGroup.token); - } - - var _parseArguments2 = this.parseArguments(func, funcData), - args = _parseArguments2.args, - optArgs = _parseArguments2.optArgs; - - var token = baseGroup.token; - var result = this.callFunction(func, args, optArgs, token); - return new _ParseNode2.default(result.type, result, this.mode); - } else { - return baseGroup.result; - } - } - - /** - * Call a function handler with a suitable context and arguments. - * @param {string} name - * @param {Array} args - * @param {Array} optArgs - * @param {Token=} token - */ - - }, { - key: "callFunction", - value: function callFunction(name, args, optArgs, token) { - var context = { - funcName: name, - parser: this, - token: token - }; - return _functions2.default[name].handler(context, args, optArgs); - } - - /** - * Parses the arguments of a function or environment - * - * @param {string} func "\name" or "\begin{name}" - * @param {{ - * numArgs: number, - * numOptionalArgs: (number|undefined), - * }} funcData - * @return {{ - * args: Array, - * optArgs: Array, - * }} - */ - - }, { - key: "parseArguments", - value: function parseArguments(func, funcData) { - var totalArgs = funcData.numArgs + funcData.numOptionalArgs; - if (totalArgs === 0) { - return { args: [], optArgs: [] }; - } - - var baseGreediness = funcData.greediness; - var args = []; - var optArgs = []; - - for (var i = 0; i < totalArgs; i++) { - var argType = funcData.argTypes && funcData.argTypes[i]; - var isOptional = i < funcData.numOptionalArgs; - // Ignore spaces between arguments. As the TeXbook says: - // "After you have said ‘\def\row#1#2{...}’, you are allowed to - // put spaces between the arguments (e.g., ‘\row x n’), because - // TeX doesn’t use single spaces as undelimited arguments." - if (i > 0 && !isOptional) { - this.consumeSpaces(); - } - // Also consume leading spaces in math mode, as parseSymbol - // won't know what to do with them. This can only happen with - // macros, e.g. \frac\foo\foo where \foo expands to a space symbol. - // In LaTeX, the \foo's get treated as (blank) arguments). - // In KaTeX, for now, both spaces will get consumed. - // TODO(edemaine) - if (i === 0 && !isOptional && this.mode === "math") { - this.consumeSpaces(); - } - var nextToken = this.nextToken; - var arg = argType ? this.parseGroupOfType(argType, isOptional) : this.parseGroup(isOptional); - if (!arg) { - if (isOptional) { - optArgs.push(null); - continue; - } - if (!this.settings.throwOnError && this.nextToken.text[0] === "\\") { - arg = newArgument(this.handleUnsupportedCmd(), nextToken); - } else { - throw new _ParseError2.default("Expected group after '" + func + "'", nextToken); - } - } - var argNode = void 0; - arg = assertFuncOrArg(arg); - if (arg.type === "fn") { - var argGreediness = _functions2.default[arg.result].greediness; - if (argGreediness > baseGreediness) { - argNode = this.parseGivenFunction(arg); - } else { - throw new _ParseError2.default("Got function '" + arg.result + "' as " + "argument to '" + func + "'", nextToken); - } - } else { - argNode = arg.result; - } - (isOptional ? optArgs : args).push(argNode); - } - - return { args: args, optArgs: optArgs }; - } - - /** - * Parses a group when the mode is changing. - * - * @return {?ParsedFuncOrArgOrDollar} - */ - - }, { - key: "parseGroupOfType", - value: function parseGroupOfType(innerMode, optional) { - var outerMode = this.mode; - // Handle `original` argTypes - if (innerMode === "original") { - innerMode = outerMode; - } - - if (innerMode === "color") { - return this.parseColorGroup(optional); - } - if (innerMode === "size") { - return this.parseSizeGroup(optional); - } - if (innerMode === "url") { - return this.parseUrlGroup(optional); - } - - // By the time we get here, innerMode is one of "text" or "math". - // We switch the mode of the parser, recurse, then restore the old mode. - this.switchMode(innerMode); - var res = this.parseGroup(optional); - this.switchMode(outerMode); - return res; - } - }, { - key: "consumeSpaces", - value: function consumeSpaces() { - while (this.nextToken.text === " ") { - this.consume(); - } - } - - /** - * Parses a group, essentially returning the string formed by the - * brace-enclosed tokens plus some position information. - * - * @param {string} modeName Used to describe the mode in error messages - * @param {boolean=} optional Whether the group is optional or required - * @return {?Token} - */ - - }, { - key: "parseStringGroup", - value: function parseStringGroup(modeName, optional) { - if (optional && this.nextToken.text !== "[") { - return null; - } - var outerMode = this.mode; - this.mode = "text"; - this.expect(optional ? "[" : "{"); - var str = ""; - var firstToken = this.nextToken; - var lastToken = firstToken; - while (this.nextToken.text !== (optional ? "]" : "}")) { - if (this.nextToken.text === "EOF") { - throw new _ParseError2.default("Unexpected end of input in " + modeName, firstToken.range(this.nextToken, str)); - } - lastToken = this.nextToken; - str += lastToken.text; - this.consume(); - } - this.mode = outerMode; - this.expect(optional ? "]" : "}"); - return firstToken.range(lastToken, str); - } - - /** - * Parses a group, essentially returning the string formed by the - * brace-enclosed tokens plus some position information, possibly - * with nested braces. - * - * @param {string} modeName Used to describe the mode in error messages - * @param {boolean=} optional Whether the group is optional or required - * @return {?Token} - */ - - }, { - key: "parseStringGroupWithBalancedBraces", - value: function parseStringGroupWithBalancedBraces(modeName, optional) { - if (optional && this.nextToken.text !== "[") { - return null; - } - var outerMode = this.mode; - this.mode = "text"; - this.expect(optional ? "[" : "{"); - var str = ""; - var nest = 0; - var firstToken = this.nextToken; - var lastToken = firstToken; - while (nest > 0 || this.nextToken.text !== (optional ? "]" : "}")) { - if (this.nextToken.text === "EOF") { - throw new _ParseError2.default("Unexpected end of input in " + modeName, firstToken.range(this.nextToken, str)); - } - lastToken = this.nextToken; - str += lastToken.text; - if (lastToken.text === "{") { - nest += 1; - } else if (lastToken.text === "}") { - if (nest <= 0) { - throw new _ParseError2.default("Unbalanced brace of input in " + modeName, firstToken.range(this.nextToken, str)); - } else { - nest -= 1; - } - } - this.consume(); - } - this.mode = outerMode; - this.expect(optional ? "]" : "}"); - return firstToken.range(lastToken, str); - } - - /** - * Parses a regex-delimited group: the largest sequence of tokens - * whose concatenated strings match `regex`. Returns the string - * formed by the tokens plus some position information. - * - * @param {RegExp} regex - * @param {string} modeName Used to describe the mode in error messages - * @return {Token} - */ - - }, { - key: "parseRegexGroup", - value: function parseRegexGroup(regex, modeName) { - var outerMode = this.mode; - this.mode = "text"; - var firstToken = this.nextToken; - var lastToken = firstToken; - var str = ""; - while (this.nextToken.text !== "EOF" && regex.test(str + this.nextToken.text)) { - lastToken = this.nextToken; - str += lastToken.text; - this.consume(); - } - if (str === "") { - throw new _ParseError2.default("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken); - } - this.mode = outerMode; - return firstToken.range(lastToken, str); - } - - /** - * Parses a color description. - */ - - }, { - key: "parseColorGroup", - value: function parseColorGroup(optional) { - var res = this.parseStringGroup("color", optional); - if (!res) { - return null; - } - var match = /^(#[a-f0-9]{3}|#[a-f0-9]{6}|[a-z]+)$/i.exec(res.text); - if (!match) { - throw new _ParseError2.default("Invalid color: '" + res.text + "'", res); - } - return newArgument(new _ParseNode2.default("color", match[0], this.mode), res); - } - - /** - * Parses a url string. - */ - - }, { - key: "parseUrlGroup", - value: function parseUrlGroup(optional) { - var res = this.parseStringGroupWithBalancedBraces("url", optional); - if (!res) { - return null; - } - var raw = res.text; - // hyperref package allows backslashes alone in href, but doesn't generate - // valid links in such cases; we interpret this as "undefiend" behaviour, - // and keep them as-is. Some browser will replace backslashes with - // forward slashes. - var url = raw.replace(/\\([#$%&~_^{}])/g, '$1'); - return newArgument(new _ParseNode2.default("url", url, this.mode), res); - } - - /** - * Parses a size specification, consisting of magnitude and unit. - */ - - }, { - key: "parseSizeGroup", - value: function parseSizeGroup(optional) { - var res = void 0; - if (!optional && this.nextToken.text !== "{") { - res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size"); - } else { - res = this.parseStringGroup("size", optional); - } - if (!res) { - return null; - } - var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text); - if (!match) { - throw new _ParseError2.default("Invalid size: '" + res.text + "'", res); - } - var data = { - number: +(match[1] + match[2]), // sign + magnitude, cast to number - unit: match[3] - }; - if (!(0, _units.validUnit)(data)) { - throw new _ParseError2.default("Invalid unit: '" + data.unit + "'", res); - } - return newArgument(new _ParseNode2.default("size", data, this.mode), res); - } - - /** - * If the argument is false or absent, this parses an ordinary group, - * which is either a single nucleus (like "x") or an expression - * in braces (like "{x+y}"). - * If the argument is true, it parses either a bracket-delimited expression - * (like "[x+y]") or returns null to indicate the absence of a - * bracket-enclosed group. - * - * @param {boolean=} optional Whether the group is optional or required - * @return {?ParsedFuncOrArgOrDollar} - */ - - }, { - key: "parseGroup", - value: function parseGroup(optional) { - var firstToken = this.nextToken; - // Try to parse an open brace - if (this.nextToken.text === (optional ? "[" : "{")) { - // If we get a brace, parse an expression - this.consume(); - var expression = this.parseExpression(false, optional ? "]" : "}"); - var lastToken = this.nextToken; - // Make sure we get a close brace - this.expect(optional ? "]" : "}"); - if (this.mode === "text") { - this.formLigatures(expression); - } - return newArgument(new _ParseNode2.default("ordgroup", expression, this.mode, firstToken, lastToken), firstToken.range(lastToken, firstToken.text)); - } else { - // Otherwise, just return a nucleus, or nothing for an optional group - return optional ? null : this.parseSymbol(); - } - } - - /** - * Form ligature-like combinations of characters for text mode. - * This includes inputs like "--", "---", "``" and "''". - * The result will simply replace multiple textord nodes with a single - * character in each value by a single textord node having multiple - * characters in its value. The representation is still ASCII source. - * - * @param {Array.} group the nodes of this group, - * list will be moified in place - */ - - }, { - key: "formLigatures", - value: function formLigatures(group) { - var n = group.length - 1; - for (var i = 0; i < n; ++i) { - var a = group[i]; - var v = a.value; - if (v === "-" && group[i + 1].value === "-") { - if (i + 1 < n && group[i + 2].value === "-") { - group.splice(i, 3, new _ParseNode2.default("textord", "---", "text", a, group[i + 2])); - n -= 2; - } else { - group.splice(i, 2, new _ParseNode2.default("textord", "--", "text", a, group[i + 1])); - n -= 1; - } - } - if ((v === "'" || v === "`") && group[i + 1].value === v) { - group.splice(i, 2, new _ParseNode2.default("textord", v + v, "text", a, group[i + 1])); - n -= 1; - } - } - } - - /** - * Parse a single symbol out of the string. Here, we handle both the functions - * we have defined, as well as the single character symbols - * - * @return {?ParsedFuncOrArgOrDollar} - */ - - }, { - key: "parseSymbol", - value: function parseSymbol() { - var nucleus = this.nextToken; - - if (_functions2.default[nucleus.text]) { - this.consume(); - // If there exists a function with this name, we return the function and - // say that it is a function. - return newFunction(nucleus); - } else if (_symbols2.default[this.mode][nucleus.text]) { - this.consume(); - // Otherwise if this is a no-argument function, find the type it - // corresponds to in the symbols map - return newArgument(new _ParseNode2.default(_symbols2.default[this.mode][nucleus.text].group, nucleus.text, this.mode, nucleus), nucleus); - } else if (this.mode === "text" && _unicodeRegexes.cjkRegex.test(nucleus.text)) { - this.consume(); - return newArgument(new _ParseNode2.default("textord", nucleus.text, this.mode, nucleus), nucleus); - } else if (nucleus.text === "$") { - return newDollar(nucleus); - } else if (/^\\verb[^a-zA-Z]/.test(nucleus.text)) { - this.consume(); - var arg = nucleus.text.slice(5); - var star = arg.charAt(0) === "*"; - if (star) { - arg = arg.slice(1); - } - // Lexer's tokenRegex is constructed to always have matching - // first/last characters. - if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) { - throw new _ParseError2.default("\\verb assertion failed --\n please report what input caused this bug"); - } - arg = arg.slice(1, -1); // remove first and last char - return newArgument(new _ParseNode2.default("verb", { - body: arg, - star: star - }, "text"), nucleus); - } else { - return null; - } - } - }]); - return Parser; -}(); - -Parser.endOfExpression = ["}", "\\end", "\\right", "&", "\\\\", "\\cr"]; -Parser.SUPSUB_GREEDINESS = 1; -Parser.sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"]; -Parser.styleFuncs = ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"]; -Parser.oldFontFuncs = { - "\\rm": "mathrm", - "\\sf": "mathsf", - "\\tt": "mathtt", - "\\bf": "mathbf", - "\\it": "mathit" - //"\\sl": "textsl", - //"\\sc": "textsc", -}; -exports.default = Parser; - -},{"./MacroExpander":82,"./ParseError":84,"./ParseNode":85,"./environments":99,"./functions":103,"./symbols":125,"./unicodeRegexes":126,"./units":127,"./utils":128,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],87:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _utils = require("./utils"); - -var _utils2 = _interopRequireDefault(_utils); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The main Settings object - * - * The current options stored are: - * - displayMode: Whether the expression should be typeset as inline math - * (false, the default), meaning that the math starts in - * \textstyle and is placed in an inline-block); or as display - * math (true), meaning that the math starts in \displaystyle - * and is placed in a block with vertical margin. - */ -var Settings = function Settings(options) { - (0, _classCallCheck3.default)(this, Settings); - - // allow null options - options = options || {}; - this.displayMode = _utils2.default.deflt(options.displayMode, false); - this.throwOnError = _utils2.default.deflt(options.throwOnError, true); - this.errorColor = _utils2.default.deflt(options.errorColor, "#cc0000"); - this.macros = options.macros || {}; - this.colorIsTextColor = _utils2.default.deflt(options.colorIsTextColor, false); - this.maxSize = Math.max(0, _utils2.default.deflt(options.maxSize, Infinity)); -}; -/** - * This is a module for storing settings passed into KaTeX. It correctly handles - * default settings. - */ - -exports.default = Settings; - -},{"./utils":128,"babel-runtime/helpers/classCallCheck":8}],88:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _freeze = require("babel-runtime/core-js/object/freeze"); - -var _freeze2 = _interopRequireDefault(_freeze); - -var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _createClass2 = require("babel-runtime/helpers/createClass"); - -var _createClass3 = _interopRequireDefault(_createClass2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Lexing or parsing positional information for error reporting. - * This object is immutable. - */ -var SourceLocation = function () { - // End offset, zero-based exclusive. - - // Lexer holding the input string. - function SourceLocation(lexer, start, end) { - (0, _classCallCheck3.default)(this, SourceLocation); - - this.lexer = lexer; - this.start = start; - this.end = end; - (0, _freeze2.default)(this); // Immutable to allow sharing in range(). - } - - /** - * Merges two `SourceLocation`s from location providers, given they are - * provided in order of appearance. - * - Returns the first one's location if only the first is provided. - * - Returns a merged range of the first and the last if both are provided - * and their lexers match. - * - Otherwise, returns null. - */ - // Start offset, zero-based inclusive. - - - (0, _createClass3.default)(SourceLocation, null, [{ - key: "range", - value: function range(first, second) { - if (!second) { - return first && first.loc; - } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) { - return null; - } else { - return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end); - } - } - }]); - return SourceLocation; -}(); - -exports.default = SourceLocation; - -},{"babel-runtime/core-js/object/freeze":7,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],89:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _createClass2 = require("babel-runtime/helpers/createClass"); - -var _createClass3 = _interopRequireDefault(_createClass2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * This file contains information and classes for the various kinds of styles - * used in TeX. It provides a generic `Style` class, which holds information - * about a specific style. It then provides instances of all the different kinds - * of styles possible, and provides functions to move between them and get - * information about them. - */ - -/** - * The main style class. Contains a unique id for the style, a size (which is - * the same for cramped and uncramped version of a style), and a cramped flag. - */ -var Style = function () { - function Style(id, size, cramped) { - (0, _classCallCheck3.default)(this, Style); - - this.id = id; - this.size = size; - this.cramped = cramped; - } - - /** - * Get the style of a superscript given a base in the current style. - */ - - - (0, _createClass3.default)(Style, [{ - key: "sup", - value: function sup() { - return styles[_sup[this.id]]; - } - - /** - * Get the style of a subscript given a base in the current style. - */ - - }, { - key: "sub", - value: function sub() { - return styles[_sub[this.id]]; - } - - /** - * Get the style of a fraction numerator given the fraction in the current - * style. - */ - - }, { - key: "fracNum", - value: function fracNum() { - return styles[_fracNum[this.id]]; - } - - /** - * Get the style of a fraction denominator given the fraction in the current - * style. - */ - - }, { - key: "fracDen", - value: function fracDen() { - return styles[_fracDen[this.id]]; - } - - /** - * Get the cramped version of a style (in particular, cramping a cramped style - * doesn't change the style). - */ - - }, { - key: "cramp", - value: function cramp() { - return styles[_cramp[this.id]]; - } - - /** - * Get a text or display version of this style. - */ - - }, { - key: "text", - value: function text() { - return styles[_text[this.id]]; - } - - /** - * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle) - */ - - }, { - key: "isTight", - value: function isTight() { - return this.size >= 2; - } - }]); - return Style; -}(); - -// Export an interface for type checking, but don't expose the implementation. -// This way, no more styles can be generated. - - -// IDs of the different styles -var D = 0; -var Dc = 1; -var T = 2; -var Tc = 3; -var S = 4; -var Sc = 5; -var SS = 6; -var SSc = 7; - -// Instances of the different styles -var styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)]; - -// Lookup tables for switching from one style to another -var _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; -var _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; -var _fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; -var _fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; -var _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; -var _text = [D, Dc, T, Tc, T, Tc, T, Tc]; - -// We only export some of the styles. -exports.default = { - DISPLAY: styles[D], - TEXT: styles[T], - SCRIPT: styles[S], - SCRIPTSCRIPT: styles[SS] -}; - -},{"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],90:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.Token = undefined; - -var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _createClass2 = require("babel-runtime/helpers/createClass"); - -var _createClass3 = _interopRequireDefault(_createClass2); - -var _SourceLocation = require("./SourceLocation"); - -var _SourceLocation2 = _interopRequireDefault(_SourceLocation); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * The resulting token returned from `lex`. - * - * It consists of the token text plus some position information. - * The position information is essentially a range in an input string, - * but instead of referencing the bare input string, we refer to the lexer. - * That way it is possible to attach extra metadata to the input string, - * like for example a file name or similar. - * - * The position information is optional, so it is OK to construct synthetic - * tokens if appropriate. Not providing available position information may - * lead to degraded error reporting, though. - */ - - -/** - * Interface required to break circular dependency between Token, Lexer, and - * ParseError. - */ -var Token = exports.Token = function () { - function Token(text, // the text of this token - loc) { - (0, _classCallCheck3.default)(this, Token); - - this.text = text; - this.loc = loc; - } - - /** - * Given a pair of tokens (this and endToken), compute a `Token` encompassing - * the whole input range enclosed by these two. - */ - - - (0, _createClass3.default)(Token, [{ - key: "range", - value: function range(endToken, // last token of the range, inclusive - text) // the text of the newly constructed token - { - return new Token(text, _SourceLocation2.default.range(this, endToken)); - } - }]); - return Token; -}(); - -},{"./SourceLocation":88,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],91:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _getIterator2 = require("babel-runtime/core-js/get-iterator"); - -var _getIterator3 = _interopRequireDefault(_getIterator2); - -var _domTree = require("./domTree"); - -var _domTree2 = _interopRequireDefault(_domTree); - -var _fontMetrics = require("./fontMetrics"); - -var _fontMetrics2 = _interopRequireDefault(_fontMetrics); - -var _symbols = require("./symbols"); - -var _symbols2 = _interopRequireDefault(_symbols); - -var _utils = require("./utils"); - -var _utils2 = _interopRequireDefault(_utils); - -var _stretchy = require("./stretchy"); - -var _stretchy2 = _interopRequireDefault(_stretchy); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// The following have to be loaded from Main-Italic font, using class mainit -var mainitLetters = ["\\imath", // dotless i -"\\jmath", // dotless j -"\\pounds"]; - -/** - * Looks up the given symbol in fontMetrics, after applying any symbol - * replacements defined in symbol.js - */ - -/* eslint no-console:0 */ -/** - * This module contains general functions that can be used for building - * different kinds of domTree nodes in a consistent manner. - */ - -var lookupSymbol = function lookupSymbol(value, -// TODO(#963): Use a union type for this. -fontFamily, mode) { - // Replace the value with its replaced value from symbol.js - if (_symbols2.default[mode][value] && _symbols2.default[mode][value].replace) { - value = _symbols2.default[mode][value].replace; - } - return { - value: value, - metrics: _fontMetrics2.default.getCharacterMetrics(value, fontFamily) - }; -}; - -/** - * Makes a symbolNode after translation via the list of symbols in symbols.js. - * Correctly pulls out metrics for the character, and optionally takes a list of - * classes to be attached to the node. - * - * TODO: make argument order closer to makeSpan - * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which - * should if present come first in `classes`. - * TODO(#953): Make `options` mandatory and always pass it in. - */ -var makeSymbol = function makeSymbol(value, fontFamily, mode, options, classes) { - var lookup = lookupSymbol(value, fontFamily, mode); - var metrics = lookup.metrics; - value = lookup.value; - - var symbolNode = void 0; - if (metrics) { - var italic = metrics.italic; - if (mode === "text") { - italic = 0; - } - symbolNode = new _domTree2.default.symbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, classes); - } else { - // TODO(emily): Figure out a good way to only print this in development - typeof console !== "undefined" && console.warn("No character metrics for '" + value + "' in style '" + fontFamily + "'"); - symbolNode = new _domTree2.default.symbolNode(value, 0, 0, 0, 0, classes); - } - - if (options) { - symbolNode.maxFontSize = options.sizeMultiplier; - if (options.style.isTight()) { - symbolNode.classes.push("mtight"); - } - var color = options.getColor(); - if (color) { - symbolNode.style.color = color; - } - } - - return symbolNode; -}; - -/** - * Makes a symbol in Main-Regular or AMS-Regular. - * Used for rel, bin, open, close, inner, and punct. - * - * TODO(#953): Make `options` mandatory and always pass it in. - */ -var mathsym = function mathsym(value, mode, options) { - var classes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; - - // Decide what font to render the symbol in by its entry in the symbols - // table. - // Have a special case for when the value = \ because the \ is used as a - // textord in unsupported command errors but cannot be parsed as a regular - // text ordinal and is therefore not present as a symbol in the symbols - // table for text - if (value === "\\" || _symbols2.default[mode][value].font === "main") { - return makeSymbol(value, "Main-Regular", mode, options, classes); - } else { - return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"])); - } -}; - -/** - * Makes a symbol in the default font for mathords and textords. - */ -var mathDefault = function mathDefault(value, mode, options, classes, type) { - if (type === "mathord") { - var fontLookup = mathit(value, mode, options, classes); - return makeSymbol(value, fontLookup.fontName, mode, options, classes.concat([fontLookup.fontClass])); - } else if (type === "textord") { - var font = _symbols2.default[mode][value] && _symbols2.default[mode][value].font; - if (font === "ams") { - return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"])); - } else { - // if (font === "main") { - return makeSymbol(value, "Main-Regular", mode, options, classes.concat(["mathrm"])); - } - } else { - throw new Error("unexpected type: " + type + " in mathDefault"); - } -}; - -/** - * Determines which of the two font names (Main-Italic and Math-Italic) and - * corresponding style tags (mainit or mathit) to use for font "mathit", - * depending on the symbol. Use this function instead of fontMap for font - * "mathit". - */ -var mathit = function mathit(value, mode, options, classes) { - if (/[0-9]/.test(value.charAt(0)) || - // glyphs for \imath and \jmath do not exist in Math-Italic so we - // need to use Main-Italic instead - _utils2.default.contains(mainitLetters, value)) { - return { - fontName: "Main-Italic", - fontClass: "mainit" - }; - } else { - return { - fontName: "Math-Italic", - fontClass: "mathit" - }; - } -}; - -/** - * Makes either a mathord or textord in the correct font and color. - */ -var makeOrd = function makeOrd(group, options, type) { - var mode = group.mode; - var value = group.value; - - var classes = ["mord"]; - - var font = options.font; - if (font) { - var fontLookup = void 0; - if (font === "mathit" || _utils2.default.contains(mainitLetters, value)) { - fontLookup = mathit(value, mode, options, classes); - } else { - fontLookup = fontMap[font]; - } - if (lookupSymbol(value, fontLookup.fontName, mode).metrics) { - return makeSymbol(value, fontLookup.fontName, mode, options, classes.concat([fontLookup.fontClass || font])); - } else { - return mathDefault(value, mode, options, classes, type); - } - } else { - return mathDefault(value, mode, options, classes, type); - } -}; - -/** - * Combine as many characters as possible in the given array of characters - * via their tryCombine method. - */ -var tryCombineChars = function tryCombineChars(chars) { - for (var i = 0; i < chars.length - 1; i++) { - if (chars[i].tryCombine(chars[i + 1])) { - chars.splice(i + 1, 1); - i--; - } - } - return chars; -}; - -/** - * Calculate the height, depth, and maxFontSize of an element based on its - * children. - */ -var sizeElementFromChildren = function sizeElementFromChildren(elem) { - var height = 0; - var depth = 0; - var maxFontSize = 0; - - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = (0, _getIterator3.default)(elem.children), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var child = _step.value; - - if (child.height > height) { - height = child.height; - } - if (child.depth > depth) { - depth = child.depth; - } - if (child.maxFontSize > maxFontSize) { - maxFontSize = child.maxFontSize; - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - elem.height = height; - elem.depth = depth; - elem.maxFontSize = maxFontSize; -}; - -/** - * Makes a span with the given list of classes, list of children, and options. - * - * TODO(#953): Ensure that `options` is always provided (currently some call - * sites don't pass it) and make the type below mandatory. - * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which - * should if present come first in `classes`. - */ -var makeSpan = function makeSpan(classes, children, options) { - var span = new _domTree2.default.span(classes, children, options); - - sizeElementFromChildren(span); - - return span; -}; - -var makeLineSpan = function makeLineSpan(className, options) { - // Fill the entire span instead of just a border. That way, the min-height - // value in katex.less will ensure that at least one screen pixel displays. - var line = _stretchy2.default.ruleSpan(className, options); - line.height = options.fontMetrics().defaultRuleThickness; - line.style.height = line.height + "em"; - line.maxFontSize = 1.0; - return line; -}; - -/** - * Makes an anchor with the given href, list of classes, list of children, - * and options. - */ -var makeAnchor = function makeAnchor(href, classes, children, options) { - var anchor = new _domTree2.default.anchor(href, classes, children, options); - - sizeElementFromChildren(anchor); - - return anchor; -}; - -/** - * Prepends the given children to the given span, updating height, depth, and - * maxFontSize. - */ -var prependChildren = function prependChildren(span, children) { - span.children = children.concat(span.children); - - sizeElementFromChildren(span); -}; - -/** - * Makes a document fragment with the given list of children. - */ -var makeFragment = function makeFragment(children) { - var fragment = new _domTree2.default.documentFragment(children); - - sizeElementFromChildren(fragment); - - return fragment; -}; - -// These are exact object types to catch typos in the names of the optional fields. - - -// A list of child or kern nodes to be stacked on top of each other (i.e. the -// first element will be at the bottom, and the last at the top). - - -// Computes the updated `children` list and the overall depth. -// -// This helper function for makeVList makes it easier to enforce type safety by -// allowing early exits (returns) in the logic. -var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { - if (params.positionType === "individualShift") { - var oldChildren = params.children; - var _children = [oldChildren[0]]; - - // Add in kerns to the list of params.children to get each element to be - // shifted to the correct specified shift - var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth; - var currPos = _depth; - for (var i = 1; i < oldChildren.length; i++) { - var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth; - var _size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth); - - currPos = currPos + diff; - - _children.push({ type: "kern", size: _size }); - _children.push(oldChildren[i]); - } - - return { children: _children, depth: _depth }; - } - - var depth = void 0; - if (params.positionType === "top") { - // We always start at the bottom, so calculate the bottom by adding up - // all the sizes - var bottom = params.positionData; - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = (0, _getIterator3.default)(params.children), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var child = _step2.value; - - bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth; - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - - depth = bottom; - } else if (params.positionType === "bottom") { - depth = -params.positionData; - } else { - var firstChild = params.children[0]; - if (firstChild.type !== "elem") { - throw new Error('First child must have type "elem".'); - } - if (params.positionType === "shift") { - depth = -firstChild.elem.depth - params.positionData; - } else if (params.positionType === "firstBaseline") { - depth = -firstChild.elem.depth; - } else { - throw new Error("Invalid positionType " + params.positionType + "."); - } - } - return { children: params.children, depth: depth }; -}; - -/** - * Makes a vertical list by stacking elements and kerns on top of each other. - * Allows for many different ways of specifying the positioning method. - * - * See VListParam documentation above. - */ -var makeVList = function makeVList(params, options) { - var _getVListChildrenAndD = getVListChildrenAndDepth(params), - children = _getVListChildrenAndD.children, - depth = _getVListChildrenAndD.depth; - - // Create a strut that is taller than any list item. The strut is added to - // each item, where it will determine the item's baseline. Since it has - // `overflow:hidden`, the strut's top edge will sit on the item's line box's - // top edge and the strut's bottom edge will sit on the item's baseline, - // with no additional line-height spacing. This allows the item baseline to - // be positioned precisely without worrying about font ascent and - // line-height. - - - var pstrutSize = 0; - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; - - try { - for (var _iterator3 = (0, _getIterator3.default)(children), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - var child = _step3.value; - - if (child.type === "elem") { - var _elem = child.elem; - pstrutSize = Math.max(pstrutSize, _elem.maxFontSize, _elem.height); - } - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } - } - - pstrutSize += 2; - var pstrut = makeSpan(["pstrut"], []); - pstrut.style.height = pstrutSize + "em"; - - // Create a new list of actual children at the correct offsets - var realChildren = []; - var minPos = depth; - var maxPos = depth; - var currPos = depth; - var _iteratorNormalCompletion4 = true; - var _didIteratorError4 = false; - var _iteratorError4 = undefined; - - try { - for (var _iterator4 = (0, _getIterator3.default)(children), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { - var _child = _step4.value; - - if (_child.type === "kern") { - currPos += _child.size; - } else { - var _elem2 = _child.elem; - - var childWrap = makeSpan([], [pstrut, _elem2]); - childWrap.style.top = -pstrutSize - currPos - _elem2.depth + "em"; - if (_child.marginLeft) { - childWrap.style.marginLeft = _child.marginLeft; - } - if (_child.marginRight) { - childWrap.style.marginRight = _child.marginRight; - } - - realChildren.push(childWrap); - currPos += _elem2.height + _elem2.depth; - } - minPos = Math.min(minPos, currPos); - maxPos = Math.max(maxPos, currPos); - } - - // The vlist contents go in a table-cell with `vertical-align:bottom`. - // This cell's bottom edge will determine the containing table's baseline - // without overly expanding the containing line-box. - } catch (err) { - _didIteratorError4 = true; - _iteratorError4 = err; - } finally { - try { - if (!_iteratorNormalCompletion4 && _iterator4.return) { - _iterator4.return(); - } - } finally { - if (_didIteratorError4) { - throw _iteratorError4; - } - } - } - - var vlist = makeSpan(["vlist"], realChildren); - vlist.style.height = maxPos + "em"; - - // A second row is used if necessary to represent the vlist's depth. - var rows = void 0; - if (minPos < 0) { - var depthStrut = makeSpan(["vlist"], []); - depthStrut.style.height = -minPos + "em"; - - // Safari wants the first row to have inline content; otherwise it - // puts the bottom of the *second* row on the baseline. - var topStrut = makeSpan(["vlist-s"], [new _domTree2.default.symbolNode("\u200B")]); - - rows = [makeSpan(["vlist-r"], [vlist, topStrut]), makeSpan(["vlist-r"], [depthStrut])]; - } else { - rows = [makeSpan(["vlist-r"], [vlist])]; - } - - var vtable = makeSpan(["vlist-t"], rows); - if (rows.length === 2) { - vtable.classes.push("vlist-t2"); - } - vtable.height = maxPos; - vtable.depth = -minPos; - return vtable; -}; - -// Converts verb group into body string, dealing with \verb* form -var makeVerb = function makeVerb(group, options) { - // TODO(#892): Make ParseNode type-safe and confirm `group.type` to guarantee - // that `group.value.body` is of type string. - var text = group.value.body; - if (group.value.star) { - text = text.replace(/ /g, "\u2423"); // Open Box - } else { - text = text.replace(/ /g, '\xA0'); // No-Break Space - // (so that, in particular, spaces don't coalesce) - } - return text; -}; - -// A map of spacing functions to their attributes, like size and corresponding -// CSS class -var spacingFunctions = { - "\\qquad": { - size: "2em", - className: "qquad" - }, - "\\quad": { - size: "1em", - className: "quad" - }, - "\\enspace": { - size: "0.5em", - className: "enspace" - }, - "\\;": { - size: "0.277778em", - className: "thickspace" - }, - "\\:": { - size: "0.22222em", - className: "mediumspace" - }, - "\\,": { - size: "0.16667em", - className: "thinspace" - }, - "\\!": { - size: "-0.16667em", - className: "negativethinspace" - } -}; - -/** - * Maps TeX font commands to objects containing: - * - variant: string used for "mathvariant" attribute in buildMathML.js - * - fontName: the "style" parameter to fontMetrics.getCharacterMetrics - */ -// A map between tex font commands an MathML mathvariant attribute values -var fontMap = { - // styles - "mathbf": { - variant: "bold", - fontName: "Main-Bold" - }, - "mathrm": { - variant: "normal", - fontName: "Main-Regular" - }, - "textit": { - variant: "italic", - fontName: "Main-Italic" - }, - - // "mathit" is missing because it requires the use of two fonts: Main-Italic - // and Math-Italic. This is handled by a special case in makeOrd which ends - // up calling mathit. - - // families - "mathbb": { - variant: "double-struck", - fontName: "AMS-Regular" - }, - "mathcal": { - variant: "script", - fontName: "Caligraphic-Regular" - }, - "mathfrak": { - variant: "fraktur", - fontName: "Fraktur-Regular" - }, - "mathscr": { - variant: "script", - fontName: "Script-Regular" - }, - "mathsf": { - variant: "sans-serif", - fontName: "SansSerif-Regular" - }, - "mathtt": { - variant: "monospace", - fontName: "Typewriter-Regular" - } -}; - -exports.default = { - fontMap: fontMap, - makeSymbol: makeSymbol, - mathsym: mathsym, - makeSpan: makeSpan, - makeLineSpan: makeLineSpan, - makeAnchor: makeAnchor, - makeFragment: makeFragment, - makeVList: makeVList, - makeOrd: makeOrd, - makeVerb: makeVerb, - tryCombineChars: tryCombineChars, - prependChildren: prependChildren, - spacingFunctions: spacingFunctions -}; - -},{"./domTree":98,"./fontMetrics":101,"./stretchy":123,"./symbols":125,"./utils":128,"babel-runtime/core-js/get-iterator":3}],92:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.buildGroup = exports.groupTypes = exports.makeNullDelimiter = exports.getTypeOfDomTree = exports.buildExpression = exports.spliceSpaces = undefined; - -var _stringify = require("babel-runtime/core-js/json/stringify"); - -var _stringify2 = _interopRequireDefault(_stringify); - -exports.default = buildHTML; - -var _ParseError = require("./ParseError"); - -var _ParseError2 = _interopRequireDefault(_ParseError); - -var _Style = require("./Style"); - -var _Style2 = _interopRequireDefault(_Style); - -var _buildCommon = require("./buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _delimiter = require("./delimiter"); - -var _delimiter2 = _interopRequireDefault(_delimiter); - -var _domTree = require("./domTree"); - -var _domTree2 = _interopRequireDefault(_domTree); - -var _units = require("./units"); - -var _utils = require("./utils"); - -var _utils2 = _interopRequireDefault(_utils); - -var _stretchy = require("./stretchy"); - -var _stretchy2 = _interopRequireDefault(_stretchy); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * WARNING: New methods on groupTypes should be added to src/functions. - * - * This file does the main work of building a domTree structure from a parse - * tree. The entry point is the `buildHTML` function, which takes a parse tree. - * Then, the buildExpression, buildGroup, and various groupTypes functions are - * called, to produce a final HTML tree. - */ - -var makeSpan = _buildCommon2.default.makeSpan; - -var isSpace = function isSpace(node) { - return node instanceof _domTree2.default.span && node.classes[0] === "mspace"; -}; - -// Binary atoms (first class `mbin`) change into ordinary atoms (`mord`) -// depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6, -// and the text before Rule 19. -var isBin = function isBin(node) { - return node && node.classes[0] === "mbin"; -}; - -var isBinLeftCanceller = function isBinLeftCanceller(node, isRealGroup) { - // TODO: This code assumes that a node's math class is the first element - // of its `classes` array. A later cleanup should ensure this, for - // instance by changing the signature of `makeSpan`. - if (node) { - return _utils2.default.contains(["mbin", "mopen", "mrel", "mop", "mpunct"], node.classes[0]); - } else { - return isRealGroup; - } -}; - -var isBinRightCanceller = function isBinRightCanceller(node, isRealGroup) { - if (node) { - return _utils2.default.contains(["mrel", "mclose", "mpunct"], node.classes[0]); - } else { - return isRealGroup; - } -}; - -/** - * Splice out any spaces from `children` starting at position `i`, and return - * the spliced-out array. Returns null if `children[i]` does not exist or is not - * a space. - */ -var spliceSpaces = exports.spliceSpaces = function spliceSpaces(children, i) { - var j = i; - while (j < children.length && isSpace(children[j])) { - j++; - } - if (j === i) { - return null; - } else { - return children.splice(i, j - i); - } -}; - -/** - * Take a list of nodes, build them in order, and return a list of the built - * nodes. documentFragments are flattened into their contents, so the - * returned list contains no fragments. `isRealGroup` is true if `expression` - * is a real group (no atoms will be added on either side), as opposed to - * a partial group (e.g. one created by \color). - */ -var buildExpression = exports.buildExpression = function buildExpression(expression, options, isRealGroup) { - // Parse expressions into `groups`. - var groups = []; - for (var i = 0; i < expression.length; i++) { - var group = expression[i]; - var output = buildGroup(group, options); - if (output instanceof _domTree2.default.documentFragment) { - Array.prototype.push.apply(groups, output.children); - } else { - groups.push(output); - } - } - // At this point `groups` consists entirely of `symbolNode`s and `span`s. - - // Explicit spaces (e.g., \;, \,) should be ignored with respect to atom - // spacing (e.g., "add thick space between mord and mrel"). Since CSS - // adjacency rules implement atom spacing, spaces should be invisible to - // CSS. So we splice them out of `groups` and into the atoms themselves. - for (var _i = 0; _i < groups.length; _i++) { - var spaces = spliceSpaces(groups, _i); - if (spaces) { - // Splicing of spaces may have removed all remaining groups. - if (_i < groups.length) { - // If there is a following group, move space within it. - if (groups[_i] instanceof _domTree2.default.symbolNode) { - groups[_i] = makeSpan([].concat(groups[_i].classes), [groups[_i]]); - } - _buildCommon2.default.prependChildren(groups[_i], spaces); - } else { - // Otherwise, put any spaces back at the end of the groups. - Array.prototype.push.apply(groups, spaces); - break; - } - } - } - - // Binary operators change to ordinary symbols in some contexts. - for (var _i2 = 0; _i2 < groups.length; _i2++) { - if (isBin(groups[_i2]) && (isBinLeftCanceller(groups[_i2 - 1], isRealGroup) || isBinRightCanceller(groups[_i2 + 1], isRealGroup))) { - groups[_i2].classes[0] = "mord"; - } - } - - // Process \\not commands within the group. - // TODO(kevinb): Handle multiple \\not commands in a row. - // TODO(kevinb): Handle \\not{abc} correctly. The \\not should appear over - // the 'a' instead of the 'c'. - for (var _i3 = 0; _i3 < groups.length; _i3++) { - if (groups[_i3].value === "\u0338" && _i3 + 1 < groups.length) { - var children = groups.slice(_i3, _i3 + 2); - - children[0].classes = ["mainrm"]; - // \u0338 is a combining glyph so we could reorder the children so - // that it comes after the other glyph. This works correctly on - // most browsers except for Safari. Instead we absolutely position - // the glyph and set its right side to match that of the other - // glyph which is visually equivalent. - children[0].style.position = "absolute"; - children[0].style.right = "0"; - - // Copy the classes from the second glyph to the new container. - // This is so it behaves the same as though there was no \\not. - var classes = groups[_i3 + 1].classes; - var container = makeSpan(classes, children); - - // LaTeX adds a space between ords separated by a \\not. - if (classes.indexOf("mord") !== -1) { - // \glue(\thickmuskip) 2.77771 plus 2.77771 - container.style.paddingLeft = "0.277771em"; - } - - // Ensure that the \u0338 is positioned relative to the container. - container.style.position = "relative"; - groups.splice(_i3, 2, container); - } - } - - return groups; -}; - -// Return math atom class (mclass) of a domTree. -var getTypeOfDomTree = exports.getTypeOfDomTree = function getTypeOfDomTree(node) { - if (node instanceof _domTree2.default.documentFragment) { - if (node.children.length) { - return getTypeOfDomTree(node.children[node.children.length - 1]); - } - } else { - if (_utils2.default.contains(["mord", "mop", "mbin", "mrel", "mopen", "mclose", "mpunct", "minner"], node.classes[0])) { - return node.classes[0]; - } - } - return null; -}; - -/** - * Sometimes, groups perform special rules when they have superscripts or - * subscripts attached to them. This function lets the `supsub` group know that - * its inner element should handle the superscripts and subscripts instead of - * handling them itself. - */ -var shouldHandleSupSub = function shouldHandleSupSub(group, options) { - if (!group.value.base) { - return false; - } else { - var base = group.value.base; - if (base.type === "op") { - // Operators handle supsubs differently when they have limits - // (e.g. `\displaystyle\sum_2^3`) - return base.value.limits && (options.style.size === _Style2.default.DISPLAY.size || base.value.alwaysHandleSupSub); - } else if (base.type === "accent") { - return isCharacterBox(base.value.base); - } else if (base.type === "horizBrace") { - var isSup = group.value.sub ? false : true; - return isSup === base.value.isOver; - } else { - return null; - } - } -}; - -/** - * Sometimes we want to pull out the innermost element of a group. In most - * cases, this will just be the group itself, but when ordgroups and colors have - * a single element, we want to pull that out. - */ -var getBaseElem = function getBaseElem(group) { - if (!group) { - return false; - } else if (group.type === "ordgroup") { - if (group.value.length === 1) { - return getBaseElem(group.value[0]); - } else { - return group; - } - } else if (group.type === "color") { - if (group.value.value.length === 1) { - return getBaseElem(group.value.value[0]); - } else { - return group; - } - } else if (group.type === "font") { - return getBaseElem(group.value.body); - } else { - return group; - } -}; - -/** - * TeXbook algorithms often reference "character boxes", which are simply groups - * with a single character in them. To decide if something is a character box, - * we find its innermost group, and see if it is a single character. - */ -var isCharacterBox = function isCharacterBox(group) { - var baseElem = getBaseElem(group); - - // These are all they types of groups which hold single characters - return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "bin" || baseElem.type === "rel" || baseElem.type === "inner" || baseElem.type === "open" || baseElem.type === "close" || baseElem.type === "punct"; -}; - -var makeNullDelimiter = exports.makeNullDelimiter = function makeNullDelimiter(options, classes) { - var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses()); - return makeSpan(classes.concat(moreClasses)); -}; - -/** - * This is a map of group types to the function used to handle that type. - * Simpler types come at the beginning, while complicated types come afterwards. - */ -var groupTypes = exports.groupTypes = {}; - -groupTypes.mathord = function (group, options) { - return _buildCommon2.default.makeOrd(group, options, "mathord"); -}; - -groupTypes.textord = function (group, options) { - return _buildCommon2.default.makeOrd(group, options, "textord"); -}; - -groupTypes.bin = function (group, options) { - return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mbin"]); -}; - -groupTypes.rel = function (group, options) { - return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mrel"]); -}; - -groupTypes.open = function (group, options) { - return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mopen"]); -}; - -groupTypes.close = function (group, options) { - return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mclose"]); -}; - -groupTypes.inner = function (group, options) { - return _buildCommon2.default.mathsym(group.value, group.mode, options, ["minner"]); -}; - -groupTypes.punct = function (group, options) { - return _buildCommon2.default.mathsym(group.value, group.mode, options, ["mpunct"]); -}; - -groupTypes.ordgroup = function (group, options) { - return makeSpan(["mord"], buildExpression(group.value, options, true), options); -}; - -groupTypes.supsub = function (group, options) { - // Superscript and subscripts are handled in the TeXbook on page - // 445-446, rules 18(a-f). - - // Here is where we defer to the inner group if it should handle - // superscripts and subscripts itself. - if (shouldHandleSupSub(group, options)) { - return groupTypes[group.value.base.type](group, options); - } - - var base = buildGroup(group.value.base, options); - var supm = void 0; - var subm = void 0; - - var metrics = options.fontMetrics(); - var newOptions = void 0; - - // Rule 18a - var supShift = 0; - var subShift = 0; - - if (group.value.sup) { - newOptions = options.havingStyle(options.style.sup()); - supm = buildGroup(group.value.sup, newOptions, options); - if (!isCharacterBox(group.value.base)) { - supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier; - } - } - - if (group.value.sub) { - newOptions = options.havingStyle(options.style.sub()); - subm = buildGroup(group.value.sub, newOptions, options); - if (!isCharacterBox(group.value.base)) { - subShift = base.depth + newOptions.fontMetrics().subDrop * newOptions.sizeMultiplier / options.sizeMultiplier; - } - } - - // Rule 18c - var minSupShift = void 0; - if (options.style === _Style2.default.DISPLAY) { - minSupShift = metrics.sup1; - } else if (options.style.cramped) { - minSupShift = metrics.sup3; - } else { - minSupShift = metrics.sup2; - } - - // scriptspace is a font-size-independent size, so scale it - // appropriately - var multiplier = options.sizeMultiplier; - var scriptspace = 0.5 / metrics.ptPerEm / multiplier + "em"; - - var supsub = void 0; - if (!group.value.sup) { - // Rule 18b - subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight); - - var vlistElem = [{ type: "elem", elem: subm, marginRight: scriptspace }]; - // Subscripts shouldn't be shifted by the base's italic correction. - // Account for that by shifting the subscript back the appropriate - // amount. Note we only do this when the base is a single symbol. - if (base instanceof _domTree2.default.symbolNode) { - vlistElem[0].marginLeft = -base.italic + "em"; - } - - supsub = _buildCommon2.default.makeVList({ - positionType: "shift", - positionData: subShift, - children: vlistElem - }, options); - } else if (!group.value.sub) { - // Rule 18c, d - supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); - - supsub = _buildCommon2.default.makeVList({ - positionType: "shift", - positionData: -supShift, - children: [{ type: "elem", elem: supm, marginRight: scriptspace }] - }, options); - } else { - supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); - subShift = Math.max(subShift, metrics.sub2); - - var ruleWidth = metrics.defaultRuleThickness; - - // Rule 18e - if (supShift - supm.depth - (subm.height - subShift) < 4 * ruleWidth) { - subShift = 4 * ruleWidth - (supShift - supm.depth) + subm.height; - var psi = 0.8 * metrics.xHeight - (supShift - supm.depth); - if (psi > 0) { - supShift += psi; - subShift -= psi; - } - } - - var _vlistElem = [{ type: "elem", elem: subm, shift: subShift, marginRight: scriptspace }, { type: "elem", elem: supm, shift: -supShift, marginRight: scriptspace }]; - // See comment above about subscripts not being shifted - if (base instanceof _domTree2.default.symbolNode) { - _vlistElem[0].marginLeft = -base.italic + "em"; - } - - supsub = _buildCommon2.default.makeVList({ - positionType: "individualShift", - children: _vlistElem - }, options); - } - - // We ensure to wrap the supsub vlist in a span.msupsub to reset text-align - var mclass = getTypeOfDomTree(base) || "mord"; - return makeSpan([mclass], [base, makeSpan(["msupsub"], [supsub])], options); -}; - -groupTypes.spacing = function (group, options) { - if (group.value === "\\ " || group.value === "\\space" || group.value === " " || group.value === "~") { - // Spaces are generated by adding an actual space. Each of these - // things has an entry in the symbols table, so these will be turned - // into appropriate outputs. - if (group.mode === "text") { - return _buildCommon2.default.makeOrd(group, options, "textord"); - } else { - return makeSpan(["mspace"], [_buildCommon2.default.mathsym(group.value, group.mode, options)], options); - } - } else { - // Other kinds of spaces are of arbitrary width. We use CSS to - // generate these. - return makeSpan(["mspace", _buildCommon2.default.spacingFunctions[group.value].className], [], options); - } -}; - -groupTypes.sqrt = function (group, options) { - // Square roots are handled in the TeXbook pg. 443, Rule 11. - - // First, we do the same steps as in overline to build the inner group - // and line - var inner = buildGroup(group.value.body, options.havingCrampedStyle()); - if (inner.height === 0) { - // Render a small surd. - inner.height = options.fontMetrics().xHeight; - } - - // Some groups can return document fragments. Handle those by wrapping - // them in a span. - if (inner instanceof _domTree2.default.documentFragment) { - inner = makeSpan([], [inner], options); - } - - // Calculate the minimum size for the \surd delimiter - var metrics = options.fontMetrics(); - var theta = metrics.defaultRuleThickness; - - var phi = theta; - if (options.style.id < _Style2.default.TEXT.id) { - phi = options.fontMetrics().xHeight; - } - - // Calculate the clearance between the body and line - var lineClearance = theta + phi / 4; - - var minDelimiterHeight = (inner.height + inner.depth + lineClearance + theta) * options.sizeMultiplier; - - // Create a sqrt SVG of the required minimum size - - var _delimiter$sqrtImage = _delimiter2.default.sqrtImage(minDelimiterHeight, options), - img = _delimiter$sqrtImage.span, - ruleWidth = _delimiter$sqrtImage.ruleWidth; - - var delimDepth = img.height - ruleWidth; - - // Adjust the clearance based on the delimiter size - if (delimDepth > inner.height + inner.depth + lineClearance) { - lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2; - } - - // Shift the sqrt image - var imgShift = img.height - inner.height - lineClearance - ruleWidth; - - inner.style.paddingLeft = img.advanceWidth + "em"; - - // Overlay the image and the argument. - var body = _buildCommon2.default.makeVList({ - positionType: "firstBaseline", - children: [{ type: "elem", elem: inner }, { type: "kern", size: -(inner.height + imgShift) }, { type: "elem", elem: img }, { type: "kern", size: ruleWidth }] - }, options); - body.children[0].children[0].classes.push("svg-align"); - - if (!group.value.index) { - return makeSpan(["mord", "sqrt"], [body], options); - } else { - // Handle the optional root index - - // The index is always in scriptscript style - var newOptions = options.havingStyle(_Style2.default.SCRIPTSCRIPT); - var rootm = buildGroup(group.value.index, newOptions, options); - - // The amount the index is shifted by. This is taken from the TeX - // source, in the definition of `\r@@t`. - var toShift = 0.6 * (body.height - body.depth); - - // Build a VList with the superscript shifted up correctly - var rootVList = _buildCommon2.default.makeVList({ - positionType: "shift", - positionData: -toShift, - children: [{ type: "elem", elem: rootm }] - }, options); - // Add a class surrounding it so we can add on the appropriate - // kerning - var rootVListWrap = makeSpan(["root"], [rootVList]); - - return makeSpan(["mord", "sqrt"], [rootVListWrap, body], options); - } -}; - -function sizingGroup(value, options, baseOptions) { - var inner = buildExpression(value, options, false); - var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; - - // Add size-resetting classes to the inner list and set maxFontSize - // manually. Handle nested size changes. - for (var i = 0; i < inner.length; i++) { - var pos = _utils2.default.indexOf(inner[i].classes, "sizing"); - if (pos < 0) { - Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions)); - } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) { - // This is a nested size change: e.g., inner[i] is the "b" in - // `\Huge a \small b`. Override the old size (the `reset-` class) - // but not the new size. - inner[i].classes[pos + 1] = "reset-size" + baseOptions.size; - } - - inner[i].height *= multiplier; - inner[i].depth *= multiplier; - } - - return _buildCommon2.default.makeFragment(inner); -} - -groupTypes.sizing = function (group, options) { - // Handle sizing operators like \Huge. Real TeX doesn't actually allow - // these functions inside of math expressions, so we do some special - // handling. - var newOptions = options.havingSize(group.value.size); - return sizingGroup(group.value.value, newOptions, options); -}; - -groupTypes.styling = function (group, options) { - // Style changes are handled in the TeXbook on pg. 442, Rule 3. - - // Figure out what style we're changing to. - var styleMap = { - "display": _Style2.default.DISPLAY, - "text": _Style2.default.TEXT, - "script": _Style2.default.SCRIPT, - "scriptscript": _Style2.default.SCRIPTSCRIPT - }; - - var newStyle = styleMap[group.value.style]; - var newOptions = options.havingStyle(newStyle); - return sizingGroup(group.value.value, newOptions, options); -}; - -groupTypes.font = function (group, options) { - var font = group.value.font; - return buildGroup(group.value.body, options.withFont(font)); -}; - -groupTypes.verb = function (group, options) { - var text = _buildCommon2.default.makeVerb(group, options); - var body = []; - // \verb enters text mode and therefore is sized like \textstyle - var newOptions = options.havingStyle(options.style.text()); - for (var i = 0; i < text.length; i++) { - if (text[i] === '\xA0') { - // spaces appear as nonbreaking space - // The space character isn't in the Typewriter-Regular font, - // so we implement it as a kern of the same size as a character. - // 0.525 is the width of a texttt character in LaTeX. - // It automatically gets scaled by the font size. - var rule = makeSpan(["mord", "rule"], [], newOptions); - rule.style.marginLeft = "0.525em"; - body.push(rule); - } else { - body.push(_buildCommon2.default.makeSymbol(text[i], "Typewriter-Regular", group.mode, newOptions, ["mathtt"])); - } - } - _buildCommon2.default.tryCombineChars(body); - return makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), body, newOptions); -}; - -groupTypes.accent = function (group, options) { - // Accents are handled in the TeXbook pg. 443, rule 12. - var base = group.value.base; - - var supsubGroup = void 0; - if (group.type === "supsub") { - // If our base is a character box, and we have superscripts and - // subscripts, the supsub will defer to us. In particular, we want - // to attach the superscripts and subscripts to the inner body (so - // that the position of the superscripts and subscripts won't be - // affected by the height of the accent). We accomplish this by - // sticking the base of the accent into the base of the supsub, and - // rendering that, while keeping track of where the accent is. - - // The supsub group is the group that was passed in - var supsub = group; - // The real accent group is the base of the supsub group - group = supsub.value.base; - // The character box is the base of the accent group - base = group.value.base; - // Stick the character box into the base of the supsub group - supsub.value.base = base; - - // Rerender the supsub group with its new base, and store that - // result. - supsubGroup = buildGroup(supsub, options); - } - - // Build the base group - var body = buildGroup(base, options.havingCrampedStyle()); - - // Does the accent need to shift for the skew of a character? - var mustShift = group.value.isShifty && isCharacterBox(base); - - // Calculate the skew of the accent. This is based on the line "If the - // nucleus is not a single character, let s = 0; otherwise set s to the - // kern amount for the nucleus followed by the \skewchar of its font." - // Note that our skew metrics are just the kern between each character - // and the skewchar. - var skew = 0; - if (mustShift) { - // If the base is a character box, then we want the skew of the - // innermost character. To do that, we find the innermost character: - var baseChar = getBaseElem(base); - // Then, we render its group to get the symbol inside it - var baseGroup = buildGroup(baseChar, options.havingCrampedStyle()); - // Finally, we pull the skew off of the symbol. - skew = baseGroup.skew; - // Note that we now throw away baseGroup, because the layers we - // removed with getBaseElem might contain things like \color which - // we can't get rid of. - // TODO(emily): Find a better way to get the skew - } - - // calculate the amount of space between the body and the accent - var clearance = Math.min(body.height, options.fontMetrics().xHeight); - - // Build the accent - var accentBody = void 0; - if (!group.value.isStretchy) { - var accent = _buildCommon2.default.makeSymbol(group.value.label, "Main-Regular", group.mode, options); - // Remove the italic correction of the accent, because it only serves to - // shift the accent over to a place we don't want. - accent.italic = 0; - - // The \vec character that the fonts use is a combining character, and - // thus shows up much too far to the left. To account for this, we add a - // specific class which shifts the accent over to where we want it. - // TODO(emily): Fix this in a better way, like by changing the font - // Similarly, text accent \H is a combining character and - // requires a different adjustment. - var accentClass = null; - if (group.value.label === "\\vec") { - accentClass = "accent-vec"; - } else if (group.value.label === '\\H') { - accentClass = "accent-hungarian"; - } - - accentBody = makeSpan([], [accent]); - accentBody = makeSpan(["accent-body", accentClass], [accentBody]); - - // Shift the accent over by the skew. Note we shift by twice the skew - // because we are centering the accent, so by adding 2*skew to the left, - // we shift it to the right by 1*skew. - accentBody.style.marginLeft = 2 * skew + "em"; - - accentBody = _buildCommon2.default.makeVList({ - positionType: "firstBaseline", - children: [{ type: "elem", elem: body }, { type: "kern", size: -clearance }, { type: "elem", elem: accentBody }] - }, options); - } else { - accentBody = _stretchy2.default.svgSpan(group, options); - - accentBody = _buildCommon2.default.makeVList({ - positionType: "firstBaseline", - children: [{ type: "elem", elem: body }, { type: "elem", elem: accentBody }] - }, options); - - var styleSpan = accentBody.children[0].children[0].children[1]; - styleSpan.classes.push("svg-align"); // text-align: left; - if (skew > 0) { - // Shorten the accent and nudge it to the right. - styleSpan.style.width = "calc(100% - " + 2 * skew + "em)"; - styleSpan.style.marginLeft = 2 * skew + "em"; - } - } - - var accentWrap = makeSpan(["mord", "accent"], [accentBody], options); - - if (supsubGroup) { - // Here, we replace the "base" child of the supsub with our newly - // generated accent. - supsubGroup.children[0] = accentWrap; - - // Since we don't rerun the height calculation after replacing the - // accent, we manually recalculate height. - supsubGroup.height = Math.max(accentWrap.height, supsubGroup.height); - - // Accents should always be ords, even when their innards are not. - supsubGroup.classes[0] = "mord"; - - return supsubGroup; - } else { - return accentWrap; - } -}; - -groupTypes.horizBrace = function (group, options) { - var style = options.style; - - var hasSupSub = group.type === "supsub"; - var supSubGroup = void 0; - var newOptions = void 0; - if (hasSupSub) { - // Ref: LaTeX source2e: }}}}\limits} - // i.e. LaTeX treats the brace similar to an op and passes it - // with \limits, so we need to assign supsub style. - if (group.value.sup) { - newOptions = options.havingStyle(style.sup()); - supSubGroup = buildGroup(group.value.sup, newOptions, options); - } else { - newOptions = options.havingStyle(style.sub()); - supSubGroup = buildGroup(group.value.sub, newOptions, options); - } - group = group.value.base; - } - - // Build the base group - var body = buildGroup(group.value.base, options.havingBaseStyle(_Style2.default.DISPLAY)); - - // Create the stretchy element - var braceBody = _stretchy2.default.svgSpan(group, options); - - // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓ - // This first vlist contains the subject matter and the brace: equation - var vlist = void 0; - if (group.value.isOver) { - vlist = _buildCommon2.default.makeVList({ - positionType: "firstBaseline", - children: [{ type: "elem", elem: body }, { type: "kern", size: 0.1 }, { type: "elem", elem: braceBody }] - }, options); - vlist.children[0].children[0].children[1].classes.push("svg-align"); - } else { - vlist = _buildCommon2.default.makeVList({ - positionType: "bottom", - positionData: body.depth + 0.1 + braceBody.height, - children: [{ type: "elem", elem: braceBody }, { type: "kern", size: 0.1 }, { type: "elem", elem: body }] - }, options); - vlist.children[0].children[0].children[0].classes.push("svg-align"); - } - - if (hasSupSub) { - // In order to write the supsub, wrap the first vlist in another vlist: - // They can't all go in the same vlist, because the note might be wider - // than the equation. We want the equation to control the brace width. - - // note long note long note - // ┏━━━━━━━━┓ or ┏━━━┓ not ┏━━━━━━━━━┓ - // equation eqn eqn - - var vSpan = makeSpan(["mord", group.value.isOver ? "mover" : "munder"], [vlist], options); - - if (group.value.isOver) { - vlist = _buildCommon2.default.makeVList({ - positionType: "firstBaseline", - children: [{ type: "elem", elem: vSpan }, { type: "kern", size: 0.2 }, { type: "elem", elem: supSubGroup }] - }, options); - } else { - vlist = _buildCommon2.default.makeVList({ - positionType: "bottom", - positionData: vSpan.depth + 0.2 + supSubGroup.height, - children: [{ type: "elem", elem: supSubGroup }, { type: "kern", size: 0.2 }, { type: "elem", elem: vSpan }] - }, options); - } - } - - return makeSpan(["mord", group.value.isOver ? "mover" : "munder"], [vlist], options); -}; - -groupTypes.accentUnder = function (group, options) { - // Treat under accents much like underlines. - var innerGroup = buildGroup(group.value.base, options); - - var accentBody = _stretchy2.default.svgSpan(group, options); - var kern = /tilde/.test(group.value.label) ? 0.12 : 0; - - // Generate the vlist, with the appropriate kerns - var vlist = _buildCommon2.default.makeVList({ - positionType: "bottom", - positionData: accentBody.height + kern, - children: [{ type: "elem", elem: accentBody }, { type: "kern", size: kern }, { type: "elem", elem: innerGroup }] - }, options); - - vlist.children[0].children[0].children[0].classes.push("svg-align"); - - return makeSpan(["mord", "accentunder"], [vlist], options); -}; - -groupTypes.enclose = function (group, options) { - // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox - var inner = buildGroup(group.value.body, options); - - var label = group.value.label.substr(1); - var scale = options.sizeMultiplier; - var img = void 0; - var imgShift = 0; - var isColorbox = /color/.test(label); - - if (label === "sout") { - img = makeSpan(["stretchy", "sout"]); - img.height = options.fontMetrics().defaultRuleThickness / scale; - imgShift = -0.5 * options.fontMetrics().xHeight; - } else { - // Add horizontal padding - inner.classes.push(/cancel/.test(label) ? "cancel-pad" : "boxpad"); - - // Add vertical padding - var vertPad = 0; - // ref: LaTeX source2e: \fboxsep = 3pt; \fboxrule = .4pt - // ref: cancel package: \advance\totalheight2\p@ % "+2" - if (/box/.test(label)) { - vertPad = label === "colorbox" ? 0.3 : 0.34; - } else { - vertPad = isCharacterBox(group.value.body) ? 0.2 : 0; - } - - img = _stretchy2.default.encloseSpan(inner, label, vertPad, options); - imgShift = inner.depth + vertPad; - - if (isColorbox) { - img.style.backgroundColor = group.value.backgroundColor.value; - if (label === "fcolorbox") { - img.style.borderColor = group.value.borderColor.value; - } - } - } - - var vlist = void 0; - if (isColorbox) { - vlist = _buildCommon2.default.makeVList({ - positionType: "individualShift", - children: [ - // Put the color background behind inner; - { type: "elem", elem: img, shift: imgShift }, { type: "elem", elem: inner, shift: 0 }] - }, options); - } else { - vlist = _buildCommon2.default.makeVList({ - positionType: "individualShift", - children: [ - // Write the \cancel stroke on top of inner. - { type: "elem", elem: inner, shift: 0 }, { type: "elem", elem: img, shift: imgShift }] - }, options); - } - - if (/cancel/.test(label)) { - vlist.children[0].children[0].children[1].classes.push("svg-align"); - - // cancel does not create horiz space for its line extension. - // That is, not when adjacent to a mord. - return makeSpan(["mord", "cancel-lap"], [vlist], options); - } else { - return makeSpan(["mord"], [vlist], options); - } -}; - -groupTypes.xArrow = function (group, options) { - var style = options.style; - - // Build the argument groups in the appropriate style. - // Ref: amsmath.dtx: \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}% - - var newOptions = options.havingStyle(style.sup()); - var upperGroup = buildGroup(group.value.body, newOptions, options); - upperGroup.classes.push("x-arrow-pad"); - - var lowerGroup = void 0; - if (group.value.below) { - // Build the lower group - newOptions = options.havingStyle(style.sub()); - lowerGroup = buildGroup(group.value.below, newOptions, options); - lowerGroup.classes.push("x-arrow-pad"); - } - - var arrowBody = _stretchy2.default.svgSpan(group, options); - - // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0. - // The point we want on the math axis is at 0.5 * arrowBody.height. - var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; - // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi - var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; - - // Generate the vlist - var vlist = void 0; - if (group.value.below) { - var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111; - vlist = _buildCommon2.default.makeVList({ - positionType: "individualShift", - children: [{ type: "elem", elem: upperGroup, shift: upperShift }, { type: "elem", elem: arrowBody, shift: arrowShift }, { type: "elem", elem: lowerGroup, shift: lowerShift }] - }, options); - } else { - vlist = _buildCommon2.default.makeVList({ - positionType: "individualShift", - children: [{ type: "elem", elem: upperGroup, shift: upperShift }, { type: "elem", elem: arrowBody, shift: arrowShift }] - }, options); - } - - vlist.children[0].children[0].children[1].classes.push("svg-align"); - - return makeSpan(["mrel", "x-arrow"], [vlist], options); -}; - -groupTypes.mclass = function (group, options) { - var elements = buildExpression(group.value.value, options, true); - - return makeSpan([group.value.mclass], elements, options); -}; - -groupTypes.raisebox = function (group, options) { - var body = groupTypes.sizing({ value: { - value: [{ - type: "text", - value: { - body: group.value.value, - font: "mathrm" // simulate \textrm - } - }], - size: 6 // simulate \normalsize - } }, options); - var dy = (0, _units.calculateSize)(group.value.dy.value, options); - return _buildCommon2.default.makeVList({ - positionType: "shift", - positionData: -dy, - children: [{ type: "elem", elem: body }] - }, options); -}; - -/** - * buildGroup is the function that takes a group and calls the correct groupType - * function for it. It also handles the interaction of size and style changes - * between parents and children. - */ -var buildGroup = exports.buildGroup = function buildGroup(group, options, baseOptions) { - if (!group) { - return makeSpan(); - } - - if (groupTypes[group.type]) { - // Call the groupTypes function - var groupNode = groupTypes[group.type](group, options); - - // If the size changed between the parent and the current group, account - // for that size difference. - if (baseOptions && options.size !== baseOptions.size) { - groupNode = makeSpan(options.sizingClasses(baseOptions), [groupNode], options); - - var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; - - groupNode.height *= multiplier; - groupNode.depth *= multiplier; - } - - return groupNode; - } else { - throw new _ParseError2.default("Got group of unknown type: '" + group.type + "'"); - } -}; - -/** - * Take an entire parse tree, and build it into an appropriate set of HTML - * nodes. - */ -function buildHTML(tree, options) { - // buildExpression is destructive, so we need to make a clone - // of the incoming tree so that it isn't accidentally changed - tree = JSON.parse((0, _stringify2.default)(tree)); - - // Build the expression contained in the tree - var expression = buildExpression(tree, options, true); - var body = makeSpan(["base"], expression, options); - - // Add struts, which ensure that the top of the HTML element falls at the - // height of the expression, and the bottom of the HTML element falls at the - // depth of the expression. - var topStrut = makeSpan(["strut"]); - var bottomStrut = makeSpan(["strut", "bottom"]); - - topStrut.style.height = body.height + "em"; - bottomStrut.style.height = body.height + body.depth + "em"; - // We'd like to use `vertical-align: top` but in IE 9 this lowers the - // baseline of the box to the bottom of this strut (instead staying in the - // normal place) so we use an absolute value for vertical-align instead - bottomStrut.style.verticalAlign = -body.depth + "em"; - - // Wrap the struts and body together - var htmlNode = makeSpan(["katex-html"], [topStrut, bottomStrut, body]); - - htmlNode.setAttribute("aria-hidden", "true"); - - return htmlNode; -} - -},{"./ParseError":84,"./Style":89,"./buildCommon":91,"./delimiter":97,"./domTree":98,"./stretchy":123,"./units":127,"./utils":128,"babel-runtime/core-js/json/stringify":5}],93:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.buildGroup = exports.buildExpression = exports.groupTypes = exports.makeText = undefined; -exports.default = buildMathML; - -var _buildCommon = require("./buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _fontMetrics = require("./fontMetrics"); - -var _fontMetrics2 = _interopRequireDefault(_fontMetrics); - -var _mathMLTree = require("./mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _ParseError = require("./ParseError"); - -var _ParseError2 = _interopRequireDefault(_ParseError); - -var _Style = require("./Style"); - -var _Style2 = _interopRequireDefault(_Style); - -var _symbols = require("./symbols"); - -var _symbols2 = _interopRequireDefault(_symbols); - -var _utils = require("./utils"); - -var _utils2 = _interopRequireDefault(_utils); - -var _stretchy = require("./stretchy"); - -var _stretchy2 = _interopRequireDefault(_stretchy); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Takes a symbol and converts it into a MathML text node after performing - * optional replacement from symbols.js. - */ -/** - * WARNING: New methods on groupTypes should be added to src/functions. - * - * This file converts a parse tree into a cooresponding MathML tree. The main - * entry point is the `buildMathML` function, which takes a parse tree from the - * parser. - */ - -var makeText = exports.makeText = function makeText(text, mode) { - if (_symbols2.default[mode][text] && _symbols2.default[mode][text].replace) { - text = _symbols2.default[mode][text].replace; - } - - return new _mathMLTree2.default.TextNode(text); -}; - -/** - * Returns the math variant as a string or null if none is required. - */ -var getVariant = function getVariant(group, options) { - var font = options.font; - if (!font) { - return null; - } - - var mode = group.mode; - if (font === "mathit") { - return "italic"; - } - - var value = group.value; - if (_utils2.default.contains(["\\imath", "\\jmath"], value)) { - return null; - } - - if (_symbols2.default[mode][value] && _symbols2.default[mode][value].replace) { - value = _symbols2.default[mode][value].replace; - } - - var fontName = _buildCommon2.default.fontMap[font].fontName; - if (_fontMetrics2.default.getCharacterMetrics(value, fontName)) { - return _buildCommon2.default.fontMap[options.font].variant; - } - - return null; -}; - -/** - * Functions for handling the different types of groups found in the parse - * tree. Each function should take a parse group and return a MathML node. - */ -var groupTypes = exports.groupTypes = {}; - -var defaultVariant = { - "mi": "italic", - "mn": "normal", - "mtext": "normal" -}; - -groupTypes.mathord = function (group, options) { - var node = new _mathMLTree2.default.MathNode("mi", [makeText(group.value, group.mode)]); - - var variant = getVariant(group, options) || "italic"; - if (variant !== defaultVariant[node.type]) { - node.setAttribute("mathvariant", variant); - } - return node; -}; - -groupTypes.textord = function (group, options) { - var text = makeText(group.value, group.mode); - - var variant = getVariant(group, options) || "normal"; - - var node = void 0; - if (group.mode === 'text') { - node = new _mathMLTree2.default.MathNode("mtext", [text]); - } else if (/[0-9]/.test(group.value)) { - // TODO(kevinb) merge adjacent nodes - // do it as a post processing step - node = new _mathMLTree2.default.MathNode("mn", [text]); - } else if (group.value === "\\prime") { - node = new _mathMLTree2.default.MathNode("mo", [text]); - } else { - node = new _mathMLTree2.default.MathNode("mi", [text]); - } - if (variant !== defaultVariant[node.type]) { - node.setAttribute("mathvariant", variant); - } - - return node; -}; - -groupTypes.bin = function (group) { - var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]); - - return node; -}; - -groupTypes.rel = function (group) { - var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]); - - return node; -}; - -groupTypes.open = function (group) { - var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]); - - return node; -}; - -groupTypes.close = function (group) { - var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]); - - return node; -}; - -groupTypes.inner = function (group) { - var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]); - - return node; -}; - -groupTypes.punct = function (group) { - var node = new _mathMLTree2.default.MathNode("mo", [makeText(group.value, group.mode)]); - - node.setAttribute("separator", "true"); - - return node; -}; - -groupTypes.ordgroup = function (group, options) { - var inner = buildExpression(group.value, options); - - var node = new _mathMLTree2.default.MathNode("mrow", inner); - - return node; -}; - -groupTypes.supsub = function (group, options) { - // Is the inner group a relevant horizonal brace? - var isBrace = false; - var isOver = void 0; - var isSup = void 0; - if (group.value.base) { - if (group.value.base.value.type === "horizBrace") { - isSup = group.value.sup ? true : false; - if (isSup === group.value.base.value.isOver) { - isBrace = true; - isOver = group.value.base.value.isOver; - } - } - } - - var removeUnnecessaryRow = true; - var children = [buildGroup(group.value.base, options, removeUnnecessaryRow)]; - - if (group.value.sub) { - children.push(buildGroup(group.value.sub, options, removeUnnecessaryRow)); - } - - if (group.value.sup) { - children.push(buildGroup(group.value.sup, options, removeUnnecessaryRow)); - } - - var nodeType = void 0; - if (isBrace) { - nodeType = isOver ? "mover" : "munder"; - } else if (!group.value.sub) { - nodeType = "msup"; - } else if (!group.value.sup) { - nodeType = "msub"; - } else { - var base = group.value.base; - if (base && base.value.limits && options.style === _Style2.default.DISPLAY) { - nodeType = "munderover"; - } else { - nodeType = "msubsup"; - } - } - - var node = new _mathMLTree2.default.MathNode(nodeType, children); - - return node; -}; - -groupTypes.sqrt = function (group, options) { - var node = void 0; - if (group.value.index) { - node = new _mathMLTree2.default.MathNode("mroot", [buildGroup(group.value.body, options), buildGroup(group.value.index, options)]); - } else { - node = new _mathMLTree2.default.MathNode("msqrt", [buildGroup(group.value.body, options)]); - } - - return node; -}; - -groupTypes.accent = function (group, options) { - var accentNode = void 0; - if (group.value.isStretchy) { - accentNode = _stretchy2.default.mathMLnode(group.value.label); - } else { - accentNode = new _mathMLTree2.default.MathNode("mo", [makeText(group.value.label, group.mode)]); - } - - var node = new _mathMLTree2.default.MathNode("mover", [buildGroup(group.value.base, options), accentNode]); - - node.setAttribute("accent", "true"); - - return node; -}; - -groupTypes.spacing = function (group) { - var node = void 0; - - if (group.value === "\\ " || group.value === "\\space" || group.value === " " || group.value === "~") { - node = new _mathMLTree2.default.MathNode("mtext", [new _mathMLTree2.default.TextNode("\xA0")]); - } else { - node = new _mathMLTree2.default.MathNode("mspace"); - - node.setAttribute("width", _buildCommon2.default.spacingFunctions[group.value].size); - } - - return node; -}; - -groupTypes.font = function (group, options) { - var font = group.value.font; - return buildGroup(group.value.body, options.withFont(font)); -}; - -groupTypes.styling = function (group, options) { - // Figure out what style we're changing to. - // TODO(kevinb): dedupe this with buildHTML.js - // This will be easier of handling of styling nodes is in the same file. - var styleMap = { - "display": _Style2.default.DISPLAY, - "text": _Style2.default.TEXT, - "script": _Style2.default.SCRIPT, - "scriptscript": _Style2.default.SCRIPTSCRIPT - }; - - var newStyle = styleMap[group.value.style]; - var newOptions = options.havingStyle(newStyle); - - var inner = buildExpression(group.value.value, newOptions); - - var node = new _mathMLTree2.default.MathNode("mstyle", inner); - - var styleAttributes = { - "display": ["0", "true"], - "text": ["0", "false"], - "script": ["1", "false"], - "scriptscript": ["2", "false"] - }; - - var attr = styleAttributes[group.value.style]; - - node.setAttribute("scriptlevel", attr[0]); - node.setAttribute("displaystyle", attr[1]); - - return node; -}; - -groupTypes.sizing = function (group, options) { - var newOptions = options.havingSize(group.value.size); - var inner = buildExpression(group.value.value, newOptions); - - var node = new _mathMLTree2.default.MathNode("mstyle", inner); - - // TODO(emily): This doesn't produce the correct size for nested size - // changes, because we don't keep state of what style we're currently - // in, so we can't reset the size to normal before changing it. Now - // that we're passing an options parameter we should be able to fix - // this. - node.setAttribute("mathsize", newOptions.sizeMultiplier + "em"); - - return node; -}; - -groupTypes.verb = function (group, options) { - var text = new _mathMLTree2.default.TextNode(_buildCommon2.default.makeVerb(group, options)); - var node = new _mathMLTree2.default.MathNode("mtext", [text]); - node.setAttribute("mathvariant", _buildCommon2.default.fontMap["mathtt"].variant); - return node; -}; - -groupTypes.accentUnder = function (group, options) { - var accentNode = _stretchy2.default.mathMLnode(group.value.label); - var node = new _mathMLTree2.default.MathNode("munder", [buildGroup(group.value.body, options), accentNode]); - node.setAttribute("accentunder", "true"); - return node; -}; - -groupTypes.enclose = function (group, options) { - var node = new _mathMLTree2.default.MathNode("menclose", [buildGroup(group.value.body, options)]); - switch (group.value.label) { - case "\\cancel": - node.setAttribute("notation", "updiagonalstrike"); - break; - case "\\bcancel": - node.setAttribute("notation", "downdiagonalstrike"); - break; - case "\\sout": - node.setAttribute("notation", "horizontalstrike"); - break; - case "\\fbox": - node.setAttribute("notation", "box"); - break; - case "\\colorbox": - node.setAttribute("mathbackground", group.value.backgroundColor.value); - break; - case "\\fcolorbox": - node.setAttribute("mathbackground", group.value.backgroundColor.value); - // TODO(ron): I don't know any way to set the border color. - node.setAttribute("notation", "box"); - break; - default: - // xcancel - node.setAttribute("notation", "updiagonalstrike downdiagonalstrike"); - } - return node; -}; - -groupTypes.horizBrace = function (group, options) { - var accentNode = _stretchy2.default.mathMLnode(group.value.label); - return new _mathMLTree2.default.MathNode(group.value.isOver ? "mover" : "munder", [buildGroup(group.value.base, options), accentNode]); -}; - -groupTypes.xArrow = function (group, options) { - var arrowNode = _stretchy2.default.mathMLnode(group.value.label); - var node = void 0; - var lowerNode = void 0; - - if (group.value.body) { - var upperNode = buildGroup(group.value.body, options); - if (group.value.below) { - lowerNode = buildGroup(group.value.below, options); - node = new _mathMLTree2.default.MathNode("munderover", [arrowNode, lowerNode, upperNode]); - } else { - node = new _mathMLTree2.default.MathNode("mover", [arrowNode, upperNode]); - } - } else if (group.value.below) { - lowerNode = buildGroup(group.value.below, options); - node = new _mathMLTree2.default.MathNode("munder", [arrowNode, lowerNode]); - } else { - node = new _mathMLTree2.default.MathNode("mover", [arrowNode]); - } - return node; -}; - -groupTypes.mclass = function (group, options) { - var inner = buildExpression(group.value.value, options); - return new _mathMLTree2.default.MathNode("mstyle", inner); -}; - -groupTypes.raisebox = function (group, options) { - var node = new _mathMLTree2.default.MathNode("mpadded", [buildGroup(group.value.body, options)]); - var dy = group.value.dy.value.number + group.value.dy.value.unit; - node.setAttribute("voffset", dy); - return node; -}; - -/** - * Takes a list of nodes, builds them, and returns a list of the generated - * MathML nodes. A little simpler than the HTML version because we don't do any - * previous-node handling. - */ -var buildExpression = exports.buildExpression = function buildExpression(expression, options) { - var groups = []; - for (var i = 0; i < expression.length; i++) { - var group = expression[i]; - groups.push(buildGroup(group, options)); - } - - // TODO(kevinb): combine \\not with mrels and mords - - return groups; -}; - -/** - * Takes a group from the parser and calls the appropriate groupTypes function - * on it to produce a MathML node. - */ -var buildGroup = exports.buildGroup = function buildGroup(group, options) { - var removeUnnecessaryRow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - if (!group) { - return new _mathMLTree2.default.MathNode("mrow"); - } - - if (groupTypes[group.type]) { - // Call the groupTypes function - var result = groupTypes[group.type](group, options); - if (removeUnnecessaryRow) { - if (result.type === "mrow" && result.children.length === 1) { - return result.children[0]; - } - } - return result; - } else { - throw new _ParseError2.default("Got group of unknown type: '" + group.type + "'"); - } -}; - -/** - * Takes a full parse tree and settings and builds a MathML representation of - * it. In particular, we put the elements from building the parse tree into a - * tag so we can also include that TeX source as an annotation. - * - * Note that we actually return a domTree element with a `` inside it so - * we can do appropriate styling. - */ -function buildMathML(tree, texExpression, options) { - var expression = buildExpression(tree, options); - - // Wrap up the expression in an mrow so it is presented in the semantics - // tag correctly. - var wrapper = new _mathMLTree2.default.MathNode("mrow", expression); - - // Build a TeX annotation of the source - var annotation = new _mathMLTree2.default.MathNode("annotation", [new _mathMLTree2.default.TextNode(texExpression)]); - - annotation.setAttribute("encoding", "application/x-tex"); - - var semantics = new _mathMLTree2.default.MathNode("semantics", [wrapper, annotation]); - - var math = new _mathMLTree2.default.MathNode("math", [semantics]); - - // You can't style nodes, so we wrap the node in a span. - return _buildCommon2.default.makeSpan(["katex-mathml"], [math]); -} - -},{"./ParseError":84,"./Style":89,"./buildCommon":91,"./fontMetrics":101,"./mathMLTree":121,"./stretchy":123,"./symbols":125,"./utils":128}],94:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _buildHTML = require("./buildHTML"); - -var _buildHTML2 = _interopRequireDefault(_buildHTML); - -var _buildMathML = require("./buildMathML"); - -var _buildMathML2 = _interopRequireDefault(_buildMathML); - -var _buildCommon = require("./buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _Options = require("./Options"); - -var _Options2 = _interopRequireDefault(_Options); - -var _Settings = require("./Settings"); - -var _Settings2 = _interopRequireDefault(_Settings); - -var _Style = require("./Style"); - -var _Style2 = _interopRequireDefault(_Style); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var buildTree = function buildTree(tree, expression, settings) { - settings = settings || new _Settings2.default({}); - - var startStyle = _Style2.default.TEXT; - if (settings.displayMode) { - startStyle = _Style2.default.DISPLAY; - } - - // Setup the default options - var options = new _Options2.default({ - style: startStyle, - maxSize: settings.maxSize - }); - - // `buildHTML` sometimes messes with the parse tree (like turning bins -> - // ords), so we build the MathML version first. - var mathMLNode = (0, _buildMathML2.default)(tree, expression, options); - var htmlNode = (0, _buildHTML2.default)(tree, options); - - var katexNode = _buildCommon2.default.makeSpan(["katex"], [mathMLNode, htmlNode]); - - if (settings.displayMode) { - return _buildCommon2.default.makeSpan(["katex-display"], [katexNode]); - } else { - return katexNode; - } -}; - -exports.default = buildTree; - -},{"./Options":83,"./Settings":87,"./Style":89,"./buildCommon":91,"./buildHTML":92,"./buildMathML":93}],95:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports._environments = undefined; -exports.default = defineEnvironment; - -var _buildHTML = require("./buildHTML"); - -var _buildMathML = require("./buildMathML"); - -var _Options = require("./Options"); - -var _Options2 = _interopRequireDefault(_Options); - -var _ParseNode = require("./ParseNode"); - -var _ParseNode2 = _interopRequireDefault(_ParseNode); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * All registered environments. - * `environments.js` exports this same dictionary again and makes it public. - * `Parser.js` requires this dictionary via `environments.js`. - */ - - -/** - * The context contains the following properties: - * - mode: current parsing mode. - * - envName: the name of the environment, one of the listed names. - * - parser: the parser object. - */ - - -/** - * - context: information and references provided by the parser - * - args: an array of arguments passed to \begin{name} - * - optArgs: an array of optional arguments passed to \begin{name} - */ - - -/** - * - numArgs: (default 0) The number of arguments after the \begin{name} function. - * - argTypes: (optional) Just like for a function - * - allowedInText: (default false) Whether or not the environment is allowed - * inside text mode (not enforced yet). - * - numOptionalArgs: (default 0) Just like for a function - */ - - -/** - * Final enviornment spec for use at parse time. - * This is almost identical to `EnvDefSpec`, except it - * 1. includes the function handler - * 2. requires all arguments except argType - * It is generated by `defineEnvironment()` below. - */ -var _environments = exports._environments = {}; - -function defineEnvironment(_ref) { - var type = _ref.type, - names = _ref.names, - props = _ref.props, - handler = _ref.handler, - htmlBuilder = _ref.htmlBuilder, - mathmlBuilder = _ref.mathmlBuilder; - - // Set default values of environments - var data = { - numArgs: props.numArgs || 0, - greediness: 1, - allowedInText: false, - numOptionalArgs: 0, - handler: handler - }; - for (var i = 0; i < names.length; ++i) { - _environments[names[i]] = data; - } - if (htmlBuilder) { - _buildHTML.groupTypes[type] = htmlBuilder; - } - if (mathmlBuilder) { - _buildMathML.groupTypes[type] = mathmlBuilder; - } -} - -},{"./Options":83,"./ParseNode":85,"./buildHTML":92,"./buildMathML":93}],96:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ordargument = exports._functions = undefined; -exports.default = defineFunction; - -var _buildHTML = require("./buildHTML"); - -var _buildMathML = require("./buildMathML"); - -/** - * All registered functions. - * `functions.js` just exports this same dictionary again and makes it public. - * `Parser.js` requires this dictionary. - */ - - -/** Context provided to function handlers for error messages. */ - - -// TODO: Enumerate all allowed output types. - - -/** - * Final function spec for use at parse time. - * This is almost identical to `FunctionPropSpec`, except it - * 1. includes the function handler, and - * 2. requires all arguments except argTypes. - * It is generated by `defineFunction()` below. - */ -var _functions = exports._functions = {}; - -function defineFunction(_ref) { - var type = _ref.type, - names = _ref.names, - props = _ref.props, - handler = _ref.handler, - htmlBuilder = _ref.htmlBuilder, - mathmlBuilder = _ref.mathmlBuilder; - - // Set default values of functions - var data = { - numArgs: props.numArgs, - argTypes: props.argTypes, - greediness: props.greediness === undefined ? 1 : props.greediness, - allowedInText: !!props.allowedInText, - allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath, - numOptionalArgs: props.numOptionalArgs || 0, - infix: !!props.infix, - handler: handler - }; - for (var i = 0; i < names.length; ++i) { - _functions[names[i]] = data; - } - if (type) { - if (htmlBuilder) { - _buildHTML.groupTypes[type] = htmlBuilder; - } - if (mathmlBuilder) { - _buildMathML.groupTypes[type] = mathmlBuilder; - } - } -} - -// Since the corresponding buildHTML/buildMathML function expects a -// list of elements, we normalize for different kinds of arguments -var ordargument = exports.ordargument = function ordargument(arg) { - if (arg.type === "ordgroup") { - return arg.value; - } else { - return [arg]; - } -}; - -},{"./buildHTML":92,"./buildMathML":93}],97:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _ParseError = require("./ParseError"); - -var _ParseError2 = _interopRequireDefault(_ParseError); - -var _Style = require("./Style"); - -var _Style2 = _interopRequireDefault(_Style); - -var _domTree = require("./domTree"); - -var _domTree2 = _interopRequireDefault(_domTree); - -var _buildCommon = require("./buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _fontMetrics = require("./fontMetrics"); - -var _fontMetrics2 = _interopRequireDefault(_fontMetrics); - -var _symbols = require("./symbols"); - -var _symbols2 = _interopRequireDefault(_symbols); - -var _utils = require("./utils"); - -var _utils2 = _interopRequireDefault(_utils); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Get the metrics for a given symbol and font, after transformation (i.e. - * after following replacement from symbols.js) - */ -var getMetrics = function getMetrics(symbol, font) { - if (_symbols2.default.math[symbol] && _symbols2.default.math[symbol].replace) { - return _fontMetrics2.default.getCharacterMetrics(_symbols2.default.math[symbol].replace, font); - } else { - return _fontMetrics2.default.getCharacterMetrics(symbol, font); - } -}; - -/** - * Puts a delimiter span in a given style, and adds appropriate height, depth, - * and maxFontSizes. - */ -/** - * This file deals with creating delimiters of various sizes. The TeXbook - * discusses these routines on page 441-442, in the "Another subroutine sets box - * x to a specified variable delimiter" paragraph. - * - * There are three main routines here. `makeSmallDelim` makes a delimiter in the - * normal font, but in either text, script, or scriptscript style. - * `makeLargeDelim` makes a delimiter in textstyle, but in one of the Size1, - * Size2, Size3, or Size4 fonts. `makeStackedDelim` makes a delimiter out of - * smaller pieces that are stacked on top of one another. - * - * The functions take a parameter `center`, which determines if the delimiter - * should be centered around the axis. - * - * Then, there are three exposed functions. `sizedDelim` makes a delimiter in - * one of the given sizes. This is used for things like `\bigl`. - * `customSizedDelim` makes a delimiter with a given total height+depth. It is - * called in places like `\sqrt`. `leftRightDelim` makes an appropriate - * delimiter which surrounds an expression of a given height an depth. It is - * used in `\left` and `\right`. - */ - -var styleWrap = function styleWrap(delim, toStyle, options, classes) { - var newOptions = options.havingBaseStyle(toStyle); - - var span = _buildCommon2.default.makeSpan((classes || []).concat(newOptions.sizingClasses(options)), [delim], options); - - span.delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; - span.height *= span.delimSizeMultiplier; - span.depth *= span.delimSizeMultiplier; - span.maxFontSize = newOptions.sizeMultiplier; - - return span; -}; - -var centerSpan = function centerSpan(span, options, style) { - var newOptions = options.havingBaseStyle(style); - var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight; - - span.classes.push("delimcenter"); - span.style.top = shift + "em"; - span.height -= shift; - span.depth += shift; -}; - -/** - * Makes a small delimiter. This is a delimiter that comes in the Main-Regular - * font, but is restyled to either be in textstyle, scriptstyle, or - * scriptscriptstyle. - */ -var makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) { - var text = _buildCommon2.default.makeSymbol(delim, "Main-Regular", mode, options); - var span = styleWrap(text, style, options, classes); - if (center) { - centerSpan(span, options, style); - } - return span; -}; - -/** - * Builds a symbol in the given font size (note size is an integer) - */ -var mathrmSize = function mathrmSize(value, size, mode, options) { - return _buildCommon2.default.makeSymbol(value, "Size" + size + "-Regular", mode, options); -}; - -/** - * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2, - * Size3, or Size4 fonts. It is always rendered in textstyle. - */ -var makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) { - var inner = mathrmSize(delim, size, mode, options); - var span = styleWrap(_buildCommon2.default.makeSpan(["delimsizing", "size" + size], [inner], options), _Style2.default.TEXT, options, classes); - if (center) { - centerSpan(span, options, _Style2.default.TEXT); - } - return span; -}; - -/** - * Make an inner span with the given offset and in the given font. This is used - * in `makeStackedDelim` to make the stacking pieces for the delimiter. - */ -var makeInner = function makeInner(symbol, font, mode) { - var sizeClass = void 0; - // Apply the correct CSS class to choose the right font. - if (font === "Size1-Regular") { - sizeClass = "delim-size1"; - } else if (font === "Size4-Regular") { - sizeClass = "delim-size4"; - } - - var inner = _buildCommon2.default.makeSpan(["delimsizinginner", sizeClass], [_buildCommon2.default.makeSpan([], [_buildCommon2.default.makeSymbol(symbol, font, mode)])]); - - // Since this will be passed into `makeVList` in the end, wrap the element - // in the appropriate tag that VList uses. - return { type: "elem", elem: inner }; -}; - -/** - * Make a stacked delimiter out of a given delimiter, with the total height at - * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook. - */ -var makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) { - // There are four parts, the top, an optional middle, a repeated part, and a - // bottom. - var top = void 0; - var middle = void 0; - var repeat = void 0; - var bottom = void 0; - top = repeat = bottom = delim; - middle = null; - // Also keep track of what font the delimiters are in - var font = "Size1-Regular"; - - // We set the parts and font based on the symbol. Note that we use - // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the - // repeats of the arrows - if (delim === "\\uparrow") { - repeat = bottom = "\u23D0"; - } else if (delim === "\\Uparrow") { - repeat = bottom = "\u2016"; - } else if (delim === "\\downarrow") { - top = repeat = "\u23D0"; - } else if (delim === "\\Downarrow") { - top = repeat = "\u2016"; - } else if (delim === "\\updownarrow") { - top = "\\uparrow"; - repeat = "\u23D0"; - bottom = "\\downarrow"; - } else if (delim === "\\Updownarrow") { - top = "\\Uparrow"; - repeat = "\u2016"; - bottom = "\\Downarrow"; - } else if (delim === "[" || delim === "\\lbrack") { - top = "\u23A1"; - repeat = "\u23A2"; - bottom = "\u23A3"; - font = "Size4-Regular"; - } else if (delim === "]" || delim === "\\rbrack") { - top = "\u23A4"; - repeat = "\u23A5"; - bottom = "\u23A6"; - font = "Size4-Regular"; - } else if (delim === "\\lfloor") { - repeat = top = "\u23A2"; - bottom = "\u23A3"; - font = "Size4-Regular"; - } else if (delim === "\\lceil") { - top = "\u23A1"; - repeat = bottom = "\u23A2"; - font = "Size4-Regular"; - } else if (delim === "\\rfloor") { - repeat = top = "\u23A5"; - bottom = "\u23A6"; - font = "Size4-Regular"; - } else if (delim === "\\rceil") { - top = "\u23A4"; - repeat = bottom = "\u23A5"; - font = "Size4-Regular"; - } else if (delim === "(") { - top = "\u239B"; - repeat = "\u239C"; - bottom = "\u239D"; - font = "Size4-Regular"; - } else if (delim === ")") { - top = "\u239E"; - repeat = "\u239F"; - bottom = "\u23A0"; - font = "Size4-Regular"; - } else if (delim === "\\{" || delim === "\\lbrace") { - top = "\u23A7"; - middle = "\u23A8"; - bottom = "\u23A9"; - repeat = "\u23AA"; - font = "Size4-Regular"; - } else if (delim === "\\}" || delim === "\\rbrace") { - top = "\u23AB"; - middle = "\u23AC"; - bottom = "\u23AD"; - repeat = "\u23AA"; - font = "Size4-Regular"; - } else if (delim === "\\lgroup") { - top = "\u23A7"; - bottom = "\u23A9"; - repeat = "\u23AA"; - font = "Size4-Regular"; - } else if (delim === "\\rgroup") { - top = "\u23AB"; - bottom = "\u23AD"; - repeat = "\u23AA"; - font = "Size4-Regular"; - } else if (delim === "\\lmoustache") { - top = "\u23A7"; - bottom = "\u23AD"; - repeat = "\u23AA"; - font = "Size4-Regular"; - } else if (delim === "\\rmoustache") { - top = "\u23AB"; - bottom = "\u23A9"; - repeat = "\u23AA"; - font = "Size4-Regular"; - } - - // Get the metrics of the four sections - var topMetrics = getMetrics(top, font); - var topHeightTotal = topMetrics.height + topMetrics.depth; - var repeatMetrics = getMetrics(repeat, font); - var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; - var bottomMetrics = getMetrics(bottom, font); - var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; - var middleHeightTotal = 0; - var middleFactor = 1; - if (middle !== null) { - var middleMetrics = getMetrics(middle, font); - middleHeightTotal = middleMetrics.height + middleMetrics.depth; - middleFactor = 2; // repeat symmetrically above and below middle - } - - // Calcuate the minimal height that the delimiter can have. - // It is at least the size of the top, bottom, and optional middle combined. - var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; - - // Compute the number of copies of the repeat symbol we will need - var repeatCount = Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal)); - - // Compute the total height of the delimiter including all the symbols - var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; - - // The center of the delimiter is placed at the center of the axis. Note - // that in this context, "center" means that the delimiter should be - // centered around the axis in the current style, while normally it is - // centered around the axis in textstyle. - var axisHeight = options.fontMetrics().axisHeight; - if (center) { - axisHeight *= options.sizeMultiplier; - } - // Calculate the depth - var depth = realHeightTotal / 2 - axisHeight; - - // Now, we start building the pieces that will go into the vlist - - // Keep a list of the inner pieces - var inners = []; - - // Add the bottom symbol - inners.push(makeInner(bottom, font, mode)); - - if (middle === null) { - // Add that many symbols - for (var i = 0; i < repeatCount; i++) { - inners.push(makeInner(repeat, font, mode)); - } - } else { - // When there is a middle bit, we need the middle part and two repeated - // sections - for (var _i = 0; _i < repeatCount; _i++) { - inners.push(makeInner(repeat, font, mode)); - } - inners.push(makeInner(middle, font, mode)); - for (var _i2 = 0; _i2 < repeatCount; _i2++) { - inners.push(makeInner(repeat, font, mode)); - } - } - - // Add the top symbol - inners.push(makeInner(top, font, mode)); - - // Finally, build the vlist - var newOptions = options.havingBaseStyle(_Style2.default.TEXT); - var inner = _buildCommon2.default.makeVList({ - positionType: "bottom", - positionData: depth, - children: inners - }, newOptions); - - return styleWrap(_buildCommon2.default.makeSpan(["delimsizing", "mult"], [inner], newOptions), _Style2.default.TEXT, options, classes); -}; - -var sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, options) { - var alternate = void 0; - if (sqrtName === "sqrtTall") { - // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular - // One path edge has a variable length. It runs from the viniculumn - // to a point near (14 units) the bottom of the surd. The viniculum - // is 40 units thick. So the length of the line in question is: - var vertSegment = viewBoxHeight - 54; - alternate = "M702 0H400000v40H742v" + vertSegment + "l-4 4-4 4c-.667.667\n-2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1h-12l-28-84c-16.667-52-96.667\n-294.333-240-727l-212 -643 -85 170c-4-3.333-8.333-7.667-13 -13l-13-13l77-155\n 77-156c66 199.333 139 419.667 219 661 l218 661zM702 0H400000v40H742z"; - } - var pathNode = new _domTree2.default.pathNode(sqrtName, alternate); - - var svg = new _domTree2.default.svgNode([pathNode], { - // Note: 1000:1 ratio of viewBox to document em width. - "width": "400em", - "height": height + "em", - "viewBox": "0 0 400000 " + viewBoxHeight, - "preserveAspectRatio": "xMinYMin slice" - }); - - return _buildCommon2.default.makeSpan(["hide-tail"], [svg], options); -}; - -/** - * Make a sqrt image of the given height, - */ -var makeSqrtImage = function makeSqrtImage(height, options) { - var delim = traverseSequence("\\surd", height, stackLargeDelimiterSequence, options); - - // Create a span containing an SVG image of a sqrt symbol. - var span = void 0; - var sizeMultiplier = options.sizeMultiplier; // default - var spanHeight = void 0; - var viewBoxHeight = void 0; - - if (delim.type === "small") { - // Get an SVG that is derived from glyph U+221A in font KaTeX-Main. - viewBoxHeight = 1000; // from font - var newOptions = options.havingBaseStyle(delim.style); - sizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; - spanHeight = 1 * sizeMultiplier; - span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, options); - span.style.minWidth = "0.853em"; - span.advanceWidth = 0.833 * sizeMultiplier; // from the font. - } else if (delim.type === "large") { - // These SVGs come from fonts: KaTeX_Size1, _Size2, etc. - viewBoxHeight = 1000 * sizeToMaxHeight[delim.size]; - spanHeight = sizeToMaxHeight[delim.size] / sizeMultiplier; - span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, options); - span.style.minWidth = "1.02em"; - span.advanceWidth = 1.0 / sizeMultiplier; // from the font - } else { - // Tall sqrt. In TeX, this would be stacked using multiple glyphs. - // We'll use a single SVG to accomplish the same thing. - spanHeight = height / sizeMultiplier; - viewBoxHeight = Math.floor(1000 * height); - span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, options); - span.style.minWidth = "0.742em"; - span.advanceWidth = 1.056 / sizeMultiplier; - } - - span.height = spanHeight; - span.style.height = spanHeight + "em"; - - return { - span: span, - // Calculate the actual line width. - // This actually should depend on the chosen font -- e.g. \boldmath - // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and - // have thicker rules. - ruleWidth: options.fontMetrics().sqrtRuleThickness * sizeMultiplier - }; -}; - -// There are three kinds of delimiters, delimiters that stack when they become -// too large -var stackLargeDelimiters = ["(", ")", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\\lceil", "\\rceil", "\\surd"]; - -// delimiters that always stack -var stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\\lmoustache", "\\rmoustache"]; - -// and delimiters that never stack -var stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; - -// Metrics of the different sizes. Found by looking at TeX's output of -// $\bigl| // \Bigl| \biggl| \Biggl| \showlists$ -// Used to create stacked delimiters of appropriate sizes in makeSizedDelim. -var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0]; - -/** - * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4. - */ -var makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) { - // < and > turn into \langle and \rangle in delimiters - if (delim === "<" || delim === "\\lt") { - delim = "\\langle"; - } else if (delim === ">" || delim === "\\gt") { - delim = "\\rangle"; - } - - // Sized delimiters are never centered. - if (_utils2.default.contains(stackLargeDelimiters, delim) || _utils2.default.contains(stackNeverDelimiters, delim)) { - return makeLargeDelim(delim, size, false, options, mode, classes); - } else if (_utils2.default.contains(stackAlwaysDelimiters, delim)) { - return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes); - } else { - throw new _ParseError2.default("Illegal delimiter: '" + delim + "'"); - } -}; - -/** - * There are three different sequences of delimiter sizes that the delimiters - * follow depending on the kind of delimiter. This is used when creating custom - * sized delimiters to decide whether to create a small, large, or stacked - * delimiter. - * - * In real TeX, these sequences aren't explicitly defined, but are instead - * defined inside the font metrics. Since there are only three sequences that - * are possible for the delimiters that TeX defines, it is easier to just encode - * them explicitly here. - */ - -// Delimiters that never stack try small delimiters and large delimiters only -var stackNeverDelimiterSequence = [{ type: "small", style: _Style2.default.SCRIPTSCRIPT }, { type: "small", style: _Style2.default.SCRIPT }, { type: "small", style: _Style2.default.TEXT }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }]; - -// Delimiters that always stack try the small delimiters first, then stack -var stackAlwaysDelimiterSequence = [{ type: "small", style: _Style2.default.SCRIPTSCRIPT }, { type: "small", style: _Style2.default.SCRIPT }, { type: "small", style: _Style2.default.TEXT }, { type: "stack" }]; - -// Delimiters that stack when large try the small and then large delimiters, and -// stack afterwards -var stackLargeDelimiterSequence = [{ type: "small", style: _Style2.default.SCRIPTSCRIPT }, { type: "small", style: _Style2.default.SCRIPT }, { type: "small", style: _Style2.default.TEXT }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }, { type: "stack" }]; - -/** - * Get the font used in a delimiter based on what kind of delimiter it is. - */ -var delimTypeToFont = function delimTypeToFont(type) { - if (type.type === "small") { - return "Main-Regular"; - } else if (type.type === "large") { - return "Size" + type.size + "-Regular"; - } else if (type.type === "stack") { - return "Size4-Regular"; - } -}; - -/** - * Traverse a sequence of types of delimiters to decide what kind of delimiter - * should be used to create a delimiter of the given height+depth. - */ -var traverseSequence = function traverseSequence(delim, height, sequence, options) { - // Here, we choose the index we should start at in the sequences. In smaller - // sizes (which correspond to larger numbers in style.size) we start earlier - // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts - // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2 - var start = Math.min(2, 3 - options.style.size); - for (var i = start; i < sequence.length; i++) { - if (sequence[i].type === "stack") { - // This is always the last delimiter, so we just break the loop now. - break; - } - - var metrics = getMetrics(delim, delimTypeToFont(sequence[i])); - var heightDepth = metrics.height + metrics.depth; - - // Small delimiters are scaled down versions of the same font, so we - // account for the style change size. - - if (sequence[i].type === "small") { - var newOptions = options.havingBaseStyle(sequence[i].style); - heightDepth *= newOptions.sizeMultiplier; - } - - // Check if the delimiter at this size works for the given height. - if (heightDepth > height) { - return sequence[i]; - } - } - - // If we reached the end of the sequence, return the last sequence element. - return sequence[sequence.length - 1]; -}; - -/** - * Make a delimiter of a given height+depth, with optional centering. Here, we - * traverse the sequences, and create a delimiter that the sequence tells us to. - */ -var makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) { - if (delim === "<" || delim === "\\lt") { - delim = "\\langle"; - } else if (delim === ">" || delim === "\\gt") { - delim = "\\rangle"; - } - - // Decide what sequence to use - var sequence = void 0; - if (_utils2.default.contains(stackNeverDelimiters, delim)) { - sequence = stackNeverDelimiterSequence; - } else if (_utils2.default.contains(stackLargeDelimiters, delim)) { - sequence = stackLargeDelimiterSequence; - } else { - sequence = stackAlwaysDelimiterSequence; - } - - // Look through the sequence - var delimType = traverseSequence(delim, height, sequence, options); - - // Get the delimiter from font glyphs. - // Depending on the sequence element we decided on, call the - // appropriate function. - if (delimType.type === "small") { - return makeSmallDelim(delim, delimType.style, center, options, mode, classes); - } else if (delimType.type === "large") { - return makeLargeDelim(delim, delimType.size, center, options, mode, classes); - } else /* if (delimType.type === "stack") */{ - return makeStackedDelim(delim, height, center, options, mode, classes); - } -}; - -/** - * Make a delimiter for use with `\left` and `\right`, given a height and depth - * of an expression that the delimiters surround. - */ -var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) { - // We always center \left/\right delimiters, so the axis is always shifted - var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; - - // Taken from TeX source, tex.web, function make_left_right - var delimiterFactor = 901; - var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm; - - var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight); - - var totalHeight = Math.max( - // In real TeX, calculations are done using integral values which are - // 65536 per pt, or 655360 per em. So, the division here truncates in - // TeX but doesn't here, producing different results. If we wanted to - // exactly match TeX's calculation, we could do - // Math.floor(655360 * maxDistFromAxis / 500) * - // delimiterFactor / 655360 - // (To see the difference, compare - // x^{x^{\left(\rule{0.1em}{0.68em}\right)}} - // in TeX and KaTeX) - maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); - - // Finally, we defer to `makeCustomSizedDelim` with our calculated total - // height - return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes); -}; - -exports.default = { - sqrtImage: makeSqrtImage, - sizedDelim: makeSizedDelim, - customSizedDelim: makeCustomSizedDelim, - leftRightDelim: makeLeftRightDelim -}; - -},{"./ParseError":84,"./Style":89,"./buildCommon":91,"./domTree":98,"./fontMetrics":101,"./symbols":125,"./utils":128}],98:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _getIterator2 = require("babel-runtime/core-js/get-iterator"); - -var _getIterator3 = _interopRequireDefault(_getIterator2); - -var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _createClass2 = require("babel-runtime/helpers/createClass"); - -var _createClass3 = _interopRequireDefault(_createClass2); - -var _unicodeRegexes = require("./unicodeRegexes"); - -var _utils = require("./utils"); - -var _utils2 = _interopRequireDefault(_utils); - -var _svgGeometry = require("./svgGeometry"); - -var _svgGeometry2 = _interopRequireDefault(_svgGeometry); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Create an HTML className based on a list of classes. In addition to joining - * with spaces, we also remove null or empty classes. - */ -var createClass = function createClass(classes) { - classes = classes.slice(); - for (var i = classes.length - 1; i >= 0; i--) { - if (!classes[i]) { - classes.splice(i, 1); - } - } - - return classes.join(" "); -}; - -// To ensure that all nodes have compatible signatures for these methods. - - -/** - * All `DomChildNode`s MUST have `height`, `depth`, and `maxFontSize` numeric - * fields. - * - * `DomChildNode` is not defined as an interface since `documentFragment` also - * has these fields but should not be considered a `DomChildNode`. - */ - -/** - * These objects store the data about the DOM nodes we create, as well as some - * extra data. They can then be transformed into real DOM nodes with the - * `toNode` function or HTML markup using `toMarkup`. They are useful for both - * storing extra properties on the nodes, as well as providing a way to easily - * work with the DOM. - * - * Similar functions for working with MathML nodes exist in mathMLTree.js. - */ - -/** - * This node represents a span node, with a className, a list of children, and - * an inline style. It also contains information about its height, depth, and - * maxFontSize. - */ -var span = function () { - function span(classes, children, options) { - (0, _classCallCheck3.default)(this, span); - - this.classes = classes || []; - this.children = children || []; - this.height = 0; - this.depth = 0; - this.maxFontSize = 0; - this.style = {}; - this.attributes = {}; - if (options) { - if (options.style.isTight()) { - this.classes.push("mtight"); - } - var color = options.getColor(); - if (color) { - this.style.color = color; - } - } - } - - /** - * Sets an arbitrary attribute on the span. Warning: use this wisely. Not all - * browsers support attributes the same, and having too many custom attributes - * is probably bad. - */ - - - (0, _createClass3.default)(span, [{ - key: "setAttribute", - value: function setAttribute(attribute, value) { - this.attributes[attribute] = value; - } - }, { - key: "tryCombine", - value: function tryCombine(sibling) { - return false; - } - - /** - * Convert the span into an HTML node - */ - - }, { - key: "toNode", - value: function toNode() { - var span = document.createElement("span"); - - // Apply the class - span.className = createClass(this.classes); - - // Apply inline styles - for (var style in this.style) { - if (Object.prototype.hasOwnProperty.call(this.style, style)) { - // $FlowFixMe Flow doesn't seem to understand span.style's type. - span.style[style] = this.style[style]; - } - } - - // Apply attributes - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - span.setAttribute(attr, this.attributes[attr]); - } - } - - // Append the children, also as HTML nodes - for (var i = 0; i < this.children.length; i++) { - span.appendChild(this.children[i].toNode()); - } - - return span; - } - - /** - * Convert the span into an HTML markup string - */ - - }, { - key: "toMarkup", - value: function toMarkup() { - var markup = ") element with a hyperlink, a list of classes, - * a list of children, and an inline style. It also contains information about its - * height, depth, and maxFontSize. - */ - - -var anchor = function () { - function anchor(href, classes, children, options) { - (0, _classCallCheck3.default)(this, anchor); - - this.href = href; - this.classes = classes; - this.children = children; - this.height = 0; - this.depth = 0; - this.maxFontSize = 0; - this.style = {}; - this.attributes = {}; - if (options.style.isTight()) { - this.classes.push("mtight"); - } - var color = options.getColor(); - if (color) { - this.style.color = color; - } - } - - /** - * Sets an arbitrary attribute on the anchor. Warning: use this wisely. Not all - * browsers support attributes the same, and having too many custom attributes - * is probably bad. - */ - - - (0, _createClass3.default)(anchor, [{ - key: "setAttribute", - value: function setAttribute(attribute, value) { - this.attributes[attribute] = value; - } - }, { - key: "tryCombine", - value: function tryCombine(sibling) { - return false; - } - - /** - * Convert the anchor into an HTML node - */ - - }, { - key: "toNode", - value: function toNode() { - var a = document.createElement("a"); - - // Apply the href - a.setAttribute('href', this.href); - - // Apply the class - if (this.classes.length) { - a.className = createClass(this.classes); - } - - // Apply inline styles - for (var style in this.style) { - if (Object.prototype.hasOwnProperty.call(this.style, style)) { - // $FlowFixMe Flow doesn't seem to understand a.style's type. - a.style[style] = this.style[style]; - } - } - - // Apply attributes - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - a.setAttribute(attr, this.attributes[attr]); - } - } - - // Append the children, also as HTML nodes - for (var i = 0; i < this.children.length; i++) { - a.appendChild(this.children[i].toNode()); - } - - return a; - } - - /** - * Convert the a into an HTML markup string - */ - - }, { - key: "toMarkup", - value: function toMarkup() { - var markup = " 0 || createClass(this.classes) !== createClass(sibling.classes) || this.skew !== sibling.skew || this.maxFontSize !== sibling.maxFontSize) { - return false; - } - for (var style in this.style) { - if (this.style.hasOwnProperty(style) && this.style[style] !== sibling.style[style]) { - return false; - } - } - for (var _style in sibling.style) { - if (sibling.style.hasOwnProperty(_style) && this.style[_style] !== sibling.style[_style]) { - return false; - } - } - this.value += sibling.value; - this.height = Math.max(this.height, sibling.height); - this.depth = Math.max(this.depth, sibling.depth); - this.italic = sibling.italic; - return true; - } - - /** - * Creates a text node or span from a symbol node. Note that a span is only - * created if it is needed. - */ - - }, { - key: "toNode", - value: function toNode() { - var node = document.createTextNode(this.value); - var span = null; - - if (this.italic > 0) { - span = document.createElement("span"); - span.style.marginRight = this.italic + "em"; - } - - if (this.classes.length > 0) { - span = span || document.createElement("span"); - span.className = createClass(this.classes); - } - - for (var style in this.style) { - if (this.style.hasOwnProperty(style)) { - span = span || document.createElement("span"); - // $FlowFixMe Flow doesn't seem to understand span.style's type. - span.style[style] = this.style[style]; - } - } - - if (span) { - span.appendChild(node); - return span; - } else { - return node; - } - } - - /** - * Creates markup for a symbol node. - */ - - }, { - key: "toMarkup", - value: function toMarkup() { - // TODO(alpert): More duplication than I'd like from - // span.prototype.toMarkup and symbolNode.prototype.toNode... - var needsSpan = false; - - var markup = " 0) { - styles += "margin-right:" + this.italic + "em;"; - } - for (var style in this.style) { - if (this.style.hasOwnProperty(style)) { - styles += _utils2.default.hyphenate(style) + ":" + this.style[style] + ";"; - } - } - - if (styles) { - needsSpan = true; - markup += " style=\"" + _utils2.default.escape(styles) + "\""; - } - - var escaped = _utils2.default.escape(this.value); - if (needsSpan) { - markup += ">"; - markup += escaped; - markup += ""; - return markup; - } else { - return escaped; - } - } - }]); - return symbolNode; -}(); - -/** - * SVG nodes are used to render stretchy wide elements. - */ - - -var svgNode = function () { - function svgNode(children, attributes) { - (0, _classCallCheck3.default)(this, svgNode); - - this.children = children || []; - this.attributes = attributes || {}; - this.height = 0; - this.depth = 0; - this.maxFontSize = 0; - } - // Required for all `DomChildNode`s. Are always 0 for svgNode. - - - (0, _createClass3.default)(svgNode, [{ - key: "toNode", - value: function toNode() { - var svgNS = "http://www.w3.org/2000/svg"; - var node = document.createElementNS(svgNS, "svg"); - - // Apply attributes - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - node.setAttribute(attr, this.attributes[attr]); - } - } - - for (var i = 0; i < this.children.length; i++) { - node.appendChild(this.children[i].toNode()); - } - return node; - } - }, { - key: "toMarkup", - value: function toMarkup() { - var markup = ""; - } else { - return ""; - } - } - }]); - return pathNode; -}(); - -var lineNode = function () { - function lineNode(attributes) { - (0, _classCallCheck3.default)(this, lineNode); - - this.attributes = attributes || {}; - } - - (0, _createClass3.default)(lineNode, [{ - key: "toNode", - value: function toNode() { - var svgNS = "http://www.w3.org/2000/svg"; - var node = document.createElementNS(svgNS, "line"); - - // Apply attributes - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - node.setAttribute(attr, this.attributes[attr]); - } - } - - return node; - } - }, { - key: "toMarkup", - value: function toMarkup() { - var markup = " 1 && lastRow.length === 1 && lastRow[0].value.value[0].value.length === 0) { - body.pop(); - } - break; - } else if (next === "\\\\" || next === "\\cr") { - var cr = parser.parseFunction(); - rowGaps.push(cr.value.size); - row = []; - body.push(row); - } else { - throw new _ParseError2.default("Expected & or \\\\ or \\end", parser.nextToken); - } - } - result.body = body; - result.rowGaps = rowGaps; - return new _ParseNode2.default(result.type, result, parser.mode); -} - -// Decides on a style for cells in an array according to whether the given -// environment name starts with the letter 'd'. -function dCellStyle(envName) { - if (envName.substr(0, 1) === "d") { - return "display"; - } else { - return "text"; - } -} - -var htmlBuilder = function htmlBuilder(group, options) { - var r = void 0; - var c = void 0; - var nr = group.value.body.length; - var nc = 0; - var body = new Array(nr); - - // Horizontal spacing - var pt = 1 / options.fontMetrics().ptPerEm; - var arraycolsep = 5 * pt; // \arraycolsep in article.cls - - // Vertical spacing - var baselineskip = 12 * pt; // see size10.clo - // Default \jot from ltmath.dtx - // TODO(edemaine): allow overriding \jot via \setlength (#687) - var jot = 3 * pt; - // Default \arraystretch from lttab.dtx - // TODO(gagern): may get redefined once we have user-defined macros - var arraystretch = _utils2.default.deflt(group.value.arraystretch, 1); - var arrayskip = arraystretch * baselineskip; - var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and - var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx - - var totalHeight = 0; - for (r = 0; r < group.value.body.length; ++r) { - var inrow = group.value.body[r]; - var _height = arstrutHeight; // \@array adds an \@arstrut - var _depth = arstrutDepth; // to each tow (via the template) - - if (nc < inrow.length) { - nc = inrow.length; - } - - var outrow = new Array(inrow.length); - for (c = 0; c < inrow.length; ++c) { - var elt = html.buildGroup(inrow[c], options); - if (_depth < elt.depth) { - _depth = elt.depth; - } - if (_height < elt.height) { - _height = elt.height; - } - outrow[c] = elt; - } - - var gap = 0; - if (group.value.rowGaps[r]) { - gap = (0, _units.calculateSize)(group.value.rowGaps[r].value, options); - if (gap > 0) { - // \@argarraycr - gap += arstrutDepth; - if (_depth < gap) { - _depth = gap; // \@xargarraycr - } - gap = 0; - } - } - // In AMS multiline environments such as aligned and gathered, rows - // correspond to lines that have additional \jot added to the - // \baselineskip via \openup. - if (group.value.addJot) { - _depth += jot; - } - - outrow.height = _height; - outrow.depth = _depth; - totalHeight += _height; - outrow.pos = totalHeight; - totalHeight += _depth + gap; // \@yargarraycr - body[r] = outrow; - } - - var offset = totalHeight / 2 + options.fontMetrics().axisHeight; - var colDescriptions = group.value.cols || []; - var cols = []; - var colSep = void 0; - var colDescrNum = void 0; - for (c = 0, colDescrNum = 0; - // Continue while either there are more columns or more column - // descriptions, so trailing separators don't get lost. - c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) { - - var colDescr = colDescriptions[colDescrNum] || {}; - - var firstSeparator = true; - while (colDescr.type === "separator") { - // If there is more than one separator in a row, add a space - // between them. - if (!firstSeparator) { - colSep = _buildCommon2.default.makeSpan(["arraycolsep"], []); - colSep.style.width = options.fontMetrics().doubleRuleSep + "em"; - cols.push(colSep); - } - - if (colDescr.separator === "|") { - var _separator = _stretchy2.default.ruleSpan("vertical-separator", options); - _separator.style.height = totalHeight + "em"; - _separator.style.verticalAlign = -(totalHeight - offset) + "em"; - - cols.push(_separator); - } else { - throw new _ParseError2.default("Invalid separator type: " + colDescr.separator); - } - - colDescrNum++; - colDescr = colDescriptions[colDescrNum] || {}; - firstSeparator = false; - } - - if (c >= nc) { - continue; - } - - var sepwidth = void 0; - if (c > 0 || group.value.hskipBeforeAndAfter) { - sepwidth = _utils2.default.deflt(colDescr.pregap, arraycolsep); - if (sepwidth !== 0) { - colSep = _buildCommon2.default.makeSpan(["arraycolsep"], []); - colSep.style.width = sepwidth + "em"; - cols.push(colSep); - } - } - - var col = []; - for (r = 0; r < nr; ++r) { - var row = body[r]; - var elem = row[c]; - if (!elem) { - continue; - } - var shift = row.pos - offset; - elem.depth = row.depth; - elem.height = row.height; - col.push({ type: "elem", elem: elem, shift: shift }); - } - - col = _buildCommon2.default.makeVList({ - positionType: "individualShift", - children: col - }, options); - col = _buildCommon2.default.makeSpan(["col-align-" + (colDescr.align || "c")], [col]); - cols.push(col); - - if (c < nc - 1 || group.value.hskipBeforeAndAfter) { - sepwidth = _utils2.default.deflt(colDescr.postgap, arraycolsep); - if (sepwidth !== 0) { - colSep = _buildCommon2.default.makeSpan(["arraycolsep"], []); - colSep.style.width = sepwidth + "em"; - cols.push(colSep); - } - } - } - body = _buildCommon2.default.makeSpan(["mtable"], cols); - return _buildCommon2.default.makeSpan(["mord"], [body], options); -}; - -var mathmlBuilder = function mathmlBuilder(group, options) { - return new _mathMLTree2.default.MathNode("mtable", group.value.body.map(function (row) { - return new _mathMLTree2.default.MathNode("mtr", row.map(function (cell) { - return new _mathMLTree2.default.MathNode("mtd", [mml.buildGroup(cell, options)]); - })); - })); -}; - -// Convinient function for aligned and alignedat environments. -var alignedHandler = function alignedHandler(context, args) { - var res = { - type: "array", - cols: [], - addJot: true - }; - res = parseArray(context.parser, res, "display"); - - // Determining number of columns. - // 1. If the first argument is given, we use it as a number of columns, - // and makes sure that each row doesn't exceed that number. - // 2. Otherwise, just count number of columns = maximum number - // of cells in each row ("aligned" mode -- isAligned will be true). - // - // At the same time, prepend empty group {} at beginning of every second - // cell in each row (starting with second cell) so that operators become - // binary. This behavior is implemented in amsmath's \start@aligned. - var numMaths = void 0; - var numCols = 0; - var emptyGroup = new _ParseNode2.default("ordgroup", [], context.mode); - if (args[0] && args[0].value) { - var arg0 = ""; - for (var i = 0; i < args[0].value.length; i++) { - arg0 += args[0].value[i].value; - } - numMaths = Number(arg0); - numCols = numMaths * 2; - } - var isAligned = !numCols; - res.value.body.forEach(function (row) { - for (var _i = 1; _i < row.length; _i += 2) { - // Modify ordgroup node within styling node - var ordgroup = row[_i].value.value[0]; - ordgroup.value.unshift(emptyGroup); - } - if (!isAligned) { - // Case 1 - var curMaths = row.length / 2; - if (numMaths < curMaths) { - throw new _ParseError2.default("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row); - } - } else if (numCols < row.length) { - // Case 2 - numCols = row.length; - } - }); - - // Adjusting alignment. - // In aligned mode, we add one \qquad between columns; - // otherwise we add nothing. - for (var _i2 = 0; _i2 < numCols; ++_i2) { - var _align = "r"; - var _pregap = 0; - if (_i2 % 2 === 1) { - _align = "l"; - } else if (_i2 > 0 && isAligned) { - // "aligned" mode. - _pregap = 1; // add one \quad - } - res.value.cols[_i2] = { - type: "align", - align: _align, - pregap: _pregap, - postgap: 0 - }; - } - return res; -}; - -// Arrays are part of LaTeX, defined in lttab.dtx so its documentation -// is part of the source2e.pdf file of LaTeX2e source documentation. -// {darray} is an {array} environment where cells are set in \displaystyle, -// as defined in nccmath.sty. -(0, _defineEnvironment2.default)({ - type: "array", - names: ["array", "darray"], - props: { - numArgs: 1 - }, - handler: function handler(context, args) { - var colalign = args[0]; - colalign = colalign.value.map ? colalign.value : [colalign]; - var cols = colalign.map(function (node) { - var ca = node.value; - if ("lcr".indexOf(ca) !== -1) { - return { - type: "align", - align: ca - }; - } else if (ca === "|") { - return { - type: "separator", - separator: "|" - }; - } - throw new _ParseError2.default("Unknown column alignment: " + node.value, node); - }); - var res = { - type: "array", - cols: cols, - hskipBeforeAndAfter: true // \@preamble in lttab.dtx - }; - res = parseArray(context.parser, res, dCellStyle(context.envName)); - return res; - }, - htmlBuilder: htmlBuilder, - mathmlBuilder: mathmlBuilder -}); - -// The matrix environments of amsmath builds on the array environment -// of LaTeX, which is discussed above. -(0, _defineEnvironment2.default)({ - type: "array", - names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix"], - props: { - numArgs: 0 - }, - handler: function handler(context) { - var delimiters = { - "matrix": null, - "pmatrix": ["(", ")"], - "bmatrix": ["[", "]"], - "Bmatrix": ["\\{", "\\}"], - "vmatrix": ["|", "|"], - "Vmatrix": ["\\Vert", "\\Vert"] - }[context.envName]; - var res = { - type: "array", - hskipBeforeAndAfter: false // \hskip -\arraycolsep in amsmath - }; - res = parseArray(context.parser, res, dCellStyle(context.envName)); - if (delimiters) { - res = new _ParseNode2.default("leftright", { - body: [res], - left: delimiters[0], - right: delimiters[1] - }, context.mode); - } - return res; - }, - htmlBuilder: htmlBuilder, - mathmlBuilder: mathmlBuilder -}); - -// A cases environment (in amsmath.sty) is almost equivalent to -// \def\arraystretch{1.2}% -// \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right. -// {dcases} is a {cases} environment where cells are set in \displaystyle, -// as defined in mathtools.sty. -(0, _defineEnvironment2.default)({ - type: "array", - names: ["cases", "dcases"], - props: { - numArgs: 0 - }, - handler: function handler(context) { - var res = { - type: "array", - arraystretch: 1.2, - cols: [{ - type: "align", - align: "l", - pregap: 0, - // TODO(kevinb) get the current style. - // For now we use the metrics for TEXT style which is what we were - // doing before. Before attempting to get the current style we - // should look at TeX's behavior especially for \over and matrices. - postgap: 1.0 /* 1em quad */ - }, { - type: "align", - align: "l", - pregap: 0, - postgap: 0 - }] - }; - res = parseArray(context.parser, res, dCellStyle(context.envName)); - res = new _ParseNode2.default("leftright", { - body: [res], - left: "\\{", - right: "." - }, context.mode); - return res; - }, - htmlBuilder: htmlBuilder, - mathmlBuilder: mathmlBuilder -}); - -// An aligned environment is like the align* environment -// except it operates within math mode. -// Note that we assume \nomallineskiplimit to be zero, -// so that \strut@ is the same as \strut. -(0, _defineEnvironment2.default)({ - type: "array", - names: ["aligned"], - props: { - numArgs: 0 - }, - handler: alignedHandler, - htmlBuilder: htmlBuilder, - mathmlBuilder: mathmlBuilder -}); - -// A gathered environment is like an array environment with one centered -// column, but where rows are considered lines so get \jot line spacing -// and contents are set in \displaystyle. -(0, _defineEnvironment2.default)({ - type: "array", - names: ["gathered"], - props: { - numArgs: 0 - }, - handler: function handler(context) { - var res = { - type: "array", - cols: [{ - type: "align", - align: "c" - }], - addJot: true - }; - res = parseArray(context.parser, res, "display"); - return res; - }, - htmlBuilder: htmlBuilder, - mathmlBuilder: mathmlBuilder -}); - -// alignat environment is like an align environment, but one must explicitly -// specify maximum number of columns in each row, and can adjust spacing between -// each columns. -(0, _defineEnvironment2.default)({ - type: "array", - names: ["alignedat"], - // One for numbered and for unnumbered; - // but, KaTeX doesn't supports math numbering yet, - // they make no difference for now. - props: { - numArgs: 1 - }, - handler: alignedHandler, - htmlBuilder: htmlBuilder, - mathmlBuilder: mathmlBuilder -}); - -},{"../ParseError":84,"../ParseNode":85,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineEnvironment":95,"../mathMLTree":121,"../stretchy":123,"../units":127,"../utils":128}],101:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _unicodeRegexes = require("./unicodeRegexes"); - -var _fontMetricsData = require("./fontMetricsData"); - -var _fontMetricsData2 = _interopRequireDefault(_fontMetricsData); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * This file contains metrics regarding fonts and individual symbols. The sigma - * and xi variables, as well as the metricMap map contain data extracted from - * TeX, TeX font metrics, and the TTF files. These data are then exposed via the - * `metrics` variable and the getCharacterMetrics function. - */ - -// In TeX, there are actually three sets of dimensions, one for each of -// textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4: -// 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are -// provided in the the arrays below, in that order. -// -// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively. -// This was determined by running the following script: -// -// latex -interaction=nonstopmode \ -// '\documentclass{article}\usepackage{amsmath}\begin{document}' \ -// '$a$ \expandafter\show\the\textfont2' \ -// '\expandafter\show\the\scriptfont2' \ -// '\expandafter\show\the\scriptscriptfont2' \ -// '\stop' -// -// The metrics themselves were retreived using the following commands: -// -// tftopl cmsy10 -// tftopl cmsy7 -// tftopl cmsy5 -// -// The output of each of these commands is quite lengthy. The only part we -// care about is the FONTDIMEN section. Each value is measured in EMs. -var sigmasAndXis = { - slant: [0.250, 0.250, 0.250], // sigma1 - space: [0.000, 0.000, 0.000], // sigma2 - stretch: [0.000, 0.000, 0.000], // sigma3 - shrink: [0.000, 0.000, 0.000], // sigma4 - xHeight: [0.431, 0.431, 0.431], // sigma5 - quad: [1.000, 1.171, 1.472], // sigma6 - extraSpace: [0.000, 0.000, 0.000], // sigma7 - num1: [0.677, 0.732, 0.925], // sigma8 - num2: [0.394, 0.384, 0.387], // sigma9 - num3: [0.444, 0.471, 0.504], // sigma10 - denom1: [0.686, 0.752, 1.025], // sigma11 - denom2: [0.345, 0.344, 0.532], // sigma12 - sup1: [0.413, 0.503, 0.504], // sigma13 - sup2: [0.363, 0.431, 0.404], // sigma14 - sup3: [0.289, 0.286, 0.294], // sigma15 - sub1: [0.150, 0.143, 0.200], // sigma16 - sub2: [0.247, 0.286, 0.400], // sigma17 - supDrop: [0.386, 0.353, 0.494], // sigma18 - subDrop: [0.050, 0.071, 0.100], // sigma19 - delim1: [2.390, 1.700, 1.980], // sigma20 - delim2: [1.010, 1.157, 1.420], // sigma21 - axisHeight: [0.250, 0.250, 0.250], // sigma22 - - // These font metrics are extracted from TeX by using tftopl on cmex10.tfm; - // they correspond to the font parameters of the extension fonts (family 3). - // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to - // match cmex7, we'd use cmex7.tfm values for script and scriptscript - // values. - defaultRuleThickness: [0.04, 0.049, 0.049], // xi8; cmex7: 0.049 - bigOpSpacing1: [0.111, 0.111, 0.111], // xi9 - bigOpSpacing2: [0.166, 0.166, 0.166], // xi10 - bigOpSpacing3: [0.2, 0.2, 0.2], // xi11 - bigOpSpacing4: [0.6, 0.611, 0.611], // xi12; cmex7: 0.611 - bigOpSpacing5: [0.1, 0.143, 0.143], // xi13; cmex7: 0.143 - - // The \sqrt rule width is taken from the height of the surd character. - // Since we use the same font at all sizes, this thickness doesn't scale. - sqrtRuleThickness: [0.04, 0.04, 0.04], - - // This value determines how large a pt is, for metrics which are defined - // in terms of pts. - // This value is also used in katex.less; if you change it make sure the - // values match. - ptPerEm: [10.0, 10.0, 10.0], - - // The space between adjacent `|` columns in an array definition. From - // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm. - doubleRuleSep: [0.2, 0.2, 0.2] -}; - -// This map contains a mapping from font name and character code to character -// metrics, including height, depth, italic correction, and skew (kern from the -// character to the corresponding \skewchar) -// This map is generated via `make metrics`. It should not be changed manually. - - -// These are very rough approximations. We default to Times New Roman which -// should have Latin-1 and Cyrillic characters, but may not depending on the -// operating system. The metrics do not account for extra height from the -// accents. In the case of Cyrillic characters which have both ascenders and -// descenders we prefer approximations with ascenders, primarily to prevent -// the fraction bar or root line from intersecting the glyph. -// TODO(kevinb) allow union of multiple glyph metrics for better accuracy. -var extraCharacterMap = { - // Latin-1 - 'À': 'A', - 'Á': 'A', - 'Â': 'A', - 'Ã': 'A', - 'Ä': 'A', - 'Å': 'A', - 'Æ': 'A', - 'Ç': 'C', - 'È': 'E', - 'É': 'E', - 'Ê': 'E', - 'Ë': 'E', - 'Ì': 'I', - 'Í': 'I', - 'Î': 'I', - 'Ï': 'I', - 'Ð': 'D', - 'Ñ': 'N', - 'Ò': 'O', - 'Ó': 'O', - 'Ô': 'O', - 'Õ': 'O', - 'Ö': 'O', - 'Ø': 'O', - 'Ù': 'U', - 'Ú': 'U', - 'Û': 'U', - 'Ü': 'U', - 'Ý': 'Y', - 'Þ': 'o', - 'ß': 'B', - 'à': 'a', - 'á': 'a', - 'â': 'a', - 'ã': 'a', - 'ä': 'a', - 'å': 'a', - 'æ': 'a', - 'ç': 'c', - 'è': 'e', - 'é': 'e', - 'ê': 'e', - 'ë': 'e', - 'ì': 'i', - 'í': 'i', - 'î': 'i', - 'ï': 'i', - 'ð': 'd', - 'ñ': 'n', - 'ò': 'o', - 'ó': 'o', - 'ô': 'o', - 'õ': 'o', - 'ö': 'o', - 'ø': 'o', - 'ù': 'u', - 'ú': 'u', - 'û': 'u', - 'ü': 'u', - 'ý': 'y', - 'þ': 'o', - 'ÿ': 'y', - - // Cyrillic - 'А': 'A', - 'Б': 'B', - 'В': 'B', - 'Г': 'F', - 'Д': 'A', - 'Е': 'E', - 'Ж': 'K', - 'З': '3', - 'И': 'N', - 'Й': 'N', - 'К': 'K', - 'Л': 'N', - 'М': 'M', - 'Н': 'H', - 'О': 'O', - 'П': 'N', - 'Р': 'P', - 'С': 'C', - 'Т': 'T', - 'У': 'y', - 'Ф': 'O', - 'Х': 'X', - 'Ц': 'U', - 'Ч': 'h', - 'Ш': 'W', - 'Щ': 'W', - 'Ъ': 'B', - 'Ы': 'X', - 'Ь': 'B', - 'Э': '3', - 'Ю': 'X', - 'Я': 'R', - 'а': 'a', - 'б': 'b', - 'в': 'a', - 'г': 'r', - 'д': 'y', - 'е': 'e', - 'ж': 'm', - 'з': 'e', - 'и': 'n', - 'й': 'n', - 'к': 'n', - 'л': 'n', - 'м': 'm', - 'н': 'n', - 'о': 'o', - 'п': 'n', - 'р': 'p', - 'с': 'c', - 'т': 'o', - 'у': 'y', - 'ф': 'b', - 'х': 'x', - 'ц': 'n', - 'ч': 'n', - 'ш': 'w', - 'щ': 'w', - 'ъ': 'a', - 'ы': 'm', - 'ь': 'a', - 'э': 'e', - 'ю': 'm', - 'я': 'r' -}; - -/** - * This function is a convenience function for looking up information in the - * metricMap table. It takes a character as a string, and a font. - * - * Note: the `width` property may be undefined if fontMetricsData.js wasn't - * built using `Make extended_metrics`. - */ -var getCharacterMetrics = function getCharacterMetrics(character, font) { - var ch = character.charCodeAt(0); - if (character[0] in extraCharacterMap) { - ch = extraCharacterMap[character[0]].charCodeAt(0); - } else if (_unicodeRegexes.cjkRegex.test(character[0])) { - ch = 'M'.charCodeAt(0); - } - var metrics = _fontMetricsData2.default[font]['' + ch]; - if (metrics) { - return { - depth: metrics[0], - height: metrics[1], - italic: metrics[2], - skew: metrics[3], - width: metrics[4] - }; - } -}; - -var fontMetricsBySizeIndex = {}; - -/** - * Get the font metrics for a given size. - */ -var getFontMetrics = function getFontMetrics(size) { - var sizeIndex = void 0; - if (size >= 5) { - sizeIndex = 0; - } else if (size >= 3) { - sizeIndex = 1; - } else { - sizeIndex = 2; - } - if (!fontMetricsBySizeIndex[sizeIndex]) { - var metrics = fontMetricsBySizeIndex[sizeIndex] = { - cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18 - }; - for (var key in sigmasAndXis) { - if (sigmasAndXis.hasOwnProperty(key)) { - metrics[key] = sigmasAndXis[key][sizeIndex]; - } - } - } - return fontMetricsBySizeIndex[sizeIndex]; -}; - -exports.default = { - getFontMetrics: getFontMetrics, - getCharacterMetrics: getCharacterMetrics -}; - -},{"./fontMetricsData":102,"./unicodeRegexes":126}],102:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var fontMetricsData = { - "AMS-Regular": { - "65": [0, 0.68889, 0, 0], - "66": [0, 0.68889, 0, 0], - "67": [0, 0.68889, 0, 0], - "68": [0, 0.68889, 0, 0], - "69": [0, 0.68889, 0, 0], - "70": [0, 0.68889, 0, 0], - "71": [0, 0.68889, 0, 0], - "72": [0, 0.68889, 0, 0], - "73": [0, 0.68889, 0, 0], - "74": [0.16667, 0.68889, 0, 0], - "75": [0, 0.68889, 0, 0], - "76": [0, 0.68889, 0, 0], - "77": [0, 0.68889, 0, 0], - "78": [0, 0.68889, 0, 0], - "79": [0.16667, 0.68889, 0, 0], - "80": [0, 0.68889, 0, 0], - "81": [0.16667, 0.68889, 0, 0], - "82": [0, 0.68889, 0, 0], - "83": [0, 0.68889, 0, 0], - "84": [0, 0.68889, 0, 0], - "85": [0, 0.68889, 0, 0], - "86": [0, 0.68889, 0, 0], - "87": [0, 0.68889, 0, 0], - "88": [0, 0.68889, 0, 0], - "89": [0, 0.68889, 0, 0], - "90": [0, 0.68889, 0, 0], - "107": [0, 0.68889, 0, 0], - "165": [0, 0.675, 0.025, 0], - "174": [0.15559, 0.69224, 0, 0], - "240": [0, 0.68889, 0, 0], - "295": [0, 0.68889, 0, 0], - "710": [0, 0.825, 0, 0], - "732": [0, 0.9, 0, 0], - "770": [0, 0.825, 0, 0], - "771": [0, 0.9, 0, 0], - "989": [0.08167, 0.58167, 0, 0], - "1008": [0, 0.43056, 0.04028, 0], - "8245": [0, 0.54986, 0, 0], - "8463": [0, 0.68889, 0, 0], - "8487": [0, 0.68889, 0, 0], - "8498": [0, 0.68889, 0, 0], - "8502": [0, 0.68889, 0, 0], - "8503": [0, 0.68889, 0, 0], - "8504": [0, 0.68889, 0, 0], - "8513": [0, 0.68889, 0, 0], - "8592": [-0.03598, 0.46402, 0, 0], - "8594": [-0.03598, 0.46402, 0, 0], - "8602": [-0.13313, 0.36687, 0, 0], - "8603": [-0.13313, 0.36687, 0, 0], - "8606": [0.01354, 0.52239, 0, 0], - "8608": [0.01354, 0.52239, 0, 0], - "8610": [0.01354, 0.52239, 0, 0], - "8611": [0.01354, 0.52239, 0, 0], - "8619": [0, 0.54986, 0, 0], - "8620": [0, 0.54986, 0, 0], - "8621": [-0.13313, 0.37788, 0, 0], - "8622": [-0.13313, 0.36687, 0, 0], - "8624": [0, 0.69224, 0, 0], - "8625": [0, 0.69224, 0, 0], - "8630": [0, 0.43056, 0, 0], - "8631": [0, 0.43056, 0, 0], - "8634": [0.08198, 0.58198, 0, 0], - "8635": [0.08198, 0.58198, 0, 0], - "8638": [0.19444, 0.69224, 0, 0], - "8639": [0.19444, 0.69224, 0, 0], - "8642": [0.19444, 0.69224, 0, 0], - "8643": [0.19444, 0.69224, 0, 0], - "8644": [0.1808, 0.675, 0, 0], - "8646": [0.1808, 0.675, 0, 0], - "8647": [0.1808, 0.675, 0, 0], - "8648": [0.19444, 0.69224, 0, 0], - "8649": [0.1808, 0.675, 0, 0], - "8650": [0.19444, 0.69224, 0, 0], - "8651": [0.01354, 0.52239, 0, 0], - "8652": [0.01354, 0.52239, 0, 0], - "8653": [-0.13313, 0.36687, 0, 0], - "8654": [-0.13313, 0.36687, 0, 0], - "8655": [-0.13313, 0.36687, 0, 0], - "8666": [0.13667, 0.63667, 0, 0], - "8667": [0.13667, 0.63667, 0, 0], - "8669": [-0.13313, 0.37788, 0, 0], - "8672": [-0.064, 0.437, 0, 0], - "8674": [-0.064, 0.437, 0, 0], - "8705": [0, 0.825, 0, 0], - "8708": [0, 0.68889, 0, 0], - "8709": [0.08167, 0.58167, 0, 0], - "8717": [0, 0.43056, 0, 0], - "8722": [-0.03598, 0.46402, 0, 0], - "8724": [0.08198, 0.69224, 0, 0], - "8726": [0.08167, 0.58167, 0, 0], - "8733": [0, 0.69224, 0, 0], - "8736": [0, 0.69224, 0, 0], - "8737": [0, 0.69224, 0, 0], - "8738": [0.03517, 0.52239, 0, 0], - "8739": [0.08167, 0.58167, 0, 0], - "8740": [0.25142, 0.74111, 0, 0], - "8741": [0.08167, 0.58167, 0, 0], - "8742": [0.25142, 0.74111, 0, 0], - "8756": [0, 0.69224, 0, 0], - "8757": [0, 0.69224, 0, 0], - "8764": [-0.13313, 0.36687, 0, 0], - "8765": [-0.13313, 0.37788, 0, 0], - "8769": [-0.13313, 0.36687, 0, 0], - "8770": [-0.03625, 0.46375, 0, 0], - "8774": [0.30274, 0.79383, 0, 0], - "8776": [-0.01688, 0.48312, 0, 0], - "8778": [0.08167, 0.58167, 0, 0], - "8782": [0.06062, 0.54986, 0, 0], - "8783": [0.06062, 0.54986, 0, 0], - "8785": [0.08198, 0.58198, 0, 0], - "8786": [0.08198, 0.58198, 0, 0], - "8787": [0.08198, 0.58198, 0, 0], - "8790": [0, 0.69224, 0, 0], - "8791": [0.22958, 0.72958, 0, 0], - "8796": [0.08198, 0.91667, 0, 0], - "8806": [0.25583, 0.75583, 0, 0], - "8807": [0.25583, 0.75583, 0, 0], - "8808": [0.25142, 0.75726, 0, 0], - "8809": [0.25142, 0.75726, 0, 0], - "8812": [0.25583, 0.75583, 0, 0], - "8814": [0.20576, 0.70576, 0, 0], - "8815": [0.20576, 0.70576, 0, 0], - "8816": [0.30274, 0.79383, 0, 0], - "8817": [0.30274, 0.79383, 0, 0], - "8818": [0.22958, 0.72958, 0, 0], - "8819": [0.22958, 0.72958, 0, 0], - "8822": [0.1808, 0.675, 0, 0], - "8823": [0.1808, 0.675, 0, 0], - "8828": [0.13667, 0.63667, 0, 0], - "8829": [0.13667, 0.63667, 0, 0], - "8830": [0.22958, 0.72958, 0, 0], - "8831": [0.22958, 0.72958, 0, 0], - "8832": [0.20576, 0.70576, 0, 0], - "8833": [0.20576, 0.70576, 0, 0], - "8840": [0.30274, 0.79383, 0, 0], - "8841": [0.30274, 0.79383, 0, 0], - "8842": [0.13597, 0.63597, 0, 0], - "8843": [0.13597, 0.63597, 0, 0], - "8847": [0.03517, 0.54986, 0, 0], - "8848": [0.03517, 0.54986, 0, 0], - "8858": [0.08198, 0.58198, 0, 0], - "8859": [0.08198, 0.58198, 0, 0], - "8861": [0.08198, 0.58198, 0, 0], - "8862": [0, 0.675, 0, 0], - "8863": [0, 0.675, 0, 0], - "8864": [0, 0.675, 0, 0], - "8865": [0, 0.675, 0, 0], - "8872": [0, 0.69224, 0, 0], - "8873": [0, 0.69224, 0, 0], - "8874": [0, 0.69224, 0, 0], - "8876": [0, 0.68889, 0, 0], - "8877": [0, 0.68889, 0, 0], - "8878": [0, 0.68889, 0, 0], - "8879": [0, 0.68889, 0, 0], - "8882": [0.03517, 0.54986, 0, 0], - "8883": [0.03517, 0.54986, 0, 0], - "8884": [0.13667, 0.63667, 0, 0], - "8885": [0.13667, 0.63667, 0, 0], - "8888": [0, 0.54986, 0, 0], - "8890": [0.19444, 0.43056, 0, 0], - "8891": [0.19444, 0.69224, 0, 0], - "8892": [0.19444, 0.69224, 0, 0], - "8901": [0, 0.54986, 0, 0], - "8903": [0.08167, 0.58167, 0, 0], - "8905": [0.08167, 0.58167, 0, 0], - "8906": [0.08167, 0.58167, 0, 0], - "8907": [0, 0.69224, 0, 0], - "8908": [0, 0.69224, 0, 0], - "8909": [-0.03598, 0.46402, 0, 0], - "8910": [0, 0.54986, 0, 0], - "8911": [0, 0.54986, 0, 0], - "8912": [0.03517, 0.54986, 0, 0], - "8913": [0.03517, 0.54986, 0, 0], - "8914": [0, 0.54986, 0, 0], - "8915": [0, 0.54986, 0, 0], - "8916": [0, 0.69224, 0, 0], - "8918": [0.0391, 0.5391, 0, 0], - "8919": [0.0391, 0.5391, 0, 0], - "8920": [0.03517, 0.54986, 0, 0], - "8921": [0.03517, 0.54986, 0, 0], - "8922": [0.38569, 0.88569, 0, 0], - "8923": [0.38569, 0.88569, 0, 0], - "8926": [0.13667, 0.63667, 0, 0], - "8927": [0.13667, 0.63667, 0, 0], - "8928": [0.30274, 0.79383, 0, 0], - "8929": [0.30274, 0.79383, 0, 0], - "8934": [0.23222, 0.74111, 0, 0], - "8935": [0.23222, 0.74111, 0, 0], - "8936": [0.23222, 0.74111, 0, 0], - "8937": [0.23222, 0.74111, 0, 0], - "8938": [0.20576, 0.70576, 0, 0], - "8939": [0.20576, 0.70576, 0, 0], - "8940": [0.30274, 0.79383, 0, 0], - "8941": [0.30274, 0.79383, 0, 0], - "8994": [0.19444, 0.69224, 0, 0], - "8995": [0.19444, 0.69224, 0, 0], - "9416": [0.15559, 0.69224, 0, 0], - "9484": [0, 0.69224, 0, 0], - "9488": [0, 0.69224, 0, 0], - "9492": [0, 0.37788, 0, 0], - "9496": [0, 0.37788, 0, 0], - "9585": [0.19444, 0.68889, 0, 0], - "9586": [0.19444, 0.74111, 0, 0], - "9632": [0, 0.675, 0, 0], - "9633": [0, 0.675, 0, 0], - "9650": [0, 0.54986, 0, 0], - "9651": [0, 0.54986, 0, 0], - "9654": [0.03517, 0.54986, 0, 0], - "9660": [0, 0.54986, 0, 0], - "9661": [0, 0.54986, 0, 0], - "9664": [0.03517, 0.54986, 0, 0], - "9674": [0.11111, 0.69224, 0, 0], - "9733": [0.19444, 0.69224, 0, 0], - "10003": [0, 0.69224, 0, 0], - "10016": [0, 0.69224, 0, 0], - "10731": [0.11111, 0.69224, 0, 0], - "10846": [0.19444, 0.75583, 0, 0], - "10877": [0.13667, 0.63667, 0, 0], - "10878": [0.13667, 0.63667, 0, 0], - "10885": [0.25583, 0.75583, 0, 0], - "10886": [0.25583, 0.75583, 0, 0], - "10887": [0.13597, 0.63597, 0, 0], - "10888": [0.13597, 0.63597, 0, 0], - "10889": [0.26167, 0.75726, 0, 0], - "10890": [0.26167, 0.75726, 0, 0], - "10891": [0.48256, 0.98256, 0, 0], - "10892": [0.48256, 0.98256, 0, 0], - "10901": [0.13667, 0.63667, 0, 0], - "10902": [0.13667, 0.63667, 0, 0], - "10933": [0.25142, 0.75726, 0, 0], - "10934": [0.25142, 0.75726, 0, 0], - "10935": [0.26167, 0.75726, 0, 0], - "10936": [0.26167, 0.75726, 0, 0], - "10937": [0.26167, 0.75726, 0, 0], - "10938": [0.26167, 0.75726, 0, 0], - "10949": [0.25583, 0.75583, 0, 0], - "10950": [0.25583, 0.75583, 0, 0], - "10955": [0.28481, 0.79383, 0, 0], - "10956": [0.28481, 0.79383, 0, 0], - "57350": [0.08167, 0.58167, 0, 0], - "57351": [0.08167, 0.58167, 0, 0], - "57352": [0.08167, 0.58167, 0, 0], - "57353": [0, 0.43056, 0.04028, 0], - "57356": [0.25142, 0.75726, 0, 0], - "57357": [0.25142, 0.75726, 0, 0], - "57358": [0.41951, 0.91951, 0, 0], - "57359": [0.30274, 0.79383, 0, 0], - "57360": [0.30274, 0.79383, 0, 0], - "57361": [0.41951, 0.91951, 0, 0], - "57366": [0.25142, 0.75726, 0, 0], - "57367": [0.25142, 0.75726, 0, 0], - "57368": [0.25142, 0.75726, 0, 0], - "57369": [0.25142, 0.75726, 0, 0], - "57370": [0.13597, 0.63597, 0, 0], - "57371": [0.13597, 0.63597, 0, 0] - }, - "Caligraphic-Regular": { - "48": [0, 0.43056, 0, 0], - "49": [0, 0.43056, 0, 0], - "50": [0, 0.43056, 0, 0], - "51": [0.19444, 0.43056, 0, 0], - "52": [0.19444, 0.43056, 0, 0], - "53": [0.19444, 0.43056, 0, 0], - "54": [0, 0.64444, 0, 0], - "55": [0.19444, 0.43056, 0, 0], - "56": [0, 0.64444, 0, 0], - "57": [0.19444, 0.43056, 0, 0], - "65": [0, 0.68333, 0, 0.19445], - "66": [0, 0.68333, 0.03041, 0.13889], - "67": [0, 0.68333, 0.05834, 0.13889], - "68": [0, 0.68333, 0.02778, 0.08334], - "69": [0, 0.68333, 0.08944, 0.11111], - "70": [0, 0.68333, 0.09931, 0.11111], - "71": [0.09722, 0.68333, 0.0593, 0.11111], - "72": [0, 0.68333, 0.00965, 0.11111], - "73": [0, 0.68333, 0.07382, 0], - "74": [0.09722, 0.68333, 0.18472, 0.16667], - "75": [0, 0.68333, 0.01445, 0.05556], - "76": [0, 0.68333, 0, 0.13889], - "77": [0, 0.68333, 0, 0.13889], - "78": [0, 0.68333, 0.14736, 0.08334], - "79": [0, 0.68333, 0.02778, 0.11111], - "80": [0, 0.68333, 0.08222, 0.08334], - "81": [0.09722, 0.68333, 0, 0.11111], - "82": [0, 0.68333, 0, 0.08334], - "83": [0, 0.68333, 0.075, 0.13889], - "84": [0, 0.68333, 0.25417, 0], - "85": [0, 0.68333, 0.09931, 0.08334], - "86": [0, 0.68333, 0.08222, 0], - "87": [0, 0.68333, 0.08222, 0.08334], - "88": [0, 0.68333, 0.14643, 0.13889], - "89": [0.09722, 0.68333, 0.08222, 0.08334], - "90": [0, 0.68333, 0.07944, 0.13889] - }, - "Fraktur-Regular": { - "33": [0, 0.69141, 0, 0], - "34": [0, 0.69141, 0, 0], - "38": [0, 0.69141, 0, 0], - "39": [0, 0.69141, 0, 0], - "40": [0.24982, 0.74947, 0, 0], - "41": [0.24982, 0.74947, 0, 0], - "42": [0, 0.62119, 0, 0], - "43": [0.08319, 0.58283, 0, 0], - "44": [0, 0.10803, 0, 0], - "45": [0.08319, 0.58283, 0, 0], - "46": [0, 0.10803, 0, 0], - "47": [0.24982, 0.74947, 0, 0], - "48": [0, 0.47534, 0, 0], - "49": [0, 0.47534, 0, 0], - "50": [0, 0.47534, 0, 0], - "51": [0.18906, 0.47534, 0, 0], - "52": [0.18906, 0.47534, 0, 0], - "53": [0.18906, 0.47534, 0, 0], - "54": [0, 0.69141, 0, 0], - "55": [0.18906, 0.47534, 0, 0], - "56": [0, 0.69141, 0, 0], - "57": [0.18906, 0.47534, 0, 0], - "58": [0, 0.47534, 0, 0], - "59": [0.12604, 0.47534, 0, 0], - "61": [-0.13099, 0.36866, 0, 0], - "63": [0, 0.69141, 0, 0], - "65": [0, 0.69141, 0, 0], - "66": [0, 0.69141, 0, 0], - "67": [0, 0.69141, 0, 0], - "68": [0, 0.69141, 0, 0], - "69": [0, 0.69141, 0, 0], - "70": [0.12604, 0.69141, 0, 0], - "71": [0, 0.69141, 0, 0], - "72": [0.06302, 0.69141, 0, 0], - "73": [0, 0.69141, 0, 0], - "74": [0.12604, 0.69141, 0, 0], - "75": [0, 0.69141, 0, 0], - "76": [0, 0.69141, 0, 0], - "77": [0, 0.69141, 0, 0], - "78": [0, 0.69141, 0, 0], - "79": [0, 0.69141, 0, 0], - "80": [0.18906, 0.69141, 0, 0], - "81": [0.03781, 0.69141, 0, 0], - "82": [0, 0.69141, 0, 0], - "83": [0, 0.69141, 0, 0], - "84": [0, 0.69141, 0, 0], - "85": [0, 0.69141, 0, 0], - "86": [0, 0.69141, 0, 0], - "87": [0, 0.69141, 0, 0], - "88": [0, 0.69141, 0, 0], - "89": [0.18906, 0.69141, 0, 0], - "90": [0.12604, 0.69141, 0, 0], - "91": [0.24982, 0.74947, 0, 0], - "93": [0.24982, 0.74947, 0, 0], - "94": [0, 0.69141, 0, 0], - "97": [0, 0.47534, 0, 0], - "98": [0, 0.69141, 0, 0], - "99": [0, 0.47534, 0, 0], - "100": [0, 0.62119, 0, 0], - "101": [0, 0.47534, 0, 0], - "102": [0.18906, 0.69141, 0, 0], - "103": [0.18906, 0.47534, 0, 0], - "104": [0.18906, 0.69141, 0, 0], - "105": [0, 0.69141, 0, 0], - "106": [0, 0.69141, 0, 0], - "107": [0, 0.69141, 0, 0], - "108": [0, 0.69141, 0, 0], - "109": [0, 0.47534, 0, 0], - "110": [0, 0.47534, 0, 0], - "111": [0, 0.47534, 0, 0], - "112": [0.18906, 0.52396, 0, 0], - "113": [0.18906, 0.47534, 0, 0], - "114": [0, 0.47534, 0, 0], - "115": [0, 0.47534, 0, 0], - "116": [0, 0.62119, 0, 0], - "117": [0, 0.47534, 0, 0], - "118": [0, 0.52396, 0, 0], - "119": [0, 0.52396, 0, 0], - "120": [0.18906, 0.47534, 0, 0], - "121": [0.18906, 0.47534, 0, 0], - "122": [0.18906, 0.47534, 0, 0], - "8216": [0, 0.69141, 0, 0], - "8217": [0, 0.69141, 0, 0], - "58112": [0, 0.62119, 0, 0], - "58113": [0, 0.62119, 0, 0], - "58114": [0.18906, 0.69141, 0, 0], - "58115": [0.18906, 0.69141, 0, 0], - "58116": [0.18906, 0.47534, 0, 0], - "58117": [0, 0.69141, 0, 0], - "58118": [0, 0.62119, 0, 0], - "58119": [0, 0.47534, 0, 0] - }, - "Main-Bold": { - "33": [0, 0.69444, 0, 0], - "34": [0, 0.69444, 0, 0], - "35": [0.19444, 0.69444, 0, 0], - "36": [0.05556, 0.75, 0, 0], - "37": [0.05556, 0.75, 0, 0], - "38": [0, 0.69444, 0, 0], - "39": [0, 0.69444, 0, 0], - "40": [0.25, 0.75, 0, 0], - "41": [0.25, 0.75, 0, 0], - "42": [0, 0.75, 0, 0], - "43": [0.13333, 0.63333, 0, 0], - "44": [0.19444, 0.15556, 0, 0], - "45": [0, 0.44444, 0, 0], - "46": [0, 0.15556, 0, 0], - "47": [0.25, 0.75, 0, 0], - "48": [0, 0.64444, 0, 0], - "49": [0, 0.64444, 0, 0], - "50": [0, 0.64444, 0, 0], - "51": [0, 0.64444, 0, 0], - "52": [0, 0.64444, 0, 0], - "53": [0, 0.64444, 0, 0], - "54": [0, 0.64444, 0, 0], - "55": [0, 0.64444, 0, 0], - "56": [0, 0.64444, 0, 0], - "57": [0, 0.64444, 0, 0], - "58": [0, 0.44444, 0, 0], - "59": [0.19444, 0.44444, 0, 0], - "60": [0.08556, 0.58556, 0, 0], - "61": [-0.10889, 0.39111, 0, 0], - "62": [0.08556, 0.58556, 0, 0], - "63": [0, 0.69444, 0, 0], - "64": [0, 0.69444, 0, 0], - "65": [0, 0.68611, 0, 0], - "66": [0, 0.68611, 0, 0], - "67": [0, 0.68611, 0, 0], - "68": [0, 0.68611, 0, 0], - "69": [0, 0.68611, 0, 0], - "70": [0, 0.68611, 0, 0], - "71": [0, 0.68611, 0, 0], - "72": [0, 0.68611, 0, 0], - "73": [0, 0.68611, 0, 0], - "74": [0, 0.68611, 0, 0], - "75": [0, 0.68611, 0, 0], - "76": [0, 0.68611, 0, 0], - "77": [0, 0.68611, 0, 0], - "78": [0, 0.68611, 0, 0], - "79": [0, 0.68611, 0, 0], - "80": [0, 0.68611, 0, 0], - "81": [0.19444, 0.68611, 0, 0], - "82": [0, 0.68611, 0, 0], - "83": [0, 0.68611, 0, 0], - "84": [0, 0.68611, 0, 0], - "85": [0, 0.68611, 0, 0], - "86": [0, 0.68611, 0.01597, 0], - "87": [0, 0.68611, 0.01597, 0], - "88": [0, 0.68611, 0, 0], - "89": [0, 0.68611, 0.02875, 0], - "90": [0, 0.68611, 0, 0], - "91": [0.25, 0.75, 0, 0], - "92": [0.25, 0.75, 0, 0], - "93": [0.25, 0.75, 0, 0], - "94": [0, 0.69444, 0, 0], - "95": [0.31, 0.13444, 0.03194, 0], - "96": [0, 0.69444, 0, 0], - "97": [0, 0.44444, 0, 0], - "98": [0, 0.69444, 0, 0], - "99": [0, 0.44444, 0, 0], - "100": [0, 0.69444, 0, 0], - "101": [0, 0.44444, 0, 0], - "102": [0, 0.69444, 0.10903, 0], - "103": [0.19444, 0.44444, 0.01597, 0], - "104": [0, 0.69444, 0, 0], - "105": [0, 0.69444, 0, 0], - "106": [0.19444, 0.69444, 0, 0], - "107": [0, 0.69444, 0, 0], - "108": [0, 0.69444, 0, 0], - "109": [0, 0.44444, 0, 0], - "110": [0, 0.44444, 0, 0], - "111": [0, 0.44444, 0, 0], - "112": [0.19444, 0.44444, 0, 0], - "113": [0.19444, 0.44444, 0, 0], - "114": [0, 0.44444, 0, 0], - "115": [0, 0.44444, 0, 0], - "116": [0, 0.63492, 0, 0], - "117": [0, 0.44444, 0, 0], - "118": [0, 0.44444, 0.01597, 0], - "119": [0, 0.44444, 0.01597, 0], - "120": [0, 0.44444, 0, 0], - "121": [0.19444, 0.44444, 0.01597, 0], - "122": [0, 0.44444, 0, 0], - "123": [0.25, 0.75, 0, 0], - "124": [0.25, 0.75, 0, 0], - "125": [0.25, 0.75, 0, 0], - "126": [0.35, 0.34444, 0, 0], - "168": [0, 0.69444, 0, 0], - "172": [0, 0.44444, 0, 0], - "175": [0, 0.59611, 0, 0], - "176": [0, 0.69444, 0, 0], - "177": [0.13333, 0.63333, 0, 0], - "180": [0, 0.69444, 0, 0], - "215": [0.13333, 0.63333, 0, 0], - "247": [0.13333, 0.63333, 0, 0], - "305": [0, 0.44444, 0, 0], - "567": [0.19444, 0.44444, 0, 0], - "710": [0, 0.69444, 0, 0], - "711": [0, 0.63194, 0, 0], - "713": [0, 0.59611, 0, 0], - "714": [0, 0.69444, 0, 0], - "715": [0, 0.69444, 0, 0], - "728": [0, 0.69444, 0, 0], - "729": [0, 0.69444, 0, 0], - "730": [0, 0.69444, 0, 0], - "732": [0, 0.69444, 0, 0], - "768": [0, 0.69444, 0, 0], - "769": [0, 0.69444, 0, 0], - "770": [0, 0.69444, 0, 0], - "771": [0, 0.69444, 0, 0], - "772": [0, 0.59611, 0, 0], - "774": [0, 0.69444, 0, 0], - "775": [0, 0.69444, 0, 0], - "776": [0, 0.69444, 0, 0], - "778": [0, 0.69444, 0, 0], - "779": [0, 0.69444, 0, 0], - "780": [0, 0.63194, 0, 0], - "824": [0.19444, 0.69444, 0, 0], - "915": [0, 0.68611, 0, 0], - "916": [0, 0.68611, 0, 0], - "920": [0, 0.68611, 0, 0], - "923": [0, 0.68611, 0, 0], - "926": [0, 0.68611, 0, 0], - "928": [0, 0.68611, 0, 0], - "931": [0, 0.68611, 0, 0], - "933": [0, 0.68611, 0, 0], - "934": [0, 0.68611, 0, 0], - "936": [0, 0.68611, 0, 0], - "937": [0, 0.68611, 0, 0], - "8211": [0, 0.44444, 0.03194, 0], - "8212": [0, 0.44444, 0.03194, 0], - "8216": [0, 0.69444, 0, 0], - "8217": [0, 0.69444, 0, 0], - "8220": [0, 0.69444, 0, 0], - "8221": [0, 0.69444, 0, 0], - "8224": [0.19444, 0.69444, 0, 0], - "8225": [0.19444, 0.69444, 0, 0], - "8242": [0, 0.55556, 0, 0], - "8407": [0, 0.72444, 0.15486, 0], - "8463": [0, 0.69444, 0, 0], - "8465": [0, 0.69444, 0, 0], - "8467": [0, 0.69444, 0, 0], - "8472": [0.19444, 0.44444, 0, 0], - "8476": [0, 0.69444, 0, 0], - "8501": [0, 0.69444, 0, 0], - "8592": [-0.10889, 0.39111, 0, 0], - "8593": [0.19444, 0.69444, 0, 0], - "8594": [-0.10889, 0.39111, 0, 0], - "8595": [0.19444, 0.69444, 0, 0], - "8596": [-0.10889, 0.39111, 0, 0], - "8597": [0.25, 0.75, 0, 0], - "8598": [0.19444, 0.69444, 0, 0], - "8599": [0.19444, 0.69444, 0, 0], - "8600": [0.19444, 0.69444, 0, 0], - "8601": [0.19444, 0.69444, 0, 0], - "8636": [-0.10889, 0.39111, 0, 0], - "8637": [-0.10889, 0.39111, 0, 0], - "8640": [-0.10889, 0.39111, 0, 0], - "8641": [-0.10889, 0.39111, 0, 0], - "8656": [-0.10889, 0.39111, 0, 0], - "8657": [0.19444, 0.69444, 0, 0], - "8658": [-0.10889, 0.39111, 0, 0], - "8659": [0.19444, 0.69444, 0, 0], - "8660": [-0.10889, 0.39111, 0, 0], - "8661": [0.25, 0.75, 0, 0], - "8704": [0, 0.69444, 0, 0], - "8706": [0, 0.69444, 0.06389, 0], - "8707": [0, 0.69444, 0, 0], - "8709": [0.05556, 0.75, 0, 0], - "8711": [0, 0.68611, 0, 0], - "8712": [0.08556, 0.58556, 0, 0], - "8715": [0.08556, 0.58556, 0, 0], - "8722": [0.13333, 0.63333, 0, 0], - "8723": [0.13333, 0.63333, 0, 0], - "8725": [0.25, 0.75, 0, 0], - "8726": [0.25, 0.75, 0, 0], - "8727": [-0.02778, 0.47222, 0, 0], - "8728": [-0.02639, 0.47361, 0, 0], - "8729": [-0.02639, 0.47361, 0, 0], - "8730": [0.18, 0.82, 0, 0], - "8733": [0, 0.44444, 0, 0], - "8734": [0, 0.44444, 0, 0], - "8736": [0, 0.69224, 0, 0], - "8739": [0.25, 0.75, 0, 0], - "8741": [0.25, 0.75, 0, 0], - "8743": [0, 0.55556, 0, 0], - "8744": [0, 0.55556, 0, 0], - "8745": [0, 0.55556, 0, 0], - "8746": [0, 0.55556, 0, 0], - "8747": [0.19444, 0.69444, 0.12778, 0], - "8764": [-0.10889, 0.39111, 0, 0], - "8768": [0.19444, 0.69444, 0, 0], - "8771": [0.00222, 0.50222, 0, 0], - "8776": [0.02444, 0.52444, 0, 0], - "8781": [0.00222, 0.50222, 0, 0], - "8801": [0.00222, 0.50222, 0, 0], - "8804": [0.19667, 0.69667, 0, 0], - "8805": [0.19667, 0.69667, 0, 0], - "8810": [0.08556, 0.58556, 0, 0], - "8811": [0.08556, 0.58556, 0, 0], - "8826": [0.08556, 0.58556, 0, 0], - "8827": [0.08556, 0.58556, 0, 0], - "8834": [0.08556, 0.58556, 0, 0], - "8835": [0.08556, 0.58556, 0, 0], - "8838": [0.19667, 0.69667, 0, 0], - "8839": [0.19667, 0.69667, 0, 0], - "8846": [0, 0.55556, 0, 0], - "8849": [0.19667, 0.69667, 0, 0], - "8850": [0.19667, 0.69667, 0, 0], - "8851": [0, 0.55556, 0, 0], - "8852": [0, 0.55556, 0, 0], - "8853": [0.13333, 0.63333, 0, 0], - "8854": [0.13333, 0.63333, 0, 0], - "8855": [0.13333, 0.63333, 0, 0], - "8856": [0.13333, 0.63333, 0, 0], - "8857": [0.13333, 0.63333, 0, 0], - "8866": [0, 0.69444, 0, 0], - "8867": [0, 0.69444, 0, 0], - "8868": [0, 0.69444, 0, 0], - "8869": [0, 0.69444, 0, 0], - "8900": [-0.02639, 0.47361, 0, 0], - "8901": [-0.02639, 0.47361, 0, 0], - "8902": [-0.02778, 0.47222, 0, 0], - "8968": [0.25, 0.75, 0, 0], - "8969": [0.25, 0.75, 0, 0], - "8970": [0.25, 0.75, 0, 0], - "8971": [0.25, 0.75, 0, 0], - "8994": [-0.13889, 0.36111, 0, 0], - "8995": [-0.13889, 0.36111, 0, 0], - "9651": [0.19444, 0.69444, 0, 0], - "9657": [-0.02778, 0.47222, 0, 0], - "9661": [0.19444, 0.69444, 0, 0], - "9667": [-0.02778, 0.47222, 0, 0], - "9711": [0.19444, 0.69444, 0, 0], - "9824": [0.12963, 0.69444, 0, 0], - "9825": [0.12963, 0.69444, 0, 0], - "9826": [0.12963, 0.69444, 0, 0], - "9827": [0.12963, 0.69444, 0, 0], - "9837": [0, 0.75, 0, 0], - "9838": [0.19444, 0.69444, 0, 0], - "9839": [0.19444, 0.69444, 0, 0], - "10216": [0.25, 0.75, 0, 0], - "10217": [0.25, 0.75, 0, 0], - "10815": [0, 0.68611, 0, 0], - "10927": [0.19667, 0.69667, 0, 0], - "10928": [0.19667, 0.69667, 0, 0] - }, - "Main-Italic": { - "33": [0, 0.69444, 0.12417, 0], - "34": [0, 0.69444, 0.06961, 0], - "35": [0.19444, 0.69444, 0.06616, 0], - "37": [0.05556, 0.75, 0.13639, 0], - "38": [0, 0.69444, 0.09694, 0], - "39": [0, 0.69444, 0.12417, 0], - "40": [0.25, 0.75, 0.16194, 0], - "41": [0.25, 0.75, 0.03694, 0], - "42": [0, 0.75, 0.14917, 0], - "43": [0.05667, 0.56167, 0.03694, 0], - "44": [0.19444, 0.10556, 0, 0], - "45": [0, 0.43056, 0.02826, 0], - "46": [0, 0.10556, 0, 0], - "47": [0.25, 0.75, 0.16194, 0], - "48": [0, 0.64444, 0.13556, 0], - "49": [0, 0.64444, 0.13556, 0], - "50": [0, 0.64444, 0.13556, 0], - "51": [0, 0.64444, 0.13556, 0], - "52": [0.19444, 0.64444, 0.13556, 0], - "53": [0, 0.64444, 0.13556, 0], - "54": [0, 0.64444, 0.13556, 0], - "55": [0.19444, 0.64444, 0.13556, 0], - "56": [0, 0.64444, 0.13556, 0], - "57": [0, 0.64444, 0.13556, 0], - "58": [0, 0.43056, 0.0582, 0], - "59": [0.19444, 0.43056, 0.0582, 0], - "61": [-0.13313, 0.36687, 0.06616, 0], - "63": [0, 0.69444, 0.1225, 0], - "64": [0, 0.69444, 0.09597, 0], - "65": [0, 0.68333, 0, 0], - "66": [0, 0.68333, 0.10257, 0], - "67": [0, 0.68333, 0.14528, 0], - "68": [0, 0.68333, 0.09403, 0], - "69": [0, 0.68333, 0.12028, 0], - "70": [0, 0.68333, 0.13305, 0], - "71": [0, 0.68333, 0.08722, 0], - "72": [0, 0.68333, 0.16389, 0], - "73": [0, 0.68333, 0.15806, 0], - "74": [0, 0.68333, 0.14028, 0], - "75": [0, 0.68333, 0.14528, 0], - "76": [0, 0.68333, 0, 0], - "77": [0, 0.68333, 0.16389, 0], - "78": [0, 0.68333, 0.16389, 0], - "79": [0, 0.68333, 0.09403, 0], - "80": [0, 0.68333, 0.10257, 0], - "81": [0.19444, 0.68333, 0.09403, 0], - "82": [0, 0.68333, 0.03868, 0], - "83": [0, 0.68333, 0.11972, 0], - "84": [0, 0.68333, 0.13305, 0], - "85": [0, 0.68333, 0.16389, 0], - "86": [0, 0.68333, 0.18361, 0], - "87": [0, 0.68333, 0.18361, 0], - "88": [0, 0.68333, 0.15806, 0], - "89": [0, 0.68333, 0.19383, 0], - "90": [0, 0.68333, 0.14528, 0], - "91": [0.25, 0.75, 0.1875, 0], - "93": [0.25, 0.75, 0.10528, 0], - "94": [0, 0.69444, 0.06646, 0], - "95": [0.31, 0.12056, 0.09208, 0], - "97": [0, 0.43056, 0.07671, 0], - "98": [0, 0.69444, 0.06312, 0], - "99": [0, 0.43056, 0.05653, 0], - "100": [0, 0.69444, 0.10333, 0], - "101": [0, 0.43056, 0.07514, 0], - "102": [0.19444, 0.69444, 0.21194, 0], - "103": [0.19444, 0.43056, 0.08847, 0], - "104": [0, 0.69444, 0.07671, 0], - "105": [0, 0.65536, 0.1019, 0], - "106": [0.19444, 0.65536, 0.14467, 0], - "107": [0, 0.69444, 0.10764, 0], - "108": [0, 0.69444, 0.10333, 0], - "109": [0, 0.43056, 0.07671, 0], - "110": [0, 0.43056, 0.07671, 0], - "111": [0, 0.43056, 0.06312, 0], - "112": [0.19444, 0.43056, 0.06312, 0], - "113": [0.19444, 0.43056, 0.08847, 0], - "114": [0, 0.43056, 0.10764, 0], - "115": [0, 0.43056, 0.08208, 0], - "116": [0, 0.61508, 0.09486, 0], - "117": [0, 0.43056, 0.07671, 0], - "118": [0, 0.43056, 0.10764, 0], - "119": [0, 0.43056, 0.10764, 0], - "120": [0, 0.43056, 0.12042, 0], - "121": [0.19444, 0.43056, 0.08847, 0], - "122": [0, 0.43056, 0.12292, 0], - "126": [0.35, 0.31786, 0.11585, 0], - "163": [0, 0.69444, 0, 0], - "305": [0, 0.43056, 0, 0.02778], - "567": [0.19444, 0.43056, 0, 0.08334], - "768": [0, 0.69444, 0, 0], - "769": [0, 0.69444, 0.09694, 0], - "770": [0, 0.69444, 0.06646, 0], - "771": [0, 0.66786, 0.11585, 0], - "772": [0, 0.56167, 0.10333, 0], - "774": [0, 0.69444, 0.10806, 0], - "775": [0, 0.66786, 0.11752, 0], - "776": [0, 0.66786, 0.10474, 0], - "778": [0, 0.69444, 0, 0], - "779": [0, 0.69444, 0.1225, 0], - "780": [0, 0.62847, 0.08295, 0], - "915": [0, 0.68333, 0.13305, 0], - "916": [0, 0.68333, 0, 0], - "920": [0, 0.68333, 0.09403, 0], - "923": [0, 0.68333, 0, 0], - "926": [0, 0.68333, 0.15294, 0], - "928": [0, 0.68333, 0.16389, 0], - "931": [0, 0.68333, 0.12028, 0], - "933": [0, 0.68333, 0.11111, 0], - "934": [0, 0.68333, 0.05986, 0], - "936": [0, 0.68333, 0.11111, 0], - "937": [0, 0.68333, 0.10257, 0], - "8211": [0, 0.43056, 0.09208, 0], - "8212": [0, 0.43056, 0.09208, 0], - "8216": [0, 0.69444, 0.12417, 0], - "8217": [0, 0.69444, 0.12417, 0], - "8220": [0, 0.69444, 0.1685, 0], - "8221": [0, 0.69444, 0.06961, 0], - "8463": [0, 0.68889, 0, 0] - }, - "Main-Regular": { - "32": [0, 0, 0, 0], - "33": [0, 0.69444, 0, 0], - "34": [0, 0.69444, 0, 0], - "35": [0.19444, 0.69444, 0, 0], - "36": [0.05556, 0.75, 0, 0], - "37": [0.05556, 0.75, 0, 0], - "38": [0, 0.69444, 0, 0], - "39": [0, 0.69444, 0, 0], - "40": [0.25, 0.75, 0, 0], - "41": [0.25, 0.75, 0, 0], - "42": [0, 0.75, 0, 0], - "43": [0.08333, 0.58333, 0, 0], - "44": [0.19444, 0.10556, 0, 0], - "45": [0, 0.43056, 0, 0], - "46": [0, 0.10556, 0, 0], - "47": [0.25, 0.75, 0, 0], - "48": [0, 0.64444, 0, 0], - "49": [0, 0.64444, 0, 0], - "50": [0, 0.64444, 0, 0], - "51": [0, 0.64444, 0, 0], - "52": [0, 0.64444, 0, 0], - "53": [0, 0.64444, 0, 0], - "54": [0, 0.64444, 0, 0], - "55": [0, 0.64444, 0, 0], - "56": [0, 0.64444, 0, 0], - "57": [0, 0.64444, 0, 0], - "58": [0, 0.43056, 0, 0], - "59": [0.19444, 0.43056, 0, 0], - "60": [0.0391, 0.5391, 0, 0], - "61": [-0.13313, 0.36687, 0, 0], - "62": [0.0391, 0.5391, 0, 0], - "63": [0, 0.69444, 0, 0], - "64": [0, 0.69444, 0, 0], - "65": [0, 0.68333, 0, 0], - "66": [0, 0.68333, 0, 0], - "67": [0, 0.68333, 0, 0], - "68": [0, 0.68333, 0, 0], - "69": [0, 0.68333, 0, 0], - "70": [0, 0.68333, 0, 0], - "71": [0, 0.68333, 0, 0], - "72": [0, 0.68333, 0, 0], - "73": [0, 0.68333, 0, 0], - "74": [0, 0.68333, 0, 0], - "75": [0, 0.68333, 0, 0], - "76": [0, 0.68333, 0, 0], - "77": [0, 0.68333, 0, 0], - "78": [0, 0.68333, 0, 0], - "79": [0, 0.68333, 0, 0], - "80": [0, 0.68333, 0, 0], - "81": [0.19444, 0.68333, 0, 0], - "82": [0, 0.68333, 0, 0], - "83": [0, 0.68333, 0, 0], - "84": [0, 0.68333, 0, 0], - "85": [0, 0.68333, 0, 0], - "86": [0, 0.68333, 0.01389, 0], - "87": [0, 0.68333, 0.01389, 0], - "88": [0, 0.68333, 0, 0], - "89": [0, 0.68333, 0.025, 0], - "90": [0, 0.68333, 0, 0], - "91": [0.25, 0.75, 0, 0], - "92": [0.25, 0.75, 0, 0], - "93": [0.25, 0.75, 0, 0], - "94": [0, 0.69444, 0, 0], - "95": [0.31, 0.12056, 0.02778, 0], - "96": [0, 0.69444, 0, 0], - "97": [0, 0.43056, 0, 0], - "98": [0, 0.69444, 0, 0], - "99": [0, 0.43056, 0, 0], - "100": [0, 0.69444, 0, 0], - "101": [0, 0.43056, 0, 0], - "102": [0, 0.69444, 0.07778, 0], - "103": [0.19444, 0.43056, 0.01389, 0], - "104": [0, 0.69444, 0, 0], - "105": [0, 0.66786, 0, 0], - "106": [0.19444, 0.66786, 0, 0], - "107": [0, 0.69444, 0, 0], - "108": [0, 0.69444, 0, 0], - "109": [0, 0.43056, 0, 0], - "110": [0, 0.43056, 0, 0], - "111": [0, 0.43056, 0, 0], - "112": [0.19444, 0.43056, 0, 0], - "113": [0.19444, 0.43056, 0, 0], - "114": [0, 0.43056, 0, 0], - "115": [0, 0.43056, 0, 0], - "116": [0, 0.61508, 0, 0], - "117": [0, 0.43056, 0, 0], - "118": [0, 0.43056, 0.01389, 0], - "119": [0, 0.43056, 0.01389, 0], - "120": [0, 0.43056, 0, 0], - "121": [0.19444, 0.43056, 0.01389, 0], - "122": [0, 0.43056, 0, 0], - "123": [0.25, 0.75, 0, 0], - "124": [0.25, 0.75, 0, 0], - "125": [0.25, 0.75, 0, 0], - "126": [0.35, 0.31786, 0, 0], - "160": [0, 0, 0, 0], - "168": [0, 0.66786, 0, 0], - "172": [0, 0.43056, 0, 0], - "175": [0, 0.56778, 0, 0], - "176": [0, 0.69444, 0, 0], - "177": [0.08333, 0.58333, 0, 0], - "180": [0, 0.69444, 0, 0], - "215": [0.08333, 0.58333, 0, 0], - "247": [0.08333, 0.58333, 0, 0], - "305": [0, 0.43056, 0, 0], - "567": [0.19444, 0.43056, 0, 0], - "710": [0, 0.69444, 0, 0], - "711": [0, 0.62847, 0, 0], - "713": [0, 0.56778, 0, 0], - "714": [0, 0.69444, 0, 0], - "715": [0, 0.69444, 0, 0], - "728": [0, 0.69444, 0, 0], - "729": [0, 0.66786, 0, 0], - "730": [0, 0.69444, 0, 0], - "732": [0, 0.66786, 0, 0], - "768": [0, 0.69444, 0, 0], - "769": [0, 0.69444, 0, 0], - "770": [0, 0.69444, 0, 0], - "771": [0, 0.66786, 0, 0], - "772": [0, 0.56778, 0, 0], - "774": [0, 0.69444, 0, 0], - "775": [0, 0.66786, 0, 0], - "776": [0, 0.66786, 0, 0], - "778": [0, 0.69444, 0, 0], - "779": [0, 0.69444, 0, 0], - "780": [0, 0.62847, 0, 0], - "824": [0.19444, 0.69444, 0, 0], - "915": [0, 0.68333, 0, 0], - "916": [0, 0.68333, 0, 0], - "920": [0, 0.68333, 0, 0], - "923": [0, 0.68333, 0, 0], - "926": [0, 0.68333, 0, 0], - "928": [0, 0.68333, 0, 0], - "931": [0, 0.68333, 0, 0], - "933": [0, 0.68333, 0, 0], - "934": [0, 0.68333, 0, 0], - "936": [0, 0.68333, 0, 0], - "937": [0, 0.68333, 0, 0], - "8211": [0, 0.43056, 0.02778, 0], - "8212": [0, 0.43056, 0.02778, 0], - "8216": [0, 0.69444, 0, 0], - "8217": [0, 0.69444, 0, 0], - "8220": [0, 0.69444, 0, 0], - "8221": [0, 0.69444, 0, 0], - "8224": [0.19444, 0.69444, 0, 0], - "8225": [0.19444, 0.69444, 0, 0], - "8230": [0, 0.12, 0, 0], - "8242": [0, 0.55556, 0, 0], - "8407": [0, 0.71444, 0.15382, 0], - "8463": [0, 0.68889, 0, 0], - "8465": [0, 0.69444, 0, 0], - "8467": [0, 0.69444, 0, 0.11111], - "8472": [0.19444, 0.43056, 0, 0.11111], - "8476": [0, 0.69444, 0, 0], - "8501": [0, 0.69444, 0, 0], - "8592": [-0.13313, 0.36687, 0, 0], - "8593": [0.19444, 0.69444, 0, 0], - "8594": [-0.13313, 0.36687, 0, 0], - "8595": [0.19444, 0.69444, 0, 0], - "8596": [-0.13313, 0.36687, 0, 0], - "8597": [0.25, 0.75, 0, 0], - "8598": [0.19444, 0.69444, 0, 0], - "8599": [0.19444, 0.69444, 0, 0], - "8600": [0.19444, 0.69444, 0, 0], - "8601": [0.19444, 0.69444, 0, 0], - "8614": [0.011, 0.511, 0, 0], - "8617": [0.011, 0.511, 0, 0], - "8618": [0.011, 0.511, 0, 0], - "8636": [-0.13313, 0.36687, 0, 0], - "8637": [-0.13313, 0.36687, 0, 0], - "8640": [-0.13313, 0.36687, 0, 0], - "8641": [-0.13313, 0.36687, 0, 0], - "8652": [0.011, 0.671, 0, 0], - "8656": [-0.13313, 0.36687, 0, 0], - "8657": [0.19444, 0.69444, 0, 0], - "8658": [-0.13313, 0.36687, 0, 0], - "8659": [0.19444, 0.69444, 0, 0], - "8660": [-0.13313, 0.36687, 0, 0], - "8661": [0.25, 0.75, 0, 0], - "8704": [0, 0.69444, 0, 0], - "8706": [0, 0.69444, 0.05556, 0.08334], - "8707": [0, 0.69444, 0, 0], - "8709": [0.05556, 0.75, 0, 0], - "8711": [0, 0.68333, 0, 0], - "8712": [0.0391, 0.5391, 0, 0], - "8715": [0.0391, 0.5391, 0, 0], - "8722": [0.08333, 0.58333, 0, 0], - "8723": [0.08333, 0.58333, 0, 0], - "8725": [0.25, 0.75, 0, 0], - "8726": [0.25, 0.75, 0, 0], - "8727": [-0.03472, 0.46528, 0, 0], - "8728": [-0.05555, 0.44445, 0, 0], - "8729": [-0.05555, 0.44445, 0, 0], - "8730": [0.2, 0.8, 0, 0], - "8733": [0, 0.43056, 0, 0], - "8734": [0, 0.43056, 0, 0], - "8736": [0, 0.69224, 0, 0], - "8739": [0.25, 0.75, 0, 0], - "8741": [0.25, 0.75, 0, 0], - "8743": [0, 0.55556, 0, 0], - "8744": [0, 0.55556, 0, 0], - "8745": [0, 0.55556, 0, 0], - "8746": [0, 0.55556, 0, 0], - "8747": [0.19444, 0.69444, 0.11111, 0], - "8764": [-0.13313, 0.36687, 0, 0], - "8768": [0.19444, 0.69444, 0, 0], - "8771": [-0.03625, 0.46375, 0, 0], - "8773": [-0.022, 0.589, 0, 0], - "8776": [-0.01688, 0.48312, 0, 0], - "8781": [-0.03625, 0.46375, 0, 0], - "8784": [-0.133, 0.67, 0, 0], - "8800": [0.215, 0.716, 0, 0], - "8801": [-0.03625, 0.46375, 0, 0], - "8804": [0.13597, 0.63597, 0, 0], - "8805": [0.13597, 0.63597, 0, 0], - "8810": [0.0391, 0.5391, 0, 0], - "8811": [0.0391, 0.5391, 0, 0], - "8826": [0.0391, 0.5391, 0, 0], - "8827": [0.0391, 0.5391, 0, 0], - "8834": [0.0391, 0.5391, 0, 0], - "8835": [0.0391, 0.5391, 0, 0], - "8838": [0.13597, 0.63597, 0, 0], - "8839": [0.13597, 0.63597, 0, 0], - "8846": [0, 0.55556, 0, 0], - "8849": [0.13597, 0.63597, 0, 0], - "8850": [0.13597, 0.63597, 0, 0], - "8851": [0, 0.55556, 0, 0], - "8852": [0, 0.55556, 0, 0], - "8853": [0.08333, 0.58333, 0, 0], - "8854": [0.08333, 0.58333, 0, 0], - "8855": [0.08333, 0.58333, 0, 0], - "8856": [0.08333, 0.58333, 0, 0], - "8857": [0.08333, 0.58333, 0, 0], - "8866": [0, 0.69444, 0, 0], - "8867": [0, 0.69444, 0, 0], - "8868": [0, 0.69444, 0, 0], - "8869": [0, 0.69444, 0, 0], - "8872": [0.249, 0.75, 0, 0], - "8900": [-0.05555, 0.44445, 0, 0], - "8901": [-0.05555, 0.44445, 0, 0], - "8902": [-0.03472, 0.46528, 0, 0], - "8904": [0.005, 0.505, 0, 0], - "8942": [0.03, 0.9, 0, 0], - "8943": [-0.19, 0.31, 0, 0], - "8945": [-0.1, 0.82, 0, 0], - "8968": [0.25, 0.75, 0, 0], - "8969": [0.25, 0.75, 0, 0], - "8970": [0.25, 0.75, 0, 0], - "8971": [0.25, 0.75, 0, 0], - "8994": [-0.14236, 0.35764, 0, 0], - "8995": [-0.14236, 0.35764, 0, 0], - "9136": [0.244, 0.744, 0, 0], - "9137": [0.244, 0.744, 0, 0], - "9651": [0.19444, 0.69444, 0, 0], - "9657": [-0.03472, 0.46528, 0, 0], - "9661": [0.19444, 0.69444, 0, 0], - "9667": [-0.03472, 0.46528, 0, 0], - "9711": [0.19444, 0.69444, 0, 0], - "9824": [0.12963, 0.69444, 0, 0], - "9825": [0.12963, 0.69444, 0, 0], - "9826": [0.12963, 0.69444, 0, 0], - "9827": [0.12963, 0.69444, 0, 0], - "9837": [0, 0.75, 0, 0], - "9838": [0.19444, 0.69444, 0, 0], - "9839": [0.19444, 0.69444, 0, 0], - "10216": [0.25, 0.75, 0, 0], - "10217": [0.25, 0.75, 0, 0], - "10222": [0.244, 0.744, 0, 0], - "10223": [0.244, 0.744, 0, 0], - "10229": [0.011, 0.511, 0, 0], - "10230": [0.011, 0.511, 0, 0], - "10231": [0.011, 0.511, 0, 0], - "10232": [0.024, 0.525, 0, 0], - "10233": [0.024, 0.525, 0, 0], - "10234": [0.024, 0.525, 0, 0], - "10236": [0.011, 0.511, 0, 0], - "10815": [0, 0.68333, 0, 0], - "10927": [0.13597, 0.63597, 0, 0], - "10928": [0.13597, 0.63597, 0, 0] - }, - "Math-BoldItalic": { - "47": [0.19444, 0.69444, 0, 0], - "65": [0, 0.68611, 0, 0], - "66": [0, 0.68611, 0.04835, 0], - "67": [0, 0.68611, 0.06979, 0], - "68": [0, 0.68611, 0.03194, 0], - "69": [0, 0.68611, 0.05451, 0], - "70": [0, 0.68611, 0.15972, 0], - "71": [0, 0.68611, 0, 0], - "72": [0, 0.68611, 0.08229, 0], - "73": [0, 0.68611, 0.07778, 0], - "74": [0, 0.68611, 0.10069, 0], - "75": [0, 0.68611, 0.06979, 0], - "76": [0, 0.68611, 0, 0], - "77": [0, 0.68611, 0.11424, 0], - "78": [0, 0.68611, 0.11424, 0], - "79": [0, 0.68611, 0.03194, 0], - "80": [0, 0.68611, 0.15972, 0], - "81": [0.19444, 0.68611, 0, 0], - "82": [0, 0.68611, 0.00421, 0], - "83": [0, 0.68611, 0.05382, 0], - "84": [0, 0.68611, 0.15972, 0], - "85": [0, 0.68611, 0.11424, 0], - "86": [0, 0.68611, 0.25555, 0], - "87": [0, 0.68611, 0.15972, 0], - "88": [0, 0.68611, 0.07778, 0], - "89": [0, 0.68611, 0.25555, 0], - "90": [0, 0.68611, 0.06979, 0], - "97": [0, 0.44444, 0, 0], - "98": [0, 0.69444, 0, 0], - "99": [0, 0.44444, 0, 0], - "100": [0, 0.69444, 0, 0], - "101": [0, 0.44444, 0, 0], - "102": [0.19444, 0.69444, 0.11042, 0], - "103": [0.19444, 0.44444, 0.03704, 0], - "104": [0, 0.69444, 0, 0], - "105": [0, 0.69326, 0, 0], - "106": [0.19444, 0.69326, 0.0622, 0], - "107": [0, 0.69444, 0.01852, 0], - "108": [0, 0.69444, 0.0088, 0], - "109": [0, 0.44444, 0, 0], - "110": [0, 0.44444, 0, 0], - "111": [0, 0.44444, 0, 0], - "112": [0.19444, 0.44444, 0, 0], - "113": [0.19444, 0.44444, 0.03704, 0], - "114": [0, 0.44444, 0.03194, 0], - "115": [0, 0.44444, 0, 0], - "116": [0, 0.63492, 0, 0], - "117": [0, 0.44444, 0, 0], - "118": [0, 0.44444, 0.03704, 0], - "119": [0, 0.44444, 0.02778, 0], - "120": [0, 0.44444, 0, 0], - "121": [0.19444, 0.44444, 0.03704, 0], - "122": [0, 0.44444, 0.04213, 0], - "915": [0, 0.68611, 0.15972, 0], - "916": [0, 0.68611, 0, 0], - "920": [0, 0.68611, 0.03194, 0], - "923": [0, 0.68611, 0, 0], - "926": [0, 0.68611, 0.07458, 0], - "928": [0, 0.68611, 0.08229, 0], - "931": [0, 0.68611, 0.05451, 0], - "933": [0, 0.68611, 0.15972, 0], - "934": [0, 0.68611, 0, 0], - "936": [0, 0.68611, 0.11653, 0], - "937": [0, 0.68611, 0.04835, 0], - "945": [0, 0.44444, 0, 0], - "946": [0.19444, 0.69444, 0.03403, 0], - "947": [0.19444, 0.44444, 0.06389, 0], - "948": [0, 0.69444, 0.03819, 0], - "949": [0, 0.44444, 0, 0], - "950": [0.19444, 0.69444, 0.06215, 0], - "951": [0.19444, 0.44444, 0.03704, 0], - "952": [0, 0.69444, 0.03194, 0], - "953": [0, 0.44444, 0, 0], - "954": [0, 0.44444, 0, 0], - "955": [0, 0.69444, 0, 0], - "956": [0.19444, 0.44444, 0, 0], - "957": [0, 0.44444, 0.06898, 0], - "958": [0.19444, 0.69444, 0.03021, 0], - "959": [0, 0.44444, 0, 0], - "960": [0, 0.44444, 0.03704, 0], - "961": [0.19444, 0.44444, 0, 0], - "962": [0.09722, 0.44444, 0.07917, 0], - "963": [0, 0.44444, 0.03704, 0], - "964": [0, 0.44444, 0.13472, 0], - "965": [0, 0.44444, 0.03704, 0], - "966": [0.19444, 0.44444, 0, 0], - "967": [0.19444, 0.44444, 0, 0], - "968": [0.19444, 0.69444, 0.03704, 0], - "969": [0, 0.44444, 0.03704, 0], - "977": [0, 0.69444, 0, 0], - "981": [0.19444, 0.69444, 0, 0], - "982": [0, 0.44444, 0.03194, 0], - "1009": [0.19444, 0.44444, 0, 0], - "1013": [0, 0.44444, 0, 0] - }, - "Math-Italic": { - "47": [0.19444, 0.69444, 0, 0], - "65": [0, 0.68333, 0, 0.13889], - "66": [0, 0.68333, 0.05017, 0.08334], - "67": [0, 0.68333, 0.07153, 0.08334], - "68": [0, 0.68333, 0.02778, 0.05556], - "69": [0, 0.68333, 0.05764, 0.08334], - "70": [0, 0.68333, 0.13889, 0.08334], - "71": [0, 0.68333, 0, 0.08334], - "72": [0, 0.68333, 0.08125, 0.05556], - "73": [0, 0.68333, 0.07847, 0.11111], - "74": [0, 0.68333, 0.09618, 0.16667], - "75": [0, 0.68333, 0.07153, 0.05556], - "76": [0, 0.68333, 0, 0.02778], - "77": [0, 0.68333, 0.10903, 0.08334], - "78": [0, 0.68333, 0.10903, 0.08334], - "79": [0, 0.68333, 0.02778, 0.08334], - "80": [0, 0.68333, 0.13889, 0.08334], - "81": [0.19444, 0.68333, 0, 0.08334], - "82": [0, 0.68333, 0.00773, 0.08334], - "83": [0, 0.68333, 0.05764, 0.08334], - "84": [0, 0.68333, 0.13889, 0.08334], - "85": [0, 0.68333, 0.10903, 0.02778], - "86": [0, 0.68333, 0.22222, 0], - "87": [0, 0.68333, 0.13889, 0], - "88": [0, 0.68333, 0.07847, 0.08334], - "89": [0, 0.68333, 0.22222, 0], - "90": [0, 0.68333, 0.07153, 0.08334], - "97": [0, 0.43056, 0, 0], - "98": [0, 0.69444, 0, 0], - "99": [0, 0.43056, 0, 0.05556], - "100": [0, 0.69444, 0, 0.16667], - "101": [0, 0.43056, 0, 0.05556], - "102": [0.19444, 0.69444, 0.10764, 0.16667], - "103": [0.19444, 0.43056, 0.03588, 0.02778], - "104": [0, 0.69444, 0, 0], - "105": [0, 0.65952, 0, 0], - "106": [0.19444, 0.65952, 0.05724, 0], - "107": [0, 0.69444, 0.03148, 0], - "108": [0, 0.69444, 0.01968, 0.08334], - "109": [0, 0.43056, 0, 0], - "110": [0, 0.43056, 0, 0], - "111": [0, 0.43056, 0, 0.05556], - "112": [0.19444, 0.43056, 0, 0.08334], - "113": [0.19444, 0.43056, 0.03588, 0.08334], - "114": [0, 0.43056, 0.02778, 0.05556], - "115": [0, 0.43056, 0, 0.05556], - "116": [0, 0.61508, 0, 0.08334], - "117": [0, 0.43056, 0, 0.02778], - "118": [0, 0.43056, 0.03588, 0.02778], - "119": [0, 0.43056, 0.02691, 0.08334], - "120": [0, 0.43056, 0, 0.02778], - "121": [0.19444, 0.43056, 0.03588, 0.05556], - "122": [0, 0.43056, 0.04398, 0.05556], - "915": [0, 0.68333, 0.13889, 0.08334], - "916": [0, 0.68333, 0, 0.16667], - "920": [0, 0.68333, 0.02778, 0.08334], - "923": [0, 0.68333, 0, 0.16667], - "926": [0, 0.68333, 0.07569, 0.08334], - "928": [0, 0.68333, 0.08125, 0.05556], - "931": [0, 0.68333, 0.05764, 0.08334], - "933": [0, 0.68333, 0.13889, 0.05556], - "934": [0, 0.68333, 0, 0.08334], - "936": [0, 0.68333, 0.11, 0.05556], - "937": [0, 0.68333, 0.05017, 0.08334], - "945": [0, 0.43056, 0.0037, 0.02778], - "946": [0.19444, 0.69444, 0.05278, 0.08334], - "947": [0.19444, 0.43056, 0.05556, 0], - "948": [0, 0.69444, 0.03785, 0.05556], - "949": [0, 0.43056, 0, 0.08334], - "950": [0.19444, 0.69444, 0.07378, 0.08334], - "951": [0.19444, 0.43056, 0.03588, 0.05556], - "952": [0, 0.69444, 0.02778, 0.08334], - "953": [0, 0.43056, 0, 0.05556], - "954": [0, 0.43056, 0, 0], - "955": [0, 0.69444, 0, 0], - "956": [0.19444, 0.43056, 0, 0.02778], - "957": [0, 0.43056, 0.06366, 0.02778], - "958": [0.19444, 0.69444, 0.04601, 0.11111], - "959": [0, 0.43056, 0, 0.05556], - "960": [0, 0.43056, 0.03588, 0], - "961": [0.19444, 0.43056, 0, 0.08334], - "962": [0.09722, 0.43056, 0.07986, 0.08334], - "963": [0, 0.43056, 0.03588, 0], - "964": [0, 0.43056, 0.1132, 0.02778], - "965": [0, 0.43056, 0.03588, 0.02778], - "966": [0.19444, 0.43056, 0, 0.08334], - "967": [0.19444, 0.43056, 0, 0.05556], - "968": [0.19444, 0.69444, 0.03588, 0.11111], - "969": [0, 0.43056, 0.03588, 0], - "977": [0, 0.69444, 0, 0.08334], - "981": [0.19444, 0.69444, 0, 0.08334], - "982": [0, 0.43056, 0.02778, 0], - "1009": [0.19444, 0.43056, 0, 0.08334], - "1013": [0, 0.43056, 0, 0.05556] - }, - "Math-Regular": { - "65": [0, 0.68333, 0, 0.13889], - "66": [0, 0.68333, 0.05017, 0.08334], - "67": [0, 0.68333, 0.07153, 0.08334], - "68": [0, 0.68333, 0.02778, 0.05556], - "69": [0, 0.68333, 0.05764, 0.08334], - "70": [0, 0.68333, 0.13889, 0.08334], - "71": [0, 0.68333, 0, 0.08334], - "72": [0, 0.68333, 0.08125, 0.05556], - "73": [0, 0.68333, 0.07847, 0.11111], - "74": [0, 0.68333, 0.09618, 0.16667], - "75": [0, 0.68333, 0.07153, 0.05556], - "76": [0, 0.68333, 0, 0.02778], - "77": [0, 0.68333, 0.10903, 0.08334], - "78": [0, 0.68333, 0.10903, 0.08334], - "79": [0, 0.68333, 0.02778, 0.08334], - "80": [0, 0.68333, 0.13889, 0.08334], - "81": [0.19444, 0.68333, 0, 0.08334], - "82": [0, 0.68333, 0.00773, 0.08334], - "83": [0, 0.68333, 0.05764, 0.08334], - "84": [0, 0.68333, 0.13889, 0.08334], - "85": [0, 0.68333, 0.10903, 0.02778], - "86": [0, 0.68333, 0.22222, 0], - "87": [0, 0.68333, 0.13889, 0], - "88": [0, 0.68333, 0.07847, 0.08334], - "89": [0, 0.68333, 0.22222, 0], - "90": [0, 0.68333, 0.07153, 0.08334], - "97": [0, 0.43056, 0, 0], - "98": [0, 0.69444, 0, 0], - "99": [0, 0.43056, 0, 0.05556], - "100": [0, 0.69444, 0, 0.16667], - "101": [0, 0.43056, 0, 0.05556], - "102": [0.19444, 0.69444, 0.10764, 0.16667], - "103": [0.19444, 0.43056, 0.03588, 0.02778], - "104": [0, 0.69444, 0, 0], - "105": [0, 0.65952, 0, 0], - "106": [0.19444, 0.65952, 0.05724, 0], - "107": [0, 0.69444, 0.03148, 0], - "108": [0, 0.69444, 0.01968, 0.08334], - "109": [0, 0.43056, 0, 0], - "110": [0, 0.43056, 0, 0], - "111": [0, 0.43056, 0, 0.05556], - "112": [0.19444, 0.43056, 0, 0.08334], - "113": [0.19444, 0.43056, 0.03588, 0.08334], - "114": [0, 0.43056, 0.02778, 0.05556], - "115": [0, 0.43056, 0, 0.05556], - "116": [0, 0.61508, 0, 0.08334], - "117": [0, 0.43056, 0, 0.02778], - "118": [0, 0.43056, 0.03588, 0.02778], - "119": [0, 0.43056, 0.02691, 0.08334], - "120": [0, 0.43056, 0, 0.02778], - "121": [0.19444, 0.43056, 0.03588, 0.05556], - "122": [0, 0.43056, 0.04398, 0.05556], - "915": [0, 0.68333, 0.13889, 0.08334], - "916": [0, 0.68333, 0, 0.16667], - "920": [0, 0.68333, 0.02778, 0.08334], - "923": [0, 0.68333, 0, 0.16667], - "926": [0, 0.68333, 0.07569, 0.08334], - "928": [0, 0.68333, 0.08125, 0.05556], - "931": [0, 0.68333, 0.05764, 0.08334], - "933": [0, 0.68333, 0.13889, 0.05556], - "934": [0, 0.68333, 0, 0.08334], - "936": [0, 0.68333, 0.11, 0.05556], - "937": [0, 0.68333, 0.05017, 0.08334], - "945": [0, 0.43056, 0.0037, 0.02778], - "946": [0.19444, 0.69444, 0.05278, 0.08334], - "947": [0.19444, 0.43056, 0.05556, 0], - "948": [0, 0.69444, 0.03785, 0.05556], - "949": [0, 0.43056, 0, 0.08334], - "950": [0.19444, 0.69444, 0.07378, 0.08334], - "951": [0.19444, 0.43056, 0.03588, 0.05556], - "952": [0, 0.69444, 0.02778, 0.08334], - "953": [0, 0.43056, 0, 0.05556], - "954": [0, 0.43056, 0, 0], - "955": [0, 0.69444, 0, 0], - "956": [0.19444, 0.43056, 0, 0.02778], - "957": [0, 0.43056, 0.06366, 0.02778], - "958": [0.19444, 0.69444, 0.04601, 0.11111], - "959": [0, 0.43056, 0, 0.05556], - "960": [0, 0.43056, 0.03588, 0], - "961": [0.19444, 0.43056, 0, 0.08334], - "962": [0.09722, 0.43056, 0.07986, 0.08334], - "963": [0, 0.43056, 0.03588, 0], - "964": [0, 0.43056, 0.1132, 0.02778], - "965": [0, 0.43056, 0.03588, 0.02778], - "966": [0.19444, 0.43056, 0, 0.08334], - "967": [0.19444, 0.43056, 0, 0.05556], - "968": [0.19444, 0.69444, 0.03588, 0.11111], - "969": [0, 0.43056, 0.03588, 0], - "977": [0, 0.69444, 0, 0.08334], - "981": [0.19444, 0.69444, 0, 0.08334], - "982": [0, 0.43056, 0.02778, 0], - "1009": [0.19444, 0.43056, 0, 0.08334], - "1013": [0, 0.43056, 0, 0.05556] - }, - "SansSerif-Regular": { - "33": [0, 0.69444, 0, 0], - "34": [0, 0.69444, 0, 0], - "35": [0.19444, 0.69444, 0, 0], - "36": [0.05556, 0.75, 0, 0], - "37": [0.05556, 0.75, 0, 0], - "38": [0, 0.69444, 0, 0], - "39": [0, 0.69444, 0, 0], - "40": [0.25, 0.75, 0, 0], - "41": [0.25, 0.75, 0, 0], - "42": [0, 0.75, 0, 0], - "43": [0.08333, 0.58333, 0, 0], - "44": [0.125, 0.08333, 0, 0], - "45": [0, 0.44444, 0, 0], - "46": [0, 0.08333, 0, 0], - "47": [0.25, 0.75, 0, 0], - "48": [0, 0.65556, 0, 0], - "49": [0, 0.65556, 0, 0], - "50": [0, 0.65556, 0, 0], - "51": [0, 0.65556, 0, 0], - "52": [0, 0.65556, 0, 0], - "53": [0, 0.65556, 0, 0], - "54": [0, 0.65556, 0, 0], - "55": [0, 0.65556, 0, 0], - "56": [0, 0.65556, 0, 0], - "57": [0, 0.65556, 0, 0], - "58": [0, 0.44444, 0, 0], - "59": [0.125, 0.44444, 0, 0], - "61": [-0.13, 0.37, 0, 0], - "63": [0, 0.69444, 0, 0], - "64": [0, 0.69444, 0, 0], - "65": [0, 0.69444, 0, 0], - "66": [0, 0.69444, 0, 0], - "67": [0, 0.69444, 0, 0], - "68": [0, 0.69444, 0, 0], - "69": [0, 0.69444, 0, 0], - "70": [0, 0.69444, 0, 0], - "71": [0, 0.69444, 0, 0], - "72": [0, 0.69444, 0, 0], - "73": [0, 0.69444, 0, 0], - "74": [0, 0.69444, 0, 0], - "75": [0, 0.69444, 0, 0], - "76": [0, 0.69444, 0, 0], - "77": [0, 0.69444, 0, 0], - "78": [0, 0.69444, 0, 0], - "79": [0, 0.69444, 0, 0], - "80": [0, 0.69444, 0, 0], - "81": [0.125, 0.69444, 0, 0], - "82": [0, 0.69444, 0, 0], - "83": [0, 0.69444, 0, 0], - "84": [0, 0.69444, 0, 0], - "85": [0, 0.69444, 0, 0], - "86": [0, 0.69444, 0.01389, 0], - "87": [0, 0.69444, 0.01389, 0], - "88": [0, 0.69444, 0, 0], - "89": [0, 0.69444, 0.025, 0], - "90": [0, 0.69444, 0, 0], - "91": [0.25, 0.75, 0, 0], - "93": [0.25, 0.75, 0, 0], - "94": [0, 0.69444, 0, 0], - "95": [0.35, 0.09444, 0.02778, 0], - "97": [0, 0.44444, 0, 0], - "98": [0, 0.69444, 0, 0], - "99": [0, 0.44444, 0, 0], - "100": [0, 0.69444, 0, 0], - "101": [0, 0.44444, 0, 0], - "102": [0, 0.69444, 0.06944, 0], - "103": [0.19444, 0.44444, 0.01389, 0], - "104": [0, 0.69444, 0, 0], - "105": [0, 0.67937, 0, 0], - "106": [0.19444, 0.67937, 0, 0], - "107": [0, 0.69444, 0, 0], - "108": [0, 0.69444, 0, 0], - "109": [0, 0.44444, 0, 0], - "110": [0, 0.44444, 0, 0], - "111": [0, 0.44444, 0, 0], - "112": [0.19444, 0.44444, 0, 0], - "113": [0.19444, 0.44444, 0, 0], - "114": [0, 0.44444, 0.01389, 0], - "115": [0, 0.44444, 0, 0], - "116": [0, 0.57143, 0, 0], - "117": [0, 0.44444, 0, 0], - "118": [0, 0.44444, 0.01389, 0], - "119": [0, 0.44444, 0.01389, 0], - "120": [0, 0.44444, 0, 0], - "121": [0.19444, 0.44444, 0.01389, 0], - "122": [0, 0.44444, 0, 0], - "126": [0.35, 0.32659, 0, 0], - "305": [0, 0.44444, 0, 0], - "567": [0.19444, 0.44444, 0, 0], - "768": [0, 0.69444, 0, 0], - "769": [0, 0.69444, 0, 0], - "770": [0, 0.69444, 0, 0], - "771": [0, 0.67659, 0, 0], - "772": [0, 0.60889, 0, 0], - "774": [0, 0.69444, 0, 0], - "775": [0, 0.67937, 0, 0], - "776": [0, 0.67937, 0, 0], - "778": [0, 0.69444, 0, 0], - "779": [0, 0.69444, 0, 0], - "780": [0, 0.63194, 0, 0], - "915": [0, 0.69444, 0, 0], - "916": [0, 0.69444, 0, 0], - "920": [0, 0.69444, 0, 0], - "923": [0, 0.69444, 0, 0], - "926": [0, 0.69444, 0, 0], - "928": [0, 0.69444, 0, 0], - "931": [0, 0.69444, 0, 0], - "933": [0, 0.69444, 0, 0], - "934": [0, 0.69444, 0, 0], - "936": [0, 0.69444, 0, 0], - "937": [0, 0.69444, 0, 0], - "8211": [0, 0.44444, 0.02778, 0], - "8212": [0, 0.44444, 0.02778, 0], - "8216": [0, 0.69444, 0, 0], - "8217": [0, 0.69444, 0, 0], - "8220": [0, 0.69444, 0, 0], - "8221": [0, 0.69444, 0, 0] - }, - "Script-Regular": { - "65": [0, 0.7, 0.22925, 0], - "66": [0, 0.7, 0.04087, 0], - "67": [0, 0.7, 0.1689, 0], - "68": [0, 0.7, 0.09371, 0], - "69": [0, 0.7, 0.18583, 0], - "70": [0, 0.7, 0.13634, 0], - "71": [0, 0.7, 0.17322, 0], - "72": [0, 0.7, 0.29694, 0], - "73": [0, 0.7, 0.19189, 0], - "74": [0.27778, 0.7, 0.19189, 0], - "75": [0, 0.7, 0.31259, 0], - "76": [0, 0.7, 0.19189, 0], - "77": [0, 0.7, 0.15981, 0], - "78": [0, 0.7, 0.3525, 0], - "79": [0, 0.7, 0.08078, 0], - "80": [0, 0.7, 0.08078, 0], - "81": [0, 0.7, 0.03305, 0], - "82": [0, 0.7, 0.06259, 0], - "83": [0, 0.7, 0.19189, 0], - "84": [0, 0.7, 0.29087, 0], - "85": [0, 0.7, 0.25815, 0], - "86": [0, 0.7, 0.27523, 0], - "87": [0, 0.7, 0.27523, 0], - "88": [0, 0.7, 0.26006, 0], - "89": [0, 0.7, 0.2939, 0], - "90": [0, 0.7, 0.24037, 0] - }, - "Size1-Regular": { - "40": [0.35001, 0.85, 0, 0], - "41": [0.35001, 0.85, 0, 0], - "47": [0.35001, 0.85, 0, 0], - "91": [0.35001, 0.85, 0, 0], - "92": [0.35001, 0.85, 0, 0], - "93": [0.35001, 0.85, 0, 0], - "123": [0.35001, 0.85, 0, 0], - "125": [0.35001, 0.85, 0, 0], - "710": [0, 0.72222, 0, 0], - "732": [0, 0.72222, 0, 0], - "770": [0, 0.72222, 0, 0], - "771": [0, 0.72222, 0, 0], - "8214": [-0.00099, 0.601, 0, 0], - "8593": [1e-05, 0.6, 0, 0], - "8595": [1e-05, 0.6, 0, 0], - "8657": [1e-05, 0.6, 0, 0], - "8659": [1e-05, 0.6, 0, 0], - "8719": [0.25001, 0.75, 0, 0], - "8720": [0.25001, 0.75, 0, 0], - "8721": [0.25001, 0.75, 0, 0], - "8730": [0.35001, 0.85, 0, 0], - "8739": [-0.00599, 0.606, 0, 0], - "8741": [-0.00599, 0.606, 0, 0], - "8747": [0.30612, 0.805, 0.19445, 0], - "8748": [0.306, 0.805, 0.19445, 0], - "8749": [0.306, 0.805, 0.19445, 0], - "8750": [0.30612, 0.805, 0.19445, 0], - "8896": [0.25001, 0.75, 0, 0], - "8897": [0.25001, 0.75, 0, 0], - "8898": [0.25001, 0.75, 0, 0], - "8899": [0.25001, 0.75, 0, 0], - "8968": [0.35001, 0.85, 0, 0], - "8969": [0.35001, 0.85, 0, 0], - "8970": [0.35001, 0.85, 0, 0], - "8971": [0.35001, 0.85, 0, 0], - "9168": [-0.00099, 0.601, 0, 0], - "10216": [0.35001, 0.85, 0, 0], - "10217": [0.35001, 0.85, 0, 0], - "10752": [0.25001, 0.75, 0, 0], - "10753": [0.25001, 0.75, 0, 0], - "10754": [0.25001, 0.75, 0, 0], - "10756": [0.25001, 0.75, 0, 0], - "10758": [0.25001, 0.75, 0, 0] - }, - "Size2-Regular": { - "40": [0.65002, 1.15, 0, 0], - "41": [0.65002, 1.15, 0, 0], - "47": [0.65002, 1.15, 0, 0], - "91": [0.65002, 1.15, 0, 0], - "92": [0.65002, 1.15, 0, 0], - "93": [0.65002, 1.15, 0, 0], - "123": [0.65002, 1.15, 0, 0], - "125": [0.65002, 1.15, 0, 0], - "710": [0, 0.75, 0, 0], - "732": [0, 0.75, 0, 0], - "770": [0, 0.75, 0, 0], - "771": [0, 0.75, 0, 0], - "8719": [0.55001, 1.05, 0, 0], - "8720": [0.55001, 1.05, 0, 0], - "8721": [0.55001, 1.05, 0, 0], - "8730": [0.65002, 1.15, 0, 0], - "8747": [0.86225, 1.36, 0.44445, 0], - "8748": [0.862, 1.36, 0.44445, 0], - "8749": [0.862, 1.36, 0.44445, 0], - "8750": [0.86225, 1.36, 0.44445, 0], - "8896": [0.55001, 1.05, 0, 0], - "8897": [0.55001, 1.05, 0, 0], - "8898": [0.55001, 1.05, 0, 0], - "8899": [0.55001, 1.05, 0, 0], - "8968": [0.65002, 1.15, 0, 0], - "8969": [0.65002, 1.15, 0, 0], - "8970": [0.65002, 1.15, 0, 0], - "8971": [0.65002, 1.15, 0, 0], - "10216": [0.65002, 1.15, 0, 0], - "10217": [0.65002, 1.15, 0, 0], - "10752": [0.55001, 1.05, 0, 0], - "10753": [0.55001, 1.05, 0, 0], - "10754": [0.55001, 1.05, 0, 0], - "10756": [0.55001, 1.05, 0, 0], - "10758": [0.55001, 1.05, 0, 0] - }, - "Size3-Regular": { - "40": [0.95003, 1.45, 0, 0], - "41": [0.95003, 1.45, 0, 0], - "47": [0.95003, 1.45, 0, 0], - "91": [0.95003, 1.45, 0, 0], - "92": [0.95003, 1.45, 0, 0], - "93": [0.95003, 1.45, 0, 0], - "123": [0.95003, 1.45, 0, 0], - "125": [0.95003, 1.45, 0, 0], - "710": [0, 0.75, 0, 0], - "732": [0, 0.75, 0, 0], - "770": [0, 0.75, 0, 0], - "771": [0, 0.75, 0, 0], - "8730": [0.95003, 1.45, 0, 0], - "8968": [0.95003, 1.45, 0, 0], - "8969": [0.95003, 1.45, 0, 0], - "8970": [0.95003, 1.45, 0, 0], - "8971": [0.95003, 1.45, 0, 0], - "10216": [0.95003, 1.45, 0, 0], - "10217": [0.95003, 1.45, 0, 0] - }, - "Size4-Regular": { - "40": [1.25003, 1.75, 0, 0], - "41": [1.25003, 1.75, 0, 0], - "47": [1.25003, 1.75, 0, 0], - "91": [1.25003, 1.75, 0, 0], - "92": [1.25003, 1.75, 0, 0], - "93": [1.25003, 1.75, 0, 0], - "123": [1.25003, 1.75, 0, 0], - "125": [1.25003, 1.75, 0, 0], - "710": [0, 0.825, 0, 0], - "732": [0, 0.825, 0, 0], - "770": [0, 0.825, 0, 0], - "771": [0, 0.825, 0, 0], - "8730": [1.25003, 1.75, 0, 0], - "8968": [1.25003, 1.75, 0, 0], - "8969": [1.25003, 1.75, 0, 0], - "8970": [1.25003, 1.75, 0, 0], - "8971": [1.25003, 1.75, 0, 0], - "9115": [0.64502, 1.155, 0, 0], - "9116": [1e-05, 0.6, 0, 0], - "9117": [0.64502, 1.155, 0, 0], - "9118": [0.64502, 1.155, 0, 0], - "9119": [1e-05, 0.6, 0, 0], - "9120": [0.64502, 1.155, 0, 0], - "9121": [0.64502, 1.155, 0, 0], - "9122": [-0.00099, 0.601, 0, 0], - "9123": [0.64502, 1.155, 0, 0], - "9124": [0.64502, 1.155, 0, 0], - "9125": [-0.00099, 0.601, 0, 0], - "9126": [0.64502, 1.155, 0, 0], - "9127": [1e-05, 0.9, 0, 0], - "9128": [0.65002, 1.15, 0, 0], - "9129": [0.90001, 0, 0, 0], - "9130": [0, 0.3, 0, 0], - "9131": [1e-05, 0.9, 0, 0], - "9132": [0.65002, 1.15, 0, 0], - "9133": [0.90001, 0, 0, 0], - "9143": [0.88502, 0.915, 0, 0], - "10216": [1.25003, 1.75, 0, 0], - "10217": [1.25003, 1.75, 0, 0], - "57344": [-0.00499, 0.605, 0, 0], - "57345": [-0.00499, 0.605, 0, 0], - "57680": [0, 0.12, 0, 0], - "57681": [0, 0.12, 0, 0], - "57682": [0, 0.12, 0, 0], - "57683": [0, 0.12, 0, 0] - }, - "Typewriter-Regular": { - "33": [0, 0.61111, 0, 0], - "34": [0, 0.61111, 0, 0], - "35": [0, 0.61111, 0, 0], - "36": [0.08333, 0.69444, 0, 0], - "37": [0.08333, 0.69444, 0, 0], - "38": [0, 0.61111, 0, 0], - "39": [0, 0.61111, 0, 0], - "40": [0.08333, 0.69444, 0, 0], - "41": [0.08333, 0.69444, 0, 0], - "42": [0, 0.52083, 0, 0], - "43": [-0.08056, 0.53055, 0, 0], - "44": [0.13889, 0.125, 0, 0], - "45": [-0.08056, 0.53055, 0, 0], - "46": [0, 0.125, 0, 0], - "47": [0.08333, 0.69444, 0, 0], - "48": [0, 0.61111, 0, 0], - "49": [0, 0.61111, 0, 0], - "50": [0, 0.61111, 0, 0], - "51": [0, 0.61111, 0, 0], - "52": [0, 0.61111, 0, 0], - "53": [0, 0.61111, 0, 0], - "54": [0, 0.61111, 0, 0], - "55": [0, 0.61111, 0, 0], - "56": [0, 0.61111, 0, 0], - "57": [0, 0.61111, 0, 0], - "58": [0, 0.43056, 0, 0], - "59": [0.13889, 0.43056, 0, 0], - "60": [-0.05556, 0.55556, 0, 0], - "61": [-0.19549, 0.41562, 0, 0], - "62": [-0.05556, 0.55556, 0, 0], - "63": [0, 0.61111, 0, 0], - "64": [0, 0.61111, 0, 0], - "65": [0, 0.61111, 0, 0], - "66": [0, 0.61111, 0, 0], - "67": [0, 0.61111, 0, 0], - "68": [0, 0.61111, 0, 0], - "69": [0, 0.61111, 0, 0], - "70": [0, 0.61111, 0, 0], - "71": [0, 0.61111, 0, 0], - "72": [0, 0.61111, 0, 0], - "73": [0, 0.61111, 0, 0], - "74": [0, 0.61111, 0, 0], - "75": [0, 0.61111, 0, 0], - "76": [0, 0.61111, 0, 0], - "77": [0, 0.61111, 0, 0], - "78": [0, 0.61111, 0, 0], - "79": [0, 0.61111, 0, 0], - "80": [0, 0.61111, 0, 0], - "81": [0.13889, 0.61111, 0, 0], - "82": [0, 0.61111, 0, 0], - "83": [0, 0.61111, 0, 0], - "84": [0, 0.61111, 0, 0], - "85": [0, 0.61111, 0, 0], - "86": [0, 0.61111, 0, 0], - "87": [0, 0.61111, 0, 0], - "88": [0, 0.61111, 0, 0], - "89": [0, 0.61111, 0, 0], - "90": [0, 0.61111, 0, 0], - "91": [0.08333, 0.69444, 0, 0], - "92": [0.08333, 0.69444, 0, 0], - "93": [0.08333, 0.69444, 0, 0], - "94": [0, 0.61111, 0, 0], - "95": [0.09514, 0, 0, 0], - "96": [0, 0.61111, 0, 0], - "97": [0, 0.43056, 0, 0], - "98": [0, 0.61111, 0, 0], - "99": [0, 0.43056, 0, 0], - "100": [0, 0.61111, 0, 0], - "101": [0, 0.43056, 0, 0], - "102": [0, 0.61111, 0, 0], - "103": [0.22222, 0.43056, 0, 0], - "104": [0, 0.61111, 0, 0], - "105": [0, 0.61111, 0, 0], - "106": [0.22222, 0.61111, 0, 0], - "107": [0, 0.61111, 0, 0], - "108": [0, 0.61111, 0, 0], - "109": [0, 0.43056, 0, 0], - "110": [0, 0.43056, 0, 0], - "111": [0, 0.43056, 0, 0], - "112": [0.22222, 0.43056, 0, 0], - "113": [0.22222, 0.43056, 0, 0], - "114": [0, 0.43056, 0, 0], - "115": [0, 0.43056, 0, 0], - "116": [0, 0.55358, 0, 0], - "117": [0, 0.43056, 0, 0], - "118": [0, 0.43056, 0, 0], - "119": [0, 0.43056, 0, 0], - "120": [0, 0.43056, 0, 0], - "121": [0.22222, 0.43056, 0, 0], - "122": [0, 0.43056, 0, 0], - "123": [0.08333, 0.69444, 0, 0], - "124": [0.08333, 0.69444, 0, 0], - "125": [0.08333, 0.69444, 0, 0], - "126": [0, 0.61111, 0, 0], - "127": [0, 0.61111, 0, 0], - "305": [0, 0.43056, 0, 0], - "567": [0.22222, 0.43056, 0, 0], - "768": [0, 0.61111, 0, 0], - "769": [0, 0.61111, 0, 0], - "770": [0, 0.61111, 0, 0], - "771": [0, 0.61111, 0, 0], - "772": [0, 0.56555, 0, 0], - "774": [0, 0.61111, 0, 0], - "776": [0, 0.61111, 0, 0], - "778": [0, 0.61111, 0, 0], - "780": [0, 0.56597, 0, 0], - "915": [0, 0.61111, 0, 0], - "916": [0, 0.61111, 0, 0], - "920": [0, 0.61111, 0, 0], - "923": [0, 0.61111, 0, 0], - "926": [0, 0.61111, 0, 0], - "928": [0, 0.61111, 0, 0], - "931": [0, 0.61111, 0, 0], - "933": [0, 0.61111, 0, 0], - "934": [0, 0.61111, 0, 0], - "936": [0, 0.61111, 0, 0], - "937": [0, 0.61111, 0, 0], - "2018": [0, 0.61111, 0, 0], - "2019": [0, 0.61111, 0, 0], - "8216": [0, 0.61111, 0, 0], - "8217": [0, 0.61111, 0, 0], - "8242": [0, 0.61111, 0, 0], - "9251": [0.11111, 0.21944, 0, 0] - } -}; - -exports.default = fontMetricsData; - -},{}],103:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _utils = require("./utils"); - -var _utils2 = _interopRequireDefault(_utils); - -var _ParseError = require("./ParseError"); - -var _ParseError2 = _interopRequireDefault(_ParseError); - -var _ParseNode = require("./ParseNode"); - -var _ParseNode2 = _interopRequireDefault(_ParseNode); - -var _defineFunction2 = require("./defineFunction"); - -var _defineFunction3 = _interopRequireDefault(_defineFunction2); - -require("./functions/color"); - -require("./functions/text"); - -require("./functions/overline"); - -require("./functions/underline"); - -require("./functions/rule"); - -require("./functions/kern"); - -require("./functions/phantom"); - -require("./functions/mod"); - -require("./functions/op"); - -require("./functions/operatorname"); - -require("./functions/genfrac"); - -require("./functions/lap"); - -require("./functions/smash"); - -require("./functions/delimsizing"); - -require("./functions/href"); - -require("./functions/mathchoice"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// WARNING: New functions should be added to src/functions and imported here. - -/** Include this to ensure that all functions are defined. */ -var functions = _defineFunction2._functions; -exports.default = functions; - -// Define a convenience function that mimcs the old semantics of defineFunction -// to support existing code so that we can migrate it a little bit at a time. - -var defineFunction = function defineFunction(names, props, handler) // null only if handled in parser -{ - (0, _defineFunction3.default)({ names: names, props: props, handler: handler }); -}; - -// A normal square root -defineFunction(["\\sqrt"], { - numArgs: 1, - numOptionalArgs: 1 -}, function (context, args, optArgs) { - var index = optArgs[0]; - var body = args[0]; - return { - type: "sqrt", - body: body, - index: index - }; -}); - -// \color is handled in Parser.js's parseImplicitGroup -defineFunction(["\\color"], { - numArgs: 1, - allowedInText: true, - greediness: 3, - argTypes: ["color"] -}, null); - -// colorbox -defineFunction(["\\colorbox"], { - numArgs: 2, - allowedInText: true, - greediness: 3, - argTypes: ["color", "text"] -}, function (context, args) { - var color = args[0]; - var body = args[1]; - return { - type: "enclose", - label: context.funcName, - backgroundColor: color, - body: body - }; -}); - -// fcolorbox -defineFunction(["\\fcolorbox"], { - numArgs: 3, - allowedInText: true, - greediness: 3, - argTypes: ["color", "color", "text"] -}, function (context, args) { - var borderColor = args[0]; - var backgroundColor = args[1]; - var body = args[2]; - return { - type: "enclose", - label: context.funcName, - backgroundColor: backgroundColor, - borderColor: borderColor, - body: body - }; -}); - -// Math class commands except \mathop -defineFunction(["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], { - numArgs: 1 -}, function (context, args) { - var body = args[0]; - return { - type: "mclass", - mclass: "m" + context.funcName.substr(5), - value: (0, _defineFunction2.ordargument)(body) - }; -}); - -// Build a relation by placing one symbol on top of another -defineFunction(["\\stackrel"], { - numArgs: 2 -}, function (context, args) { - var top = args[0]; - var bottom = args[1]; - - var bottomop = new _ParseNode2.default("op", { - type: "op", - limits: true, - alwaysHandleSupSub: true, - symbol: false, - value: (0, _defineFunction2.ordargument)(bottom) - }, bottom.mode); - - var supsub = new _ParseNode2.default("supsub", { - base: bottomop, - sup: top, - sub: null - }, top.mode); - - return { - type: "mclass", - mclass: "mrel", - value: [supsub] - }; -}); - -var fontAliases = { - "\\Bbb": "\\mathbb", - "\\bold": "\\mathbf", - "\\frak": "\\mathfrak" -}; - -var singleCharIntegrals = { - "\u222B": "\\int", - "\u222C": "\\iint", - "\u222D": "\\iiint", - "\u222E": "\\oint" -}; - -// There are 2 flags for operators; whether they produce limits in -// displaystyle, and whether they are symbols and should grow in -// displaystyle. These four groups cover the four possible choices. - -// No limits, not symbols -defineFunction(["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"], { - numArgs: 0 -}, function (context) { - return { - type: "op", - limits: false, - symbol: false, - body: context.funcName - }; -}); - -// Limits, not symbols -defineFunction(["\\det", "\\gcd", "\\inf", "\\lim", "\\liminf", "\\limsup", "\\max", "\\min", "\\Pr", "\\sup"], { - numArgs: 0 -}, function (context) { - return { - type: "op", - limits: true, - symbol: false, - body: context.funcName - }; -}); - -// No limits, symbols -defineFunction(["\\int", "\\iint", "\\iiint", "\\oint", "\u222B", "\u222C", "\u222D", "\u222E"], { - numArgs: 0 -}, function (context) { - var fName = context.funcName; - if (fName.length === 1) { - fName = singleCharIntegrals[fName]; - } - return { - type: "op", - limits: false, - symbol: true, - body: fName - }; -}); - -// Sizing functions (handled in Parser.js explicitly, hence no handler) -defineFunction(["\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"], { numArgs: 0 }, null); - -// Style changing functions (handled in Parser.js explicitly, hence no -// handler) -defineFunction(["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], { numArgs: 0 }, null); - -// Old font changing functions -defineFunction(["\\rm", "\\sf", "\\tt", "\\bf", "\\it"], { numArgs: 0 }, null); - -defineFunction([ -// styles -"\\mathrm", "\\mathit", "\\mathbf", - -// families -"\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt", - -// aliases -"\\Bbb", "\\bold", "\\frak"], { - numArgs: 1, - greediness: 2 -}, function (context, args) { - var body = args[0]; - var func = context.funcName; - if (func in fontAliases) { - func = fontAliases[func]; - } - return { - type: "font", - font: func.slice(1), - body: body - }; -}); - -// Accents -defineFunction(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"], { - numArgs: 1 -}, function (context, args) { - var base = args[0]; - - var isStretchy = !_utils2.default.contains(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot"], context.funcName); - - var isShifty = !isStretchy || _utils2.default.contains(["\\widehat", "\\widetilde"], context.funcName); - - return { - type: "accent", - label: context.funcName, - isStretchy: isStretchy, - isShifty: isShifty, - base: base - }; -}); - -// Text-mode accents -defineFunction(["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v"], { - numArgs: 1, - allowedInText: true, - allowedInMath: false -}, function (context, args) { - var base = args[0]; - - return { - type: "accent", - label: context.funcName, - isStretchy: false, - isShifty: true, - base: base - }; -}); - -// Horizontal stretchy braces -defineFunction(["\\overbrace", "\\underbrace"], { - numArgs: 1 -}, function (context, args) { - var base = args[0]; - return { - type: "horizBrace", - label: context.funcName, - isOver: /^\\over/.test(context.funcName), - base: base - }; -}); - -// Stretchy accents under the body -defineFunction(["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"], { - numArgs: 1 -}, function (context, args) { - var base = args[0]; - return { - type: "accentUnder", - label: context.funcName, - base: base - }; -}); - -// Stretchy arrows with an optional argument -defineFunction(["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom"], { - numArgs: 1, - numOptionalArgs: 1 -}, function (context, args, optArgs) { - var below = optArgs[0]; - var body = args[0]; - return { - type: "xArrow", // x for extensible - label: context.funcName, - body: body, - below: below - }; -}); - -// enclose -defineFunction(["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\fbox"], { - numArgs: 1 -}, function (context, args) { - var body = args[0]; - return { - type: "enclose", - label: context.funcName, - body: body - }; -}); - -// Infix generalized fractions -defineFunction(["\\over", "\\choose", "\\atop"], { - numArgs: 0, - infix: true -}, function (context) { - var replaceWith = void 0; - switch (context.funcName) { - case "\\over": - replaceWith = "\\frac"; - break; - case "\\choose": - replaceWith = "\\binom"; - break; - case "\\atop": - replaceWith = "\\\\atopfrac"; - break; - default: - throw new Error("Unrecognized infix genfrac command"); - } - return { - type: "infix", - replaceWith: replaceWith, - token: context.token - }; -}); - -// Row breaks for aligned data -defineFunction(["\\\\", "\\cr"], { - numArgs: 0, - numOptionalArgs: 1, - argTypes: ["size"] -}, function (context, args, optArgs) { - var size = optArgs[0]; - return { - type: "cr", - size: size - }; -}); - -// Environment delimiters -defineFunction(["\\begin", "\\end"], { - numArgs: 1, - argTypes: ["text"] -}, function (context, args) { - var nameGroup = args[0]; - if (nameGroup.type !== "ordgroup") { - throw new _ParseError2.default("Invalid environment name", nameGroup); - } - var name = ""; - for (var i = 0; i < nameGroup.value.length; ++i) { - name += nameGroup.value[i].value; - } - return { - type: "environment", - name: name, - nameGroup: nameGroup - }; -}); - -// Box manipulation -defineFunction(["\\raisebox"], { - numArgs: 2, - argTypes: ["size", "text"], - allowedInText: true -}, function (context, args) { - var amount = args[0]; - var body = args[1]; - return { - type: "raisebox", - dy: amount, - body: body, - value: (0, _defineFunction2.ordargument)(body) - }; -}); - -// \verb and \verb* are dealt with directly in Parser.js. -// If we end up here, it's because of a failure to match the two delimiters -// in the regex in Lexer.js. LaTeX raises the following error when \verb is -// terminated by end of line (or file). -defineFunction(["\\verb"], { - numArgs: 0, - allowedInText: true -}, function (context) { - throw new _ParseError2.default("\\verb ended by end of line instead of matching delimiter"); -}); - -// Hyperlinks - - -// MathChoice - -},{"./ParseError":84,"./ParseNode":85,"./defineFunction":96,"./functions/color":104,"./functions/delimsizing":105,"./functions/genfrac":106,"./functions/href":107,"./functions/kern":108,"./functions/lap":109,"./functions/mathchoice":110,"./functions/mod":111,"./functions/op":112,"./functions/operatorname":113,"./functions/overline":114,"./functions/phantom":115,"./functions/rule":116,"./functions/smash":117,"./functions/text":118,"./functions/underline":119,"./utils":128}],104:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var htmlBuilder = function htmlBuilder(group, options) { - var elements = html.buildExpression(group.value.value, options.withColor(group.value.color), false); - - // \color isn't supposed to affect the type of the elements it contains. - // To accomplish this, we wrap the results in a fragment, so the inner - // elements will be able to directly interact with their neighbors. For - // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3` - return new _buildCommon2.default.makeFragment(elements); -}; - - -var mathmlBuilder = function mathmlBuilder(group, options) { - var inner = mml.buildExpression(group.value.value, options); - - var node = new _mathMLTree2.default.MathNode("mstyle", inner); - - node.setAttribute("mathcolor", group.value.color); - - return node; -}; - -(0, _defineFunction2.default)({ - type: "color", - names: ["\\textcolor"], - props: { - numArgs: 2, - allowedInText: true, - greediness: 3, - argTypes: ["color", "original"] - }, - handler: function handler(context, args) { - var color = args[0]; - var body = args[1]; - return { - type: "color", - color: color.value, - value: (0, _defineFunction.ordargument)(body) - }; - }, - - htmlBuilder: htmlBuilder, - mathmlBuilder: mathmlBuilder -}); - -// TODO(kevinb): define these using macros -(0, _defineFunction2.default)({ - type: "color", - names: ["\\blue", "\\orange", "\\pink", "\\red", "\\green", "\\gray", "\\purple", "\\blueA", "\\blueB", "\\blueC", "\\blueD", "\\blueE", "\\tealA", "\\tealB", "\\tealC", "\\tealD", "\\tealE", "\\greenA", "\\greenB", "\\greenC", "\\greenD", "\\greenE", "\\goldA", "\\goldB", "\\goldC", "\\goldD", "\\goldE", "\\redA", "\\redB", "\\redC", "\\redD", "\\redE", "\\maroonA", "\\maroonB", "\\maroonC", "\\maroonD", "\\maroonE", "\\purpleA", "\\purpleB", "\\purpleC", "\\purpleD", "\\purpleE", "\\mintA", "\\mintB", "\\mintC", "\\grayA", "\\grayB", "\\grayC", "\\grayD", "\\grayE", "\\grayF", "\\grayG", "\\grayH", "\\grayI", "\\kaBlue", "\\kaGreen"], - props: { - numArgs: 1, - allowedInText: true, - greediness: 3 - }, - handler: function handler(context, args) { - var body = args[0]; - return { - type: "color", - color: "katex-" + context.funcName.slice(1), - value: (0, _defineFunction.ordargument)(body) - }; - }, - - htmlBuilder: htmlBuilder, - mathmlBuilder: mathmlBuilder -}); - -},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],105:[function(require,module,exports){ -"use strict"; - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _delimiter = require("../delimiter"); - -var _delimiter2 = _interopRequireDefault(_delimiter); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _ParseError = require("../ParseError"); - -var _ParseError2 = _interopRequireDefault(_ParseError); - -var _utils = require("../utils"); - -var _utils2 = _interopRequireDefault(_utils); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// Extra data needed for the delimiter handler down below -var delimiterSizes = { - "\\bigl": { mclass: "mopen", size: 1 }, - "\\Bigl": { mclass: "mopen", size: 2 }, - "\\biggl": { mclass: "mopen", size: 3 }, - "\\Biggl": { mclass: "mopen", size: 4 }, - "\\bigr": { mclass: "mclose", size: 1 }, - "\\Bigr": { mclass: "mclose", size: 2 }, - "\\biggr": { mclass: "mclose", size: 3 }, - "\\Biggr": { mclass: "mclose", size: 4 }, - "\\bigm": { mclass: "mrel", size: 1 }, - "\\Bigm": { mclass: "mrel", size: 2 }, - "\\biggm": { mclass: "mrel", size: 3 }, - "\\Biggm": { mclass: "mrel", size: 4 }, - "\\big": { mclass: "mord", size: 1 }, - "\\Big": { mclass: "mord", size: 2 }, - "\\bigg": { mclass: "mord", size: 3 }, - "\\Bigg": { mclass: "mord", size: 4 } -}; - -var delimiters = ["(", ")", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\\lceil", "\\rceil", "<", ">", "\\langle", "\\rangle", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\\lmoustache", "\\rmoustache", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]; - -// Delimiter functions -function checkDelimiter(delim, context) { - if (_utils2.default.contains(delimiters, delim.value)) { - return delim; - } else { - throw new _ParseError2.default("Invalid delimiter: '" + delim.value + "' after '" + context.funcName + "'", delim); - } -} - -(0, _defineFunction2.default)({ - type: "delimsizing", - names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"], - props: { - numArgs: 1 - }, - handler: function handler(context, args) { - var delim = checkDelimiter(args[0], context); - - return { - type: "delimsizing", - size: delimiterSizes[context.funcName].size, - mclass: delimiterSizes[context.funcName].mclass, - value: delim.value - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var delim = group.value.value; - - if (delim === ".") { - // Empty delimiters still count as elements, even though they don't - // show anything. - return _buildCommon2.default.makeSpan([group.value.mclass]); - } - - // Use delimiter.sizedDelim to generate the delimiter. - return _delimiter2.default.sizedDelim(delim, group.value.size, options, group.mode, [group.value.mclass]); - }, - mathmlBuilder: function mathmlBuilder(group) { - var children = []; - - if (group.value.value !== ".") { - children.push(mml.makeText(group.value.value, group.mode)); - } - - var node = new _mathMLTree2.default.MathNode("mo", children); - - if (group.value.mclass === "mopen" || group.value.mclass === "mclose") { - // Only some of the delimsizing functions act as fences, and they - // return "mopen" or "mclose" mclass. - node.setAttribute("fence", "true"); - } else { - // Explicitly disable fencing if it's not a fence, to override the - // defaults. - node.setAttribute("fence", "false"); - } - - return node; - } -}); - -(0, _defineFunction2.default)({ - type: "leftright", - names: ["\\left", "\\right"], - props: { - numArgs: 1 - }, - handler: function handler(context, args) { - var delim = checkDelimiter(args[0], context); - - // \left and \right are caught somewhere in Parser.js, which is - // why this data doesn't match what is in buildHTML. - return { - type: "leftright", - value: delim.value - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - // Build the inner expression - var inner = html.buildExpression(group.value.body, options, true); - - var innerHeight = 0; - var innerDepth = 0; - var hadMiddle = false; - - // Calculate its height and depth - for (var i = 0; i < inner.length; i++) { - if (inner[i].isMiddle) { - hadMiddle = true; - } else { - innerHeight = Math.max(inner[i].height, innerHeight); - innerDepth = Math.max(inner[i].depth, innerDepth); - } - } - - // The size of delimiters is the same, regardless of what style we are - // in. Thus, to correctly calculate the size of delimiter we need around - // a group, we scale down the inner size based on the size. - innerHeight *= options.sizeMultiplier; - innerDepth *= options.sizeMultiplier; - - var leftDelim = void 0; - if (group.value.left === ".") { - // Empty delimiters in \left and \right make null delimiter spaces. - leftDelim = html.makeNullDelimiter(options, ["mopen"]); - } else { - // Otherwise, use leftRightDelim to generate the correct sized - // delimiter. - leftDelim = _delimiter2.default.leftRightDelim(group.value.left, innerHeight, innerDepth, options, group.mode, ["mopen"]); - } - // Add it to the beginning of the expression - inner.unshift(leftDelim); - - // Handle middle delimiters - if (hadMiddle) { - for (var _i = 1; _i < inner.length; _i++) { - var middleDelim = inner[_i]; - if (middleDelim.isMiddle) { - // Apply the options that were active when \middle was called - inner[_i] = _delimiter2.default.leftRightDelim(middleDelim.isMiddle.value, innerHeight, innerDepth, middleDelim.isMiddle.options, group.mode, []); - // Add back spaces shifted into the delimiter - var spaces = html.spliceSpaces(middleDelim.children, 0); - if (spaces) { - _buildCommon2.default.prependChildren(inner[_i], spaces); - } - } - } - } - - var rightDelim = void 0; - // Same for the right delimiter - if (group.value.right === ".") { - rightDelim = html.makeNullDelimiter(options, ["mclose"]); - } else { - rightDelim = _delimiter2.default.leftRightDelim(group.value.right, innerHeight, innerDepth, options, group.mode, ["mclose"]); - } - // Add it to the end of the expression. - inner.push(rightDelim); - - return _buildCommon2.default.makeSpan(["minner"], inner, options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var inner = mml.buildExpression(group.value.body, options); - - if (group.value.left !== ".") { - var leftNode = new _mathMLTree2.default.MathNode("mo", [mml.makeText(group.value.left, group.mode)]); - - leftNode.setAttribute("fence", "true"); - - inner.unshift(leftNode); - } - - if (group.value.right !== ".") { - var rightNode = new _mathMLTree2.default.MathNode("mo", [mml.makeText(group.value.right, group.mode)]); - - rightNode.setAttribute("fence", "true"); - - inner.push(rightNode); - } - - var outerNode = new _mathMLTree2.default.MathNode("mrow", inner); - - return outerNode; - } -}); - -(0, _defineFunction2.default)({ - type: "middle", - names: ["\\middle"], - props: { - numArgs: 1 - }, - handler: function handler(context, args) { - var delim = checkDelimiter(args[0], context); - if (!context.parser.leftrightDepth) { - throw new _ParseError2.default("\\middle without preceding \\left", delim); - } - - return { - type: "middle", - value: delim.value - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var middleDelim = void 0; - if (group.value.value === ".") { - middleDelim = html.makeNullDelimiter(options, []); - } else { - middleDelim = _delimiter2.default.sizedDelim(group.value.value, 1, options, group.mode, []); - middleDelim.isMiddle = { value: group.value.value, options: options }; - } - return middleDelim; - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var middleNode = new _mathMLTree2.default.MathNode("mo", [mml.makeText(group.value.middle, group.mode)]); - middleNode.setAttribute("fence", "true"); - return middleNode; - } -}); - -},{"../ParseError":84,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../delimiter":97,"../mathMLTree":121,"../utils":128}],106:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _delimiter = require("../delimiter"); - -var _delimiter2 = _interopRequireDefault(_delimiter); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _Style = require("../Style"); - -var _Style2 = _interopRequireDefault(_Style); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _defineFunction2.default)({ - type: "genfrac", - names: ["\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac"], - props: { - numArgs: 2, - greediness: 2 - }, - handler: function handler(context, args) { - var numer = args[0]; - var denom = args[1]; - var hasBarLine = void 0; - var leftDelim = null; - var rightDelim = null; - var size = "auto"; - - switch (context.funcName) { - case "\\dfrac": - case "\\frac": - case "\\tfrac": - hasBarLine = true; - break; - case "\\\\atopfrac": - hasBarLine = false; - break; - case "\\dbinom": - case "\\binom": - case "\\tbinom": - hasBarLine = false; - leftDelim = "("; - rightDelim = ")"; - break; - default: - throw new Error("Unrecognized genfrac command"); - } - - switch (context.funcName) { - case "\\dfrac": - case "\\dbinom": - size = "display"; - break; - case "\\tfrac": - case "\\tbinom": - size = "text"; - break; - } - - return { - type: "genfrac", - numer: numer, - denom: denom, - hasBarLine: hasBarLine, - leftDelim: leftDelim, - rightDelim: rightDelim, - size: size - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e). - // Figure out what style this fraction should be in based on the - // function used - var style = options.style; - if (group.value.size === "display") { - style = _Style2.default.DISPLAY; - } else if (group.value.size === "text") { - style = _Style2.default.TEXT; - } - - var nstyle = style.fracNum(); - var dstyle = style.fracDen(); - var newOptions = void 0; - - newOptions = options.havingStyle(nstyle); - var numerm = html.buildGroup(group.value.numer, newOptions, options); - - newOptions = options.havingStyle(dstyle); - var denomm = html.buildGroup(group.value.denom, newOptions, options); - - var rule = void 0; - var ruleWidth = void 0; - var ruleSpacing = void 0; - if (group.value.hasBarLine) { - rule = _buildCommon2.default.makeLineSpan("frac-line", options); - ruleWidth = rule.height; - ruleSpacing = rule.height; - } else { - rule = null; - ruleWidth = 0; - ruleSpacing = options.fontMetrics().defaultRuleThickness; - } - - // Rule 15b - var numShift = void 0; - var clearance = void 0; - var denomShift = void 0; - if (style.size === _Style2.default.DISPLAY.size) { - numShift = options.fontMetrics().num1; - if (ruleWidth > 0) { - clearance = 3 * ruleSpacing; - } else { - clearance = 7 * ruleSpacing; - } - denomShift = options.fontMetrics().denom1; - } else { - if (ruleWidth > 0) { - numShift = options.fontMetrics().num2; - clearance = ruleSpacing; - } else { - numShift = options.fontMetrics().num3; - clearance = 3 * ruleSpacing; - } - denomShift = options.fontMetrics().denom2; - } - - var frac = void 0; - if (ruleWidth === 0) { - // Rule 15c - var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift); - if (candidateClearance < clearance) { - numShift += 0.5 * (clearance - candidateClearance); - denomShift += 0.5 * (clearance - candidateClearance); - } - - frac = _buildCommon2.default.makeVList({ - positionType: "individualShift", - children: [{ type: "elem", elem: denomm, shift: denomShift }, { type: "elem", elem: numerm, shift: -numShift }] - }, options); - } else { - // Rule 15d - var axisHeight = options.fontMetrics().axisHeight; - - if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) { - numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth)); - } - - if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) { - denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift)); - } - - var midShift = -(axisHeight - 0.5 * ruleWidth); - - frac = _buildCommon2.default.makeVList({ - positionType: "individualShift", - children: [{ type: "elem", elem: denomm, shift: denomShift }, - // $FlowFixMe `rule` cannot be `null` here. - { type: "elem", elem: rule, shift: midShift }, { type: "elem", elem: numerm, shift: -numShift }] - }, options); - } - - // Since we manually change the style sometimes (with \dfrac or \tfrac), - // account for the possible size change here. - newOptions = options.havingStyle(style); - frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier; - frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; - - // Rule 15e - var delimSize = void 0; - if (style.size === _Style2.default.DISPLAY.size) { - delimSize = options.fontMetrics().delim1; - } else { - delimSize = options.fontMetrics().delim2; - } - - var leftDelim = void 0; - var rightDelim = void 0; - if (group.value.leftDelim == null) { - leftDelim = html.makeNullDelimiter(options, ["mopen"]); - } else { - leftDelim = _delimiter2.default.customSizedDelim(group.value.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]); - } - if (group.value.rightDelim == null) { - rightDelim = html.makeNullDelimiter(options, ["mclose"]); - } else { - rightDelim = _delimiter2.default.customSizedDelim(group.value.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]); - } - - return _buildCommon2.default.makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, _buildCommon2.default.makeSpan(["mfrac"], [frac]), rightDelim], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var node = new _mathMLTree2.default.MathNode("mfrac", [mml.buildGroup(group.value.numer, options), mml.buildGroup(group.value.denom, options)]); - - if (!group.value.hasBarLine) { - node.setAttribute("linethickness", "0px"); - } - - if (group.value.leftDelim != null || group.value.rightDelim != null) { - var withDelims = []; - - if (group.value.leftDelim != null) { - var leftOp = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode(group.value.leftDelim)]); - - leftOp.setAttribute("fence", "true"); - - withDelims.push(leftOp); - } - - withDelims.push(node); - - if (group.value.rightDelim != null) { - var rightOp = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode(group.value.rightDelim)]); - - rightOp.setAttribute("fence", "true"); - - withDelims.push(rightOp); - } - - var outerNode = new _mathMLTree2.default.MathNode("mrow", withDelims); - - return outerNode; - } - - return node; - } -}); - -},{"../Style":89,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../delimiter":97,"../mathMLTree":121}],107:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _defineFunction2.default)({ - type: "href", - names: ["\\href"], - props: { - numArgs: 2, - argTypes: ["url", "original"] - }, - handler: function handler(context, args) { - var body = args[1]; - var href = args[0].value; - return { - type: "href", - href: href, - body: (0, _defineFunction.ordargument)(body) - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var elements = html.buildExpression(group.value.body, options, false); - - var href = group.value.href; - - /** - * Determining class for anchors. - * 1. if it has the only element, use its class; - * 2. if it has more than two elements, and the classes - * of its first and last elements coincide, then use it; - * 3. otherwise, we will inject an empty s at both ends, - * with the same classes of both ends of elements, with the - * first span having the same class as the first element of body, - * and the second one the same as the last. - */ - - var classes = []; // Default behaviour for Case 3. - var first = void 0; // mathtype of the first child - var last = void 0; // mathtype of the last child - // Invariants: both first and last must be non-null if classes is null. - if (elements.length === 1) { - // Case 1 - classes = elements[0].classes; - } else if (elements.length >= 2) { - first = html.getTypeOfDomTree(elements[0]) || 'mord'; - last = html.getTypeOfDomTree(elements[elements.length - 1]) || 'mord'; - if (first === last) { - // Case 2 : type of both ends coincides - classes = [first]; - } else { - // Case 3: both ends have different types. - var anc = _buildCommon2.default.makeAnchor(href, [], elements, options); - return new _buildCommon2.default.makeFragment([new _buildCommon2.default.makeSpan([first], [], options), anc, new _buildCommon2.default.makeSpan([last], [], options)]); - } - } - return new _buildCommon2.default.makeAnchor(href, classes, elements, options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var inner = mml.buildExpression(group.value.body, options); - var math = new _mathMLTree2.default.MathNode("mrow", inner); - math.setAttribute("href", group.value.href); - return math; - } -}); - -},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],108:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _units = require("../units"); - -var _ParseError = require("../ParseError"); - -var _ParseError2 = _interopRequireDefault(_ParseError); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// TODO: \hskip and \mskip should support plus and minus in lengths - -(0, _defineFunction2.default)({ - type: "kern", - names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"], - props: { - numArgs: 1, - argTypes: ["size"], - allowedInText: true - }, - handler: function handler(context, args) { - var mathFunction = context.funcName[1] === 'm'; // \mkern, \mskip - var muUnit = args[0].value.unit === 'mu'; - if (mathFunction) { - if (!muUnit) { - typeof console !== "undefined" && console.warn("In LaTeX, " + context.funcName + " supports only mu units, " + ("not " + args[0].value.unit + " units")); - } - if (context.parser.mode !== "math") { - throw new _ParseError2.default("Can't use function '" + context.funcName + "' in text mode"); - } - } else { - // !mathFunction - if (muUnit) { - typeof console !== "undefined" && console.warn("In LaTeX, " + context.funcName + " does not support mu units"); - } - } - return { - type: "kern", - dimension: args[0].value - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - // Make an empty span for the rule - var rule = _buildCommon2.default.makeSpan(["mord", "rule"], [], options); - - if (group.value.dimension) { - var dimension = (0, _units.calculateSize)(group.value.dimension, options); - rule.style.marginLeft = dimension + "em"; - } - - return rule; - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var node = new _mathMLTree2.default.MathNode("mspace"); - - if (group.value.dimension) { - var dimension = (0, _units.calculateSize)(group.value.dimension, options); - node.setAttribute("width", dimension + "em"); - } - - return node; - } -}); -/* eslint no-console:0 */ -// Horizontal spacing commands - -},{"../ParseError":84,"../buildCommon":91,"../defineFunction":96,"../mathMLTree":121,"../units":127}],109:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _defineFunction2.default)({ - type: "lap", - names: ["\\mathllap", "\\mathrlap", "\\mathclap"], - props: { - numArgs: 1, - allowedInText: true - }, - handler: function handler(context, args) { - var body = args[0]; - return { - type: "lap", - alignment: context.funcName.slice(5), - body: body - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - // mathllap, mathrlap, mathclap - var inner = void 0; - if (group.value.alignment === "clap") { - // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/ - inner = _buildCommon2.default.makeSpan([], [html.buildGroup(group.value.body, options)]); - // wrap, since CSS will center a .clap > .inner > span - inner = _buildCommon2.default.makeSpan(["inner"], [inner], options); - } else { - inner = _buildCommon2.default.makeSpan(["inner"], [html.buildGroup(group.value.body, options)]); - } - var fix = _buildCommon2.default.makeSpan(["fix"], []); - return _buildCommon2.default.makeSpan(["mord", group.value.alignment], [inner, fix], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - // mathllap, mathrlap, mathclap - var node = new _mathMLTree2.default.MathNode("mpadded", [mml.buildGroup(group.value.body, options)]); - - if (group.value.alignment !== "rlap") { - var offset = group.value.alignment === "llap" ? "-1" : "-0.5"; - node.setAttribute("lspace", offset + "width"); - } - node.setAttribute("width", "0px"); - - return node; - } -}); -// Horizontal overlap functions - -},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],110:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _Style = require("../Style"); - -var _Style2 = _interopRequireDefault(_Style); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var chooseMathStyle = function chooseMathStyle(group, options) { - var style = options.style; - if (style.size === _Style2.default.DISPLAY.size) { - return group.value.display; - } else if (style.size === _Style2.default.TEXT.size) { - return group.value.text; - } else if (style.size === _Style2.default.SCRIPT.size) { - return group.value.script; - } else if (style.size === _Style2.default.SCRIPTSCRIPT.size) { - return group.value.scriptscript; - } - return group.value.text; -}; - -(0, _defineFunction2.default)({ - type: "mathchoice", - names: ["\\mathchoice"], - props: { - numArgs: 4 - }, - handler: function handler(context, args) { - return { - type: "mathchoice", - display: (0, _defineFunction.ordargument)(args[0]), - text: (0, _defineFunction.ordargument)(args[1]), - script: (0, _defineFunction.ordargument)(args[2]), - scriptscript: (0, _defineFunction.ordargument)(args[3]) - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var body = chooseMathStyle(group, options); - var elements = html.buildExpression(body, options, false); - return new _buildCommon2.default.makeFragment(elements); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var body = chooseMathStyle(group, options); - var elements = mml.buildExpression(body, options, false); - return new _mathMLTree2.default.MathNode("mrow", elements); - } -}); - -},{"../Style":89,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],111:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _Style = require("../Style"); - -var _Style2 = _interopRequireDefault(_Style); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// \mod-type functions -var htmlModBuilder = function htmlModBuilder(group, options) { - var inner = []; - - if (group.value.modType === "bmod") { - // “\nonscript\mskip-\medmuskip\mkern5mu”, where \medmuskip is - // 4mu plus 2mu minus 1mu, translates to 1mu space in - // display/textstyle and 5mu space in script/scriptscriptstyle. - if (!options.style.isTight()) { - inner.push(_buildCommon2.default.makeSpan(["mspace", "muspace"], [], options)); - } else { - inner.push(_buildCommon2.default.makeSpan(["mspace", "thickspace"], [], options)); - } - } else if (options.style.size === _Style2.default.DISPLAY.size) { - inner.push(_buildCommon2.default.makeSpan(["mspace", "quad"], [], options)); - } else if (group.value.modType === "mod") { - inner.push(_buildCommon2.default.makeSpan(["mspace", "twelvemuspace"], [], options)); - } else { - inner.push(_buildCommon2.default.makeSpan(["mspace", "eightmuspace"], [], options)); - } - - if (group.value.modType === "pod" || group.value.modType === "pmod") { - inner.push(_buildCommon2.default.mathsym("(", group.mode)); - } - - if (group.value.modType !== "pod") { - var modInner = [_buildCommon2.default.mathsym("m", group.mode), _buildCommon2.default.mathsym("o", group.mode), _buildCommon2.default.mathsym("d", group.mode)]; - if (group.value.modType === "bmod") { - inner.push(_buildCommon2.default.makeSpan(["mbin"], modInner, options)); - // “\mkern5mu\nonscript\mskip-\medmuskip” as above - if (!options.style.isTight()) { - inner.push(_buildCommon2.default.makeSpan(["mspace", "muspace"], [], options)); - } else { - inner.push(_buildCommon2.default.makeSpan(["mspace", "thickspace"], [], options)); - } - } else { - Array.prototype.push.apply(inner, modInner); - inner.push(_buildCommon2.default.makeSpan(["mspace", "sixmuspace"], [], options)); - } - } - - if (group.value.value) { - Array.prototype.push.apply(inner, html.buildExpression(group.value.value, options, false)); - } - - if (group.value.modType === "pod" || group.value.modType === "pmod") { - inner.push(_buildCommon2.default.mathsym(")", group.mode)); - } - - return _buildCommon2.default.makeFragment(inner); -}; - -var mmlModBuilder = function mmlModBuilder(group, options) { - var inner = []; - - if (group.value.modType === "pod" || group.value.modType === "pmod") { - inner.push(new _mathMLTree2.default.MathNode("mo", [mml.makeText("(", group.mode)])); - } - if (group.value.modType !== "pod") { - inner.push(new _mathMLTree2.default.MathNode("mo", [mml.makeText("mod", group.mode)])); - } - if (group.value.value) { - var space = new _mathMLTree2.default.MathNode("mspace"); - space.setAttribute("width", "0.333333em"); - inner.push(space); - inner = inner.concat(mml.buildExpression(group.value.value, options)); - } - if (group.value.modType === "pod" || group.value.modType === "pmod") { - inner.push(new _mathMLTree2.default.MathNode("mo", [mml.makeText(")", group.mode)])); - } - - return new _mathMLTree2.default.MathNode("mo", inner); -}; - -(0, _defineFunction2.default)({ - type: "mod", - names: ["\\bmod"], - props: { - numArgs: 0 - }, - handler: function handler(context, args) { - return { - type: "mod", - modType: "bmod", - value: null - }; - }, - htmlBuilder: htmlModBuilder, - mathmlBuilder: mmlModBuilder -}); - -// Note: calling defineFunction with a type that's already been defined only -// works because the same htmlBuilder and mathmlBuilder are being used. -(0, _defineFunction2.default)({ - type: "mod", - names: ["\\pod", "\\pmod", "\\mod"], - props: { - numArgs: 1 - }, - handler: function handler(context, args) { - var body = args[0]; - return { - type: "mod", - modType: context.funcName.substr(1), - value: (0, _defineFunction.ordargument)(body) - }; - }, - htmlBuilder: htmlModBuilder, - mathmlBuilder: mmlModBuilder -}); - -},{"../Style":89,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],112:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _domTree = require("../domTree"); - -var _domTree2 = _interopRequireDefault(_domTree); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _utils = require("../utils"); - -var _utils2 = _interopRequireDefault(_utils); - -var _Style = require("../Style"); - -var _Style2 = _interopRequireDefault(_Style); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// Limits, symbols -var htmlBuilder = function htmlBuilder(group, options) { - // Operators are handled in the TeXbook pg. 443-444, rule 13(a). - var supGroup = void 0; - var subGroup = void 0; - var hasLimits = false; - if (group.type === "supsub") { - // If we have limits, supsub will pass us its group to handle. Pull - // out the superscript and subscript and set the group to the op in - // its base. - supGroup = group.value.sup; - subGroup = group.value.sub; - group = group.value.base; - hasLimits = true; - } - - var style = options.style; - - // Most operators have a large successor symbol, but these don't. - var noSuccessor = ["\\smallint"]; - - var large = false; - if (style.size === _Style2.default.DISPLAY.size && group.value.symbol && !_utils2.default.contains(noSuccessor, group.value.body)) { - - // Most symbol operators get larger in displaystyle (rule 13) - large = true; - } - - var base = void 0; - if (group.value.symbol) { - // If this is a symbol, create the symbol. - var fontName = large ? "Size2-Regular" : "Size1-Regular"; - base = _buildCommon2.default.makeSymbol(group.value.body, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]); - } else if (group.value.value) { - // If this is a list, compose that list. - var inner = html.buildExpression(group.value.value, options, true); - if (inner.length === 1 && inner[0] instanceof _domTree2.default.symbolNode) { - base = inner[0]; - base.classes[0] = "mop"; // replace old mclass - } else { - base = _buildCommon2.default.makeSpan(["mop"], inner, options); - } - } else { - // Otherwise, this is a text operator. Build the text from the - // operator's name. - // TODO(emily): Add a space in the middle of some of these - // operators, like \limsup - var output = []; - for (var i = 1; i < group.value.body.length; i++) { - output.push(_buildCommon2.default.mathsym(group.value.body[i], group.mode)); - } - base = _buildCommon2.default.makeSpan(["mop"], output, options); - } - - // If content of op is a single symbol, shift it vertically. - var baseShift = 0; - var slant = 0; - if (base instanceof _domTree2.default.symbolNode) { - // Shift the symbol so its center lies on the axis (rule 13). It - // appears that our fonts have the centers of the symbols already - // almost on the axis, so these numbers are very small. Note we - // don't actually apply this here, but instead it is used either in - // the vlist creation or separately when there are no limits. - baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; - - // The slant of the symbol is just its italic correction. - slant = base.italic; - } - - if (hasLimits) { - // IE 8 clips \int if it is in a display: inline-block. We wrap it - // in a new span so it is an inline, and works. - base = _buildCommon2.default.makeSpan([], [base]); - - var sub = void 0; - var sup = void 0; - // We manually have to handle the superscripts and subscripts. This, - // aside from the kern calculations, is copied from supsub. - if (supGroup) { - var elem = html.buildGroup(supGroup, options.havingStyle(style.sup()), options); - - sup = { - elem: elem, - kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth) - }; - } - - if (subGroup) { - var _elem = html.buildGroup(subGroup, options.havingStyle(style.sub()), options); - - sub = { - elem: _elem, - kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height) - }; - } - - // Build the final group as a vlist of the possible subscript, base, - // and possible superscript. - var finalGroup = void 0; - if (sup && sub) { - var bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift; - - finalGroup = _buildCommon2.default.makeVList({ - positionType: "bottom", - positionData: bottom, - children: [{ type: "kern", size: options.fontMetrics().bigOpSpacing5 }, { type: "elem", elem: sub.elem, marginLeft: -slant + "em" }, { type: "kern", size: sub.kern }, { type: "elem", elem: base }, { type: "kern", size: sup.kern }, { type: "elem", elem: sup.elem, marginLeft: slant + "em" }, { type: "kern", size: options.fontMetrics().bigOpSpacing5 }] - }, options); - } else if (sub) { - var top = base.height - baseShift; - - // Shift the limits by the slant of the symbol. Note - // that we are supposed to shift the limits by 1/2 of the slant, - // but since we are centering the limits adding a full slant of - // margin will shift by 1/2 that. - finalGroup = _buildCommon2.default.makeVList({ - positionType: "top", - positionData: top, - children: [{ type: "kern", size: options.fontMetrics().bigOpSpacing5 }, { type: "elem", elem: sub.elem, marginLeft: -slant + "em" }, { type: "kern", size: sub.kern }, { type: "elem", elem: base }] - }, options); - } else if (sup) { - var _bottom = base.depth + baseShift; - - finalGroup = _buildCommon2.default.makeVList({ - positionType: "bottom", - positionData: _bottom, - children: [{ type: "elem", elem: base }, { type: "kern", size: sup.kern }, { type: "elem", elem: sup.elem, marginLeft: slant + "em" }, { type: "kern", size: options.fontMetrics().bigOpSpacing5 }] - }, options); - } else { - // This case probably shouldn't occur (this would mean the - // supsub was sending us a group with no superscript or - // subscript) but be safe. - return base; - } - - return _buildCommon2.default.makeSpan(["mop", "op-limits"], [finalGroup], options); - } else { - if (baseShift) { - base.style.position = "relative"; - base.style.top = baseShift + "em"; - } - - return base; - } -}; - -var mathmlBuilder = function mathmlBuilder(group, options) { - var node = void 0; - - // TODO(emily): handle big operators using the `largeop` attribute - - if (group.value.symbol) { - // This is a symbol. Just add the symbol. - node = new _mathMLTree2.default.MathNode("mo", [mml.makeText(group.value.body, group.mode)]); - } else if (group.value.value) { - // This is an operator with children. Add them. - node = new _mathMLTree2.default.MathNode("mo", mml.buildExpression(group.value.value, options)); - } else { - // This is a text operator. Add all of the characters from the - // operator's name. - // TODO(emily): Add a space in the middle of some of these - // operators, like \limsup. - node = new _mathMLTree2.default.MathNode("mi", [new _mathMLTree2.default.TextNode(group.value.body.slice(1))]); - - // Append an . - // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4 - var operator = new _mathMLTree2.default.MathNode("mo", [mml.makeText("\u2061", "text")]); - - return new _domTree2.default.documentFragment([node, operator]); - } - - return node; -}; - -var singleCharBigOps = { - "\u220F": "\\prod", - "\u2210": "\\coprod", - "\u2211": "\\sum", - "\u22C0": "\\bigwedge", - "\u22C1": "\\bigvee", - "\u22C2": "\\bigcap", - "\u22C3": "\\bigcap", - "\u2A00": "\\bigodot", - "\u2A01": "\\bigoplus", - "\u2A02": "\\bigotimes", - "\u2A04": "\\biguplus", - "\u2A06": "\\bigsqcup" -}; - -(0, _defineFunction2.default)({ - type: "op", - names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22C0", "\u22C1", "\u22C2", "\u22C3", "\u2A00", "\u2A01", "\u2A02", "\u2A04", "\u2A06"], - props: { - numArgs: 0 - }, - handler: function handler(context, args) { - var fName = context.funcName; - if (fName.length === 1) { - fName = singleCharBigOps[fName]; - } - return { - type: "op", - limits: true, - symbol: true, - body: fName - }; - }, - htmlBuilder: htmlBuilder, - mathmlBuilder: mathmlBuilder -}); - -// Note: calling defineFunction with a type that's already been defined only -// works because the same htmlBuilder and mathmlBuilder are being used. -(0, _defineFunction2.default)({ - type: "op", - names: ["\\mathop"], - props: { - numArgs: 1 - }, - handler: function handler(context, args) { - var body = args[0]; - return { - type: "op", - limits: false, - symbol: false, - value: (0, _defineFunction.ordargument)(body) - }; - }, - htmlBuilder: htmlBuilder, - mathmlBuilder: mathmlBuilder -}); - -},{"../Style":89,"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../domTree":98,"../mathMLTree":121,"../utils":128}],113:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _domTree = require("../domTree"); - -var _domTree2 = _interopRequireDefault(_domTree); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// \operatorname -// amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@ -(0, _defineFunction2.default)({ - type: "operatorname", - names: ["\\operatorname"], - props: { - numArgs: 1 - }, - handler: function handler(context, args) { - var body = args[0]; - return { - type: "operatorname", - value: (0, _defineFunction.ordargument)(body) - }; - }, - - htmlBuilder: function htmlBuilder(group, options) { - var output = []; - if (group.value.value.length > 0) { - var letter = ""; - var mode = ""; - - // Consolidate Greek letter function names into symbol characters. - var temp = html.buildExpression(group.value.value, options, true); - - // All we want from temp are the letters. With them, we'll - // create a text operator similar to \tan or \cos. - for (var i = 0; i < temp.length; i++) { - letter = temp[i].value; - - // In the amsopn package, \newmcodes@ changes four - // characters, *-/:’, from math operators back into text. - // Given what is in temp, we have to address two of them. - letter = letter.replace(/\u2212/, "-"); // minus => hyphen - letter = letter.replace(/\u2217/, "*"); - - // Use math mode for Greek letters - mode = /[\u0391-\u03D7]/.test(letter) ? "math" : "text"; - output.push(_buildCommon2.default.mathsym(letter, mode)); - } - } - return _buildCommon2.default.makeSpan(["mop"], output, options); - }, - - mathmlBuilder: function mathmlBuilder(group, options) { - // The steps taken here are similar to the html version. - var output = []; - if (group.value.value.length > 0) { - var temp = mml.buildExpression(group.value.value, options); - - var word = ""; - for (var i = 0; i < temp.length; i++) { - word += temp[i].children[0].text; - } - word = word.replace(/\u2212/g, "-"); - word = word.replace(/\u2217/g, "*"); - output = [new _mathMLTree2.default.TextNode(word)]; - } - var identifier = new _mathMLTree2.default.MathNode("mi", output); - identifier.setAttribute("mathvariant", "normal"); - - // \u2061 is the same as ⁡ - // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp - var operator = new _mathMLTree2.default.MathNode("mo", [mml.makeText("\u2061", "text")]); - - return new _domTree2.default.documentFragment([identifier, operator]); - } -}); - -},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../domTree":98,"../mathMLTree":121}],114:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _defineFunction2.default)({ - type: "overline", - names: ["\\overline"], - props: { - numArgs: 1 - }, - handler: function handler(context, args) { - var body = args[0]; - return { - type: "overline", - body: body - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - // Overlines are handled in the TeXbook pg 443, Rule 9. - - // Build the inner group in the cramped style. - var innerGroup = html.buildGroup(group.value.body, options.havingCrampedStyle()); - - // Create the line above the body - var line = _buildCommon2.default.makeLineSpan("overline-line", options); - - // Generate the vlist, with the appropriate kerns - var vlist = _buildCommon2.default.makeVList({ - positionType: "firstBaseline", - children: [{ type: "elem", elem: innerGroup }, { type: "kern", size: 3 * line.height }, { type: "elem", elem: line }, { type: "kern", size: line.height }] - }, options); - - return _buildCommon2.default.makeSpan(["mord", "overline"], [vlist], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var operator = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode("\u203E")]); - operator.setAttribute("stretchy", "true"); - - var node = new _mathMLTree2.default.MathNode("mover", [mml.buildGroup(group.value.body, options), operator]); - node.setAttribute("accent", "true"); - - return node; - } -}); - -},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],115:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _defineFunction2.default)({ - type: "phantom", - names: ["\\phantom"], - props: { - numArgs: 1 - }, - handler: function handler(context, args) { - var body = args[0]; - return { - type: "phantom", - value: (0, _defineFunction.ordargument)(body) - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var elements = html.buildExpression(group.value.value, options.withPhantom(), false); - - // \phantom isn't supposed to affect the elements it contains. - // See "color" for more details. - return new _buildCommon2.default.makeFragment(elements); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var inner = mml.buildExpression(group.value.value, options); - return new _mathMLTree2.default.MathNode("mphantom", inner); - } -}); - - -(0, _defineFunction2.default)({ - type: "hphantom", - names: ["\\hphantom"], - props: { - numArgs: 1 - }, - handler: function handler(context, args) { - var body = args[0]; - return { - type: "hphantom", - value: (0, _defineFunction.ordargument)(body), - body: body - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var node = _buildCommon2.default.makeSpan([], [html.buildGroup(group.value.body, options.withPhantom())]); - node.height = 0; - node.depth = 0; - if (node.children) { - for (var i = 0; i < node.children.length; i++) { - node.children[i].height = 0; - node.children[i].depth = 0; - } - } - - // See smash for comment re: use of makeVList - node = _buildCommon2.default.makeVList({ - positionType: "firstBaseline", - children: [{ type: "elem", elem: node }] - }, options); - - return node; - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var inner = mml.buildExpression(group.value.value, options); - var node = new _mathMLTree2.default.MathNode("mphantom", inner); - node.setAttribute("height", "0px"); - return node; - } -}); - -(0, _defineFunction2.default)({ - type: "vphantom", - names: ["\\vphantom"], - props: { - numArgs: 1 - }, - handler: function handler(context, args) { - var body = args[0]; - return { - type: "vphantom", - value: (0, _defineFunction.ordargument)(body), - body: body - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var inner = _buildCommon2.default.makeSpan(["inner"], [html.buildGroup(group.value.body, options.withPhantom())]); - var fix = _buildCommon2.default.makeSpan(["fix"], []); - return _buildCommon2.default.makeSpan(["mord", "rlap"], [inner, fix], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var inner = mml.buildExpression(group.value.value, options); - var node = new _mathMLTree2.default.MathNode("mphantom", inner); - node.setAttribute("width", "0px"); - return node; - } -}); - -},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],116:[function(require,module,exports){ -"use strict"; - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _units = require("../units"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _defineFunction2.default)({ - type: "rule", - names: ["\\rule"], - props: { - numArgs: 2, - numOptionalArgs: 1, - argTypes: ["size", "size", "size"] - }, - handler: function handler(context, args, optArgs) { - var shift = optArgs[0]; - var width = args[0]; - var height = args[1]; - return { - type: "rule", - shift: shift && shift.value, - width: width.value, - height: height.value - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - // Make an empty span for the rule - var rule = _buildCommon2.default.makeSpan(["mord", "rule"], [], options); - - // Calculate the shift, width, and height of the rule, and account for units - var shift = 0; - if (group.value.shift) { - shift = (0, _units.calculateSize)(group.value.shift, options); - } - - var width = (0, _units.calculateSize)(group.value.width, options); - var height = (0, _units.calculateSize)(group.value.height, options); - - // Style the rule to the right size - rule.style.borderRightWidth = width + "em"; - rule.style.borderTopWidth = height + "em"; - rule.style.bottom = shift + "em"; - - // Record the height and width - rule.width = width; - rule.height = height + shift; - rule.depth = -shift; - // Font size is the number large enough that the browser will - // reserve at least `absHeight` space above the baseline. - // The 1.125 factor was empirically determined - rule.maxFontSize = height * 1.125 * options.sizeMultiplier; - - return rule; - }, - mathmlBuilder: function mathmlBuilder(group, options) { - // TODO(emily): Figure out if there's an actual way to draw black boxes - // in MathML. - var node = new _mathMLTree2.default.MathNode("mrow"); - - return node; - } -}); - -},{"../buildCommon":91,"../defineFunction":96,"../mathMLTree":121,"../units":127}],117:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _defineFunction2.default)({ - type: "smash", - names: ["\\smash"], - props: { - numArgs: 1, - numOptionalArgs: 1, - allowedInText: true - }, - handler: function handler(context, args, optArgs) { - var smashHeight = false; - var smashDepth = false; - var tbArg = optArgs[0]; - if (tbArg) { - // Optional [tb] argument is engaged. - // ref: amsmath: \renewcommand{\smash}[1][tb]{% - // def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% - var letter = ""; - for (var i = 0; i < tbArg.value.length; ++i) { - letter = tbArg.value[i].value; - if (letter === "t") { - smashHeight = true; - } else if (letter === "b") { - smashDepth = true; - } else { - smashHeight = false; - smashDepth = false; - break; - } - } - } else { - smashHeight = true; - smashDepth = true; - } - - var body = args[0]; - return { - type: "smash", - body: body, - smashHeight: smashHeight, - smashDepth: smashDepth - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var node = _buildCommon2.default.makeSpan(["mord"], [html.buildGroup(group.value.body, options)]); - - if (!group.value.smashHeight && !group.value.smashDepth) { - return node; - } - - if (group.value.smashHeight) { - node.height = 0; - // In order to influence makeVList, we have to reset the children. - if (node.children) { - for (var i = 0; i < node.children.length; i++) { - node.children[i].height = 0; - } - } - } - - if (group.value.smashDepth) { - node.depth = 0; - if (node.children) { - for (var _i = 0; _i < node.children.length; _i++) { - node.children[_i].depth = 0; - } - } - } - - // At this point, we've reset the TeX-like height and depth values. - // But the span still has an HTML line height. - // makeVList applies "display: table-cell", which prevents the browser - // from acting on that line height. So we'll call makeVList now. - - return _buildCommon2.default.makeVList({ - positionType: "firstBaseline", - children: [{ type: "elem", elem: node }] - }, options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var node = new _mathMLTree2.default.MathNode("mpadded", [mml.buildGroup(group.value.body, options)]); - - if (group.value.smashHeight) { - node.setAttribute("height", "0px"); - } - - if (group.value.smashDepth) { - node.setAttribute("depth", "0px"); - } - - return node; - } -}); -// smash, with optional [tb], as in AMS - -},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],118:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// Non-mathy text, possibly in a font -var textFunctionFonts = { - "\\text": undefined, "\\textrm": "mathrm", "\\textsf": "mathsf", - "\\texttt": "mathtt", "\\textnormal": "mathrm", "\\textbf": "mathbf", - "\\textit": "textit" -}; - - -(0, _defineFunction2.default)({ - type: "text", - names: ["\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", "\\textbf", "\\textit"], - props: { - numArgs: 1, - argTypes: ["text"], - greediness: 2, - allowedInText: true - }, - handler: function handler(context, args) { - var body = args[0]; - return { - type: "text", - body: (0, _defineFunction.ordargument)(body), - font: textFunctionFonts[context.funcName] - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var newOptions = options.withFont(group.value.font); - var inner = html.buildExpression(group.value.body, newOptions, true); - _buildCommon2.default.tryCombineChars(inner); - return _buildCommon2.default.makeSpan(["mord", "text"], inner, newOptions); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var body = group.value.body; - - // Convert each element of the body into MathML, and combine consecutive - // outputs into a single tag. In this way, we don't - // nest non-text items (e.g., $nested-math$) within an . - var inner = []; - var currentText = null; - for (var i = 0; i < body.length; i++) { - var _group = mml.buildGroup(body[i], options); - if (_group.type === 'mtext' && currentText != null) { - Array.prototype.push.apply(currentText.children, _group.children); - } else { - inner.push(_group); - if (_group.type === 'mtext') { - currentText = _group; - } - } - } - - // If there is a single tag in the end (presumably ), - // just return it. Otherwise, wrap them in an . - if (inner.length === 1) { - return inner[0]; - } else { - return new _mathMLTree2.default.MathNode("mrow", inner); - } - } -}); - -},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],119:[function(require,module,exports){ -"use strict"; - -var _defineFunction = require("../defineFunction"); - -var _defineFunction2 = _interopRequireDefault(_defineFunction); - -var _buildCommon = require("../buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("../mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _buildHTML = require("../buildHTML"); - -var html = _interopRequireWildcard(_buildHTML); - -var _buildMathML = require("../buildMathML"); - -var mml = _interopRequireWildcard(_buildMathML); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _defineFunction2.default)({ - type: "underline", - names: ["\\underline"], - props: { - numArgs: 1 - }, - handler: function handler(context, args) { - var body = args[0]; - return { - type: "underline", - body: body - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - // Underlines are handled in the TeXbook pg 443, Rule 10. - // Build the inner group. - var innerGroup = html.buildGroup(group.value.body, options); - - // Create the line above the body - var line = _buildCommon2.default.makeLineSpan("underline-line", options); - - // Generate the vlist, with the appropriate kerns - var vlist = _buildCommon2.default.makeVList({ - positionType: "top", - positionData: innerGroup.height, - children: [{ type: "kern", size: line.height }, { type: "elem", elem: line }, { type: "kern", size: 3 * line.height }, { type: "elem", elem: innerGroup }] - }, options); - - return _buildCommon2.default.makeSpan(["mord", "underline"], [vlist], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var operator = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode("\u203E")]); - operator.setAttribute("stretchy", "true"); - - var node = new _mathMLTree2.default.MathNode("munder", [mml.buildGroup(group.value.body, options), operator]); - node.setAttribute("accentunder", "true"); - - return node; - } -}); - -},{"../buildCommon":91,"../buildHTML":92,"../buildMathML":93,"../defineFunction":96,"../mathMLTree":121}],120:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _fontMetricsData = require("./fontMetricsData"); - -var _fontMetricsData2 = _interopRequireDefault(_fontMetricsData); - -var _symbols = require("./symbols"); - -var _symbols2 = _interopRequireDefault(_symbols); - -var _utils = require("./utils"); - -var _utils2 = _interopRequireDefault(_utils); - -var _Token = require("./Token"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Provides context to macros defined by functions. Implemented by - * MacroExpander. - */ - - -/** Macro tokens (in reverse order). */ - -/** - * Predefined macros for KaTeX. - * This can be used to define some commands in terms of others. - */ - -var builtinMacros = {}; -exports.default = builtinMacros; - -// This function might one day accept an additional argument and do more things. - -function defineMacro(name, body) { - builtinMacros[name] = body; -} - -////////////////////////////////////////////////////////////////////// -// macro tools - -defineMacro("\\@firstoftwo", function (context) { - var args = context.consumeArgs(2); - return { tokens: args[0], numArgs: 0 }; -}); - -defineMacro("\\@ifnextchar", function (context) { - var args = context.consumeArgs(3); // symbol, if, else - var nextToken = context.future(); - if (args[0].length === 1 && args[0][0].text === nextToken.text) { - return { tokens: args[1], numArgs: 0 }; - } else { - return { tokens: args[2], numArgs: 0 }; - } -}); - -// \def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}} -defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); - -////////////////////////////////////////////////////////////////////// -// basics -defineMacro("\\bgroup", "{"); -defineMacro("\\egroup", "}"); -defineMacro("\\begingroup", "{"); -defineMacro("\\endgroup", "}"); - -// Unicode double-struck letters -defineMacro("\u2102", "\\mathbb{C}"); -defineMacro("\u210D", "\\mathbb{H}"); -defineMacro("\u2115", "\\mathbb{N}"); -defineMacro("\u2119", "\\mathbb{P}"); -defineMacro("\u211A", "\\mathbb{Q}"); -defineMacro("\u211D", "\\mathbb{R}"); -defineMacro("\u2124", "\\mathbb{Z}"); - -// \llap and \rlap render their contents in text mode -defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); -defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); -defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); - -////////////////////////////////////////////////////////////////////// -// amsmath.sty -// http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf - -// \def\overset#1#2{\binrel@{#2}\binrel@@{\mathop{\kern\z@#2}\limits^{#1}}} -defineMacro("\\overset", "\\mathop{#2}\\limits^{#1}"); -defineMacro("\\underset", "\\mathop{#2}\\limits_{#1}"); - -// \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} -defineMacro("\\boxed", "\\fbox{\\displaystyle{#1}}"); - -// \def\iff{\DOTSB\;\Longleftrightarrow\;} -// \def\implies{\DOTSB\;\Longrightarrow\;} -// \def\impliedby{\DOTSB\;\Longleftarrow\;} -defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); -defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); -defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); - -// AMSMath's automatic \dots, based on \mdots@@ macro. -var dotsByToken = { - ',': '\\dotsc', - '\\not': '\\dotsb', - // \keybin@ checks for the following: - '+': '\\dotsb', - '=': '\\dotsb', - '<': '\\dotsb', - '>': '\\dotsb', - '-': '\\dotsb', - '*': '\\dotsb', - ':': '\\dotsb', - // Symbols whose definition starts with \DOTSB: - '\\DOTSB': '\\dotsb', - '\\coprod': '\\dotsb', - '\\bigvee': '\\dotsb', - '\\bigwedge': '\\dotsb', - '\\biguplus': '\\dotsb', - '\\bigcap': '\\dotsb', - '\\bigcup': '\\dotsb', - '\\prod': '\\dotsb', - '\\sum': '\\dotsb', - '\\bigotimes': '\\dotsb', - '\\bigoplus': '\\dotsb', - '\\bigodot': '\\dotsb', - '\\bigsqcup': '\\dotsb', - '\\implies': '\\dotsb', - '\\impliedby': '\\dotsb', - '\\And': '\\dotsb', - '\\longrightarrow': '\\dotsb', - '\\Longrightarrow': '\\dotsb', - '\\longleftarrow': '\\dotsb', - '\\Longleftarrow': '\\dotsb', - '\\longleftrightarrow': '\\dotsb', - '\\Longleftrightarrow': '\\dotsb', - '\\mapsto': '\\dotsb', - '\\longmapsto': '\\dotsb', - '\\hookrightarrow': '\\dotsb', - '\\iff': '\\dotsb', - '\\doteq': '\\dotsb', - // Symbols whose definition starts with \mathbin: - '\\mathbin': '\\dotsb', - '\\bmod': '\\dotsb', - // Symbols whose definition starts with \mathrel: - '\\mathrel': '\\dotsb', - '\\relbar': '\\dotsb', - '\\Relbar': '\\dotsb', - '\\xrightarrow': '\\dotsb', - '\\xleftarrow': '\\dotsb', - // Symbols whose definition starts with \DOTSI: - '\\DOTSI': '\\dotsi', - '\\int': '\\dotsi', - '\\oint': '\\dotsi', - '\\iint': '\\dotsi', - '\\iiint': '\\dotsi', - '\\iiiint': '\\dotsi', - '\\idotsint': '\\dotsi', - // Symbols whose definition starts with \DOTSX: - '\\DOTSX': '\\dotsx' -}; - -defineMacro("\\dots", function (context) { - // TODO: If used in text mode, should expand to \textellipsis. - // However, in KaTeX, \textellipsis and \ldots behave the same - // (in text mode), and it's unlikely we'd see any of the math commands - // that affect the behavior of \dots when in text mode. So fine for now - // (until we support \ifmmode ... \else ... \fi). - var thedots = '\\dotso'; - var next = context.expandAfterFuture().text; - if (next in dotsByToken) { - thedots = dotsByToken[next]; - } else if (next.substr(0, 4) === '\\not') { - thedots = '\\dotsb'; - } else if (next in _symbols2.default.math) { - if (_utils2.default.contains(['bin', 'rel'], _symbols2.default.math[next].group)) { - thedots = '\\dotsb'; - } - } - return thedots; -}); - -var spaceAfterDots = { - // \rightdelim@ checks for the following: - ')': true, - ']': true, - '\\rbrack': true, - '\\}': true, - '\\rbrace': true, - '\\rangle': true, - '\\rceil': true, - '\\rfloor': true, - '\\rgroup': true, - '\\rmoustache': true, - '\\right': true, - '\\bigr': true, - '\\biggr': true, - '\\Bigr': true, - '\\Biggr': true, - // \extra@ also tests for the following: - '$': true, - // \extrap@ checks for the following: - ';': true, - '.': true, - ',': true -}; - -defineMacro("\\dotso", function (context) { - var next = context.future().text; - if (next in spaceAfterDots) { - return "\\ldots\\,"; - } else { - return "\\ldots"; - } -}); - -defineMacro("\\dotsc", function (context) { - var next = context.future().text; - // \dotsc uses \extra@ but not \extrap@, instead specially checking for - // ';' and '.', but doesn't check for ','. - if (next in spaceAfterDots && next !== ',') { - return "\\ldots\\,"; - } else { - return "\\ldots"; - } -}); - -defineMacro("\\cdots", function (context) { - var next = context.future().text; - if (next in spaceAfterDots) { - return "\\@cdots\\,"; - } else { - return "\\@cdots"; - } -}); - -defineMacro("\\dotsb", "\\cdots"); -defineMacro("\\dotsm", "\\cdots"); -defineMacro("\\dotsi", "\\!\\cdots"); -// amsmath doesn't actually define \dotsx, but \dots followed by a macro -// starting with \DOTSX implies \dotso, and then \extra@ detects this case -// and forces the added `\,`. -defineMacro("\\dotsx", "\\ldots\\,"); - -// \let\DOTSI\relax -// \let\DOTSB\relax -// \let\DOTSX\relax -defineMacro("\\DOTSI", "\\relax"); -defineMacro("\\DOTSB", "\\relax"); -defineMacro("\\DOTSX", "\\relax"); - -// http://texdoc.net/texmf-dist/doc/latex/amsmath/amsmath.pdf -defineMacro("\\thinspace", "\\,"); // \let\thinspace\, -defineMacro("\\medspace", "\\:"); // \let\medspace\: -defineMacro("\\thickspace", "\\;"); // \let\thickspace\; - -////////////////////////////////////////////////////////////////////// -// LaTeX source2e - -// \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} -// TODO: Doesn't normally work in math mode because \@ fails. KaTeX doesn't -// support \@ yet, so that's omitted, and we add \text so that the result -// doesn't look funny in math mode. -defineMacro("\\TeX", "\\textrm{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}"); - -// \DeclareRobustCommand{\LaTeX}{L\kern-.36em% -// {\sbox\z@ T% -// \vbox to\ht\z@{\hbox{\check@mathfonts -// \fontsize\sf@size\z@ -// \math@fontsfalse\selectfont -// A}% -// \vss}% -// }% -// \kern-.15em% -// \TeX} -// This code aligns the top of the A with the T (from the perspective of TeX's -// boxes, though visually the A appears to extend above slightly). -// We compute the corresponding \raisebox when A is rendered at \scriptsize, -// which is size3, which has a scale factor of 0.7 (see Options.js). -var latexRaiseA = _fontMetricsData2.default['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * _fontMetricsData2.default['Main-Regular']["A".charCodeAt(0)][1] + "em"; -defineMacro("\\LaTeX", "\\textrm{L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptsize A}" + "\\kern-.15em\\TeX}"); - -// New KaTeX logo based on tweaking LaTeX logo -defineMacro("\\KaTeX", "\\textrm{K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptsize A}" + "\\kern-.15em\\TeX}"); - -// \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace} -// \def\@hspace#1{\hskip #1\relax} -// KaTeX doesn't do line breaks, so \hspace and \hspace* are the same as \kern -defineMacro("\\hspace", "\\@ifstar\\kern\\kern"); - -////////////////////////////////////////////////////////////////////// -// mathtools.sty - -//\providecommand\ordinarycolon{:} -defineMacro("\\ordinarycolon", ":"); -//\def\vcentcolon{\mathrel{\mathop\ordinarycolon}} -//TODO(edemaine): Not yet centered. Fix via \raisebox or #726 -defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); -// \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon} -defineMacro("\\dblcolon", "\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon"); -// \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=} -defineMacro("\\coloneqq", "\\vcentcolon\\mathrel{\\mkern-1.2mu}="); -// \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=} -defineMacro("\\Coloneqq", "\\dblcolon\\mathrel{\\mkern-1.2mu}="); -// \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}} -defineMacro("\\coloneq", "\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}"); -// \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}} -defineMacro("\\Coloneq", "\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}"); -// \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon} -defineMacro("\\eqqcolon", "=\\mathrel{\\mkern-1.2mu}\\vcentcolon"); -// \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon} -defineMacro("\\Eqqcolon", "=\\mathrel{\\mkern-1.2mu}\\dblcolon"); -// \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon} -defineMacro("\\eqcolon", "\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon"); -// \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon} -defineMacro("\\Eqcolon", "\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon"); -// \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx} -defineMacro("\\colonapprox", "\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx"); -// \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx} -defineMacro("\\Colonapprox", "\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx"); -// \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim} -defineMacro("\\colonsim", "\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim"); -// \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim} -defineMacro("\\Colonsim", "\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim"); - -////////////////////////////////////////////////////////////////////// -// colonequals.sty - -// Alternate names for mathtools's macros: -defineMacro("\\ratio", "\\vcentcolon"); -defineMacro("\\coloncolon", "\\dblcolon"); -defineMacro("\\colonequals", "\\coloneqq"); -defineMacro("\\coloncolonequals", "\\Coloneqq"); -defineMacro("\\equalscolon", "\\eqqcolon"); -defineMacro("\\equalscoloncolon", "\\Eqqcolon"); -defineMacro("\\colonminus", "\\coloneq"); -defineMacro("\\coloncolonminus", "\\Coloneq"); -defineMacro("\\minuscolon", "\\eqcolon"); -defineMacro("\\minuscoloncolon", "\\Eqcolon"); -// \colonapprox name is same in mathtools and colonequals. -defineMacro("\\coloncolonapprox", "\\Colonapprox"); -// \colonsim name is same in mathtools and colonequals. -defineMacro("\\coloncolonsim", "\\Colonsim"); - -// Additional macros, implemented by analogy with mathtools definitions: -defineMacro("\\simcolon", "\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon"); -defineMacro("\\simcoloncolon", "\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon"); -defineMacro("\\approxcolon", "\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon"); -defineMacro("\\approxcoloncolon", "\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon"); - -// Present in newtxmath, pxfonts and txfonts -// TODO: The unicode character U+220C ∌ should be added to the font, and this -// macro turned into a propper defineSymbol in symbols.js. That way, the -// MathML result will be much cleaner. -defineMacro("\\notni", "\\not\\ni"); - -},{"./Token":90,"./fontMetricsData":102,"./symbols":125,"./utils":128}],121:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _getIterator2 = require("babel-runtime/core-js/get-iterator"); - -var _getIterator3 = _interopRequireDefault(_getIterator2); - -var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); - -var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - -var _createClass2 = require("babel-runtime/helpers/createClass"); - -var _createClass3 = _interopRequireDefault(_createClass2); - -var _utils = require("./utils"); - -var _utils2 = _interopRequireDefault(_utils); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * This node represents a general purpose MathML node of any type. The - * constructor requires the type of node to create (for example, `"mo"` or - * `"mspace"`, corresponding to `` and `` tags). - */ - - -/** - * MathML node types used in KaTeX. For a complete list of MathML nodes, see - * https://developer.mozilla.org/en-US/docs/Web/MathML/Element. - */ -var MathNode = function () { - function MathNode(type, children) { - (0, _classCallCheck3.default)(this, MathNode); - - this.type = type; - this.attributes = {}; - this.children = children || []; - } - - /** - * Sets an attribute on a MathML node. MathML depends on attributes to convey a - * semantic content, so this is used heavily. - */ - - - (0, _createClass3.default)(MathNode, [{ - key: "setAttribute", - value: function setAttribute(name, value) { - this.attributes[name] = value; - } - - /** - * Converts the math node into a MathML-namespaced DOM element. - */ - - }, { - key: "toNode", - value: function toNode() { - var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type); - - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - node.setAttribute(attr, this.attributes[attr]); - } - } - - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = (0, _getIterator3.default)(this.children), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var child = _step.value; - - node.appendChild(child.toNode()); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - return node; - } - - /** - * Converts the math node into an HTML markup string. - */ - - }, { - key: "toMarkup", - value: function toMarkup() { - var markup = "<" + this.type; - - // Add the attributes - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - markup += " " + attr + "=\""; - markup += _utils2.default.escape(this.attributes[attr]); - markup += "\""; - } - } - - markup += ">"; - - for (var i = 0; i < this.children.length; i++) { - markup += this.children[i].toMarkup(); - } - - markup += ""; - - return markup; - } - }]); - return MathNode; -}(); - -/** - * This node represents a piece of text. - */ - -/** - * These objects store data about MathML nodes. This is the MathML equivalent - * of the types in domTree.js. Since MathML handles its own rendering, and - * since we're mainly using MathML to improve accessibility, we don't manage - * any of the styling state that the plain DOM nodes do. - * - * The `toNode` and `toMarkup` functions work simlarly to how they do in - * domTree.js, creating namespaced DOM nodes and HTML text markup respectively. - */ - -var TextNode = function () { - function TextNode(text) { - (0, _classCallCheck3.default)(this, TextNode); - - this.text = text; - } - - /** - * Converts the text node into a DOM text node. - */ - - - (0, _createClass3.default)(TextNode, [{ - key: "toNode", - value: function toNode() { - return document.createTextNode(this.text); - } - - /** - * Converts the text node into HTML markup (which is just the text itself). - */ - - }, { - key: "toMarkup", - value: function toMarkup() { - return _utils2.default.escape(this.text); - } - }]); - return TextNode; -}(); - -exports.default = { - MathNode: MathNode, - TextNode: TextNode -}; - -},{"./utils":128,"babel-runtime/core-js/get-iterator":3,"babel-runtime/helpers/classCallCheck":8,"babel-runtime/helpers/createClass":9}],122:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _Parser = require("./Parser"); - -var _Parser2 = _interopRequireDefault(_Parser); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Parses an expression using a Parser, then returns the parsed result. - */ -var parseTree = function parseTree(toParse, settings) { - if (!(typeof toParse === 'string' || toParse instanceof String)) { - throw new TypeError('KaTeX can only parse string typed expression'); - } - var parser = new _Parser2.default(toParse, settings); - - return parser.parse(); -}; -/** - * Provides a single function for parsing an expression using a Parser - * TODO(emily): Remove this - */ - -exports.default = parseTree; - -},{"./Parser":86}],123:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _slicedToArray2 = require("babel-runtime/helpers/slicedToArray"); - -var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); - -var _domTree = require("./domTree"); - -var _domTree2 = _interopRequireDefault(_domTree); - -var _buildCommon = require("./buildCommon"); - -var _buildCommon2 = _interopRequireDefault(_buildCommon); - -var _mathMLTree = require("./mathMLTree"); - -var _mathMLTree2 = _interopRequireDefault(_mathMLTree); - -var _utils = require("./utils"); - -var _utils2 = _interopRequireDefault(_utils); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * This file provides support to buildMathML.js and buildHTML.js - * for stretchy wide elements rendered from SVG files - * and other CSS trickery. - */ - -var stretchyCodePoint = { - widehat: "^", - widetilde: "~", - utilde: "~", - overleftarrow: "\u2190", - underleftarrow: "\u2190", - xleftarrow: "\u2190", - overrightarrow: "\u2192", - underrightarrow: "\u2192", - xrightarrow: "\u2192", - underbrace: "\u23B5", - overbrace: "\u23DE", - overleftrightarrow: "\u2194", - underleftrightarrow: "\u2194", - xleftrightarrow: "\u2194", - Overrightarrow: "\u21D2", - xRightarrow: "\u21D2", - overleftharpoon: "\u21BC", - xleftharpoonup: "\u21BC", - overrightharpoon: "\u21C0", - xrightharpoonup: "\u21C0", - xLeftarrow: "\u21D0", - xLeftrightarrow: "\u21D4", - xhookleftarrow: "\u21A9", - xhookrightarrow: "\u21AA", - xmapsto: "\u21A6", - xrightharpoondown: "\u21C1", - xleftharpoondown: "\u21BD", - xrightleftharpoons: "\u21CC", - xleftrightharpoons: "\u21CB", - xtwoheadleftarrow: "\u219E", - xtwoheadrightarrow: "\u21A0", - xlongequal: "=", - xtofrom: "\u21C4" -}; - -var mathMLnode = function mathMLnode(label) { - var node = new _mathMLTree2.default.MathNode("mo", [new _mathMLTree2.default.TextNode(stretchyCodePoint[label.substr(1)])]); - node.setAttribute("stretchy", "true"); - return node; -}; - -// Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts. -// Copyright (c) 2009-2010, Design Science, Inc. () -// Copyright (c) 2014-2017 Khan Academy () -// Licensed under the SIL Open Font License, Version 1.1. -// See \nhttp://scripts.sil.org/OFL - -// Very Long SVGs -// Many of the KaTeX stretchy wide elements use a long SVG image and an -// overflow: hidden tactic to achieve a stretchy image while avoiding -// distortion of arrowheads or brace corners. - -// The SVG typically contains a very long (400 em) arrow. - -// The SVG is in a container span that has overflow: hidden, so the span -// acts like a window that exposes only part of the SVG. - -// The SVG always has a longer, thinner aspect ratio than the container span. -// After the SVG fills 100% of the height of the container span, -// there is a long arrow shaft left over. That left-over shaft is not shown. -// Instead, it is sliced off because the span's CSS has overflow: hidden. - -// Thus, the reader sees an arrow that matches the subject matter width -// without distortion. - -// Some functions, such as \cancel, need to vary their aspect ratio. These -// functions do not get the overflow SVG treatment. - -// Second Brush Stroke -// Low resolution monitors struggle to display images in fine detail. -// So browsers apply anti-aliasing. A long straight arrow shaft therefore -// will sometimes appear as if it has a blurred edge. - -// To mitigate this, these SVG files contain a second "brush-stroke" on the -// arrow shafts. That is, a second long thin rectangular SVG path has been -// written directly on top of each arrow shaft. This reinforcement causes -// some of the screen pixels to display as black instead of the anti-aliased -// gray pixel that a single path would generate. So we get arrow shafts -// whose edges appear to be sharper. - -// In the katexImagesData object just below, the dimensions all -// correspond to path geometry inside the relevant SVG. -// For example, \overrightarrow uses the same arrowhead as glyph U+2192 -// from the KaTeX Main font. The scaling factor is 1000. -// That is, inside the font, that arrowhead is 522 units tall, which -// corresponds to 0.522 em inside the document. - -var katexImagesData = { - // path(s), minWidth, height, align - overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], - overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], - underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], - underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], - xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], - xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], - Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], - xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], - xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], - overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"], - xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"], - xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"], - overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"], - xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], - xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], - xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], - xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], - xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], - - overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], - overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548], - underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548], - underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], - xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522], - xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], - xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716], - xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716], - xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522], - xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522], - overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], - underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], - overgroup: [["leftgroup", "rightgroup"], 0.888, 342], - undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342], - xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522], - xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528] -}; - -var groupLength = function groupLength(arg) { - if (arg.type === "ordgroup") { - return arg.value.length; - } else { - return 1; - } -}; - -var svgSpan = function svgSpan(group, options) { - // Create a span with inline SVG for the element. - function buildSvgSpan_() { - var viewBoxWidth = 400000; // default - var label = group.value.label.substr(1); - if (_utils2.default.contains(["widehat", "widetilde", "utilde"], label)) { - // There are four SVG images available for each function. - // Choose a taller image when there are more characters. - var numChars = groupLength(group.value.base); - var viewBoxHeight = void 0; - var pathName = void 0; - var _height = void 0; - - if (numChars > 5) { - viewBoxHeight = label === "widehat" ? 420 : 312; - viewBoxWidth = label === "widehat" ? 2364 : 2340; - // Next get the span height, in 1000 ems - _height = label === "widehat" ? 0.42 : 0.34; - pathName = (label === "widehat" ? "widehat" : "tilde") + "4"; - } else { - var imgIndex = [1, 1, 2, 2, 3, 3][numChars]; - if (label === "widehat") { - viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex]; - viewBoxHeight = [0, 239, 300, 360, 420][imgIndex]; - _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex]; - pathName = "widehat" + imgIndex; - } else { - viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex]; - viewBoxHeight = [0, 260, 286, 306, 312][imgIndex]; - _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex]; - pathName = "tilde" + imgIndex; - } - } - var path = new _domTree2.default.pathNode(pathName); - var svgNode = new _domTree2.default.svgNode([path], { - "width": "100%", - "height": _height + "em", - "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight, - "preserveAspectRatio": "none" - }); - return { - span: _buildCommon2.default.makeSpan([], [svgNode], options), - minWidth: 0, - height: _height - }; - } else { - var spans = []; - - var _katexImagesData$labe = (0, _slicedToArray3.default)(katexImagesData[label], 4), - paths = _katexImagesData$labe[0], - _minWidth = _katexImagesData$labe[1], - _viewBoxHeight = _katexImagesData$labe[2], - align1 = _katexImagesData$labe[3]; - - var _height2 = _viewBoxHeight / 1000; - - var numSvgChildren = paths.length; - var widthClasses = void 0; - var aligns = void 0; - if (numSvgChildren === 1) { - widthClasses = ["hide-tail"]; - aligns = [align1]; - } else if (numSvgChildren === 2) { - widthClasses = ["halfarrow-left", "halfarrow-right"]; - aligns = ["xMinYMin", "xMaxYMin"]; - } else if (numSvgChildren === 3) { - widthClasses = ["brace-left", "brace-center", "brace-right"]; - aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"]; - } else { - throw new Error("Correct katexImagesData or update code here to support\n " + numSvgChildren + " children."); - } - - for (var i = 0; i < numSvgChildren; i++) { - var _path = new _domTree2.default.pathNode(paths[i]); - - var _svgNode = new _domTree2.default.svgNode([_path], { - "width": "400em", - "height": _height2 + "em", - "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight, - "preserveAspectRatio": aligns[i] + " slice" - }); - - var _span = _buildCommon2.default.makeSpan([widthClasses[i]], [_svgNode], options); - if (numSvgChildren === 1) { - return { span: _span, minWidth: _minWidth, height: _height2 }; - } else { - _span.style.height = _height2 + "em"; - spans.push(_span); - } - } - - return { - span: _buildCommon2.default.makeSpan(["stretchy"], spans, options), - minWidth: _minWidth, - height: _height2 - }; - } - } // buildSvgSpan_() - - var _buildSvgSpan_ = buildSvgSpan_(), - span = _buildSvgSpan_.span, - minWidth = _buildSvgSpan_.minWidth, - height = _buildSvgSpan_.height; - - // Note that we are returning span.depth = 0. - // Any adjustments relative to the baseline must be done in buildHTML. - - - span.height = height; - span.style.height = height + "em"; - if (minWidth > 0) { - span.style.minWidth = minWidth + "em"; - } - - return span; -}; - -var encloseSpan = function encloseSpan(inner, label, pad, options) { - // Return an image span for \cancel, \bcancel, \xcancel, or \fbox - var img = void 0; - var totalHeight = inner.height + inner.depth + 2 * pad; - - if (/fbox|color/.test(label)) { - img = _buildCommon2.default.makeSpan(["stretchy", label], [], options); - - if (label === "fbox") { - var color = options.color && options.getColor(); - if (color) { - img.style.borderColor = color; - } - } - } else { - // \cancel, \bcancel, or \xcancel - // Since \cancel's SVG is inline and it omits the viewBox attribute, - // its stroke-width will not vary with span area. - - var lines = []; - if (/^[bx]cancel$/.test(label)) { - lines.push(new _domTree2.default.lineNode({ - "x1": "0", - "y1": "0", - "x2": "100%", - "y2": "100%", - "stroke-width": "0.046em" - })); - } - - if (/^x?cancel$/.test(label)) { - lines.push(new _domTree2.default.lineNode({ - "x1": "0", - "y1": "100%", - "x2": "100%", - "y2": "0", - "stroke-width": "0.046em" - })); - } - - var svgNode = new _domTree2.default.svgNode(lines, { - "width": "100%", - "height": totalHeight + "em" - }); - - img = _buildCommon2.default.makeSpan([], [svgNode], options); - } - - img.height = totalHeight; - img.style.height = totalHeight + "em"; - - return img; -}; - -var ruleSpan = function ruleSpan(className, options) { - // Get a big square image. The parent span will hide the overflow. - var pathNode = new _domTree2.default.pathNode('bigRule'); - var svg = new _domTree2.default.svgNode([pathNode], { - "width": "400em", - "height": "400em", - "viewBox": "0 0 400000 400000", - "preserveAspectRatio": "xMinYMin slice" - }); - return _buildCommon2.default.makeSpan([className, "hide-tail"], [svg], options); -}; - -exports.default = { - encloseSpan: encloseSpan, - mathMLnode: mathMLnode, - ruleSpan: ruleSpan, - svgSpan: svgSpan -}; - -},{"./buildCommon":91,"./domTree":98,"./mathMLTree":121,"./utils":128,"babel-runtime/helpers/slicedToArray":10}],124:[function(require,module,exports){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var path = { - // bigRule provides a big square image for frac-lines, etc. - // The actual rendered rule is smaller, controlled by overflow:hidden. - bigRule: 'M0 0 h400000 v400000 h-400000z M0 0 h400000 v400000 h-400000z', - - // sqrtMain path geometry is from glyph U221A in the font KaTeX Main - sqrtMain: 'M95 622c-2.667 0-7.167-2.667-13.5\n-8S72 604 72 600c0-2 .333-3.333 1-4 1.333-2.667 23.833-20.667 67.5-54s\n65.833-50.333 66.5-51c1.333-1.333 3-2 5-2 4.667 0 8.667 3.333 12 10l173\n378c.667 0 35.333-71 104-213s137.5-285 206.5-429S812 17.333 812 14c5.333\n-9.333 12-14 20-14h399166v40H845.272L620 507 385 993c-2.667 4.667-9 7-19\n7-6 0-10-1-12-3L160 575l-65 47zM834 0h399166v40H845z', - - // size1 is from glyph U221A in the font KaTeX_Size1-Regular - sqrtSize1: 'M263 601c.667 0 18 39.667 52 119s68.167\n 158.667 102.5 238 51.833 119.333 52.5 120C810 373.333 980.667 17.667 982 11\nc4.667-7.333 11-11 19-11h398999v40H1012.333L741 607c-38.667 80.667-84 175-136\n 283s-89.167 185.333-111.5 232-33.833 70.333-34.5 71c-4.667 4.667-12.333 7-23\n 7l-12-1-109-253c-72.667-168-109.333-252-110-252-10.667 8-22 16.667-34 26-22\n 17.333-33.333 26-34 26l-26-26 76-59 76-60zM1001 0h398999v40H1012z', - - // size2 is from glyph U221A in the font KaTeX_Size2-Regular - sqrtSize2: 'M1001 0h398999v40H1013.084S929.667 308 749\n 880s-277 876.333-289 913c-4.667 4.667-12.667 7-24 7h-12c-1.333-3.333-3.667\n-11.667-7-25-35.333-125.333-106.667-373.333-214-744-10 12-21 25-33 39l-32 39\nc-6-5.333-15-14-27-26l25-30c26.667-32.667 52-63 76-91l52-60 208 722c56-175.333\n 126.333-397.333 211-666s153.833-488.167 207.5-658.5C944.167 129.167 975 32.667\n 983 10c4-6.667 10-10 18-10zm0 0h398999v40H1013z', - - // size3 is from glyph U221A in the font KaTeX_Size3-Regular - sqrtSize3: 'M424 2398c-1.333-.667-38.5-172-111.5-514 S202.667 1370.667 202\n 1370c0-2-10.667 14.333-32 49-4.667 7.333-9.833 15.667-15.5 25s-9.833 16-12.5\n 20l-5 7c-4-3.333-8.333-7.667-13-13l-13-13 76-122 77-121 209 968c0-2 84.667\n-361.667 254-1079C896.333 373.667 981.667 13.333 983 10c4-6.667 10-10 18-10\nh398999v40H1014.622S927.332 418.667 742 1206c-185.333 787.333-279.333 1182.333\n-282 1185-2 6-10 9-24 9-8 0-12-.667-12-2zM1001 0h398999v40H1014z', - - // size4 is from glyph U221A in the font KaTeX_Size4-Regular - sqrtSize4: 'M473 2713C812.333 913.667 982.333 13 983 11c3.333-7.333 9.333\n-11 18-11h399110v40H1017.698S927.168 518 741.5 1506C555.833 2494 462 2989 460\n 2991c-2 6-10 9-24 9-8 0-12-.667-12-2s-5.333-32-16-92c-50.667-293.333-119.667\n-693.333-207-1200 0-1.333-5.333 8.667-16 30l-32 64-16 33-26-26 76-153 77-151\nc.667.667 35.667 202 105 604 67.333 400.667 102 602.667 104 606z\nM1001 0h398999v40H1017z', - - // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main - doubleleftarrow: 'M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z', - - // doublerightarrow is from glyph U+21D2 in font KaTeX Main - doublerightarrow: 'M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z', - - // leftarrow is from glyph U+2190 in font KaTeX Main - leftarrow: 'M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z', - - // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular - leftbrace: 'M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z', - - leftbraceunder: 'M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z', - - // overgroup is from the MnSymbol package (public domain) - leftgroup: 'M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z', - - leftgroupunder: 'M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z', - - // Harpoons are from glyph U+21BD in font KaTeX Main - leftharpoon: 'M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z', - - leftharpoonplus: 'M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z', - - leftharpoondown: 'M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z', - - leftharpoondownplus: 'M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z', - - // hook is from glyph U+21A9 in font KaTeX Main - lefthook: 'M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z', - - leftlinesegment: 'M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z', - - leftmapsto: 'M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z', - - // tofrom is from glyph U+21C4 in font KaTeX AMS Regular - leftToFrom: 'M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z', - - longequal: 'M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z', - - midbrace: 'M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z', - - midbraceunder: 'M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z', - - rightarrow: 'M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z', - - rightbrace: 'M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z', - - rightbraceunder: 'M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z', - - rightgroup: 'M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z', - - rightgroupunder: 'M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z', - - rightharpoon: 'M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z', - - rightharpoonplus: 'M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z', - - rightharpoondown: 'M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z', - - rightharpoondownplus: 'M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z', - - righthook: 'M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z', - - rightlinesegment: 'M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z', - - rightToFrom: 'M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z', - - // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular - twoheadleftarrow: 'M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z', - - twoheadrightarrow: 'M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z', - - // tilde1 is a modified version of a glyph from the MnSymbol package - tilde1: 'M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z', - - // ditto tilde2, tilde3, & tilde4 - tilde2: 'M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z', - - tilde3: 'M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z', - - tilde4: 'M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z', - - // widehat1 is a modified version of a glyph from the MnSymbol package - widehat1: 'M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z', - - // ditto widehat2, widehat3, & widehat4 - widehat2: 'M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z', - - widehat3: 'M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z', - - widehat4: 'M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z' -}; - -exports.default = { path: path }; - -},{}],125:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -/** - * This file holds a list of all no-argument functions and single-character - * symbols (like 'a' or ';'). - * - * For each of the symbols, there are three properties they can have: - * - font (required): the font to be used for this symbol. Either "main" (the - normal font), or "ams" (the ams fonts). - * - group (required): the ParseNode group type the symbol should have (i.e. - "textord", "mathord", etc). - See https://github.com/Khan/KaTeX/wiki/Examining-TeX#group-types - * - replace: the character that this symbol or function should be - * replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi - * character in the main font). - * - * The outermost map in the table indicates what mode the symbols should be - * accepted in (e.g. "math" or "text"). - */ - -var symbols = { - "math": {}, - "text": {} -}; -exports.default = symbols; - -/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */ - -function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) { - symbols[mode][name] = { font: font, group: group, replace: replace }; - - if (acceptUnicodeChar && replace) { - symbols[mode][replace] = symbols[mode][name]; - } -} - -// Some abbreviations for commonly used strings. -// This helps minify the code, and also spotting typos using jshint. - -// modes: -var math = "math"; -var text = "text"; - -// fonts: -var main = "main"; -var ams = "ams"; - -// groups: -var accent = "accent"; -var bin = "bin"; -var close = "close"; -var inner = "inner"; -var mathord = "mathord"; -var op = "op"; -var open = "open"; -var punct = "punct"; -var rel = "rel"; -var spacing = "spacing"; -var textord = "textord"; - -// Now comes the symbol table - -// Relation Symbols -defineSymbol(math, main, rel, "\u2261", "\\equiv", true); -defineSymbol(math, main, rel, "\u227A", "\\prec", true); -defineSymbol(math, main, rel, "\u227B", "\\succ", true); -defineSymbol(math, main, rel, "\u223C", "\\sim", true); -defineSymbol(math, main, rel, "\u22A5", "\\perp"); -defineSymbol(math, main, rel, "\u2AAF", "\\preceq", true); -defineSymbol(math, main, rel, "\u2AB0", "\\succeq", true); -defineSymbol(math, main, rel, "\u2243", "\\simeq", true); -defineSymbol(math, main, rel, "\u2223", "\\mid", true); -defineSymbol(math, main, rel, "\u226A", "\\ll"); -defineSymbol(math, main, rel, "\u226B", "\\gg", true); -defineSymbol(math, main, rel, "\u224D", "\\asymp", true); -defineSymbol(math, main, rel, "\u2225", "\\parallel"); -defineSymbol(math, main, rel, "\u22C8", "\\bowtie", true); -defineSymbol(math, main, rel, "\u2323", "\\smile", true); -defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true); -defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true); -defineSymbol(math, main, rel, "\u2250", "\\doteq", true); -defineSymbol(math, main, rel, "\u2322", "\\frown", true); -defineSymbol(math, main, rel, "\u220B", "\\ni", true); -defineSymbol(math, main, rel, "\u221D", "\\propto", true); -defineSymbol(math, main, rel, "\u22A2", "\\vdash", true); -defineSymbol(math, main, rel, "\u22A3", "\\dashv", true); -defineSymbol(math, main, rel, "\u220B", "\\owns"); - -// Punctuation -defineSymbol(math, main, punct, ".", "\\ldotp"); -defineSymbol(math, main, punct, "\u22C5", "\\cdotp"); - -// Misc Symbols -defineSymbol(math, main, textord, "#", "\\#"); -defineSymbol(text, main, textord, "#", "\\#"); -defineSymbol(math, main, textord, "&", "\\&"); -defineSymbol(text, main, textord, "&", "\\&"); -defineSymbol(math, main, textord, "\u2135", "\\aleph", true); -defineSymbol(math, main, textord, "\u2200", "\\forall", true); -defineSymbol(math, main, textord, "\u210F", "\\hbar"); -defineSymbol(math, main, textord, "\u2203", "\\exists", true); -defineSymbol(math, main, textord, "\u2207", "\\nabla", true); -defineSymbol(math, main, textord, "\u266D", "\\flat", true); -defineSymbol(math, main, textord, "\u2113", "\\ell", true); -defineSymbol(math, main, textord, "\u266E", "\\natural", true); -defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true); -defineSymbol(math, main, textord, "\u2118", "\\wp", true); -defineSymbol(math, main, textord, "\u266F", "\\sharp", true); -defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true); -defineSymbol(math, main, textord, "\u211C", "\\Re", true); -defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true); -defineSymbol(math, main, textord, "\u2111", "\\Im", true); -defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true); - -// Math and Text -defineSymbol(math, main, textord, "\u2020", "\\dag"); -defineSymbol(text, main, textord, "\u2020", "\\dag"); -defineSymbol(text, main, textord, "\u2020", "\\textdagger"); -defineSymbol(math, main, textord, "\u2021", "\\ddag"); -defineSymbol(text, main, textord, "\u2021", "\\ddag"); -defineSymbol(text, main, textord, "\u2020", "\\textdaggerdbl"); - -// Large Delimiters -defineSymbol(math, main, close, "\u23B1", "\\rmoustache"); -defineSymbol(math, main, open, "\u23B0", "\\lmoustache"); -defineSymbol(math, main, close, "\u27EF", "\\rgroup"); -defineSymbol(math, main, open, "\u27EE", "\\lgroup"); - -// Binary Operators -defineSymbol(math, main, bin, "\u2213", "\\mp", true); -defineSymbol(math, main, bin, "\u2296", "\\ominus", true); -defineSymbol(math, main, bin, "\u228E", "\\uplus", true); -defineSymbol(math, main, bin, "\u2293", "\\sqcap", true); -defineSymbol(math, main, bin, "\u2217", "\\ast"); -defineSymbol(math, main, bin, "\u2294", "\\sqcup", true); -defineSymbol(math, main, bin, "\u25EF", "\\bigcirc"); -defineSymbol(math, main, bin, "\u2219", "\\bullet"); -defineSymbol(math, main, bin, "\u2021", "\\ddagger"); -defineSymbol(math, main, bin, "\u2240", "\\wr", true); -defineSymbol(math, main, bin, "\u2A3F", "\\amalg"); -defineSymbol(math, main, bin, "&", "\\And"); // from amsmath - -// Arrow Symbols -defineSymbol(math, main, rel, "\u27F5", "\\longleftarrow", true); -defineSymbol(math, main, rel, "\u21D0", "\\Leftarrow", true); -defineSymbol(math, main, rel, "\u27F8", "\\Longleftarrow", true); -defineSymbol(math, main, rel, "\u27F6", "\\longrightarrow", true); -defineSymbol(math, main, rel, "\u21D2", "\\Rightarrow", true); -defineSymbol(math, main, rel, "\u27F9", "\\Longrightarrow", true); -defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true); -defineSymbol(math, main, rel, "\u27F7", "\\longleftrightarrow", true); -defineSymbol(math, main, rel, "\u21D4", "\\Leftrightarrow", true); -defineSymbol(math, main, rel, "\u27FA", "\\Longleftrightarrow", true); -defineSymbol(math, main, rel, "\u21A6", "\\mapsto", true); -defineSymbol(math, main, rel, "\u27FC", "\\longmapsto", true); -defineSymbol(math, main, rel, "\u2197", "\\nearrow", true); -defineSymbol(math, main, rel, "\u21A9", "\\hookleftarrow", true); -defineSymbol(math, main, rel, "\u21AA", "\\hookrightarrow", true); -defineSymbol(math, main, rel, "\u2198", "\\searrow", true); -defineSymbol(math, main, rel, "\u21BC", "\\leftharpoonup", true); -defineSymbol(math, main, rel, "\u21C0", "\\rightharpoonup", true); -defineSymbol(math, main, rel, "\u2199", "\\swarrow", true); -defineSymbol(math, main, rel, "\u21BD", "\\leftharpoondown", true); -defineSymbol(math, main, rel, "\u21C1", "\\rightharpoondown", true); -defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true); -defineSymbol(math, main, rel, "\u21CC", "\\rightleftharpoons", true); - -// AMS Negated Binary Relations -defineSymbol(math, ams, rel, "\u226E", "\\nless", true); -defineSymbol(math, ams, rel, "\uE010", "\\nleqslant"); -defineSymbol(math, ams, rel, "\uE011", "\\nleqq"); -defineSymbol(math, ams, rel, "\u2A87", "\\lneq", true); -defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true); -defineSymbol(math, ams, rel, "\uE00C", "\\lvertneqq"); -defineSymbol(math, ams, rel, "\u22E6", "\\lnsim", true); -defineSymbol(math, ams, rel, "\u2A89", "\\lnapprox", true); -defineSymbol(math, ams, rel, "\u2280", "\\nprec", true); -// unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym. -defineSymbol(math, ams, rel, "\u22E0", "\\npreceq", true); -defineSymbol(math, ams, rel, "\u22E8", "\\precnsim", true); -defineSymbol(math, ams, rel, "\u2AB9", "\\precnapprox", true); -defineSymbol(math, ams, rel, "\u2241", "\\nsim", true); -defineSymbol(math, ams, rel, "\uE006", "\\nshortmid"); -defineSymbol(math, ams, rel, "\u2224", "\\nmid", true); -defineSymbol(math, ams, rel, "\u22AC", "\\nvdash", true); -defineSymbol(math, ams, rel, "\u22AD", "\\nvDash", true); -defineSymbol(math, ams, rel, "\u22EA", "\\ntriangleleft"); -defineSymbol(math, ams, rel, "\u22EC", "\\ntrianglelefteq", true); -defineSymbol(math, ams, rel, "\u228A", "\\subsetneq", true); -defineSymbol(math, ams, rel, "\uE01A", "\\varsubsetneq"); -defineSymbol(math, ams, rel, "\u2ACB", "\\subsetneqq", true); -defineSymbol(math, ams, rel, "\uE017", "\\varsubsetneqq"); -defineSymbol(math, ams, rel, "\u226F", "\\ngtr", true); -defineSymbol(math, ams, rel, "\uE00F", "\\ngeqslant"); -defineSymbol(math, ams, rel, "\uE00E", "\\ngeqq"); -defineSymbol(math, ams, rel, "\u2A88", "\\gneq", true); -defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true); -defineSymbol(math, ams, rel, "\uE00D", "\\gvertneqq"); -defineSymbol(math, ams, rel, "\u22E7", "\\gnsim", true); -defineSymbol(math, ams, rel, "\u2A8A", "\\gnapprox", true); -defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true); -// unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym. -defineSymbol(math, ams, rel, "\u22E1", "\\nsucceq", true); -defineSymbol(math, ams, rel, "\u22E9", "\\succnsim", true); -defineSymbol(math, ams, rel, "\u2ABA", "\\succnapprox", true); -// unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym. -defineSymbol(math, ams, rel, "\u2246", "\\ncong", true); -defineSymbol(math, ams, rel, "\uE007", "\\nshortparallel"); -defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true); -defineSymbol(math, ams, rel, "\u22AF", "\\nVDash", true); -defineSymbol(math, ams, rel, "\u22EB", "\\ntriangleright"); -defineSymbol(math, ams, rel, "\u22ED", "\\ntrianglerighteq", true); -defineSymbol(math, ams, rel, "\uE018", "\\nsupseteqq"); -defineSymbol(math, ams, rel, "\u228B", "\\supsetneq", true); -defineSymbol(math, ams, rel, "\uE01B", "\\varsupsetneq"); -defineSymbol(math, ams, rel, "\u2ACC", "\\supsetneqq", true); -defineSymbol(math, ams, rel, "\uE019", "\\varsupsetneqq"); -defineSymbol(math, ams, rel, "\u22AE", "\\nVdash", true); -defineSymbol(math, ams, rel, "\u2AB5", "\\precneqq", true); -defineSymbol(math, ams, rel, "\u2AB6", "\\succneqq", true); -defineSymbol(math, ams, rel, "\uE016", "\\nsubseteqq"); -defineSymbol(math, ams, bin, "\u22B4", "\\unlhd"); -defineSymbol(math, ams, bin, "\u22B5", "\\unrhd"); - -// AMS Negated Arrows -defineSymbol(math, ams, rel, "\u219A", "\\nleftarrow", true); -defineSymbol(math, ams, rel, "\u219B", "\\nrightarrow", true); -defineSymbol(math, ams, rel, "\u21CD", "\\nLeftarrow", true); -defineSymbol(math, ams, rel, "\u21CF", "\\nRightarrow", true); -defineSymbol(math, ams, rel, "\u21AE", "\\nleftrightarrow", true); -defineSymbol(math, ams, rel, "\u21CE", "\\nLeftrightarrow", true); - -// AMS Misc -defineSymbol(math, ams, rel, "\u25B3", "\\vartriangle"); -defineSymbol(math, ams, textord, "\u210F", "\\hslash"); -defineSymbol(math, ams, textord, "\u25BD", "\\triangledown"); -defineSymbol(math, ams, textord, "\u25CA", "\\lozenge"); -defineSymbol(math, ams, textord, "\u24C8", "\\circledS"); -defineSymbol(math, ams, textord, "\xAE", "\\circledR"); -defineSymbol(text, ams, textord, "\xAE", "\\circledR"); -defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true); -defineSymbol(math, ams, textord, "\u2204", "\\nexists"); -defineSymbol(math, ams, textord, "\u2127", "\\mho"); -defineSymbol(math, ams, textord, "\u2132", "\\Finv", true); -defineSymbol(math, ams, textord, "\u2141", "\\Game", true); -defineSymbol(math, ams, textord, "k", "\\Bbbk"); -defineSymbol(math, ams, textord, "\u2035", "\\backprime"); -defineSymbol(math, ams, textord, "\u25B2", "\\blacktriangle"); -defineSymbol(math, ams, textord, "\u25BC", "\\blacktriangledown"); -defineSymbol(math, ams, textord, "\u25A0", "\\blacksquare"); -defineSymbol(math, ams, textord, "\u29EB", "\\blacklozenge"); -defineSymbol(math, ams, textord, "\u2605", "\\bigstar"); -defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true); -defineSymbol(math, ams, textord, "\u2201", "\\complement", true); -// unicode-math maps U+F0 to \matheth. We map to AMS function \eth -defineSymbol(math, ams, textord, "\xF0", "\\eth", true); -defineSymbol(math, ams, textord, "\u2571", "\\diagup"); -defineSymbol(math, ams, textord, "\u2572", "\\diagdown"); -defineSymbol(math, ams, textord, "\u25A1", "\\square"); -defineSymbol(math, ams, textord, "\u25A1", "\\Box"); -defineSymbol(math, ams, textord, "\u25CA", "\\Diamond"); -// unicode-math maps U+A5 to \mathyen. We map to AMS function \yen -defineSymbol(math, ams, textord, "\xA5", "\\yen", true); -defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true); -defineSymbol(text, ams, textord, "\u2713", "\\checkmark"); - -// AMS Hebrew -defineSymbol(math, ams, textord, "\u2136", "\\beth", true); -defineSymbol(math, ams, textord, "\u2138", "\\daleth", true); -defineSymbol(math, ams, textord, "\u2137", "\\gimel", true); - -// AMS Greek -defineSymbol(math, ams, textord, "\u03DD", "\\digamma"); -defineSymbol(math, ams, textord, "\u03F0", "\\varkappa"); - -// AMS Delimiters -defineSymbol(math, ams, open, "\u250C", "\\ulcorner"); -defineSymbol(math, ams, close, "\u2510", "\\urcorner"); -defineSymbol(math, ams, open, "\u2514", "\\llcorner"); -defineSymbol(math, ams, close, "\u2518", "\\lrcorner"); - -// AMS Binary Relations -defineSymbol(math, ams, rel, "\u2266", "\\leqq", true); -defineSymbol(math, ams, rel, "\u2A7D", "\\leqslant"); -defineSymbol(math, ams, rel, "\u2A95", "\\eqslantless", true); -defineSymbol(math, ams, rel, "\u2272", "\\lesssim"); -defineSymbol(math, ams, rel, "\u2A85", "\\lessapprox"); -defineSymbol(math, ams, rel, "\u224A", "\\approxeq", true); -defineSymbol(math, ams, bin, "\u22D6", "\\lessdot"); -defineSymbol(math, ams, rel, "\u22D8", "\\lll"); -defineSymbol(math, ams, rel, "\u2276", "\\lessgtr"); -defineSymbol(math, ams, rel, "\u22DA", "\\lesseqgtr"); -defineSymbol(math, ams, rel, "\u2A8B", "\\lesseqqgtr"); -defineSymbol(math, ams, rel, "\u2251", "\\doteqdot"); -defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq", true); -defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq", true); -defineSymbol(math, ams, rel, "\u223D", "\\backsim", true); -defineSymbol(math, ams, rel, "\u22CD", "\\backsimeq", true); -defineSymbol(math, ams, rel, "\u2AC5", "\\subseteqq", true); -defineSymbol(math, ams, rel, "\u22D0", "\\Subset", true); -defineSymbol(math, ams, rel, "\u228F", "\\sqsubset", true); -defineSymbol(math, ams, rel, "\u227C", "\\preccurlyeq", true); -defineSymbol(math, ams, rel, "\u22DE", "\\curlyeqprec", true); -defineSymbol(math, ams, rel, "\u227E", "\\precsim", true); -defineSymbol(math, ams, rel, "\u2AB7", "\\precapprox", true); -defineSymbol(math, ams, rel, "\u22B2", "\\vartriangleleft"); -defineSymbol(math, ams, rel, "\u22B4", "\\trianglelefteq"); -defineSymbol(math, ams, rel, "\u22A8", "\\vDash"); -defineSymbol(math, ams, rel, "\u22AA", "\\Vvdash", true); -defineSymbol(math, ams, rel, "\u2323", "\\smallsmile"); -defineSymbol(math, ams, rel, "\u2322", "\\smallfrown"); -defineSymbol(math, ams, rel, "\u224F", "\\bumpeq", true); -defineSymbol(math, ams, rel, "\u224E", "\\Bumpeq", true); -defineSymbol(math, ams, rel, "\u2267", "\\geqq", true); -defineSymbol(math, ams, rel, "\u2A7E", "\\geqslant", true); -defineSymbol(math, ams, rel, "\u2A96", "\\eqslantgtr", true); -defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true); -defineSymbol(math, ams, rel, "\u2A86", "\\gtrapprox", true); -defineSymbol(math, ams, bin, "\u22D7", "\\gtrdot"); -defineSymbol(math, ams, rel, "\u22D9", "\\ggg", true); -defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true); -defineSymbol(math, ams, rel, "\u22DB", "\\gtreqless", true); -defineSymbol(math, ams, rel, "\u2A8C", "\\gtreqqless", true); -defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true); -defineSymbol(math, ams, rel, "\u2257", "\\circeq", true); -defineSymbol(math, ams, rel, "\u225C", "\\triangleq", true); -defineSymbol(math, ams, rel, "\u223C", "\\thicksim"); -defineSymbol(math, ams, rel, "\u2248", "\\thickapprox"); -defineSymbol(math, ams, rel, "\u2AC6", "\\supseteqq", true); -defineSymbol(math, ams, rel, "\u22D1", "\\Supset", true); -defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true); -defineSymbol(math, ams, rel, "\u227D", "\\succcurlyeq", true); -defineSymbol(math, ams, rel, "\u22DF", "\\curlyeqsucc", true); -defineSymbol(math, ams, rel, "\u227F", "\\succsim", true); -defineSymbol(math, ams, rel, "\u2AB8", "\\succapprox", true); -defineSymbol(math, ams, rel, "\u22B3", "\\vartriangleright"); -defineSymbol(math, ams, rel, "\u22B5", "\\trianglerighteq"); -defineSymbol(math, ams, rel, "\u22A9", "\\Vdash", true); -defineSymbol(math, ams, rel, "\u2223", "\\shortmid"); -defineSymbol(math, ams, rel, "\u2225", "\\shortparallel"); -defineSymbol(math, ams, rel, "\u226C", "\\between", true); -defineSymbol(math, ams, rel, "\u22D4", "\\pitchfork", true); -defineSymbol(math, ams, rel, "\u221D", "\\varpropto"); -defineSymbol(math, ams, rel, "\u25C0", "\\blacktriangleleft"); -// unicode-math says that \therefore is a mathord atom. -// We kept the amssymb atom type, which is rel. -defineSymbol(math, ams, rel, "\u2234", "\\therefore", true); -defineSymbol(math, ams, rel, "\u220D", "\\backepsilon"); -defineSymbol(math, ams, rel, "\u25B6", "\\blacktriangleright"); -// unicode-math says that \because is a mathord atom. -// We kept the amssymb atom type, which is rel. -defineSymbol(math, ams, rel, "\u2235", "\\because", true); -defineSymbol(math, ams, rel, "\u22D8", "\\llless"); -defineSymbol(math, ams, rel, "\u22D9", "\\gggtr"); -defineSymbol(math, ams, bin, "\u22B2", "\\lhd"); -defineSymbol(math, ams, bin, "\u22B3", "\\rhd"); -defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true); -defineSymbol(math, main, rel, "\u22C8", "\\Join"); -defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true); - -// AMS Binary Operators -defineSymbol(math, ams, bin, "\u2214", "\\dotplus", true); -defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus"); -defineSymbol(math, ams, bin, "\u22D2", "\\Cap", true); -defineSymbol(math, ams, bin, "\u22D3", "\\Cup", true); -defineSymbol(math, ams, bin, "\u2A5E", "\\doublebarwedge", true); -defineSymbol(math, ams, bin, "\u229F", "\\boxminus", true); -defineSymbol(math, ams, bin, "\u229E", "\\boxplus", true); -defineSymbol(math, ams, bin, "\u22C7", "\\divideontimes", true); -defineSymbol(math, ams, bin, "\u22C9", "\\ltimes", true); -defineSymbol(math, ams, bin, "\u22CA", "\\rtimes", true); -defineSymbol(math, ams, bin, "\u22CB", "\\leftthreetimes", true); -defineSymbol(math, ams, bin, "\u22CC", "\\rightthreetimes", true); -defineSymbol(math, ams, bin, "\u22CF", "\\curlywedge", true); -defineSymbol(math, ams, bin, "\u22CE", "\\curlyvee", true); -defineSymbol(math, ams, bin, "\u229D", "\\circleddash", true); -defineSymbol(math, ams, bin, "\u229B", "\\circledast", true); -defineSymbol(math, ams, bin, "\u22C5", "\\centerdot"); -defineSymbol(math, ams, bin, "\u22BA", "\\intercal", true); -defineSymbol(math, ams, bin, "\u22D2", "\\doublecap"); -defineSymbol(math, ams, bin, "\u22D3", "\\doublecup"); -defineSymbol(math, ams, bin, "\u22A0", "\\boxtimes", true); - -// AMS Arrows -// Note: unicode-math maps \u21e2 to their own function \rightdasharrow. -// We'll map it to AMS function \dashrightarrow. It produces the same atom. -defineSymbol(math, ams, rel, "\u21E2", "\\dashrightarrow", true); -// unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym. -defineSymbol(math, ams, rel, "\u21E0", "\\dashleftarrow", true); -defineSymbol(math, ams, rel, "\u21C7", "\\leftleftarrows", true); -defineSymbol(math, ams, rel, "\u21C6", "\\leftrightarrows", true); -defineSymbol(math, ams, rel, "\u21DA", "\\Lleftarrow", true); -defineSymbol(math, ams, rel, "\u219E", "\\twoheadleftarrow", true); -defineSymbol(math, ams, rel, "\u21A2", "\\leftarrowtail", true); -defineSymbol(math, ams, rel, "\u21AB", "\\looparrowleft", true); -defineSymbol(math, ams, rel, "\u21CB", "\\leftrightharpoons", true); -defineSymbol(math, ams, rel, "\u21B6", "\\curvearrowleft", true); -// unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym. -defineSymbol(math, ams, rel, "\u21BA", "\\circlearrowleft", true); -defineSymbol(math, ams, rel, "\u21B0", "\\Lsh", true); -defineSymbol(math, ams, rel, "\u21C8", "\\upuparrows", true); -defineSymbol(math, ams, rel, "\u21BF", "\\upharpoonleft", true); -defineSymbol(math, ams, rel, "\u21C3", "\\downharpoonleft", true); -defineSymbol(math, ams, rel, "\u22B8", "\\multimap", true); -defineSymbol(math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true); -defineSymbol(math, ams, rel, "\u21C9", "\\rightrightarrows", true); -defineSymbol(math, ams, rel, "\u21C4", "\\rightleftarrows", true); -defineSymbol(math, ams, rel, "\u21A0", "\\twoheadrightarrow", true); -defineSymbol(math, ams, rel, "\u21A3", "\\rightarrowtail", true); -defineSymbol(math, ams, rel, "\u21AC", "\\looparrowright", true); -defineSymbol(math, ams, rel, "\u21B7", "\\curvearrowright", true); -// unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym. -defineSymbol(math, ams, rel, "\u21BB", "\\circlearrowright", true); -defineSymbol(math, ams, rel, "\u21B1", "\\Rsh", true); -defineSymbol(math, ams, rel, "\u21CA", "\\downdownarrows", true); -defineSymbol(math, ams, rel, "\u21BE", "\\upharpoonright", true); -defineSymbol(math, ams, rel, "\u21C2", "\\downharpoonright", true); -defineSymbol(math, ams, rel, "\u21DD", "\\rightsquigarrow", true); -defineSymbol(math, ams, rel, "\u21DD", "\\leadsto"); -defineSymbol(math, ams, rel, "\u21DB", "\\Rrightarrow", true); -defineSymbol(math, ams, rel, "\u21BE", "\\restriction"); - -defineSymbol(math, main, textord, "\u2018", "`"); -defineSymbol(math, main, textord, "$", "\\$"); -defineSymbol(text, main, textord, "$", "\\$"); -defineSymbol(text, main, textord, "$", "\\textdollar"); -defineSymbol(math, main, textord, "%", "\\%"); -defineSymbol(text, main, textord, "%", "\\%"); -defineSymbol(math, main, textord, "_", "\\_"); -defineSymbol(text, main, textord, "_", "\\_"); -defineSymbol(text, main, textord, "_", "\\textunderscore"); -defineSymbol(math, main, textord, "\u2220", "\\angle", true); -defineSymbol(math, main, textord, "\u221E", "\\infty", true); -defineSymbol(math, main, textord, "\u2032", "\\prime"); -defineSymbol(math, main, textord, "\u25B3", "\\triangle"); -defineSymbol(math, main, textord, "\u0393", "\\Gamma", true); -defineSymbol(math, main, textord, "\u0394", "\\Delta", true); -defineSymbol(math, main, textord, "\u0398", "\\Theta", true); -defineSymbol(math, main, textord, "\u039B", "\\Lambda", true); -defineSymbol(math, main, textord, "\u039E", "\\Xi", true); -defineSymbol(math, main, textord, "\u03A0", "\\Pi", true); -defineSymbol(math, main, textord, "\u03A3", "\\Sigma", true); -defineSymbol(math, main, textord, "\u03A5", "\\Upsilon", true); -defineSymbol(math, main, textord, "\u03A6", "\\Phi", true); -defineSymbol(math, main, textord, "\u03A8", "\\Psi", true); -defineSymbol(math, main, textord, "\u03A9", "\\Omega", true); -defineSymbol(math, main, textord, "\xAC", "\\neg"); -defineSymbol(math, main, textord, "\xAC", "\\lnot"); -defineSymbol(math, main, textord, "\u22A4", "\\top"); -defineSymbol(math, main, textord, "\u22A5", "\\bot"); -defineSymbol(math, main, textord, "\u2205", "\\emptyset"); -defineSymbol(math, ams, textord, "\u2205", "\\varnothing"); -defineSymbol(math, main, mathord, "\u03B1", "\\alpha", true); -defineSymbol(math, main, mathord, "\u03B2", "\\beta", true); -defineSymbol(math, main, mathord, "\u03B3", "\\gamma", true); -defineSymbol(math, main, mathord, "\u03B4", "\\delta", true); -defineSymbol(math, main, mathord, "\u03F5", "\\epsilon", true); -defineSymbol(math, main, mathord, "\u03B6", "\\zeta", true); -defineSymbol(math, main, mathord, "\u03B7", "\\eta", true); -defineSymbol(math, main, mathord, "\u03B8", "\\theta", true); -defineSymbol(math, main, mathord, "\u03B9", "\\iota", true); -defineSymbol(math, main, mathord, "\u03BA", "\\kappa", true); -defineSymbol(math, main, mathord, "\u03BB", "\\lambda", true); -defineSymbol(math, main, mathord, "\u03BC", "\\mu", true); -defineSymbol(math, main, mathord, "\u03BD", "\\nu", true); -defineSymbol(math, main, mathord, "\u03BE", "\\xi", true); -defineSymbol(math, main, mathord, "\u03BF", "\\omicron", true); -defineSymbol(math, main, mathord, "\u03C0", "\\pi", true); -defineSymbol(math, main, mathord, "\u03C1", "\\rho", true); -defineSymbol(math, main, mathord, "\u03C3", "\\sigma", true); -defineSymbol(math, main, mathord, "\u03C4", "\\tau", true); -defineSymbol(math, main, mathord, "\u03C5", "\\upsilon", true); -defineSymbol(math, main, mathord, "\u03D5", "\\phi", true); -defineSymbol(math, main, mathord, "\u03C7", "\\chi", true); -defineSymbol(math, main, mathord, "\u03C8", "\\psi", true); -defineSymbol(math, main, mathord, "\u03C9", "\\omega", true); -defineSymbol(math, main, mathord, "\u03B5", "\\varepsilon", true); -defineSymbol(math, main, mathord, "\u03D1", "\\vartheta", true); -defineSymbol(math, main, mathord, "\u03D6", "\\varpi", true); -defineSymbol(math, main, mathord, "\u03F1", "\\varrho", true); -defineSymbol(math, main, mathord, "\u03C2", "\\varsigma", true); -defineSymbol(math, main, mathord, "\u03C6", "\\varphi", true); -defineSymbol(math, main, bin, "\u2217", "*"); -defineSymbol(math, main, bin, "+", "+"); -defineSymbol(math, main, bin, "\u2212", "-"); -defineSymbol(math, main, bin, "\u22C5", "\\cdot"); -defineSymbol(math, main, bin, "\u2218", "\\circ"); -defineSymbol(math, main, bin, "\xF7", "\\div", true); -defineSymbol(math, main, bin, "\xB1", "\\pm", true); -defineSymbol(math, main, bin, "\xD7", "\\times", true); -defineSymbol(math, main, bin, "\u2229", "\\cap", true); -defineSymbol(math, main, bin, "\u222A", "\\cup", true); -defineSymbol(math, main, bin, "\u2216", "\\setminus"); -defineSymbol(math, main, bin, "\u2227", "\\land"); -defineSymbol(math, main, bin, "\u2228", "\\lor"); -defineSymbol(math, main, bin, "\u2227", "\\wedge", true); -defineSymbol(math, main, bin, "\u2228", "\\vee", true); -defineSymbol(math, main, textord, "\u221A", "\\surd"); -defineSymbol(math, main, open, "(", "("); -defineSymbol(math, main, open, "[", "["); -defineSymbol(math, main, open, "\u27E8", "\\langle"); -defineSymbol(math, main, open, "\u2223", "\\lvert"); -defineSymbol(math, main, open, "\u2225", "\\lVert"); -defineSymbol(math, main, close, ")", ")"); -defineSymbol(math, main, close, "]", "]"); -defineSymbol(math, main, close, "?", "?"); -defineSymbol(math, main, close, "!", "!"); -defineSymbol(math, main, close, "\u27E9", "\\rangle"); -defineSymbol(math, main, close, "\u2223", "\\rvert"); -defineSymbol(math, main, close, "\u2225", "\\rVert"); -defineSymbol(math, main, rel, "=", "="); -defineSymbol(math, main, rel, "<", "<"); -defineSymbol(math, main, rel, ">", ">"); -defineSymbol(math, main, rel, ":", ":"); -defineSymbol(math, main, rel, "\u2248", "\\approx", true); -defineSymbol(math, main, rel, "\u2245", "\\cong", true); -defineSymbol(math, main, rel, "\u2265", "\\ge"); -defineSymbol(math, main, rel, "\u2265", "\\geq", true); -defineSymbol(math, main, rel, "\u2190", "\\gets"); -defineSymbol(math, main, rel, ">", "\\gt"); -defineSymbol(math, main, rel, "\u2208", "\\in", true); -defineSymbol(math, main, rel, "\u2209", "\\notin", true); -defineSymbol(math, main, rel, "\u0338", "\\not"); -defineSymbol(math, main, rel, "\u2282", "\\subset", true); -defineSymbol(math, main, rel, "\u2283", "\\supset", true); -defineSymbol(math, main, rel, "\u2286", "\\subseteq", true); -defineSymbol(math, main, rel, "\u2287", "\\supseteq", true); -defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true); -defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true); -defineSymbol(math, main, rel, "\u22A8", "\\models"); -defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true); -defineSymbol(math, main, rel, "\u2264", "\\le"); -defineSymbol(math, main, rel, "\u2264", "\\leq", true); -defineSymbol(math, main, rel, "<", "\\lt"); -defineSymbol(math, main, rel, "\u2260", "\\ne", true); -defineSymbol(math, main, rel, "\u2260", "\\neq"); -defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true); -defineSymbol(math, main, rel, "\u2192", "\\to"); -defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true); -defineSymbol(math, ams, rel, "\u2270", "\\nleq", true); -defineSymbol(math, main, spacing, null, "\\!"); -defineSymbol(math, main, spacing, "\xA0", "\\ "); -defineSymbol(math, main, spacing, "\xA0", "~"); -defineSymbol(math, main, spacing, null, "\\,"); -defineSymbol(math, main, spacing, null, "\\:"); -defineSymbol(math, main, spacing, null, "\\;"); -defineSymbol(math, main, spacing, null, "\\enspace"); -defineSymbol(math, main, spacing, null, "\\qquad"); -defineSymbol(math, main, spacing, null, "\\quad"); -defineSymbol(math, main, spacing, "\xA0", "\\space"); -defineSymbol(math, main, punct, ",", ","); -defineSymbol(math, main, punct, ";", ";"); -defineSymbol(math, main, punct, ":", "\\colon"); -defineSymbol(math, ams, bin, "\u22BC", "\\barwedge", true); -defineSymbol(math, ams, bin, "\u22BB", "\\veebar", true); -defineSymbol(math, main, bin, "\u2299", "\\odot", true); -defineSymbol(math, main, bin, "\u2295", "\\oplus", true); -defineSymbol(math, main, bin, "\u2297", "\\otimes", true); -defineSymbol(math, main, textord, "\u2202", "\\partial", true); -defineSymbol(math, main, bin, "\u2298", "\\oslash", true); -defineSymbol(math, ams, bin, "\u229A", "\\circledcirc", true); -defineSymbol(math, ams, bin, "\u22A1", "\\boxdot", true); -defineSymbol(math, main, bin, "\u25B3", "\\bigtriangleup"); -defineSymbol(math, main, bin, "\u25BD", "\\bigtriangledown"); -defineSymbol(math, main, bin, "\u2020", "\\dagger"); -defineSymbol(math, main, bin, "\u22C4", "\\diamond"); -defineSymbol(math, main, bin, "\u22C6", "\\star"); -defineSymbol(math, main, bin, "\u25C3", "\\triangleleft"); -defineSymbol(math, main, bin, "\u25B9", "\\triangleright"); -defineSymbol(math, main, open, "{", "\\{"); -defineSymbol(text, main, textord, "{", "\\{"); -defineSymbol(text, main, textord, "{", "\\textbraceleft"); -defineSymbol(math, main, close, "}", "\\}"); -defineSymbol(text, main, textord, "}", "\\}"); -defineSymbol(text, main, textord, "}", "\\textbraceright"); -defineSymbol(math, main, open, "{", "\\lbrace"); -defineSymbol(math, main, close, "}", "\\rbrace"); -defineSymbol(math, main, open, "[", "\\lbrack"); -defineSymbol(math, main, close, "]", "\\rbrack"); -defineSymbol(text, main, textord, "<", "\\textless"); // in T1 fontenc -defineSymbol(text, main, textord, ">", "\\textgreater"); // in T1 fontenc -defineSymbol(math, main, open, "\u230A", "\\lfloor"); -defineSymbol(math, main, close, "\u230B", "\\rfloor"); -defineSymbol(math, main, open, "\u2308", "\\lceil"); -defineSymbol(math, main, close, "\u2309", "\\rceil"); -defineSymbol(math, main, textord, "\\", "\\backslash"); -defineSymbol(math, main, textord, "\u2223", "|"); -defineSymbol(math, main, textord, "\u2223", "\\vert"); -defineSymbol(text, main, textord, "|", "\\textbar"); // in T1 fontenc -defineSymbol(math, main, textord, "\u2225", "\\|"); -defineSymbol(math, main, textord, "\u2225", "\\Vert"); -defineSymbol(text, main, textord, "\u2225", "\\textbardbl"); -defineSymbol(math, main, rel, "\u2191", "\\uparrow", true); -defineSymbol(math, main, rel, "\u21D1", "\\Uparrow", true); -defineSymbol(math, main, rel, "\u2193", "\\downarrow", true); -defineSymbol(math, main, rel, "\u21D3", "\\Downarrow", true); -defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true); -defineSymbol(math, main, rel, "\u21D5", "\\Updownarrow", true); -defineSymbol(math, main, op, "\u2210", "\\coprod"); -defineSymbol(math, main, op, "\u22C1", "\\bigvee"); -defineSymbol(math, main, op, "\u22C0", "\\bigwedge"); -defineSymbol(math, main, op, "\u2A04", "\\biguplus"); -defineSymbol(math, main, op, "\u22C2", "\\bigcap"); -defineSymbol(math, main, op, "\u22C3", "\\bigcup"); -defineSymbol(math, main, op, "\u222B", "\\int"); -defineSymbol(math, main, op, "\u222B", "\\intop"); -defineSymbol(math, main, op, "\u222C", "\\iint"); -defineSymbol(math, main, op, "\u222D", "\\iiint"); -defineSymbol(math, main, op, "\u220F", "\\prod"); -defineSymbol(math, main, op, "\u2211", "\\sum"); -defineSymbol(math, main, op, "\u2A02", "\\bigotimes"); -defineSymbol(math, main, op, "\u2A01", "\\bigoplus"); -defineSymbol(math, main, op, "\u2A00", "\\bigodot"); -defineSymbol(math, main, op, "\u222E", "\\oint"); -defineSymbol(math, main, op, "\u2A06", "\\bigsqcup"); -defineSymbol(math, main, op, "\u222B", "\\smallint"); -defineSymbol(text, main, inner, "\u2026", "\\textellipsis"); -defineSymbol(math, main, inner, "\u2026", "\\mathellipsis"); -defineSymbol(text, main, inner, "\u2026", "\\ldots", true); -defineSymbol(math, main, inner, "\u2026", "\\ldots", true); -defineSymbol(math, main, inner, "\u22EF", "\\@cdots", true); -defineSymbol(math, main, inner, "\u22F1", "\\ddots", true); -defineSymbol(math, main, textord, "\u22EE", "\\vdots", true); -defineSymbol(math, main, accent, "\xB4", "\\acute"); -defineSymbol(math, main, accent, "`", "\\grave"); -defineSymbol(math, main, accent, "\xA8", "\\ddot"); -defineSymbol(math, main, accent, "~", "\\tilde"); -defineSymbol(math, main, accent, "\xAF", "\\bar"); -defineSymbol(math, main, accent, "\u02D8", "\\breve"); -defineSymbol(math, main, accent, "\u02C7", "\\check"); -defineSymbol(math, main, accent, "^", "\\hat"); -defineSymbol(math, main, accent, "\u20D7", "\\vec"); -defineSymbol(math, main, accent, "\u02D9", "\\dot"); -defineSymbol(math, main, mathord, "\u0131", "\\imath"); -defineSymbol(math, main, mathord, "\u0237", "\\jmath"); -defineSymbol(text, main, accent, "\u02CA", "\\'"); // acute -defineSymbol(text, main, accent, "\u02CB", "\\`"); // grave -defineSymbol(text, main, accent, "\u02C6", "\\^"); // circumflex -defineSymbol(text, main, accent, "\u02DC", "\\~"); // tilde -defineSymbol(text, main, accent, "\u02C9", "\\="); // macron -defineSymbol(text, main, accent, "\u02D8", "\\u"); // breve -defineSymbol(text, main, accent, "\u02D9", "\\."); // dot above -defineSymbol(text, main, accent, "\u02DA", "\\r"); // ring above -defineSymbol(text, main, accent, "\u02C7", "\\v"); // caron -defineSymbol(text, main, accent, "\xA8", '\\"'); // diaresis -defineSymbol(text, main, accent, "\u030B", "\\H"); // double acute - -defineSymbol(text, main, textord, "\u2013", "--"); -defineSymbol(text, main, textord, "\u2013", "\\textendash"); -defineSymbol(text, main, textord, "\u2014", "---"); -defineSymbol(text, main, textord, "\u2014", "\\textemdash"); -defineSymbol(text, main, textord, "\u2018", "`"); -defineSymbol(text, main, textord, "\u2018", "\\textquoteleft"); -defineSymbol(text, main, textord, "\u2019", "'"); -defineSymbol(text, main, textord, "\u2019", "\\textquoteright"); -defineSymbol(text, main, textord, "\u201C", "``"); -defineSymbol(text, main, textord, "\u201C", "\\textquotedblleft"); -defineSymbol(text, main, textord, "\u201D", "''"); -defineSymbol(text, main, textord, "\u201D", "\\textquotedblright"); -defineSymbol(math, main, textord, "\xB0", "\\degree"); -defineSymbol(text, main, textord, "\xB0", "\\degree"); -// TODO: In LaTeX, \pounds can generate a different character in text and math -// mode, but among our fonts, only Main-Italic defines this character "163". -defineSymbol(math, main, mathord, "\xA3", "\\pounds"); -defineSymbol(math, main, mathord, "\xA3", "\\mathsterling", true); -defineSymbol(text, main, mathord, "\xA3", "\\pounds"); -defineSymbol(text, main, mathord, "\xA3", "\\textsterling"); -defineSymbol(math, ams, textord, "\u2720", "\\maltese"); -defineSymbol(text, ams, textord, "\u2720", "\\maltese"); - -defineSymbol(text, main, spacing, "\xA0", "\\ "); -defineSymbol(text, main, spacing, "\xA0", " "); -defineSymbol(text, main, spacing, "\xA0", "~"); - -// There are lots of symbols which are the same, so we add them in afterwards. - -// All of these are textords in math mode -var mathTextSymbols = "0123456789/@.\""; -for (var i = 0; i < mathTextSymbols.length; i++) { - var ch = mathTextSymbols.charAt(i); - defineSymbol(math, main, textord, ch, ch); -} - -// All of these are textords in text mode -var textSymbols = "0123456789!@*()-=+[]<>|\";:?/.,"; -for (var _i = 0; _i < textSymbols.length; _i++) { - var _ch = textSymbols.charAt(_i); - defineSymbol(text, main, textord, _ch, _ch); -} - -// All of these are textords in text mode, and mathords in math mode -var letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; -for (var _i2 = 0; _i2 < letters.length; _i2++) { - var _ch2 = letters.charAt(_i2); - defineSymbol(math, main, mathord, _ch2, _ch2); - defineSymbol(text, main, textord, _ch2, _ch2); -} - -// Latin-1 letters -for (var _i3 = 0x00C0; _i3 <= 0x00D6; _i3++) { - var _ch3 = String.fromCharCode(_i3); - defineSymbol(math, main, mathord, _ch3, _ch3); - defineSymbol(text, main, textord, _ch3, _ch3); -} - -for (var _i4 = 0x00D8; _i4 <= 0x00F6; _i4++) { - var _ch4 = String.fromCharCode(_i4); - defineSymbol(math, main, mathord, _ch4, _ch4); - defineSymbol(text, main, textord, _ch4, _ch4); -} - -for (var _i5 = 0x00F8; _i5 <= 0x00FF; _i5++) { - var _ch5 = String.fromCharCode(_i5); - defineSymbol(math, main, mathord, _ch5, _ch5); - defineSymbol(text, main, textord, _ch5, _ch5); -} - -// Cyrillic -for (var _i6 = 0x0410; _i6 <= 0x044F; _i6++) { - var _ch6 = String.fromCharCode(_i6); - defineSymbol(text, main, textord, _ch6, _ch6); -} - -// Unicode versions of existing characters -defineSymbol(text, main, textord, "\u2013", "–"); -defineSymbol(text, main, textord, "\u2014", "—"); -defineSymbol(text, main, textord, "\u2018", "‘"); -defineSymbol(text, main, textord, "\u2019", "’"); -defineSymbol(text, main, textord, "\u201C", "“"); -defineSymbol(text, main, textord, "\u201D", "”"); - -},{}],126:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var hangulRegex = exports.hangulRegex = /[\uAC00-\uD7AF]/; - -// This regex combines -// - CJK symbols and punctuation: [\u3000-\u303F] -// - Hiragana: [\u3040-\u309F] -// - Katakana: [\u30A0-\u30FF] -// - CJK ideograms: [\u4E00-\u9FAF] -// - Hangul syllables: [\uAC00-\uD7AF] -// - Fullwidth punctuation: [\uFF00-\uFF60] -// Notably missing are halfwidth Katakana and Romanji glyphs. -var cjkRegex = exports.cjkRegex = /[\u3000-\u30FF\u4E00-\u9FAF\uAC00-\uD7AF\uFF00-\uFF60]/; - -},{}],127:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.calculateSize = exports.validUnit = undefined; - -var _ParseError = require("./ParseError"); - -var _ParseError2 = _interopRequireDefault(_ParseError); - -var _Options = require("./Options"); - -var _Options2 = _interopRequireDefault(_Options); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// This table gives the number of TeX pts in one of each *absolute* TeX unit. -// Thus, multiplying a length by this number converts the length from units -// into pts. Dividing the result by ptPerEm gives the number of ems -// *assuming* a font size of ptPerEm (normal size, normal style). - - -/** - * This file does conversion between units. In particular, it provides - * calculateSize to convert other units into ems. - */ - -var ptPerUnit = { - // https://en.wikibooks.org/wiki/LaTeX/Lengths and - // https://tex.stackexchange.com/a/8263 - "pt": 1, // TeX point - "mm": 7227 / 2540, // millimeter - "cm": 7227 / 254, // centimeter - "in": 72.27, // inch - "bp": 803 / 800, // big (PostScript) points - "pc": 12, // pica - "dd": 1238 / 1157, // didot - "cc": 14856 / 1157, // cicero (12 didot) - "nd": 685 / 642, // new didot - "nc": 1370 / 107, // new cicero (12 new didot) - "sp": 1 / 65536, // scaled point (TeX's internal smallest unit) - // https://tex.stackexchange.com/a/41371 - "px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX -}; - -// Dictionary of relative units, for fast validity testing. -var relativeUnit = { - "ex": true, - "em": true, - "mu": true -}; - -/** - * Determine whether the specified unit (either a string defining the unit - * or a "size" parse node containing a unit field) is valid. - */ -var validUnit = exports.validUnit = function validUnit(unit) { - if (typeof unit !== "string") { - unit = unit.unit; - } - return unit in ptPerUnit || unit in relativeUnit || unit === "ex"; -}; - -/* - * Convert a "size" parse node (with numeric "number" and string "unit" fields, - * as parsed by functions.js argType "size") into a CSS em value for the - * current style/scale. `options` gives the current options. - */ -var calculateSize = exports.calculateSize = function calculateSize(sizeValue, options) { - var scale = void 0; - if (sizeValue.unit in ptPerUnit) { - // Absolute units - scale = ptPerUnit[sizeValue.unit] // Convert unit to pt - / options.fontMetrics().ptPerEm // Convert pt to CSS em - / options.sizeMultiplier; // Unscale to make absolute units - } else if (sizeValue.unit === "mu") { - // `mu` units scale with scriptstyle/scriptscriptstyle. - scale = options.fontMetrics().cssEmPerMu; - } else { - // Other relative units always refer to the *textstyle* font - // in the current size. - var unitOptions = void 0; - if (options.style.isTight()) { - // isTight() means current style is script/scriptscript. - unitOptions = options.havingStyle(options.style.text()); - } else { - unitOptions = options; - } - // TODO: In TeX these units are relative to the quad of the current - // *text* font, e.g. cmr10. KaTeX instead uses values from the - // comparably-sized *Computer Modern symbol* font. At 10pt, these - // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641; - // cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$. - // TeX \showlists shows a kern of 1.13889 * fontsize; - // KaTeX shows a kern of 1.171 * fontsize. - if (sizeValue.unit === "ex") { - scale = unitOptions.fontMetrics().xHeight; - } else if (sizeValue.unit === "em") { - scale = unitOptions.fontMetrics().quad; - } else { - throw new _ParseError2.default("Invalid unit: '" + sizeValue.unit + "'"); - } - if (unitOptions !== options) { - scale *= unitOptions.sizeMultiplier / options.sizeMultiplier; - } - } - return Math.min(sizeValue.number * scale, options.maxSize); -}; - -},{"./Options":83,"./ParseError":84}],128:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -/** - * This file contains a list of utility functions which are useful in other - * files. - */ - -/** - * Provide an `indexOf` function which works in IE8, but defers to native if - * possible. - */ -var nativeIndexOf = Array.prototype.indexOf; -var indexOf = function indexOf(list, elem) { - if (list == null) { - return -1; - } - if (nativeIndexOf && list.indexOf === nativeIndexOf) { - return list.indexOf(elem); - } - var l = list.length; - for (var i = 0; i < l; i++) { - if (list[i] === elem) { - return i; - } - } - return -1; -}; - -/** - * Return whether an element is contained in a list - */ -var contains = function contains(list, elem) { - return indexOf(list, elem) !== -1; -}; - -/** - * Provide a default value if a setting is undefined - * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022. - */ -var deflt = function deflt(setting, defaultIfUndefined) { - return setting === undefined ? defaultIfUndefined : setting; -}; - -// hyphenate and escape adapted from Facebook's React under Apache 2 license - -var uppercase = /([A-Z])/g; -var hyphenate = function hyphenate(str) { - return str.replace(uppercase, "-$1").toLowerCase(); -}; - -var ESCAPE_LOOKUP = { - "&": "&", - ">": ">", - "<": "<", - "\"": """, - "'": "'" -}; - -var ESCAPE_REGEX = /[&><"']/g; - -/** - * Escapes text to prevent scripting attacks. - */ -function escape(text) { - return String(text).replace(ESCAPE_REGEX, function (match) { - return ESCAPE_LOOKUP[match]; - }); -} - -/** - * A function to set the text content of a DOM element in all supported - * browsers. Note that we don't define this if there is no document. - */ -var setTextContent = void 0; -if (typeof document !== "undefined") { - var testNode = document.createElement("span"); - if ("textContent" in testNode) { - setTextContent = function setTextContent(node, text) { - node.textContent = text; - }; - } else { - setTextContent = function setTextContent(node, text) { - node.innerText = text; - }; - } -} - -/** - * A function to clear a node. - */ -function clearNode(node) { - setTextContent(node, ""); -} - -exports.default = { - contains: contains, - deflt: deflt, - escape: escape, - hyphenate: hyphenate, - indexOf: indexOf, - setTextContent: setTextContent, - clearNode: clearNode -}; - -},{}]},{},[1])(1) -}); \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 26e2b790f98..26d1e703390 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3872,6 +3872,12 @@ karma@^1.7.0: tmp "0.0.31" useragent "^2.1.12" +katex@^0.9.0-alpha2: + version "0.9.0-alpha2" + resolved "https://registry.yarnpkg.com/katex/-/katex-0.9.0-alpha2.tgz#f559e8bb32969082d735d949960b7df133fd5831" + dependencies: + match-at "^0.1.1" + kind-of@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47" @@ -4166,6 +4172,10 @@ marked@^0.3.6: version "0.3.6" resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.6.tgz#b2c6c618fccece4ef86c4fc6cb8a7cbf5aeda8d7" +match-at@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/match-at/-/match-at-0.1.1.tgz#25d040d291777704d5e6556bbb79230ec2de0540" + math-expression-evaluator@^1.2.14: version "1.2.16" resolved "https://registry.yarnpkg.com/math-expression-evaluator/-/math-expression-evaluator-1.2.16.tgz#b357fa1ca9faefb8e48d10c14ef2bcb2d9f0a7c9" -- cgit v1.2.1 From 2f0335e1978799eb44eec715d37a16b116a31140 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Wed, 20 Dec 2017 17:55:53 -0600 Subject: Removed the remains of katex from vendor assets and load everything via webpack --- app/assets/javascripts/render_math.js | 14 +- config/webpack.config.js | 23 + package.json | 1 + vendor/assets/fonts/KaTeX_AMS-Regular.eot | Bin 71656 -> 0 bytes vendor/assets/fonts/KaTeX_AMS-Regular.ttf | Bin 71428 -> 0 bytes vendor/assets/fonts/KaTeX_AMS-Regular.woff | Bin 40200 -> 0 bytes vendor/assets/fonts/KaTeX_AMS-Regular.woff2 | Bin 33212 -> 0 bytes vendor/assets/fonts/KaTeX_Caligraphic-Bold.eot | Bin 19836 -> 0 bytes vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf | Bin 19588 -> 0 bytes vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff | Bin 12136 -> 0 bytes vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 | Bin 10584 -> 0 bytes vendor/assets/fonts/KaTeX_Caligraphic-Regular.eot | Bin 19220 -> 0 bytes vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf | Bin 18960 -> 0 bytes vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff | Bin 11868 -> 0 bytes .../assets/fonts/KaTeX_Caligraphic-Regular.woff2 | Bin 10396 -> 0 bytes vendor/assets/fonts/KaTeX_Fraktur-Bold.eot | Bin 36200 -> 0 bytes vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf | Bin 35968 -> 0 bytes vendor/assets/fonts/KaTeX_Fraktur-Bold.woff | Bin 23388 -> 0 bytes vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 | Bin 20472 -> 0 bytes vendor/assets/fonts/KaTeX_Fraktur-Regular.eot | Bin 34896 -> 0 bytes vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf | Bin 34652 -> 0 bytes vendor/assets/fonts/KaTeX_Fraktur-Regular.woff | Bin 22844 -> 0 bytes vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 | Bin 19872 -> 0 bytes vendor/assets/fonts/KaTeX_Main-Bold.eot | Bin 63248 -> 0 bytes vendor/assets/fonts/KaTeX_Main-Bold.ttf | Bin 63028 -> 0 bytes vendor/assets/fonts/KaTeX_Main-Bold.woff | Bin 37160 -> 0 bytes vendor/assets/fonts/KaTeX_Main-Bold.woff2 | Bin 31000 -> 0 bytes vendor/assets/fonts/KaTeX_Main-Italic.eot | Bin 47864 -> 0 bytes vendor/assets/fonts/KaTeX_Main-Italic.ttf | Bin 47636 -> 0 bytes vendor/assets/fonts/KaTeX_Main-Italic.woff | Bin 27092 -> 0 bytes vendor/assets/fonts/KaTeX_Main-Italic.woff2 | Bin 22972 -> 0 bytes vendor/assets/fonts/KaTeX_Main-Regular.eot | Bin 71548 -> 0 bytes vendor/assets/fonts/KaTeX_Main-Regular.ttf | Bin 71316 -> 0 bytes vendor/assets/fonts/KaTeX_Main-Regular.woff | Bin 39576 -> 0 bytes vendor/assets/fonts/KaTeX_Main-Regular.woff2 | Bin 32948 -> 0 bytes vendor/assets/fonts/KaTeX_Math-BoldItalic.eot | Bin 39990 -> 0 bytes vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf | Bin 39744 -> 0 bytes vendor/assets/fonts/KaTeX_Math-BoldItalic.woff | Bin 23192 -> 0 bytes vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 | Bin 20028 -> 0 bytes vendor/assets/fonts/KaTeX_Math-Italic.eot | Bin 41676 -> 0 bytes vendor/assets/fonts/KaTeX_Math-Italic.ttf | Bin 41448 -> 0 bytes vendor/assets/fonts/KaTeX_Math-Italic.woff | Bin 23820 -> 0 bytes vendor/assets/fonts/KaTeX_Math-Italic.woff2 | Bin 20420 -> 0 bytes vendor/assets/fonts/KaTeX_Math-Regular.eot | Bin 41536 -> 0 bytes vendor/assets/fonts/KaTeX_Math-Regular.ttf | Bin 41304 -> 0 bytes vendor/assets/fonts/KaTeX_Math-Regular.woff | Bin 23712 -> 0 bytes vendor/assets/fonts/KaTeX_Math-Regular.woff2 | Bin 20384 -> 0 bytes vendor/assets/fonts/KaTeX_SansSerif-Bold.eot | Bin 34204 -> 0 bytes vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf | Bin 33964 -> 0 bytes vendor/assets/fonts/KaTeX_SansSerif-Bold.woff | Bin 19196 -> 0 bytes vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 | Bin 16000 -> 0 bytes vendor/assets/fonts/KaTeX_SansSerif-Italic.eot | Bin 31320 -> 0 bytes vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf | Bin 31072 -> 0 bytes vendor/assets/fonts/KaTeX_SansSerif-Italic.woff | Bin 18080 -> 0 bytes vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 | Bin 15144 -> 0 bytes vendor/assets/fonts/KaTeX_SansSerif-Regular.eot | Bin 30212 -> 0 bytes vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf | Bin 29960 -> 0 bytes vendor/assets/fonts/KaTeX_SansSerif-Regular.woff | Bin 16744 -> 0 bytes vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 | Bin 13900 -> 0 bytes vendor/assets/fonts/KaTeX_Script-Regular.eot | Bin 25104 -> 0 bytes vendor/assets/fonts/KaTeX_Script-Regular.ttf | Bin 24864 -> 0 bytes vendor/assets/fonts/KaTeX_Script-Regular.woff | Bin 13856 -> 0 bytes vendor/assets/fonts/KaTeX_Script-Regular.woff2 | Bin 12284 -> 0 bytes vendor/assets/fonts/KaTeX_Size1-Regular.eot | Bin 13408 -> 0 bytes vendor/assets/fonts/KaTeX_Size1-Regular.ttf | Bin 13172 -> 0 bytes vendor/assets/fonts/KaTeX_Size1-Regular.woff | Bin 6980 -> 0 bytes vendor/assets/fonts/KaTeX_Size1-Regular.woff2 | Bin 5812 -> 0 bytes vendor/assets/fonts/KaTeX_Size2-Regular.eot | Bin 12648 -> 0 bytes vendor/assets/fonts/KaTeX_Size2-Regular.ttf | Bin 12412 -> 0 bytes vendor/assets/fonts/KaTeX_Size2-Regular.woff | Bin 6684 -> 0 bytes vendor/assets/fonts/KaTeX_Size2-Regular.woff2 | Bin 5556 -> 0 bytes vendor/assets/fonts/KaTeX_Size3-Regular.eot | Bin 8596 -> 0 bytes vendor/assets/fonts/KaTeX_Size3-Regular.ttf | Bin 8360 -> 0 bytes vendor/assets/fonts/KaTeX_Size3-Regular.woff | Bin 4776 -> 0 bytes vendor/assets/fonts/KaTeX_Size3-Regular.woff2 | Bin 3852 -> 0 bytes vendor/assets/fonts/KaTeX_Size4-Regular.eot | Bin 11520 -> 0 bytes vendor/assets/fonts/KaTeX_Size4-Regular.ttf | Bin 11284 -> 0 bytes vendor/assets/fonts/KaTeX_Size4-Regular.woff | Bin 6456 -> 0 bytes vendor/assets/fonts/KaTeX_Size4-Regular.woff2 | Bin 5168 -> 0 bytes vendor/assets/fonts/KaTeX_Typewriter-Regular.eot | Bin 35984 -> 0 bytes vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf | Bin 35728 -> 0 bytes vendor/assets/fonts/KaTeX_Typewriter-Regular.woff | Bin 20812 -> 0 bytes vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 | Bin 17360 -> 0 bytes vendor/assets/stylesheets/katex.scss | 1189 -------------------- yarn.lock | 7 + 85 files changed, 37 insertions(+), 1197 deletions(-) delete mode 100755 vendor/assets/fonts/KaTeX_AMS-Regular.eot delete mode 100755 vendor/assets/fonts/KaTeX_AMS-Regular.ttf delete mode 100755 vendor/assets/fonts/KaTeX_AMS-Regular.woff delete mode 100755 vendor/assets/fonts/KaTeX_AMS-Regular.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Caligraphic-Bold.eot delete mode 100755 vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff delete mode 100755 vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Caligraphic-Regular.eot delete mode 100755 vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff delete mode 100755 vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Fraktur-Bold.eot delete mode 100755 vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Fraktur-Bold.woff delete mode 100755 vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Fraktur-Regular.eot delete mode 100755 vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Fraktur-Regular.woff delete mode 100755 vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Main-Bold.eot delete mode 100755 vendor/assets/fonts/KaTeX_Main-Bold.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Main-Bold.woff delete mode 100755 vendor/assets/fonts/KaTeX_Main-Bold.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Main-Italic.eot delete mode 100755 vendor/assets/fonts/KaTeX_Main-Italic.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Main-Italic.woff delete mode 100755 vendor/assets/fonts/KaTeX_Main-Italic.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Main-Regular.eot delete mode 100755 vendor/assets/fonts/KaTeX_Main-Regular.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Main-Regular.woff delete mode 100755 vendor/assets/fonts/KaTeX_Main-Regular.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Math-BoldItalic.eot delete mode 100755 vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Math-BoldItalic.woff delete mode 100755 vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Math-Italic.eot delete mode 100755 vendor/assets/fonts/KaTeX_Math-Italic.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Math-Italic.woff delete mode 100755 vendor/assets/fonts/KaTeX_Math-Italic.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Math-Regular.eot delete mode 100755 vendor/assets/fonts/KaTeX_Math-Regular.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Math-Regular.woff delete mode 100755 vendor/assets/fonts/KaTeX_Math-Regular.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_SansSerif-Bold.eot delete mode 100755 vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf delete mode 100755 vendor/assets/fonts/KaTeX_SansSerif-Bold.woff delete mode 100755 vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_SansSerif-Italic.eot delete mode 100755 vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf delete mode 100755 vendor/assets/fonts/KaTeX_SansSerif-Italic.woff delete mode 100755 vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_SansSerif-Regular.eot delete mode 100755 vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf delete mode 100755 vendor/assets/fonts/KaTeX_SansSerif-Regular.woff delete mode 100755 vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Script-Regular.eot delete mode 100755 vendor/assets/fonts/KaTeX_Script-Regular.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Script-Regular.woff delete mode 100755 vendor/assets/fonts/KaTeX_Script-Regular.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Size1-Regular.eot delete mode 100755 vendor/assets/fonts/KaTeX_Size1-Regular.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Size1-Regular.woff delete mode 100755 vendor/assets/fonts/KaTeX_Size1-Regular.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Size2-Regular.eot delete mode 100755 vendor/assets/fonts/KaTeX_Size2-Regular.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Size2-Regular.woff delete mode 100755 vendor/assets/fonts/KaTeX_Size2-Regular.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Size3-Regular.eot delete mode 100755 vendor/assets/fonts/KaTeX_Size3-Regular.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Size3-Regular.woff delete mode 100755 vendor/assets/fonts/KaTeX_Size3-Regular.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Size4-Regular.eot delete mode 100755 vendor/assets/fonts/KaTeX_Size4-Regular.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Size4-Regular.woff delete mode 100755 vendor/assets/fonts/KaTeX_Size4-Regular.woff2 delete mode 100755 vendor/assets/fonts/KaTeX_Typewriter-Regular.eot delete mode 100755 vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf delete mode 100755 vendor/assets/fonts/KaTeX_Typewriter-Regular.woff delete mode 100755 vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 delete mode 100644 vendor/assets/stylesheets/katex.scss diff --git a/app/assets/javascripts/render_math.js b/app/assets/javascripts/render_math.js index 2e68a9642e7..341fb842cbe 100644 --- a/app/assets/javascripts/render_math.js +++ b/app/assets/javascripts/render_math.js @@ -1,4 +1,5 @@ // import katex from 'katex'; +// import katexCSS from 'katex/dist/katex.css'; import Flash from './flash'; // Renders math using KaTeX in any element with the @@ -28,16 +29,13 @@ function renderWithKaTeX(elements, katex) { export default function renderMath($els) { if (!$els.length) return; - import(/* webpackChunkName: 'katex' */ 'katex').then((katex) => { - $.get(gon.katex_css_url, () => { - const css = $('', { - rel: 'stylesheet', - type: 'text/css', - href: gon.katex_css_url, - }); - css.appendTo('head'); + import(/* webpackChunkName: 'katex' */ 'katex/dist/katex.css') + .then(() => { renderWithKaTeX($els, katex); + }) + .catch((err) => { + Flash(`Can't load katex css ${err}`); }); }).catch((err) => { Flash(`Can't load katex module: ${err}`); diff --git a/config/webpack.config.js b/config/webpack.config.js index f7063442618..fad09886fef 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -128,6 +128,29 @@ var config = { name: '[name].[hash].[ext]', } }, + { + test: /katex.css$/, + include: /node_modules\/katex\/dist/, + exclude: /(vendor\/assets)/, + use: [ + { loader: 'style-loader' }, + { + loader: 'css-loader', + options: { + name: '[name].[hash].[ext]' + } + }, + ], + }, + { + test: /\.(eot|ttf|woff|woff2)$/, + include: /node_modules\/katex\/dist\/fonts/, + exclude: /(vendor\/assets)/, + loader: 'file-loader', + options: { + name: '[name].[hash].[ext]', + } + }, { test: /monaco-editor\/\w+\/vs\/loader\.js$/, use: [ diff --git a/package.json b/package.json index a50364d0929..a7b86b8935c 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "react-dev-utils": "^0.5.2", "select2": "3.5.2-browserify", "sql.js": "^0.4.0", + "style-loader": "^0.19.1", "svg4everybody": "2.1.9", "three": "^0.84.0", "three-orbit-controls": "^82.1.0", diff --git a/vendor/assets/fonts/KaTeX_AMS-Regular.eot b/vendor/assets/fonts/KaTeX_AMS-Regular.eot deleted file mode 100755 index 97fd899ab05..00000000000 Binary files a/vendor/assets/fonts/KaTeX_AMS-Regular.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_AMS-Regular.ttf b/vendor/assets/fonts/KaTeX_AMS-Regular.ttf deleted file mode 100755 index 001c30f2f43..00000000000 Binary files a/vendor/assets/fonts/KaTeX_AMS-Regular.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_AMS-Regular.woff b/vendor/assets/fonts/KaTeX_AMS-Regular.woff deleted file mode 100755 index c6376aeac46..00000000000 Binary files a/vendor/assets/fonts/KaTeX_AMS-Regular.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_AMS-Regular.woff2 b/vendor/assets/fonts/KaTeX_AMS-Regular.woff2 deleted file mode 100755 index 6b43fd937ab..00000000000 Binary files a/vendor/assets/fonts/KaTeX_AMS-Regular.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.eot b/vendor/assets/fonts/KaTeX_Caligraphic-Bold.eot deleted file mode 100755 index f4613bc7c39..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf b/vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf deleted file mode 100755 index e92c81860c5..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff b/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff deleted file mode 100755 index a27cd773c62..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 b/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 deleted file mode 100755 index d9ababd7685..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.eot b/vendor/assets/fonts/KaTeX_Caligraphic-Regular.eot deleted file mode 100755 index b7f66c8e206..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf b/vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf deleted file mode 100755 index e7736624028..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff b/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff deleted file mode 100755 index c6df9639e16..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 b/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 deleted file mode 100755 index d762739df6d..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Bold.eot b/vendor/assets/fonts/KaTeX_Fraktur-Bold.eot deleted file mode 100755 index ffade5ea4ae..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Bold.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf b/vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf deleted file mode 100755 index 977b2f9a8f8..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff b/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff deleted file mode 100755 index fd2d1be5547..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 b/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 deleted file mode 100755 index f5b9bc4611b..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Regular.eot b/vendor/assets/fonts/KaTeX_Fraktur-Regular.eot deleted file mode 100755 index 1676056a3e3..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Regular.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf b/vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf deleted file mode 100755 index a2b86fcf0f0..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff b/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff deleted file mode 100755 index 9088fcd1da8..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 b/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 deleted file mode 100755 index 748ed0e0688..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Main-Bold.eot b/vendor/assets/fonts/KaTeX_Main-Bold.eot deleted file mode 100755 index 3af6f51c107..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Main-Bold.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Main-Bold.ttf b/vendor/assets/fonts/KaTeX_Main-Bold.ttf deleted file mode 100755 index 0a9434d1ed3..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Main-Bold.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Main-Bold.woff b/vendor/assets/fonts/KaTeX_Main-Bold.woff deleted file mode 100755 index 42e687ed86a..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Main-Bold.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Main-Bold.woff2 b/vendor/assets/fonts/KaTeX_Main-Bold.woff2 deleted file mode 100755 index ad0487c9c3c..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Main-Bold.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Main-Italic.eot b/vendor/assets/fonts/KaTeX_Main-Italic.eot deleted file mode 100755 index 0c2537ba89c..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Main-Italic.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Main-Italic.ttf b/vendor/assets/fonts/KaTeX_Main-Italic.ttf deleted file mode 100755 index a8142a7fe34..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Main-Italic.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Main-Italic.woff b/vendor/assets/fonts/KaTeX_Main-Italic.woff deleted file mode 100755 index 0c301bd6787..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Main-Italic.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Main-Italic.woff2 b/vendor/assets/fonts/KaTeX_Main-Italic.woff2 deleted file mode 100755 index 9ea376e0986..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Main-Italic.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Main-Regular.eot b/vendor/assets/fonts/KaTeX_Main-Regular.eot deleted file mode 100755 index 5c3387fd668..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Main-Regular.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Main-Regular.ttf b/vendor/assets/fonts/KaTeX_Main-Regular.ttf deleted file mode 100755 index 43145ee90cd..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Main-Regular.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Main-Regular.woff b/vendor/assets/fonts/KaTeX_Main-Regular.woff deleted file mode 100755 index 4956dc62d35..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Main-Regular.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Main-Regular.woff2 b/vendor/assets/fonts/KaTeX_Main-Regular.woff2 deleted file mode 100755 index 89b01e44c46..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Main-Regular.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Math-BoldItalic.eot b/vendor/assets/fonts/KaTeX_Math-BoldItalic.eot deleted file mode 100755 index 4209732a5dc..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Math-BoldItalic.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf b/vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf deleted file mode 100755 index c40c1003a35..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff b/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff deleted file mode 100755 index 38c9cf2959a..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 b/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 deleted file mode 100755 index 9d33f144720..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Math-Italic.eot b/vendor/assets/fonts/KaTeX_Math-Italic.eot deleted file mode 100755 index b6f8cbe8ce1..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Math-Italic.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Math-Italic.ttf b/vendor/assets/fonts/KaTeX_Math-Italic.ttf deleted file mode 100755 index a61089b2258..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Math-Italic.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Math-Italic.woff b/vendor/assets/fonts/KaTeX_Math-Italic.woff deleted file mode 100755 index 465a41f359f..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Math-Italic.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Math-Italic.woff2 b/vendor/assets/fonts/KaTeX_Math-Italic.woff2 deleted file mode 100755 index 3f945bee400..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Math-Italic.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Math-Regular.eot b/vendor/assets/fonts/KaTeX_Math-Regular.eot deleted file mode 100755 index 3408ad26bad..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Math-Regular.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Math-Regular.ttf b/vendor/assets/fonts/KaTeX_Math-Regular.ttf deleted file mode 100755 index 5a5788a58db..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Math-Regular.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Math-Regular.woff b/vendor/assets/fonts/KaTeX_Math-Regular.woff deleted file mode 100755 index 34b0e3618b5..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Math-Regular.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Math-Regular.woff2 b/vendor/assets/fonts/KaTeX_Math-Regular.woff2 deleted file mode 100755 index 2385fbeb8e6..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Math-Regular.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Bold.eot b/vendor/assets/fonts/KaTeX_SansSerif-Bold.eot deleted file mode 100755 index 2104d2aa29b..00000000000 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Bold.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf b/vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf deleted file mode 100755 index 644e8aa3c4d..00000000000 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff b/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff deleted file mode 100755 index 126fd8e4b42..00000000000 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 b/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 deleted file mode 100755 index f042002876c..00000000000 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Italic.eot b/vendor/assets/fonts/KaTeX_SansSerif-Italic.eot deleted file mode 100755 index d9633ff5865..00000000000 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Italic.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf b/vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf deleted file mode 100755 index 9eb9d8f0ce6..00000000000 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff b/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff deleted file mode 100755 index 0fb184ce0ab..00000000000 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 b/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 deleted file mode 100755 index cf87ba55541..00000000000 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Regular.eot b/vendor/assets/fonts/KaTeX_SansSerif-Regular.eot deleted file mode 100755 index 190015bf812..00000000000 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Regular.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf b/vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf deleted file mode 100755 index 4d27eba24b7..00000000000 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff b/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff deleted file mode 100755 index bcaae2cbd1e..00000000000 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 b/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 deleted file mode 100755 index aa1eefc0930..00000000000 Binary files a/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Script-Regular.eot b/vendor/assets/fonts/KaTeX_Script-Regular.eot deleted file mode 100755 index c41bad3038c..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Script-Regular.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Script-Regular.ttf b/vendor/assets/fonts/KaTeX_Script-Regular.ttf deleted file mode 100755 index 11700094b79..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Script-Regular.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Script-Regular.woff b/vendor/assets/fonts/KaTeX_Script-Regular.woff deleted file mode 100755 index 03df046d859..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Script-Regular.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Script-Regular.woff2 b/vendor/assets/fonts/KaTeX_Script-Regular.woff2 deleted file mode 100755 index a6fc2a96b7d..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Script-Regular.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size1-Regular.eot b/vendor/assets/fonts/KaTeX_Size1-Regular.eot deleted file mode 100755 index ebe463e4a3f..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size1-Regular.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size1-Regular.ttf b/vendor/assets/fonts/KaTeX_Size1-Regular.ttf deleted file mode 100755 index 7d0a7c5825e..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size1-Regular.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size1-Regular.woff b/vendor/assets/fonts/KaTeX_Size1-Regular.woff deleted file mode 100755 index c1838b2927c..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size1-Regular.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size1-Regular.woff2 b/vendor/assets/fonts/KaTeX_Size1-Regular.woff2 deleted file mode 100755 index 450cd7b3866..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size1-Regular.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size2-Regular.eot b/vendor/assets/fonts/KaTeX_Size2-Regular.eot deleted file mode 100755 index c0fdba72c89..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size2-Regular.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size2-Regular.ttf b/vendor/assets/fonts/KaTeX_Size2-Regular.ttf deleted file mode 100755 index fcff9e13239..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size2-Regular.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size2-Regular.woff b/vendor/assets/fonts/KaTeX_Size2-Regular.woff deleted file mode 100755 index 5b421fb6f83..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size2-Regular.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size2-Regular.woff2 b/vendor/assets/fonts/KaTeX_Size2-Regular.woff2 deleted file mode 100755 index a0df638b81b..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size2-Regular.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size3-Regular.eot b/vendor/assets/fonts/KaTeX_Size3-Regular.eot deleted file mode 100755 index a28ebc892c3..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size3-Regular.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size3-Regular.ttf b/vendor/assets/fonts/KaTeX_Size3-Regular.ttf deleted file mode 100755 index af36ae23ee9..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size3-Regular.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size3-Regular.woff b/vendor/assets/fonts/KaTeX_Size3-Regular.woff deleted file mode 100755 index d0d195539e2..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size3-Regular.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size3-Regular.woff2 b/vendor/assets/fonts/KaTeX_Size3-Regular.woff2 deleted file mode 100755 index 226186ae5fc..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size3-Regular.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size4-Regular.eot b/vendor/assets/fonts/KaTeX_Size4-Regular.eot deleted file mode 100755 index a6753252675..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size4-Regular.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size4-Regular.ttf b/vendor/assets/fonts/KaTeX_Size4-Regular.ttf deleted file mode 100755 index 979a449915d..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size4-Regular.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size4-Regular.woff b/vendor/assets/fonts/KaTeX_Size4-Regular.woff deleted file mode 100755 index 185e575d6e3..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size4-Regular.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Size4-Regular.woff2 b/vendor/assets/fonts/KaTeX_Size4-Regular.woff2 deleted file mode 100755 index 292513c0e09..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Size4-Regular.woff2 and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Typewriter-Regular.eot b/vendor/assets/fonts/KaTeX_Typewriter-Regular.eot deleted file mode 100755 index b713e4cc0e4..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Typewriter-Regular.eot and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf b/vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf deleted file mode 100755 index 78640734c50..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff b/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff deleted file mode 100755 index c572bf5073f..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff and /dev/null differ diff --git a/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 b/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 deleted file mode 100755 index eddad58f060..00000000000 Binary files a/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 and /dev/null differ diff --git a/vendor/assets/stylesheets/katex.scss b/vendor/assets/stylesheets/katex.scss deleted file mode 100644 index 937a67ddc42..00000000000 --- a/vendor/assets/stylesheets/katex.scss +++ /dev/null @@ -1,1189 +0,0 @@ -/* - The MIT License (MIT) - - Copyright (c) 2015 Khan Academy - - This software also uses portions of the underscore.js project, which is - MIT licensed with the following copyright: - - Copyright (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative - Reporters & Editors - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - */ - -/* - Here is how to build a version of KaTeX that works with gitlab. - - The problem is that the standard procedure for changing font location doesn't work for the empty string. - - 1. Clone KaTeX. Anything later than 4fb9445a9 (is merged into master) will do. - 2. make (requires node) - 3. sed -e 's,fonts/,,' -e 's/url\(([^)]*)\)/url(font-path\1)/g' build/katex.css > build/katex.scss - 4. Copy build/katex.js to gitlab/vendor/assets/javascripts/katex.js, - build/katex.scss to gitlab/vendor/assets/stylesheets/katex.scss and - fonts/* to gitlab/vendor/assets/fonts/. -*/ - -@font-face { - font-family: 'KaTeX_AMS'; - src: url(font-path('KaTeX_AMS-Regular.eot')); - src: url(font-path('KaTeX_AMS-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_AMS-Regular.woff2')) format('woff2'), url(font-path('KaTeX_AMS-Regular.woff')) format('woff'), url(font-path('KaTeX_AMS-Regular.ttf')) format('truetype'); - font-weight: normal; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Caligraphic'; - src: url(font-path('KaTeX_Caligraphic-Bold.eot')); - src: url(font-path('KaTeX_Caligraphic-Bold.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Caligraphic-Bold.woff2')) format('woff2'), url(font-path('KaTeX_Caligraphic-Bold.woff')) format('woff'), url(font-path('KaTeX_Caligraphic-Bold.ttf')) format('truetype'); - font-weight: bold; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Caligraphic'; - src: url(font-path('KaTeX_Caligraphic-Regular.eot')); - src: url(font-path('KaTeX_Caligraphic-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Caligraphic-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Caligraphic-Regular.woff')) format('woff'), url(font-path('KaTeX_Caligraphic-Regular.ttf')) format('truetype'); - font-weight: normal; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Fraktur'; - src: url(font-path('KaTeX_Fraktur-Bold.eot')); - src: url(font-path('KaTeX_Fraktur-Bold.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Fraktur-Bold.woff2')) format('woff2'), url(font-path('KaTeX_Fraktur-Bold.woff')) format('woff'), url(font-path('KaTeX_Fraktur-Bold.ttf')) format('truetype'); - font-weight: bold; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Fraktur'; - src: url(font-path('KaTeX_Fraktur-Regular.eot')); - src: url(font-path('KaTeX_Fraktur-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Fraktur-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Fraktur-Regular.woff')) format('woff'), url(font-path('KaTeX_Fraktur-Regular.ttf')) format('truetype'); - font-weight: normal; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Main'; - src: url(font-path('KaTeX_Main-Bold.eot')); - src: url(font-path('KaTeX_Main-Bold.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Main-Bold.woff2')) format('woff2'), url(font-path('KaTeX_Main-Bold.woff')) format('woff'), url(font-path('KaTeX_Main-Bold.ttf')) format('truetype'); - font-weight: bold; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Main'; - src: url(font-path('KaTeX_Main-Italic.eot')); - src: url(font-path('KaTeX_Main-Italic.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Main-Italic.woff2')) format('woff2'), url(font-path('KaTeX_Main-Italic.woff')) format('woff'), url(font-path('KaTeX_Main-Italic.ttf')) format('truetype'); - font-weight: normal; - font-style: italic; -} -@font-face { - font-family: 'KaTeX_Main'; - src: url(font-path('KaTeX_Main-Regular.eot')); - src: url(font-path('KaTeX_Main-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Main-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Main-Regular.woff')) format('woff'), url(font-path('KaTeX_Main-Regular.ttf')) format('truetype'); - font-weight: normal; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Math'; - src: url(font-path('KaTeX_Math-Italic.eot')); - src: url(font-path('KaTeX_Math-Italic.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Math-Italic.woff2')) format('woff2'), url(font-path('KaTeX_Math-Italic.woff')) format('woff'), url(font-path('KaTeX_Math-Italic.ttf')) format('truetype'); - font-weight: normal; - font-style: italic; -} -@font-face { - font-family: 'KaTeX_SansSerif'; - src: url(font-path('KaTeX_SansSerif-Regular.eot')); - src: url(font-path('KaTeX_SansSerif-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_SansSerif-Regular.woff2')) format('woff2'), url(font-path('KaTeX_SansSerif-Regular.woff')) format('woff'), url(font-path('KaTeX_SansSerif-Regular.ttf')) format('truetype'); - font-weight: normal; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Script'; - src: url(font-path('KaTeX_Script-Regular.eot')); - src: url(font-path('KaTeX_Script-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Script-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Script-Regular.woff')) format('woff'), url(font-path('KaTeX_Script-Regular.ttf')) format('truetype'); - font-weight: normal; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Size1'; - src: url(font-path('KaTeX_Size1-Regular.eot')); - src: url(font-path('KaTeX_Size1-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Size1-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Size1-Regular.woff')) format('woff'), url(font-path('KaTeX_Size1-Regular.ttf')) format('truetype'); - font-weight: normal; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Size2'; - src: url(font-path('KaTeX_Size2-Regular.eot')); - src: url(font-path('KaTeX_Size2-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Size2-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Size2-Regular.woff')) format('woff'), url(font-path('KaTeX_Size2-Regular.ttf')) format('truetype'); - font-weight: normal; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Size3'; - src: url(font-path('KaTeX_Size3-Regular.eot')); - src: url(font-path('KaTeX_Size3-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Size3-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Size3-Regular.woff')) format('woff'), url(font-path('KaTeX_Size3-Regular.ttf')) format('truetype'); - font-weight: normal; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Size4'; - src: url(font-path('KaTeX_Size4-Regular.eot')); - src: url(font-path('KaTeX_Size4-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Size4-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Size4-Regular.woff')) format('woff'), url(font-path('KaTeX_Size4-Regular.ttf')) format('truetype'); - font-weight: normal; - font-style: normal; -} -@font-face { - font-family: 'KaTeX_Typewriter'; - src: url(font-path('KaTeX_Typewriter-Regular.eot')); - src: url(font-path('KaTeX_Typewriter-Regular.eot#iefix')) format('embedded-opentype'), url(font-path('KaTeX_Typewriter-Regular.woff2')) format('woff2'), url(font-path('KaTeX_Typewriter-Regular.woff')) format('woff'), url(font-path('KaTeX_Typewriter-Regular.ttf')) format('truetype'); - font-weight: normal; - font-style: normal; -} -.katex-display { - display: block; - margin: 1em 0; - text-align: center; -} -.katex-display > .katex { - display: inline-block; - text-align: initial; -} -.katex { - font: normal 1.21em KaTeX_Main, Times New Roman, serif; - line-height: 1.2; - white-space: nowrap; - text-indent: 0; - text-rendering: auto; -} -.katex * { - -ms-high-contrast-adjust: none !important; -} -.katex .katex-html { - display: inline-block; -} -.katex .katex-mathml { - position: absolute; - clip: rect(1px, 1px, 1px, 1px); - padding: 0; - border: 0; - height: 1px; - width: 1px; - overflow: hidden; -} -.katex .base { - position: relative; - display: inline-block; -} -.katex .strut { - display: inline-block; -} -.katex .mathrm { - font-style: normal; -} -.katex .textit { - font-style: italic; -} -.katex .mathit { - font-family: KaTeX_Math; - font-style: italic; -} -.katex .mathbf { - font-family: KaTeX_Main; - font-weight: bold; -} -.katex .amsrm { - font-family: KaTeX_AMS; -} -.katex .mathbb { - font-family: KaTeX_AMS; -} -.katex .mathcal { - font-family: KaTeX_Caligraphic; -} -.katex .mathfrak { - font-family: KaTeX_Fraktur; -} -.katex .mathtt { - font-family: KaTeX_Typewriter; -} -.katex .mathscr { - font-family: KaTeX_Script; -} -.katex .mathsf { - font-family: KaTeX_SansSerif; -} -.katex .mainit { - font-family: KaTeX_Main; - font-style: italic; -} -.katex .mainrm { - font-family: KaTeX_Main; - font-style: normal; -} -.katex .mord + .mop { - margin-left: 0.16667em; -} -.katex .mord + .mbin { - margin-left: 0.22222em; -} -.katex .mord + .mrel { - margin-left: 0.27778em; -} -.katex .mord + .minner { - margin-left: 0.16667em; -} -.katex .mop + .mord { - margin-left: 0.16667em; -} -.katex .mop + .mop { - margin-left: 0.16667em; -} -.katex .mop + .mrel { - margin-left: 0.27778em; -} -.katex .mop + .minner { - margin-left: 0.16667em; -} -.katex .mbin + .mord { - margin-left: 0.22222em; -} -.katex .mbin + .mop { - margin-left: 0.22222em; -} -.katex .mbin + .mopen { - margin-left: 0.22222em; -} -.katex .mbin + .minner { - margin-left: 0.22222em; -} -.katex .mrel + .mord { - margin-left: 0.27778em; -} -.katex .mrel + .mop { - margin-left: 0.27778em; -} -.katex .mrel + .mopen { - margin-left: 0.27778em; -} -.katex .mrel + .minner { - margin-left: 0.27778em; -} -.katex .mclose + .mop { - margin-left: 0.16667em; -} -.katex .mclose + .mbin { - margin-left: 0.22222em; -} -.katex .mclose + .mrel { - margin-left: 0.27778em; -} -.katex .mclose + .minner { - margin-left: 0.16667em; -} -.katex .mpunct + .mord { - margin-left: 0.16667em; -} -.katex .mpunct + .mop { - margin-left: 0.16667em; -} -.katex .mpunct + .mrel { - margin-left: 0.16667em; -} -.katex .mpunct + .mopen { - margin-left: 0.16667em; -} -.katex .mpunct + .mclose { - margin-left: 0.16667em; -} -.katex .mpunct + .mpunct { - margin-left: 0.16667em; -} -.katex .mpunct + .minner { - margin-left: 0.16667em; -} -.katex .minner + .mord { - margin-left: 0.16667em; -} -.katex .minner + .mop { - margin-left: 0.16667em; -} -.katex .minner + .mbin { - margin-left: 0.22222em; -} -.katex .minner + .mrel { - margin-left: 0.27778em; -} -.katex .minner + .mopen { - margin-left: 0.16667em; -} -.katex .minner + .mpunct { - margin-left: 0.16667em; -} -.katex .minner + .minner { - margin-left: 0.16667em; -} -.katex .mord.mtight { - margin-left: 0; -} -.katex .mop.mtight { - margin-left: 0; -} -.katex .mbin.mtight { - margin-left: 0; -} -.katex .mrel.mtight { - margin-left: 0; -} -.katex .mopen.mtight { - margin-left: 0; -} -.katex .mclose.mtight { - margin-left: 0; -} -.katex .mpunct.mtight { - margin-left: 0; -} -.katex .minner.mtight { - margin-left: 0; -} -.katex .mord + .mop.mtight { - margin-left: 0.16667em; -} -.katex .mop + .mord.mtight { - margin-left: 0.16667em; -} -.katex .mop + .mop.mtight { - margin-left: 0.16667em; -} -.katex .mclose + .mop.mtight { - margin-left: 0.16667em; -} -.katex .minner + .mop.mtight { - margin-left: 0.16667em; -} -.katex .vlist-t { - display: inline-table; - table-layout: fixed; -} -.katex .vlist-r { - display: table-row; -} -.katex .vlist { - display: table-cell; - vertical-align: bottom; - position: relative; -} -.katex .vlist > span { - display: block; - height: 0; - position: relative; -} -.katex .vlist > span > span { - display: inline-block; -} -.katex .vlist > span > .pstrut { - overflow: hidden; - width: 0; -} -.katex .vlist-t2 { - margin-right: -2px; -} -.katex .vlist-s { - display: table-cell; - vertical-align: bottom; - font-size: 1px; - width: 2px; -} -.katex .msupsub { - text-align: left; -} -.katex .mfrac > span > span { - text-align: center; -} -.katex .mfrac .frac-line { - display: inline-block; - width: 100%; -} -@media screen { - .katex .mfrac .frac-line, - .katex .overline .overline-line, - .katex .underline .underline-line { - min-height: 1px; - } -} -@media screen and (-webkit-min-device-pixel-ratio: 2), screen and (min-resolution: 192dpi) { - .katex .mfrac .frac-line, - .katex .overline .overline-line, - .katex .underline .underline-line { - min-height: 0.5px; - } -} -.katex .mspace { - display: inline-block; -} -.katex .mspace.negativethinspace { - margin-left: -0.16667em; -} -.katex .mspace.muspace { - width: 0.055556em; -} -.katex .mspace.thinspace { - width: 0.16667em; -} -.katex .mspace.negativemediumspace { - margin-left: -0.22222em; -} -.katex .mspace.mediumspace { - width: 0.22222em; -} -.katex .mspace.thickspace { - width: 0.27778em; -} -.katex .mspace.sixmuspace { - width: 0.333333em; -} -.katex .mspace.eightmuspace { - width: 0.444444em; -} -.katex .mspace.enspace { - width: 0.5em; -} -.katex .mspace.twelvemuspace { - width: 0.666667em; -} -.katex .mspace.quad { - width: 1em; -} -.katex .mspace.qquad { - width: 2em; -} -.katex .llap, -.katex .rlap, -.katex .clap { - width: 0; - position: relative; -} -.katex .llap > .inner, -.katex .rlap > .inner, -.katex .clap > .inner { - position: absolute; -} -.katex .llap > .fix, -.katex .rlap > .fix, -.katex .clap > .fix { - display: inline-block; -} -.katex .llap > .inner { - right: 0; -} -.katex .rlap > .inner, -.katex .clap > .inner { - left: 0; -} -.katex .clap > .inner > span { - margin-left: -50%; - margin-right: 50%; -} -.katex .katex-logo .a { - font-size: 0.75em; - margin-left: -0.32em; - position: relative; - top: -0.2em; -} -.katex .katex-logo .t { - margin-left: -0.23em; -} -.katex .katex-logo .e { - margin-left: -0.1667em; - position: relative; - top: 0.2155em; -} -.katex .katex-logo .x { - margin-left: -0.125em; -} -.katex .rule { - display: inline-block; - border: solid 0; - position: relative; -} -.katex .overline .overline-line, -.katex .underline .underline-line { - display: inline-block; - width: 100%; -} -.katex .sqrt > .root { - margin-left: 0.27777778em; - margin-right: -0.55555556em; -} -.katex .sizing, -.katex .fontsize-ensurer { - display: inline-block; -} -.katex .sizing.reset-size1.size1, -.katex .fontsize-ensurer.reset-size1.size1 { - font-size: 1em; -} -.katex .sizing.reset-size1.size2, -.katex .fontsize-ensurer.reset-size1.size2 { - font-size: 1.2em; -} -.katex .sizing.reset-size1.size3, -.katex .fontsize-ensurer.reset-size1.size3 { - font-size: 1.4em; -} -.katex .sizing.reset-size1.size4, -.katex .fontsize-ensurer.reset-size1.size4 { - font-size: 1.6em; -} -.katex .sizing.reset-size1.size5, -.katex .fontsize-ensurer.reset-size1.size5 { - font-size: 1.8em; -} -.katex .sizing.reset-size1.size6, -.katex .fontsize-ensurer.reset-size1.size6 { - font-size: 2em; -} -.katex .sizing.reset-size1.size7, -.katex .fontsize-ensurer.reset-size1.size7 { - font-size: 2.4em; -} -.katex .sizing.reset-size1.size8, -.katex .fontsize-ensurer.reset-size1.size8 { - font-size: 2.88em; -} -.katex .sizing.reset-size1.size9, -.katex .fontsize-ensurer.reset-size1.size9 { - font-size: 3.456em; -} -.katex .sizing.reset-size1.size10, -.katex .fontsize-ensurer.reset-size1.size10 { - font-size: 4.148em; -} -.katex .sizing.reset-size1.size11, -.katex .fontsize-ensurer.reset-size1.size11 { - font-size: 4.976em; -} -.katex .sizing.reset-size2.size1, -.katex .fontsize-ensurer.reset-size2.size1 { - font-size: 0.83333333em; -} -.katex .sizing.reset-size2.size2, -.katex .fontsize-ensurer.reset-size2.size2 { - font-size: 1em; -} -.katex .sizing.reset-size2.size3, -.katex .fontsize-ensurer.reset-size2.size3 { - font-size: 1.16666667em; -} -.katex .sizing.reset-size2.size4, -.katex .fontsize-ensurer.reset-size2.size4 { - font-size: 1.33333333em; -} -.katex .sizing.reset-size2.size5, -.katex .fontsize-ensurer.reset-size2.size5 { - font-size: 1.5em; -} -.katex .sizing.reset-size2.size6, -.katex .fontsize-ensurer.reset-size2.size6 { - font-size: 1.66666667em; -} -.katex .sizing.reset-size2.size7, -.katex .fontsize-ensurer.reset-size2.size7 { - font-size: 2em; -} -.katex .sizing.reset-size2.size8, -.katex .fontsize-ensurer.reset-size2.size8 { - font-size: 2.4em; -} -.katex .sizing.reset-size2.size9, -.katex .fontsize-ensurer.reset-size2.size9 { - font-size: 2.88em; -} -.katex .sizing.reset-size2.size10, -.katex .fontsize-ensurer.reset-size2.size10 { - font-size: 3.45666667em; -} -.katex .sizing.reset-size2.size11, -.katex .fontsize-ensurer.reset-size2.size11 { - font-size: 4.14666667em; -} -.katex .sizing.reset-size3.size1, -.katex .fontsize-ensurer.reset-size3.size1 { - font-size: 0.71428571em; -} -.katex .sizing.reset-size3.size2, -.katex .fontsize-ensurer.reset-size3.size2 { - font-size: 0.85714286em; -} -.katex .sizing.reset-size3.size3, -.katex .fontsize-ensurer.reset-size3.size3 { - font-size: 1em; -} -.katex .sizing.reset-size3.size4, -.katex .fontsize-ensurer.reset-size3.size4 { - font-size: 1.14285714em; -} -.katex .sizing.reset-size3.size5, -.katex .fontsize-ensurer.reset-size3.size5 { - font-size: 1.28571429em; -} -.katex .sizing.reset-size3.size6, -.katex .fontsize-ensurer.reset-size3.size6 { - font-size: 1.42857143em; -} -.katex .sizing.reset-size3.size7, -.katex .fontsize-ensurer.reset-size3.size7 { - font-size: 1.71428571em; -} -.katex .sizing.reset-size3.size8, -.katex .fontsize-ensurer.reset-size3.size8 { - font-size: 2.05714286em; -} -.katex .sizing.reset-size3.size9, -.katex .fontsize-ensurer.reset-size3.size9 { - font-size: 2.46857143em; -} -.katex .sizing.reset-size3.size10, -.katex .fontsize-ensurer.reset-size3.size10 { - font-size: 2.96285714em; -} -.katex .sizing.reset-size3.size11, -.katex .fontsize-ensurer.reset-size3.size11 { - font-size: 3.55428571em; -} -.katex .sizing.reset-size4.size1, -.katex .fontsize-ensurer.reset-size4.size1 { - font-size: 0.625em; -} -.katex .sizing.reset-size4.size2, -.katex .fontsize-ensurer.reset-size4.size2 { - font-size: 0.75em; -} -.katex .sizing.reset-size4.size3, -.katex .fontsize-ensurer.reset-size4.size3 { - font-size: 0.875em; -} -.katex .sizing.reset-size4.size4, -.katex .fontsize-ensurer.reset-size4.size4 { - font-size: 1em; -} -.katex .sizing.reset-size4.size5, -.katex .fontsize-ensurer.reset-size4.size5 { - font-size: 1.125em; -} -.katex .sizing.reset-size4.size6, -.katex .fontsize-ensurer.reset-size4.size6 { - font-size: 1.25em; -} -.katex .sizing.reset-size4.size7, -.katex .fontsize-ensurer.reset-size4.size7 { - font-size: 1.5em; -} -.katex .sizing.reset-size4.size8, -.katex .fontsize-ensurer.reset-size4.size8 { - font-size: 1.8em; -} -.katex .sizing.reset-size4.size9, -.katex .fontsize-ensurer.reset-size4.size9 { - font-size: 2.16em; -} -.katex .sizing.reset-size4.size10, -.katex .fontsize-ensurer.reset-size4.size10 { - font-size: 2.5925em; -} -.katex .sizing.reset-size4.size11, -.katex .fontsize-ensurer.reset-size4.size11 { - font-size: 3.11em; -} -.katex .sizing.reset-size5.size1, -.katex .fontsize-ensurer.reset-size5.size1 { - font-size: 0.55555556em; -} -.katex .sizing.reset-size5.size2, -.katex .fontsize-ensurer.reset-size5.size2 { - font-size: 0.66666667em; -} -.katex .sizing.reset-size5.size3, -.katex .fontsize-ensurer.reset-size5.size3 { - font-size: 0.77777778em; -} -.katex .sizing.reset-size5.size4, -.katex .fontsize-ensurer.reset-size5.size4 { - font-size: 0.88888889em; -} -.katex .sizing.reset-size5.size5, -.katex .fontsize-ensurer.reset-size5.size5 { - font-size: 1em; -} -.katex .sizing.reset-size5.size6, -.katex .fontsize-ensurer.reset-size5.size6 { - font-size: 1.11111111em; -} -.katex .sizing.reset-size5.size7, -.katex .fontsize-ensurer.reset-size5.size7 { - font-size: 1.33333333em; -} -.katex .sizing.reset-size5.size8, -.katex .fontsize-ensurer.reset-size5.size8 { - font-size: 1.6em; -} -.katex .sizing.reset-size5.size9, -.katex .fontsize-ensurer.reset-size5.size9 { - font-size: 1.92em; -} -.katex .sizing.reset-size5.size10, -.katex .fontsize-ensurer.reset-size5.size10 { - font-size: 2.30444444em; -} -.katex .sizing.reset-size5.size11, -.katex .fontsize-ensurer.reset-size5.size11 { - font-size: 2.76444444em; -} -.katex .sizing.reset-size6.size1, -.katex .fontsize-ensurer.reset-size6.size1 { - font-size: 0.5em; -} -.katex .sizing.reset-size6.size2, -.katex .fontsize-ensurer.reset-size6.size2 { - font-size: 0.6em; -} -.katex .sizing.reset-size6.size3, -.katex .fontsize-ensurer.reset-size6.size3 { - font-size: 0.7em; -} -.katex .sizing.reset-size6.size4, -.katex .fontsize-ensurer.reset-size6.size4 { - font-size: 0.8em; -} -.katex .sizing.reset-size6.size5, -.katex .fontsize-ensurer.reset-size6.size5 { - font-size: 0.9em; -} -.katex .sizing.reset-size6.size6, -.katex .fontsize-ensurer.reset-size6.size6 { - font-size: 1em; -} -.katex .sizing.reset-size6.size7, -.katex .fontsize-ensurer.reset-size6.size7 { - font-size: 1.2em; -} -.katex .sizing.reset-size6.size8, -.katex .fontsize-ensurer.reset-size6.size8 { - font-size: 1.44em; -} -.katex .sizing.reset-size6.size9, -.katex .fontsize-ensurer.reset-size6.size9 { - font-size: 1.728em; -} -.katex .sizing.reset-size6.size10, -.katex .fontsize-ensurer.reset-size6.size10 { - font-size: 2.074em; -} -.katex .sizing.reset-size6.size11, -.katex .fontsize-ensurer.reset-size6.size11 { - font-size: 2.488em; -} -.katex .sizing.reset-size7.size1, -.katex .fontsize-ensurer.reset-size7.size1 { - font-size: 0.41666667em; -} -.katex .sizing.reset-size7.size2, -.katex .fontsize-ensurer.reset-size7.size2 { - font-size: 0.5em; -} -.katex .sizing.reset-size7.size3, -.katex .fontsize-ensurer.reset-size7.size3 { - font-size: 0.58333333em; -} -.katex .sizing.reset-size7.size4, -.katex .fontsize-ensurer.reset-size7.size4 { - font-size: 0.66666667em; -} -.katex .sizing.reset-size7.size5, -.katex .fontsize-ensurer.reset-size7.size5 { - font-size: 0.75em; -} -.katex .sizing.reset-size7.size6, -.katex .fontsize-ensurer.reset-size7.size6 { - font-size: 0.83333333em; -} -.katex .sizing.reset-size7.size7, -.katex .fontsize-ensurer.reset-size7.size7 { - font-size: 1em; -} -.katex .sizing.reset-size7.size8, -.katex .fontsize-ensurer.reset-size7.size8 { - font-size: 1.2em; -} -.katex .sizing.reset-size7.size9, -.katex .fontsize-ensurer.reset-size7.size9 { - font-size: 1.44em; -} -.katex .sizing.reset-size7.size10, -.katex .fontsize-ensurer.reset-size7.size10 { - font-size: 1.72833333em; -} -.katex .sizing.reset-size7.size11, -.katex .fontsize-ensurer.reset-size7.size11 { - font-size: 2.07333333em; -} -.katex .sizing.reset-size8.size1, -.katex .fontsize-ensurer.reset-size8.size1 { - font-size: 0.34722222em; -} -.katex .sizing.reset-size8.size2, -.katex .fontsize-ensurer.reset-size8.size2 { - font-size: 0.41666667em; -} -.katex .sizing.reset-size8.size3, -.katex .fontsize-ensurer.reset-size8.size3 { - font-size: 0.48611111em; -} -.katex .sizing.reset-size8.size4, -.katex .fontsize-ensurer.reset-size8.size4 { - font-size: 0.55555556em; -} -.katex .sizing.reset-size8.size5, -.katex .fontsize-ensurer.reset-size8.size5 { - font-size: 0.625em; -} -.katex .sizing.reset-size8.size6, -.katex .fontsize-ensurer.reset-size8.size6 { - font-size: 0.69444444em; -} -.katex .sizing.reset-size8.size7, -.katex .fontsize-ensurer.reset-size8.size7 { - font-size: 0.83333333em; -} -.katex .sizing.reset-size8.size8, -.katex .fontsize-ensurer.reset-size8.size8 { - font-size: 1em; -} -.katex .sizing.reset-size8.size9, -.katex .fontsize-ensurer.reset-size8.size9 { - font-size: 1.2em; -} -.katex .sizing.reset-size8.size10, -.katex .fontsize-ensurer.reset-size8.size10 { - font-size: 1.44027778em; -} -.katex .sizing.reset-size8.size11, -.katex .fontsize-ensurer.reset-size8.size11 { - font-size: 1.72777778em; -} -.katex .sizing.reset-size9.size1, -.katex .fontsize-ensurer.reset-size9.size1 { - font-size: 0.28935185em; -} -.katex .sizing.reset-size9.size2, -.katex .fontsize-ensurer.reset-size9.size2 { - font-size: 0.34722222em; -} -.katex .sizing.reset-size9.size3, -.katex .fontsize-ensurer.reset-size9.size3 { - font-size: 0.40509259em; -} -.katex .sizing.reset-size9.size4, -.katex .fontsize-ensurer.reset-size9.size4 { - font-size: 0.46296296em; -} -.katex .sizing.reset-size9.size5, -.katex .fontsize-ensurer.reset-size9.size5 { - font-size: 0.52083333em; -} -.katex .sizing.reset-size9.size6, -.katex .fontsize-ensurer.reset-size9.size6 { - font-size: 0.5787037em; -} -.katex .sizing.reset-size9.size7, -.katex .fontsize-ensurer.reset-size9.size7 { - font-size: 0.69444444em; -} -.katex .sizing.reset-size9.size8, -.katex .fontsize-ensurer.reset-size9.size8 { - font-size: 0.83333333em; -} -.katex .sizing.reset-size9.size9, -.katex .fontsize-ensurer.reset-size9.size9 { - font-size: 1em; -} -.katex .sizing.reset-size9.size10, -.katex .fontsize-ensurer.reset-size9.size10 { - font-size: 1.20023148em; -} -.katex .sizing.reset-size9.size11, -.katex .fontsize-ensurer.reset-size9.size11 { - font-size: 1.43981481em; -} -.katex .sizing.reset-size10.size1, -.katex .fontsize-ensurer.reset-size10.size1 { - font-size: 0.24108004em; -} -.katex .sizing.reset-size10.size2, -.katex .fontsize-ensurer.reset-size10.size2 { - font-size: 0.28929605em; -} -.katex .sizing.reset-size10.size3, -.katex .fontsize-ensurer.reset-size10.size3 { - font-size: 0.33751205em; -} -.katex .sizing.reset-size10.size4, -.katex .fontsize-ensurer.reset-size10.size4 { - font-size: 0.38572806em; -} -.katex .sizing.reset-size10.size5, -.katex .fontsize-ensurer.reset-size10.size5 { - font-size: 0.43394407em; -} -.katex .sizing.reset-size10.size6, -.katex .fontsize-ensurer.reset-size10.size6 { - font-size: 0.48216008em; -} -.katex .sizing.reset-size10.size7, -.katex .fontsize-ensurer.reset-size10.size7 { - font-size: 0.57859209em; -} -.katex .sizing.reset-size10.size8, -.katex .fontsize-ensurer.reset-size10.size8 { - font-size: 0.69431051em; -} -.katex .sizing.reset-size10.size9, -.katex .fontsize-ensurer.reset-size10.size9 { - font-size: 0.83317261em; -} -.katex .sizing.reset-size10.size10, -.katex .fontsize-ensurer.reset-size10.size10 { - font-size: 1em; -} -.katex .sizing.reset-size10.size11, -.katex .fontsize-ensurer.reset-size10.size11 { - font-size: 1.19961427em; -} -.katex .sizing.reset-size11.size1, -.katex .fontsize-ensurer.reset-size11.size1 { - font-size: 0.20096463em; -} -.katex .sizing.reset-size11.size2, -.katex .fontsize-ensurer.reset-size11.size2 { - font-size: 0.24115756em; -} -.katex .sizing.reset-size11.size3, -.katex .fontsize-ensurer.reset-size11.size3 { - font-size: 0.28135048em; -} -.katex .sizing.reset-size11.size4, -.katex .fontsize-ensurer.reset-size11.size4 { - font-size: 0.32154341em; -} -.katex .sizing.reset-size11.size5, -.katex .fontsize-ensurer.reset-size11.size5 { - font-size: 0.36173633em; -} -.katex .sizing.reset-size11.size6, -.katex .fontsize-ensurer.reset-size11.size6 { - font-size: 0.40192926em; -} -.katex .sizing.reset-size11.size7, -.katex .fontsize-ensurer.reset-size11.size7 { - font-size: 0.48231511em; -} -.katex .sizing.reset-size11.size8, -.katex .fontsize-ensurer.reset-size11.size8 { - font-size: 0.57877814em; -} -.katex .sizing.reset-size11.size9, -.katex .fontsize-ensurer.reset-size11.size9 { - font-size: 0.69453376em; -} -.katex .sizing.reset-size11.size10, -.katex .fontsize-ensurer.reset-size11.size10 { - font-size: 0.83360129em; -} -.katex .sizing.reset-size11.size11, -.katex .fontsize-ensurer.reset-size11.size11 { - font-size: 1em; -} -.katex .delimsizing.size1 { - font-family: KaTeX_Size1; -} -.katex .delimsizing.size2 { - font-family: KaTeX_Size2; -} -.katex .delimsizing.size3 { - font-family: KaTeX_Size3; -} -.katex .delimsizing.size4 { - font-family: KaTeX_Size4; -} -.katex .delimsizing.mult .delim-size1 > span { - font-family: KaTeX_Size1; -} -.katex .delimsizing.mult .delim-size4 > span { - font-family: KaTeX_Size4; -} -.katex .nulldelimiter { - display: inline-block; - width: 0.12em; -} -.katex .delimcenter { - position: relative; -} -.katex .op-symbol { - position: relative; -} -.katex .op-symbol.small-op { - font-family: KaTeX_Size1; -} -.katex .op-symbol.large-op { - font-family: KaTeX_Size2; -} -.katex .op-limits > .vlist-t { - text-align: center; -} -.katex .accent > .vlist-t { - text-align: center; -} -.katex .accent .accent-body > span { - width: 0; -} -.katex .accent .accent-body.accent-vec > span { - position: relative; - left: 0.326em; -} -.katex .accent .accent-body.accent-hungarian > span { - position: relative; - left: 0.250em; -} -.katex .mtable .vertical-separator { - display: inline-block; - margin: 0 -0.025em; - width: 0.05em; -} -@media screen { - .katex .mtable .vertical-separator { - min-width: 1px; - } -} -@media screen and (-webkit-min-device-pixel-ratio: 2), screen and (min-resolution: 192dpi) { - .katex .mtable .vertical-separator { - min-width: 0.5px; - } -} -.katex .mtable .arraycolsep { - display: inline-block; -} -.katex .mtable .col-align-c > .vlist-t { - text-align: center; -} -.katex .mtable .col-align-l > .vlist-t { - text-align: left; -} -.katex .mtable .col-align-r > .vlist-t { - text-align: right; -} -.katex .svg-align { - text-align: left; -} -.katex svg { - display: block; - position: absolute; - width: 100%; -} -.katex svg path { - fill: currentColor; -} -.katex svg line { - stroke: currentColor; -} -.katex .stretchy { - width: 100%; - display: block; -} -.katex .stretchy:before, -.katex .stretchy:after { - content: ""; -} -.katex .hide-tail { - width: 100%; - position: relative; - overflow: hidden; -} -.katex .halfarrow-left { - position: absolute; - left: 0; - width: 50.1%; - overflow: hidden; -} -.katex .halfarrow-right { - position: absolute; - right: 0; - width: 50%; - overflow: hidden; -} -.katex .brace-left { - position: absolute; - left: 0; - width: 25.1%; - overflow: hidden; -} -.katex .brace-center { - position: absolute; - left: 25%; - width: 50%; - overflow: hidden; -} -.katex .brace-right { - position: absolute; - right: 0; - width: 25.1%; - overflow: hidden; -} -.katex .x-arrow-pad { - padding: 0 0.5em; -} -.katex .x-arrow, -.katex .mover, -.katex .munder { - text-align: center; -} -.katex .boxpad { - padding: 0 0.3em 0 0.3em; -} -.katex .fbox { - box-sizing: border-box; - border: 0.04em solid black; -} -.katex .fcolorbox { - box-sizing: border-box; - border: 0.04em solid; -} -.katex .cancel-pad { - padding: 0 0.2em 0 0.2em; -} -.katex .mord + .cancel-lap, -.katex .mbin + .cancel-lap { - margin-left: -0.2em; -} -.katex .cancel-lap + .mord, -.katex .cancel-lap + .mbin, -.katex .cancel-lap + .msupsub { - margin-left: -0.2em; -} -.katex .sout { - border-bottom-style: solid; - border-bottom-width: 0.08em; -} diff --git a/yarn.lock b/yarn.lock index 26d1e703390..a771909b9a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6077,6 +6077,13 @@ strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" +style-loader@^0.19.1: + version "0.19.1" + resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.19.1.tgz#591ffc80bcefe268b77c5d9ebc0505d772619f85" + dependencies: + loader-utils "^1.0.2" + schema-utils "^0.3.0" + supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -- cgit v1.2.1 From 78bfced3ff33ee94c5c0bfc21bb2c5a356e08396 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Wed, 20 Dec 2017 18:01:12 -0600 Subject: Removed the katex precompile steps from the application configuration --- config/application.rb | 2 -- lib/gitlab/gon_helper.rb | 1 - 2 files changed, 3 deletions(-) diff --git a/config/application.rb b/config/application.rb index 1110199b888..336c6d2405c 100644 --- a/config/application.rb +++ b/config/application.rb @@ -103,8 +103,6 @@ module Gitlab config.assets.precompile << "print.css" config.assets.precompile << "notify.css" config.assets.precompile << "mailers/*.css" - config.assets.precompile << "katex.css" - config.assets.precompile << "katex.js" config.assets.precompile << "xterm/xterm.css" config.assets.precompile << "performance_bar.css" config.assets.precompile << "lib/ace.js" diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index f91be9a7142..1fe076cf909 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -14,7 +14,6 @@ module Gitlab gon.relative_url_root = Gitlab.config.gitlab.relative_url_root gon.shortcuts_path = help_page_path('shortcuts') gon.user_color_scheme = Gitlab::ColorSchemes.for_user(current_user).css_class - gon.katex_css_url = ActionController::Base.helpers.asset_path('katex.css') gon.sentry_dsn = current_application_settings.clientside_sentry_dsn if current_application_settings.clientside_sentry_enabled gon.gitlab_url = Gitlab.config.gitlab.url gon.revision = Gitlab::REVISION -- cgit v1.2.1 From e6016d0bc2b640801914369e25e1a3639d3e50eb Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Wed, 20 Dec 2017 18:15:12 -0600 Subject: removed unused imports --- app/assets/javascripts/render_math.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/assets/javascripts/render_math.js b/app/assets/javascripts/render_math.js index 341fb842cbe..7518ed69cdf 100644 --- a/app/assets/javascripts/render_math.js +++ b/app/assets/javascripts/render_math.js @@ -1,5 +1,3 @@ -// import katex from 'katex'; -// import katexCSS from 'katex/dist/katex.css'; import Flash from './flash'; // Renders math using KaTeX in any element with the -- cgit v1.2.1 From 18fa0c91cec0e3c185eeb3358e5b25f160e4de05 Mon Sep 17 00:00:00 2001 From: Takuya Noguchi Date: Wed, 24 Jan 2018 01:12:06 +0900 Subject: Reduce Spinach parallelization to 2 nodes and increase RSpec's to 28 nodes --- .gitlab-ci.yml | 126 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be18520b876..2744c7001f9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -323,69 +323,69 @@ setup-test-env: - tmp/tests - config/secrets.yml -rspec-pg 0 27: *rspec-metadata-pg -rspec-pg 1 27: *rspec-metadata-pg -rspec-pg 2 27: *rspec-metadata-pg -rspec-pg 3 27: *rspec-metadata-pg -rspec-pg 4 27: *rspec-metadata-pg -rspec-pg 5 27: *rspec-metadata-pg -rspec-pg 6 27: *rspec-metadata-pg -rspec-pg 7 27: *rspec-metadata-pg -rspec-pg 8 27: *rspec-metadata-pg -rspec-pg 9 27: *rspec-metadata-pg -rspec-pg 10 27: *rspec-metadata-pg -rspec-pg 11 27: *rspec-metadata-pg -rspec-pg 12 27: *rspec-metadata-pg -rspec-pg 13 27: *rspec-metadata-pg -rspec-pg 14 27: *rspec-metadata-pg -rspec-pg 15 27: *rspec-metadata-pg -rspec-pg 16 27: *rspec-metadata-pg -rspec-pg 17 27: *rspec-metadata-pg -rspec-pg 18 27: *rspec-metadata-pg -rspec-pg 19 27: *rspec-metadata-pg -rspec-pg 20 27: *rspec-metadata-pg -rspec-pg 21 27: *rspec-metadata-pg -rspec-pg 22 27: *rspec-metadata-pg -rspec-pg 23 27: *rspec-metadata-pg -rspec-pg 24 27: *rspec-metadata-pg -rspec-pg 25 27: *rspec-metadata-pg -rspec-pg 26 27: *rspec-metadata-pg - -rspec-mysql 0 27: *rspec-metadata-mysql -rspec-mysql 1 27: *rspec-metadata-mysql -rspec-mysql 2 27: *rspec-metadata-mysql -rspec-mysql 3 27: *rspec-metadata-mysql -rspec-mysql 4 27: *rspec-metadata-mysql -rspec-mysql 5 27: *rspec-metadata-mysql -rspec-mysql 6 27: *rspec-metadata-mysql -rspec-mysql 7 27: *rspec-metadata-mysql -rspec-mysql 8 27: *rspec-metadata-mysql -rspec-mysql 9 27: *rspec-metadata-mysql -rspec-mysql 10 27: *rspec-metadata-mysql -rspec-mysql 11 27: *rspec-metadata-mysql -rspec-mysql 12 27: *rspec-metadata-mysql -rspec-mysql 13 27: *rspec-metadata-mysql -rspec-mysql 14 27: *rspec-metadata-mysql -rspec-mysql 15 27: *rspec-metadata-mysql -rspec-mysql 16 27: *rspec-metadata-mysql -rspec-mysql 17 27: *rspec-metadata-mysql -rspec-mysql 18 27: *rspec-metadata-mysql -rspec-mysql 19 27: *rspec-metadata-mysql -rspec-mysql 20 27: *rspec-metadata-mysql -rspec-mysql 21 27: *rspec-metadata-mysql -rspec-mysql 22 27: *rspec-metadata-mysql -rspec-mysql 23 27: *rspec-metadata-mysql -rspec-mysql 24 27: *rspec-metadata-mysql -rspec-mysql 25 27: *rspec-metadata-mysql -rspec-mysql 26 27: *rspec-metadata-mysql - -spinach-pg 0 3: *spinach-metadata-pg -spinach-pg 1 3: *spinach-metadata-pg -spinach-pg 2 3: *spinach-metadata-pg - -spinach-mysql 0 3: *spinach-metadata-mysql -spinach-mysql 1 3: *spinach-metadata-mysql -spinach-mysql 2 3: *spinach-metadata-mysql +rspec-pg 0 28: *rspec-metadata-pg +rspec-pg 1 28: *rspec-metadata-pg +rspec-pg 2 28: *rspec-metadata-pg +rspec-pg 3 28: *rspec-metadata-pg +rspec-pg 4 28: *rspec-metadata-pg +rspec-pg 5 28: *rspec-metadata-pg +rspec-pg 6 28: *rspec-metadata-pg +rspec-pg 7 28: *rspec-metadata-pg +rspec-pg 8 28: *rspec-metadata-pg +rspec-pg 9 28: *rspec-metadata-pg +rspec-pg 10 28: *rspec-metadata-pg +rspec-pg 11 28: *rspec-metadata-pg +rspec-pg 12 28: *rspec-metadata-pg +rspec-pg 13 28: *rspec-metadata-pg +rspec-pg 14 28: *rspec-metadata-pg +rspec-pg 15 28: *rspec-metadata-pg +rspec-pg 16 28: *rspec-metadata-pg +rspec-pg 17 28: *rspec-metadata-pg +rspec-pg 18 28: *rspec-metadata-pg +rspec-pg 19 28: *rspec-metadata-pg +rspec-pg 20 28: *rspec-metadata-pg +rspec-pg 21 28: *rspec-metadata-pg +rspec-pg 22 28: *rspec-metadata-pg +rspec-pg 23 28: *rspec-metadata-pg +rspec-pg 24 28: *rspec-metadata-pg +rspec-pg 25 28: *rspec-metadata-pg +rspec-pg 26 28: *rspec-metadata-pg +rspec-pg 27 28: *rspec-metadata-pg + +rspec-mysql 0 28: *rspec-metadata-mysql +rspec-mysql 1 28: *rspec-metadata-mysql +rspec-mysql 2 28: *rspec-metadata-mysql +rspec-mysql 3 28: *rspec-metadata-mysql +rspec-mysql 4 28: *rspec-metadata-mysql +rspec-mysql 5 28: *rspec-metadata-mysql +rspec-mysql 6 28: *rspec-metadata-mysql +rspec-mysql 7 28: *rspec-metadata-mysql +rspec-mysql 8 28: *rspec-metadata-mysql +rspec-mysql 9 28: *rspec-metadata-mysql +rspec-mysql 10 28: *rspec-metadata-mysql +rspec-mysql 11 28: *rspec-metadata-mysql +rspec-mysql 12 28: *rspec-metadata-mysql +rspec-mysql 13 28: *rspec-metadata-mysql +rspec-mysql 14 28: *rspec-metadata-mysql +rspec-mysql 15 28: *rspec-metadata-mysql +rspec-mysql 16 28: *rspec-metadata-mysql +rspec-mysql 17 28: *rspec-metadata-mysql +rspec-mysql 18 28: *rspec-metadata-mysql +rspec-mysql 19 28: *rspec-metadata-mysql +rspec-mysql 20 28: *rspec-metadata-mysql +rspec-mysql 21 28: *rspec-metadata-mysql +rspec-mysql 22 28: *rspec-metadata-mysql +rspec-mysql 23 28: *rspec-metadata-mysql +rspec-mysql 24 28: *rspec-metadata-mysql +rspec-mysql 25 28: *rspec-metadata-mysql +rspec-mysql 26 28: *rspec-metadata-mysql +rspec-mysql 27 28: *rspec-metadata-mysql + +spinach-pg 0 2: *spinach-metadata-pg +spinach-pg 1 2: *spinach-metadata-pg + +spinach-mysql 0 2: *spinach-metadata-mysql +spinach-mysql 1 2: *spinach-metadata-mysql # Static analysis jobs .ruby-static-analysis: &ruby-static-analysis -- cgit v1.2.1 From 8e0573efa176cb4cdfc3c82d887d286b6e9c8033 Mon Sep 17 00:00:00 2001 From: Marcia Ramos Date: Wed, 31 Jan 2018 17:49:36 -0200 Subject: un-index old blog post from doc, add the important content from the post to the docs --- .../project/pages/getting_started_part_three.md | 33 +++++++++++++++++++--- doc/user/project/pages/index.md | 1 - 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/doc/user/project/pages/getting_started_part_three.md b/doc/user/project/pages/getting_started_part_three.md index 0096f8507d2..4daa826d211 100644 --- a/doc/user/project/pages/getting_started_part_three.md +++ b/doc/user/project/pages/getting_started_part_three.md @@ -155,15 +155,40 @@ Certificates are NOT required to add to your custom (sub)domain on your GitLab Pages project, though they are highly recommendable. -The importance of having any website securely served under HTTPS -is explained on the introductory section of the blog post -[Secure GitLab Pages with StartSSL](https://about.gitlab.com/2016/06/24/secure-gitlab-pages-with-startssl/#https-a-quick-overview). +Let's start with an introduction to the importance of HTTPS. +Alternatively, jump ahead to [adding certificates to your project](#adding-certificates-to-your-project). -The reason why certificates are so important is that they encrypt +#### Why should I care about HTTPS? + +This might be your first question. If our sites are hosted by GitLab Pages, +they are static, hence we are not dealing with server-side scripts +nor credit card transactions, then why do we need secure connections? + +Back in the 1990s, where HTTPS came out, [SSL](https://en.wikipedia.org/wiki/Transport_Layer_Security#SSL_1.0.2C_2.0_and_3.0) was considered a "special" +security measure, necessary just for big companies, like banks and shoppings sites +with financial transactions. +Now we have a different picture. [According to Josh Aas](https://letsencrypt.org/2015/10/29/phishing-and-malware.html), Executive Director at [ISRG](https://en.wikipedia.org/wiki/Internet_Security_Research_Group): + +> _We’ve since come to realize that HTTPS is important for almost all websites. It’s important for any website that allows people to log in with a password, any website that [tracks its users](https://www.washingtonpost.com/news/the-switch/wp/2013/12/10/nsa-uses-google-cookies-to-pinpoint-targets-for-hacking/) in any way, any website that [doesn’t want its content altered](http://arstechnica.com/tech-policy/2014/09/why-comcasts-javascript-ad-injections-threaten-security-net-neutrality/), and for any site that offers content people might not want others to know they are consuming. We’ve also learned that any site not secured by HTTPS [can be used to attack other sites](http://krebsonsecurity.com/2015/04/dont-be-fodder-for-chinas-great-cannon/)._ + +Therefore, the reason why certificates are so important is that they encrypt the connection between the **client** (you, me, your visitors) and the **server** (where you site lives), through a keychain of authentications and validations. +How about taking Josh's advice and protecting our sites too? We will be +well supported, and we'll contribute to a safer internet. + +#### Organizations supporting HTTPS + +There is a huge movement in favor of securing all the web. W3C fully +[supports the cause](https://w3ctag.github.io/web-https/) and explains very well +the reasons for that. Richard Barnes, a writer for Mozilla Security Blog, +suggested that [Firefox would deprecate HTTP](https://blog.mozilla.org/security/2015/04/30/deprecating-non-secure-http/), +and would no longer accept unsecured connections. Recently, Mozilla published a +[communicate](https://blog.mozilla.org/security/2016/03/29/march-2016-ca-communication/) +reiterating the importance of HTTPS. + ### Issuing Certificates GitLab Pages accepts [PEM](https://support.quovadisglobal.com/kb/a37/what-is-pem-format.aspx) certificates issued by diff --git a/doc/user/project/pages/index.md b/doc/user/project/pages/index.md index 8404d789de6..df245710940 100644 --- a/doc/user/project/pages/index.md +++ b/doc/user/project/pages/index.md @@ -54,7 +54,6 @@ _Blog posts for securing GitLab Pages custom domains with SSL/TLS certificates:_ - [CloudFlare](https://about.gitlab.com/2017/02/07/setting-up-gitlab-pages-with-cloudflare-certificates/) - [Let's Encrypt](https://about.gitlab.com/2016/04/11/tutorial-securing-your-gitlab-pages-with-tls-and-letsencrypt/) (outdated) -- [StartSSL](https://about.gitlab.com/2016/06/24/secure-gitlab-pages-with-startssl/) (deprecated) ## Advanced use -- cgit v1.2.1 From 9d4324e72972f364e9dd15307e4faf16f9ff259b Mon Sep 17 00:00:00 2001 From: morph027 Date: Fri, 2 Feb 2018 10:47:33 +0000 Subject: Added PlantUML server using docker --- doc/administration/integration/plantuml.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/administration/integration/plantuml.md b/doc/administration/integration/plantuml.md index 65f59b72690..d978d1dca53 100644 --- a/doc/administration/integration/plantuml.md +++ b/doc/administration/integration/plantuml.md @@ -9,7 +9,19 @@ created in snippets, wikis, and repos. ## PlantUML Server Before you can enable PlantUML in GitLab; you need to set up your own PlantUML -server that will generate the diagrams. Installing and configuring your +server that will generate the diagrams. + +### Docker + +With Docker, you can just run a container like this: + +`docker run -d --name plantuml -p 8080:8080 plantuml/plantuml-server:tomcat` + +The **PlantUML URL** will be the hostname of the server running the container. + +### Debian/Ubuntu + +Installing and configuring your own PlantUML server is easy in Debian/Ubuntu distributions using Tomcat. First you need to create a `plantuml.war` file from the source code: -- cgit v1.2.1 From 2f20c064605d8afab76d2458137bd7dfc42da71b Mon Sep 17 00:00:00 2001 From: Ann Lette Date: Sun, 4 Feb 2018 20:34:01 +0000 Subject: Update index.md with minor grammatical edit --- doc/user/project/repository/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/project/repository/index.md b/doc/user/project/repository/index.md index 9501db88f57..26f28ba36e9 100644 --- a/doc/user/project/repository/index.md +++ b/doc/user/project/repository/index.md @@ -18,7 +18,7 @@ documentation. > **Important:** For security reasons, when using the command line, we strongly recommend -you to [connect with GitLab via SSH](../../../ssh/README.md). +that you [connect with GitLab via SSH](../../../ssh/README.md). ## Files -- cgit v1.2.1 From 7609d0609e5b0fd9c9c80f3b753024df9099aed6 Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Sun, 4 Feb 2018 20:44:01 -0200 Subject: Add blurb about changing MRs to WIP through commits --- doc/user/project/merge_requests/work_in_progress_merge_requests.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/user/project/merge_requests/work_in_progress_merge_requests.md b/doc/user/project/merge_requests/work_in_progress_merge_requests.md index 546c8bdc5e5..f01da06fa6e 100644 --- a/doc/user/project/merge_requests/work_in_progress_merge_requests.md +++ b/doc/user/project/merge_requests/work_in_progress_merge_requests.md @@ -7,7 +7,8 @@ have been marked a **Work In Progress**. ![Blocked Accept Button](img/wip_blocked_accept_button.png) To mark a merge request a Work In Progress, simply start its title with `[WIP]` -or `WIP:`. +or `WIP:`. As an alternative, you're also able to do it by sending a commit +with its title starting with `wip` or `WIP` to the merge request's source branch. ![Mark as WIP](img/wip_mark_as_wip.png) -- cgit v1.2.1 From 1264e2b6e8ce53f578255e9296875947845431bf Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 2 Feb 2018 00:35:33 +0800 Subject: WIP --- qa/qa.rb | 4 ++ qa/qa/factory/resource/pipeline.rb | 8 +++ qa/qa/factory/resource/runner.rb | 17 ++++- qa/qa/page/project/job/show.rb | 11 +++ qa/qa/page/project/pipeline/index.rb | 6 ++ qa/qa/page/project/pipeline/show.rb | 10 +++ qa/qa/page/project/show.rb | 29 +++++--- qa/qa/runtime/rsa_key.rb | 2 +- qa/qa/service/runner.rb | 26 +++++-- .../features/cicd/pull_with_deploy_key_spec.rb | 83 ++++++++++++++++++++++ 10 files changed, 181 insertions(+), 15 deletions(-) create mode 100644 qa/qa/factory/resource/pipeline.rb create mode 100644 qa/qa/page/project/job/show.rb create mode 100644 qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb diff --git a/qa/qa.rb b/qa/qa.rb index 8630e2a522c..b5536a449f1 100644 --- a/qa/qa.rb +++ b/qa/qa.rb @@ -116,6 +116,10 @@ module QA autoload :Show, 'qa/page/project/pipeline/show' end + module Job + autoload :Show, 'qa/page/project/job/show' + end + module Settings autoload :Common, 'qa/page/project/settings/common' autoload :Advanced, 'qa/page/project/settings/advanced' diff --git a/qa/qa/factory/resource/pipeline.rb b/qa/qa/factory/resource/pipeline.rb new file mode 100644 index 00000000000..d3f1586ec5e --- /dev/null +++ b/qa/qa/factory/resource/pipeline.rb @@ -0,0 +1,8 @@ +module QA + module Factory + module Resource + class Pipeline < Factory::Base + end + end + end +end diff --git a/qa/qa/factory/resource/runner.rb b/qa/qa/factory/resource/runner.rb index 5f37f8ac2e9..da0f4b8f520 100644 --- a/qa/qa/factory/resource/runner.rb +++ b/qa/qa/factory/resource/runner.rb @@ -4,7 +4,7 @@ module QA module Factory module Resource class Runner < Factory::Base - attr_writer :name, :tags + attr_writer :name, :tags, :image, :executor, :docker_image dependency Factory::Resource::Project, as: :project do |project| project.name = 'project-with-ci-cd' @@ -19,6 +19,18 @@ module QA @tags || %w[qa e2e] end + def image + @image || 'gitlab/gitlab-runner:alpine' + end + + def executor + @executor || 'shell' + end + + def docker_image + @docker_image || 'ubuntu/16.04' + end + def fabricate! project.visit! @@ -31,6 +43,9 @@ module QA runner.token = runners.registration_token runner.address = runners.coordinator_address runner.tags = tags + runner.image = image + runner.executor = executor + runner.docker_image = docker_image runner.register! end end diff --git a/qa/qa/page/project/job/show.rb b/qa/qa/page/project/job/show.rb new file mode 100644 index 00000000000..9be14812736 --- /dev/null +++ b/qa/qa/page/project/job/show.rb @@ -0,0 +1,11 @@ +module QA::Page + module Project::Job + class Show < QA::Page::Base + def output + css = '.js-build-output' + wait { has_css?(css) } + find(css).text + end + end + end +end diff --git a/qa/qa/page/project/pipeline/index.rb b/qa/qa/page/project/pipeline/index.rb index 32c108393b9..9dd65aea217 100644 --- a/qa/qa/page/project/pipeline/index.rb +++ b/qa/qa/page/project/pipeline/index.rb @@ -8,6 +8,12 @@ module QA::Page def go_to_latest_pipeline first('.js-pipeline-url-link').click end + + def wait_for_latest_pipeline + wait do + first('.js-pipeline-url-link') + end + end end end end diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index 0835173f1cd..80f8924e42c 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -30,6 +30,16 @@ module QA::Page end end end + + def go_to_first_job + css = '.js-pipeline-graph-job-link' + + wait do + has_css?(css) + end + + first(css).click + end end end end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 553d35f9579..e8b26900460 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -23,16 +23,11 @@ module QA end def choose_repository_clone_http - wait(reload: false) do - click_element :clone_dropdown - - page.within('.clone-options-dropdown') do - click_link('HTTP') - end + choose_repository_clone('HTTP') + end - # Ensure git clone textbox was updated to http URI - page.has_css?('.git-clone-holder input#project_clone[value*="http"]') - end + def choose_repository_clone_ssh + choose_repository_clone('SSH') end def repository_location @@ -57,6 +52,22 @@ module QA click_link 'New issue' end + + private + + def choose_repository_clone(kind) + wait(reload: false) do + click_element :clone_dropdown + + page.within('.clone-options-dropdown') do + click_link(kind) + end + + # Ensure git clone textbox was updated to http URI + page.has_css?( + %Q{.git-clone-holder input#project_clone[value*="#{kind}"]}) + end + end end end end diff --git a/qa/qa/runtime/rsa_key.rb b/qa/qa/runtime/rsa_key.rb index d456062bce7..fcd7dcc4f02 100644 --- a/qa/qa/runtime/rsa_key.rb +++ b/qa/qa/runtime/rsa_key.rb @@ -7,7 +7,7 @@ module QA extend Forwardable attr_reader :key - def_delegators :@key, :fingerprint + def_delegators :@key, :fingerprint, :to_pem def initialize(bits = 4096) @key = OpenSSL::PKey::RSA.new(bits) diff --git a/qa/qa/service/runner.rb b/qa/qa/service/runner.rb index d0ee33c69f2..f08507c8a4c 100644 --- a/qa/qa/service/runner.rb +++ b/qa/qa/service/runner.rb @@ -6,13 +6,15 @@ module QA include Scenario::Actable include Service::Shellout - attr_accessor :token, :address, :tags, :image + attr_accessor :token, :address, :tags, :image, :executor, :docker_image def initialize(name) - @image = 'gitlab/gitlab-runner:alpine' @name = name || "qa-runner-#{SecureRandom.hex(4)}" @network = Runtime::Scenario.attributes[:network] || 'test' @tags = %w[qa test] + @image = 'gitlab/gitlab-runner:alpine' + @executor = 'shell' + @docker_image = 'ubuntu/16.04' end def pull @@ -26,16 +28,32 @@ module QA -e CI_SERVER_URL=#{@address} -e REGISTER_NON_INTERACTIVE=true -e REGISTRATION_TOKEN=#{@token} - -e RUNNER_EXECUTOR=shell + -e RUNNER_EXECUTOR=#{@executor} + -e DOCKER_IMAGE=#{@docker_image} -e RUNNER_TAG_LIST=#{@tags.join(',')} -e RUNNER_NAME=#{@name} - #{@image} -c 'gitlab-runner register && gitlab-runner run' + #{@image} -c '#{docker_commands}' CMD end def remove! shell "docker rm -f #{@name}" end + + private + + def docker_commands + commands = [ + 'gitlab-runner register', + 'gitlab-runner run' + ] + + if @executor == 'docker' + commands.unshift('apt-get install -y docker-ce') + end + + commands.join(' && ') + end end end end diff --git a/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb b/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb new file mode 100644 index 00000000000..a0761aab97d --- /dev/null +++ b/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb @@ -0,0 +1,83 @@ +module QA + feature 'pull codes with a deploy key', :core, :docker do + let(:runner_name) { "qa-runner-#{Time.now.to_i}" } + + after do + Service::Runner.new(runner_name).remove! + end + + scenario 'user pushes .gitlab-ci.yml to the repository' do + Runtime::Browser.visit(:gitlab, Page::Main::Login) + Page::Main::Login.act { sign_in_using_credentials } + + project = Factory::Resource::Project.fabricate! do |resource| + resource.name = 'cicd-pull-with-deploy-key' + end + + Factory::Resource::Runner.fabricate! do |runner| + runner.project = project + runner.name = runner_name + runner.tags = %w[qa docker] + runner.executor = 'shell' + runner.image = 'gitlab/gitlab-runner:ubuntu' + end + + key = Runtime::RSAKey.new + + Factory::Resource::DeployKey.fabricate! do |resource| + resource.project = project + resource.title = 'deploy key title' + resource.key = key.public_key + end + + Factory::Resource::SecretVariable.fabricate! do |resource| + resource.project = project + resource.key = 'DEPLOY_KEY' + resource.value = key.to_pem + end + + project.visit! + + repository_url = Page::Project::Show.act do + choose_repository_clone_ssh + repository_location + end + + gitlab_ci = + <<~YAML + cat-config: + script: + - eval $(ssh-agent -s) + - echo "$DEPLOY_KEY" | tr -d '\\r' | ssh-add - > /dev/null + - git clone #{repository_url} + - cat #{project.name}/.gitlab-ci.yml + tags: + - qa + - docker + YAML + + Factory::Repository::Push.fabricate! do |push| + push.project = project + push.file_name = '.gitlab-ci.yml' + push.commit_message = 'Add .gitlab-ci.yml' + push.file_content = gitlab_ci + end + + Page::Project::Show.act { wait_for_push } + Page::Menu::Side.act { click_ci_cd_pipelines } + + Page::Project::Pipeline::Index.act do + wait_for_latest_pipeline + go_to_latest_pipeline + end + + Page::Project::Pipeline::Show.act do + go_to_first_job + end + + Page::Project::Job::Show.perform do |job| + expect(job.output).to include(gitlab_ci.tr("\n", ' ')) + end + end + end +end -- cgit v1.2.1 From ebe205abc98874afa3300001fedb4cfd156517ac Mon Sep 17 00:00:00 2001 From: Olivier Gonzalez Date: Tue, 6 Feb 2018 20:12:11 +0000 Subject: Add the missing "Security Products" Team label and sort them alphabetically --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ed56da0353d..dfe4bf65f9f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -174,7 +174,7 @@ Assigning a team label makes sure issues get the attention of the appropriate people. The current team labels are ~Build, ~"CI/CD", ~Discussion, ~Documentation, ~Edge, -~Geo, ~Gitaly, ~Platform, ~Monitoring, ~Release, and ~"UX". +~Geo, ~Gitaly, ~Monitoring, ~Platform, ~Release, ~"Security Products" and ~"UX". The descriptions on the [labels page][labels-page] explain what falls under the responsibility of each team. -- cgit v1.2.1 From ffb1fab40395ead740c1c1282cb7b3f518134c3f Mon Sep 17 00:00:00 2001 From: Dylan Griffith Date: Tue, 6 Feb 2018 16:56:04 +1100 Subject: Expose GITLAB_FEATURES as CI/CD variable (fixes #40994) --- app/models/ci/build.rb | 1 + app/models/namespace.rb | 4 ++++ changelogs/unreleased/40994-expose-features-as-ci-cd-variable.yml | 5 +++++ spec/models/ci/build_spec.rb | 1 + 4 files changed, 11 insertions(+) create mode 100644 changelogs/unreleased/40994-expose-features-as-ci-cd-variable.yml diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 20534b8eed0..ee987949080 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -543,6 +543,7 @@ module Ci variables = [ { key: 'CI', value: 'true', public: true }, { key: 'GITLAB_CI', value: 'true', public: true }, + { key: 'GITLAB_FEATURES', value: project.namespace.features.join(','), public: true }, { key: 'CI_SERVER_NAME', value: 'GitLab', public: true }, { key: 'CI_SERVER_VERSION', value: Gitlab::VERSION, public: true }, { key: 'CI_SERVER_REVISION', value: Gitlab::REVISION, public: true }, diff --git a/app/models/namespace.rb b/app/models/namespace.rb index d95489ee9f2..db274ea8172 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -243,6 +243,10 @@ class Namespace < ActiveRecord::Base all_projects.with_storage_feature(:repository).find_each(&:remove_exports) end + def features + [] + end + private def path_or_parent_changed? diff --git a/changelogs/unreleased/40994-expose-features-as-ci-cd-variable.yml b/changelogs/unreleased/40994-expose-features-as-ci-cd-variable.yml new file mode 100644 index 00000000000..1e377094791 --- /dev/null +++ b/changelogs/unreleased/40994-expose-features-as-ci-cd-variable.yml @@ -0,0 +1,5 @@ +--- +title: 'Expose GITLAB_FEATURES as CI/CD variable (fixes #40994)' +merge_request: +author: +type: added diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 0b3d5c6a0bd..9e159c3f1fe 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1413,6 +1413,7 @@ describe Ci::Build do [ { key: 'CI', value: 'true', public: true }, { key: 'GITLAB_CI', value: 'true', public: true }, + { key: 'GITLAB_FEATURES', value: '', public: true }, { key: 'CI_SERVER_NAME', value: 'GitLab', public: true }, { key: 'CI_SERVER_VERSION', value: Gitlab::VERSION, public: true }, { key: 'CI_SERVER_REVISION', value: Gitlab::REVISION, public: true }, -- cgit v1.2.1 From 73bc9d4eaf8f41532b07a61f5f05d67d6ff78e61 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Wed, 7 Feb 2018 12:29:05 +0100 Subject: Don't allow N +1 calls from Root#show --- app/controllers/root_controller.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 8acefd58e77..63e5fdb1da5 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -13,10 +13,7 @@ class RootController < Dashboard::ProjectsController before_action :redirect_logged_user, if: -> { current_user.present? } def index - # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37434 - Gitlab::GitalyClient.allow_n_plus_1_calls do - super - end + super end private -- cgit v1.2.1 From c807a79979fe7c6335c625fcd0eaa9fd5cb900b2 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Wed, 7 Feb 2018 14:24:47 +0100 Subject: Add a note about merge conflicts in `gitlab.pot` --- doc/development/i18n/externalization.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/development/i18n/externalization.md b/doc/development/i18n/externalization.md index f493ad4ae66..695b2dbbfdb 100644 --- a/doc/development/i18n/externalization.md +++ b/doc/development/i18n/externalization.md @@ -124,6 +124,9 @@ strings and remove any strings that aren't used anymore. You should check this file in. Once the changes are on master, they will be picked up by [Crowdin](http://translate.gitlab.com) and be presented for translation. +If there are merge conflicts in the `gitlab.pot` file, you can delete the file +and regenerate it using the same command. Confirm that you are not deleting any strings accidentally by looking over the diff. + The command also updates the translation files for each language: `locale/*/gitlab.po` These changes can be discarded, the languange files will be updated by Crowdin automatically. -- cgit v1.2.1 From 6b0c6e69e1b249f14624550fcbca7f5ee6f51410 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Fri, 1 Dec 2017 13:58:49 +0000 Subject: Use hashed storage in the specs --- lib/api/internal.rb | 2 +- spec/controllers/profiles_controller_spec.rb | 40 +++- spec/controllers/projects_controller_spec.rb | 96 ++++++---- spec/factories/projects.rb | 6 +- .../import_export/namespace_export_file_spec.rb | 6 +- spec/lib/backup/repository_spec.rb | 18 +- .../populate_untracked_uploads_spec.rb | 22 +-- .../prepare_untracked_uploads_spec.rb | 4 +- .../gitlab/bare_repository_import/importer_spec.rb | 6 +- .../v1/rename_namespaces_spec.rb | 14 +- .../v1/rename_projects_spec.rb | 11 +- spec/lib/gitlab/email/attachment_uploader_spec.rb | 2 +- spec/lib/gitlab/gfm/uploads_rewriter_spec.rb | 4 +- .../gitlab/import_export/uploads_restorer_spec.rb | 4 +- .../lib/gitlab/import_export/uploads_saver_spec.rb | 4 +- spec/lib/gitlab/repo_path_spec.rb | 4 +- spec/lib/gitlab/shell_spec.rb | 2 +- spec/lib/gitlab/workhorse_spec.rb | 2 +- .../migrate_process_commit_worker_jobs_spec.rb | 2 +- ...ed_groups_into_regular_groups_for_mysql_spec.rb | 2 +- spec/models/namespace_spec.rb | 206 +++++++++++++-------- spec/models/project_spec.rb | 31 +++- spec/requests/api/internal_spec.rb | 66 +++---- spec/requests/api/projects_spec.rb | 11 +- spec/requests/api/v3/projects_spec.rb | 4 +- spec/requests/git_http_spec.rb | 2 +- spec/services/groups/destroy_service_spec.rb | 6 +- .../migrate_attachments_service_spec.rb | 2 +- .../migrate_repository_service_spec.rb | 2 +- .../hashed_storage_migration_service_spec.rb | 2 +- spec/services/projects/transfer_service_spec.rb | 4 +- spec/services/projects/update_service_spec.rb | 2 + spec/services/users/destroy_service_spec.rb | 4 +- spec/uploaders/file_uploader_spec.rb | 6 +- spec/workers/repository_fork_worker_spec.rb | 2 +- spec/workers/storage_migrator_worker_spec.rb | 2 +- 36 files changed, 349 insertions(+), 254 deletions(-) diff --git a/lib/api/internal.rb b/lib/api/internal.rb index 9285fb90cdc..b3660e4a1d0 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -13,7 +13,7 @@ module API # key_id - ssh key id for Git over SSH # user_id - user id for Git over HTTP # protocol - Git access protocol being used, e.g. HTTP or SSH - # project - project path with namespace + # project - project full_path (not path on disk) # action - git action (git-upload-pack or git-receive-pack) # changes - changes as "oldrev newrev ref", see Gitlab::ChangesList post "/allowed" do diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb index d380978b86e..03cbbb21e62 100644 --- a/spec/controllers/profiles_controller_spec.rb +++ b/spec/controllers/profiles_controller_spec.rb @@ -69,9 +69,8 @@ describe ProfilesController, :request_store do describe 'PUT update_username' do let(:namespace) { user.namespace } - let(:project) { create(:project_empty_repo, namespace: namespace) } let(:gitlab_shell) { Gitlab::Shell.new } - let(:new_username) { 'renamedtosomethingelse' } + let(:new_username) { generate(:username) } it 'allows username change' do sign_in(user) @@ -85,16 +84,39 @@ describe ProfilesController, :request_store do expect(user.username).to eq(new_username) end - it 'moves dependent projects to new namespace' do - sign_in(user) + context 'with legacy storage' do + it 'moves dependent projects to new namespace' do + project = create(:project_empty_repo, :legacy_storage, namespace: namespace) - put :update_username, - user: { username: new_username } + sign_in(user) - user.reload + put :update_username, + user: { username: new_username } - expect(response.status).to eq(302) - expect(gitlab_shell.exists?(project.repository_storage_path, "#{new_username}/#{project.path}.git")).to be_truthy + user.reload + + expect(response.status).to eq(302) + expect(gitlab_shell.exists?(project.repository_storage_path, "#{new_username}/#{project.path}.git")).to be_truthy + end + end + + context 'with hashed storage' do + it 'keeps repository location unchanged on disk' do + project = create(:project_empty_repo, namespace: namespace) + + before_disk_path = project.disk_path + + sign_in(user) + + put :update_username, + user: { username: new_username } + + user.reload + + expect(response.status).to eq(302) + expect(gitlab_shell.exists?(project.repository_storage_path, "#{project.disk_path}.git")).to be_truthy + expect(before_disk_path).to eq(project.disk_path) + end end end end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 5202ffdd8bb..994da3cd159 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -288,62 +288,82 @@ describe ProjectsController do render_views let(:admin) { create(:admin) } - let(:project) { create(:project, :repository) } before do sign_in(admin) end - context 'when only renaming a project path' do - it "sets the repository to the right path after a rename" do - expect { update_project path: 'renamed_path' } - .to change { project.reload.path } + shared_examples_for 'updating a project' do + context 'when only renaming a project path' do + it "sets the repository to the right path after a rename" do + original_repository_path = project.repository.path - expect(project.path).to include 'renamed_path' - expect(assigns(:repository).path).to include project.path - expect(response).to have_gitlab_http_status(302) - end - end + expect { update_project path: 'renamed_path' } + .to change { project.reload.path } + expect(project.path).to include 'renamed_path' - context 'when project has container repositories with tags' do - before do - stub_container_registry_config(enabled: true) - stub_container_registry_tags(repository: /image/, tags: %w[rc1]) - create(:container_repository, project: project, name: :image) + if project.hashed_storage?(:repository) + expect(assigns(:repository).path).to eq(original_repository_path) + else + expect(assigns(:repository).path).to include(project.path) + end + + expect(response).to have_gitlab_http_status(302) + end end - it 'does not allow to rename the project' do - expect { update_project path: 'renamed_path' } - .not_to change { project.reload.path } + context 'when project has container repositories with tags' do + before do + stub_container_registry_config(enabled: true) + stub_container_registry_tags(repository: /image/, tags: %w[rc1]) + create(:container_repository, project: project, name: :image) + end - expect(controller).to set_flash[:alert].to(/container registry tags/) - expect(response).to have_gitlab_http_status(200) + it 'does not allow to rename the project' do + expect { update_project path: 'renamed_path' } + .not_to change { project.reload.path } + + expect(controller).to set_flash[:alert].to(/container registry tags/) + expect(response).to have_gitlab_http_status(200) + end end - end - it 'updates Fast Forward Merge attributes' do - controller.instance_variable_set(:@project, project) + it 'updates Fast Forward Merge attributes' do + controller.instance_variable_set(:@project, project) - params = { - merge_method: :ff - } + params = { + merge_method: :ff + } - put :update, - namespace_id: project.namespace, - id: project.id, - project: params + put :update, + namespace_id: project.namespace, + id: project.id, + project: params - expect(response).to have_gitlab_http_status(302) - params.each do |param, value| - expect(project.public_send(param)).to eq(value) + expect(response).to have_gitlab_http_status(302) + params.each do |param, value| + expect(project.public_send(param)).to eq(value) + end + end + + def update_project(**parameters) + put :update, + namespace_id: project.namespace.path, + id: project.path, + project: parameters end end - def update_project(**parameters) - put :update, - namespace_id: project.namespace.path, - id: project.path, - project: parameters + context 'hashed storage' do + let(:project) { create(:project, :repository) } + + it_behaves_like 'updating a project' + end + + context 'legacy storage' do + let(:project) { create(:project, :repository, :legacy_storage) } + + it_behaves_like 'updating a project' end end diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 20976977f21..b048e9361dc 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -81,8 +81,10 @@ FactoryBot.define do archived true end - trait :hashed do - storage_version Project::LATEST_STORAGE_VERSION + storage_version Project::LATEST_STORAGE_VERSION + + trait :legacy_storage do + storage_version nil end trait :access_requestable do diff --git a/spec/features/projects/import_export/namespace_export_file_spec.rb b/spec/features/projects/import_export/namespace_export_file_spec.rb index c1fccf4a40b..7d056b0c140 100644 --- a/spec/features/projects/import_export/namespace_export_file_spec.rb +++ b/spec/features/projects/import_export/namespace_export_file_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Import/Export - Namespace export file cleanup', :js do +describe 'Import/Export - Namespace export file cleanup', :js do let(:export_path) { Dir.mktmpdir('namespace_export_file_spec') } before do @@ -42,13 +42,13 @@ feature 'Import/Export - Namespace export file cleanup', :js do end describe 'legacy storage' do - let(:project) { create(:project) } + let(:project) { create(:project, :legacy_storage) } it_behaves_like 'handling project exports on namespace change' end describe 'hashed storage' do - let(:project) { create(:project, :hashed) } + let(:project) { create(:project) } it_behaves_like 'handling project exports on namespace change' end diff --git a/spec/lib/backup/repository_spec.rb b/spec/lib/backup/repository_spec.rb index 6ee3d531d6e..f7b1a61f4f8 100644 --- a/spec/lib/backup/repository_spec.rb +++ b/spec/lib/backup/repository_spec.rb @@ -33,10 +33,22 @@ describe Backup::Repository do allow(Gitlab::Popen).to receive(:popen).and_return(['error', 1]) end - it 'shows the appropriate error' do - described_class.new.restore + context 'hashed storage' do + it 'shows the appropriate error' do + described_class.new.restore - expect(progress).to have_received(:puts).with("Ignoring error on #{project.full_path} - error") + expect(progress).to have_received(:puts).with("Ignoring error on #{project.full_path} (#{project.disk_path}) - error") + end + end + + context 'legacy storage' do + let!(:project) { create(:project, :legacy_storage) } + + it 'shows the appropriate error' do + described_class.new.restore + + expect(progress).to have_received(:puts).with("Ignoring error on #{project.full_path} - error") + end end end end diff --git a/spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb b/spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb index be45c00dfe6..8590522f3ef 100644 --- a/spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb +++ b/spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb @@ -23,8 +23,8 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads, :sidekiq do let!(:appearance) { create_or_update_appearance(logo: uploaded_file, header_logo: uploaded_file) } let!(:user1) { create(:user, :with_avatar) } let!(:user2) { create(:user, :with_avatar) } - let!(:project1) { create(:project, :with_avatar) } - let!(:project2) { create(:project, :with_avatar) } + let!(:project1) { create(:project, :legacy_storage, :with_avatar) } + let!(:project2) { create(:project, :legacy_storage, :with_avatar) } before do UploadService.new(project1, uploaded_file, FileUploader).execute # Markdown upload @@ -48,7 +48,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads, :sidekiq do it 'adds untracked files to the uploads table' do expect do - subject.perform(1, untracked_files_for_uploads.last.id) + subject.perform(1, untracked_files_for_uploads.reorder(:id).last.id) end.to change { uploads.count }.from(4).to(8) expect(user2.uploads.count).to eq(1) @@ -213,13 +213,13 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads, :sidekiq do end context 'for a project avatar file path' do - let(:model) { create(:project, :with_avatar) } + let(:model) { create(:project, :legacy_storage, :with_avatar) } it_behaves_like 'non_markdown_file' end context 'for a project Markdown attachment (notes, issues, MR descriptions) file path' do - let(:model) { create(:project) } + let(:model) { create(:project, :legacy_storage) } before do # Upload the file @@ -304,7 +304,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UntrackedFile do context 'for a project Markdown attachment (notes, issues, MR descriptions) file path' do it 'returns the file path relative to the project directory in uploads' do - project = create(:project) + project = create(:project, :legacy_storage) random_hex = SecureRandom.hex assert_upload_path("/#{project.full_path}/#{random_hex}/Some file.jpg", "#{random_hex}/Some file.jpg") @@ -357,7 +357,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UntrackedFile do context 'for a project Markdown attachment (notes, issues, MR descriptions) file path' do it 'returns FileUploader as a string' do - project = create(:project) + project = create(:project, :legacy_storage) assert_uploader("/#{project.full_path}/#{SecureRandom.hex}/Some file.jpg", 'FileUploader') end @@ -409,7 +409,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UntrackedFile do context 'for a project Markdown attachment (notes, issues, MR descriptions) file path' do it 'returns Project as a string' do - project = create(:project) + project = create(:project, :legacy_storage) assert_model_type("/#{project.full_path}/#{SecureRandom.hex}/Some file.jpg", 'Project') end @@ -461,7 +461,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UntrackedFile do context 'for a project Markdown attachment (notes, issues, MR descriptions) file path' do it 'returns the ID as a string' do - project = create(:project) + project = create(:project, :legacy_storage) assert_model_id("/#{project.full_path}/#{SecureRandom.hex}/Some file.jpg", project.id) end @@ -483,7 +483,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UntrackedFile do end context 'for a project avatar file path' do - let(:project) { create(:project, avatar: uploaded_file) } + let(:project) { create(:project, :legacy_storage, avatar: uploaded_file) } let(:untracked_file) { described_class.create!(path: project.uploads.first.path) } it 'returns the file size' do @@ -496,7 +496,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UntrackedFile do end context 'for a project Markdown attachment (notes, issues, MR descriptions) file path' do - let(:project) { create(:project) } + let(:project) { create(:project, :legacy_storage) } let(:untracked_file) { create_untracked_file("/#{project.full_path}/#{project.uploads.first.path}") } before do diff --git a/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb b/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb index 370c2490b97..48204114ae8 100644 --- a/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb +++ b/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb @@ -77,7 +77,7 @@ describe Gitlab::BackgroundMigration::PrepareUntrackedUploads, :sidekiq do context 'when files were uploaded before and after hashed storage was enabled' do let!(:appearance) { create_or_update_appearance(logo: uploaded_file, header_logo: uploaded_file) } let!(:user) { create(:user, :with_avatar) } - let!(:project1) { create(:project, :with_avatar) } + let!(:project1) { create(:project, :with_avatar, :legacy_storage) } let(:project2) { create(:project) } # instantiate after enabling hashed_storage before do @@ -149,7 +149,7 @@ describe Gitlab::BackgroundMigration::PrepareUntrackedUploads, :sidekiq do context 'when files were uploaded before and after hashed storage was enabled' do let!(:appearance) { create_or_update_appearance(logo: uploaded_file, header_logo: uploaded_file) } let!(:user) { create(:user, :with_avatar) } - let!(:project1) { create(:project, :with_avatar) } + let!(:project1) { create(:project, :with_avatar, :legacy_storage) } let(:project2) { create(:project) } # instantiate after enabling hashed_storage before do diff --git a/spec/lib/gitlab/bare_repository_import/importer_spec.rb b/spec/lib/gitlab/bare_repository_import/importer_spec.rb index f302e412a6e..eb4b9d8b12f 100644 --- a/spec/lib/gitlab/bare_repository_import/importer_spec.rb +++ b/spec/lib/gitlab/bare_repository_import/importer_spec.rb @@ -8,11 +8,15 @@ describe Gitlab::BareRepositoryImport::Importer, repository: true do subject(:importer) { described_class.new(admin, bare_repository) } before do + @rainbow = Rainbow.enabled + Rainbow.enabled = false + allow(described_class).to receive(:log) end after do FileUtils.rm_rf(base_dir) + Rainbow.enabled = @rainbow end shared_examples 'importing a repository' do @@ -148,7 +152,7 @@ describe Gitlab::BareRepositoryImport::Importer, repository: true do # This is a quick way to get a valid repository instead of copying an # existing one. Since it's not persisted, the importer will try to # create the project. - project = build(:project, :repository) + project = build(:project, :legacy_storage, :repository) original_commit_count = project.repository.commit_count bare_repo = Gitlab::BareRepositoryImport::Repository.new(project.repository_storage_path, project.repository.path) diff --git a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb index f31475dbd71..b411aaa19da 100644 --- a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb +++ b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb @@ -94,7 +94,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : describe '#move_repositories' do let(:namespace) { create(:group, name: 'hello-group') } it 'moves a project for a namespace' do - create(:project, :repository, namespace: namespace, path: 'hello-project') + create(:project, :repository, :legacy_storage, namespace: namespace, path: 'hello-project') expected_path = File.join(TestEnv.repos_path, 'bye-group', 'hello-project.git') subject.move_repositories(namespace, 'hello-group', 'bye-group') @@ -104,7 +104,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : it 'moves a namespace in a subdirectory correctly' do child_namespace = create(:group, name: 'sub-group', parent: namespace) - create(:project, :repository, namespace: child_namespace, path: 'hello-project') + create(:project, :repository, :legacy_storage, namespace: child_namespace, path: 'hello-project') expected_path = File.join(TestEnv.repos_path, 'hello-group', 'renamed-sub-group', 'hello-project.git') @@ -115,7 +115,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : it 'moves a parent namespace with subdirectories' do child_namespace = create(:group, name: 'sub-group', parent: namespace) - create(:project, :repository, namespace: child_namespace, path: 'hello-project') + create(:project, :repository, :legacy_storage, namespace: child_namespace, path: 'hello-project') expected_path = File.join(TestEnv.repos_path, 'renamed-group', 'sub-group', 'hello-project.git') subject.move_repositories(child_namespace, 'hello-group', 'renamed-group') @@ -166,7 +166,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : describe '#rename_namespace_dependencies' do it "moves the the repository for a project in the namespace" do - create(:project, :repository, namespace: namespace, path: "the-path-project") + create(:project, :repository, :legacy_storage, namespace: namespace, path: "the-path-project") expected_repo = File.join(TestEnv.repos_path, "the-path0", "the-path-project.git") subject.rename_namespace_dependencies(namespace, 'the-path', 'the-path0') @@ -187,7 +187,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : end it 'invalidates the markdown cache of related projects' do - project = create(:project, namespace: namespace, path: "the-path-project") + project = create(:project, :legacy_storage, namespace: namespace, path: "the-path-project") expect(subject).to receive(:remove_cached_html_for_projects).with([project.id]) @@ -243,7 +243,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : describe '#revert_renames', :redis do it 'renames the routes back to the previous values' do - project = create(:project, :repository, path: 'a-project', namespace: namespace) + project = create(:project, :legacy_storage, :repository, path: 'a-project', namespace: namespace) subject.rename_namespace(namespace) expect(subject).to receive(:perform_rename) @@ -261,7 +261,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : end it 'moves the repositories back to their original place' do - project = create(:project, :repository, path: 'a-project', namespace: namespace) + project = create(:project, :repository, :legacy_storage, path: 'a-project', namespace: namespace) project.create_repository subject.rename_namespace(namespace) diff --git a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects_spec.rb b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects_spec.rb index 0958144643b..b4896d69077 100644 --- a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects_spec.rb +++ b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects_spec.rb @@ -5,6 +5,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameProjects, :de let(:subject) { described_class.new(['the-path'], migration) } let(:project) do create(:project, + :legacy_storage, path: 'the-path', namespace: create(:namespace, path: 'known-parent' )) end @@ -17,7 +18,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameProjects, :de describe '#projects_for_paths' do it 'searches using nested paths' do namespace = create(:namespace, path: 'hello') - project = create(:project, path: 'THE-path', namespace: namespace) + project = create(:project, :legacy_storage, path: 'THE-path', namespace: namespace) result_ids = described_class.new(['Hello/the-path'], migration) .projects_for_paths.map(&:id) @@ -26,8 +27,8 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameProjects, :de end it 'includes the correct projects' do - project = create(:project, path: 'THE-path') - _other_project = create(:project) + project = create(:project, :legacy_storage, path: 'THE-path') + _other_project = create(:project, :legacy_storage) result_ids = subject.projects_for_paths.map(&:id) @@ -36,7 +37,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameProjects, :de end describe '#rename_projects' do - let!(:projects) { create_list(:project, 2, path: 'the-path') } + let!(:projects) { create_list(:project, 2, :legacy_storage, path: 'the-path') } it 'renames each project' do expect(subject).to receive(:rename_project).twice @@ -120,7 +121,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameProjects, :de describe '#move_repository' do let(:known_parent) { create(:namespace, path: 'known-parent') } - let(:project) { create(:project, :repository, path: 'the-path', namespace: known_parent) } + let(:project) { create(:project, :repository, :legacy_storage, path: 'the-path', namespace: known_parent) } it 'moves the repository for a project' do expected_path = File.join(TestEnv.repos_path, 'known-parent', 'new-repo.git') diff --git a/spec/lib/gitlab/email/attachment_uploader_spec.rb b/spec/lib/gitlab/email/attachment_uploader_spec.rb index f61dbc67ad1..45c690842bc 100644 --- a/spec/lib/gitlab/email/attachment_uploader_spec.rb +++ b/spec/lib/gitlab/email/attachment_uploader_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" describe Gitlab::Email::AttachmentUploader do describe "#execute" do - let(:project) { build(:project) } + let(:project) { create(:project) } let(:message_raw) { fixture_file("emails/attachment.eml") } let(:message) { Mail::Message.new(message_raw) } diff --git a/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb b/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb index 326ed2f2ecf..13df8531b63 100644 --- a/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb +++ b/spec/lib/gitlab/gfm/uploads_rewriter_spec.rb @@ -39,8 +39,8 @@ describe Gitlab::Gfm::UploadsRewriter do it 'copies files' do expect(new_files).to all(exist) expect(old_paths).not_to match_array new_paths - expect(old_paths).to all(include(old_project.full_path)) - expect(new_paths).to all(include(new_project.full_path)) + expect(old_paths).to all(include(old_project.disk_path)) + expect(new_paths).to all(include(new_project.disk_path)) end it 'does not remove old files' do diff --git a/spec/lib/gitlab/import_export/uploads_restorer_spec.rb b/spec/lib/gitlab/import_export/uploads_restorer_spec.rb index a685521cbf0..8a3a244be21 100644 --- a/spec/lib/gitlab/import_export/uploads_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/uploads_restorer_spec.rb @@ -16,7 +16,7 @@ describe Gitlab::ImportExport::UploadsRestorer do end describe 'legacy storage' do - let(:project) { create(:project) } + let(:project) { create(:project, :legacy_storage) } subject(:restorer) { described_class.new(project: project, shared: shared) } @@ -34,7 +34,7 @@ describe Gitlab::ImportExport::UploadsRestorer do end describe 'hashed storage' do - let(:project) { create(:project, :hashed) } + let(:project) { create(:project) } subject(:restorer) { described_class.new(project: project, shared: shared) } diff --git a/spec/lib/gitlab/import_export/uploads_saver_spec.rb b/spec/lib/gitlab/import_export/uploads_saver_spec.rb index 959779523f4..177036c109b 100644 --- a/spec/lib/gitlab/import_export/uploads_saver_spec.rb +++ b/spec/lib/gitlab/import_export/uploads_saver_spec.rb @@ -15,7 +15,7 @@ describe Gitlab::ImportExport::UploadsSaver do end describe 'legacy storage' do - let(:project) { create(:project) } + let(:project) { create(:project, :legacy_storage) } subject(:saver) { described_class.new(shared: shared, project: project) } @@ -37,7 +37,7 @@ describe Gitlab::ImportExport::UploadsSaver do end describe 'hashed storage' do - let(:project) { create(:project, :hashed) } + let(:project) { create(:project) } subject(:saver) { described_class.new(shared: shared, project: project) } diff --git a/spec/lib/gitlab/repo_path_spec.rb b/spec/lib/gitlab/repo_path_spec.rb index 1a925a15e0c..b67bcc77bd4 100644 --- a/spec/lib/gitlab/repo_path_spec.rb +++ b/spec/lib/gitlab/repo_path_spec.rb @@ -6,11 +6,11 @@ describe ::Gitlab::RepoPath do context 'a repository storage path' do it 'parses a full repository path' do - expect(described_class.parse(project.repository.path)).to eq([project, false, nil]) + expect(described_class.parse(project.repository.full_path)).to eq([project, false, nil]) end it 'parses a full wiki path' do - expect(described_class.parse(project.wiki.repository.path)).to eq([project, true, nil]) + expect(described_class.parse(project.wiki.repository.full_path)).to eq([project, true, nil]) end end diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb index 2b61ce38418..4506cbc3982 100644 --- a/spec/lib/gitlab/shell_spec.rb +++ b/spec/lib/gitlab/shell_spec.rb @@ -443,7 +443,7 @@ describe Gitlab::Shell do end describe '#remove_repository' do - let!(:project) { create(:project, :repository) } + let!(:project) { create(:project, :repository, :legacy_storage) } let(:disk_path) { "#{project.disk_path}.git" } it 'returns true when the command succeeds' do diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb index dc2bb5b9747..37a0bf1ad36 100644 --- a/spec/lib/gitlab/workhorse_spec.rb +++ b/spec/lib/gitlab/workhorse_spec.rb @@ -324,7 +324,7 @@ describe Gitlab::Workhorse do it 'includes a Repository param' do repo_param = { storage_name: 'default', - relative_path: project.full_path + '.git', + relative_path: project.disk_path + '.git', gl_repository: "project-#{project.id}" } diff --git a/spec/migrations/migrate_process_commit_worker_jobs_spec.rb b/spec/migrations/migrate_process_commit_worker_jobs_spec.rb index e5793a3c0ee..657113812bd 100644 --- a/spec/migrations/migrate_process_commit_worker_jobs_spec.rb +++ b/spec/migrations/migrate_process_commit_worker_jobs_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require Rails.root.join('db', 'migrate', '20161124141322_migrate_process_commit_worker_jobs.rb') describe MigrateProcessCommitWorkerJobs do - let(:project) { create(:project, :repository) } + let(:project) { create(:project, :legacy_storage, :repository) } let(:user) { create(:user) } let(:commit) { project.commit.raw.rugged_commit } diff --git a/spec/migrations/turn_nested_groups_into_regular_groups_for_mysql_spec.rb b/spec/migrations/turn_nested_groups_into_regular_groups_for_mysql_spec.rb index 6f7a730edff..528dc54781d 100644 --- a/spec/migrations/turn_nested_groups_into_regular_groups_for_mysql_spec.rb +++ b/spec/migrations/turn_nested_groups_into_regular_groups_for_mysql_spec.rb @@ -4,7 +4,7 @@ require Rails.root.join('db', 'migrate', '20170503140202_turn_nested_groups_into describe TurnNestedGroupsIntoRegularGroupsForMysql do let!(:parent_group) { create(:group) } let!(:child_group) { create(:group, parent: parent_group) } - let!(:project) { create(:project, :empty_repo, namespace: child_group) } + let!(:project) { create(:project, :legacy_storage, :empty_repo, namespace: child_group) } let!(:member) { create(:user) } let(:migration) { described_class.new } diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index 191b60e4383..e626efd054d 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -168,84 +168,105 @@ describe Namespace do end describe '#move_dir', :request_store do - let(:namespace) { create(:namespace) } - let!(:project) { create(:project_empty_repo, namespace: namespace) } + shared_examples "namespace restrictions" do + context "when any project has container images" do + let(:container_repository) { create(:container_repository) } - it "raises error when directory exists" do - expect { namespace.move_dir }.to raise_error("namespace directory cannot be moved") - end + before do + stub_container_registry_config(enabled: true) + stub_container_registry_tags(repository: :any, tags: ['tag']) - it "moves dir if path changed" do - namespace.update_attributes(path: namespace.full_path + '_new') + create(:project, namespace: namespace, container_repositories: [container_repository]) - expect(gitlab_shell.exists?(project.repository_storage_path, "#{namespace.path}/#{project.path}.git")).to be_truthy - end + allow(namespace).to receive(:path_was).and_return(namespace.path) + allow(namespace).to receive(:path).and_return('new_path') + end - context "when any project has container images" do - let(:container_repository) { create(:container_repository) } + it 'raises an error about not movable project' do + expect { namespace.move_dir }.to raise_error(/Namespace cannot be moved/) + end + end + end - before do - stub_container_registry_config(enabled: true) - stub_container_registry_tags(repository: :any, tags: ['tag']) + context 'legacy storage' do + let(:namespace) { create(:namespace) } + let!(:project) { create(:project_empty_repo, :legacy_storage, namespace: namespace) } - create(:project, namespace: namespace, container_repositories: [container_repository]) + it_behaves_like 'namespace restrictions' - allow(namespace).to receive(:path_was).and_return(namespace.path) - allow(namespace).to receive(:path).and_return('new_path') + it "raises error when directory exists" do + expect { namespace.move_dir }.to raise_error("namespace directory cannot be moved") end - it 'raises an error about not movable project' do - expect { namespace.move_dir }.to raise_error(/Namespace cannot be moved/) + it "moves dir if path changed" do + namespace.update_attributes(path: namespace.full_path + '_new') + + expect(gitlab_shell.exists?(project.repository_storage_path, "#{namespace.path}/#{project.path}.git")).to be_truthy end - end - context 'with subgroups' do - let(:parent) { create(:group, name: 'parent', path: 'parent') } - let(:child) { create(:group, name: 'child', path: 'child', parent: parent) } - let!(:project) { create(:project_empty_repo, path: 'the-project', namespace: child, skip_disk_validation: true) } - let(:uploads_dir) { FileUploader.root } - let(:pages_dir) { File.join(TestEnv.pages_path) } + context 'with subgroups' do + let(:parent) { create(:group, name: 'parent', path: 'parent') } + let(:child) { create(:group, name: 'child', path: 'child', parent: parent) } + let!(:project) { create(:project_empty_repo, :legacy_storage, path: 'the-project', namespace: child, skip_disk_validation: true) } + let(:uploads_dir) { FileUploader.root } + let(:pages_dir) { File.join(TestEnv.pages_path) } - before do - FileUtils.mkdir_p(File.join(uploads_dir, 'parent', 'child', 'the-project')) - FileUtils.mkdir_p(File.join(pages_dir, 'parent', 'child', 'the-project')) - end + before do + FileUtils.mkdir_p(File.join(uploads_dir, project.full_path)) + FileUtils.mkdir_p(File.join(pages_dir, project.full_path)) + end + + context 'renaming child' do + it 'correctly moves the repository, uploads and pages' do + expected_repository_path = File.join(TestEnv.repos_path, 'parent', 'renamed', 'the-project.git') + expected_upload_path = File.join(uploads_dir, 'parent', 'renamed', 'the-project') + expected_pages_path = File.join(pages_dir, 'parent', 'renamed', 'the-project') - context 'renaming child' do - it 'correctly moves the repository, uploads and pages' do - expected_repository_path = File.join(TestEnv.repos_path, 'parent', 'renamed', 'the-project.git') - expected_upload_path = File.join(uploads_dir, 'parent', 'renamed', 'the-project') - expected_pages_path = File.join(pages_dir, 'parent', 'renamed', 'the-project') + child.update_attributes!(path: 'renamed') - child.update_attributes!(path: 'renamed') + expect(File.directory?(expected_repository_path)).to be(true) + expect(File.directory?(expected_upload_path)).to be(true) + expect(File.directory?(expected_pages_path)).to be(true) + end + end + + context 'renaming parent' do + it 'correctly moves the repository, uploads and pages' do + expected_repository_path = File.join(TestEnv.repos_path, 'renamed', 'child', 'the-project.git') + expected_upload_path = File.join(uploads_dir, 'renamed', 'child', 'the-project') + expected_pages_path = File.join(pages_dir, 'renamed', 'child', 'the-project') - expect(File.directory?(expected_repository_path)).to be(true) - expect(File.directory?(expected_upload_path)).to be(true) - expect(File.directory?(expected_pages_path)).to be(true) + parent.update_attributes!(path: 'renamed') + + expect(File.directory?(expected_repository_path)).to be(true) + expect(File.directory?(expected_upload_path)).to be(true) + expect(File.directory?(expected_pages_path)).to be(true) + end end end + end - context 'renaming parent' do - it 'correctly moves the repository, uploads and pages' do - expected_repository_path = File.join(TestEnv.repos_path, 'renamed', 'child', 'the-project.git') - expected_upload_path = File.join(uploads_dir, 'renamed', 'child', 'the-project') - expected_pages_path = File.join(pages_dir, 'renamed', 'child', 'the-project') + context 'hashed storage' do + let(:namespace) { create(:namespace) } + let!(:project) { create(:project_empty_repo, namespace: namespace) } - parent.update_attributes!(path: 'renamed') + it_behaves_like 'namespace restrictions' - expect(File.directory?(expected_repository_path)).to be(true) - expect(File.directory?(expected_upload_path)).to be(true) - expect(File.directory?(expected_pages_path)).to be(true) - end + it "repository directory remains unchanged if path changed" do + before_disk_path = project.disk_path + namespace.update_attributes(path: namespace.full_path + '_new') + + expect(before_disk_path).to eq(project.disk_path) + expect(gitlab_shell.exists?(project.repository_storage_path, "#{project.disk_path}.git")).to be_truthy end end it 'updates project full path in .git/config for each project inside namespace' do parent = create(:group, name: 'mygroup', path: 'mygroup') subgroup = create(:group, name: 'mysubgroup', path: 'mysubgroup', parent: parent) - project_in_parent_group = create(:project, :repository, namespace: parent, name: 'foo1') - hashed_project_in_subgroup = create(:project, :repository, :hashed, namespace: subgroup, name: 'foo2') - legacy_project_in_subgroup = create(:project, :repository, namespace: subgroup, name: 'foo3') + project_in_parent_group = create(:project, :legacy_storage, :repository, namespace: parent, name: 'foo1') + hashed_project_in_subgroup = create(:project, :repository, namespace: subgroup, name: 'foo2') + legacy_project_in_subgroup = create(:project, :legacy_storage, :repository, namespace: subgroup, name: 'foo3') parent.update(path: 'mygroup_new') @@ -260,38 +281,18 @@ describe Namespace do end describe '#rm_dir', 'callback' do - let!(:project) { create(:project_empty_repo, namespace: namespace) } let(:repository_storage_path) { Gitlab.config.repositories.storages.default['path'] } let(:path_in_dir) { File.join(repository_storage_path, namespace.full_path) } let(:deleted_path) { namespace.full_path.gsub(namespace.path, "#{namespace.full_path}+#{namespace.id}+deleted") } let(:deleted_path_in_dir) { File.join(repository_storage_path, deleted_path) } - it 'renames its dirs when deleted' do - allow(GitlabShellWorker).to receive(:perform_in) - - namespace.destroy - - expect(File.exist?(deleted_path_in_dir)).to be(true) - end - - it 'schedules the namespace for deletion' do - expect(GitlabShellWorker).to receive(:perform_in).with(5.minutes, :rm_namespace, repository_storage_path, deleted_path) - - namespace.destroy - end - - context 'in sub-groups' do - let(:parent) { create(:group, path: 'parent') } - let(:child) { create(:group, parent: parent, path: 'child') } - let!(:project) { create(:project_empty_repo, namespace: child) } - let(:path_in_dir) { File.join(repository_storage_path, 'parent', 'child') } - let(:deleted_path) { File.join('parent', "child+#{child.id}+deleted") } - let(:deleted_path_in_dir) { File.join(repository_storage_path, deleted_path) } + context 'legacy storage' do + let!(:project) { create(:project_empty_repo, :legacy_storage, namespace: namespace) } it 'renames its dirs when deleted' do allow(GitlabShellWorker).to receive(:perform_in) - child.destroy + namespace.destroy expect(File.exist?(deleted_path_in_dir)).to be(true) end @@ -299,14 +300,57 @@ describe Namespace do it 'schedules the namespace for deletion' do expect(GitlabShellWorker).to receive(:perform_in).with(5.minutes, :rm_namespace, repository_storage_path, deleted_path) - child.destroy + namespace.destroy + end + + context 'in sub-groups' do + let(:parent) { create(:group, path: 'parent') } + let(:child) { create(:group, parent: parent, path: 'child') } + let!(:project) { create(:project_empty_repo, :legacy_storage, namespace: child) } + let(:path_in_dir) { File.join(repository_storage_path, 'parent', 'child') } + let(:deleted_path) { File.join('parent', "child+#{child.id}+deleted") } + let(:deleted_path_in_dir) { File.join(repository_storage_path, deleted_path) } + + it 'renames its dirs when deleted' do + allow(GitlabShellWorker).to receive(:perform_in) + + child.destroy + + expect(File.exist?(deleted_path_in_dir)).to be(true) + end + + it 'schedules the namespace for deletion' do + expect(GitlabShellWorker).to receive(:perform_in).with(5.minutes, :rm_namespace, repository_storage_path, deleted_path) + + child.destroy + end + end + + it 'removes the exports folder' do + expect(namespace).to receive(:remove_exports!) + + namespace.destroy end end - it 'removes the exports folder' do - expect(namespace).to receive(:remove_exports!) + context 'hashed storage' do + let!(:project) { create(:project_empty_repo, namespace: namespace) } + + it 'has no repositories base directories to remove' do + allow(GitlabShellWorker).to receive(:perform_in) + + expect(File.exist?(path_in_dir)).to be(false) - namespace.destroy + namespace.destroy + + expect(File.exist?(deleted_path_in_dir)).to be(false) + end + + it 'removes the exports folder' do + expect(namespace).to receive(:remove_exports!) + + namespace.destroy + end end end @@ -567,8 +611,8 @@ describe Namespace do end describe '#remove_exports' do - let(:legacy_project) { create(:project, :with_export, namespace: namespace) } - let(:hashed_project) { create(:project, :with_export, :hashed, namespace: namespace) } + let(:legacy_project) { create(:project, :with_export, :legacy_storage, namespace: namespace) } + let(:hashed_project) { create(:project, :with_export, namespace: namespace) } let(:export_path) { Dir.mktmpdir('namespace_remove_exports_spec') } let(:legacy_export) { legacy_project.export_project_path } let(:hashed_export) { hashed_project.export_project_path } diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 9dca7f326d3..0da97f62959 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -2503,6 +2503,7 @@ describe Project do end describe '#remove_exports' do + let(:legacy_project) { create(:project, :legacy_storage, :with_export) } let(:project) { create(:project, :with_export) } it 'removes the exports directory for the project' do @@ -2515,15 +2516,29 @@ describe Project do expect(File.exist?(project.export_path)).to be_falsy end - it 'is a no-op when there is no namespace' do + it 'is a no-op on legacy projects when there is no namespace' do + export_path = legacy_project.export_path + + legacy_project.update_column(:namespace_id, nil) + + expect(FileUtils).not_to receive(:rm_rf).with(export_path) + + legacy_project.remove_exports + + expect(File.exist?(export_path)).to be_truthy + end + + it 'runs on hashed storage projects when there is no namespace' do export_path = project.export_path + project.update_column(:namespace_id, nil) - expect(FileUtils).not_to receive(:rm_rf).with(export_path) + allow(FileUtils).to receive(:rm_rf).and_call_original + expect(FileUtils).to receive(:rm_rf).with(export_path).and_call_original project.remove_exports - expect(File.exist?(export_path)).to be_truthy + expect(File.exist?(export_path)).to be_falsy end it 'is run when the project is destroyed' do @@ -2544,7 +2559,7 @@ describe Project do end context 'legacy storage' do - let(:project) { create(:project, :repository) } + let(:project) { create(:project, :repository, :legacy_storage) } let(:gitlab_shell) { Gitlab::Shell.new } let(:project_storage) { project.send(:storage) } @@ -2718,6 +2733,8 @@ describe Project do let(:project) { create(:project, :repository, skip_disk_validation: true) } let(:gitlab_shell) { Gitlab::Shell.new } let(:hash) { Digest::SHA2.hexdigest(project.id.to_s) } + let(:hashed_prefix) { File.join('@hashed', hash[0..1], hash[2..3]) } + let(:hashed_path) { File.join(hashed_prefix, hash) } before do stub_application_setting(hashed_storage_enabled: true) @@ -2743,14 +2760,12 @@ describe Project do describe '#base_dir' do it 'returns base_dir based on hash of project id' do - expect(project.base_dir).to eq("@hashed/#{hash[0..1]}/#{hash[2..3]}") + expect(project.base_dir).to eq(hashed_prefix) end end describe '#disk_path' do it 'returns disk_path based on hash of project id' do - hashed_path = "@hashed/#{hash[0..1]}/#{hash[2..3]}/#{hash}" - expect(project.disk_path).to eq(hashed_path) end end @@ -2759,7 +2774,7 @@ describe Project do it 'delegates to gitlab_shell to ensure namespace is created' do allow(project).to receive(:gitlab_shell).and_return(gitlab_shell) - expect(gitlab_shell).to receive(:add_namespace).with(project.repository_storage_path, "@hashed/#{hash[0..1]}/#{hash[2..3]}") + expect(gitlab_shell).to receive(:add_namespace).with(project.repository_storage_path, hashed_prefix) project.ensure_storage_path_exists end diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb index ea6b0a71849..c7df6251d74 100644 --- a/spec/requests/api/internal_spec.rb +++ b/spec/requests/api/internal_spec.rb @@ -366,20 +366,9 @@ describe API::Internal do end end - context 'project as /namespace/project' do - it do - push(key, project_with_repo_path('/' + project.full_path)) - - expect(response).to have_gitlab_http_status(200) - expect(json_response["status"]).to be_truthy - expect(json_response["repository_path"]).to eq(project.repository.path_to_repo) - expect(json_response["gl_repository"]).to eq("project-#{project.id}") - end - end - context 'project as namespace/project' do it do - push(key, project_with_repo_path(project.full_path)) + push(key, project) expect(response).to have_gitlab_http_status(200) expect(json_response["status"]).to be_truthy @@ -496,8 +485,10 @@ describe API::Internal do end context 'project does not exist' do - it do - pull(key, project_with_repo_path('gitlab/notexist')) + it 'returns a 200 response with status: false' do + project.destroy + + pull(key, project) expect(response).to have_gitlab_http_status(200) expect(json_response["status"]).to be_falsey @@ -569,6 +560,7 @@ describe API::Internal do end context 'the project path was changed' do + let(:project) { create(:project, :repository, :legacy_storage) } let!(:old_path_to_repo) { project.repository.path_to_repo } let!(:repository) { project.repository } @@ -858,9 +850,14 @@ describe API::Internal do end end - def project_with_repo_path(path) - double().tap do |fake_project| - allow(fake_project).to receive_message_chain('repository.path_to_repo' => path) + def gl_repository_for(project_or_wiki) + case project_or_wiki + when ProjectWiki + project_or_wiki.project.gl_repository(is_wiki: true) + when Project + project_or_wiki.gl_repository(is_wiki: false) + else + nil end end @@ -868,18 +865,8 @@ describe API::Internal do post( api("/internal/allowed"), key_id: key.id, - project: project.repository.path_to_repo, - action: 'git-upload-pack', - secret_token: secret_token, - protocol: protocol - ) - end - - def pull_with_path(key, path_to_repo, protocol = 'ssh') - post( - api("/internal/allowed"), - key_id: key.id, - project: path_to_repo, + project: project.full_path, + gl_repository: gl_repository_for(project), action: 'git-upload-pack', secret_token: secret_token, protocol: protocol @@ -891,20 +878,8 @@ describe API::Internal do api("/internal/allowed"), changes: 'd14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/master', key_id: key.id, - project: project.repository.path_to_repo, - action: 'git-receive-pack', - secret_token: secret_token, - protocol: protocol, - env: env - ) - end - - def push_with_path(key, path_to_repo, protocol = 'ssh', env: nil) - post( - api("/internal/allowed"), - changes: 'd14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/master', - key_id: key.id, - project: path_to_repo, + project: project.full_path, + gl_repository: gl_repository_for(project), action: 'git-receive-pack', secret_token: secret_token, protocol: protocol, @@ -917,7 +892,8 @@ describe API::Internal do api("/internal/allowed"), ref: 'master', key_id: key.id, - project: project.repository.path_to_repo, + project: project.full_path, + gl_repository: gl_repository_for(project), action: 'git-upload-archive', secret_token: secret_token, protocol: 'ssh' @@ -929,7 +905,7 @@ describe API::Internal do api("/internal/lfs_authenticate"), key_id: key_id, secret_token: secret_token, - project: project.repository.path_to_repo + project: project.full_path ) end end diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index f11cd638d96..00dd8897e6a 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -460,7 +460,7 @@ describe API::Projects do expect(response).to have_gitlab_http_status(201) project.each_pair do |k, v| - next if %i[has_external_issue_tracker issues_enabled merge_requests_enabled wiki_enabled].include?(k) + next if %i[has_external_issue_tracker issues_enabled merge_requests_enabled wiki_enabled storage_version].include?(k) expect(json_response[k.to_s]).to eq(v) end @@ -622,12 +622,8 @@ describe API::Projects do end describe 'POST /projects/user/:id' do - before do - expect(project).to be_persisted - end - it 'creates new project without path but with name and return 201' do - expect { post api("/projects/user/#{user.id}", admin), name: 'Foo Project' }.to change {Project.count}.by(1) + expect { post api("/projects/user/#{user.id}", admin), name: 'Foo Project' }.to change { Project.count }.by(1) expect(response).to have_gitlab_http_status(201) project = Project.last @@ -666,8 +662,9 @@ describe API::Projects do post api("/projects/user/#{user.id}", admin), project expect(response).to have_gitlab_http_status(201) + project.each_pair do |k, v| - next if %i[has_external_issue_tracker path].include?(k) + next if %i[has_external_issue_tracker path storage_version].include?(k) expect(json_response[k.to_s]).to eq(v) end diff --git a/spec/requests/api/v3/projects_spec.rb b/spec/requests/api/v3/projects_spec.rb index 5d99d9495f3..bf36d3e245a 100644 --- a/spec/requests/api/v3/projects_spec.rb +++ b/spec/requests/api/v3/projects_spec.rb @@ -401,7 +401,7 @@ describe API::V3::Projects do post v3_api('/projects', user), project project.each_pair do |k, v| - next if %i[has_external_issue_tracker issues_enabled merge_requests_enabled wiki_enabled].include?(k) + next if %i[storage_version has_external_issue_tracker issues_enabled merge_requests_enabled wiki_enabled].include?(k) expect(json_response[k.to_s]).to eq(v) end @@ -545,7 +545,7 @@ describe API::V3::Projects do expect(response).to have_gitlab_http_status(201) project.each_pair do |k, v| - next if %i[has_external_issue_tracker path].include?(k) + next if %i[storage_version has_external_issue_tracker path].include?(k) expect(json_response[k.to_s]).to eq(v) end diff --git a/spec/requests/git_http_spec.rb b/spec/requests/git_http_spec.rb index 2e2dccdafad..942e5b2bb1b 100644 --- a/spec/requests/git_http_spec.rb +++ b/spec/requests/git_http_spec.rb @@ -163,7 +163,7 @@ describe 'Git HTTP requests' do download(path) do |response| json_body = ActiveSupport::JSON.decode(response.body) - expect(json_body['RepoPath']).to include(wiki.repository.full_path) + expect(json_body['RepoPath']).to include(wiki.repository.disk_path) end end end diff --git a/spec/services/groups/destroy_service_spec.rb b/spec/services/groups/destroy_service_spec.rb index ac4b9c02ba7..e8216abb08b 100644 --- a/spec/services/groups/destroy_service_spec.rb +++ b/spec/services/groups/destroy_service_spec.rb @@ -6,7 +6,7 @@ describe Groups::DestroyService do let!(:user) { create(:user) } let!(:group) { create(:group) } let!(:nested_group) { create(:group, parent: group) } - let!(:project) { create(:project, namespace: group) } + let!(:project) { create(:project, :legacy_storage, namespace: group) } let!(:notification_setting) { create(:notification_setting, source: group)} let(:gitlab_shell) { Gitlab::Shell.new } let(:remove_path) { group.path + "+#{group.id}+deleted" } @@ -141,7 +141,7 @@ describe Groups::DestroyService do end context 'legacy storage' do - let!(:project) { create(:project, :empty_repo, namespace: group) } + let!(:project) { create(:project, :legacy_storage, :empty_repo, namespace: group) } it 'removes repository' do expect(gitlab_shell.exists?(project.repository_storage_path, "#{project.disk_path}.git")).to be_falsey @@ -149,7 +149,7 @@ describe Groups::DestroyService do end context 'hashed storage' do - let!(:project) { create(:project, :hashed, :empty_repo, namespace: group) } + let!(:project) { create(:project, :empty_repo, namespace: group) } it 'removes repository' do expect(gitlab_shell.exists?(project.repository_storage_path, "#{project.disk_path}.git")).to be_falsey diff --git a/spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb b/spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb index 15699574b3a..fb6d7171ac3 100644 --- a/spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb +++ b/spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Projects::HashedStorage::MigrateAttachmentsService do subject(:service) { described_class.new(project) } - let(:project) { create(:project) } + let(:project) { create(:project, :legacy_storage) } let(:legacy_storage) { Storage::LegacyProject.new(project) } let(:hashed_storage) { Storage::HashedProject.new(project) } diff --git a/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb b/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb index 7b536cc05cb..747bd4529a0 100644 --- a/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb +++ b/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Projects::HashedStorage::MigrateRepositoryService do let(:gitlab_shell) { Gitlab::Shell.new } - let(:project) { create(:project, :repository, :wiki_repo) } + let(:project) { create(:project, :legacy_storage, :repository, :wiki_repo) } let(:service) { described_class.new(project) } let(:legacy_storage) { Storage::LegacyProject.new(project) } let(:hashed_storage) { Storage::HashedProject.new(project) } diff --git a/spec/services/projects/hashed_storage_migration_service_spec.rb b/spec/services/projects/hashed_storage_migration_service_spec.rb index 466f0b5d7c2..e8e18bb3ac0 100644 --- a/spec/services/projects/hashed_storage_migration_service_spec.rb +++ b/spec/services/projects/hashed_storage_migration_service_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Projects::HashedStorageMigrationService do - let(:project) { create(:project, :empty_repo, :wiki_repo) } + let(:project) { create(:project, :empty_repo, :wiki_repo, :legacy_storage) } subject(:service) { described_class.new(project) } describe '#execute' do diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb index ef68742a463..ae0e22e3dc0 100644 --- a/spec/services/projects/transfer_service_spec.rb +++ b/spec/services/projects/transfer_service_spec.rb @@ -4,7 +4,7 @@ describe Projects::TransferService do let(:gitlab_shell) { Gitlab::Shell.new } let(:user) { create(:user) } let(:group) { create(:group) } - let(:project) { create(:project, :repository, namespace: user.namespace) } + let(:project) { create(:project, :repository, :legacy_storage, namespace: user.namespace) } context 'namespace -> namespace' do before do @@ -214,7 +214,7 @@ describe Projects::TransferService do end context 'when hashed storage in use' do - let(:hashed_project) { create(:project, :repository, :hashed, namespace: user.namespace) } + let(:hashed_project) { create(:project, :repository, namespace: user.namespace) } before do group.add_owner(user) diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb index fc6aa713d6f..a0b97ceead9 100644 --- a/spec/services/projects/update_service_spec.rb +++ b/spec/services/projects/update_service_spec.rb @@ -150,6 +150,8 @@ describe Projects::UpdateService do let(:repository_storage_path) { Gitlab.config.repositories.storages[repository_storage]['path'] } context 'with legacy storage' do + let(:project) { create(:project, :legacy_storage, :repository, creator: user, namespace: user.namespace) } + before do gitlab_shell.add_repository(repository_storage, "#{user.namespace.full_path}/existing") end diff --git a/spec/services/users/destroy_service_spec.rb b/spec/services/users/destroy_service_spec.rb index bb3d73edf8e..11c75ddfcf8 100644 --- a/spec/services/users/destroy_service_spec.rb +++ b/spec/services/users/destroy_service_spec.rb @@ -173,7 +173,7 @@ describe Users::DestroyService do end context 'legacy storage' do - let!(:project) { create(:project, :empty_repo, namespace: user.namespace) } + let!(:project) { create(:project, :empty_repo, :legacy_storage, namespace: user.namespace) } it 'removes repository' do expect(gitlab_shell.exists?(project.repository_storage_path, "#{project.disk_path}.git")).to be_falsey @@ -181,7 +181,7 @@ describe Users::DestroyService do end context 'hashed storage' do - let!(:project) { create(:project, :empty_repo, :hashed, namespace: user.namespace) } + let!(:project) { create(:project, :empty_repo, namespace: user.namespace) } it 'removes repository' do expect(gitlab_shell.exists?(project.repository_storage_path, "#{project.disk_path}.git")).to be_falsey diff --git a/spec/uploaders/file_uploader_spec.rb b/spec/uploaders/file_uploader_spec.rb index 6a92e7fae51..b42ce982b27 100644 --- a/spec/uploaders/file_uploader_spec.rb +++ b/spec/uploaders/file_uploader_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe FileUploader do let(:group) { create(:group, name: 'awesome') } - let(:project) { create(:project, namespace: group, name: 'project') } + let(:project) { create(:project, :legacy_storage, namespace: group, name: 'project') } let(:uploader) { described_class.new(project) } let(:upload) { double(model: project, path: 'secret/foo.jpg') } @@ -16,12 +16,12 @@ describe FileUploader do shared_examples 'uses hashed storage' do context 'when rolled out attachments' do + let(:project) { build_stubbed(:project, namespace: group, name: 'project') } + before do allow(project).to receive(:disk_path).and_return('ca/fe/fe/ed') end - let(:project) { build_stubbed(:project, :hashed, namespace: group, name: 'project') } - it_behaves_like 'builds correct paths', store_dir: %r{ca/fe/fe/ed/\h+}, absolute_path: %r{#{described_class.root}/ca/fe/fe/ed/secret/foo.jpg} diff --git a/spec/workers/repository_fork_worker_spec.rb b/spec/workers/repository_fork_worker_spec.rb index 4912baa348c..6c66658d8c3 100644 --- a/spec/workers/repository_fork_worker_spec.rb +++ b/spec/workers/repository_fork_worker_spec.rb @@ -68,7 +68,7 @@ describe RepositoryForkWorker do end it "handles bad fork" do - error_message = "Unable to fork project #{fork_project.id} for repository #{project.full_path} -> #{fork_project.full_path}" + error_message = "Unable to fork project #{fork_project.id} for repository #{project.disk_path} -> #{fork_project.disk_path}" expect_fork_repository.and_return(false) diff --git a/spec/workers/storage_migrator_worker_spec.rb b/spec/workers/storage_migrator_worker_spec.rb index 8619ff2f7da..ff625164142 100644 --- a/spec/workers/storage_migrator_worker_spec.rb +++ b/spec/workers/storage_migrator_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe StorageMigratorWorker do subject(:worker) { described_class.new } - let(:projects) { create_list(:project, 2) } + let(:projects) { create_list(:project, 2, :legacy_storage) } describe '#perform' do let(:ids) { projects.map(&:id) } -- cgit v1.2.1 From 3647fe58c1069909e2ce610ff85910b74f89ff31 Mon Sep 17 00:00:00 2001 From: Jared Deckard Date: Tue, 6 Feb 2018 15:36:49 -0600 Subject: The emoji menu should not close when the search box is clicked --- spec/javascripts/awards_handler_spec.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spec/javascripts/awards_handler_spec.js b/spec/javascripts/awards_handler_spec.js index 268b5b83b73..1c1b3f3ced3 100644 --- a/spec/javascripts/awards_handler_spec.js +++ b/spec/javascripts/awards_handler_spec.js @@ -79,7 +79,7 @@ import '~/lib/utils/common_utils'; return expect($emojiMenu.length).toBe(1); }); }); - return it('should remove emoji menu when body is clicked', function(done) { + it('should remove emoji menu when body is clicked', function(done) { $('.js-add-award').eq(0).click(); return lazyAssert(done, function() { var $emojiMenu; @@ -90,6 +90,17 @@ import '~/lib/utils/common_utils'; return expect($('.js-awards-block.current').length).toBe(0); }); }); + it('should not remove emoji menu when search is clicked', function(done) { + $('.js-add-award').eq(0).click(); + return lazyAssert(done, function() { + var $emojiMenu; + $emojiMenu = $('.emoji-menu'); + $('.emoji-search').click(); + expect($emojiMenu.length).toBe(1); + expect($emojiMenu.hasClass('is-visible')).toBe(true); + return expect($('.js-awards-block.current').length).toBe(1); + }); + }); }); describe('::addAwardToEmojiBar', function() { it('should add emoji to votes block', function() { -- cgit v1.2.1 From 37a396560cc5b78f39308b03b34ae734cc5fcefc Mon Sep 17 00:00:00 2001 From: Jared Deckard Date: Tue, 6 Feb 2018 15:41:41 -0600 Subject: Don't reset the awards block when the emoji search is clicked --- app/assets/javascripts/awards_handler.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index 87109a802e5..3283ce5ec36 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -50,10 +50,8 @@ class AwardsHandler { this.registerEventListener('on', $('html'), 'click', (e) => { const $target = $(e.target); - if (!$target.closest('.emoji-menu-content').length) { - $('.js-awards-block.current').removeClass('current'); - } if (!$target.closest('.emoji-menu').length) { + $('.js-awards-block.current').removeClass('current'); if ($('.emoji-menu').is(':visible')) { $('.js-add-award.is-active').removeClass('is-active'); this.hideMenuElement($('.emoji-menu')); -- cgit v1.2.1 From e73760f52fc535b7dad0b3db40179c2f404b6352 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 7 Feb 2018 17:02:32 -0800 Subject: Fix sample fstab file in GitLab HA docs The nobootwait option is no longer a valid option in Ubuntu 16.04. Use nofail instead: https://askubuntu.com/questions/786928/ubuntu-16-04-fstab-fails-with-nobootwait --- doc/administration/high_availability/gitlab.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/administration/high_availability/gitlab.md b/doc/administration/high_availability/gitlab.md index b85a166089d..e201848791c 100644 --- a/doc/administration/high_availability/gitlab.md +++ b/doc/administration/high_availability/gitlab.md @@ -25,11 +25,11 @@ for each GitLab application server in your environment. options. Here is an example snippet to add to `/etc/fstab`: ``` - 10.1.0.1:/var/opt/gitlab/.ssh /var/opt/gitlab/.ssh nfs defaults,soft,rsize=1048576,wsize=1048576,noatime,nobootwait,lookupcache=positive 0 2 - 10.1.0.1:/var/opt/gitlab/gitlab-rails/uploads /var/opt/gitlab/gitlab-rails/uploads nfs defaults,soft,rsize=1048576,wsize=1048576,noatime,nobootwait,lookupcache=positive 0 2 - 10.1.0.1:/var/opt/gitlab/gitlab-rails/shared /var/opt/gitlab/gitlab-rails/shared nfs defaults,soft,rsize=1048576,wsize=1048576,noatime,nobootwait,lookupcache=positive 0 2 - 10.1.0.1:/var/opt/gitlab/gitlab-ci/builds /var/opt/gitlab/gitlab-ci/builds nfs defaults,soft,rsize=1048576,wsize=1048576,noatime,nobootwait,lookupcache=positive 0 2 - 10.1.1.1:/var/opt/gitlab/git-data /var/opt/gitlab/git-data nfs defaults,soft,rsize=1048576,wsize=1048576,noatime,nobootwait,lookupcache=positive 0 2 + 10.1.0.1:/var/opt/gitlab/.ssh /var/opt/gitlab/.ssh nfs defaults,soft,rsize=1048576,wsize=1048576,noatime,nofail,lookupcache=positive 0 2 + 10.1.0.1:/var/opt/gitlab/gitlab-rails/uploads /var/opt/gitlab/gitlab-rails/uploads nfs defaults,soft,rsize=1048576,wsize=1048576,noatime,nofail,lookupcache=positive 0 2 + 10.1.0.1:/var/opt/gitlab/gitlab-rails/shared /var/opt/gitlab/gitlab-rails/shared nfs defaults,soft,rsize=1048576,wsize=1048576,noatime,nofail,lookupcache=positive 0 2 + 10.1.0.1:/var/opt/gitlab/gitlab-ci/builds /var/opt/gitlab/gitlab-ci/builds nfs defaults,soft,rsize=1048576,wsize=1048576,noatime,nofail,lookupcache=positive 0 2 + 10.1.0.1:/var/opt/gitlab/git-data /var/opt/gitlab/git-data nfs defaults,soft,rsize=1048576,wsize=1048576,noatime,nofail,lookupcache=positive 0 2 ``` 1. Create the shared directories. These may be different depending on your NFS -- cgit v1.2.1 From 7e00adcc71877677637a8ebe0680f1d38176e7c8 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Thu, 8 Feb 2018 08:51:29 +0100 Subject: Early migrations populating fork-networks: no-op Since populating the fork networks was scheduled multiple times because of bugs that needed to be fixed: - https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15595/ Creating fork networks for projects that were missing the root of the fork network. - https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15709 The API allowed creating forked_project_links without fork_network_members. Scheduling this migration multiple times would case it to run concurrently. Which in turn would try to insert the same data into `fork_network_members` causing duplicate key errors. This avoids running the migration multiple times. --- .../bvl-fix-concurrent-fork-network-migrations.yml | 5 +++++ db/migrate/20170929131201_populate_fork_networks.rb | 16 +--------------- .../20171124150326_reschedule_fork_network_creation.rb | 16 +--------------- 3 files changed, 7 insertions(+), 30 deletions(-) create mode 100644 changelogs/unreleased/bvl-fix-concurrent-fork-network-migrations.yml diff --git a/changelogs/unreleased/bvl-fix-concurrent-fork-network-migrations.yml b/changelogs/unreleased/bvl-fix-concurrent-fork-network-migrations.yml new file mode 100644 index 00000000000..b2a77f75e55 --- /dev/null +++ b/changelogs/unreleased/bvl-fix-concurrent-fork-network-migrations.yml @@ -0,0 +1,5 @@ +--- +title: Avoid running `PopulateForkNetworksRange`-migration multiple times +merge_request: 16988 +author: +type: fixed diff --git a/db/migrate/20170929131201_populate_fork_networks.rb b/db/migrate/20170929131201_populate_fork_networks.rb index 1214962770f..ddbf27e1852 100644 --- a/db/migrate/20170929131201_populate_fork_networks.rb +++ b/db/migrate/20170929131201_populate_fork_networks.rb @@ -6,22 +6,8 @@ class PopulateForkNetworks < ActiveRecord::Migration DOWNTIME = false - MIGRATION = 'PopulateForkNetworksRange'.freeze - BATCH_SIZE = 100 - DELAY_INTERVAL = 15.seconds - - disable_ddl_transaction! - - class ForkedProjectLink < ActiveRecord::Base - include EachBatch - - self.table_name = 'forked_project_links' - end - def up - say 'Populating the `fork_networks` based on existing `forked_project_links`' - - queue_background_migration_jobs_by_range_at_intervals(ForkedProjectLink, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE) + say 'Fork networks will be populated in 20171205190711 - RescheduleForkNetworkCreationCaller' end def down diff --git a/db/post_migrate/20171124150326_reschedule_fork_network_creation.rb b/db/post_migrate/20171124150326_reschedule_fork_network_creation.rb index 05430efe1f6..26f917d5a1e 100644 --- a/db/post_migrate/20171124150326_reschedule_fork_network_creation.rb +++ b/db/post_migrate/20171124150326_reschedule_fork_network_creation.rb @@ -3,22 +3,8 @@ class RescheduleForkNetworkCreation < ActiveRecord::Migration DOWNTIME = false - MIGRATION = 'PopulateForkNetworksRange'.freeze - BATCH_SIZE = 100 - DELAY_INTERVAL = 15.seconds - - disable_ddl_transaction! - - class ForkedProjectLink < ActiveRecord::Base - include EachBatch - - self.table_name = 'forked_project_links' - end - def up - say 'Populating the `fork_networks` based on existing `forked_project_links`' - - queue_background_migration_jobs_by_range_at_intervals(ForkedProjectLink, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE) + say 'Fork networks will be populated in 20171205190711 - RescheduleForkNetworkCreationCaller' end def down -- cgit v1.2.1 From 0478ff7cd44d291e931436b8fcd4c5c53b249741 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Thu, 8 Feb 2018 09:11:00 +0100 Subject: Handle uniqueness on fork_network_member creation Since the migration might be queued already and be rescheduled when it fails on a uniqueness error, this should help clearing the background migration queue faster. --- .../create_fork_network_memberships_range.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/gitlab/background_migration/create_fork_network_memberships_range.rb b/lib/gitlab/background_migration/create_fork_network_memberships_range.rb index 03b17b319fa..1b4a9e8a194 100644 --- a/lib/gitlab/background_migration/create_fork_network_memberships_range.rb +++ b/lib/gitlab/background_migration/create_fork_network_memberships_range.rb @@ -14,6 +14,14 @@ module Gitlab def perform(start_id, end_id) log("Creating memberships for forks: #{start_id} - #{end_id}") + insert_members(start_id, end_id) + + if missing_members?(start_id, end_id) + BackgroundMigrationWorker.perform_in(RESCHEDULE_DELAY, "CreateForkNetworkMembershipsRange", [start_id, end_id]) + end + end + + def insert_members(start_id, end_id) ActiveRecord::Base.connection.execute <<~INSERT_MEMBERS INSERT INTO fork_network_members (fork_network_id, project_id, forked_from_project_id) @@ -33,10 +41,9 @@ module Gitlab WHERE existing_members.project_id = forked_project_links.forked_to_project_id ) INSERT_MEMBERS - - if missing_members?(start_id, end_id) - BackgroundMigrationWorker.perform_in(RESCHEDULE_DELAY, "CreateForkNetworkMembershipsRange", [start_id, end_id]) - end + rescue ActiveRecord::RecordNotUnique => e + # `fork_network_member` was created concurrently in another migration + log(e.message) end def missing_members?(start_id, end_id) -- cgit v1.2.1 From 917fb1744c10cdddd50c22bda690dfcca9a47eff Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Thu, 8 Feb 2018 09:15:45 +0100 Subject: [docs] Info rescheduling background migrations --- doc/development/background_migrations.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/development/background_migrations.md b/doc/development/background_migrations.md index af2026c483e..fc1b202b5eb 100644 --- a/doc/development/background_migrations.md +++ b/doc/development/background_migrations.md @@ -94,6 +94,18 @@ jobs = [['BackgroundMigrationClassName', [1]], BackgroundMigrationWorker.bulk_perform_in(5.minutes, jobs) ``` +### Rescheduling background migrations + +If one of the background migrations contains a bug that is fixed in a patch +release, the background migration needs to be rescheduled so the migration would +be repeated on systems that already performed the initial migration. + +When you reschedule the background migration, make sure to turn the original +scheduling into a no-op by clearing up the `#up` and `#down` methods of the +migration performing the scheduling. Otherwise the background migration would be +scheduled multiple times on systems that are upgrading multiple patch releases at +once. + ## Cleaning Up >**Note:** -- cgit v1.2.1 From 36a301a3c9cbb788860b8c4b020b5095fd3a3363 Mon Sep 17 00:00:00 2001 From: Constance Okoghenun Date: Thu, 8 Feb 2018 09:47:31 +0100 Subject: Replaced use of $.get with axios.get and updated tests --- app/assets/javascripts/diff.js | 8 +++++- app/assets/javascripts/gpg_badges.js | 16 +++++++----- spec/javascripts/gpg_badges_spec.js | 50 +++++++++++++++++++++--------------- 3 files changed, 46 insertions(+), 28 deletions(-) diff --git a/app/assets/javascripts/diff.js b/app/assets/javascripts/diff.js index a162424b3cf..b26422ab725 100644 --- a/app/assets/javascripts/diff.js +++ b/app/assets/javascripts/diff.js @@ -1,3 +1,6 @@ +import axios from '~/lib/utils/axios_utils'; +import flash from '~/flash'; +import { __ } from '~/locale'; import { getLocationHash } from './lib/utils/url_utility'; import FilesCommentButton from './files_comment_button'; import SingleFileDiff from './single_file_diff'; @@ -69,7 +72,10 @@ export default class Diff { const view = file.data('view'); const params = { since, to, bottom, offset, unfold, view }; - $.get(link, params, response => $target.parent().replaceWith(response)); + // $.get(link, params, response => $target.parent().replaceWith(response)); + axios.get(link, { params }) + .then(({ data }) => $target.parent().replaceWith(data)) + .catch(() => flash(__('An error occurred while loading diff'))); } openAnchoredDiff(cb) { diff --git a/app/assets/javascripts/gpg_badges.js b/app/assets/javascripts/gpg_badges.js index 7ac9dcd1112..11adf4d2826 100644 --- a/app/assets/javascripts/gpg_badges.js +++ b/app/assets/javascripts/gpg_badges.js @@ -1,3 +1,7 @@ +import axios from '~/lib/utils/axios_utils'; +import flash from '~/flash'; +import { __ } from '~/locale'; + export default class GpgBadges { static fetch() { const badges = $('.js-loading-gpg-badge'); @@ -5,13 +9,13 @@ export default class GpgBadges { badges.html(''); - $.get({ - url: form.data('signatures-path'), - data: form.serialize(), - }).done((response) => { - response.signatures.forEach((signature) => { + const params = form.serialize(); + return axios.get(form.data('signatures-path'), { params }) + .then(({ data }) => { + data.signatures.forEach((signature) => { badges.filter(`[data-commit-sha="${signature.commit_sha}"]`).replaceWith(signature.html); }); - }); + }) + .catch(() => flash(__('An error occurred while loading comm'))); } } diff --git a/spec/javascripts/gpg_badges_spec.js b/spec/javascripts/gpg_badges_spec.js index 7a826487bf9..d739cd55ef3 100644 --- a/spec/javascripts/gpg_badges_spec.js +++ b/spec/javascripts/gpg_badges_spec.js @@ -1,6 +1,9 @@ +import MockAdapter from 'axios-mock-adapter'; +import axios from '~/lib/utils/axios_utils'; import GpgBadges from '~/gpg_badges'; describe('GpgBadges', () => { + let mock; const dummyCommitSha = 'n0m0rec0ffee'; const dummyBadgeHtml = 'dummy html'; const dummyResponse = { @@ -11,38 +14,43 @@ describe('GpgBadges', () => { }; beforeEach(() => { + mock = new MockAdapter(axios); setFixtures(` +
+ + +
`); }); - it('displays a loading spinner', () => { - spyOn($, 'get').and.returnValue({ - done() { - // intentionally left blank - }, - }); + afterEach(() => { + mock.restore(); + }); - GpgBadges.fetch(); + it('displays a loading spinner', (done) => { + mock.onGet('/hello').reply(200); - expect(document.querySelector('.js-loading-gpg-badge:empty')).toBe(null); - const spinners = document.querySelectorAll('.js-loading-gpg-badge i.fa.fa-spinner.fa-spin'); - expect(spinners.length).toBe(1); + GpgBadges.fetch().then(() => { + expect(document.querySelector('.js-loading-gpg-badge:empty')).toBe(null); + const spinners = document.querySelectorAll('.js-loading-gpg-badge i.fa.fa-spinner.fa-spin'); + expect(spinners.length).toBe(1); + done(); + }).catch(err => done(err)); }); - it('replaces the loading spinner', () => { - spyOn($, 'get').and.returnValue({ - done(callback) { - callback(dummyResponse); - }, - }); - - GpgBadges.fetch(); + it('replaces the loading spinner', (done) => { + mock.onGet('/hello').reply(200, dummyResponse); - expect(document.querySelector('.js-loading-gpg-badge')).toBe(null); - const parentContainer = document.querySelector('.parent-container'); - expect(parentContainer.innerHTML.trim()).toEqual(dummyBadgeHtml); + GpgBadges.fetch().then(() => { + expect(document.querySelector('.js-loading-gpg-badge')).toBe(null); + const parentContainer = document.querySelector('.parent-container'); + expect(parentContainer.innerHTML.trim()).toEqual(dummyBadgeHtml); + done(); + }).catch(err => done(err)); }); }); -- cgit v1.2.1 From 271e7a325340551475ae937aaf2ed7a6344be9e8 Mon Sep 17 00:00:00 2001 From: Greg Stark Date: Fri, 19 Jan 2018 12:44:27 +0000 Subject: Add indexes and change SQL for expired artifacts to deal with artifacts migration efficiently Artifacts are in the middle of being migrated from ci_builds to ci_job_artifacts. The expiration date is currently visible in both of these tables and the test for whether an expired artifact is present for a job is complex as it requires checking both the of the tables. Add two new indexes, one on ci_builds.artifacts_expire_at and one on ci_job_artifacts.expire_at to enable finding expired artifacts efficiently. And until the migration is finished, replace the SQL for finding expired and non-expired artifacts with a hand-crafted UNION ALL based query instead of using OR. This overcomes a database optimizer limitation that prevents it from using these indexes. When the migration is finished the next version should remove this query and replace it with a much simpler query on just ci_job_artifacts. See https://gitlab.com/gitlab-org/gitlab-ce/issues/42561 for followup. --- app/models/ci/build.rb | 40 +++++++++++++++++++--- changelogs/unreleased/expired-ci-artifacts.yml | 5 +++ .../20180119160751_optimize_ci_job_artifacts.rb | 23 +++++++++++++ db/schema.rb | 2 ++ spec/factories/ci/builds.rb | 4 +-- 5 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 changelogs/unreleased/expired-ci-artifacts.yml create mode 100644 db/migrate/20180119160751_optimize_ci_job_artifacts.rb diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 20534b8eed0..a5f6ec8b022 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -41,12 +41,44 @@ module Ci scope :unstarted, ->() { where(runner_id: nil) } scope :ignore_failures, ->() { where(allow_failure: false) } + + # This convoluted mess is because we need to handle two cases of + # artifact files during the migration. And a simple OR clause + # makes it impossible to optimize. + + # Instead we want to use UNION ALL and do two carefully + # constructed disjoint queries. But Rails cannot handle UNION or + # UNION ALL queries so we do the query in a subquery and wrap it + # in an otherwise redundant WHERE IN query (IN is fine for + # non-null columns). + + # This should all be ripped out when the migration is finished and + # replaced with just the new storage to avoid the extra work. + scope :with_artifacts, ->() do - where('(artifacts_file IS NOT NULL AND artifacts_file <> ?) OR EXISTS (?)', - '', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id')) + old = where(%q[artifacts_file <> '']) + new = where(%q[(artifacts_file IS NULL OR artifacts_file = '') AND EXISTS (?)], + Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id')) + union = Gitlab::SQL::Union.new([old, new], remove_duplicates: false) + Ci::Build.from("(#{union.to_sql}) #{Ci::Build.table_name}") end - scope :with_artifacts_not_expired, ->() { with_artifacts.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.now) } - scope :with_expired_artifacts, ->() { with_artifacts.where('artifacts_expire_at < ?', Time.now) } + + scope :with_artifacts_not_expired, ->() do + old = where(%q[artifacts_file <> '' AND (artifacts_expire_at IS NULL OR artifacts_expire_at > ?)], Time.now) + new = where(%q[(artifacts_file IS NULL OR artifacts_file = '') AND EXISTS (?)], + Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id AND (expire_at IS NULL OR expire_at > ?)', Time.now)) + union = Gitlab::SQL::Union.new([old, new], remove_duplicates: false) + Ci::Build.from("(#{union.to_sql}) #{Ci::Build.table_name}") + end + + scope :with_expired_artifacts, ->() do + old = where(%q[artifacts_file <> '' AND artifacts_expire_at < ?], Time.now) + new = where(%q[(artifacts_file IS NULL OR artifacts_file = '') AND EXISTS (?)], + Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id AND expire_at < ?', Time.now)) + union = Gitlab::SQL::Union.new([old, new], remove_duplicates: false) + Ci::Build.from("(#{union.to_sql}) #{Ci::Build.table_name}") + end + scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) } scope :manual_actions, ->() { where(when: :manual, status: COMPLETED_STATUSES + [:manual]) } scope :ref_protected, -> { where(protected: true) } diff --git a/changelogs/unreleased/expired-ci-artifacts.yml b/changelogs/unreleased/expired-ci-artifacts.yml new file mode 100644 index 00000000000..2fcbdb02f84 --- /dev/null +++ b/changelogs/unreleased/expired-ci-artifacts.yml @@ -0,0 +1,5 @@ +--- +title: Change SQL for expired artifacts to use new ci_job_artifacts.expire_at +merge_request: 16578 +author: +type: performance diff --git a/db/migrate/20180119160751_optimize_ci_job_artifacts.rb b/db/migrate/20180119160751_optimize_ci_job_artifacts.rb new file mode 100644 index 00000000000..9b4340ed7b7 --- /dev/null +++ b/db/migrate/20180119160751_optimize_ci_job_artifacts.rb @@ -0,0 +1,23 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class OptimizeCiJobArtifacts < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + disable_ddl_transaction! + + def up + # job_id is just here to be a covering index for index only scans + # since we'll almost always be joining against ci_builds on job_id + add_concurrent_index(:ci_job_artifacts, [:expire_at, :job_id]) + add_concurrent_index(:ci_builds, [:artifacts_expire_at], where: "artifacts_file <> ''") + end + + def down + remove_concurrent_index(:ci_job_artifacts, [:expire_at, :job_id]) + remove_concurrent_index(:ci_builds, [:artifacts_expire_at], where: "artifacts_file <> ''") + end +end diff --git a/db/schema.rb b/db/schema.rb index d07a4c31618..57b3f4c9988 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -293,6 +293,7 @@ ActiveRecord::Schema.define(version: 20180206200543) do t.integer "failure_reason" end + add_index "ci_builds", ["artifacts_expire_at"], name: "index_ci_builds_on_artifacts_expire_at", where: "(artifacts_file <> ''::text)", using: :btree add_index "ci_builds", ["auto_canceled_by_id"], name: "index_ci_builds_on_auto_canceled_by_id", using: :btree add_index "ci_builds", ["commit_id", "stage_idx", "created_at"], name: "index_ci_builds_on_commit_id_and_stage_idx_and_created_at", using: :btree add_index "ci_builds", ["commit_id", "status", "type"], name: "index_ci_builds_on_commit_id_and_status_and_type", using: :btree @@ -333,6 +334,7 @@ ActiveRecord::Schema.define(version: 20180206200543) do t.string "file" end + add_index "ci_job_artifacts", ["expire_at", "job_id"], name: "index_ci_job_artifacts_on_expire_at_and_job_id", using: :btree add_index "ci_job_artifacts", ["job_id", "file_type"], name: "index_ci_job_artifacts_on_job_id_and_file_type", unique: true, using: :btree add_index "ci_job_artifacts", ["project_id"], name: "index_ci_job_artifacts_on_project_id", using: :btree diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index 6ba599cdf83..f6ba3a581ca 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -180,8 +180,8 @@ FactoryBot.define do trait :artifacts do after(:create) do |build| - create(:ci_job_artifact, :archive, job: build) - create(:ci_job_artifact, :metadata, job: build) + create(:ci_job_artifact, :archive, job: build, expire_at: build.artifacts_expire_at) + create(:ci_job_artifact, :metadata, job: build, expire_at: build.artifacts_expire_at) build.reload end end -- cgit v1.2.1 From 801f5205cd7b0837329d466875c32ebc3cdbedf5 Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Thu, 8 Feb 2018 09:28:38 +0000 Subject: Update style_guide_scss.md --- doc/development/fe_guide/style_guide_scss.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/development/fe_guide/style_guide_scss.md b/doc/development/fe_guide/style_guide_scss.md index 86a8b4135af..655d94793dd 100644 --- a/doc/development/fe_guide/style_guide_scss.md +++ b/doc/development/fe_guide/style_guide_scss.md @@ -7,6 +7,8 @@ easy to maintain, and performant for the end-user. ### Naming +Filenames should use `snake_case`. + CSS classes should use the `lowercase-hyphenated` format rather than `snake_case` or `camelCase`. -- cgit v1.2.1 From 9a323c7e1f806bca099158e29561e0958baa06a6 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 7 Feb 2018 22:23:15 -0800 Subject: Memoize MergeRequest#rebase_in_progress? to prevent N+1 queries in Gitaly MergeRequest#rebase_in_progress? and MergeRequest#rebase_path were called twice each time per request. This memoization helps reduce the overall number of queries. See https://gitlab.com/gitlab-org/gitlab-ee/-/jobs/51616319 as a failing job. Closes gitlab-org/gitlab-ee#4857 --- app/models/merge_request.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index d025062f562..5bec68ce4f6 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -158,10 +158,12 @@ class MergeRequest < ActiveRecord::Base end def rebase_in_progress? - # The source project can be deleted - return false unless source_project + strong_memoize(:rebase_in_progress) do + # The source project can be deleted + next false unless source_project - source_project.repository.rebase_in_progress?(id) + source_project.repository.rebase_in_progress?(id) + end end # Use this method whenever you need to make sure the head_pipeline is synced with the -- cgit v1.2.1 From d7c04772bf9b87a7ce0960cc03391c75af20267b Mon Sep 17 00:00:00 2001 From: Constance Okoghenun Date: Thu, 8 Feb 2018 12:48:02 +0100 Subject: Replaced $.get with axois.get --- app/assets/javascripts/boards/components/new_list_dropdown.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/boards/components/new_list_dropdown.js b/app/assets/javascripts/boards/components/new_list_dropdown.js index c19c989680d..cf0bb5f5376 100644 --- a/app/assets/javascripts/boards/components/new_list_dropdown.js +++ b/app/assets/javascripts/boards/components/new_list_dropdown.js @@ -1,5 +1,6 @@ /* eslint-disable func-names, no-new, space-before-function-paren, one-var, promise/catch-or-return */ +import axios from '~/lib/utils/axios_utils'; import _ from 'underscore'; import CreateLabelDropdown from '../../create_label'; @@ -28,9 +29,9 @@ gl.issueBoards.newListDropdownInit = () => { $this.glDropdown({ data(term, callback) { - $.get($this.attr('data-list-labels-path')) - .then((resp) => { - callback(resp); + axios.get($this.attr('data-list-labels-path')) + .then(({ data }) => { + callback(data); }); }, renderRow (label) { -- cgit v1.2.1 From 583ef9458c5e5c32a14629f5754bc53ed0ad8a33 Mon Sep 17 00:00:00 2001 From: Hassan Zamani Date: Tue, 30 May 2017 10:36:00 +0430 Subject: Add groups to OpenID Connect claims --- app/models/user.rb | 7 +++++- .../unreleased/feature-oidc-groups-claim.yml | 4 ++++ config/initializers/doorkeeper_openid_connect.rb | 1 + config/locales/doorkeeper.en.yml | 2 +- doc/integration/openid_connect_provider.md | 1 + spec/models/user_spec.rb | 25 +++++++++++++++++++++- spec/requests/openid_connect_spec.rb | 24 +++++++++++++++++---- 7 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 changelogs/unreleased/feature-oidc-groups-claim.yml diff --git a/app/models/user.rb b/app/models/user.rb index a57ba3740c9..d4e720dc173 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -564,7 +564,7 @@ class User < ActiveRecord::Base gpg_keys.each(&:update_invalid_gpg_signatures) end - # Returns the groups a user has access to + # Returns the groups a user has access to, either through a membership or a project authorization def authorized_groups union = Gitlab::SQL::Union .new([groups.select(:id), authorized_projects.select(:namespace_id)]) @@ -572,6 +572,11 @@ class User < ActiveRecord::Base Group.where("namespaces.id IN (#{union.to_sql})") # rubocop:disable GitlabSecurity/SqlInjection end + # Returns the groups a user is a member of, either directly or through a parent group + def membership_groups + Gitlab::GroupHierarchy.new(groups).base_and_descendants + end + # Returns a relation of groups the user has access to, including their parent # and child groups (recursively). def all_expanded_groups diff --git a/changelogs/unreleased/feature-oidc-groups-claim.yml b/changelogs/unreleased/feature-oidc-groups-claim.yml new file mode 100644 index 00000000000..bde19130114 --- /dev/null +++ b/changelogs/unreleased/feature-oidc-groups-claim.yml @@ -0,0 +1,4 @@ +--- +title: Add groups to OpenID Connect claims +merge_request: 16929 +author: Hassan Zamani diff --git a/config/initializers/doorkeeper_openid_connect.rb b/config/initializers/doorkeeper_openid_connect.rb index af174def047..98e1f6e830f 100644 --- a/config/initializers/doorkeeper_openid_connect.rb +++ b/config/initializers/doorkeeper_openid_connect.rb @@ -31,6 +31,7 @@ Doorkeeper::OpenidConnect.configure do o.claim(:website) { |user| user.full_website_url if user.website_url? } o.claim(:profile) { |user| Gitlab::Routing.url_helpers.user_url user } o.claim(:picture) { |user| user.avatar_url(only_path: false) } + o.claim(:groups) { |user| user.membership_groups.map(&:full_path) } end end end diff --git a/config/locales/doorkeeper.en.yml b/config/locales/doorkeeper.en.yml index b1c71095d4f..889111282ef 100644 --- a/config/locales/doorkeeper.en.yml +++ b/config/locales/doorkeeper.en.yml @@ -68,7 +68,7 @@ en: read_user: Read-only access to the user's profile information, like username, public email and full name openid: - The ability to authenticate using GitLab, and read-only access to the user's profile information + The ability to authenticate using GitLab, and read-only access to the user's profile information and group memberships sudo: Access to the Sudo feature, to perform API actions as any user in the system (only available for admins) flash: diff --git a/doc/integration/openid_connect_provider.md b/doc/integration/openid_connect_provider.md index 56f367d841e..ad41be52045 100644 --- a/doc/integration/openid_connect_provider.md +++ b/doc/integration/openid_connect_provider.md @@ -39,6 +39,7 @@ Currently the following user information is shared with clients: | `website` | `string` | URL for the user's website | `profile` | `string` | URL for the user's GitLab profile | `picture` | `string` | URL for the user's GitLab avatar +| `groups` | `array` | Names of the groups the user is a member of [OpenID Connect]: http://openid.net/connect/ "OpenID Connect website" [doorkeeper-openid_connect]: https://github.com/doorkeeper-gem/doorkeeper-openid_connect "Doorkeeper::OpenidConnect website" diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 18c91d4cffd..264a2b948c9 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1557,14 +1557,37 @@ describe User do describe '#authorized_groups' do let!(:user) { create(:user) } let!(:private_group) { create(:group) } + let!(:child_group) { create(:group, parent: private_group) } + + let!(:project_group) { create(:group) } + let!(:project) { create(:project, group: project_group) } before do private_group.add_user(user, Gitlab::Access::MASTER) + project.add_master(user) end subject { user.authorized_groups } - it { is_expected.to eq([private_group]) } + it { is_expected.to contain_exactly private_group, project_group } + end + + describe '#membership_groups' do + let!(:user) { create(:user) } + let!(:parent_group) { create(:group) } + let!(:child_group) { create(:group, parent: parent_group) } + + before do + parent_group.add_user(user, Gitlab::Access::MASTER) + end + + subject { user.membership_groups } + + if Group.supports_nested_groups? + it { is_expected.to contain_exactly parent_group, child_group } + else + it { is_expected.to contain_exactly parent_group } + end end describe '#authorized_projects', :delete do diff --git a/spec/requests/openid_connect_spec.rb b/spec/requests/openid_connect_spec.rb index 1a5ad9b04e4..5d349f45a33 100644 --- a/spec/requests/openid_connect_spec.rb +++ b/spec/requests/openid_connect_spec.rb @@ -65,10 +65,20 @@ describe 'OpenID Connect requests' do ) end - let(:public_email) { build :email, email: 'public@example.com' } - let(:private_email) { build :email, email: 'private@example.com' } + let!(:public_email) { build :email, email: 'public@example.com' } + let!(:private_email) { build :email, email: 'private@example.com' } - it 'includes all user information' do + let!(:group1) { create :group, path: 'group1' } + let!(:group2) { create :group, path: 'group2' } + let!(:group3) { create :group, path: 'group3', parent: group2 } + let!(:group4) { create :group, path: 'group4', parent: group3 } + + before do + group1.add_user(user, GroupMember::OWNER) + group3.add_user(user, Gitlab::Access::DEVELOPER) + end + + it 'includes all user information and group memberships' do request_user_info expect(json_response).to eq({ @@ -79,7 +89,13 @@ describe 'OpenID Connect requests' do 'email_verified' => true, 'website' => 'https://example.com', 'profile' => 'http://localhost/alice', - 'picture' => "http://localhost/uploads/-/system/user/avatar/#{user.id}/dk.png" + 'picture' => "http://localhost/uploads/-/system/user/avatar/#{user.id}/dk.png", + 'groups' => + if Group.supports_nested_groups? + ['group1', 'group2/group3', 'group2/group3/group4'] + else + ['group1', 'group2/group3'] + end }) end end -- cgit v1.2.1 From 1ac22dba519535b18cc14a12b7bbda1b5d28e26a Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Thu, 8 Feb 2018 12:25:08 +0000 Subject: Add docs for MR link in commit page --- doc/user/project/merge_requests/index.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/user/project/merge_requests/index.md b/doc/user/project/merge_requests/index.md index aa3266cb457..769aad77da1 100644 --- a/doc/user/project/merge_requests/index.md +++ b/doc/user/project/merge_requests/index.md @@ -146,6 +146,19 @@ administrator to do so. ![Create new merge requests by email](img/create_from_email.png) +## Find the merge request that introduced a change + +> **Note**: this feature was [implemented in GitLab 10.5](https://gitlab.com/gitlab-org/gitlab-ce/issues/2383). + +When viewing the commit details page, GitLab will link to the merge request (or +merge requests, if it's in more than one) containing that commit. + +This only applies to commits that are in the most recent version of a merge +request - if a commit was in a merge request, then rebased out of that merge +request, they will not be linked. + +[Read more about merge request versions](versions.md) + ## Revert changes GitLab implements Git's powerful feature to revert any commit with introducing @@ -160,7 +173,7 @@ of merge request diff is created. When you visit a merge request that contains more than one pushes, you can select and compare the versions of those merge request diffs. -[Read more about the merge requests versions.](versions.md) +[Read more about merge request versions](versions.md) ## Work In Progress merge requests -- cgit v1.2.1 From b7cd99c376c2f953f30a4bf982b69780e3d6985b Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Fri, 22 Dec 2017 16:54:55 +0100 Subject: Allow including custom attributes in API responses --- .../feature-include-custom-attributes-in-api.yml | 5 + doc/api/groups.md | 4 + doc/api/projects.md | 4 + doc/api/users.md | 12 ++ lib/api/entities.rb | 5 + lib/api/groups.rb | 29 +++- lib/api/helpers/custom_attributes.rb | 28 ++++ lib/api/projects.rb | 19 ++- lib/api/users.rb | 9 +- .../api/custom_attributes_shared_examples.rb | 158 ++++++++++++++++----- 10 files changed, 229 insertions(+), 44 deletions(-) create mode 100644 changelogs/unreleased/feature-include-custom-attributes-in-api.yml create mode 100644 lib/api/helpers/custom_attributes.rb diff --git a/changelogs/unreleased/feature-include-custom-attributes-in-api.yml b/changelogs/unreleased/feature-include-custom-attributes-in-api.yml new file mode 100644 index 00000000000..f1087d7f7cc --- /dev/null +++ b/changelogs/unreleased/feature-include-custom-attributes-in-api.yml @@ -0,0 +1,5 @@ +--- +title: Allow including custom attributes in API responses +merge_request: 16526 +author: Markus Koller +type: changed diff --git a/doc/api/groups.md b/doc/api/groups.md index de730cdd869..f50558b58a6 100644 --- a/doc/api/groups.md +++ b/doc/api/groups.md @@ -15,6 +15,7 @@ Parameters: | `order_by` | string | no | Order groups by `name` or `path`. Default is `name` | | `sort` | string | no | Order groups in `asc` or `desc` order. Default is `asc` | | `statistics` | boolean | no | Include group statistics (admins only) | +| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) | | `owned` | boolean | no | Limit to groups owned by the current user | ``` @@ -98,6 +99,7 @@ Parameters: | `order_by` | string | no | Order groups by `name` or `path`. Default is `name` | | `sort` | string | no | Order groups in `asc` or `desc` order. Default is `asc` | | `statistics` | boolean | no | Include group statistics (admins only) | +| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) | | `owned` | boolean | no | Limit to groups owned by the current user | ``` @@ -145,6 +147,7 @@ Parameters: | `simple` | boolean | no | Return only the ID, URL, name, and path of each project | | `owned` | boolean | no | Limit by projects owned by the current user | | `starred` | boolean | no | Limit by projects starred by the current user | +| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) | Example response: @@ -204,6 +207,7 @@ Parameters: | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | +| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) | ```bash curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/groups/4 diff --git a/doc/api/projects.md b/doc/api/projects.md index 46f5de5aa0e..05d2f2af00b 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -37,6 +37,7 @@ GET /projects | `membership` | boolean | no | Limit by projects that the current user is a member of | | `starred` | boolean | no | Limit by projects starred by the current user | | `statistics` | boolean | no | Include project statistics | +| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) | | `with_issues_enabled` | boolean | no | Limit by enabled issues feature | | `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature | @@ -220,6 +221,7 @@ GET /users/:user_id/projects | `membership` | boolean | no | Limit by projects that the current user is a member of | | `starred` | boolean | no | Limit by projects starred by the current user | | `statistics` | boolean | no | Include project statistics | +| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) | | `with_issues_enabled` | boolean | no | Limit by enabled issues feature | | `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature | @@ -388,6 +390,7 @@ GET /projects/:id | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | | `statistics` | boolean | no | Include project statistics | +| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) | ```json { @@ -664,6 +667,7 @@ GET /projects/:id/forks | `membership` | boolean | no | Limit by projects that the current user is a member of | | `starred` | boolean | no | Limit by projects starred by the current user | | `statistics` | boolean | no | Include project statistics | +| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) | | `with_issues_enabled` | boolean | no | Limit by enabled issues feature | | `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature | diff --git a/doc/api/users.md b/doc/api/users.md index 2082e45756a..a4447e32908 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -165,6 +165,12 @@ You can filter by [custom attributes](custom_attributes.md) with: GET /users?custom_attributes[key]=value&custom_attributes[other_key]=other_value ``` +You can include the users' [custom attributes](custom_attributes.md) in the response with: + +``` +GET /users?with_custom_attributes=true +``` + ## Single user Get a single user. @@ -245,6 +251,12 @@ Parameters: } ``` +You can include the user's [custom attributes](custom_attributes.md) in the response with: + +``` +GET /users/:id?with_custom_attributes=true +``` + ## User creation Creates a new user. Note only administrators can create new users. Either `password` or `reset_password` should be specified (`reset_password` takes priority). diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 7838de13c56..dc8e2b26316 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -22,6 +22,7 @@ module API end expose :avatar_path, if: ->(user, options) { options.fetch(:only_path, false) && user.avatar_path } + expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes expose :web_url do |user, options| Gitlab::Routing.url_helpers.user_url(user) @@ -109,6 +110,8 @@ module API expose :star_count, :forks_count expose :last_activity_at + expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes + def self.preload_relation(projects_relation, options = {}) projects_relation.preload(:project_feature, :route) .preload(namespace: [:route, :owner], @@ -230,6 +233,8 @@ module API expose :parent_id end + expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes + expose :statistics, if: :statistics do with_options format_with: -> (value) { value.to_i } do expose :storage_size diff --git a/lib/api/groups.rb b/lib/api/groups.rb index b81f07a1770..4a4df1b8b9e 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -1,6 +1,7 @@ module API class Groups < Grape::API include PaginationParams + include Helpers::CustomAttributes before { authenticate_non_get! } @@ -67,6 +68,8 @@ module API } groups = groups.with_statistics if options[:statistics] + groups, options = with_custom_attributes(groups, options) + present paginate(groups), options end end @@ -79,6 +82,7 @@ module API end params do use :group_list_params + use :with_custom_attributes end get do groups = find_groups(params) @@ -142,9 +146,20 @@ module API desc 'Get a single group, with containing projects.' do success Entities::GroupDetail end + params do + use :with_custom_attributes + end get ":id" do group = find_group!(params[:id]) - present group, with: Entities::GroupDetail, current_user: current_user + + options = { + with: Entities::GroupDetail, + current_user: current_user + } + + group, options = with_custom_attributes(group, options) + + present group, options end desc 'Remove a group.' @@ -175,12 +190,19 @@ module API optional :starred, type: Boolean, default: false, desc: 'Limit by starred status' use :pagination + use :with_custom_attributes end get ":id/projects" do projects = find_group_projects(params) - entity = params[:simple] ? Entities::BasicProjectDetails : Entities::Project - present entity.prepare_relation(projects), with: entity, current_user: current_user + options = { + with: params[:simple] ? Entities::BasicProjectDetails : Entities::Project, + current_user: current_user + } + + projects, options = with_custom_attributes(projects, options) + + present options[:with].prepare_relation(projects), options end desc 'Get a list of subgroups in this group.' do @@ -188,6 +210,7 @@ module API end params do use :group_list_params + use :with_custom_attributes end get ":id/subgroups" do groups = find_groups(params) diff --git a/lib/api/helpers/custom_attributes.rb b/lib/api/helpers/custom_attributes.rb new file mode 100644 index 00000000000..70e4eda95f8 --- /dev/null +++ b/lib/api/helpers/custom_attributes.rb @@ -0,0 +1,28 @@ +module API + module Helpers + module CustomAttributes + extend ActiveSupport::Concern + + included do + helpers do + params :with_custom_attributes do + optional :with_custom_attributes, type: Boolean, default: false, desc: 'Include custom attributes in the response' + end + + def with_custom_attributes(collection_or_resource, options = {}) + options = options.merge( + with_custom_attributes: params[:with_custom_attributes] && + can?(current_user, :read_custom_attribute) + ) + + if options[:with_custom_attributes] && collection_or_resource.is_a?(ActiveRecord::Relation) + collection_or_resource = collection_or_resource.includes(:custom_attributes) + end + + [collection_or_resource, options] + end + end + end + end + end +end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 5b481121a10..e90892a90f7 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -3,6 +3,7 @@ require_dependency 'declarative_policy' module API class Projects < Grape::API include PaginationParams + include Helpers::CustomAttributes before { authenticate_non_get! } @@ -80,6 +81,7 @@ module API projects = projects.with_merge_requests_enabled if params[:with_merge_requests_enabled] projects = projects.with_statistics if params[:statistics] projects = paginate(projects) + projects, options = with_custom_attributes(projects, options) if current_user project_members = current_user.project_members.preload(:source, user: [notification_settings: :source]) @@ -107,6 +109,7 @@ module API requires :user_id, type: String, desc: 'The ID or username of the user' use :collection_params use :statistics_params + use :with_custom_attributes end get ":user_id/projects" do user = find_user(params[:user_id]) @@ -127,6 +130,7 @@ module API params do use :collection_params use :statistics_params + use :with_custom_attributes end get do present_projects load_projects @@ -196,11 +200,19 @@ module API end params do use :statistics_params + use :with_custom_attributes end get ":id" do - entity = current_user ? Entities::ProjectWithAccess : Entities::BasicProjectDetails - present user_project, with: entity, current_user: current_user, - user_can_admin_project: can?(current_user, :admin_project, user_project), statistics: params[:statistics] + options = { + with: current_user ? Entities::ProjectWithAccess : Entities::BasicProjectDetails, + current_user: current_user, + user_can_admin_project: can?(current_user, :admin_project, user_project), + statistics: params[:statistics] + } + + project, options = with_custom_attributes(user_project, options) + + present project, options end desc 'Fork new project for the current user or provided namespace.' do @@ -242,6 +254,7 @@ module API end params do use :collection_params + use :with_custom_attributes end get ':id/forks' do forks = ForkProjectsFinder.new(user_project, params: project_finder_params, current_user: current_user).execute diff --git a/lib/api/users.rb b/lib/api/users.rb index 3cc12724b8a..3920171205f 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -2,6 +2,7 @@ module API class Users < Grape::API include PaginationParams include APIGuard + include Helpers::CustomAttributes allow_access_with_scope :read_user, if: -> (request) { request.get? } @@ -70,6 +71,7 @@ module API use :sort_params use :pagination + use :with_custom_attributes end get do authenticated_as_admin! if params[:external].present? || (params[:extern_uid].present? && params[:provider].present?) @@ -94,8 +96,9 @@ module API entity = current_user&.admin? ? Entities::UserWithAdmin : Entities::UserBasic users = users.preload(:identities, :u2f_registrations) if entity == Entities::UserWithAdmin + users, options = with_custom_attributes(users, with: entity) - present paginate(users), with: entity + present paginate(users), options end desc 'Get a single user' do @@ -103,12 +106,16 @@ module API end params do requires :id, type: Integer, desc: 'The ID of the user' + + use :with_custom_attributes end get ":id" do user = User.find_by(id: params[:id]) not_found!('User') unless user && can?(current_user, :read_user, user) opts = current_user&.admin? ? { with: Entities::UserWithAdmin } : { with: Entities::User } + user, opts = with_custom_attributes(user, opts) + present user, opts end diff --git a/spec/support/shared_examples/requests/api/custom_attributes_shared_examples.rb b/spec/support/shared_examples/requests/api/custom_attributes_shared_examples.rb index 4e18804b937..9fc2fbef449 100644 --- a/spec/support/shared_examples/requests/api/custom_attributes_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/custom_attributes_shared_examples.rb @@ -17,12 +17,88 @@ shared_examples 'custom attributes endpoints' do |attributable_name| end end - it 'filters by custom attributes' do - get api("/#{attributable_name}", admin), custom_attributes: { foo: 'foo', bar: 'bar' } + context 'with an authorized user' do + it 'filters by custom attributes' do + get api("/#{attributable_name}", admin), custom_attributes: { foo: 'foo', bar: 'bar' } - expect(response).to have_gitlab_http_status(200) - expect(json_response.size).to be 1 - expect(json_response.first['id']).to eq attributable.id + expect(response).to have_gitlab_http_status(200) + expect(json_response.size).to be 1 + expect(json_response.first['id']).to eq attributable.id + end + end + end + + describe "GET /#{attributable_name} with custom attributes" do + before do + other_attributable + end + + context 'with an unauthorized user' do + it 'does not include custom attributes' do + get api("/#{attributable_name}", user), with_custom_attributes: true + + expect(response).to have_gitlab_http_status(200) + expect(json_response.size).to be 2 + expect(json_response.first).not_to include 'custom_attributes' + end + end + + context 'with an authorized user' do + it 'does not include custom attributes by default' do + get api("/#{attributable_name}", admin) + + expect(response).to have_gitlab_http_status(200) + expect(json_response.size).to be 2 + expect(json_response.first).not_to include 'custom_attributes' + expect(json_response.second).not_to include 'custom_attributes' + end + + it 'includes custom attributes if requested' do + get api("/#{attributable_name}", admin), with_custom_attributes: true + + expect(response).to have_gitlab_http_status(200) + expect(json_response.size).to be 2 + + attributable_response = json_response.find { |r| r['id'] == attributable.id } + other_attributable_response = json_response.find { |r| r['id'] == other_attributable.id } + + expect(attributable_response['custom_attributes']).to contain_exactly( + { 'key' => 'foo', 'value' => 'foo' }, + { 'key' => 'bar', 'value' => 'bar' } + ) + + expect(other_attributable_response['custom_attributes']).to eq [] + end + end + end + + describe "GET /#{attributable_name}/:id with custom attributes" do + context 'with an unauthorized user' do + it 'does not include custom attributes' do + get api("/#{attributable_name}/#{attributable.id}", user), with_custom_attributes: true + + expect(response).to have_gitlab_http_status(200) + expect(json_response).not_to include 'custom_attributes' + end + end + + context 'with an authorized user' do + it 'does not include custom attributes by default' do + get api("/#{attributable_name}/#{attributable.id}", admin) + + expect(response).to have_gitlab_http_status(200) + expect(json_response).not_to include 'custom_attributes' + end + + it 'includes custom attributes if requested' do + get api("/#{attributable_name}/#{attributable.id}", admin), with_custom_attributes: true + + expect(response).to have_gitlab_http_status(200) + expect(json_response['custom_attributes']).to contain_exactly( + { 'key' => 'foo', 'value' => 'foo' }, + { 'key' => 'bar', 'value' => 'bar' } + ) + end end end @@ -33,14 +109,16 @@ shared_examples 'custom attributes endpoints' do |attributable_name| it_behaves_like 'an unauthorized API user' end - it 'returns all custom attributes' do - get api("/#{attributable_name}/#{attributable.id}/custom_attributes", admin) + context 'with an authorized user' do + it 'returns all custom attributes' do + get api("/#{attributable_name}/#{attributable.id}/custom_attributes", admin) - expect(response).to have_gitlab_http_status(200) - expect(json_response).to contain_exactly( - { 'key' => 'foo', 'value' => 'foo' }, - { 'key' => 'bar', 'value' => 'bar' } - ) + expect(response).to have_gitlab_http_status(200) + expect(json_response).to contain_exactly( + { 'key' => 'foo', 'value' => 'foo' }, + { 'key' => 'bar', 'value' => 'bar' } + ) + end end end @@ -51,11 +129,13 @@ shared_examples 'custom attributes endpoints' do |attributable_name| it_behaves_like 'an unauthorized API user' end - it 'returns a single custom attribute' do - get api("/#{attributable_name}/#{attributable.id}/custom_attributes/foo", admin) + context 'with an authorized user' do + it'returns a single custom attribute' do + get api("/#{attributable_name}/#{attributable.id}/custom_attributes/foo", admin) - expect(response).to have_gitlab_http_status(200) - expect(json_response).to eq({ 'key' => 'foo', 'value' => 'foo' }) + expect(response).to have_gitlab_http_status(200) + expect(json_response).to eq({ 'key' => 'foo', 'value' => 'foo' }) + end end end @@ -66,24 +146,26 @@ shared_examples 'custom attributes endpoints' do |attributable_name| it_behaves_like 'an unauthorized API user' end - it 'creates a new custom attribute' do - expect do - put api("/#{attributable_name}/#{attributable.id}/custom_attributes/new", admin), value: 'new' - end.to change { attributable.custom_attributes.count }.by(1) + context 'with an authorized user' do + it 'creates a new custom attribute' do + expect do + put api("/#{attributable_name}/#{attributable.id}/custom_attributes/new", admin), value: 'new' + end.to change { attributable.custom_attributes.count }.by(1) - expect(response).to have_gitlab_http_status(200) - expect(json_response).to eq({ 'key' => 'new', 'value' => 'new' }) - expect(attributable.custom_attributes.find_by(key: 'new').value).to eq 'new' - end + expect(response).to have_gitlab_http_status(200) + expect(json_response).to eq({ 'key' => 'new', 'value' => 'new' }) + expect(attributable.custom_attributes.find_by(key: 'new').value).to eq 'new' + end - it 'updates an existing custom attribute' do - expect do - put api("/#{attributable_name}/#{attributable.id}/custom_attributes/foo", admin), value: 'new' - end.not_to change { attributable.custom_attributes.count } + it 'updates an existing custom attribute' do + expect do + put api("/#{attributable_name}/#{attributable.id}/custom_attributes/foo", admin), value: 'new' + end.not_to change { attributable.custom_attributes.count } - expect(response).to have_gitlab_http_status(200) - expect(json_response).to eq({ 'key' => 'foo', 'value' => 'new' }) - expect(custom_attribute1.reload.value).to eq 'new' + expect(response).to have_gitlab_http_status(200) + expect(json_response).to eq({ 'key' => 'foo', 'value' => 'new' }) + expect(custom_attribute1.reload.value).to eq 'new' + end end end @@ -94,13 +176,15 @@ shared_examples 'custom attributes endpoints' do |attributable_name| it_behaves_like 'an unauthorized API user' end - it 'deletes an existing custom attribute' do - expect do - delete api("/#{attributable_name}/#{attributable.id}/custom_attributes/foo", admin) - end.to change { attributable.custom_attributes.count }.by(-1) + context 'with an authorized user' do + it 'deletes an existing custom attribute' do + expect do + delete api("/#{attributable_name}/#{attributable.id}/custom_attributes/foo", admin) + end.to change { attributable.custom_attributes.count }.by(-1) - expect(response).to have_gitlab_http_status(204) - expect(attributable.custom_attributes.find_by(key: 'foo')).to be_nil + expect(response).to have_gitlab_http_status(204) + expect(attributable.custom_attributes.find_by(key: 'foo')).to be_nil + end end end end -- cgit v1.2.1 From 0b37e1109405493bfca7412d1272912fa4e547b5 Mon Sep 17 00:00:00 2001 From: Mark Fletcher Date: Thu, 8 Feb 2018 12:53:20 +0000 Subject: Update 10.5 source install guide --- doc/install/installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index 6eb8890cc4f..4dfc03d0fe0 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -299,9 +299,9 @@ sudo usermod -aG redis git ### Clone the Source # Clone GitLab repository - sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 10-4-stable gitlab + sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 10-5-stable gitlab -**Note:** You can change `10-4-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server! +**Note:** You can change `10-5-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server! ### Configure It -- cgit v1.2.1 From 4413d8768f511396805b2080c442c0ca96522f57 Mon Sep 17 00:00:00 2001 From: Mark Fletcher Date: Thu, 8 Feb 2018 13:04:50 +0000 Subject: Create update guide for 10.5 --- doc/update/10.4-to-10.5.md | 361 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 361 insertions(+) create mode 100644 doc/update/10.4-to-10.5.md diff --git a/doc/update/10.4-to-10.5.md b/doc/update/10.4-to-10.5.md new file mode 100644 index 00000000000..313419ed13d --- /dev/null +++ b/doc/update/10.4-to-10.5.md @@ -0,0 +1,361 @@ +--- +comments: false +--- + +# From 10.4 to 10.5 + +Make sure you view this update guide from the tag (version) of GitLab you would +like to install. In most cases this should be the highest numbered production +tag (without rc in it). You can select the tag in the version dropdown at the +top left corner of GitLab (below the menu bar). + +If the highest number stable branch is unclear please check the +[GitLab Blog](https://about.gitlab.com/blog/archives.html) for installation +guide links by version. + +### 1. Stop server + +```bash +sudo service gitlab stop +``` + +### 2. Backup + +NOTE: If you installed GitLab from source, make sure `rsync` is installed. + +```bash +cd /home/git/gitlab + +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production +``` + +### 3. Update Ruby + +NOTE: GitLab 9.0 and higher only support Ruby 2.3.x and dropped support for Ruby 2.1.x. Be +sure to upgrade your interpreter if necessary. + +You can check which version you are running with `ruby -v`. + +Download and compile Ruby: + +```bash +mkdir /tmp/ruby && cd /tmp/ruby +curl --remote-name --progress https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.6.tar.gz +echo '4e6a0f828819e15d274ae58485585fc8b7caace0 ruby-2.3.6.tar.gz' | shasum -c - && tar xzf ruby-2.3.6.tar.gz +cd ruby-2.3.6 +./configure --disable-install-rdoc +make +sudo make install +``` + +Install Bundler: + +```bash +sudo gem install bundler --no-ri --no-rdoc +``` + +### 4. Update Node + +GitLab now runs [webpack](http://webpack.js.org) to compile frontend assets. +We require a minimum version of node v6.0.0. + +You can check which version you are running with `node -v`. If you are running +a version older than `v6.0.0` you will need to update to a newer version. You +can find instructions to install from community maintained packages or compile +from source at the nodejs.org website. + + + +Since 8.17, GitLab requires the use of yarn `>= v0.17.0` to manage +JavaScript dependencies. + +```bash +curl --silent --show-error https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - +echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list +sudo apt-get update +sudo apt-get install yarn +``` + +More information can be found on the [yarn website](https://yarnpkg.com/en/docs/install). + +### 5. Update Go + +NOTE: GitLab 9.2 and higher only supports Go 1.8.3 and dropped support for Go +1.5.x through 1.7.x. Be sure to upgrade your installation if necessary. + +You can check which version you are running with `go version`. + +Download and install Go: + +```bash +# Remove former Go installation folder +sudo rm -rf /usr/local/go + +curl --remote-name --progress https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz +echo '1862f4c3d3907e59b04a757cfda0ea7aa9ef39274af99a784f5be843c80c6772 go1.8.3.linux-amd64.tar.gz' | shasum -a256 -c - && \ + sudo tar -C /usr/local -xzf go1.8.3.linux-amd64.tar.gz +sudo ln -sf /usr/local/go/bin/{go,godoc,gofmt} /usr/local/bin/ +rm go1.8.3.linux-amd64.tar.gz +``` + +### 6. Get latest code + +```bash +cd /home/git/gitlab + +sudo -u git -H git fetch --all +sudo -u git -H git checkout -- db/schema.rb # local changes will be restored automatically +sudo -u git -H git checkout -- locale +``` + +For GitLab Community Edition: + +```bash +cd /home/git/gitlab + +sudo -u git -H git checkout 10-5-stable +``` + +OR + +For GitLab Enterprise Edition: + +```bash +cd /home/git/gitlab + +sudo -u git -H git checkout 10-5-stable-ee +``` + +### 7. Update gitlab-shell + +```bash +cd /home/git/gitlab-shell + +sudo -u git -H git fetch --all --tags +sudo -u git -H git checkout v$( Date: Thu, 8 Feb 2018 13:22:47 +0000 Subject: 10.5 Update the .gitignore, .gitlab-ci.yml, and Dockerfile templates --- vendor/gitignore/Android.gitignore | 7 ++++++ vendor/gitignore/Dart.gitignore | 1 + vendor/gitignore/Global/JetBrains.gitignore | 3 +-- vendor/gitignore/Python.gitignore | 1 + vendor/gitignore/ROS.gitignore | 2 ++ vendor/gitignore/TeX.gitignore | 1 + vendor/gitignore/VisualStudio.gitignore | 1 + vendor/gitlab-ci-yml/Auto-DevOps.gitlab-ci.yml | 32 ++++++++++++++++++++++---- 8 files changed, 42 insertions(+), 6 deletions(-) diff --git a/vendor/gitignore/Android.gitignore b/vendor/gitignore/Android.gitignore index addf405e4f5..d57137223ed 100644 --- a/vendor/gitignore/Android.gitignore +++ b/vendor/gitignore/Android.gitignore @@ -54,3 +54,10 @@ google-services.json freeline.py freeline/ freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md diff --git a/vendor/gitignore/Dart.gitignore b/vendor/gitignore/Dart.gitignore index 4d2a4d6db7c..58950beb4fa 100644 --- a/vendor/gitignore/Dart.gitignore +++ b/vendor/gitignore/Dart.gitignore @@ -1,6 +1,7 @@ # See https://www.dartlang.org/tools/private-files.html # Files and directories created by pub +.dart_tool/ .packages .pub/ build/ diff --git a/vendor/gitignore/Global/JetBrains.gitignore b/vendor/gitignore/Global/JetBrains.gitignore index a30eacf1d98..9c01e12b050 100644 --- a/vendor/gitignore/Global/JetBrains.gitignore +++ b/vendor/gitignore/Global/JetBrains.gitignore @@ -1,4 +1,4 @@ -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff: @@ -9,7 +9,6 @@ # Sensitive or high-churn files: .idea/**/dataSources/ .idea/**/dataSources.ids -.idea/**/dataSources.xml .idea/**/dataSources.local.xml .idea/**/sqlDataSources.xml .idea/**/dynamic.xml diff --git a/vendor/gitignore/Python.gitignore b/vendor/gitignore/Python.gitignore index af2f537516d..b989be6ca15 100644 --- a/vendor/gitignore/Python.gitignore +++ b/vendor/gitignore/Python.gitignore @@ -45,6 +45,7 @@ nosetests.xml coverage.xml *.cover .hypothesis/ +.pytest_cache/ # Translations *.mo diff --git a/vendor/gitignore/ROS.gitignore b/vendor/gitignore/ROS.gitignore index 425641f2c3a..35d74bb771f 100644 --- a/vendor/gitignore/ROS.gitignore +++ b/vendor/gitignore/ROS.gitignore @@ -13,6 +13,8 @@ msg/*Feedback.msg msg/*Goal.msg msg/*Result.msg msg/_*.py +build_isolated/ +devel_isolated/ # Generated by dynamic reconfigure *.cfgc diff --git a/vendor/gitignore/TeX.gitignore b/vendor/gitignore/TeX.gitignore index 9bb63365618..5359e544bcf 100644 --- a/vendor/gitignore/TeX.gitignore +++ b/vendor/gitignore/TeX.gitignore @@ -10,6 +10,7 @@ *.fot *.cb *.cb2 +.*.lb ## Intermediate documents: *.dvi diff --git a/vendor/gitignore/VisualStudio.gitignore b/vendor/gitignore/VisualStudio.gitignore index d3d5371b415..c49041ff7d2 100644 --- a/vendor/gitignore/VisualStudio.gitignore +++ b/vendor/gitignore/VisualStudio.gitignore @@ -237,6 +237,7 @@ _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML UpgradeLog*.htm +ServiceFabricBackup/ # SQL Server files *.mdf diff --git a/vendor/gitlab-ci-yml/Auto-DevOps.gitlab-ci.yml b/vendor/gitlab-ci-yml/Auto-DevOps.gitlab-ci.yml index b2439d96e00..094d6791505 100644 --- a/vendor/gitlab-ci-yml/Auto-DevOps.gitlab-ci.yml +++ b/vendor/gitlab-ci-yml/Auto-DevOps.gitlab-ci.yml @@ -110,12 +110,15 @@ performance: kubernetes: active sast: - image: registry.gitlab.com/gitlab-org/gl-sast:latest + image: docker:latest variables: - POSTGRES_DB: "false" + DOCKER_DRIVER: overlay2 allow_failure: true + services: + - docker:dind script: - - sast . + - setup_docker + - sast artifacts: paths: [gl-sast-report.json] @@ -285,6 +288,12 @@ production: export TILLER_NAMESPACE=$KUBE_NAMESPACE function sast_container() { + if [[ -n "$CI_REGISTRY_USER" ]]; then + echo "Logging to GitLab Container Registry with CI credentials..." + docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" + echo "" + fi + docker run -d --name db arminc/clair-db:latest docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.1 apk add -U wget ca-certificates @@ -309,7 +318,12 @@ production: function sast() { case "$CI_SERVER_VERSION" in *-ee) - /app/bin/run "$@" + # Extract "MAJOR.MINOR" from CI_SERVER_VERSION and generate "MAJOR-MINOR-stable" + SAST_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') + + docker run --volume "$PWD:/code" \ + --volume /var/run/docker.sock:/var/run/docker.sock \ + "registry.gitlab.com/gitlab-org/security-products/sast:$SAST_VERSION" /app/bin/run /code ;; *) echo "GitLab EE is required" @@ -346,6 +360,12 @@ production: replicas="$new_replicas" fi + if [[ "$CI_PROJECT_VISIBILITY" != "public" ]]; then + secret_name='gitlab-registry' + else + secret_name='' + fi + helm upgrade --install \ --wait \ --set service.enabled="$service_enabled" \ @@ -353,6 +373,7 @@ production: --set image.repository="$CI_APPLICATION_REPOSITORY" \ --set image.tag="$CI_APPLICATION_TAG" \ --set image.pullPolicy=IfNotPresent \ + --set image.secrets[0].name="$secret_name" \ --set application.track="$track" \ --set application.database_url="$DATABASE_URL" \ --set service.url="$CI_ENVIRONMENT_URL" \ @@ -482,6 +503,9 @@ production: function create_secret() { echo "Create secret..." + if [[ "$CI_PROJECT_VISIBILITY" == "public" ]]; then + return + fi kubectl create secret -n "$KUBE_NAMESPACE" \ docker-registry gitlab-registry \ -- cgit v1.2.1 From 91b9488ff76dbc22d68dacf4e63cdaa0d730f82e Mon Sep 17 00:00:00 2001 From: Mark Fletcher Date: Thu, 8 Feb 2018 13:46:36 +0000 Subject: 10.5 Update the dependencies license list --- vendor/licenses.csv | 1268 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 1259 insertions(+), 9 deletions(-) diff --git a/vendor/licenses.csv b/vendor/licenses.csv index e3ccf080f74..8f127468e25 100644 --- a/vendor/licenses.csv +++ b/vendor/licenses.csv @@ -1,5 +1,22 @@ +@babel/code-frame,7.0.0-beta.32,MIT +@babel/helper-function-name,7.0.0-beta.32,MIT +@babel/helper-get-function-arity,7.0.0-beta.32,MIT +@babel/template,7.0.0-beta.32,MIT +@babel/traverse,7.0.0-beta.32,MIT +@babel/types,7.0.0-beta.32,MIT +@gitlab-org/gitlab-svgs,1.8.0,SEE LICENSE IN LICENSE +@types/jquery,2.0.48,MIT +JSONStream,1.3.2,MIT RedCloth,4.3.2,MIT +abbrev,1.0.9,ISC +accepts,1.3.3,MIT ace-rails-ap,4.1.2,MIT +acorn,3.3.0,MIT +acorn,4.0.13,MIT +acorn,5.1.1,MIT +acorn,5.3.0,MIT +acorn-dynamic-import,2.0.2,MIT +acorn-jsx,3.0.1,MIT actionmailer,4.2.10,MIT actionpack,4.2.10,MIT actionview,4.2.10,MIT @@ -9,70 +26,518 @@ activerecord,4.2.10,MIT activesupport,4.2.10,MIT acts-as-taggable-on,4.0.0,MIT addressable,2.5.2,Apache 2.0 +addressparser,1.0.1,MIT +after,0.8.2,MIT +agent-base,2.1.1,MIT +ajv,4.11.8,MIT +ajv,5.2.2,MIT +ajv,5.5.2,MIT +ajv-keywords,1.5.1,MIT +ajv-keywords,2.1.0,MIT akismet,2.0.0,MIT +align-text,0.1.4,MIT allocations,1.0.5,MIT +alphanum-sort,1.0.2,MIT +amdefine,1.0.1,BSD-3-Clause OR MIT +ansi-escapes,1.4.0,MIT +ansi-html,0.0.5,"Apache, Version 2.0" +ansi-html,0.0.7,Apache 2.0 +ansi-regex,2.1.1,MIT +ansi-regex,3.0.0,MIT +ansi-styles,2.2.1,MIT +ansi-styles,3.2.0,MIT +anymatch,1.3.2,ISC +append-transform,0.4.0,MIT +aproba,1.1.2,ISC +are-we-there-yet,1.1.4,ISC arel,6.0.4,MIT +argparse,1.0.9,MIT +arr-diff,2.0.0,MIT +arr-flatten,1.0.1,MIT +array-filter,0.0.1,MIT +array-find,1.0.0,MIT +array-find-index,1.0.2,MIT +array-flatten,1.1.1,MIT +array-flatten,2.1.1,MIT +array-map,0.0.0,MIT +array-reduce,0.0.0,MIT +array-slice,0.2.3,MIT +array-union,1.0.2,MIT +array-uniq,1.0.3,MIT +array-unique,0.2.1,MIT +arraybuffer.slice,0.0.7,MIT +arrify,1.0.1,MIT asana,0.6.0,MIT asciidoctor,1.5.3,MIT asciidoctor-plantuml,0.0.7,MIT +asn1,0.2.3,MIT +asn1.js,4.9.1,MIT +assert,1.4.1,MIT +assert-plus,0.2.0,MIT +assert-plus,1.0.0,MIT asset_sync,2.2.0,MIT +ast-types,0.10.1,MIT +astw,2.2.0,MIT +async,0.9.2,MIT +async,1.5.2,MIT +async,2.1.5,MIT +async,2.4.1,MIT +async-each,1.0.1,MIT +async-limiter,1.0.0,MIT +asynckit,0.4.0,MIT atomic,1.1.99,Apache 2.0 attr_encrypted,3.0.3,MIT attr_required,1.0.0,MIT +autoprefixer,6.7.7,MIT autoprefixer-rails,6.2.3,MIT +autosize,4.0.0,MIT +aws-sign2,0.6.0,Apache 2.0 +aws-sign2,0.7.0,Apache 2.0 +aws4,1.6.0,MIT axiom-types,0.1.1,MIT +axios,0.15.3,MIT +axios,0.17.1,MIT +axios-mock-adapter,1.10.0,MIT +babel-code-frame,6.26.0,MIT +babel-core,6.26.0,MIT +babel-eslint,8.0.2,MIT +babel-generator,6.26.0,MIT +babel-helper-bindify-decorators,6.24.1,MIT +babel-helper-builder-binary-assignment-operator-visitor,6.24.1,MIT +babel-helper-call-delegate,6.24.1,MIT +babel-helper-define-map,6.26.0,MIT +babel-helper-explode-assignable-expression,6.24.1,MIT +babel-helper-explode-class,6.24.1,MIT +babel-helper-function-name,6.24.1,MIT +babel-helper-get-function-arity,6.24.1,MIT +babel-helper-hoist-variables,6.24.1,MIT +babel-helper-optimise-call-expression,6.24.1,MIT +babel-helper-regex,6.26.0,MIT +babel-helper-remap-async-to-generator,6.24.1,MIT +babel-helper-replace-supers,6.24.1,MIT +babel-helpers,6.24.1,MIT +babel-loader,7.1.2,MIT +babel-messages,6.23.0,MIT +babel-plugin-check-es2015-constants,6.22.0,MIT +babel-plugin-istanbul,4.1.5,New BSD +babel-plugin-syntax-async-functions,6.13.0,MIT +babel-plugin-syntax-async-generators,6.13.0,MIT +babel-plugin-syntax-class-properties,6.13.0,MIT +babel-plugin-syntax-decorators,6.13.0,MIT +babel-plugin-syntax-dynamic-import,6.18.0,MIT +babel-plugin-syntax-exponentiation-operator,6.13.0,MIT +babel-plugin-syntax-object-rest-spread,6.13.0,MIT +babel-plugin-syntax-trailing-function-commas,6.22.0,MIT +babel-plugin-transform-async-generator-functions,6.24.1,MIT +babel-plugin-transform-async-to-generator,6.24.1,MIT +babel-plugin-transform-class-properties,6.24.1,MIT +babel-plugin-transform-decorators,6.24.1,MIT +babel-plugin-transform-define,1.3.0,MIT +babel-plugin-transform-es2015-arrow-functions,6.22.0,MIT +babel-plugin-transform-es2015-block-scoped-functions,6.22.0,MIT +babel-plugin-transform-es2015-block-scoping,6.26.0,MIT +babel-plugin-transform-es2015-classes,6.24.1,MIT +babel-plugin-transform-es2015-computed-properties,6.24.1,MIT +babel-plugin-transform-es2015-destructuring,6.23.0,MIT +babel-plugin-transform-es2015-duplicate-keys,6.24.1,MIT +babel-plugin-transform-es2015-for-of,6.23.0,MIT +babel-plugin-transform-es2015-function-name,6.24.1,MIT +babel-plugin-transform-es2015-literals,6.22.0,MIT +babel-plugin-transform-es2015-modules-amd,6.24.1,MIT +babel-plugin-transform-es2015-modules-commonjs,6.26.0,MIT +babel-plugin-transform-es2015-modules-systemjs,6.24.1,MIT +babel-plugin-transform-es2015-modules-umd,6.24.1,MIT +babel-plugin-transform-es2015-object-super,6.24.1,MIT +babel-plugin-transform-es2015-parameters,6.24.1,MIT +babel-plugin-transform-es2015-shorthand-properties,6.24.1,MIT +babel-plugin-transform-es2015-spread,6.22.0,MIT +babel-plugin-transform-es2015-sticky-regex,6.24.1,MIT +babel-plugin-transform-es2015-template-literals,6.22.0,MIT +babel-plugin-transform-es2015-typeof-symbol,6.23.0,MIT +babel-plugin-transform-es2015-unicode-regex,6.24.1,MIT +babel-plugin-transform-exponentiation-operator,6.24.1,MIT +babel-plugin-transform-object-rest-spread,6.23.0,MIT +babel-plugin-transform-regenerator,6.26.0,MIT +babel-plugin-transform-strict-mode,6.24.1,MIT +babel-preset-es2015,6.24.1,MIT +babel-preset-es2016,6.24.1,MIT +babel-preset-es2017,6.24.1,MIT +babel-preset-latest,6.24.1,MIT +babel-preset-stage-2,6.24.1,MIT +babel-preset-stage-3,6.24.1,MIT +babel-register,6.26.0,MIT +babel-runtime,6.26.0,MIT +babel-template,6.26.0,MIT +babel-traverse,6.26.0,MIT +babel-types,6.26.0,MIT babosa,1.0.2,MIT +babylon,6.18.0,MIT +babylon,7.0.0-beta.32,MIT +backo2,1.0.2,MIT +balanced-match,0.4.2,MIT +balanced-match,1.0.0,MIT base32,0.3.2,MIT +base64-arraybuffer,0.1.5,MIT +base64-js,1.2.0,MIT +base64id,1.0.0,MIT +batch,0.6.1,MIT batch-loader,1.2.1,MIT bcrypt,3.1.11,MIT +bcrypt-pbkdf,1.0.1,New BSD bcrypt_pbkdf,1.0.0,MIT +better-assert,1.0.2,MIT +big.js,3.1.3,MIT +binary-extensions,1.10.0,MIT bindata,2.4.1,ruby +bl,1.1.2,MIT +blackst0ne-mermaid,7.1.0-fixed,MIT +blob,0.0.4,MIT* +block-stream,0.0.9,ISC +bluebird,2.11.0,MIT +bluebird,3.5.0,MIT +bn.js,4.11.6,MIT +body-parser,1.17.2,MIT +bonjour,3.5.0,MIT +boom,2.10.1,New BSD +boom,4.3.1,New BSD +boom,5.2.0,New BSD bootstrap-sass,3.3.6,MIT bootstrap_form,2.7.0,MIT +brace-expansion,1.1.8,MIT +braces,0.1.5,MIT +braces,1.8.5,MIT +brorand,1.0.7,MIT browser,2.2.0,MIT +browser-pack,6.0.2,MIT +browser-resolve,1.11.2,MIT +browserify,14.5.0,MIT +browserify-aes,1.0.6,MIT +browserify-cipher,1.0.0,MIT +browserify-des,1.0.0,MIT +browserify-rsa,4.0.1,MIT +browserify-sign,4.0.0,ISC +browserify-zlib,0.1.4,MIT +browserify-zlib,0.2.0,MIT +browserslist,1.7.7,MIT +buffer,4.9.1,MIT +buffer,5.0.8,MIT +buffer-indexof,1.1.0,MIT +buffer-xor,1.0.3,MIT builder,3.2.3,MIT +buildmail,4.0.1,MIT +builtin-modules,1.1.1,MIT +builtin-status-codes,3.0.0,MIT +bytes,2.4.0,MIT +bytes,2.5.0,MIT +bytes,3.0.0,MIT +cached-path-relative,1.0.1,MIT +caller-path,0.1.0,MIT +callsite,1.0.0,MIT* +callsites,0.2.0,MIT +camelcase,1.2.1,MIT +camelcase,2.1.1,MIT +camelcase,3.0.0,MIT +camelcase,4.1.0,MIT +camelcase-keys,2.1.0,MIT +caniuse-api,1.6.1,MIT +caniuse-db,1.0.30000649,CC-BY-4.0 carrierwave,1.2.1,MIT +caseless,0.11.0,Apache 2.0 +caseless,0.12.0,Apache 2.0 cause,0.1,MIT +center-align,0.1.3,MIT +chalk,1.1.3,MIT +chalk,2.3.0,MIT charlock_holmes,0.7.5,MIT +chokidar,1.7.0,MIT chronic,0.10.2,MIT chronic_duration,0.10.6,MIT chunky_png,1.3.5,MIT +cipher-base,1.0.3,MIT +circular-json,0.3.3,MIT +circular-json,0.4.0,MIT citrus,3.0.2,MIT +clap,1.1.3,MIT +classlist-polyfill,1.2.0,Unlicense +cli-cursor,1.0.2,MIT +cli-width,2.1.0,ISC +clipboard,1.7.1,MIT +cliui,2.1.0,ISC +cliui,3.2.0,ISC +clone,1.0.2,MIT +co,3.0.6,MIT +co,4.6.0,MIT +coa,1.0.1,MIT +code-point-at,1.1.0,MIT coercible,1.0.0,MIT +color,0.11.4,MIT +color-convert,1.9.1,MIT +color-name,1.1.2,MIT +color-string,0.3.0,MIT +colormin,1.1.2,MIT +colors,1.1.2,MIT +combine-lists,1.0.1,MIT +combine-source-map,0.7.2,MIT +combined-stream,1.0.5,MIT +commander,2.9.0,MIT +commondir,1.0.1,MIT +component-bind,1.0.0,MIT* +component-emitter,1.2.1,MIT +component-inherit,0.0.3,MIT* +compressible,2.0.11,MIT +compression,1.7.0,MIT +compression-webpack-plugin,1.0.0,MIT +concat-map,0.0.1,MIT +concat-stream,1.5.2,MIT +concat-stream,1.6.0,MIT concurrent-ruby-ext,1.0.5,MIT +configstore,1.4.0,Simplified BSD +connect,3.6.3,MIT +connect-history-api-fallback,1.3.0,MIT connection_pool,2.2.1,MIT +console-browserify,1.1.0,MIT +console-control-strings,1.1.0,ISC +consolidate,0.14.5,MIT +constants-browserify,1.0.0,MIT +contains-path,0.1.0,MIT +content-disposition,0.5.2,MIT +content-type,1.0.2,MIT +convert-source-map,1.1.3,MIT +convert-source-map,1.5.0,MIT +cookie,0.3.1,MIT +cookie-signature,1.0.6,MIT +copy-webpack-plugin,4.0.1,MIT +core-js,2.3.0,MIT +core-js,2.4.1,MIT +core-js,2.5.1,MIT +core-util-is,1.0.2,MIT +cosmiconfig,2.1.1,MIT crack,0.4.3,MIT +create-ecdh,4.0.0,MIT +create-hash,1.1.2,MIT +create-hmac,1.1.4,MIT creole,0.5.0,ruby +cropper,2.3.0,MIT +cross-spawn,5.1.0,MIT +cryptiles,2.0.5,New BSD +cryptiles,3.1.2,New BSD +crypto-browserify,3.11.0,MIT +crypto-browserify,3.12.0,MIT +css-color-names,0.0.4,MIT +css-loader,0.28.0,MIT +css-selector-tokenizer,0.6.0,MIT +css-selector-tokenizer,0.7.0,MIT css_parser,1.5.0,MIT +cssesc,0.1.0,MIT +cssnano,3.10.0,MIT +csso,2.3.2,MIT +currently-unhandled,0.4.1,MIT +custom-event,1.0.1,MIT +d,0.1.1,MIT +d,1.0.0,MIT +d3,3.5.17,New BSD +d3-array,1.2.1,New BSD +d3-axis,1.0.8,New BSD +d3-brush,1.0.4,New BSD +d3-collection,1.0.4,New BSD +d3-color,1.0.3,New BSD +d3-dispatch,1.0.3,New BSD +d3-drag,1.2.1,New BSD +d3-ease,1.0.3,New BSD +d3-format,1.2.1,New BSD +d3-interpolate,1.1.6,New BSD +d3-path,1.0.5,New BSD +d3-scale,1.0.7,New BSD +d3-selection,1.2.0,New BSD +d3-shape,1.2.0,New BSD +d3-time,1.0.8,New BSD +d3-time-format,2.1.1,New BSD +d3-timer,1.0.7,New BSD +d3-transition,1.1.1,New BSD d3_rails,3.5.11,MIT +dagre-d3-renderer,0.4.24,MIT +dagre-layout,0.8.0,MIT +dashdash,1.14.1,MIT +data-uri-to-buffer,1.2.0,MIT +date-format,1.2.0,MIT +date-now,0.1.4,MIT +de-indent,1.0.2,MIT +debug,2.2.0,MIT +debug,2.6.7,MIT +debug,2.6.8,MIT +debug,2.6.9,MIT +debug,3.1.0,MIT debugger-ruby_core_source,1.3.8,MIT +decamelize,1.2.0,MIT deckar01-task_list,2.0.0,MIT declarative,0.0.10,MIT declarative-option,0.1.0,MIT +decompress-response,3.3.0,MIT +deep-equal,1.0.1,MIT +deep-extend,0.4.2,MIT +deep-is,0.1.3,MIT +default-require-extensions,1.0.0,MIT default_value_for,3.0.2,MIT +define-properties,1.1.2,MIT +defined,1.0.0,MIT +degenerator,1.0.4,MIT +del,2.2.2,MIT +del,3.0.0,MIT +delayed-stream,1.0.0,MIT +delegate,3.1.2,MIT +delegates,1.0.0,MIT +depd,1.1.0,MIT +depd,1.1.1,MIT +deps-sort,2.0.0,MIT +des.js,1.0.0,MIT descendants_tracker,0.0.4,MIT +destroy,1.0.4,MIT +detect-indent,4.0.0,MIT +detect-node,2.0.3,ISC +detective,4.7.1,MIT devise,4.2.0,MIT devise-two-factor,3.0.0,MIT +di,0.0.1,MIT +diff,3.4.0,New BSD diff-lcs,1.3,"MIT,Artistic-2.0,GPL-2.0+" +diffie-hellman,5.0.2,MIT diffy,3.1.0,MIT +dns-equal,1.0.0,MIT +dns-packet,1.2.2,MIT +dns-txt,2.0.2,MIT +doctrine,1.5.0,Simplified BSD +doctrine,2.0.0,Apache 2.0 +document-register-element,1.3.0,MIT +dom-serialize,2.2.1,MIT +dom-serializer,0.1.0,MIT +domain-browser,1.1.7,MIT domain_name,0.5.20161021,"Simplified BSD,New BSD,Mozilla Public License 2.0" +domelementtype,1.1.3,Simplified BSD +domelementtype,1.3.0,Simplified BSD +domhandler,2.4.1,Simplified BSD +domutils,1.6.2,Simplified BSD doorkeeper,4.2.6,MIT doorkeeper-openid_connect,1.2.0,MIT +double-ended-queue,2.1.0-0,MIT +dropzone,4.2.0,MIT dropzonejs-rails,0.7.2,MIT +duplexer,0.1.1,MIT +duplexer2,0.1.4,New BSD +duplexer3,0.1.4,New BSD +duplexify,3.5.1,MIT +ecc-jsbn,0.1.1,MIT +ee-first,1.1.1,MIT +ejs,2.5.6,Apache 2.0 +electron-to-chromium,1.3.3,ISC +elliptic,6.3.3,MIT email_reply_trimmer,0.1.6,MIT +emoji-unicode-version,0.2.1,MIT +emojis-list,2.1.0,MIT +encodeurl,1.0.1,MIT encryptor,3.0.0,MIT +end-of-stream,1.4.0,MIT +engine.io,3.1.4,MIT +engine.io-client,3.1.4,MIT +engine.io-parser,2.1.2,MIT +enhanced-resolve,0.9.1,MIT +enhanced-resolve,3.4.1,MIT +ent,2.2.0,MIT +entities,1.1.1,Simplified BSD equalizer,0.0.11,MIT +errno,0.1.4,MIT +error-ex,1.3.0,MIT erubis,2.7.0,MIT +es-abstract,1.8.2,MIT +es-to-primitive,1.1.1,MIT +es5-ext,0.10.24,MIT +es6-iterator,2.0.1,MIT +es6-map,0.1.5,MIT +es6-promise,3.0.2,MIT +es6-set,0.1.5,MIT +es6-symbol,3.1.1,MIT +es6-weak-map,2.0.1,MIT +escape-html,1.0.3,MIT +escape-string-regexp,1.0.5,MIT escape_utils,1.1.1,MIT +escodegen,1.8.1,Simplified BSD +escodegen,1.9.0,Simplified BSD +escope,3.6.0,Simplified BSD +eslint,3.19.0,MIT +eslint-config-airbnb-base,10.0.1,MIT +eslint-import-resolver-node,0.2.3,MIT +eslint-import-resolver-webpack,0.8.3,MIT +eslint-module-utils,2.0.0,MIT +eslint-plugin-filenames,1.1.0,MIT +eslint-plugin-html,2.0.1,ISC +eslint-plugin-import,2.2.0,MIT +eslint-plugin-jasmine,2.2.0,MIT +eslint-plugin-promise,3.5.0,ISC +eslint-plugin-vue,4.0.1,MIT +eslint-scope,3.7.1,Simplified BSD +eslint-visitor-keys,1.0.0,Apache 2.0 +espree,3.5.0,Simplified BSD +espree,3.5.2,Simplified BSD +esprima,2.7.3,Simplified BSD +esprima,3.1.3,Simplified BSD +esprima,4.0.0,Simplified BSD +esquery,1.0.0,New BSD +esrecurse,4.1.0,Simplified BSD +estraverse,1.9.3,Simplified BSD +estraverse,4.1.1,Simplified BSD +estraverse,4.2.0,Simplified BSD +esutils,2.0.2,Simplified BSD et-orbi,1.0.3,MIT +etag,1.8.0,MIT +eve-raphael,0.5.0,Apache 2.0 +event-emitter,0.3.5,MIT +event-stream,3.3.4,MIT +eventemitter3,1.2.0,MIT +events,1.1.1,MIT +eventsource,0.1.6,MIT +evp_bytestokey,1.0.0,MIT excon,0.57.1,MIT +execa,0.7.0,MIT execjs,2.6.0,MIT +exit-hook,1.1.1,MIT +expand-braces,0.1.2,MIT +expand-brackets,0.1.5,MIT +expand-range,0.1.1,MIT +expand-range,1.8.2,MIT +exports-loader,0.6.4,MIT +express,4.15.4,MIT expression_parser,0.9.0,MIT +extend,3.0.1,MIT +extglob,0.3.2,MIT +extsprintf,1.3.0,MIT faraday,0.12.2,MIT faraday_middleware,0.11.0.1,MIT faraday_middleware-multi_json,0.0.6,MIT +fast-deep-equal,1.0.0,MIT +fast-json-stable-stringify,2.0.0,MIT +fast-levenshtein,2.0.6,MIT +fast_blank,1.0.0,MIT fast_gettext,1.4.0,"MIT,ruby" +fastparse,1.1.1,MIT +faye-websocket,0.10.0,MIT +faye-websocket,0.11.1,MIT +faye-websocket,0.7.3,MIT ffi,1.9.18,New BSD +figures,1.7.0,MIT +file-entry-cache,2.0.0,MIT +file-loader,0.11.1,MIT +file-uri-to-path,1.0.0,MIT +filename-regex,2.0.0,MIT +fileset,2.0.3,MIT +filesize,3.3.0,New BSD +filesize,3.5.10,New BSD +fill-range,2.2.3,MIT +finalhandler,1.0.4,MIT +find-cache-dir,1.0.0,MIT +find-root,0.1.2,MIT +find-up,1.1.2,MIT +find-up,2.1.0,MIT +flat-cache,1.2.2,MIT +flatten,1.0.2,MIT flipper,0.11.0,MIT flipper-active_record,0.11.0,MIT flipper-active_support_cache_store,0.11.0,MIT @@ -86,93 +551,452 @@ fog-local,0.3.1,MIT fog-openstack,0.1.21,MIT fog-rackspace,0.1.1,MIT fog-xml,0.1.3,MIT +follow-redirects,1.0.0,MIT +follow-redirects,1.2.6,MIT font-awesome-rails,4.7.0.1,"MIT,SIL Open Font License" +for-each,0.3.2,MIT +for-in,0.1.6,MIT +for-own,0.1.4,MIT +foreach,2.0.5,MIT +forever-agent,0.6.1,Apache 2.0 +form-data,2.0.0,MIT +form-data,2.1.4,MIT +form-data,2.3.1,MIT formatador,0.2.5,MIT +forwarded,0.1.0,MIT +fresh,0.5.0,MIT +from,0.1.7,MIT +fs-access,1.0.1,MIT +fs-extra,0.26.7,MIT +fs.realpath,1.0.0,ISC +fsevents,1.1.2,MIT +fstream,1.0.11,ISC +fstream-ignore,1.0.5,ISC +ftp,0.3.10,MIT +function-bind,1.1.0,MIT +function-bind,1.1.1,MIT +fuzzaldrin-plus,0.5.0,MIT +gauge,2.7.4,ISC gemnasium-gitlab-service,0.2.6,MIT gemojione,3.3.0,MIT +generate-function,2.0.0,MIT +generate-object-property,1.2.0,MIT +get-caller-file,1.0.2,ISC +get-stdin,4.0.1,MIT +get-stream,3.0.0,MIT +get-uri,2.0.1,MIT get_process_mem,0.2.0,MIT +getpass,0.1.7,MIT gettext_i18n_rails,1.8.0,MIT gettext_i18n_rails_js,1.2.0,MIT -gitaly-proto,0.64.0,MIT +gitaly-proto,0.84.0,MIT github-linguist,4.7.6,MIT github-markup,1.6.1,MIT gitlab-flowdock-git-hook,1.0.1,MIT gitlab-grit,2.8.2,MIT gitlab-markup,1.6.3,MIT gitlab_omniauth-ldap,2.0.4,MIT +glob,5.0.15,ISC +glob,6.0.4,ISC +glob,7.1.1,ISC +glob,7.1.2,ISC +glob-base,0.3.0,MIT +glob-parent,2.0.0,ISC globalid,0.4.1,MIT +globals,10.4.0,MIT +globals,9.18.0,MIT +globby,5.0.0,MIT +globby,6.1.0,MIT gollum-grit_adapter,1.0.1,MIT gollum-lib,4.2.7,MIT gollum-rugged_adapter,0.4.4,MIT gon,6.1.0,MIT +good-listener,1.2.2,MIT google-api-client,0.13.6,Apache 2.0 -google-protobuf,3.4.1.1,New BSD +google-protobuf,3.5.1,New BSD +googleapis-common-protos-types,1.0.1,Apache 2.0 googleauth,0.5.3,Apache 2.0 +got,3.3.1,MIT +got,7.1.0,MIT gpgme,2.0.13,LGPL-2.1+ +graceful-fs,4.1.11,ISC +graceful-readlink,1.0.1,MIT grape,1.0.0,MIT grape-entity,0.6.0,MIT grape-route-helpers,2.1.0,MIT grape_logging,1.7.0,MIT -grpc,1.4.5,New BSD +graphlib,2.1.1,MIT +grpc,1.8.3,Apache 2.0 +gzip-size,3.0.0,MIT hamlit,2.6.1,MIT +handle-thing,1.2.5,MIT +handlebars,4.0.6,MIT +har-schema,1.0.5,ISC +har-schema,2.0.0,ISC +har-validator,2.0.6,ISC +har-validator,4.2.1,ISC +har-validator,5.0.3,ISC +has,1.0.1,MIT +has-ansi,2.0.0,MIT +has-binary2,1.0.2,MIT +has-cors,1.1.0,MIT +has-flag,1.0.0,MIT +has-flag,2.0.0,MIT +has-symbol-support-x,1.3.0,MIT +has-to-string-tag-x,1.3.0,MIT +has-unicode,2.0.1,ISC +hash-sum,1.0.2,MIT +hash.js,1.0.3,MIT hashie,3.5.6,MIT hashie-forbidden_attributes,0.1.1,MIT +hawk,3.1.3,New BSD +hawk,6.0.2,New BSD +he,1.1.1,MIT health_check,2.6.0,MIT hipchat,1.5.2,MIT +hipchat-notifier,1.1.0,MIT +hoek,2.16.3,New BSD +hoek,4.2.0,New BSD +home-or-tmp,2.0.0,MIT +hosted-git-info,2.2.0,ISC +hpack.js,2.1.6,MIT +html-comment-regex,1.1.1,MIT +html-entities,1.2.0,MIT html-pipeline,1.11.0,MIT html2text,0.2.0,MIT htmlentities,4.3.4,MIT +htmlescape,1.1.1,MIT +htmlparser2,3.9.2,MIT http,0.9.8,MIT http-cookie,1.0.3,MIT +http-deceiver,1.2.7,MIT +http-errors,1.6.1,MIT +http-errors,1.6.2,MIT http-form_data,1.0.1,MIT +http-proxy,1.16.2,MIT +http-proxy-agent,1.0.0,MIT +http-proxy-middleware,0.17.4,MIT +http-signature,1.1.1,MIT +http-signature,1.2.0,MIT http_parser.rb,0.6.0,MIT httparty,0.13.7,MIT httpclient,2.8.2,ruby +httpntlm,1.6.1,MIT +httpreq,0.4.24,MIT +https-browserify,0.0.1,MIT +https-browserify,1.0.0,MIT +https-proxy-agent,1.0.0,MIT i18n,0.9.1,MIT ice_nine,0.11.2,MIT +iconv-lite,0.4.15,MIT +iconv-lite,0.4.19,MIT +icss-replace-symbols,1.0.2,ISC +ieee754,1.1.8,New BSD +ignore,3.3.3,MIT +ignore-by-default,1.0.1,ISC +immediate,3.0.6,MIT +imports-loader,0.7.1,MIT +imurmurhash,0.1.4,MIT +indent-string,2.1.0,MIT +indexes-of,1.0.1,MIT +indexof,0.0.1,MIT* +infinity-agent,2.0.3,MIT +inflection,1.10.0,MIT +inflection,1.3.8,MIT +inflight,1.0.6,ISC influxdb,0.2.3,MIT +inherits,2.0.1,ISC +inherits,2.0.3,ISC +ini,1.3.4,ISC +inline-source-map,0.6.2,MIT +inquirer,0.12.0,MIT +insert-module-globals,7.0.1,MIT +internal-ip,1.2.0,MIT +interpret,1.0.1,MIT +invariant,2.2.2,New BSD +invert-kv,1.0.0,MIT +ip,1.0.1,MIT +ip,1.1.5,MIT +ipaddr.js,1.4.0,MIT ipaddress,0.8.3,MIT +is-absolute,0.2.6,MIT +is-absolute-url,2.1.0,MIT +is-arrayish,0.2.1,MIT +is-binary-path,1.0.1,MIT +is-buffer,1.1.5,MIT +is-buffer,1.1.6,MIT +is-builtin-module,1.0.0,MIT +is-callable,1.1.3,MIT +is-date-object,1.0.1,MIT +is-dotfile,1.0.2,MIT +is-equal-shallow,0.1.3,MIT +is-extendable,0.1.1,MIT +is-extglob,1.0.0,MIT +is-extglob,2.1.1,MIT +is-finite,1.0.2,MIT +is-fullwidth-code-point,1.0.0,MIT +is-fullwidth-code-point,2.0.0,MIT +is-function,1.0.1,MIT +is-glob,2.0.1,MIT +is-glob,3.1.0,MIT +is-my-json-valid,2.16.0,MIT +is-my-json-valid,2.17.1,MIT +is-npm,1.0.0,MIT +is-number,0.1.1,MIT +is-number,2.1.0,MIT +is-object,1.0.1,MIT +is-path-cwd,1.0.0,MIT +is-path-in-cwd,1.0.0,MIT +is-path-inside,1.0.0,MIT +is-plain-obj,1.1.0,MIT +is-posix-bracket,0.1.1,MIT +is-primitive,2.0.0,MIT +is-property,1.0.2,MIT +is-redirect,1.0.0,MIT +is-regex,1.0.4,MIT +is-relative,0.2.1,MIT +is-resolvable,1.0.0,MIT +is-retry-allowed,1.1.0,MIT +is-stream,1.1.0,MIT +is-svg,2.1.0,MIT +is-symbol,1.0.1,MIT +is-typedarray,1.0.0,MIT +is-unc-path,0.1.2,MIT +is-utf8,0.2.1,MIT +is-windows,0.2.0,MIT +isarray,0.0.1,MIT +isarray,1.0.0,MIT +isarray,2.0.1,MIT +isbinaryfile,3.0.2,MIT +isexe,1.1.2,ISC +isobject,2.1.0,MIT +isstream,0.1.2,MIT +istanbul,0.4.5,New BSD +istanbul-api,1.2.1,New BSD +istanbul-lib-coverage,1.1.1,New BSD +istanbul-lib-hook,1.1.0,New BSD +istanbul-lib-instrument,1.9.1,New BSD +istanbul-lib-report,1.1.2,New BSD +istanbul-lib-source-maps,1.2.2,New BSD +istanbul-reports,1.1.3,New BSD +isurl,1.0.0,MIT +jasmine-core,2.9.0,MIT +jasmine-jquery,2.1.1,MIT +jed,1.1.1,MIT jira-ruby,1.4.1,MIT +jquery,2.2.4,MIT jquery-atwho-rails,1.3.2,MIT jquery-rails,4.3.1,MIT +jquery-ujs,1.2.2,MIT +js-base64,2.1.9,New BSD +js-cookie,2.1.3,MIT +js-tokens,3.0.2,MIT +js-yaml,3.7.0,MIT +js-yaml,3.9.1,MIT +jsbn,0.1.1,MIT +jsesc,0.5.0,MIT +jsesc,1.3.0,MIT json,1.8.6,ruby json-jwt,1.7.2,MIT +json-loader,0.5.7,MIT +json-schema,0.2.3,BSD +json-schema-traverse,0.3.1,MIT +json-stable-stringify,0.0.1,MIT +json-stable-stringify,1.0.1,MIT +json-stringify-safe,5.0.1,ISC +json3,3.3.2,MIT +json5,0.5.1,MIT +jsonfile,2.4.0,MIT +jsonify,0.0.0,Public Domain +jsonparse,1.3.1,MIT +jsonpointer,4.0.1,MIT +jsprim,1.4.1,MIT +jszip,3.1.3,(MIT OR GPL-3.0) +jszip-utils,0.0.2,MIT or GPLv3 jwt,1.5.6,MIT kaminari,1.0.1,MIT kaminari-actionview,1.0.1,MIT kaminari-activerecord,1.0.1,MIT kaminari-core,1.0.1,MIT +karma,2.0.0,MIT +karma-chrome-launcher,2.2.0,MIT +karma-coverage-istanbul-reporter,1.3.3,MIT +karma-jasmine,1.1.1,MIT +karma-mocha-reporter,2.2.5,MIT +karma-sourcemap-loader,0.3.7,MIT +karma-webpack,2.0.7,MIT kgio,2.10.0,LGPL-2.1+ +kind-of,3.1.0,MIT +klaw,1.3.1,MIT kubeclient,2.2.0,MIT +labeled-stream-splicer,2.0.0,MIT +latest-version,1.0.1,MIT +lazy-cache,1.0.4,MIT +lcid,1.0.0,MIT +levn,0.3.0,MIT +lexical-scope,1.2.0,MIT +libbase64,0.1.0,MIT +libmime,3.0.0,MIT +libqp,1.1.0,MIT licensee,8.7.0,MIT +lie,3.1.1,MIT little-plugger,1.1.4,MIT +load-json-file,1.1.0,MIT +load-json-file,2.0.0,MIT +loader-runner,2.3.0,MIT +loader-utils,0.2.16,MIT +loader-utils,1.1.0,MIT locale,2.1.2,"ruby,LGPLv3+" +locate-path,2.0.0,MIT +lodash,3.10.1,MIT +lodash,4.17.4,MIT +lodash._baseassign,3.2.0,MIT +lodash._basecopy,3.0.1,MIT +lodash._baseget,3.7.2,MIT +lodash._bindcallback,3.0.1,MIT +lodash._createassigner,3.1.1,MIT +lodash._getnative,3.9.1,MIT +lodash._isiterateecall,3.0.9,MIT +lodash._topath,3.8.1,MIT +lodash.assign,3.2.0,MIT +lodash.camelcase,4.1.1,MIT +lodash.camelcase,4.3.0,MIT +lodash.capitalize,4.2.1,MIT +lodash.clonedeep,4.5.0,MIT +lodash.cond,4.5.2,MIT +lodash.deburr,4.1.0,MIT +lodash.defaults,3.1.2,MIT +lodash.escaperegexp,4.1.2,MIT +lodash.get,3.7.0,MIT +lodash.isarguments,3.1.0,MIT +lodash.isarray,3.0.4,MIT +lodash.kebabcase,4.0.1,MIT +lodash.keys,3.1.2,MIT +lodash.memoize,3.0.4,MIT +lodash.memoize,4.1.2,MIT +lodash.mergewith,4.6.0,MIT +lodash.restparam,3.6.1,MIT +lodash.snakecase,4.0.1,MIT +lodash.uniq,4.5.0,MIT +lodash.words,4.2.0,MIT +log-symbols,2.1.0,MIT +log4js,2.4.1,Apache 2.0 logging,2.2.2,MIT +loggly,1.1.1,MIT +loglevel,1.4.1,MIT lograge,0.5.1,MIT +longest,1.0.1,MIT loofah,2.0.3,MIT +loose-envify,1.3.1,MIT +loud-rejection,1.6.0,MIT +lowercase-keys,1.0.0,MIT +lru-cache,2.2.4,MIT +lru-cache,2.6.5,ISC +lru-cache,4.1.1,ISC +macaddress,0.2.8,MIT mail,2.7.0,MIT mail_room,0.9.1,MIT +mailcomposer,4.0.1,MIT +mailgun-js,0.7.15,MIT +make-dir,1.0.0,MIT +map-obj,1.0.1,MIT +map-stream,0.1.0,Unknown +marked,0.3.12,MIT +math-expression-evaluator,1.2.16,MIT +media-typer,0.3.0,MIT +mem,1.1.0,MIT memoist,0.16.0,MIT +memory-fs,0.2.0,MIT +memory-fs,0.4.1,MIT +meow,3.7.0,MIT +merge-descriptors,1.0.1,MIT method_source,0.8.2,MIT +methods,1.1.2,MIT +micromatch,2.3.11,MIT +miller-rabin,4.0.0,MIT +mime,1.3.4,MIT +mime,1.6.0,MIT +mime-db,1.27.0,MIT +mime-db,1.29.0,MIT +mime-db,1.30.0,MIT +mime-types,2.1.15,MIT +mime-types,2.1.17,MIT mime-types,3.1,MIT mime-types-data,3.2016.0521,MIT mimemagic,0.3.0,MIT +mimic-fn,1.1.0,MIT +mimic-response,1.0.0,MIT mini_mime,0.1.4,MIT mini_portile2,2.3.0,MIT +minimalistic-assert,1.0.0,ISC +minimatch,3.0.3,ISC +minimatch,3.0.4,ISC +minimist,0.0.8,MIT +minimist,1.2.0,MIT +mkdirp,0.5.1,MIT +module-deps,4.1.1,MIT +moment,2.19.2,MIT +monaco-editor,0.10.0,MIT +mousetrap,1.4.6,Apache 2.0 mousetrap-rails,1.4.6,"MIT,Apache" +ms,0.7.1,MIT +ms,2.0.0,MIT multi_json,1.12.2,MIT multi_xml,0.6.0,MIT +multicast-dns,6.1.1,MIT +multicast-dns-service-types,1.1.0,MIT multipart-post,2.0.0,MIT mustermann,1.0.0,MIT mustermann-grape,1.0.0,MIT +mute-stream,0.0.5,ISC mysql2,0.4.10,MIT +name-all-modules-plugin,1.0.1,MIT +nan,2.6.2,MIT +natural-compare,1.4.0,MIT +negotiator,0.6.1,MIT +nested-error-stacks,1.0.2,MIT net-ldap,0.16.0,MIT net-ssh,4.1.0,MIT +netmask,1.0.6,MIT netrc,0.11.0,MIT -nokogiri,1.8.1,MIT +node-dir,0.1.17,MIT +node-forge,0.6.33,New BSD +node-libs-browser,1.1.1,MIT +node-libs-browser,2.0.0,MIT +node-pre-gyp,0.6.37,New BSD +node-uuid,1.4.8,MIT +nodemailer,2.7.2,MIT +nodemailer-direct-transport,3.3.2,MIT +nodemailer-fetch,1.6.0,MIT +nodemailer-shared,1.1.0,MIT +nodemailer-smtp-pool,2.8.2,MIT +nodemailer-smtp-transport,2.7.2,MIT +nodemailer-wellknown,0.1.10,MIT +nodemon,1.11.0,MIT +nokogiri,1.8.2,MIT +nopt,1.0.10,MIT +nopt,3.0.6,ISC +nopt,4.0.1,ISC +normalize-package-data,2.4.0,Simplified BSD +normalize-path,2.1.1,MIT +normalize-range,0.1.2,MIT +normalize-url,1.9.1,MIT +npm-run-path,2.0.2,MIT +npmlog,4.1.2,ISC +null-check,1.0.0,MIT +num2fraction,1.2.2,MIT +number-is-nan,1.0.1,MIT numerizer,0.1.1,MIT oauth,0.5.1,MIT +oauth-sign,0.8.2,Apache 2.0 oauth2,1.4.0,MIT +object-assign,3.0.0,MIT +object-assign,4.1.1,MIT +object-component,0.0.3,MIT* +object-inspect,1.3.0,MIT +object-keys,1.0.11,MIT +object.omit,2.0.1,MIT +obuf,1.1.1,MIT octokit,4.6.2,MIT oj,2.17.5,MIT omniauth,1.4.2,MIT @@ -193,10 +1017,58 @@ omniauth-saml,1.7.0,MIT omniauth-shibboleth,1.2.1,MIT omniauth-twitter,1.2.1,MIT omniauth_crowd,2.2.3,MIT +on-finished,2.3.0,MIT +on-headers,1.0.1,MIT +once,1.4.0,ISC +onetime,1.1.0,MIT +opener,1.4.3,(WTFPL OR MIT) +opn,4.0.2,MIT +optimist,0.6.1,MIT +optionator,0.8.2,MIT org-ruby,0.9.12,MIT +original,1.0.0,MIT orm_adapter,0.5.0,MIT os,0.9.6,MIT -paranoia,2.3.1,MIT +os-browserify,0.2.1,MIT +os-browserify,0.3.0,MIT +os-homedir,1.0.2,MIT +os-locale,1.4.0,MIT +os-locale,2.1.0,MIT +os-tmpdir,1.0.2,MIT +osenv,0.1.4,ISC +p-cancelable,0.3.0,MIT +p-finally,1.0.0,MIT +p-limit,1.1.0,MIT +p-locate,2.0.0,MIT +p-map,1.1.1,MIT +p-timeout,1.2.0,MIT +pac-proxy-agent,1.1.0,MIT +pac-resolver,2.0.0,MIT +package-json,1.2.0,MIT +pako,0.2.9,MIT +pako,1.0.5,(MIT AND Zlib) +pako,1.0.6,(MIT AND Zlib) +parents,1.0.1,MIT +parse-asn1,5.0.0,ISC +parse-glob,3.0.4,MIT +parse-json,2.2.0,MIT +parseqs,0.0.5,MIT +parseuri,0.0.5,MIT +parseurl,1.3.1,MIT +path-browserify,0.0.0,MIT +path-exists,2.1.0,MIT +path-exists,3.0.0,MIT +path-is-absolute,1.0.1,MIT +path-is-inside,1.0.2,(WTFPL OR MIT) +path-key,2.0.1,MIT +path-parse,1.0.5,MIT +path-platform,0.11.15,MIT +path-proxy,1.0.0,MIT +path-to-regexp,0.1.7,MIT +path-type,1.1.0,MIT +path-type,2.0.0,MIT +pause-stream,0.0.11,Apache 2.0 +pbkdf2,3.0.9,MIT peek,1.0.1,MIT peek-gc,0.0.2,MIT peek-host,1.0.0,MIT @@ -206,18 +1078,98 @@ peek-pg,1.3.0,MIT peek-rblineprof,0.2.0,MIT peek-redis,1.2.0,MIT peek-sidekiq,1.0.3,MIT +performance-now,0.2.0,MIT +performance-now,2.1.0,MIT pg,0.18.4,"BSD,ruby,GPL" +pify,2.3.0,MIT +pify,3.0.0,MIT +pikaday,1.6.1,MIT +pinkie,2.0.4,MIT +pinkie-promise,2.0.1,MIT +pkg-dir,1.0.0,MIT +pkg-dir,2.0.0,MIT +pkg-up,1.0.0,MIT +pluralize,1.2.1,MIT po_to_json,1.0.1,MIT +portfinder,1.0.13,MIT posix-spawn,0.3.13,MIT +postcss,5.2.16,MIT +postcss,6.0.14,MIT +postcss,6.0.15,MIT +postcss-calc,5.3.1,MIT +postcss-colormin,2.2.2,MIT +postcss-convert-values,2.6.1,MIT +postcss-discard-comments,2.0.4,MIT +postcss-discard-duplicates,2.1.0,MIT +postcss-discard-empty,2.1.0,MIT +postcss-discard-overridden,0.1.1,MIT +postcss-discard-unused,2.2.3,MIT +postcss-filter-plugins,2.0.2,MIT +postcss-load-config,1.2.0,MIT +postcss-load-options,1.2.0,MIT +postcss-load-plugins,2.3.0,MIT +postcss-merge-idents,2.1.7,MIT +postcss-merge-longhand,2.0.2,MIT +postcss-merge-rules,2.1.2,MIT +postcss-message-helpers,2.0.0,MIT +postcss-minify-font-values,1.0.5,MIT +postcss-minify-gradients,1.0.5,MIT +postcss-minify-params,1.2.2,MIT +postcss-minify-selectors,2.1.1,MIT +postcss-modules-extract-imports,1.0.1,ISC +postcss-modules-local-by-default,1.1.1,MIT +postcss-modules-scope,1.0.2,ISC +postcss-modules-values,1.2.2,ISC +postcss-normalize-charset,1.1.1,MIT +postcss-normalize-url,3.0.8,MIT +postcss-ordered-values,2.2.3,MIT +postcss-reduce-idents,2.4.0,MIT +postcss-reduce-initial,1.0.1,MIT +postcss-reduce-transforms,1.0.4,MIT +postcss-selector-parser,2.2.3,MIT +postcss-svgo,2.1.6,MIT +postcss-unique-selectors,2.0.2,MIT +postcss-value-parser,3.3.0,MIT +postcss-zindex,2.2.0,MIT +prelude-ls,1.1.2,MIT premailer,1.10.4,New BSD premailer-rails,1.9.7,MIT -prometheus-client-mmap,0.7.0.beta44,Apache 2.0 +prepend-http,1.0.4,MIT +preserve,0.2.0,MIT +prettier,1.8.2,MIT +prettier,1.9.2,MIT +prismjs,1.6.0,MIT +private,0.1.8,MIT +process,0.11.9,MIT +process-nextick-args,1.0.7,MIT +progress,1.1.8,MIT +prometheus-client-mmap,0.9.1,Apache 2.0 +proxy-addr,1.1.5,MIT +proxy-agent,2.0.0,MIT +prr,0.0.0,MIT +ps-tree,1.1.0,MIT +pseudomap,1.0.2,ISC +public-encrypt,4.0.0,MIT public_suffix,3.0.0,MIT +punycode,1.3.2,MIT +punycode,1.4.1,MIT pyu-ruby-sasl,0.0.3.3,MIT +q,1.4.1,MIT +q,1.5.0,MIT +qjobs,1.1.5,MIT +qs,6.2.3,New BSD +qs,6.4.0,New BSD +qs,6.5.0,New BSD +qs,6.5.1,New BSD +query-string,4.3.2,MIT +querystring,0.2.0,MIT +querystring-es3,0.2.1,MIT +querystringify,0.0.4,MIT +querystringify,1.0.0,MIT rack,1.6.8,MIT rack-accept,0.4.5,MIT rack-attack,4.4.1,MIT -rack-cors,0.4.0,MIT +rack-cors,1.0.2,MIT rack-oauth2,1.2.3,MIT rack-protection,1.5.3,MIT rack-proxy,0.6.0,MIT @@ -231,26 +1183,93 @@ railties,4.2.10,MIT rainbow,2.2.2,MIT raindrops,0.18.0,LGPL-2.1+ rake,12.3.0,MIT +randomatic,1.1.6,MIT +randombytes,2.0.3,MIT +randombytes,2.0.6,MIT +randomfill,1.0.3,MIT +range-parser,1.2.0,MIT +raphael,2.2.7,MIT +raven-js,3.22.1,Simplified BSD +raw-body,2.2.0,MIT +raw-body,2.3.2,MIT +raw-loader,0.5.1,MIT +rb-fsevent,0.10.2,MIT +rb-inotify,0.9.10,MIT rbnacl,4.0.2,MIT rbnacl-libsodium,1.0.11,MIT +rc,1.2.1,(BSD-2-Clause OR MIT OR Apache-2.0) rdoc,4.2.2,ruby re2,1.1.1,New BSD +react-dev-utils,0.5.2,New BSD +read-all-stream,3.1.0,MIT +read-only-stream,2.0.0,MIT +read-pkg,1.1.0,MIT +read-pkg,2.0.0,MIT +read-pkg-up,1.0.1,MIT +read-pkg-up,2.0.0,MIT +readable-stream,1.1.14,MIT +readable-stream,2.0.6,MIT +readable-stream,2.3.3,MIT +readdirp,2.1.0,MIT +readline2,1.0.1,MIT recaptcha,3.0.0,MIT +rechoir,0.6.2,MIT recursive-open-struct,1.0.0,MIT +recursive-readdir,2.1.1,MIT redcarpet,3.4.0,MIT +redent,1.0.0,MIT +redis,2.8.0,MIT redis,3.3.5,MIT redis-actionpack,5.0.2,MIT redis-activesupport,5.0.4,MIT +redis-commands,1.3.1,MIT redis-namespace,1.5.2,MIT +redis-parser,2.6.0,MIT redis-rack,2.0.4,MIT redis-rails,5.0.2,MIT redis-store,1.4.1,MIT +reduce-css-calc,1.3.0,MIT +reduce-function-call,1.0.2,MIT +regenerate,1.3.2,MIT +regenerator-runtime,0.11.0,MIT +regenerator-transform,0.10.1,BSD +regex-cache,0.4.3,MIT +regexpu-core,1.0.0,MIT +regexpu-core,2.0.0,MIT +registry-url,3.1.0,MIT +regjsgen,0.2.0,MIT +regjsparser,0.1.5,Simplified BSD +remove-trailing-separator,1.1.0,ISC +repeat-element,1.1.2,MIT +repeat-string,0.2.2,MIT +repeat-string,1.6.1,MIT +repeating,1.1.3,MIT +repeating,2.0.1,MIT representable,3.0.4,MIT +request,2.75.0,Apache 2.0 +request,2.81.0,Apache 2.0 +request,2.83.0,Apache 2.0 request_store,1.3.1,MIT +requestretry,1.12.2,MIT +require-all,2.2.0,MIT +require-directory,2.1.1,MIT +require-from-string,1.2.1,MIT +require-main-filename,1.0.1,ISC +require-uncached,1.0.3,MIT +requires-port,1.0.0,MIT +resolve,1.1.7,MIT +resolve,1.4.0,MIT +resolve,1.5.0,MIT +resolve-from,1.0.1,MIT responders,2.3.0,MIT rest-client,2.0.0,MIT +restore-cursor,1.0.1,MIT +resumer,0.0.0,MIT retriable,3.1.1,MIT +right-align,0.1.3,MIT +rimraf,2.6.1,ISC rinku,2.0.0,ISC +ripemd160,1.0.1,New BSD rotp,2.1.2,MIT rouge,2.2.1,MIT rqrcode,0.7.0,MIT @@ -263,51 +1282,282 @@ rubyntlm,0.6.2,MIT rubypants,0.2.0,BSD rufus-scheduler,3.4.0,MIT rugged,0.26.0,MIT +run-async,0.1.0,MIT +rx-lite,3.1.2,Apache 2.0 +safe-buffer,5.0.1,MIT +safe-buffer,5.1.1,MIT safe_yaml,1.0.4,MIT sanitize,2.1.0,MIT -sass,3.4.22,MIT +sanitize-html,1.16.3,MIT +sass,3.5.5,MIT +sass-listen,4.0.0,MIT sass-rails,5.0.6,MIT sawyer,0.8.1,MIT +sax,1.2.2,ISC +schema-utils,0.3.0,MIT securecompare,1.0.0,MIT -seed-fu,2.3.6,MIT +seed-fu,2.3.7,MIT +select,1.1.2,MIT +select-hose,2.0.0,MIT +select2,3.5.2-browserify,Apache* select2-rails,3.5.9.3,MIT +selfsigned,1.10.1,MIT +semver,5.0.3,ISC +semver,5.3.0,ISC +semver-diff,2.1.0,MIT +send,0.15.4,MIT sentry-raven,2.5.3,Apache 2.0 +serve-index,1.9.0,MIT +serve-static,1.12.4,MIT +set-blocking,2.0.0,ISC +set-immediate-shim,1.0.1,MIT +setimmediate,1.0.5,MIT +setprototypeof,1.0.3,ISC settingslogic,2.0.9,MIT sexp_processor,4.9.0,MIT +sha.js,2.4.8,MIT +sha.js,2.4.9,MIT +shasum,1.0.2,MIT +shebang-command,1.2.0,MIT +shebang-regex,1.0.0,MIT +shell-quote,1.6.1,MIT +shelljs,0.7.8,New BSD sidekiq,5.0.5,LGPL sidekiq-cron,0.6.0,MIT sidekiq-limit_fetch,3.4.0,MIT +signal-exit,3.0.2,ISC signet,0.7.3,Apache 2.0 +slack-node,0.2.0,MIT slack-notifier,1.5.1,MIT +slash,1.0.0,MIT +slice-ansi,0.0.4,MIT +slide,1.1.6,ISC +smart-buffer,1.1.15,MIT +smtp-connection,2.12.0,MIT +sntp,1.0.9,BSD +sntp,2.1.0,BSD +socket.io,2.0.4,MIT +socket.io-adapter,1.1.1,MIT +socket.io-client,2.0.4,MIT +socket.io-parser,3.1.2,MIT +sockjs,0.3.18,MIT +sockjs-client,1.0.1,MIT +sockjs-client,1.1.4,MIT +socks,1.1.10,MIT +socks,1.1.9,MIT +socks-proxy-agent,2.1.1,MIT +sort-keys,1.1.2,MIT +source-list-map,0.1.8,MIT +source-list-map,2.0.0,MIT +source-map,0.2.0,New BSD +source-map,0.4.4,New BSD +source-map,0.5.6,New BSD +source-map,0.5.7,New BSD +source-map,0.6.1,New BSD +source-map-support,0.4.18,MIT +spdx-correct,1.0.2,Apache 2.0 +spdx-expression-parse,1.0.4,(MIT AND CC-BY-3.0) +spdx-license-ids,1.2.2,Unlicense +spdy,3.4.7,MIT +spdy-transport,2.0.20,MIT +split,0.3.3,MIT +sprintf-js,1.0.3,New BSD sprockets,3.7.1,MIT sprockets-rails,3.2.1,MIT +sql.js,0.4.0,MIT +srcset,1.0.0,MIT +sshpk,1.13.1,MIT state_machines,0.4.0,MIT state_machines-activemodel,0.4.0,MIT state_machines-activerecord,0.4.0,MIT +statuses,1.3.1,MIT +stream-browserify,2.0.1,MIT +stream-combiner,0.0.4,MIT +stream-combiner2,1.1.1,MIT +stream-http,2.6.3,MIT +stream-http,2.7.2,MIT +stream-shift,1.0.0,MIT +stream-splicer,2.0.0,MIT +streamroller,0.7.0,MIT +strict-uri-encode,1.1.0,MIT +string-length,1.0.1,MIT +string-width,1.0.2,MIT +string-width,2.0.0,MIT +string.prototype.trim,1.1.2,MIT +string_decoder,0.10.31,MIT +string_decoder,1.0.3,MIT stringex,2.7.1,MIT +stringstream,0.0.5,MIT +strip-ansi,3.0.1,MIT +strip-ansi,4.0.0,MIT +strip-bom,2.0.0,MIT +strip-bom,3.0.0,MIT +strip-eof,1.0.0,MIT +strip-indent,1.0.1,MIT +strip-json-comments,2.0.1,MIT +subarg,1.0.0,MIT +supports-color,2.0.0,MIT +supports-color,3.2.3,MIT +supports-color,4.2.1,MIT +supports-color,4.5.0,MIT +supports-color,5.1.0,MIT +svg4everybody,2.1.9,CC0-1.0 +svgo,0.7.2,MIT +syntax-error,1.3.0,MIT sys-filesystem,1.1.6,Artistic 2.0 +table,3.8.3,New BSD +tapable,0.1.10,MIT +tapable,0.2.8,MIT +tape,4.8.0,MIT +tar,2.2.1,ISC +tar-pack,3.4.0,Simplified BSD temple,0.7.7,MIT +test-exclude,4.1.1,ISC text,1.3.1,MIT +text-table,0.2.0,MIT thor,0.19.4,MIT thread_safe,0.3.6,Apache 2.0 +three,0.84.0,MIT +three-orbit-controls,82.1.0,MIT +three-stl-loader,1.0.4,MIT +through,2.3.8,MIT +through2,2.0.3,MIT +thunkify,2.1.2,MIT +thunky,0.1.0,MIT* tilt,2.0.6,MIT +time-stamp,2.0.0,MIT +timeago.js,3.0.2,MIT +timed-out,2.0.0,MIT +timed-out,4.0.1,MIT +timers-browserify,1.4.2,MIT +timers-browserify,2.0.4,MIT +timespan,2.3.0,MIT timfel-krb5-auth,0.8.3,LGPL +tiny-emitter,2.0.2,MIT +tmp,0.0.31,MIT +tmp,0.0.33,MIT +to-array,0.1.4,MIT +to-arraybuffer,1.0.1,MIT +to-fast-properties,1.0.3,MIT +to-fast-properties,2.0.0,MIT toml-rb,0.3.15,MIT +touch,1.0.0,ISC +tough-cookie,2.3.2,New BSD +tough-cookie,2.3.3,New BSD +traverse,0.6.6,MIT +trim-newlines,1.0.0,MIT +trim-right,1.0.1,MIT truncato,0.7.10,MIT +tryit,1.0.3,MIT +tsscmp,1.0.5,MIT +tty-browserify,0.0.0,MIT +tunnel-agent,0.4.3,Apache 2.0 +tunnel-agent,0.6.0,Apache 2.0 +tweetnacl,0.14.5,Unlicense +type-check,0.3.2,MIT +type-is,1.6.15,MIT +typedarray,0.0.6,MIT tzinfo,1.2.4,MIT u2f,0.2.1,MIT uber,0.1.0,MIT uglifier,2.7.2,MIT +uglify-js,2.8.29,Simplified BSD +uglify-to-browserify,1.0.2,MIT +uglifyjs-webpack-plugin,0.4.6,MIT +uid-number,0.0.6,ISC +ultron,1.1.0,MIT +umd,3.0.1,MIT +unc-path-regex,0.1.2,MIT +undefsafe,0.0.3,MIT / http://rem.mit-license.org +underscore,1.7.0,MIT +underscore,1.8.3,MIT unf,0.1.4,BSD unf_ext,0.0.7.4,MIT unicorn,5.1.0,ruby unicorn-worker-killer,0.4.4,ruby +uniq,1.0.1,MIT +uniqid,4.1.1,MIT +uniqs,2.0.0,MIT +unpipe,1.0.0,MIT +update-notifier,0.5.0,Simplified BSD +url,0.11.0,MIT +url-loader,0.5.8,MIT +url-parse,1.0.5,MIT +url-parse,1.1.7,MIT +url-parse,1.1.9,MIT +url-parse-lax,1.0.0,MIT +url-to-options,1.0.1,MIT url_safe_base64,0.2.2,MIT +user-home,2.0.0,MIT +useragent,2.2.1,MIT +util,0.10.3,MIT +util-deprecate,1.0.2,MIT +utils-merge,1.0.0,MIT +uuid,2.0.3,MIT +uuid,3.1.0,MIT +uws,0.14.5,Zlib +validate-npm-package-license,3.0.1,Apache 2.0 validates_hostname,1.0.6,MIT +vary,1.1.1,MIT +vendors,1.0.1,MIT +verror,1.10.0,MIT version_sorter,2.1.0,MIT virtus,1.0.5,MIT +visibilityjs,1.2.4,MIT +vm-browserify,0.0.4,MIT vmstat,2.3.0,MIT +void-elements,2.0.1,MIT +vue,2.5.13,MIT +vue-eslint-parser,2.0.1,MIT +vue-hot-reload-api,2.2.4,MIT +vue-loader,13.7.0,MIT +vue-resource,1.3.5,MIT +vue-router,3.0.1,MIT +vue-style-loader,3.0.3,MIT +vue-template-compiler,2.5.13,MIT +vue-template-es2015-compiler,1.6.0,MIT +vuex,3.0.1,MIT warden,1.2.6,MIT +watchpack,1.4.0,MIT +wbuf,1.7.2,MIT +webpack,3.5.5,MIT +webpack-bundle-analyzer,2.8.2,MIT +webpack-dev-middleware,1.11.0,MIT +webpack-dev-middleware,1.12.2,MIT +webpack-dev-server,2.7.1,MIT webpack-rails,0.9.10,MIT +webpack-sources,1.0.1,MIT +webpack-stats-plugin,0.1.5,MIT +websocket-driver,0.6.5,MIT +websocket-extensions,0.1.1,MIT +when,3.7.8,MIT +whet.extend,0.9.9,MIT +which,1.2.12,ISC +which-module,1.0.0,ISC +which-module,2.0.0,ISC +wide-align,1.1.2,ISC wikicloth,0.8.1,MIT +window-size,0.1.0,MIT +wordwrap,0.0.2,MIT +wordwrap,0.0.3,MIT +wordwrap,1.0.0,MIT +worker-loader,1.1.0,MIT +wrap-ansi,2.1.0,MIT +wrappy,1.0.2,ISC +write,0.2.1,MIT +write-file-atomic,1.3.4,ISC +ws,2.3.1,MIT +ws,3.3.3,MIT +xdg-basedir,2.0.0,MIT xml-simple,1.1.5,ruby +xmlhttprequest-ssl,1.5.5,MIT +xregexp,2.0.0,MIT +xtend,4.0.1,MIT +y18n,3.2.1,ISC +yallist,2.1.2,ISC +yargs,3.10.0,MIT +yargs,6.6.0,MIT +yargs,8.0.2,MIT +yargs-parser,4.2.1,ISC +yargs-parser,7.0.0,ISC +yeast,0.1.2,MIT -- cgit v1.2.1 From 4c45c106a32adedad5dd6c18fe6131ab6e873a68 Mon Sep 17 00:00:00 2001 From: Brett Walker Date: Thu, 8 Feb 2018 15:02:44 +0100 Subject: don't check against a hardcoded user name and use an invalid user name that is random so we know it's invalid --- qa/qa/specs/features/api/users_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qa/qa/specs/features/api/users_spec.rb b/qa/qa/specs/features/api/users_spec.rb index 9d039590a0e..d4ff4ebbc9a 100644 --- a/qa/qa/specs/features/api/users_spec.rb +++ b/qa/qa/specs/features/api/users_spec.rb @@ -14,7 +14,7 @@ module QA end scenario 'submit request with a valid user name' do - get request.url, { params: { username: 'root' } } + get request.url, { params: { username: Runtime::User.name } } expect_status(200) expect(json_body).to be_an Array @@ -23,7 +23,7 @@ module QA end scenario 'submit request with an invalid user name' do - get request.url, { params: { username: 'invalid' } } + get request.url, { params: { username: SecureRandom.hex(10) } } expect_status(200) expect(json_body).to be_an Array -- cgit v1.2.1 From 0ddaaae2fcef62aed3b8f071972455ebda3a03a1 Mon Sep 17 00:00:00 2001 From: Marcia Ramos Date: Thu, 8 Feb 2018 14:11:47 +0000 Subject: wording --- doc/user/project/pages/getting_started_part_three.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/project/pages/getting_started_part_three.md b/doc/user/project/pages/getting_started_part_three.md index 4daa826d211..a153610c712 100644 --- a/doc/user/project/pages/getting_started_part_three.md +++ b/doc/user/project/pages/getting_started_part_three.md @@ -186,7 +186,7 @@ There is a huge movement in favor of securing all the web. W3C fully the reasons for that. Richard Barnes, a writer for Mozilla Security Blog, suggested that [Firefox would deprecate HTTP](https://blog.mozilla.org/security/2015/04/30/deprecating-non-secure-http/), and would no longer accept unsecured connections. Recently, Mozilla published a -[communicate](https://blog.mozilla.org/security/2016/03/29/march-2016-ca-communication/) +[communication](https://blog.mozilla.org/security/2016/03/29/march-2016-ca-communication/) reiterating the importance of HTTPS. ### Issuing Certificates -- cgit v1.2.1 From c2f0f8d76305902e8918660843ed06893fd7cfe7 Mon Sep 17 00:00:00 2001 From: Constance Okoghenun Date: Thu, 8 Feb 2018 14:22:31 +0000 Subject: Refactored merge_requests/show path in dispatcher.js --- app/assets/javascripts/dispatcher.js | 21 ++++--------------- app/assets/javascripts/gl_form.js | 3 +-- .../pages/projects/merge_requests/show/index.js | 24 ++++++++++++++++++++++ spec/javascripts/gl_form_spec.js | 20 ++++++------------ 4 files changed, 35 insertions(+), 33 deletions(-) create mode 100644 app/assets/javascripts/pages/projects/merge_requests/show/index.js diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index aceaffdfcb9..f8082c74943 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -1,15 +1,9 @@ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, wrap-iife, no-shadow, consistent-return, one-var, one-var-declaration-per-line, camelcase, default-case, no-new, quotes, no-duplicate-case, no-case-declarations, no-fallthrough, max-len */ -import MergeRequest from './merge_request'; import Flash from './flash'; import GfmAutoComplete from './gfm_auto_complete'; -import ZenMode from './zen_mode'; -import initNotes from './init_notes'; -import initIssuableSidebar from './init_issuable_sidebar'; import { convertPermissionToBoolean } from './lib/utils/common_utils'; import GlFieldErrors from './gl_field_errors'; import Shortcuts from './shortcuts'; -import ShortcutsIssuable from './shortcuts_issuable'; -import Diff from './diff'; import SearchAutocomplete from './search_autocomplete'; var Dispatcher; @@ -262,17 +256,10 @@ var Dispatcher; .catch(fail); break; case 'projects:merge_requests:show': - new Diff(); - new ZenMode(); - - initIssuableSidebar(); - initNotes(); - - const mrShowNode = document.querySelector('.merge-request'); - window.mergeRequest = new MergeRequest({ - action: mrShowNode.dataset.mrAction, - }); - shortcut_handler = new ShortcutsIssuable(true); + import('./pages/projects/merge_requests/show') + .then(callDefault) + .catch(fail); + shortcut_handler = true; break; case 'dashboard:activity': import('./pages/dashboard/activity') diff --git a/app/assets/javascripts/gl_form.js b/app/assets/javascripts/gl_form.js index d0f9e6af0f8..d200044b79f 100644 --- a/app/assets/javascripts/gl_form.js +++ b/app/assets/javascripts/gl_form.js @@ -1,5 +1,4 @@ -/* global autosize */ - +import autosize from 'autosize'; import GfmAutoComplete from './gfm_auto_complete'; import dropzoneInput from './dropzone_input'; import textUtils from './lib/utils/text_markdown'; diff --git a/app/assets/javascripts/pages/projects/merge_requests/show/index.js b/app/assets/javascripts/pages/projects/merge_requests/show/index.js new file mode 100644 index 00000000000..c3463c266e3 --- /dev/null +++ b/app/assets/javascripts/pages/projects/merge_requests/show/index.js @@ -0,0 +1,24 @@ +import MergeRequest from '~/merge_request'; +import ZenMode from '~/zen_mode'; +import initNotes from '~/init_notes'; +import initIssuableSidebar from '~/init_issuable_sidebar'; +import ShortcutsIssuable from '~/shortcuts_issuable'; +import Diff from '~/diff'; +import { handleLocationHash } from '~/lib/utils/common_utils'; + +export default () => { + new Diff(); // eslint-disable-line no-new + new ZenMode(); // eslint-disable-line no-new + + initIssuableSidebar(); // eslint-disable-line no-new + initNotes(); // eslint-disable-line no-new + + const mrShowNode = document.querySelector('.merge-request'); + + window.mergeRequest = new MergeRequest({ + action: mrShowNode.dataset.mrAction, + }); + + new ShortcutsIssuable(true); // eslint-disable-line no-new + handleLocationHash(); +}; diff --git a/spec/javascripts/gl_form_spec.js b/spec/javascripts/gl_form_spec.js index 5a8009e57fd..9c1fc0fda9e 100644 --- a/spec/javascripts/gl_form_spec.js +++ b/spec/javascripts/gl_form_spec.js @@ -1,10 +1,8 @@ -import Autosize from 'autosize'; +import autosize from 'autosize'; import GLForm from '~/gl_form'; import '~/lib/utils/text_utility'; import '~/lib/utils/common_utils'; -window.autosize = Autosize; - describe('GLForm', () => { describe('when instantiated', function () { beforeEach((done) => { @@ -13,14 +11,12 @@ describe('GLForm', () => { spyOn($.prototype, 'off').and.returnValue(this.textarea); spyOn($.prototype, 'on').and.returnValue(this.textarea); spyOn($.prototype, 'css'); - spyOn(window, 'autosize'); - this.glForm = new GLForm(this.form); + this.glForm = new GLForm(this.form, false); setTimeout(() => { $.prototype.off.calls.reset(); $.prototype.on.calls.reset(); $.prototype.css.calls.reset(); - window.autosize.calls.reset(); done(); }); }); @@ -43,10 +39,6 @@ describe('GLForm', () => { expect($.prototype.on).toHaveBeenCalledWith('mouseup.autosize', jasmine.any(Function)); }); - it('should autosize the textarea', () => { - expect(window.autosize).toHaveBeenCalledWith(jasmine.any(Object)); - }); - it('should set the resize css property to vertical', () => { expect($.prototype.css).toHaveBeenCalledWith('resize', 'vertical'); }); @@ -74,7 +66,7 @@ describe('GLForm', () => { spyOn($.prototype, 'data'); spyOn($.prototype, 'outerHeight').and.returnValue(200); spyOn(window, 'outerHeight').and.returnValue(400); - spyOn(window.autosize, 'destroy'); + spyOn(autosize, 'destroy'); this.glForm.destroyAutosize(); }); @@ -88,7 +80,7 @@ describe('GLForm', () => { }); it('should call autosize destroy', () => { - expect(window.autosize.destroy).toHaveBeenCalledWith(this.textarea); + expect(autosize.destroy).toHaveBeenCalledWith(this.textarea); }); it('should set the data-height attribute', () => { @@ -107,9 +99,9 @@ describe('GLForm', () => { it('should return undefined if the data-height equals the outerHeight', () => { spyOn($.prototype, 'outerHeight').and.returnValue(200); spyOn($.prototype, 'data').and.returnValue(200); - spyOn(window.autosize, 'destroy'); + spyOn(autosize, 'destroy'); expect(this.glForm.destroyAutosize()).toBeUndefined(); - expect(window.autosize.destroy).not.toHaveBeenCalled(); + expect(autosize.destroy).not.toHaveBeenCalled(); }); }); }); -- cgit v1.2.1 From 133b3f20fc60a9294eede7c4233c5272566e580e Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 8 Feb 2018 22:34:56 +0800 Subject: Allow using a different sandbox group for QA --- qa/README.md | 8 ++++++++ qa/qa/runtime/namespace.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/qa/README.md b/qa/README.md index 3c1b61900d9..29720668251 100644 --- a/qa/README.md +++ b/qa/README.md @@ -70,6 +70,14 @@ If you need to authenticate as a different user, you can provide the GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password bin/qa Test::Instance https://gitlab.example.com ``` +If your user doesn't have permission to default sandbox group +`gitlab-qa-sandbox`, you could also use another sandbox group by giving +`GITLAB_SANDBOX_NAME`: + +``` +GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password GITLAB_SANDBOX_NAME=jsmith-qa-sandbox bin/qa Test::Instance https://gitlab.example.com +``` + All [supported environment variables are here](https://gitlab.com/gitlab-org/gitlab-qa#supported-environment-variables). [GDK]: https://gitlab.com/gitlab-org/gitlab-development-kit/ diff --git a/qa/qa/runtime/namespace.rb b/qa/qa/runtime/namespace.rb index a72c2d21898..2ff5686c78d 100644 --- a/qa/qa/runtime/namespace.rb +++ b/qa/qa/runtime/namespace.rb @@ -16,7 +16,7 @@ module QA end def sandbox_name - 'gitlab-qa-sandbox' + ENV['GITLAB_SANDBOX_NAME'] || 'gitlab-qa-sandbox' end end end -- cgit v1.2.1 From 7959d46a892f90614306ba01f338bfc9009181fd Mon Sep 17 00:00:00 2001 From: Constance Okoghenun Date: Thu, 8 Feb 2018 15:37:43 +0100 Subject: Fixed typo, updated test, and removed commented code --- app/assets/javascripts/diff.js | 1 - app/assets/javascripts/gpg_badges.js | 2 +- spec/javascripts/gpg_badges_spec.js | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/diff.js b/app/assets/javascripts/diff.js index b26422ab725..3ab8f3ab7ad 100644 --- a/app/assets/javascripts/diff.js +++ b/app/assets/javascripts/diff.js @@ -72,7 +72,6 @@ export default class Diff { const view = file.data('view'); const params = { since, to, bottom, offset, unfold, view }; - // $.get(link, params, response => $target.parent().replaceWith(response)); axios.get(link, { params }) .then(({ data }) => $target.parent().replaceWith(data)) .catch(() => flash(__('An error occurred while loading diff'))); diff --git a/app/assets/javascripts/gpg_badges.js b/app/assets/javascripts/gpg_badges.js index 11adf4d2826..5e17ee7d32d 100644 --- a/app/assets/javascripts/gpg_badges.js +++ b/app/assets/javascripts/gpg_badges.js @@ -16,6 +16,6 @@ export default class GpgBadges { badges.filter(`[data-commit-sha="${signature.commit_sha}"]`).replaceWith(signature.html); }); }) - .catch(() => flash(__('An error occurred while loading comm'))); + .catch(() => flash(__('An error occurred while loading commits'))); } } diff --git a/spec/javascripts/gpg_badges_spec.js b/spec/javascripts/gpg_badges_spec.js index d739cd55ef3..5decb5e6bbd 100644 --- a/spec/javascripts/gpg_badges_spec.js +++ b/spec/javascripts/gpg_badges_spec.js @@ -40,7 +40,7 @@ describe('GpgBadges', () => { const spinners = document.querySelectorAll('.js-loading-gpg-badge i.fa.fa-spinner.fa-spin'); expect(spinners.length).toBe(1); done(); - }).catch(err => done(err)); + }).catch(done.fail); }); it('replaces the loading spinner', (done) => { @@ -51,6 +51,6 @@ describe('GpgBadges', () => { const parentContainer = document.querySelector('.parent-container'); expect(parentContainer.innerHTML.trim()).toEqual(dummyBadgeHtml); done(); - }).catch(err => done(err)); + }).catch(done.fail); }); }); -- cgit v1.2.1 From 3cabe148c1d63ad71ec2fe1e35f36a8af967a4a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20Wu=20=F0=9F=8C=B4Vacation=20Feb=2010-18?= =?UTF-8?q?=F0=9F=8C=B4?= Date: Wed, 7 Feb 2018 15:17:00 +0000 Subject: Update docs labels CE --- doc/user/project/img/label_priority_sort_order.png | Bin 101667 -> 0 bytes .../project/img/labels_assign_label_sidebar.png | Bin 11767 -> 0 bytes .../img/labels_assign_label_sidebar_saved.png | Bin 9741 -> 0 bytes doc/user/project/img/labels_default.png | Bin 24404 -> 22975 bytes .../project/img/labels_description_tooltip.png | Bin 8538 -> 0 bytes doc/user/project/img/labels_filter.png | Bin 19071 -> 0 bytes doc/user/project/img/labels_generate.png | Bin 13628 -> 0 bytes doc/user/project/img/labels_generate_default.png | Bin 0 -> 65549 bytes doc/user/project/img/labels_group_issues.png | Bin 0 -> 264573 bytes doc/user/project/img/labels_list.png | Bin 0 -> 207736 bytes doc/user/project/img/labels_new_label.png | Bin 10720 -> 0 bytes .../project/img/labels_new_label_on_the_fly.png | Bin 4625 -> 0 bytes .../img/labels_new_label_on_the_fly_create.png | Bin 6389 -> 0 bytes doc/user/project/img/labels_prioritize.png | Bin 24194 -> 0 bytes doc/user/project/img/labels_prioritized.png | Bin 0 -> 156020 bytes doc/user/project/img/labels_promotion.png | Bin 0 -> 121824 bytes doc/user/project/img/labels_sidebar.png | Bin 0 -> 31123 bytes doc/user/project/img/labels_sidebar_assign.png | Bin 0 -> 28033 bytes doc/user/project/img/labels_sidebar_inline.png | Bin 0 -> 28423 bytes .../project/img/labels_sort_label_priority.png | Bin 0 -> 110154 bytes doc/user/project/img/labels_sort_priority.png | Bin 0 -> 108780 bytes doc/user/project/img/labels_subscribe.png | Bin 5336 -> 0 bytes doc/user/project/img/labels_subscriptions.png | Bin 0 -> 87502 bytes doc/user/project/img/new_label_from_sidebar.gif | Bin 0 -> 759243 bytes doc/user/project/labels.md | 189 ++++++++------------- 25 files changed, 70 insertions(+), 119 deletions(-) delete mode 100644 doc/user/project/img/label_priority_sort_order.png delete mode 100644 doc/user/project/img/labels_assign_label_sidebar.png delete mode 100644 doc/user/project/img/labels_assign_label_sidebar_saved.png delete mode 100644 doc/user/project/img/labels_description_tooltip.png delete mode 100644 doc/user/project/img/labels_filter.png delete mode 100644 doc/user/project/img/labels_generate.png create mode 100644 doc/user/project/img/labels_generate_default.png create mode 100644 doc/user/project/img/labels_group_issues.png create mode 100644 doc/user/project/img/labels_list.png delete mode 100644 doc/user/project/img/labels_new_label.png delete mode 100644 doc/user/project/img/labels_new_label_on_the_fly.png delete mode 100644 doc/user/project/img/labels_new_label_on_the_fly_create.png delete mode 100644 doc/user/project/img/labels_prioritize.png create mode 100644 doc/user/project/img/labels_prioritized.png create mode 100644 doc/user/project/img/labels_promotion.png create mode 100644 doc/user/project/img/labels_sidebar.png create mode 100644 doc/user/project/img/labels_sidebar_assign.png create mode 100644 doc/user/project/img/labels_sidebar_inline.png create mode 100644 doc/user/project/img/labels_sort_label_priority.png create mode 100644 doc/user/project/img/labels_sort_priority.png delete mode 100644 doc/user/project/img/labels_subscribe.png create mode 100644 doc/user/project/img/labels_subscriptions.png create mode 100644 doc/user/project/img/new_label_from_sidebar.gif diff --git a/doc/user/project/img/label_priority_sort_order.png b/doc/user/project/img/label_priority_sort_order.png deleted file mode 100644 index 21c7a76a322..00000000000 Binary files a/doc/user/project/img/label_priority_sort_order.png and /dev/null differ diff --git a/doc/user/project/img/labels_assign_label_sidebar.png b/doc/user/project/img/labels_assign_label_sidebar.png deleted file mode 100644 index d74796fdb4d..00000000000 Binary files a/doc/user/project/img/labels_assign_label_sidebar.png and /dev/null differ diff --git a/doc/user/project/img/labels_assign_label_sidebar_saved.png b/doc/user/project/img/labels_assign_label_sidebar_saved.png deleted file mode 100644 index dabffe956dc..00000000000 Binary files a/doc/user/project/img/labels_assign_label_sidebar_saved.png and /dev/null differ diff --git a/doc/user/project/img/labels_default.png b/doc/user/project/img/labels_default.png index 7934e3bfb5e..7a7fab611a4 100644 Binary files a/doc/user/project/img/labels_default.png and b/doc/user/project/img/labels_default.png differ diff --git a/doc/user/project/img/labels_description_tooltip.png b/doc/user/project/img/labels_description_tooltip.png deleted file mode 100644 index eea4f8cf0f4..00000000000 Binary files a/doc/user/project/img/labels_description_tooltip.png and /dev/null differ diff --git a/doc/user/project/img/labels_filter.png b/doc/user/project/img/labels_filter.png deleted file mode 100644 index 6a1ebfc2ecb..00000000000 Binary files a/doc/user/project/img/labels_filter.png and /dev/null differ diff --git a/doc/user/project/img/labels_generate.png b/doc/user/project/img/labels_generate.png deleted file mode 100644 index 987f4b5be71..00000000000 Binary files a/doc/user/project/img/labels_generate.png and /dev/null differ diff --git a/doc/user/project/img/labels_generate_default.png b/doc/user/project/img/labels_generate_default.png new file mode 100644 index 00000000000..fca2a06e04f Binary files /dev/null and b/doc/user/project/img/labels_generate_default.png differ diff --git a/doc/user/project/img/labels_group_issues.png b/doc/user/project/img/labels_group_issues.png new file mode 100644 index 00000000000..29dcf7ff45e Binary files /dev/null and b/doc/user/project/img/labels_group_issues.png differ diff --git a/doc/user/project/img/labels_list.png b/doc/user/project/img/labels_list.png new file mode 100644 index 00000000000..12c47ea9766 Binary files /dev/null and b/doc/user/project/img/labels_list.png differ diff --git a/doc/user/project/img/labels_new_label.png b/doc/user/project/img/labels_new_label.png deleted file mode 100644 index e26425d0188..00000000000 Binary files a/doc/user/project/img/labels_new_label.png and /dev/null differ diff --git a/doc/user/project/img/labels_new_label_on_the_fly.png b/doc/user/project/img/labels_new_label_on_the_fly.png deleted file mode 100644 index 2ac9805b1ab..00000000000 Binary files a/doc/user/project/img/labels_new_label_on_the_fly.png and /dev/null differ diff --git a/doc/user/project/img/labels_new_label_on_the_fly_create.png b/doc/user/project/img/labels_new_label_on_the_fly_create.png deleted file mode 100644 index 02ccf68553b..00000000000 Binary files a/doc/user/project/img/labels_new_label_on_the_fly_create.png and /dev/null differ diff --git a/doc/user/project/img/labels_prioritize.png b/doc/user/project/img/labels_prioritize.png deleted file mode 100644 index d602a3c90ec..00000000000 Binary files a/doc/user/project/img/labels_prioritize.png and /dev/null differ diff --git a/doc/user/project/img/labels_prioritized.png b/doc/user/project/img/labels_prioritized.png new file mode 100644 index 00000000000..57dcfe89b3d Binary files /dev/null and b/doc/user/project/img/labels_prioritized.png differ diff --git a/doc/user/project/img/labels_promotion.png b/doc/user/project/img/labels_promotion.png new file mode 100644 index 00000000000..8a5efd210a2 Binary files /dev/null and b/doc/user/project/img/labels_promotion.png differ diff --git a/doc/user/project/img/labels_sidebar.png b/doc/user/project/img/labels_sidebar.png new file mode 100644 index 00000000000..7349c6d4f0c Binary files /dev/null and b/doc/user/project/img/labels_sidebar.png differ diff --git a/doc/user/project/img/labels_sidebar_assign.png b/doc/user/project/img/labels_sidebar_assign.png new file mode 100644 index 00000000000..61e8d04fc85 Binary files /dev/null and b/doc/user/project/img/labels_sidebar_assign.png differ diff --git a/doc/user/project/img/labels_sidebar_inline.png b/doc/user/project/img/labels_sidebar_inline.png new file mode 100644 index 00000000000..31fa397761d Binary files /dev/null and b/doc/user/project/img/labels_sidebar_inline.png differ diff --git a/doc/user/project/img/labels_sort_label_priority.png b/doc/user/project/img/labels_sort_label_priority.png new file mode 100644 index 00000000000..c8b97639121 Binary files /dev/null and b/doc/user/project/img/labels_sort_label_priority.png differ diff --git a/doc/user/project/img/labels_sort_priority.png b/doc/user/project/img/labels_sort_priority.png new file mode 100644 index 00000000000..a95198e7f72 Binary files /dev/null and b/doc/user/project/img/labels_sort_priority.png differ diff --git a/doc/user/project/img/labels_subscribe.png b/doc/user/project/img/labels_subscribe.png deleted file mode 100644 index 56f24ae7bc8..00000000000 Binary files a/doc/user/project/img/labels_subscribe.png and /dev/null differ diff --git a/doc/user/project/img/labels_subscriptions.png b/doc/user/project/img/labels_subscriptions.png new file mode 100644 index 00000000000..8bcb3b57f6c Binary files /dev/null and b/doc/user/project/img/labels_subscriptions.png differ diff --git a/doc/user/project/img/new_label_from_sidebar.gif b/doc/user/project/img/new_label_from_sidebar.gif new file mode 100644 index 00000000000..572b29a86e1 Binary files /dev/null and b/doc/user/project/img/new_label_from_sidebar.gif differ diff --git a/doc/user/project/labels.md b/doc/user/project/labels.md index d7eb4bca89c..49f7baf9652 100644 --- a/doc/user/project/labels.md +++ b/doc/user/project/labels.md @@ -1,174 +1,125 @@ # Labels -Labels provide an easy way to categorize the issues or merge requests based on -descriptive titles like `bug`, `documentation` or any other text you feel like. -They can have different colors, a description, and are visible throughout -the issue tracker or inside each issue individually. +## Overview -With labels, you can navigate the issue tracker and filter any bloated -information to visualize only the issues you are interested in. Let's see how -that works. +Labels allow you to categorize issues or merge requests using descriptive titles like `bug`, `feature request`, or `docs`. Each label also has a customizable color. They allow you to quickly and dynamically filter and manage issues or merge requests you care about, and are visible throughout GitLab in most places where issues and merge requests are located. -## Create new labels +## Project labels and group labels + +In GitLab, you can create project and group labels: + +- **Project labels** can be assigned to issues or merge requests in that project only. +- **Group labels** can be assigned to any issue or merge request of any project in that group. +- In the [future](https://gitlab.com/gitlab-org/gitlab-ce/issues/40915), you will be able to assign group labels to issues and merge reqeusts of projects in [subgroups](../group/subgroups/index.md). + +## Creating labels >**Note:** -A permission level of `Developer` or higher is required in order to manage -labels. +A permission level of `Developer` or higher is required in order to create labels. -Head over a single project and navigate to **Issues > Labels**. +### New project label -The first time you visit this page, you'll notice that there are no labels -created yet. +To create a **project label**, navigate to **Issues > Labels** in the project. -Creating a new label from scratch is as easy as pressing the **New label** -button. From there on you can choose the name, give it an optional description, -a color and you are set. +Click the **New label** button. Enter the title, an optional description, and the background color. Click **Create label** to create the label. -When you are ready press the **Create label** button to create the new label. +If a project has no labels, you can generate a default set of project labels from its empty label list page: -![New label](img/labels_new_label.png) +![Labels generate default](img/labels_generate_default.png) ---- +GitLab will add the following default labels to the project: -## Default labels +![Labels default](img/labels_default.png) -The very first time you visit the labels area, it's gonna be empty. In that -case, it's possible to populate the labels for your project from a set of -predefined labels. +### New group label -Click the link to 'Generate a default set of labels' and GitLab will -generate them for you. There are 8 default generated labels in total: +To create a **group label**, follow similar steps from above to project labels. Navigate to **Issues > Labels** in the group and create it from there. -- bug -- confirmed -- critical -- discussion -- documentation -- enhancement -- suggestion -- support +Group labels appear in every label list page of the group's child projects. -## Labels Overview +![Labels list](img/labels_list.png) -![Default generated labels](img/labels_default.png) +### New project label from sidebar -You can see that from the labels page you can have an overview of the number of -issues and merge requests assigned to each label. +From the sidebar of an issue or a merge request, you can create a create a new **project label** inline immediately, instead of navigating to the project label list page. -## Prioritize labels +![Labels inline](img/new_label_from_sidebar.gif) ->**Notes:** -> -> - Introduced in GitLab 8.9. -> - Priority sorting is based on the highest priority label only. This might -> change in the future, follow the discussion in -> https://gitlab.com/gitlab-org/gitlab-ce/issues/18554. +## Editing labels -Prioritized labels are like any other label, but sorted by priority. This allows -you to sort issues and merge requests by label priority. +NOTE: **Note:** +A permission level of `Developer` or higher is required in order to edit labels. -To prioritize labels, navigate to your project's **Issues > Labels** and click -on the star icon next to them to put them in the priority list. Click on the -star icon again to remove them from the list. +You can update a label by navigating to **Issues > Labels** in the project ot group and clicking the pencil icon. -From there, you can drag them around to set the desired priority. Priority is -set from high to low with an ascending order. Labels with no priority, count as -having their priority set to null. +You can delete a label by clicking the trash icon. -![Prioritize labels](img/labels_prioritize.png) +### Promoting project labels to group labels -Now that you have labels prioritized, you can use the 'Label priority' and 'Priority' -sort orders in the issues or merge requests tracker. +If you are expanding from a few projects to a larger number of projects within the same group, you may want to share the same label among multiple projects in the same group. If you previously created a project label and now want to make it available for other projects, you can promote it to a group label. -In the following, everything applies to both issues and merge requests, but we'll -refer to just issues for brevity. +From the project label list page, you can promote a project label to a group label. This will merge all project labels across all projects in this group with the same name into a single group label. All issues and merge requests that previously were assigned one of these project labels will now be assigned the new group label. This action cannot be reversed and the changes are permanent. -The 'Label priority' sort order positions issues with higher priority labels -toward the top, and issues with lower priority labels toward the bottom. A non-prioritized -label is considered to have the lowest priority. For a given issue, we _only_ consider the -highest priority label assigned to it in the comparison. ([We are discussing](https://gitlab.com/gitlab-org/gitlab-ce/issues/18554) -including all the labels in a given issue for this comparison.) Given two issues -are equal according to this sort comparison, their relative order is equal, and -therefore it's not guaranteed that one will be always above the other. +![Labels promotion](img/labels_promotion.png) -![Label priority sort order](img/label_priority_sort_order.png) +## Assigning labels from the sidebar -The 'Priority' sort order comparison first considers an issue's milestone's due date, -(if the issue is assigned a milestone and the milestone's due date exists), and then -secondarily considers the label priority comparison above. Sooner due dates results -a higher sort order. If an issue doesn't have a milestone due date, it is equivalent to -being assigned to a milestone that has a due date in the infinite future. Given two issues -are equal according to this two-stage sort comparison, their relative order is equal, and -therefore it's not guaranteed that one will be always above the other. +Every issue and merge request can be assigned any number of labels. The labels are visible on every issue and merge request page, in the sidebar. They are also visible in the issue board. From the sidebar, you can assign or unassign a label to the object (i.e. label or unlabel it). You can also perform this as a [quick action](quick_actions.md) in a comment. -![Priority sort order](img/priority_sort_order.png) +| View labels in sidebar | Assign labels from sidebar | +|:---:|:---:| +| ![Labels sidebar](img/labels_sidebar.png) | ![Labels sidebar assign](img/labels_sidebar_assign.png) | +## Filtering issues and merge requests by label -## Subscribe to labels +### Filtering in list pages -If you don’t want to miss issues or merge requests that are important to you, -simply subscribe to a label. You’ll get notified whenever the label gets added -to an issue or merge request, making sure you don’t miss a thing. +From the project issue list page and the project merge request list page, you can [filter](../search/index.md#issues-and-merge-requests) by both group labels and project labels. -Go to your project's **Issues > Labels** area, find the label(s) you want to -subscribe to and click on the eye icon. Click again to unsubscribe. +From the group issue list page and the group merge request list page, you can [filter](../search/index.md#issues-and-merge-requests) by both group labels and project labels. -![Subscribe to labels](img/labels_subscribe.png) +![Labels group issues](img/labels_group_issues.png) -If you work on a large or popular project, try subscribing only to the labels -that are relevant to you. You’ll notice it’ll be much easier to focus on what’s -important. +### Filtering in issue boards -## Create a new label when inside an issue +- From [project boards](issue_board.md), you can filter by both group labels and project labels in the [search and filter bar](../search/index.md#issue-boards). -There are times when you are already inside an issue searching to assign a -label, only to realize it doesn't exist. Instead of going to the **Labels** -page and being distracted from your original purpose, you can create new -labels on the fly. +## Subscribing to labels -Expand the issue sidebar and select **Create new label** from the labels dropdown -list. Provide a name, pick a color and hit **Create**. The new label will be -ready to used right away! +From the project label list page and the group label list page, you can subscribe to [notifications](../../workflow/notifications.md) of a given label, to alert you that that label has been assigned to an issue or merge request. -![New label on the fly](img/labels_new_label_on_the_fly.png) +![Labels subscriptions](img/labels_subscriptions.png) -## Assigning labels to issues and merge requests +## Label priority -There are generally two ways to assign a label to an issue or merge request. +>**Notes:** +> +> - Introduced in GitLab 8.9. +> - Priority sorting is based on the highest priority label only. [This discussion](https://gitlab.com/gitlab-org/gitlab-ce/issues/18554) considers changing this. -The first one is to assign a label when you first create or edit an issue or -merge request. +Labels can have relative priorities, which are used in the "Label priority" and "Priority" sort orders of the issue and merge request list pages. -The second way is by using the right sidebar when inside an issue or merge -request. Expand it and hit **Edit** in the labels area. Start typing the name -of the label you are looking for to narrow down the list, and select it. You -can add more than one labels at once. When done, click outside the sidebar area -for the changes to take effect. +From the project label list page, star a label to indicate that it has a priority. Drag starred labels up and down to change their priority. Higher means higher priority. Prioritization happens at the project level, only on the project label list page, and not on the group label list page. However, both project and group labels can be prioritized on the project label list page since both types are displayed on the project label list page. -![Assign label in sidebar](img/labels_assign_label_sidebar.png) -![Save labels in sidebar](img/labels_assign_label_sidebar_saved.png) +![Labels prioritized](img/labels_prioritized.png) ---- +On the project and group issue and merge request list pages, you can sort by `Label priority` and `Priority`, which account for objects (issues and merge requests) that have prioritized labels assigned to them. -To remove labels, expand the left sidebar and unmark them from the labels list. -Simple as that. +If you sort by `Label priority`, GitLab considers this sort comparison order: -## Use labels to filter issues +- Object with a higher priority prioritized label. +- Object without a prioritized label. -Once you start adding labels to your issues, you'll see the benefit of it. -Labels can have several uses, one of them being the quick filtering of issues -or merge requests. +Ties are broken arbitrarily. (Note that we _only_ consider the highest prioritized label in an object, and not any of the lower prioritized labels. [This discussion](https://gitlab.com/gitlab-org/gitlab-ce/issues/18554) considers changing this.) -Pick an existing label from the dropdown _Label_ menu or click on an existing -label from the issue tracker. In the latter case, you also get to see the -label description like shown below. +![Labels sort label priority](img/labels_sort_label_priority.png) -![Filter labels](img/labels_filter.png) +If you sort by `Priority`, GitLab considers this sort comparison order: ---- +- Object's assigned [milestone](milestones/index.md)'s due date is sooner, provided the object has a milestone and the milestone has a due date. If this isn't the case, consider the object having a due date in the infinite future. +- Object with a higher priority prioritized label. +- Object without a prioritized label. -And if you added a description to your label, you can see it by hovering your -mouse over the label in the issue tracker or wherever else the label is -rendered. +Ties are broken arbitrarily. -![Label tooltips](img/labels_description_tooltip.png) +![Labels sort priority](img/labels_sort_priority.png) -- cgit v1.2.1 From d2ec2d865cab7703ee19c0ae30a7fdfefc34ed7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20Wu=20=F0=9F=8C=B4Vacation=20Feb=2010-18?= =?UTF-8?q?=F0=9F=8C=B4?= Date: Thu, 8 Feb 2018 15:44:56 +0000 Subject: Issues and merge requests in subgroups docs --- doc/user/project/issues/index.md | 4 +--- doc/user/project/merge_requests/index.md | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/user/project/issues/index.md b/doc/user/project/issues/index.md index 88acd8edbe2..be4436749f9 100644 --- a/doc/user/project/issues/index.md +++ b/doc/user/project/issues/index.md @@ -64,9 +64,7 @@ You can also [search and filter](../../search/index.md#issues-and-merge-requests ### Issues per group -View all the issues in a group (that is, all the issues across all projects in that -group) by navigating to **Group > Issues**. This view also has the open and closed -issue tabs. +View issues in all projects in the group, including all projects of all descendant subgroups of the group. Navigate to **Group > Issues** to view these issues. This view also has the open and closed issues tabs. ![Group Issues list view](img/group_issues_list_view.png) diff --git a/doc/user/project/merge_requests/index.md b/doc/user/project/merge_requests/index.md index aa3266cb457..1658307ef81 100644 --- a/doc/user/project/merge_requests/index.md +++ b/doc/user/project/merge_requests/index.md @@ -70,9 +70,9 @@ and you can use the tabs available to quickly filter by open and closed. You can ## Merge requests per group -View all the merge requests in a group (that is, all the merge requests across all projects in that -group) by navigating to **Group > Merge Requests**. This view also has the open, merged, and closed -merge request tabs, from which you can [search and filter the results](../../search/index.md#issues-and-merge-requests-per-group). +View merge requests in all projects in the group, including all projects of all descendant subgroups of the group. Navigate to **Group > Merge Requests** to view these merge requests. This view also has the open and closed merge requests tabs. + +You can [search and filter the results](../../search/index.md#issues-and-merge-requests-per-group) from here. ![Group Issues list view](img/group_merge_requests_list_view.png) -- cgit v1.2.1 From f2ffb398d602c55f8cbd3c501adea97bb6682e65 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 8 Feb 2018 15:52:38 +0000 Subject: Update jquery.waitforimages & use npm version #39072 --- app/assets/javascripts/commit/image_file.js | 1 - app/assets/javascripts/commons/jquery.js | 2 +- app/assets/javascripts/issue.js | 1 - app/assets/javascripts/merge_request.js | 2 - package.json | 1 + vendor/assets/javascripts/jquery.waitforimages.js | 144 ---------------------- yarn.lock | 4 + 7 files changed, 6 insertions(+), 149 deletions(-) delete mode 100644 vendor/assets/javascripts/jquery.waitforimages.js diff --git a/app/assets/javascripts/commit/image_file.js b/app/assets/javascripts/commit/image_file.js index 525fbf9dac9..6504a0bbbfc 100644 --- a/app/assets/javascripts/commit/image_file.js +++ b/app/assets/javascripts/commit/image_file.js @@ -1,5 +1,4 @@ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-use-before-define, prefer-arrow-callback, no-else-return, consistent-return, prefer-template, quotes, one-var, one-var-declaration-per-line, no-unused-vars, no-return-assign, comma-dangle, quote-props, no-unused-expressions, no-sequences, object-shorthand, max-len */ -import 'vendor/jquery.waitforimages'; // Width where images must fits in, for 2-up this gets divided by 2 const availWidth = 900; diff --git a/app/assets/javascripts/commons/jquery.js b/app/assets/javascripts/commons/jquery.js index b93e94a3c97..a7ed175f7a4 100644 --- a/app/assets/javascripts/commons/jquery.js +++ b/app/assets/javascripts/commons/jquery.js @@ -6,5 +6,5 @@ import 'vendor/jquery.endless-scroll'; import 'vendor/jquery.caret'; import 'vendor/jquery.atwho'; import 'vendor/jquery.scrollTo'; -import 'vendor/jquery.waitforimages'; +import 'jquery.waitforimages'; import 'select2/select2'; diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js index ff65ea99e9a..e3d90a24185 100644 --- a/app/assets/javascripts/issue.js +++ b/app/assets/javascripts/issue.js @@ -1,5 +1,4 @@ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, one-var, no-underscore-dangle, one-var-declaration-per-line, object-shorthand, no-unused-vars, no-new, comma-dangle, consistent-return, quotes, dot-notation, quote-props, prefer-arrow-callback, max-len */ -import 'vendor/jquery.waitforimages'; import axios from './lib/utils/axios_utils'; import { addDelimiter } from './lib/utils/text_utility'; import flash from './flash'; diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index bedd50de1bb..a64093afcf4 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -1,6 +1,4 @@ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, quotes, no-underscore-dangle, one-var, one-var-declaration-per-line, consistent-return, dot-notation, quote-props, comma-dangle, object-shorthand, max-len, prefer-arrow-callback */ - -import 'vendor/jquery.waitforimages'; import { __ } from '~/locale'; import TaskList from './task_list'; import MergeRequestTabs from './merge_request_tabs'; diff --git a/package.json b/package.json index c508a6e9931..75d11afbbe1 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "jed": "^1.1.1", "jquery": "^2.2.4", "jquery-ujs": "1.2.2", + "jquery.waitforimages": "^2.2.0", "js-cookie": "^2.1.3", "jszip": "^3.1.3", "jszip-utils": "^0.0.2", diff --git a/vendor/assets/javascripts/jquery.waitforimages.js b/vendor/assets/javascripts/jquery.waitforimages.js deleted file mode 100644 index 95b39c2e074..00000000000 --- a/vendor/assets/javascripts/jquery.waitforimages.js +++ /dev/null @@ -1,144 +0,0 @@ -/* - * waitForImages 1.4 - * ----------------- - * Provides a callback when all images have loaded in your given selector. - * http://www.alexanderdickson.com/ - * - * - * Copyright (c) 2011 Alex Dickson - * Licensed under the MIT licenses. - * See website for more info. - * - */ - -;(function($) { - // Namespace all events. - var eventNamespace = 'waitForImages'; - - // CSS properties which contain references to images. - $.waitForImages = { - hasImageProperties: [ - 'backgroundImage', - 'listStyleImage', - 'borderImage', - 'borderCornerImage' - ] - }; - - // Custom selector to find `img` elements that have a valid `src` attribute and have not already loaded. - $.expr[':'].uncached = function(obj) { - // Ensure we are dealing with an `img` element with a valid `src` attribute. - if ( ! $(obj).is('img[src!=""]')) { - return false; - } - - // Firefox's `complete` property will always be`true` even if the image has not been downloaded. - // Doing it this way works in Firefox. - var img = document.createElement('img'); - img.src = obj.src; - return ! img.complete; - }; - - $.fn.waitForImages = function(finishedCallback, eachCallback, waitForAll) { - - // Handle options object. - if ($.isPlainObject(arguments[0])) { - eachCallback = finishedCallback.each; - waitForAll = finishedCallback.waitForAll; - finishedCallback = finishedCallback.finished; - } - - // Handle missing callbacks. - finishedCallback = finishedCallback || $.noop; - eachCallback = eachCallback || $.noop; - - // Convert waitForAll to Boolean - waitForAll = !! waitForAll; - - // Ensure callbacks are functions. - if (!$.isFunction(finishedCallback) || !$.isFunction(eachCallback)) { - throw new TypeError('An invalid callback was supplied.'); - }; - - return this.each(function() { - // Build a list of all imgs, dependent on what images will be considered. - var obj = $(this), - allImgs = []; - - if (waitForAll) { - // CSS properties which may contain an image. - var hasImgProperties = $.waitForImages.hasImageProperties || [], - matchUrl = /url\((['"]?)(.*?)\1\)/g; - - // Get all elements, as any one of them could have a background image. - obj.find('*').each(function() { - var element = $(this); - - // If an `img` element, add it. But keep iterating in case it has a background image too. - if (element.is('img:uncached')) { - allImgs.push({ - src: element.attr('src'), - element: element[0] - }); - } - - $.each(hasImgProperties, function(i, property) { - var propertyValue = element.css(property); - // If it doesn't contain this property, skip. - if ( ! propertyValue) { - return true; - } - - // Get all url() of this element. - var match; - while (match = matchUrl.exec(propertyValue)) { - allImgs.push({ - src: match[2], - element: element[0] - }); - }; - }); - }); - } else { - // For images only, the task is simpler. - obj - .find('img:uncached') - .each(function() { - allImgs.push({ - src: this.src, - element: this - }); - }); - }; - - var allImgsLength = allImgs.length, - allImgsLoaded = 0; - - // If no images found, don't bother. - if (allImgsLength == 0) { - finishedCallback.call(obj[0]); - }; - - $.each(allImgs, function(i, img) { - - var image = new Image; - - // Handle the image loading and error with the same callback. - $(image).bind('load.' + eventNamespace + ' error.' + eventNamespace, function(event) { - allImgsLoaded++; - - // If an error occurred with loading the image, set the third argument accordingly. - eachCallback.call(img.element, allImgsLoaded, allImgsLength, event.type == 'load'); - - if (allImgsLoaded == allImgsLength) { - finishedCallback.call(obj[0]); - return false; - }; - - }); - - image.src = img.src; - }); - }); - }; -})(jQuery); diff --git a/yarn.lock b/yarn.lock index bc5c19464fb..8e86121812d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4203,6 +4203,10 @@ jquery-ujs@1.2.2: dependencies: jquery ">=1.8.0" +jquery.waitforimages@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/jquery.waitforimages/-/jquery.waitforimages-2.2.0.tgz#63f23131055a1b060dc913e6d874bcc9b9e6b16b" + "jquery@>= 1.9.1", jquery@>=1.8.0, jquery@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/jquery/-/jquery-2.2.4.tgz#2c89d6889b5eac522a7eea32c14521559c6cbf02" -- cgit v1.2.1 From d4e232aeb3d7264af10a2bfb69027ddc61ab1067 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 8 Feb 2018 16:14:31 +0000 Subject: Added 'clear' button to ci lint editor --- .../javascripts/pages/ci/lints/ci_lint_editor.js | 7 +++++ app/views/ci/lints/show.html.haml | 2 ++ .../feature-26598-clear-button-ci-lint.yml | 4 +++ spec/features/ci_lint_spec.rb | 34 +++++++++++++++++----- 4 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 changelogs/unreleased/feature-26598-clear-button-ci-lint.yml diff --git a/app/assets/javascripts/pages/ci/lints/ci_lint_editor.js b/app/assets/javascripts/pages/ci/lints/ci_lint_editor.js index b9469e5b7cb..9ab73be80a0 100644 --- a/app/assets/javascripts/pages/ci/lints/ci_lint_editor.js +++ b/app/assets/javascripts/pages/ci/lints/ci_lint_editor.js @@ -2,11 +2,18 @@ export default class CILintEditor { constructor() { this.editor = window.ace.edit('ci-editor'); this.textarea = document.querySelector('#content'); + this.clearYml = document.querySelector('.clear-yml'); this.editor.getSession().setMode('ace/mode/yaml'); this.editor.on('input', () => { const content = this.editor.getSession().getValue(); this.textarea.value = content; }); + + this.clearYml.addEventListener('click', this.clear.bind(this)); + } + + clear() { + this.editor.setValue(''); } } diff --git a/app/views/ci/lints/show.html.haml b/app/views/ci/lints/show.html.haml index e6408f35201..3c0881caa06 100644 --- a/app/views/ci/lints/show.html.haml +++ b/app/views/ci/lints/show.html.haml @@ -18,6 +18,8 @@ .col-sm-12 .pull-left.prepend-top-10 = submit_tag('Validate', class: 'btn btn-success submit-yml') + .pull-right.prepend-top-10 + = button_tag('Clear', type: 'button', class: 'btn btn-default clear-yml') .row.prepend-top-20 .col-sm-12 diff --git a/changelogs/unreleased/feature-26598-clear-button-ci-lint.yml b/changelogs/unreleased/feature-26598-clear-button-ci-lint.yml new file mode 100644 index 00000000000..fcf237f20f0 --- /dev/null +++ b/changelogs/unreleased/feature-26598-clear-button-ci-lint.yml @@ -0,0 +1,4 @@ +--- +title: Added clear button to ci lint editor +merge_request: +author: Michael Robinson diff --git a/spec/features/ci_lint_spec.rb b/spec/features/ci_lint_spec.rb index 9bc23baf6cf..b1dceec9da8 100644 --- a/spec/features/ci_lint_spec.rb +++ b/spec/features/ci_lint_spec.rb @@ -3,16 +3,19 @@ require 'spec_helper' describe 'CI Lint', :js do before do sign_in(create(:user)) + + visit ci_lint_path + find('#ci-editor') + execute_script("ace.edit('ci-editor').setValue(#{yaml_content.to_json});") + + # Ace editor updates a hidden textarea and it happens asynchronously + wait_for('YAML content') do + find('.ace_content').text.present? + end end describe 'YAML parsing' do before do - visit ci_lint_path - # Ace editor updates a hidden textarea and it happens asynchronously - # `sleep 0.1` is actually needed here because of this - find('#ci-editor') - execute_script("ace.edit('ci-editor').setValue(" + yaml_content.to_json + ");") - sleep 0.1 click_on 'Validate' end @@ -32,11 +35,10 @@ describe 'CI Lint', :js do end context 'YAML is incorrect' do - let(:yaml_content) { '' } + let(:yaml_content) { 'value: cannot have :' } it 'displays information about an error' do expect(page).to have_content('Status: syntax is incorrect') - expect(page).to have_content('Error: Please provide content of .gitlab-ci.yml') end end @@ -48,4 +50,20 @@ describe 'CI Lint', :js do end end end + + describe 'YAML clearing' do + before do + click_on 'Clear' + end + + context 'YAML is present' do + let(:yaml_content) do + File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) + end + + it 'YAML content is cleared' do + expect(page).to have_field('content', with: '', visible: false, type: 'textarea') + end + end + end end -- cgit v1.2.1 From 77c1d87feabc6afcad3c3fce44c6884b54345a43 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Thu, 8 Feb 2018 16:31:36 +0000 Subject: Make resetting column information overridable in EE --- spec/support/migrations_helpers.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/support/migrations_helpers.rb b/spec/support/migrations_helpers.rb index ba4a1bee089..06322aa0586 100644 --- a/spec/support/migrations_helpers.rb +++ b/spec/support/migrations_helpers.rb @@ -25,14 +25,19 @@ module MigrationsHelpers clear_schema_cache! # Reset column information for the most offending classes **after** we - # migrated the schema up, otherwise, column information could be outdated - ActiveRecord::Base.descendants.each { |klass| klass.reset_column_information } + # migrated the schema up, otherwise, column information could be + # outdated. We have a separate method for this so we can override it in EE. + ActiveRecord::Base.descendants.each(&method(:reset_column_information)) # Without that, we get errors because of missing attributes, e.g. # super: no superclass method `elasticsearch_indexing' for # ApplicationSetting.define_attribute_methods end + def reset_column_information(klass) + klass.reset_column_information + end + def previous_migration migrations.each_cons(2) do |previous, migration| break previous if migration.name == described_class.name -- cgit v1.2.1 From 6de6770e8db79d9684ddd504922f5aaf65a6f2cc Mon Sep 17 00:00:00 2001 From: Tiago Botelho Date: Thu, 8 Feb 2018 16:42:33 +0000 Subject: Bumps Gitlab Shell version to 6.0.3 --- GITLAB_SHELL_VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GITLAB_SHELL_VERSION b/GITLAB_SHELL_VERSION index 9b9a244206f..090ea9dad19 100644 --- a/GITLAB_SHELL_VERSION +++ b/GITLAB_SHELL_VERSION @@ -1 +1 @@ -6.0.2 +6.0.3 -- cgit v1.2.1 From ec43aaee0f336fb6c0863593ecc408beb175e568 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Thu, 8 Feb 2018 10:47:12 -0600 Subject: Remove unused code --- app/assets/javascripts/profile/profile.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/app/assets/javascripts/profile/profile.js b/app/assets/javascripts/profile/profile.js index e116ee23601..930f0fb381e 100644 --- a/app/assets/javascripts/profile/profile.js +++ b/app/assets/javascripts/profile/profile.js @@ -33,9 +33,6 @@ import flash from '../flash'; $('input[name="user[multi_file]"]').on('change', this.setNewRepoCookie); $('#user_notification_email').on('change', this.submitForm); $('#user_notified_of_own_activity').on('change', this.submitForm); - $('.update-username').on('ajax:before', this.beforeUpdateUsername); - $('.update-username').on('ajax:complete', this.afterUpdateUsername); - $('.update-notifications').on('ajax:success', this.onUpdateNotifs); this.form.on('submit', this.onSubmitForm); } @@ -48,21 +45,6 @@ import flash from '../flash'; return this.saveForm(); } - beforeUpdateUsername() { - $('.loading-username', this).removeClass('hidden'); - } - - afterUpdateUsername() { - $('.loading-username', this).addClass('hidden'); - $('button[type=submit]', this).enable(); - } - - onUpdateNotifs(e, data) { - return data.saved ? - flash(__('Notification settings saved'), 'notice') : - flash(__('Failed to save new settings')); - } - saveForm() { const self = this; const formData = new FormData(this.form[0]); -- cgit v1.2.1 From 8cdb3477b091e5c4ce08ef9f8caa65c7f5d925af Mon Sep 17 00:00:00 2001 From: Ahmad Sherif Date: Thu, 8 Feb 2018 17:14:45 +0100 Subject: Remove allow_n_plus_1 from Git::Repository#branches_filter --- lib/gitlab/git/repository.rb | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 6761fb0937a..5f014e43c6f 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -1614,17 +1614,14 @@ module Gitlab # Gitaly note: JV: Trying to get rid of the 'filter' option so we can implement this with 'git'. def branches_filter(filter: nil, sort_by: nil) - # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37464 - branches = Gitlab::GitalyClient.allow_n_plus_1_calls do - rugged.branches.each(filter).map do |rugged_ref| - begin - target_commit = Gitlab::Git::Commit.find(self, rugged_ref.target) - Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target, target_commit) - rescue Rugged::ReferenceError - # Omit invalid branch - end - end.compact - end + branches = rugged.branches.each(filter).map do |rugged_ref| + begin + target_commit = Gitlab::Git::Commit.find(self, rugged_ref.target) + Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target, target_commit) + rescue Rugged::ReferenceError + # Omit invalid branch + end + end.compact sort_branches(branches, sort_by) end -- cgit v1.2.1 From fe0b3095c50db00da2edaed355dfaeb769048680 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 8 Feb 2018 18:26:57 +0000 Subject: Moves missing branch into a vue file --- .../components/states/mr_widget_missing_branch.js | 43 --------------- .../components/states/mr_widget_missing_branch.vue | 63 ++++++++++++++++++++++ .../vue_merge_request_widget/dependencies.js | 2 +- .../states/mr_widget_missing_branch_spec.js | 34 ++++-------- 4 files changed, 73 insertions(+), 69 deletions(-) delete mode 100644 app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.js create mode 100644 app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.js b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.js deleted file mode 100644 index 7733fb74afe..00000000000 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.js +++ /dev/null @@ -1,43 +0,0 @@ -import statusIcon from '../mr_widget_status_icon.vue'; -import tooltip from '../../../vue_shared/directives/tooltip'; -import mrWidgetMergeHelp from '../../components/mr_widget_merge_help.vue'; - -export default { - name: 'MRWidgetMissingBranch', - props: { - mr: { type: Object, required: true }, - }, - directives: { - tooltip, - }, - components: { - 'mr-widget-merge-help': mrWidgetMergeHelp, - statusIcon, - }, - computed: { - missingBranchName() { - return this.mr.sourceBranchRemoved ? 'source' : 'target'; - }, - message() { - return `If the ${this.missingBranchName} branch exists in your local repository, you can merge this merge request manually using the command line`; - }, - }, - template: ` -
- -
- - - {{missingBranchName}} - branch does not exist. - Please restore it or use a different {{missingBranchName}} branch - - -
-
- `, -}; diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue new file mode 100644 index 00000000000..94eca0e9288 --- /dev/null +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue @@ -0,0 +1,63 @@ + + diff --git a/app/assets/javascripts/vue_merge_request_widget/dependencies.js b/app/assets/javascripts/vue_merge_request_widget/dependencies.js index 7ca15537719..5517888c3b1 100644 --- a/app/assets/javascripts/vue_merge_request_widget/dependencies.js +++ b/app/assets/javascripts/vue_merge_request_widget/dependencies.js @@ -24,7 +24,7 @@ export { default as WipState } from './components/states/mr_widget_wip'; export { default as ArchivedState } from './components/states/mr_widget_archived.vue'; export { default as ConflictsState } from './components/states/mr_widget_conflicts.vue'; export { default as NothingToMergeState } from './components/states/mr_widget_nothing_to_merge'; -export { default as MissingBranchState } from './components/states/mr_widget_missing_branch'; +export { default as MissingBranchState } from './components/states/mr_widget_missing_branch.vue'; export { default as NotAllowedState } from './components/states/mr_widget_not_allowed'; export { default as ReadyToMergeState } from './components/states/mr_widget_ready_to_merge'; export { default as SHAMismatchState } from './components/states/mr_widget_sha_mismatch'; diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js index 720effb5c1c..3d7f4abd420 100644 --- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js +++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js @@ -1,38 +1,22 @@ import Vue from 'vue'; -import missingBranchComponent from '~/vue_merge_request_widget/components/states/mr_widget_missing_branch'; - -const createComponent = () => { - const Component = Vue.extend(missingBranchComponent); - const mr = { - sourceBranchRemoved: true, - }; - - return new Component({ - el: document.createElement('div'), - propsData: { mr }, - }); -}; +import missingBranchComponent from '~/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue'; +import mountComponent from '../../../helpers/vue_mount_component_helper'; describe('MRWidgetMissingBranch', () => { - describe('props', () => { - it('should have props', () => { - const mrProp = missingBranchComponent.props.mr; + let vm; - expect(mrProp.type instanceof Object).toBeTruthy(); - expect(mrProp.required).toBeTruthy(); - }); + beforeEach(() => { + const Component = Vue.extend(missingBranchComponent); + vm = mountComponent(Component, { mr: { sourceBranchRemoved: true } }); }); - describe('components', () => { - it('should have components added', () => { - expect(missingBranchComponent.components['mr-widget-merge-help']).toBeDefined(); - }); + afterEach(() => { + vm.$destroy(); }); describe('computed', () => { describe('missingBranchName', () => { it('should return proper branch name', () => { - const vm = createComponent(); expect(vm.missingBranchName).toEqual('source'); vm.mr.sourceBranchRemoved = false; @@ -43,7 +27,7 @@ describe('MRWidgetMissingBranch', () => { describe('template', () => { it('should have correct elements', () => { - const el = createComponent().$el; + const el = vm.$el; const content = el.textContent.replace(/\n(\s)+/g, ' ').trim(); expect(el.classList.contains('mr-widget-body')).toBeTruthy(); -- cgit v1.2.1 From 4e3ad326e10f724c0e6dac11e0c2631e666bb8d0 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Thu, 8 Feb 2018 18:33:35 +0000 Subject: Backport EE changes to some hashed storage documentation to CE --- doc/administration/repository_storage_types.md | 91 +++++++++++++++----------- 1 file changed, 52 insertions(+), 39 deletions(-) diff --git a/doc/administration/repository_storage_types.md b/doc/administration/repository_storage_types.md index c5b286f6804..39bd19ac851 100644 --- a/doc/administration/repository_storage_types.md +++ b/doc/administration/repository_storage_types.md @@ -4,50 +4,63 @@ ## Legacy Storage -Legacy Storage is the storage behavior prior to version 10.0. For historical reasons, GitLab replicated the same -mapping structure from the projects URLs: +Legacy Storage is the storage behavior prior to version 10.0. For historical +reasons, GitLab replicated the same mapping structure from the projects URLs: - * Project's repository: `#{namespace}/#{project_name}.git` - * Project's wiki: `#{namespace}/#{project_name}.wiki.git` +* Project's repository: `#{namespace}/#{project_name}.git` +* Project's wiki: `#{namespace}/#{project_name}.wiki.git` -This structure made simple to migrate from existing solutions to GitLab and easy for Administrators to find where the -repository is stored. +This structure made it simple to migrate from existing solutions to GitLab and +easy for Administrators to find where the repository is stored. On the other hand this has some drawbacks: -Storage location will concentrate huge amount of top-level namespaces. The impact can be reduced by the introduction of [multiple storage paths][storage-paths]. +Storage location will concentrate huge amount of top-level namespaces. The +impact can be reduced by the introduction of [multiple storage +paths][storage-paths]. -Because Backups are a snapshot of the same URL mapping, if you try to recover a very old backup, you need to verify -if any project has taken the place of an old removed project sharing the same URL. This means that `mygroup/myproject` -from your backup may not be the same original project that is today in the same URL. +Because backups are a snapshot of the same URL mapping, if you try to recover a +very old backup, you need to verify whether any project has taken the place of +an old removed or renamed project sharing the same URL. This means that +`mygroup/myproject` from your backup may not be the same original project that +is at that same URL today. -Any change in the URL will need to be reflected on disk (when groups / users or projects are renamed). This can add a lot -of load in big installations, and can be even worst if they are using any type of network based filesystem. +Any change in the URL will need to be reflected on disk (when groups / users or +projects are renamed). This can add a lot of load in big installations, +especially if using any type of network based filesystem. -Last, for GitLab Geo, this storage type means we have to synchronize the disk state, replicate renames in the correct -order or we may end-up with wrong repository or missing data temporarily. +For GitLab Geo in particular: Geo does work with legacy storage, but in some +edge cases due to race conditions it can lead to errors when a project is +renamed multiple times in short succession, or a project is deleted and +recreated under the same name very quickly. We expect these race events to be +rare, and we have not observed a race condition side-effect happening yet. -This pattern also exists in other objects stored in GitLab, like issue Attachments, GitLab Pages artifacts, -Docker Containers for the integrated Registry, etc. +This pattern also exists in other objects stored in GitLab, like issue +Attachments, GitLab Pages artifacts, Docker Containers for the integrated +Registry, etc. ## Hashed Storage -Hashed Storage is the new storage behavior we are rolling out with 10.0. It's not enabled by default yet, but we -encourage everyone to try-it and take the time to fix any script you may have that depends on the old behavior. +> **Warning:** Hashed storage is in **Beta**. For the latest updates, check the +> associated [issue](https://gitlab.com/gitlab-com/infrastructure/issues/2821) +> and please report any problems you encounter. -Instead of coupling project URL and the folder structure where the repository will be stored on disk, we are coupling -a hash, based on the project's ID. +Hashed Storage is the new storage behavior we are rolling out with 10.0. Instead +of coupling project URL and the folder structure where the repository will be +stored on disk, we are coupling a hash, based on the project's ID. This makes +the folder structure immutable, and therefore eliminates any requirement to +synchronize state from URLs to disk structure. This means that renaming a group, +user, or project will cost only the database transaction, and will take effect +immediately. -This makes the folder structure immutable, and therefore eliminates any requirement to synchronize state from URLs to -disk structure. This means that renaming a group, user or project will cost only the database transaction, and will take -effect immediately. +The hash also helps to spread the repositories more evenly on the disk, so the +top-level directory will contain less folders than the total amount of top-level +namespaces. -The hash also helps to spread the repositories more evenly on the disk, so the top-level directory will contain less -folders than the total amount of top-level namespaces. - -Hash format is based on hexadecimal representation of SHA256: `SHA256(project.id)`. -Top-level folder uses first 2 characters, followed by another folder with the next 2 characters. They are both stored in -a special folder `@hashed`, to co-exist with existing Legacy projects: +The hash format is based on the hexadecimal representation of SHA256: +`SHA256(project.id)`. The top-level folder uses the first 2 characters, followed +by another folder with the next 2 characters. They are both stored in a special +`@hashed` folder, to be able to co-exist with existing Legacy Storage projects: ```ruby # Project's repository: @@ -57,15 +70,13 @@ a special folder `@hashed`, to co-exist with existing Legacy projects: "@hashed/#{hash[0..1]}/#{hash[2..3]}/#{hash}.wiki.git" ``` -This new format also makes possible to restore backups with confidence, as when restoring a repository from the backup, -you will never mistakenly restore a repository in the wrong project (considering the backup is made after the migration). - ### How to migrate to Hashed Storage -In GitLab, go to **Admin > Settings**, find the **Repository Storage** section and select -"_Create new projects using hashed storage paths_". +In GitLab, go to **Admin > Settings**, find the **Repository Storage** section +and select "_Create new projects using hashed storage paths_". -To migrate your existing projects to the new storage type, check the specific [rake tasks]. +To migrate your existing projects to the new storage type, check the specific +[rake tasks]. [ce-28283]: https://gitlab.com/gitlab-org/gitlab-ce/issues/28283 [rake tasks]: raketasks/storage.md#migrate-existing-projects-to-hashed-storage @@ -73,11 +84,13 @@ To migrate your existing projects to the new storage type, check the specific [r ### Hashed Storage coverage -We are incrementally moving every storable object in GitLab to the Hashed Storage pattern. You can check the current -coverage status below. +We are incrementally moving every storable object in GitLab to the Hashed +Storage pattern. You can check the current coverage status below (and also see +the [issue](https://gitlab.com/gitlab-com/infrastructure/issues/2821)). -Note that things stored in an S3 compatible endpoint will not have the downsides mentioned earlier, if they are not -prefixed with `#{namespace}/#{project_name}`, which is true for CI Cache and LFS Objects. +Note that things stored in an S3 compatible endpoint will not have the downsides +mentioned earlier, if they are not prefixed with `#{namespace}/#{project_name}`, +which is true for CI Cache and LFS Objects. | Storable Object | Legacy Storage | Hashed Storage | S3 Compatible | GitLab Version | | --------------- | -------------- | -------------- | ------------- | -------------- | -- cgit v1.2.1 From 469148b23184a1dd2d5ce6ceedcce48c2b02a7d1 Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Thu, 8 Feb 2018 21:06:18 +0200 Subject: Update vue component naming guidelines --- changelogs/unreleased/docs-update-vue-naming-guidelines.yml | 5 +++++ doc/development/fe_guide/style_guide_js.md | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 changelogs/unreleased/docs-update-vue-naming-guidelines.yml diff --git a/changelogs/unreleased/docs-update-vue-naming-guidelines.yml b/changelogs/unreleased/docs-update-vue-naming-guidelines.yml new file mode 100644 index 00000000000..95bfd212370 --- /dev/null +++ b/changelogs/unreleased/docs-update-vue-naming-guidelines.yml @@ -0,0 +1,5 @@ +--- +title: Update vue component naming guidelines +merge_request: 17018 +author: George Tsiolis +type: other diff --git a/doc/development/fe_guide/style_guide_js.md b/doc/development/fe_guide/style_guide_js.md index 02773162801..cd26baa4243 100644 --- a/doc/development/fe_guide/style_guide_js.md +++ b/doc/development/fe_guide/style_guide_js.md @@ -302,20 +302,20 @@ Please check this [rules][eslint-plugin-vue-rules] for more documentation. #### Naming 1. **Extensions**: Use `.vue` extension for Vue components. -1. **Reference Naming**: Use camelCase for their instances: +1. **Reference Naming**: Use PascalCase for their instances: ```javascript // bad - import CardBoard from 'cardBoard' + import cardBoard from 'cardBoard.vue' components: { - CardBoard: + cardBoard, }; // good - import cardBoard from 'cardBoard' + import CardBoard from 'cardBoard.vue' components: { - cardBoard: + CardBoard, }; ``` -- cgit v1.2.1 From 89c652b8fe24dd1784acb7b9d475eec6775b6a04 Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Tue, 6 Feb 2018 16:44:38 +0200 Subject: Move BoardNewIssue vue component --- .../javascripts/boards/components/board_list.vue | 2 +- .../boards/components/board_new_issue.js | 100 ------------------ .../boards/components/board_new_issue.vue | 113 +++++++++++++++++++++ app/assets/javascripts/boards/models/issue.js | 2 + ...refactor-move-board-new-issue-vue-component.yml | 5 + spec/javascripts/boards/board_new_issue_spec.js | 2 +- 6 files changed, 122 insertions(+), 102 deletions(-) delete mode 100644 app/assets/javascripts/boards/components/board_new_issue.js create mode 100644 app/assets/javascripts/boards/components/board_new_issue.vue create mode 100644 changelogs/unreleased/refactor-move-board-new-issue-vue-component.yml diff --git a/app/assets/javascripts/boards/components/board_list.vue b/app/assets/javascripts/boards/components/board_list.vue index 9a0442e2afe..6637904d87d 100644 --- a/app/assets/javascripts/boards/components/board_list.vue +++ b/app/assets/javascripts/boards/components/board_list.vue @@ -1,6 +1,6 @@ + + diff --git a/app/assets/javascripts/boards/models/issue.js b/app/assets/javascripts/boards/models/issue.js index 81edd95bf2b..3bfb6d39ad5 100644 --- a/app/assets/javascripts/boards/models/issue.js +++ b/app/assets/javascripts/boards/models/issue.js @@ -110,3 +110,5 @@ class ListIssue { } window.ListIssue = ListIssue; + +export default ListIssue; diff --git a/changelogs/unreleased/refactor-move-board-new-issue-vue-component.yml b/changelogs/unreleased/refactor-move-board-new-issue-vue-component.yml new file mode 100644 index 00000000000..20d05530513 --- /dev/null +++ b/changelogs/unreleased/refactor-move-board-new-issue-vue-component.yml @@ -0,0 +1,5 @@ +--- +title: Move BoardNewIssue vue component +merge_request: 16947 +author: George Tsiolis +type: performance diff --git a/spec/javascripts/boards/board_new_issue_spec.js b/spec/javascripts/boards/board_new_issue_spec.js index e204985f039..d5fbfdeaa91 100644 --- a/spec/javascripts/boards/board_new_issue_spec.js +++ b/spec/javascripts/boards/board_new_issue_spec.js @@ -4,7 +4,7 @@ import Vue from 'vue'; import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; -import boardNewIssue from '~/boards/components/board_new_issue'; +import boardNewIssue from '~/boards/components/board_new_issue.vue'; import '~/boards/models/list'; import { listObj, boardsMockInterceptor, mockBoardService } from './mock_data'; -- cgit v1.2.1 From 4e72e4563c4425b39714f068e3f94f1a6f7ed26f Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 8 Feb 2018 23:07:28 -0600 Subject: Rename .scss files to use snake_case See https://gitlab.com/gitlab-org/gitlab-ce/issues/42908 --- app/assets/stylesheets/framework.scss | 14 +- .../stylesheets/framework/broadcast-messages.scss | 21 - .../stylesheets/framework/broadcast_messages.scss | 21 + .../stylesheets/framework/contextual-sidebar.scss | 471 ----- .../stylesheets/framework/contextual_sidebar.scss | 471 +++++ .../stylesheets/framework/emoji-sprites.scss | 1813 -------------------- .../stylesheets/framework/emoji_sprites.scss | 1813 ++++++++++++++++++++ app/assets/stylesheets/framework/gitlab-theme.scss | 274 --- app/assets/stylesheets/framework/gitlab_theme.scss | 274 +++ app/assets/stylesheets/framework/page-header.scss | 66 - app/assets/stylesheets/framework/page_header.scss | 66 + .../framework/secondary-navigation-elements.scss | 379 ---- .../framework/secondary_navigation_elements.scss | 379 ++++ .../framework/stacked-progress-bar.scss | 54 - .../framework/stacked_progress_bar.scss | 54 + lib/tasks/gemojione.rake | 2 +- 16 files changed, 3086 insertions(+), 3086 deletions(-) delete mode 100644 app/assets/stylesheets/framework/broadcast-messages.scss create mode 100644 app/assets/stylesheets/framework/broadcast_messages.scss delete mode 100644 app/assets/stylesheets/framework/contextual-sidebar.scss create mode 100644 app/assets/stylesheets/framework/contextual_sidebar.scss delete mode 100644 app/assets/stylesheets/framework/emoji-sprites.scss create mode 100644 app/assets/stylesheets/framework/emoji_sprites.scss delete mode 100644 app/assets/stylesheets/framework/gitlab-theme.scss create mode 100644 app/assets/stylesheets/framework/gitlab_theme.scss delete mode 100644 app/assets/stylesheets/framework/page-header.scss create mode 100644 app/assets/stylesheets/framework/page_header.scss delete mode 100644 app/assets/stylesheets/framework/secondary-navigation-elements.scss create mode 100644 app/assets/stylesheets/framework/secondary_navigation_elements.scss delete mode 100644 app/assets/stylesheets/framework/stacked-progress-bar.scss create mode 100644 app/assets/stylesheets/framework/stacked_progress_bar.scss diff --git a/app/assets/stylesheets/framework.scss b/app/assets/stylesheets/framework.scss index 887879ab715..2fccfa4011c 100644 --- a/app/assets/stylesheets/framework.scss +++ b/app/assets/stylesheets/framework.scss @@ -21,7 +21,7 @@ @import "framework/flash"; @import "framework/forms"; @import "framework/gfm"; -@import "framework/gitlab-theme"; +@import "framework/gitlab_theme"; @import "framework/header"; @import "framework/highlight"; @import "framework/issue_box"; @@ -35,10 +35,10 @@ @import "framework/pagination"; @import "framework/panels"; @import "framework/popup"; -@import "framework/secondary-navigation-elements"; +@import "framework/secondary_navigation_elements"; @import "framework/selects"; @import "framework/sidebar"; -@import "framework/contextual-sidebar"; +@import "framework/contextual_sidebar"; @import "framework/tables"; @import "framework/notes"; @import "framework/tabs"; @@ -49,16 +49,16 @@ @import "framework/zen"; @import "framework/blank"; @import "framework/wells"; -@import "framework/page-header"; +@import "framework/page_header"; @import "framework/awards"; @import "framework/images"; -@import "framework/broadcast-messages"; +@import "framework/broadcast_messages"; @import "framework/emojis"; -@import "framework/emoji-sprites"; +@import "framework/emoji_sprites"; @import "framework/icons"; @import "framework/snippets"; @import "framework/memory_graph"; @import "framework/responsive_tables"; -@import "framework/stacked-progress-bar"; +@import "framework/stacked_progress_bar"; @import "framework/ci_variable_list"; @import "framework/feature_highlight"; diff --git a/app/assets/stylesheets/framework/broadcast-messages.scss b/app/assets/stylesheets/framework/broadcast-messages.scss deleted file mode 100644 index 9b54fb94cdc..00000000000 --- a/app/assets/stylesheets/framework/broadcast-messages.scss +++ /dev/null @@ -1,21 +0,0 @@ -.broadcast-message { - @extend .alert-warning; - padding: 10px; - text-align: center; - - div, - p { - display: inline; - margin: 0; - - a { - color: inherit; - text-decoration: underline; - } - } -} - -.broadcast-message-preview { - @extend .broadcast-message; - margin-bottom: 20px; -} diff --git a/app/assets/stylesheets/framework/broadcast_messages.scss b/app/assets/stylesheets/framework/broadcast_messages.scss new file mode 100644 index 00000000000..9b54fb94cdc --- /dev/null +++ b/app/assets/stylesheets/framework/broadcast_messages.scss @@ -0,0 +1,21 @@ +.broadcast-message { + @extend .alert-warning; + padding: 10px; + text-align: center; + + div, + p { + display: inline; + margin: 0; + + a { + color: inherit; + text-decoration: underline; + } + } +} + +.broadcast-message-preview { + @extend .broadcast-message; + margin-bottom: 20px; +} diff --git a/app/assets/stylesheets/framework/contextual-sidebar.scss b/app/assets/stylesheets/framework/contextual-sidebar.scss deleted file mode 100644 index 1acde98c3ae..00000000000 --- a/app/assets/stylesheets/framework/contextual-sidebar.scss +++ /dev/null @@ -1,471 +0,0 @@ -.page-with-contextual-sidebar { - transition: padding-left $sidebar-transition-duration; - - @media (min-width: $screen-md-min) { - padding-left: $contextual-sidebar-collapsed-width; - } - - @media (min-width: $screen-lg-min) { - padding-left: $contextual-sidebar-width; - } - - .issues-bulk-update.right-sidebar.right-sidebar-expanded .issuable-sidebar-header { - padding: 10px 0 15px; - } -} - -.page-with-icon-sidebar { - @media (min-width: $screen-sm-min) { - padding-left: $contextual-sidebar-collapsed-width; - } -} - -.context-header { - position: relative; - margin-right: 2px; - width: $contextual-sidebar-width; - - a { - transition: padding $sidebar-transition-duration; - font-weight: $gl-font-weight-bold; - display: flex; - align-items: center; - padding: 10px 16px 10px 10px; - color: $gl-text-color; - } - - &:hover, - a:hover { - background-color: $link-hover-background; - color: $gl-text-color; - } - - .avatar-container { - flex: 0 0 40px; - background-color: $white-light; - } - - .sidebar-context-title { - overflow: hidden; - text-overflow: ellipsis; - } -} - -.settings-avatar { - background-color: $white-light; - - svg { - fill: $gl-text-color-secondary; - margin: auto; - } -} - -.nav-sidebar { - transition: width $sidebar-transition-duration, left $sidebar-transition-duration; - position: fixed; - z-index: 400; - width: $contextual-sidebar-width; - top: $header-height; - bottom: 0; - left: 0; - background-color: $gray-light; - box-shadow: inset -2px 0 0 $border-color; - transform: translate3d(0, 0, 0); - - &:not(.sidebar-collapsed-desktop) { - @media (min-width: $screen-sm-min) and (max-width: $screen-md-max) { - box-shadow: inset -2px 0 0 $border-color, - 2px 1px 3px $dropdown-shadow-color; - } - } - - &.sidebar-collapsed-desktop { - width: $contextual-sidebar-collapsed-width; - - .nav-sidebar-inner-scroll { - overflow-x: hidden; - } - - .badge:not(.fly-out-badge), - .sidebar-context-title, - .nav-item-name { - display: none; - } - - .sidebar-top-level-items > li > a { - min-height: 44px; - } - - .fly-out-top-item { - display: block; - } - - .avatar-container { - margin-right: 0; - } - } - - &.sidebar-expanded-mobile { - left: 0; - } - - a { - text-decoration: none; - } - - ul { - padding-left: 0; - list-style: none; - } - - li { - white-space: nowrap; - - a { - transition: padding $sidebar-transition-duration; - display: flex; - align-items: center; - padding: 12px 15px; - color: $gl-text-color-secondary; - } - - .nav-item-name { - flex: 1; - } - - &.active { - > a { - font-weight: $gl-font-weight-bold; - } - } - } - - @media (max-width: $screen-xs-max) { - left: (-$contextual-sidebar-width); - } - - .nav-icon-container { - display: flex; - margin-right: 8px; - } - - .fly-out-top-item { - display: none; - } - - svg { - height: 16px; - width: 16px; - } -} - -.nav-sidebar-inner-scroll { - height: 100%; - width: 100%; - overflow: auto; - - @media (min-width: $screen-sm-min) { - overflow: hidden; - } -} - -.with-performance-bar .nav-sidebar { - top: $header-height + $performance-bar-height; -} - -.sidebar-sub-level-items { - display: none; - padding-bottom: 8px; - - > li { - a { - padding: 8px 16px 8px 40px; - - &:hover, - &:focus { - background: $link-active-background; - color: $gl-text-color; - } - } - - &.active { - a { - &, - &:hover, - &:focus { - background: $link-active-background; - } - } - } - } -} - -.sidebar-top-level-items { - margin-bottom: 60px; - - > li { - > a { - @media (min-width: $screen-sm-min) { - margin-right: 2px; - } - - &:hover { - color: $gl-text-color; - } - } - - &.is-showing-fly-out { - > a { - margin-right: 2px; - } - - .sidebar-sub-level-items { - @media (min-width: $screen-sm-min) { - position: fixed; - top: 0; - left: 0; - min-width: 150px; - margin-top: -1px; - padding: 4px 1px; - background-color: $white-light; - box-shadow: 2px 1px 3px $dropdown-shadow-color; - border: 1px solid $gray-darker; - border-left: 0; - border-radius: 0 3px 3px 0; - - &::before { - content: ""; - position: absolute; - top: -30px; - bottom: -30px; - left: -10px; - right: -30px; - z-index: -1; - } - - &.is-above { - margin-top: 1px; - } - - .divider { - height: 1px; - margin: 4px -1px; - padding: 0; - background-color: $dropdown-divider-color; - } - - > .active { - box-shadow: none; - - > a { - background-color: transparent; - } - } - - a { - padding: 8px 16px; - color: $gl-text-color; - - &:hover, - &:focus { - background-color: $gray-darker; - } - } - } - } - } - - .badge { - background-color: $inactive-badge-background; - color: $gl-text-color-secondary; - } - - &.active { - background: $link-active-background; - - > a { - margin-left: 4px; - // Subtract width of left border on active element - padding-left: 11px; - } - - .badge { - font-weight: $gl-font-weight-bold; - } - - .sidebar-sub-level-items:not(.is-fly-out-only) { - display: block; - } - } - - &.active > a:hover, - &.is-over > a { - background-color: $link-hover-background; - } - } -} - - -// Collapsed nav - -.toggle-sidebar-button, -.close-nav-button { - width: $contextual-sidebar-width - 2px; - transition: width $sidebar-transition-duration; - position: fixed; - bottom: 0; - padding: $gl-padding; - background-color: $gray-light; - border: 0; - border-top: 2px solid $border-color; - color: $gl-text-color-secondary; - display: flex; - align-items: center; - line-height: 1; - - svg { - margin-right: 8px; - } - - .icon-angle-double-right { - display: none; - } - - &:hover { - background-color: $border-color; - color: $gl-text-color; - } -} - -.toggle-sidebar-button { - @media (max-width: $screen-xs-max) { - display: none; - } -} - -.collapse-text { - white-space: nowrap; - overflow: hidden; -} - -.sidebar-collapsed-desktop { - .context-header { - height: 60px; - width: $contextual-sidebar-collapsed-width; - - a { - padding: 10px 4px; - } - } - - .sidebar-top-level-items > li { - .sidebar-sub-level-items { - &:not(.flyout-list) { - display: none; - } - } - } - - .nav-icon-container { - margin-right: 0; - } - - .toggle-sidebar-button { - padding: 16px; - width: $contextual-sidebar-collapsed-width - 2px; - - .collapse-text, - .icon-angle-double-left { - display: none; - } - - .icon-angle-double-right { - display: block; - margin: 0; - } - } -} - -.fly-out-top-item { - > a { - display: flex; - } - - .fly-out-badge { - margin-left: 8px; - } -} - -.fly-out-top-item-name { - flex: 1; -} - -// Mobile nav - -.close-nav-button { - display: none; -} - -.toggle-mobile-nav { - display: none; - background-color: transparent; - border: 0; - padding: 6px 16px; - margin: 0 0 0 -15px; - height: 46px; - - i { - font-size: 20px; - color: $gl-text-color-secondary; - } - - @media (max-width: $screen-xs-max) { - display: flex; - align-items: center; - - i { - font-size: 18px; - } - } - - @media (max-width: $screen-xs-max) { - + .breadcrumbs-links { - padding-left: $gl-padding; - border-left: 1px solid $gl-text-color-quaternary; - } - } -} - -@media (max-width: $screen-xs-max) { - .close-nav-button { - display: flex; - } -} - -.mobile-overlay { - display: none; - - &.mobile-nav-open { - display: block; - position: fixed; - background-color: $black-transparent; - height: 100%; - width: 100%; - z-index: 300; - } -} - - -// Make issue boards full-height now that sub-nav is gone - -.boards-list { - height: calc(100vh - #{$header-height}); - - @media (min-width: $screen-sm-min) { - height: calc(100vh - 180px); - } -} - -.with-performance-bar .boards-list { - height: calc(100vh - #{$header-height} - #{$performance-bar-height}); -} diff --git a/app/assets/stylesheets/framework/contextual_sidebar.scss b/app/assets/stylesheets/framework/contextual_sidebar.scss new file mode 100644 index 00000000000..1acde98c3ae --- /dev/null +++ b/app/assets/stylesheets/framework/contextual_sidebar.scss @@ -0,0 +1,471 @@ +.page-with-contextual-sidebar { + transition: padding-left $sidebar-transition-duration; + + @media (min-width: $screen-md-min) { + padding-left: $contextual-sidebar-collapsed-width; + } + + @media (min-width: $screen-lg-min) { + padding-left: $contextual-sidebar-width; + } + + .issues-bulk-update.right-sidebar.right-sidebar-expanded .issuable-sidebar-header { + padding: 10px 0 15px; + } +} + +.page-with-icon-sidebar { + @media (min-width: $screen-sm-min) { + padding-left: $contextual-sidebar-collapsed-width; + } +} + +.context-header { + position: relative; + margin-right: 2px; + width: $contextual-sidebar-width; + + a { + transition: padding $sidebar-transition-duration; + font-weight: $gl-font-weight-bold; + display: flex; + align-items: center; + padding: 10px 16px 10px 10px; + color: $gl-text-color; + } + + &:hover, + a:hover { + background-color: $link-hover-background; + color: $gl-text-color; + } + + .avatar-container { + flex: 0 0 40px; + background-color: $white-light; + } + + .sidebar-context-title { + overflow: hidden; + text-overflow: ellipsis; + } +} + +.settings-avatar { + background-color: $white-light; + + svg { + fill: $gl-text-color-secondary; + margin: auto; + } +} + +.nav-sidebar { + transition: width $sidebar-transition-duration, left $sidebar-transition-duration; + position: fixed; + z-index: 400; + width: $contextual-sidebar-width; + top: $header-height; + bottom: 0; + left: 0; + background-color: $gray-light; + box-shadow: inset -2px 0 0 $border-color; + transform: translate3d(0, 0, 0); + + &:not(.sidebar-collapsed-desktop) { + @media (min-width: $screen-sm-min) and (max-width: $screen-md-max) { + box-shadow: inset -2px 0 0 $border-color, + 2px 1px 3px $dropdown-shadow-color; + } + } + + &.sidebar-collapsed-desktop { + width: $contextual-sidebar-collapsed-width; + + .nav-sidebar-inner-scroll { + overflow-x: hidden; + } + + .badge:not(.fly-out-badge), + .sidebar-context-title, + .nav-item-name { + display: none; + } + + .sidebar-top-level-items > li > a { + min-height: 44px; + } + + .fly-out-top-item { + display: block; + } + + .avatar-container { + margin-right: 0; + } + } + + &.sidebar-expanded-mobile { + left: 0; + } + + a { + text-decoration: none; + } + + ul { + padding-left: 0; + list-style: none; + } + + li { + white-space: nowrap; + + a { + transition: padding $sidebar-transition-duration; + display: flex; + align-items: center; + padding: 12px 15px; + color: $gl-text-color-secondary; + } + + .nav-item-name { + flex: 1; + } + + &.active { + > a { + font-weight: $gl-font-weight-bold; + } + } + } + + @media (max-width: $screen-xs-max) { + left: (-$contextual-sidebar-width); + } + + .nav-icon-container { + display: flex; + margin-right: 8px; + } + + .fly-out-top-item { + display: none; + } + + svg { + height: 16px; + width: 16px; + } +} + +.nav-sidebar-inner-scroll { + height: 100%; + width: 100%; + overflow: auto; + + @media (min-width: $screen-sm-min) { + overflow: hidden; + } +} + +.with-performance-bar .nav-sidebar { + top: $header-height + $performance-bar-height; +} + +.sidebar-sub-level-items { + display: none; + padding-bottom: 8px; + + > li { + a { + padding: 8px 16px 8px 40px; + + &:hover, + &:focus { + background: $link-active-background; + color: $gl-text-color; + } + } + + &.active { + a { + &, + &:hover, + &:focus { + background: $link-active-background; + } + } + } + } +} + +.sidebar-top-level-items { + margin-bottom: 60px; + + > li { + > a { + @media (min-width: $screen-sm-min) { + margin-right: 2px; + } + + &:hover { + color: $gl-text-color; + } + } + + &.is-showing-fly-out { + > a { + margin-right: 2px; + } + + .sidebar-sub-level-items { + @media (min-width: $screen-sm-min) { + position: fixed; + top: 0; + left: 0; + min-width: 150px; + margin-top: -1px; + padding: 4px 1px; + background-color: $white-light; + box-shadow: 2px 1px 3px $dropdown-shadow-color; + border: 1px solid $gray-darker; + border-left: 0; + border-radius: 0 3px 3px 0; + + &::before { + content: ""; + position: absolute; + top: -30px; + bottom: -30px; + left: -10px; + right: -30px; + z-index: -1; + } + + &.is-above { + margin-top: 1px; + } + + .divider { + height: 1px; + margin: 4px -1px; + padding: 0; + background-color: $dropdown-divider-color; + } + + > .active { + box-shadow: none; + + > a { + background-color: transparent; + } + } + + a { + padding: 8px 16px; + color: $gl-text-color; + + &:hover, + &:focus { + background-color: $gray-darker; + } + } + } + } + } + + .badge { + background-color: $inactive-badge-background; + color: $gl-text-color-secondary; + } + + &.active { + background: $link-active-background; + + > a { + margin-left: 4px; + // Subtract width of left border on active element + padding-left: 11px; + } + + .badge { + font-weight: $gl-font-weight-bold; + } + + .sidebar-sub-level-items:not(.is-fly-out-only) { + display: block; + } + } + + &.active > a:hover, + &.is-over > a { + background-color: $link-hover-background; + } + } +} + + +// Collapsed nav + +.toggle-sidebar-button, +.close-nav-button { + width: $contextual-sidebar-width - 2px; + transition: width $sidebar-transition-duration; + position: fixed; + bottom: 0; + padding: $gl-padding; + background-color: $gray-light; + border: 0; + border-top: 2px solid $border-color; + color: $gl-text-color-secondary; + display: flex; + align-items: center; + line-height: 1; + + svg { + margin-right: 8px; + } + + .icon-angle-double-right { + display: none; + } + + &:hover { + background-color: $border-color; + color: $gl-text-color; + } +} + +.toggle-sidebar-button { + @media (max-width: $screen-xs-max) { + display: none; + } +} + +.collapse-text { + white-space: nowrap; + overflow: hidden; +} + +.sidebar-collapsed-desktop { + .context-header { + height: 60px; + width: $contextual-sidebar-collapsed-width; + + a { + padding: 10px 4px; + } + } + + .sidebar-top-level-items > li { + .sidebar-sub-level-items { + &:not(.flyout-list) { + display: none; + } + } + } + + .nav-icon-container { + margin-right: 0; + } + + .toggle-sidebar-button { + padding: 16px; + width: $contextual-sidebar-collapsed-width - 2px; + + .collapse-text, + .icon-angle-double-left { + display: none; + } + + .icon-angle-double-right { + display: block; + margin: 0; + } + } +} + +.fly-out-top-item { + > a { + display: flex; + } + + .fly-out-badge { + margin-left: 8px; + } +} + +.fly-out-top-item-name { + flex: 1; +} + +// Mobile nav + +.close-nav-button { + display: none; +} + +.toggle-mobile-nav { + display: none; + background-color: transparent; + border: 0; + padding: 6px 16px; + margin: 0 0 0 -15px; + height: 46px; + + i { + font-size: 20px; + color: $gl-text-color-secondary; + } + + @media (max-width: $screen-xs-max) { + display: flex; + align-items: center; + + i { + font-size: 18px; + } + } + + @media (max-width: $screen-xs-max) { + + .breadcrumbs-links { + padding-left: $gl-padding; + border-left: 1px solid $gl-text-color-quaternary; + } + } +} + +@media (max-width: $screen-xs-max) { + .close-nav-button { + display: flex; + } +} + +.mobile-overlay { + display: none; + + &.mobile-nav-open { + display: block; + position: fixed; + background-color: $black-transparent; + height: 100%; + width: 100%; + z-index: 300; + } +} + + +// Make issue boards full-height now that sub-nav is gone + +.boards-list { + height: calc(100vh - #{$header-height}); + + @media (min-width: $screen-sm-min) { + height: calc(100vh - 180px); + } +} + +.with-performance-bar .boards-list { + height: calc(100vh - #{$header-height} - #{$performance-bar-height}); +} diff --git a/app/assets/stylesheets/framework/emoji-sprites.scss b/app/assets/stylesheets/framework/emoji-sprites.scss deleted file mode 100644 index 0174e17b660..00000000000 --- a/app/assets/stylesheets/framework/emoji-sprites.scss +++ /dev/null @@ -1,1813 +0,0 @@ -.emoji-zzz { background-position: 0 0; } -.emoji-1234 { background-position: -20px 0; } -.emoji-1F627 { background-position: 0 -20px; } -.emoji-8ball { background-position: -20px -20px; } -.emoji-a { background-position: -40px 0; } -.emoji-ab { background-position: -40px -20px; } -.emoji-abc { background-position: 0 -40px; } -.emoji-abcd { background-position: -20px -40px; } -.emoji-accept { background-position: -40px -40px; } -.emoji-aerial_tramway { background-position: -60px 0; } -.emoji-airplane { background-position: -60px -20px; } -.emoji-airplane_arriving { background-position: -60px -40px; } -.emoji-airplane_departure { background-position: 0 -60px; } -.emoji-airplane_small { background-position: -20px -60px; } -.emoji-alarm_clock { background-position: -40px -60px; } -.emoji-alembic { background-position: -60px -60px; } -.emoji-alien { background-position: -80px 0; } -.emoji-ambulance { background-position: -80px -20px; } -.emoji-amphora { background-position: -80px -40px; } -.emoji-anchor { background-position: -80px -60px; } -.emoji-angel { background-position: 0 -80px; } -.emoji-angel_tone1 { background-position: -20px -80px; } -.emoji-angel_tone2 { background-position: -40px -80px; } -.emoji-angel_tone3 { background-position: -60px -80px; } -.emoji-angel_tone4 { background-position: -80px -80px; } -.emoji-angel_tone5 { background-position: -100px 0; } -.emoji-anger { background-position: -100px -20px; } -.emoji-anger_right { background-position: -100px -40px; } -.emoji-angry { background-position: -100px -60px; } -.emoji-ant { background-position: -100px -80px; } -.emoji-apple { background-position: 0 -100px; } -.emoji-aquarius { background-position: -20px -100px; } -.emoji-aries { background-position: -40px -100px; } -.emoji-arrow_backward { background-position: -60px -100px; } -.emoji-arrow_double_down { background-position: -80px -100px; } -.emoji-arrow_double_up { background-position: -100px -100px; } -.emoji-arrow_down { background-position: -120px 0; } -.emoji-arrow_down_small { background-position: -120px -20px; } -.emoji-arrow_forward { background-position: -120px -40px; } -.emoji-arrow_heading_down { background-position: -120px -60px; } -.emoji-arrow_heading_up { background-position: -120px -80px; } -.emoji-arrow_left { background-position: -120px -100px; } -.emoji-arrow_lower_left { background-position: 0 -120px; } -.emoji-arrow_lower_right { background-position: -20px -120px; } -.emoji-arrow_right { background-position: -40px -120px; } -.emoji-arrow_right_hook { background-position: -60px -120px; } -.emoji-arrow_up { background-position: -80px -120px; } -.emoji-arrow_up_down { background-position: -100px -120px; } -.emoji-arrow_up_small { background-position: -120px -120px; } -.emoji-arrow_upper_left { background-position: -140px 0; } -.emoji-arrow_upper_right { background-position: -140px -20px; } -.emoji-arrows_clockwise { background-position: -140px -40px; } -.emoji-arrows_counterclockwise { background-position: -140px -60px; } -.emoji-art { background-position: -140px -80px; } -.emoji-articulated_lorry { background-position: -140px -100px; } -.emoji-asterisk { background-position: -140px -120px; } -.emoji-astonished { background-position: 0 -140px; } -.emoji-athletic_shoe { background-position: -20px -140px; } -.emoji-atm { background-position: -40px -140px; } -.emoji-atom { background-position: -60px -140px; } -.emoji-avocado { background-position: -80px -140px; } -.emoji-b { background-position: -100px -140px; } -.emoji-baby { background-position: -120px -140px; } -.emoji-baby_bottle { background-position: -140px -140px; } -.emoji-baby_chick { background-position: -160px 0; } -.emoji-baby_symbol { background-position: -160px -20px; } -.emoji-baby_tone1 { background-position: -160px -40px; } -.emoji-baby_tone2 { background-position: -160px -60px; } -.emoji-baby_tone3 { background-position: -160px -80px; } -.emoji-baby_tone4 { background-position: -160px -100px; } -.emoji-baby_tone5 { background-position: -160px -120px; } -.emoji-back { background-position: -160px -140px; } -.emoji-bacon { background-position: 0 -160px; } -.emoji-badminton { background-position: -20px -160px; } -.emoji-baggage_claim { background-position: -40px -160px; } -.emoji-balloon { background-position: -60px -160px; } -.emoji-ballot_box { background-position: -80px -160px; } -.emoji-ballot_box_with_check { background-position: -100px -160px; } -.emoji-bamboo { background-position: -120px -160px; } -.emoji-banana { background-position: -140px -160px; } -.emoji-bangbang { background-position: -160px -160px; } -.emoji-bank { background-position: -180px 0; } -.emoji-bar_chart { background-position: -180px -20px; } -.emoji-barber { background-position: -180px -40px; } -.emoji-baseball { background-position: -180px -60px; } -.emoji-basketball { background-position: -180px -80px; } -.emoji-basketball_player { background-position: -180px -100px; } -.emoji-basketball_player_tone1 { background-position: -180px -120px; } -.emoji-basketball_player_tone2 { background-position: -180px -140px; } -.emoji-basketball_player_tone3 { background-position: -180px -160px; } -.emoji-basketball_player_tone4 { background-position: 0 -180px; } -.emoji-basketball_player_tone5 { background-position: -20px -180px; } -.emoji-bat { background-position: -40px -180px; } -.emoji-bath { background-position: -60px -180px; } -.emoji-bath_tone1 { background-position: -80px -180px; } -.emoji-bath_tone2 { background-position: -100px -180px; } -.emoji-bath_tone3 { background-position: -120px -180px; } -.emoji-bath_tone4 { background-position: -140px -180px; } -.emoji-bath_tone5 { background-position: -160px -180px; } -.emoji-bathtub { background-position: -180px -180px; } -.emoji-battery { background-position: -200px 0; } -.emoji-beach { background-position: -200px -20px; } -.emoji-beach_umbrella { background-position: -200px -40px; } -.emoji-bear { background-position: -200px -60px; } -.emoji-bed { background-position: -200px -80px; } -.emoji-bee { background-position: -200px -100px; } -.emoji-beer { background-position: -200px -120px; } -.emoji-beers { background-position: -200px -140px; } -.emoji-beetle { background-position: -200px -160px; } -.emoji-beginner { background-position: -200px -180px; } -.emoji-bell { background-position: 0 -200px; } -.emoji-bellhop { background-position: -20px -200px; } -.emoji-bento { background-position: -40px -200px; } -.emoji-bicyclist { background-position: -60px -200px; } -.emoji-bicyclist_tone1 { background-position: -80px -200px; } -.emoji-bicyclist_tone2 { background-position: -100px -200px; } -.emoji-bicyclist_tone3 { background-position: -120px -200px; } -.emoji-bicyclist_tone4 { background-position: -140px -200px; } -.emoji-bicyclist_tone5 { background-position: -160px -200px; } -.emoji-bike { background-position: -180px -200px; } -.emoji-bikini { background-position: -200px -200px; } -.emoji-biohazard { background-position: -220px 0; } -.emoji-bird { background-position: -220px -20px; } -.emoji-birthday { background-position: -220px -40px; } -.emoji-black_circle { background-position: -220px -60px; } -.emoji-black_heart { background-position: -220px -80px; } -.emoji-black_joker { background-position: -220px -100px; } -.emoji-black_large_square { background-position: -220px -120px; } -.emoji-black_medium_small_square { background-position: -220px -140px; } -.emoji-black_medium_square { background-position: -220px -160px; } -.emoji-black_nib { background-position: -220px -180px; } -.emoji-black_small_square { background-position: -220px -200px; } -.emoji-black_square_button { background-position: 0 -220px; } -.emoji-blossom { background-position: -20px -220px; } -.emoji-blowfish { background-position: -40px -220px; } -.emoji-blue_book { background-position: -60px -220px; } -.emoji-blue_car { background-position: -80px -220px; } -.emoji-blue_heart { background-position: -100px -220px; } -.emoji-blush { background-position: -120px -220px; } -.emoji-boar { background-position: -140px -220px; } -.emoji-bomb { background-position: -160px -220px; } -.emoji-book { background-position: -180px -220px; } -.emoji-bookmark { background-position: -200px -220px; } -.emoji-bookmark_tabs { background-position: -220px -220px; } -.emoji-books { background-position: -240px 0; } -.emoji-boom { background-position: -240px -20px; } -.emoji-boot { background-position: -240px -40px; } -.emoji-bouquet { background-position: -240px -60px; } -.emoji-bow { background-position: -240px -80px; } -.emoji-bow_and_arrow { background-position: -240px -100px; } -.emoji-bow_tone1 { background-position: -240px -120px; } -.emoji-bow_tone2 { background-position: -240px -140px; } -.emoji-bow_tone3 { background-position: -240px -160px; } -.emoji-bow_tone4 { background-position: -240px -180px; } -.emoji-bow_tone5 { background-position: -240px -200px; } -.emoji-bowling { background-position: -240px -220px; } -.emoji-boxing_glove { background-position: 0 -240px; } -.emoji-boy { background-position: -20px -240px; } -.emoji-boy_tone1 { background-position: -40px -240px; } -.emoji-boy_tone2 { background-position: -60px -240px; } -.emoji-boy_tone3 { background-position: -80px -240px; } -.emoji-boy_tone4 { background-position: -100px -240px; } -.emoji-boy_tone5 { background-position: -120px -240px; } -.emoji-bread { background-position: -140px -240px; } -.emoji-bride_with_veil { background-position: -160px -240px; } -.emoji-bride_with_veil_tone1 { background-position: -180px -240px; } -.emoji-bride_with_veil_tone2 { background-position: -200px -240px; } -.emoji-bride_with_veil_tone3 { background-position: -220px -240px; } -.emoji-bride_with_veil_tone4 { background-position: -240px -240px; } -.emoji-bride_with_veil_tone5 { background-position: -260px 0; } -.emoji-bridge_at_night { background-position: -260px -20px; } -.emoji-briefcase { background-position: -260px -40px; } -.emoji-broken_heart { background-position: -260px -60px; } -.emoji-bug { background-position: -260px -80px; } -.emoji-bulb { background-position: -260px -100px; } -.emoji-bullettrain_front { background-position: -260px -120px; } -.emoji-bullettrain_side { background-position: -260px -140px; } -.emoji-burrito { background-position: -260px -160px; } -.emoji-bus { background-position: -260px -180px; } -.emoji-busstop { background-position: -260px -200px; } -.emoji-bust_in_silhouette { background-position: -260px -220px; } -.emoji-busts_in_silhouette { background-position: -260px -240px; } -.emoji-butterfly { background-position: 0 -260px; } -.emoji-cactus { background-position: -20px -260px; } -.emoji-cake { background-position: -40px -260px; } -.emoji-calendar { background-position: -60px -260px; } -.emoji-calendar_spiral { background-position: -80px -260px; } -.emoji-call_me { background-position: -100px -260px; } -.emoji-call_me_tone1 { background-position: -120px -260px; } -.emoji-call_me_tone2 { background-position: -140px -260px; } -.emoji-call_me_tone3 { background-position: -160px -260px; } -.emoji-call_me_tone4 { background-position: -180px -260px; } -.emoji-call_me_tone5 { background-position: -200px -260px; } -.emoji-calling { background-position: -220px -260px; } -.emoji-camel { background-position: -240px -260px; } -.emoji-camera { background-position: -260px -260px; } -.emoji-camera_with_flash { background-position: -280px 0; } -.emoji-camping { background-position: -280px -20px; } -.emoji-cancer { background-position: -280px -40px; } -.emoji-candle { background-position: -280px -60px; } -.emoji-candy { background-position: -280px -80px; } -.emoji-canoe { background-position: -280px -100px; } -.emoji-capital_abcd { background-position: -280px -120px; } -.emoji-capricorn { background-position: -280px -140px; } -.emoji-card_box { background-position: -280px -160px; } -.emoji-card_index { background-position: -280px -180px; } -.emoji-carousel_horse { background-position: -280px -200px; } -.emoji-carrot { background-position: -280px -220px; } -.emoji-cartwheel { background-position: -280px -240px; } -.emoji-cartwheel_tone1 { background-position: -280px -260px; } -.emoji-cartwheel_tone2 { background-position: 0 -280px; } -.emoji-cartwheel_tone3 { background-position: -20px -280px; } -.emoji-cartwheel_tone4 { background-position: -40px -280px; } -.emoji-cartwheel_tone5 { background-position: -60px -280px; } -.emoji-cat { background-position: -80px -280px; } -.emoji-cat2 { background-position: -100px -280px; } -.emoji-cd { background-position: -120px -280px; } -.emoji-chains { background-position: -140px -280px; } -.emoji-champagne { background-position: -160px -280px; } -.emoji-champagne_glass { background-position: -180px -280px; } -.emoji-chart { background-position: -200px -280px; } -.emoji-chart_with_downwards_trend { background-position: -220px -280px; } -.emoji-chart_with_upwards_trend { background-position: -240px -280px; } -.emoji-checkered_flag { background-position: -260px -280px; } -.emoji-cheese { background-position: -280px -280px; } -.emoji-cherries { background-position: -300px 0; } -.emoji-cherry_blossom { background-position: -300px -20px; } -.emoji-chestnut { background-position: -300px -40px; } -.emoji-chicken { background-position: -300px -60px; } -.emoji-children_crossing { background-position: -300px -80px; } -.emoji-chipmunk { background-position: -300px -100px; } -.emoji-chocolate_bar { background-position: -300px -120px; } -.emoji-christmas_tree { background-position: -300px -140px; } -.emoji-church { background-position: -300px -160px; } -.emoji-cinema { background-position: -300px -180px; } -.emoji-circus_tent { background-position: -300px -200px; } -.emoji-city_dusk { background-position: -300px -220px; } -.emoji-city_sunset { background-position: -300px -240px; } -.emoji-cityscape { background-position: -300px -260px; } -.emoji-cl { background-position: -300px -280px; } -.emoji-clap { background-position: 0 -300px; } -.emoji-clap_tone1 { background-position: -20px -300px; } -.emoji-clap_tone2 { background-position: -40px -300px; } -.emoji-clap_tone3 { background-position: -60px -300px; } -.emoji-clap_tone4 { background-position: -80px -300px; } -.emoji-clap_tone5 { background-position: -100px -300px; } -.emoji-clapper { background-position: -120px -300px; } -.emoji-classical_building { background-position: -140px -300px; } -.emoji-clipboard { background-position: -160px -300px; } -.emoji-clock { background-position: -180px -300px; } -.emoji-clock1 { background-position: -200px -300px; } -.emoji-clock10 { background-position: -220px -300px; } -.emoji-clock1030 { background-position: -240px -300px; } -.emoji-clock11 { background-position: -260px -300px; } -.emoji-clock1130 { background-position: -280px -300px; } -.emoji-clock12 { background-position: -300px -300px; } -.emoji-clock1230 { background-position: -320px 0; } -.emoji-clock130 { background-position: -320px -20px; } -.emoji-clock2 { background-position: -320px -40px; } -.emoji-clock230 { background-position: -320px -60px; } -.emoji-clock3 { background-position: -320px -80px; } -.emoji-clock330 { background-position: -320px -100px; } -.emoji-clock4 { background-position: -320px -120px; } -.emoji-clock430 { background-position: -320px -140px; } -.emoji-clock5 { background-position: -320px -160px; } -.emoji-clock530 { background-position: -320px -180px; } -.emoji-clock6 { background-position: -320px -200px; } -.emoji-clock630 { background-position: -320px -220px; } -.emoji-clock7 { background-position: -320px -240px; } -.emoji-clock730 { background-position: -320px -260px; } -.emoji-clock8 { background-position: -320px -280px; } -.emoji-clock830 { background-position: -320px -300px; } -.emoji-clock9 { background-position: 0 -320px; } -.emoji-clock930 { background-position: -20px -320px; } -.emoji-closed_book { background-position: -40px -320px; } -.emoji-closed_lock_with_key { background-position: -60px -320px; } -.emoji-closed_umbrella { background-position: -80px -320px; } -.emoji-cloud { background-position: -100px -320px; } -.emoji-cloud_lightning { background-position: -120px -320px; } -.emoji-cloud_rain { background-position: -140px -320px; } -.emoji-cloud_snow { background-position: -160px -320px; } -.emoji-cloud_tornado { background-position: -180px -320px; } -.emoji-clown { background-position: -200px -320px; } -.emoji-clubs { background-position: -220px -320px; } -.emoji-cocktail { background-position: -240px -320px; } -.emoji-coffee { background-position: -260px -320px; } -.emoji-coffin { background-position: -280px -320px; } -.emoji-cold_sweat { background-position: -300px -320px; } -.emoji-comet { background-position: -320px -320px; } -.emoji-compression { background-position: -340px 0; } -.emoji-computer { background-position: -340px -20px; } -.emoji-confetti_ball { background-position: -340px -40px; } -.emoji-confounded { background-position: -340px -60px; } -.emoji-confused { background-position: -340px -80px; } -.emoji-congratulations { background-position: -340px -100px; } -.emoji-construction { background-position: -340px -120px; } -.emoji-construction_site { background-position: -340px -140px; } -.emoji-construction_worker { background-position: -340px -160px; } -.emoji-construction_worker_tone1 { background-position: -340px -180px; } -.emoji-construction_worker_tone2 { background-position: -340px -200px; } -.emoji-construction_worker_tone3 { background-position: -340px -220px; } -.emoji-construction_worker_tone4 { background-position: -340px -240px; } -.emoji-construction_worker_tone5 { background-position: -340px -260px; } -.emoji-control_knobs { background-position: -340px -280px; } -.emoji-convenience_store { background-position: -340px -300px; } -.emoji-cookie { background-position: -340px -320px; } -.emoji-cooking { background-position: 0 -340px; } -.emoji-cool { background-position: -20px -340px; } -.emoji-cop { background-position: -40px -340px; } -.emoji-cop_tone1 { background-position: -60px -340px; } -.emoji-cop_tone2 { background-position: -80px -340px; } -.emoji-cop_tone3 { background-position: -100px -340px; } -.emoji-cop_tone4 { background-position: -120px -340px; } -.emoji-cop_tone5 { background-position: -140px -340px; } -.emoji-copyright { background-position: -160px -340px; } -.emoji-corn { background-position: -180px -340px; } -.emoji-couch { background-position: -200px -340px; } -.emoji-couple { background-position: -220px -340px; } -.emoji-couple_mm { background-position: -240px -340px; } -.emoji-couple_with_heart { background-position: -260px -340px; } -.emoji-couple_ww { background-position: -280px -340px; } -.emoji-couplekiss { background-position: -300px -340px; } -.emoji-cow { background-position: -320px -340px; } -.emoji-cow2 { background-position: -340px -340px; } -.emoji-cowboy { background-position: -360px 0; } -.emoji-crab { background-position: -360px -20px; } -.emoji-crayon { background-position: -360px -40px; } -.emoji-credit_card { background-position: -360px -60px; } -.emoji-crescent_moon { background-position: -360px -80px; } -.emoji-cricket { background-position: -360px -100px; } -.emoji-crocodile { background-position: -360px -120px; } -.emoji-croissant { background-position: -360px -140px; } -.emoji-cross { background-position: -360px -160px; } -.emoji-crossed_flags { background-position: -360px -180px; } -.emoji-crossed_swords { background-position: -360px -200px; } -.emoji-crown { background-position: -360px -220px; } -.emoji-cruise_ship { background-position: -360px -240px; } -.emoji-cry { background-position: -360px -260px; } -.emoji-crying_cat_face { background-position: -360px -280px; } -.emoji-crystal_ball { background-position: -360px -300px; } -.emoji-cucumber { background-position: -360px -320px; } -.emoji-cupid { background-position: -360px -340px; } -.emoji-curly_loop { background-position: 0 -360px; } -.emoji-currency_exchange { background-position: -20px -360px; } -.emoji-curry { background-position: -40px -360px; } -.emoji-custard { background-position: -60px -360px; } -.emoji-customs { background-position: -80px -360px; } -.emoji-cyclone { background-position: -100px -360px; } -.emoji-dagger { background-position: -120px -360px; } -.emoji-dancer { background-position: -140px -360px; } -.emoji-dancer_tone1 { background-position: -160px -360px; } -.emoji-dancer_tone2 { background-position: -180px -360px; } -.emoji-dancer_tone3 { background-position: -200px -360px; } -.emoji-dancer_tone4 { background-position: -220px -360px; } -.emoji-dancer_tone5 { background-position: -240px -360px; } -.emoji-dancers { background-position: -260px -360px; } -.emoji-dango { background-position: -280px -360px; } -.emoji-dark_sunglasses { background-position: -300px -360px; } -.emoji-dart { background-position: -320px -360px; } -.emoji-dash { background-position: -340px -360px; } -.emoji-date { background-position: -360px -360px; } -.emoji-deciduous_tree { background-position: -380px 0; } -.emoji-deer { background-position: -380px -20px; } -.emoji-department_store { background-position: -380px -40px; } -.emoji-desert { background-position: -380px -60px; } -.emoji-desktop { background-position: -380px -80px; } -.emoji-diamond_shape_with_a_dot_inside { background-position: -380px -100px; } -.emoji-diamonds { background-position: -380px -120px; } -.emoji-disappointed { background-position: -380px -140px; } -.emoji-disappointed_relieved { background-position: -380px -160px; } -.emoji-dividers { background-position: -380px -180px; } -.emoji-dizzy { background-position: -380px -200px; } -.emoji-dizzy_face { background-position: -380px -220px; } -.emoji-do_not_litter { background-position: -380px -240px; } -.emoji-dog { background-position: -380px -260px; } -.emoji-dog2 { background-position: -380px -280px; } -.emoji-dollar { background-position: -380px -300px; } -.emoji-dolls { background-position: -380px -320px; } -.emoji-dolphin { background-position: -380px -340px; } -.emoji-door { background-position: -380px -360px; } -.emoji-doughnut { background-position: 0 -380px; } -.emoji-dove { background-position: -20px -380px; } -.emoji-dragon { background-position: -40px -380px; } -.emoji-dragon_face { background-position: -60px -380px; } -.emoji-dress { background-position: -80px -380px; } -.emoji-dromedary_camel { background-position: -100px -380px; } -.emoji-drooling_face { background-position: -120px -380px; } -.emoji-droplet { background-position: -140px -380px; } -.emoji-drum { background-position: -160px -380px; } -.emoji-duck { background-position: -180px -380px; } -.emoji-dvd { background-position: -200px -380px; } -.emoji-e-mail { background-position: -220px -380px; } -.emoji-eagle { background-position: -240px -380px; } -.emoji-ear { background-position: -260px -380px; } -.emoji-ear_of_rice { background-position: -280px -380px; } -.emoji-ear_tone1 { background-position: -300px -380px; } -.emoji-ear_tone2 { background-position: -320px -380px; } -.emoji-ear_tone3 { background-position: -340px -380px; } -.emoji-ear_tone4 { background-position: -360px -380px; } -.emoji-ear_tone5 { background-position: -380px -380px; } -.emoji-earth_africa { background-position: -400px 0; } -.emoji-earth_americas { background-position: -400px -20px; } -.emoji-earth_asia { background-position: -400px -40px; } -.emoji-egg { background-position: -400px -60px; } -.emoji-eggplant { background-position: -400px -80px; } -.emoji-eight { background-position: -400px -100px; } -.emoji-eight_pointed_black_star { background-position: -400px -120px; } -.emoji-eight_spoked_asterisk { background-position: -400px -140px; } -.emoji-eject { background-position: -400px -160px; } -.emoji-electric_plug { background-position: -400px -180px; } -.emoji-elephant { background-position: -400px -200px; } -.emoji-end { background-position: -400px -220px; } -.emoji-envelope { background-position: -400px -240px; } -.emoji-envelope_with_arrow { background-position: -400px -260px; } -.emoji-euro { background-position: -400px -280px; } -.emoji-european_castle { background-position: -400px -300px; } -.emoji-european_post_office { background-position: -400px -320px; } -.emoji-evergreen_tree { background-position: -400px -340px; } -.emoji-exclamation { background-position: -400px -360px; } -.emoji-expressionless { background-position: -400px -380px; } -.emoji-eye { background-position: 0 -400px; } -.emoji-eye_in_speech_bubble { background-position: -20px -400px; } -.emoji-eyeglasses { background-position: -40px -400px; } -.emoji-eyes { background-position: -60px -400px; } -.emoji-face_palm { background-position: -80px -400px; } -.emoji-face_palm_tone1 { background-position: -100px -400px; } -.emoji-face_palm_tone2 { background-position: -120px -400px; } -.emoji-face_palm_tone3 { background-position: -140px -400px; } -.emoji-face_palm_tone4 { background-position: -160px -400px; } -.emoji-face_palm_tone5 { background-position: -180px -400px; } -.emoji-factory { background-position: -200px -400px; } -.emoji-fallen_leaf { background-position: -220px -400px; } -.emoji-family { background-position: -240px -400px; } -.emoji-family_mmb { background-position: -260px -400px; } -.emoji-family_mmbb { background-position: -280px -400px; } -.emoji-family_mmg { background-position: -300px -400px; } -.emoji-family_mmgb { background-position: -320px -400px; } -.emoji-family_mmgg { background-position: -340px -400px; } -.emoji-family_mwbb { background-position: -360px -400px; } -.emoji-family_mwg { background-position: -380px -400px; } -.emoji-family_mwgb { background-position: -400px -400px; } -.emoji-family_mwgg { background-position: -420px 0; } -.emoji-family_wwb { background-position: -420px -20px; } -.emoji-family_wwbb { background-position: -420px -40px; } -.emoji-family_wwg { background-position: -420px -60px; } -.emoji-family_wwgb { background-position: -420px -80px; } -.emoji-family_wwgg { background-position: -420px -100px; } -.emoji-fast_forward { background-position: -420px -120px; } -.emoji-fax { background-position: -420px -140px; } -.emoji-fearful { background-position: -420px -160px; } -.emoji-feet { background-position: -420px -180px; } -.emoji-fencer { background-position: -420px -200px; } -.emoji-ferris_wheel { background-position: -420px -220px; } -.emoji-ferry { background-position: -420px -240px; } -.emoji-field_hockey { background-position: -420px -260px; } -.emoji-file_cabinet { background-position: -420px -280px; } -.emoji-file_folder { background-position: -420px -300px; } -.emoji-film_frames { background-position: -420px -320px; } -.emoji-fingers_crossed { background-position: -420px -340px; } -.emoji-fingers_crossed_tone1 { background-position: -420px -360px; } -.emoji-fingers_crossed_tone2 { background-position: -420px -380px; } -.emoji-fingers_crossed_tone3 { background-position: -420px -400px; } -.emoji-fingers_crossed_tone4 { background-position: 0 -420px; } -.emoji-fingers_crossed_tone5 { background-position: -20px -420px; } -.emoji-fire { background-position: -40px -420px; } -.emoji-fire_engine { background-position: -60px -420px; } -.emoji-fireworks { background-position: -80px -420px; } -.emoji-first_place { background-position: -100px -420px; } -.emoji-first_quarter_moon { background-position: -120px -420px; } -.emoji-first_quarter_moon_with_face { background-position: -140px -420px; } -.emoji-fish { background-position: -160px -420px; } -.emoji-fish_cake { background-position: -180px -420px; } -.emoji-fishing_pole_and_fish { background-position: -200px -420px; } -.emoji-fist { background-position: -220px -420px; } -.emoji-fist_tone1 { background-position: -240px -420px; } -.emoji-fist_tone2 { background-position: -260px -420px; } -.emoji-fist_tone3 { background-position: -280px -420px; } -.emoji-fist_tone4 { background-position: -300px -420px; } -.emoji-fist_tone5 { background-position: -320px -420px; } -.emoji-five { background-position: -340px -420px; } -.emoji-flag_ac { background-position: -360px -420px; } -.emoji-flag_ad { background-position: -380px -420px; } -.emoji-flag_ae { background-position: -400px -420px; } -.emoji-flag_af { background-position: -420px -420px; } -.emoji-flag_ag { background-position: -440px 0; } -.emoji-flag_ai { background-position: -440px -20px; } -.emoji-flag_al { background-position: -440px -40px; } -.emoji-flag_am { background-position: -440px -60px; } -.emoji-flag_ao { background-position: -440px -80px; } -.emoji-flag_aq { background-position: -440px -100px; } -.emoji-flag_ar { background-position: -440px -120px; } -.emoji-flag_as { background-position: -440px -140px; } -.emoji-flag_at { background-position: -440px -160px; } -.emoji-flag_au { background-position: -440px -180px; } -.emoji-flag_aw { background-position: -440px -200px; } -.emoji-flag_ax { background-position: -440px -220px; } -.emoji-flag_az { background-position: -440px -240px; } -.emoji-flag_ba { background-position: -440px -260px; } -.emoji-flag_bb { background-position: -440px -280px; } -.emoji-flag_bd { background-position: -440px -300px; } -.emoji-flag_be { background-position: -440px -320px; } -.emoji-flag_bf { background-position: -440px -340px; } -.emoji-flag_bg { background-position: -440px -360px; } -.emoji-flag_bh { background-position: -440px -380px; } -.emoji-flag_bi { background-position: -440px -400px; } -.emoji-flag_bj { background-position: -440px -420px; } -.emoji-flag_bl { background-position: 0 -440px; } -.emoji-flag_black { background-position: -20px -440px; } -.emoji-flag_bm { background-position: -40px -440px; } -.emoji-flag_bn { background-position: -60px -440px; } -.emoji-flag_bo { background-position: -80px -440px; } -.emoji-flag_bq { background-position: -100px -440px; } -.emoji-flag_br { background-position: -120px -440px; } -.emoji-flag_bs { background-position: -140px -440px; } -.emoji-flag_bt { background-position: -160px -440px; } -.emoji-flag_bv { background-position: -180px -440px; } -.emoji-flag_bw { background-position: -200px -440px; } -.emoji-flag_by { background-position: -220px -440px; } -.emoji-flag_bz { background-position: -240px -440px; } -.emoji-flag_ca { background-position: -260px -440px; } -.emoji-flag_cc { background-position: -280px -440px; } -.emoji-flag_cd { background-position: -300px -440px; } -.emoji-flag_cf { background-position: -320px -440px; } -.emoji-flag_cg { background-position: -340px -440px; } -.emoji-flag_ch { background-position: -360px -440px; } -.emoji-flag_ci { background-position: -380px -440px; } -.emoji-flag_ck { background-position: -400px -440px; } -.emoji-flag_cl { background-position: -420px -440px; } -.emoji-flag_cm { background-position: -440px -440px; } -.emoji-flag_cn { background-position: -460px 0; } -.emoji-flag_co { background-position: -460px -20px; } -.emoji-flag_cp { background-position: -460px -40px; } -.emoji-flag_cr { background-position: -460px -60px; } -.emoji-flag_cu { background-position: -460px -80px; } -.emoji-flag_cv { background-position: -460px -100px; } -.emoji-flag_cw { background-position: -460px -120px; } -.emoji-flag_cx { background-position: -460px -140px; } -.emoji-flag_cy { background-position: -460px -160px; } -.emoji-flag_cz { background-position: -460px -180px; } -.emoji-flag_de { background-position: -460px -200px; } -.emoji-flag_dg { background-position: -460px -220px; } -.emoji-flag_dj { background-position: -460px -240px; } -.emoji-flag_dk { background-position: -460px -260px; } -.emoji-flag_dm { background-position: -460px -280px; } -.emoji-flag_do { background-position: -460px -300px; } -.emoji-flag_dz { background-position: -460px -320px; } -.emoji-flag_ea { background-position: -460px -340px; } -.emoji-flag_ec { background-position: -460px -360px; } -.emoji-flag_ee { background-position: -460px -380px; } -.emoji-flag_eg { background-position: -460px -400px; } -.emoji-flag_eh { background-position: -460px -420px; } -.emoji-flag_er { background-position: -460px -440px; } -.emoji-flag_es { background-position: 0 -460px; } -.emoji-flag_et { background-position: -20px -460px; } -.emoji-flag_eu { background-position: -40px -460px; } -.emoji-flag_fi { background-position: -60px -460px; } -.emoji-flag_fj { background-position: -80px -460px; } -.emoji-flag_fk { background-position: -100px -460px; } -.emoji-flag_fm { background-position: -120px -460px; } -.emoji-flag_fo { background-position: -140px -460px; } -.emoji-flag_fr { background-position: -160px -460px; } -.emoji-flag_ga { background-position: -180px -460px; } -.emoji-flag_gb { background-position: -200px -460px; } -.emoji-flag_gd { background-position: -220px -460px; } -.emoji-flag_ge { background-position: -240px -460px; } -.emoji-flag_gf { background-position: -260px -460px; } -.emoji-flag_gg { background-position: -280px -460px; } -.emoji-flag_gh { background-position: -300px -460px; } -.emoji-flag_gi { background-position: -320px -460px; } -.emoji-flag_gl { background-position: -340px -460px; } -.emoji-flag_gm { background-position: -360px -460px; } -.emoji-flag_gn { background-position: -380px -460px; } -.emoji-flag_gp { background-position: -400px -460px; } -.emoji-flag_gq { background-position: -420px -460px; } -.emoji-flag_gr { background-position: -440px -460px; } -.emoji-flag_gs { background-position: -460px -460px; } -.emoji-flag_gt { background-position: -480px 0; } -.emoji-flag_gu { background-position: -480px -20px; } -.emoji-flag_gw { background-position: -480px -40px; } -.emoji-flag_gy { background-position: -480px -60px; } -.emoji-flag_hk { background-position: -480px -80px; } -.emoji-flag_hm { background-position: -480px -100px; } -.emoji-flag_hn { background-position: -480px -120px; } -.emoji-flag_hr { background-position: -480px -140px; } -.emoji-flag_ht { background-position: -480px -160px; } -.emoji-flag_hu { background-position: -480px -180px; } -.emoji-flag_ic { background-position: -480px -200px; } -.emoji-flag_id { background-position: -480px -220px; } -.emoji-flag_ie { background-position: -480px -240px; } -.emoji-flag_il { background-position: -480px -260px; } -.emoji-flag_im { background-position: -480px -280px; } -.emoji-flag_in { background-position: -480px -300px; } -.emoji-flag_io { background-position: -480px -320px; } -.emoji-flag_iq { background-position: -480px -340px; } -.emoji-flag_ir { background-position: -480px -360px; } -.emoji-flag_is { background-position: -480px -380px; } -.emoji-flag_it { background-position: -480px -400px; } -.emoji-flag_je { background-position: -480px -420px; } -.emoji-flag_jm { background-position: -480px -440px; } -.emoji-flag_jo { background-position: -480px -460px; } -.emoji-flag_jp { background-position: 0 -480px; } -.emoji-flag_ke { background-position: -20px -480px; } -.emoji-flag_kg { background-position: -40px -480px; } -.emoji-flag_kh { background-position: -60px -480px; } -.emoji-flag_ki { background-position: -80px -480px; } -.emoji-flag_km { background-position: -100px -480px; } -.emoji-flag_kn { background-position: -120px -480px; } -.emoji-flag_kp { background-position: -140px -480px; } -.emoji-flag_kr { background-position: -160px -480px; } -.emoji-flag_kw { background-position: -180px -480px; } -.emoji-flag_ky { background-position: -200px -480px; } -.emoji-flag_kz { background-position: -220px -480px; } -.emoji-flag_la { background-position: -240px -480px; } -.emoji-flag_lb { background-position: -260px -480px; } -.emoji-flag_lc { background-position: -280px -480px; } -.emoji-flag_li { background-position: -300px -480px; } -.emoji-flag_lk { background-position: -320px -480px; } -.emoji-flag_lr { background-position: -340px -480px; } -.emoji-flag_ls { background-position: -360px -480px; } -.emoji-flag_lt { background-position: -380px -480px; } -.emoji-flag_lu { background-position: -400px -480px; } -.emoji-flag_lv { background-position: -420px -480px; } -.emoji-flag_ly { background-position: -440px -480px; } -.emoji-flag_ma { background-position: -460px -480px; } -.emoji-flag_mc { background-position: -480px -480px; } -.emoji-flag_md { background-position: -500px 0; } -.emoji-flag_me { background-position: -500px -20px; } -.emoji-flag_mf { background-position: -500px -40px; } -.emoji-flag_mg { background-position: -500px -60px; } -.emoji-flag_mh { background-position: -500px -80px; } -.emoji-flag_mk { background-position: -500px -100px; } -.emoji-flag_ml { background-position: -500px -120px; } -.emoji-flag_mm { background-position: -500px -140px; } -.emoji-flag_mn { background-position: -500px -160px; } -.emoji-flag_mo { background-position: -500px -180px; } -.emoji-flag_mp { background-position: -500px -200px; } -.emoji-flag_mq { background-position: -500px -220px; } -.emoji-flag_mr { background-position: -500px -240px; } -.emoji-flag_ms { background-position: -500px -260px; } -.emoji-flag_mt { background-position: -500px -280px; } -.emoji-flag_mu { background-position: -500px -300px; } -.emoji-flag_mv { background-position: -500px -320px; } -.emoji-flag_mw { background-position: -500px -340px; } -.emoji-flag_mx { background-position: -500px -360px; } -.emoji-flag_my { background-position: -500px -380px; } -.emoji-flag_mz { background-position: -500px -400px; } -.emoji-flag_na { background-position: -500px -420px; } -.emoji-flag_nc { background-position: -500px -440px; } -.emoji-flag_ne { background-position: -500px -460px; } -.emoji-flag_nf { background-position: -500px -480px; } -.emoji-flag_ng { background-position: 0 -500px; } -.emoji-flag_ni { background-position: -20px -500px; } -.emoji-flag_nl { background-position: -40px -500px; } -.emoji-flag_no { background-position: -60px -500px; } -.emoji-flag_np { background-position: -80px -500px; } -.emoji-flag_nr { background-position: -100px -500px; } -.emoji-flag_nu { background-position: -120px -500px; } -.emoji-flag_nz { background-position: -140px -500px; } -.emoji-flag_om { background-position: -160px -500px; } -.emoji-flag_pa { background-position: -180px -500px; } -.emoji-flag_pe { background-position: -200px -500px; } -.emoji-flag_pf { background-position: -220px -500px; } -.emoji-flag_pg { background-position: -240px -500px; } -.emoji-flag_ph { background-position: -260px -500px; } -.emoji-flag_pk { background-position: -280px -500px; } -.emoji-flag_pl { background-position: -300px -500px; } -.emoji-flag_pm { background-position: -320px -500px; } -.emoji-flag_pn { background-position: -340px -500px; } -.emoji-flag_pr { background-position: -360px -500px; } -.emoji-flag_ps { background-position: -380px -500px; } -.emoji-flag_pt { background-position: -400px -500px; } -.emoji-flag_pw { background-position: -420px -500px; } -.emoji-flag_py { background-position: -440px -500px; } -.emoji-flag_qa { background-position: -460px -500px; } -.emoji-flag_re { background-position: -480px -500px; } -.emoji-flag_ro { background-position: -500px -500px; } -.emoji-flag_rs { background-position: -520px 0; } -.emoji-flag_ru { background-position: -520px -20px; } -.emoji-flag_rw { background-position: -520px -40px; } -.emoji-flag_sa { background-position: -520px -60px; } -.emoji-flag_sb { background-position: -520px -80px; } -.emoji-flag_sc { background-position: -520px -100px; } -.emoji-flag_sd { background-position: -520px -120px; } -.emoji-flag_se { background-position: -520px -140px; } -.emoji-flag_sg { background-position: -520px -160px; } -.emoji-flag_sh { background-position: -520px -180px; } -.emoji-flag_si { background-position: -520px -200px; } -.emoji-flag_sj { background-position: -520px -220px; } -.emoji-flag_sk { background-position: -520px -240px; } -.emoji-flag_sl { background-position: -520px -260px; } -.emoji-flag_sm { background-position: -520px -280px; } -.emoji-flag_sn { background-position: -520px -300px; } -.emoji-flag_so { background-position: -520px -320px; } -.emoji-flag_sr { background-position: -520px -340px; } -.emoji-flag_ss { background-position: -520px -360px; } -.emoji-flag_st { background-position: -520px -380px; } -.emoji-flag_sv { background-position: -520px -400px; } -.emoji-flag_sx { background-position: -520px -420px; } -.emoji-flag_sy { background-position: -520px -440px; } -.emoji-flag_sz { background-position: -520px -460px; } -.emoji-flag_ta { background-position: -520px -480px; } -.emoji-flag_tc { background-position: -520px -500px; } -.emoji-flag_td { background-position: 0 -520px; } -.emoji-flag_tf { background-position: -20px -520px; } -.emoji-flag_tg { background-position: -40px -520px; } -.emoji-flag_th { background-position: -60px -520px; } -.emoji-flag_tj { background-position: -80px -520px; } -.emoji-flag_tk { background-position: -100px -520px; } -.emoji-flag_tl { background-position: -120px -520px; } -.emoji-flag_tm { background-position: -140px -520px; } -.emoji-flag_tn { background-position: -160px -520px; } -.emoji-flag_to { background-position: -180px -520px; } -.emoji-flag_tr { background-position: -200px -520px; } -.emoji-flag_tt { background-position: -220px -520px; } -.emoji-flag_tv { background-position: -240px -520px; } -.emoji-flag_tw { background-position: -260px -520px; } -.emoji-flag_tz { background-position: -280px -520px; } -.emoji-flag_ua { background-position: -300px -520px; } -.emoji-flag_ug { background-position: -320px -520px; } -.emoji-flag_um { background-position: -340px -520px; } -.emoji-flag_us { background-position: -360px -520px; } -.emoji-flag_uy { background-position: -380px -520px; } -.emoji-flag_uz { background-position: -400px -520px; } -.emoji-flag_va { background-position: -420px -520px; } -.emoji-flag_vc { background-position: -440px -520px; } -.emoji-flag_ve { background-position: -460px -520px; } -.emoji-flag_vg { background-position: -480px -520px; } -.emoji-flag_vi { background-position: -500px -520px; } -.emoji-flag_vn { background-position: -520px -520px; } -.emoji-flag_vu { background-position: -540px 0; } -.emoji-flag_wf { background-position: -540px -20px; } -.emoji-flag_white { background-position: -540px -40px; } -.emoji-flag_ws { background-position: -540px -60px; } -.emoji-flag_xk { background-position: -540px -80px; } -.emoji-flag_ye { background-position: -540px -100px; } -.emoji-flag_yt { background-position: -540px -120px; } -.emoji-flag_za { background-position: -540px -140px; } -.emoji-flag_zm { background-position: -540px -160px; } -.emoji-flag_zw { background-position: -540px -180px; } -.emoji-flags { background-position: -540px -200px; } -.emoji-flashlight { background-position: -540px -220px; } -.emoji-fleur-de-lis { background-position: -540px -240px; } -.emoji-floppy_disk { background-position: -540px -260px; } -.emoji-flower_playing_cards { background-position: -540px -280px; } -.emoji-flushed { background-position: -540px -300px; } -.emoji-fog { background-position: -540px -320px; } -.emoji-foggy { background-position: -540px -340px; } -.emoji-football { background-position: -540px -360px; } -.emoji-footprints { background-position: -540px -380px; } -.emoji-fork_and_knife { background-position: -540px -400px; } -.emoji-fork_knife_plate { background-position: -540px -420px; } -.emoji-fountain { background-position: -540px -440px; } -.emoji-four { background-position: -540px -460px; } -.emoji-four_leaf_clover { background-position: -540px -480px; } -.emoji-fox { background-position: -540px -500px; } -.emoji-frame_photo { background-position: -540px -520px; } -.emoji-free { background-position: 0 -540px; } -.emoji-french_bread { background-position: -20px -540px; } -.emoji-fried_shrimp { background-position: -40px -540px; } -.emoji-fries { background-position: -60px -540px; } -.emoji-frog { background-position: -80px -540px; } -.emoji-frowning { background-position: -100px -540px; } -.emoji-frowning2 { background-position: -120px -540px; } -.emoji-fuelpump { background-position: -140px -540px; } -.emoji-full_moon { background-position: -160px -540px; } -.emoji-full_moon_with_face { background-position: -180px -540px; } -.emoji-game_die { background-position: -200px -540px; } -.emoji-gay_pride_flag { background-position: -220px -540px; } -.emoji-gear { background-position: -240px -540px; } -.emoji-gem { background-position: -260px -540px; } -.emoji-gemini { background-position: -280px -540px; } -.emoji-ghost { background-position: -300px -540px; } -.emoji-gift { background-position: -320px -540px; } -.emoji-gift_heart { background-position: -340px -540px; } -.emoji-girl { background-position: -360px -540px; } -.emoji-girl_tone1 { background-position: -380px -540px; } -.emoji-girl_tone2 { background-position: -400px -540px; } -.emoji-girl_tone3 { background-position: -420px -540px; } -.emoji-girl_tone4 { background-position: -440px -540px; } -.emoji-girl_tone5 { background-position: -460px -540px; } -.emoji-globe_with_meridians { background-position: -480px -540px; } -.emoji-goal { background-position: -500px -540px; } -.emoji-goat { background-position: -520px -540px; } -.emoji-golf { background-position: -540px -540px; } -.emoji-golfer { background-position: -560px 0; } -.emoji-gorilla { background-position: -560px -20px; } -.emoji-grapes { background-position: -560px -40px; } -.emoji-green_apple { background-position: -560px -60px; } -.emoji-green_book { background-position: -560px -80px; } -.emoji-green_heart { background-position: -560px -100px; } -.emoji-grey_exclamation { background-position: -560px -120px; } -.emoji-grey_question { background-position: -560px -140px; } -.emoji-grimacing { background-position: -560px -160px; } -.emoji-grin { background-position: -560px -180px; } -.emoji-grinning { background-position: -560px -200px; } -.emoji-guardsman { background-position: -560px -220px; } -.emoji-guardsman_tone1 { background-position: -560px -240px; } -.emoji-guardsman_tone2 { background-position: -560px -260px; } -.emoji-guardsman_tone3 { background-position: -560px -280px; } -.emoji-guardsman_tone4 { background-position: -560px -300px; } -.emoji-guardsman_tone5 { background-position: -560px -320px; } -.emoji-guitar { background-position: -560px -340px; } -.emoji-gun { background-position: -560px -360px; } -.emoji-haircut { background-position: -560px -380px; } -.emoji-haircut_tone1 { background-position: -560px -400px; } -.emoji-haircut_tone2 { background-position: -560px -420px; } -.emoji-haircut_tone3 { background-position: -560px -440px; } -.emoji-haircut_tone4 { background-position: -560px -460px; } -.emoji-haircut_tone5 { background-position: -560px -480px; } -.emoji-hamburger { background-position: -560px -500px; } -.emoji-hammer { background-position: -560px -520px; } -.emoji-hammer_pick { background-position: -560px -540px; } -.emoji-hamster { background-position: 0 -560px; } -.emoji-hand_splayed { background-position: -20px -560px; } -.emoji-hand_splayed_tone1 { background-position: -40px -560px; } -.emoji-hand_splayed_tone2 { background-position: -60px -560px; } -.emoji-hand_splayed_tone3 { background-position: -80px -560px; } -.emoji-hand_splayed_tone4 { background-position: -100px -560px; } -.emoji-hand_splayed_tone5 { background-position: -120px -560px; } -.emoji-handbag { background-position: -140px -560px; } -.emoji-handball { background-position: -160px -560px; } -.emoji-handball_tone1 { background-position: -180px -560px; } -.emoji-handball_tone2 { background-position: -200px -560px; } -.emoji-handball_tone3 { background-position: -220px -560px; } -.emoji-handball_tone4 { background-position: -240px -560px; } -.emoji-handball_tone5 { background-position: -260px -560px; } -.emoji-handshake { background-position: -280px -560px; } -.emoji-handshake_tone1 { background-position: -300px -560px; } -.emoji-handshake_tone2 { background-position: -320px -560px; } -.emoji-handshake_tone3 { background-position: -340px -560px; } -.emoji-handshake_tone4 { background-position: -360px -560px; } -.emoji-handshake_tone5 { background-position: -380px -560px; } -.emoji-hash { background-position: -400px -560px; } -.emoji-hatched_chick { background-position: -420px -560px; } -.emoji-hatching_chick { background-position: -440px -560px; } -.emoji-head_bandage { background-position: -460px -560px; } -.emoji-headphones { background-position: -480px -560px; } -.emoji-hear_no_evil { background-position: -500px -560px; } -.emoji-heart { background-position: -520px -560px; } -.emoji-heart_decoration { background-position: -540px -560px; } -.emoji-heart_exclamation { background-position: -560px -560px; } -.emoji-heart_eyes { background-position: -580px 0; } -.emoji-heart_eyes_cat { background-position: -580px -20px; } -.emoji-heartbeat { background-position: -580px -40px; } -.emoji-heartpulse { background-position: -580px -60px; } -.emoji-hearts { background-position: -580px -80px; } -.emoji-heavy_check_mark { background-position: -580px -100px; } -.emoji-heavy_division_sign { background-position: -580px -120px; } -.emoji-heavy_dollar_sign { background-position: -580px -140px; } -.emoji-heavy_minus_sign { background-position: -580px -160px; } -.emoji-heavy_multiplication_x { background-position: -580px -180px; } -.emoji-heavy_plus_sign { background-position: -580px -200px; } -.emoji-helicopter { background-position: -580px -220px; } -.emoji-helmet_with_cross { background-position: -580px -240px; } -.emoji-herb { background-position: -580px -260px; } -.emoji-hibiscus { background-position: -580px -280px; } -.emoji-high_brightness { background-position: -580px -300px; } -.emoji-high_heel { background-position: -580px -320px; } -.emoji-hockey { background-position: -580px -340px; } -.emoji-hole { background-position: -580px -360px; } -.emoji-homes { background-position: -580px -380px; } -.emoji-honey_pot { background-position: -580px -400px; } -.emoji-horse { background-position: -580px -420px; } -.emoji-horse_racing { background-position: -580px -440px; } -.emoji-horse_racing_tone1 { background-position: -580px -460px; } -.emoji-horse_racing_tone2 { background-position: -580px -480px; } -.emoji-horse_racing_tone3 { background-position: -580px -500px; } -.emoji-horse_racing_tone4 { background-position: -580px -520px; } -.emoji-horse_racing_tone5 { background-position: -580px -540px; } -.emoji-hospital { background-position: -580px -560px; } -.emoji-hot_pepper { background-position: 0 -580px; } -.emoji-hotdog { background-position: -20px -580px; } -.emoji-hotel { background-position: -40px -580px; } -.emoji-hotsprings { background-position: -60px -580px; } -.emoji-hourglass { background-position: -80px -580px; } -.emoji-hourglass_flowing_sand { background-position: -100px -580px; } -.emoji-house { background-position: -120px -580px; } -.emoji-house_abandoned { background-position: -140px -580px; } -.emoji-house_with_garden { background-position: -160px -580px; } -.emoji-hugging { background-position: -180px -580px; } -.emoji-hushed { background-position: -200px -580px; } -.emoji-ice_cream { background-position: -220px -580px; } -.emoji-ice_skate { background-position: -240px -580px; } -.emoji-icecream { background-position: -260px -580px; } -.emoji-id { background-position: -280px -580px; } -.emoji-ideograph_advantage { background-position: -300px -580px; } -.emoji-imp { background-position: -320px -580px; } -.emoji-inbox_tray { background-position: -340px -580px; } -.emoji-incoming_envelope { background-position: -360px -580px; } -.emoji-information_desk_person { background-position: -380px -580px; } -.emoji-information_desk_person_tone1 { background-position: -400px -580px; } -.emoji-information_desk_person_tone2 { background-position: -420px -580px; } -.emoji-information_desk_person_tone3 { background-position: -440px -580px; } -.emoji-information_desk_person_tone4 { background-position: -460px -580px; } -.emoji-information_desk_person_tone5 { background-position: -480px -580px; } -.emoji-information_source { background-position: -500px -580px; } -.emoji-innocent { background-position: -520px -580px; } -.emoji-interrobang { background-position: -540px -580px; } -.emoji-iphone { background-position: -560px -580px; } -.emoji-island { background-position: -580px -580px; } -.emoji-izakaya_lantern { background-position: -600px 0; } -.emoji-jack_o_lantern { background-position: -600px -20px; } -.emoji-japan { background-position: -600px -40px; } -.emoji-japanese_castle { background-position: -600px -60px; } -.emoji-japanese_goblin { background-position: -600px -80px; } -.emoji-japanese_ogre { background-position: -600px -100px; } -.emoji-jeans { background-position: -600px -120px; } -.emoji-joy { background-position: -600px -140px; } -.emoji-joy_cat { background-position: -600px -160px; } -.emoji-joystick { background-position: -600px -180px; } -.emoji-juggling { background-position: -600px -200px; } -.emoji-juggling_tone1 { background-position: -600px -220px; } -.emoji-juggling_tone2 { background-position: -600px -240px; } -.emoji-juggling_tone3 { background-position: -600px -260px; } -.emoji-juggling_tone4 { background-position: -600px -280px; } -.emoji-juggling_tone5 { background-position: -600px -300px; } -.emoji-kaaba { background-position: -600px -320px; } -.emoji-key { background-position: -600px -340px; } -.emoji-key2 { background-position: -600px -360px; } -.emoji-keyboard { background-position: -600px -380px; } -.emoji-kimono { background-position: -600px -400px; } -.emoji-kiss { background-position: -600px -420px; } -.emoji-kiss_mm { background-position: -600px -440px; } -.emoji-kiss_ww { background-position: -600px -460px; } -.emoji-kissing { background-position: -600px -480px; } -.emoji-kissing_cat { background-position: -600px -500px; } -.emoji-kissing_closed_eyes { background-position: -600px -520px; } -.emoji-kissing_heart { background-position: -600px -540px; } -.emoji-kissing_smiling_eyes { background-position: -600px -560px; } -.emoji-kiwi { background-position: -600px -580px; } -.emoji-knife { background-position: 0 -600px; } -.emoji-koala { background-position: -20px -600px; } -.emoji-koko { background-position: -40px -600px; } -.emoji-label { background-position: -60px -600px; } -.emoji-large_blue_circle { background-position: -80px -600px; } -.emoji-large_blue_diamond { background-position: -100px -600px; } -.emoji-large_orange_diamond { background-position: -120px -600px; } -.emoji-last_quarter_moon { background-position: -140px -600px; } -.emoji-last_quarter_moon_with_face { background-position: -160px -600px; } -.emoji-laughing { background-position: -180px -600px; } -.emoji-leaves { background-position: -200px -600px; } -.emoji-ledger { background-position: -220px -600px; } -.emoji-left_facing_fist { background-position: -240px -600px; } -.emoji-left_facing_fist_tone1 { background-position: -260px -600px; } -.emoji-left_facing_fist_tone2 { background-position: -280px -600px; } -.emoji-left_facing_fist_tone3 { background-position: -300px -600px; } -.emoji-left_facing_fist_tone4 { background-position: -320px -600px; } -.emoji-left_facing_fist_tone5 { background-position: -340px -600px; } -.emoji-left_luggage { background-position: -360px -600px; } -.emoji-left_right_arrow { background-position: -380px -600px; } -.emoji-leftwards_arrow_with_hook { background-position: -400px -600px; } -.emoji-lemon { background-position: -420px -600px; } -.emoji-leo { background-position: -440px -600px; } -.emoji-leopard { background-position: -460px -600px; } -.emoji-level_slider { background-position: -480px -600px; } -.emoji-levitate { background-position: -500px -600px; } -.emoji-libra { background-position: -520px -600px; } -.emoji-lifter { background-position: -540px -600px; } -.emoji-lifter_tone1 { background-position: -560px -600px; } -.emoji-lifter_tone2 { background-position: -580px -600px; } -.emoji-lifter_tone3 { background-position: -600px -600px; } -.emoji-lifter_tone4 { background-position: -620px 0; } -.emoji-lifter_tone5 { background-position: -620px -20px; } -.emoji-light_rail { background-position: -620px -40px; } -.emoji-link { background-position: -620px -60px; } -.emoji-lion_face { background-position: -620px -80px; } -.emoji-lips { background-position: -620px -100px; } -.emoji-lipstick { background-position: -620px -120px; } -.emoji-lizard { background-position: -620px -140px; } -.emoji-lock { background-position: -620px -160px; } -.emoji-lock_with_ink_pen { background-position: -620px -180px; } -.emoji-lollipop { background-position: -620px -200px; } -.emoji-loop { background-position: -620px -220px; } -.emoji-loud_sound { background-position: -620px -240px; } -.emoji-loudspeaker { background-position: -620px -260px; } -.emoji-love_hotel { background-position: -620px -280px; } -.emoji-love_letter { background-position: -620px -300px; } -.emoji-low_brightness { background-position: -620px -320px; } -.emoji-lying_face { background-position: -620px -340px; } -.emoji-m { background-position: -620px -360px; } -.emoji-mag { background-position: -620px -380px; } -.emoji-mag_right { background-position: -620px -400px; } -.emoji-mahjong { background-position: -620px -420px; } -.emoji-mailbox { background-position: -620px -440px; } -.emoji-mailbox_closed { background-position: -620px -460px; } -.emoji-mailbox_with_mail { background-position: -620px -480px; } -.emoji-mailbox_with_no_mail { background-position: -620px -500px; } -.emoji-man { background-position: -620px -520px; } -.emoji-man_dancing { background-position: -620px -540px; } -.emoji-man_dancing_tone1 { background-position: -620px -560px; } -.emoji-man_dancing_tone2 { background-position: -620px -580px; } -.emoji-man_dancing_tone3 { background-position: -620px -600px; } -.emoji-man_dancing_tone4 { background-position: 0 -620px; } -.emoji-man_dancing_tone5 { background-position: -20px -620px; } -.emoji-man_in_tuxedo { background-position: -40px -620px; } -.emoji-man_in_tuxedo_tone1 { background-position: -60px -620px; } -.emoji-man_in_tuxedo_tone2 { background-position: -80px -620px; } -.emoji-man_in_tuxedo_tone3 { background-position: -100px -620px; } -.emoji-man_in_tuxedo_tone4 { background-position: -120px -620px; } -.emoji-man_in_tuxedo_tone5 { background-position: -140px -620px; } -.emoji-man_tone1 { background-position: -160px -620px; } -.emoji-man_tone2 { background-position: -180px -620px; } -.emoji-man_tone3 { background-position: -200px -620px; } -.emoji-man_tone4 { background-position: -220px -620px; } -.emoji-man_tone5 { background-position: -240px -620px; } -.emoji-man_with_gua_pi_mao { background-position: -260px -620px; } -.emoji-man_with_gua_pi_mao_tone1 { background-position: -280px -620px; } -.emoji-man_with_gua_pi_mao_tone2 { background-position: -300px -620px; } -.emoji-man_with_gua_pi_mao_tone3 { background-position: -320px -620px; } -.emoji-man_with_gua_pi_mao_tone4 { background-position: -340px -620px; } -.emoji-man_with_gua_pi_mao_tone5 { background-position: -360px -620px; } -.emoji-man_with_turban { background-position: -380px -620px; } -.emoji-man_with_turban_tone1 { background-position: -400px -620px; } -.emoji-man_with_turban_tone2 { background-position: -420px -620px; } -.emoji-man_with_turban_tone3 { background-position: -440px -620px; } -.emoji-man_with_turban_tone4 { background-position: -460px -620px; } -.emoji-man_with_turban_tone5 { background-position: -480px -620px; } -.emoji-mans_shoe { background-position: -500px -620px; } -.emoji-map { background-position: -520px -620px; } -.emoji-maple_leaf { background-position: -540px -620px; } -.emoji-martial_arts_uniform { background-position: -560px -620px; } -.emoji-mask { background-position: -580px -620px; } -.emoji-massage { background-position: -600px -620px; } -.emoji-massage_tone1 { background-position: -620px -620px; } -.emoji-massage_tone2 { background-position: -640px 0; } -.emoji-massage_tone3 { background-position: -640px -20px; } -.emoji-massage_tone4 { background-position: -640px -40px; } -.emoji-massage_tone5 { background-position: -640px -60px; } -.emoji-meat_on_bone { background-position: -640px -80px; } -.emoji-medal { background-position: -640px -100px; } -.emoji-mega { background-position: -640px -120px; } -.emoji-melon { background-position: -640px -140px; } -.emoji-menorah { background-position: -640px -160px; } -.emoji-mens { background-position: -640px -180px; } -.emoji-metal { background-position: -640px -200px; } -.emoji-metal_tone1 { background-position: -640px -220px; } -.emoji-metal_tone2 { background-position: -640px -240px; } -.emoji-metal_tone3 { background-position: -640px -260px; } -.emoji-metal_tone4 { background-position: -640px -280px; } -.emoji-metal_tone5 { background-position: -640px -300px; } -.emoji-metro { background-position: -640px -320px; } -.emoji-microphone { background-position: -640px -340px; } -.emoji-microphone2 { background-position: -640px -360px; } -.emoji-microscope { background-position: -640px -380px; } -.emoji-middle_finger { background-position: -640px -400px; } -.emoji-middle_finger_tone1 { background-position: -640px -420px; } -.emoji-middle_finger_tone2 { background-position: -640px -440px; } -.emoji-middle_finger_tone3 { background-position: -640px -460px; } -.emoji-middle_finger_tone4 { background-position: -640px -480px; } -.emoji-middle_finger_tone5 { background-position: -640px -500px; } -.emoji-military_medal { background-position: -640px -520px; } -.emoji-milk { background-position: -640px -540px; } -.emoji-milky_way { background-position: -640px -560px; } -.emoji-minibus { background-position: -640px -580px; } -.emoji-minidisc { background-position: -640px -600px; } -.emoji-mobile_phone_off { background-position: -640px -620px; } -.emoji-money_mouth { background-position: 0 -640px; } -.emoji-money_with_wings { background-position: -20px -640px; } -.emoji-moneybag { background-position: -40px -640px; } -.emoji-monkey { background-position: -60px -640px; } -.emoji-monkey_face { background-position: -80px -640px; } -.emoji-monorail { background-position: -100px -640px; } -.emoji-mortar_board { background-position: -120px -640px; } -.emoji-mosque { background-position: -140px -640px; } -.emoji-motor_scooter { background-position: -160px -640px; } -.emoji-motorboat { background-position: -180px -640px; } -.emoji-motorcycle { background-position: -200px -640px; } -.emoji-motorway { background-position: -220px -640px; } -.emoji-mount_fuji { background-position: -240px -640px; } -.emoji-mountain { background-position: -260px -640px; } -.emoji-mountain_bicyclist { background-position: -280px -640px; } -.emoji-mountain_bicyclist_tone1 { background-position: -300px -640px; } -.emoji-mountain_bicyclist_tone2 { background-position: -320px -640px; } -.emoji-mountain_bicyclist_tone3 { background-position: -340px -640px; } -.emoji-mountain_bicyclist_tone4 { background-position: -360px -640px; } -.emoji-mountain_bicyclist_tone5 { background-position: -380px -640px; } -.emoji-mountain_cableway { background-position: -400px -640px; } -.emoji-mountain_railway { background-position: -420px -640px; } -.emoji-mountain_snow { background-position: -440px -640px; } -.emoji-mouse { background-position: -460px -640px; } -.emoji-mouse2 { background-position: -480px -640px; } -.emoji-mouse_three_button { background-position: -500px -640px; } -.emoji-movie_camera { background-position: -520px -640px; } -.emoji-moyai { background-position: -540px -640px; } -.emoji-mrs_claus { background-position: -560px -640px; } -.emoji-mrs_claus_tone1 { background-position: -580px -640px; } -.emoji-mrs_claus_tone2 { background-position: -600px -640px; } -.emoji-mrs_claus_tone3 { background-position: -620px -640px; } -.emoji-mrs_claus_tone4 { background-position: -640px -640px; } -.emoji-mrs_claus_tone5 { background-position: -660px 0; } -.emoji-muscle { background-position: -660px -20px; } -.emoji-muscle_tone1 { background-position: -660px -40px; } -.emoji-muscle_tone2 { background-position: -660px -60px; } -.emoji-muscle_tone3 { background-position: -660px -80px; } -.emoji-muscle_tone4 { background-position: -660px -100px; } -.emoji-muscle_tone5 { background-position: -660px -120px; } -.emoji-mushroom { background-position: -660px -140px; } -.emoji-musical_keyboard { background-position: -660px -160px; } -.emoji-musical_note { background-position: -660px -180px; } -.emoji-musical_score { background-position: -660px -200px; } -.emoji-mute { background-position: -660px -220px; } -.emoji-nail_care { background-position: -660px -240px; } -.emoji-nail_care_tone1 { background-position: -660px -260px; } -.emoji-nail_care_tone2 { background-position: -660px -280px; } -.emoji-nail_care_tone3 { background-position: -660px -300px; } -.emoji-nail_care_tone4 { background-position: -660px -320px; } -.emoji-nail_care_tone5 { background-position: -660px -340px; } -.emoji-name_badge { background-position: -660px -360px; } -.emoji-nauseated_face { background-position: -660px -380px; } -.emoji-necktie { background-position: -660px -400px; } -.emoji-negative_squared_cross_mark { background-position: -660px -420px; } -.emoji-nerd { background-position: -660px -440px; } -.emoji-neutral_face { background-position: -660px -460px; } -.emoji-new { background-position: -660px -480px; } -.emoji-new_moon { background-position: -660px -500px; } -.emoji-new_moon_with_face { background-position: -660px -520px; } -.emoji-newspaper { background-position: -660px -540px; } -.emoji-newspaper2 { background-position: -660px -560px; } -.emoji-ng { background-position: -660px -580px; } -.emoji-night_with_stars { background-position: -660px -600px; } -.emoji-nine { background-position: -660px -620px; } -.emoji-no_bell { background-position: -660px -640px; } -.emoji-no_bicycles { background-position: 0 -660px; } -.emoji-no_entry { background-position: -20px -660px; } -.emoji-no_entry_sign { background-position: -40px -660px; } -.emoji-no_good { background-position: -60px -660px; } -.emoji-no_good_tone1 { background-position: -80px -660px; } -.emoji-no_good_tone2 { background-position: -100px -660px; } -.emoji-no_good_tone3 { background-position: -120px -660px; } -.emoji-no_good_tone4 { background-position: -140px -660px; } -.emoji-no_good_tone5 { background-position: -160px -660px; } -.emoji-no_mobile_phones { background-position: -180px -660px; } -.emoji-no_mouth { background-position: -200px -660px; } -.emoji-no_pedestrians { background-position: -220px -660px; } -.emoji-no_smoking { background-position: -240px -660px; } -.emoji-non-potable_water { background-position: -260px -660px; } -.emoji-nose { background-position: -280px -660px; } -.emoji-nose_tone1 { background-position: -300px -660px; } -.emoji-nose_tone2 { background-position: -320px -660px; } -.emoji-nose_tone3 { background-position: -340px -660px; } -.emoji-nose_tone4 { background-position: -360px -660px; } -.emoji-nose_tone5 { background-position: -380px -660px; } -.emoji-notebook { background-position: -400px -660px; } -.emoji-notebook_with_decorative_cover { background-position: -420px -660px; } -.emoji-notepad_spiral { background-position: -440px -660px; } -.emoji-notes { background-position: -460px -660px; } -.emoji-nut_and_bolt { background-position: -480px -660px; } -.emoji-o { background-position: -500px -660px; } -.emoji-o2 { background-position: -520px -660px; } -.emoji-ocean { background-position: -540px -660px; } -.emoji-octagonal_sign { background-position: -560px -660px; } -.emoji-octopus { background-position: -580px -660px; } -.emoji-oden { background-position: -600px -660px; } -.emoji-office { background-position: -620px -660px; } -.emoji-oil { background-position: -640px -660px; } -.emoji-ok { background-position: -660px -660px; } -.emoji-ok_hand { background-position: -680px 0; } -.emoji-ok_hand_tone1 { background-position: -680px -20px; } -.emoji-ok_hand_tone2 { background-position: -680px -40px; } -.emoji-ok_hand_tone3 { background-position: -680px -60px; } -.emoji-ok_hand_tone4 { background-position: -680px -80px; } -.emoji-ok_hand_tone5 { background-position: -680px -100px; } -.emoji-ok_woman { background-position: -680px -120px; } -.emoji-ok_woman_tone1 { background-position: -680px -140px; } -.emoji-ok_woman_tone2 { background-position: -680px -160px; } -.emoji-ok_woman_tone3 { background-position: -680px -180px; } -.emoji-ok_woman_tone4 { background-position: -680px -200px; } -.emoji-ok_woman_tone5 { background-position: -680px -220px; } -.emoji-older_man { background-position: -680px -240px; } -.emoji-older_man_tone1 { background-position: -680px -260px; } -.emoji-older_man_tone2 { background-position: -680px -280px; } -.emoji-older_man_tone3 { background-position: -680px -300px; } -.emoji-older_man_tone4 { background-position: -680px -320px; } -.emoji-older_man_tone5 { background-position: -680px -340px; } -.emoji-older_woman { background-position: -680px -360px; } -.emoji-older_woman_tone1 { background-position: -680px -380px; } -.emoji-older_woman_tone2 { background-position: -680px -400px; } -.emoji-older_woman_tone3 { background-position: -680px -420px; } -.emoji-older_woman_tone4 { background-position: -680px -440px; } -.emoji-older_woman_tone5 { background-position: -680px -460px; } -.emoji-om_symbol { background-position: -680px -480px; } -.emoji-on { background-position: -680px -500px; } -.emoji-oncoming_automobile { background-position: -680px -520px; } -.emoji-oncoming_bus { background-position: -680px -540px; } -.emoji-oncoming_police_car { background-position: -680px -560px; } -.emoji-oncoming_taxi { background-position: -680px -580px; } -.emoji-one { background-position: -680px -600px; } -.emoji-open_file_folder { background-position: -680px -620px; } -.emoji-open_hands { background-position: -680px -640px; } -.emoji-open_hands_tone1 { background-position: -680px -660px; } -.emoji-open_hands_tone2 { background-position: 0 -680px; } -.emoji-open_hands_tone3 { background-position: -20px -680px; } -.emoji-open_hands_tone4 { background-position: -40px -680px; } -.emoji-open_hands_tone5 { background-position: -60px -680px; } -.emoji-open_mouth { background-position: -80px -680px; } -.emoji-ophiuchus { background-position: -100px -680px; } -.emoji-orange_book { background-position: -120px -680px; } -.emoji-orthodox_cross { background-position: -140px -680px; } -.emoji-outbox_tray { background-position: -160px -680px; } -.emoji-owl { background-position: -180px -680px; } -.emoji-ox { background-position: -200px -680px; } -.emoji-package { background-position: -220px -680px; } -.emoji-page_facing_up { background-position: -240px -680px; } -.emoji-page_with_curl { background-position: -260px -680px; } -.emoji-pager { background-position: -280px -680px; } -.emoji-paintbrush { background-position: -300px -680px; } -.emoji-palm_tree { background-position: -320px -680px; } -.emoji-pancakes { background-position: -340px -680px; } -.emoji-panda_face { background-position: -360px -680px; } -.emoji-paperclip { background-position: -380px -680px; } -.emoji-paperclips { background-position: -400px -680px; } -.emoji-park { background-position: -420px -680px; } -.emoji-parking { background-position: -440px -680px; } -.emoji-part_alternation_mark { background-position: -460px -680px; } -.emoji-partly_sunny { background-position: -480px -680px; } -.emoji-passport_control { background-position: -500px -680px; } -.emoji-pause_button { background-position: -520px -680px; } -.emoji-peace { background-position: -540px -680px; } -.emoji-peach { background-position: -560px -680px; } -.emoji-peanuts { background-position: -580px -680px; } -.emoji-pear { background-position: -600px -680px; } -.emoji-pen_ballpoint { background-position: -620px -680px; } -.emoji-pen_fountain { background-position: -640px -680px; } -.emoji-pencil { background-position: -660px -680px; } -.emoji-pencil2 { background-position: -680px -680px; } -.emoji-penguin { background-position: -700px 0; } -.emoji-pensive { background-position: -700px -20px; } -.emoji-performing_arts { background-position: -700px -40px; } -.emoji-persevere { background-position: -700px -60px; } -.emoji-person_frowning { background-position: -700px -80px; } -.emoji-person_frowning_tone1 { background-position: -700px -100px; } -.emoji-person_frowning_tone2 { background-position: -700px -120px; } -.emoji-person_frowning_tone3 { background-position: -700px -140px; } -.emoji-person_frowning_tone4 { background-position: -700px -160px; } -.emoji-person_frowning_tone5 { background-position: -700px -180px; } -.emoji-person_with_blond_hair { background-position: -700px -200px; } -.emoji-person_with_blond_hair_tone1 { background-position: -700px -220px; } -.emoji-person_with_blond_hair_tone2 { background-position: -700px -240px; } -.emoji-person_with_blond_hair_tone3 { background-position: -700px -260px; } -.emoji-person_with_blond_hair_tone4 { background-position: -700px -280px; } -.emoji-person_with_blond_hair_tone5 { background-position: -700px -300px; } -.emoji-person_with_pouting_face { background-position: -700px -320px; } -.emoji-person_with_pouting_face_tone1 { background-position: -700px -340px; } -.emoji-person_with_pouting_face_tone2 { background-position: -700px -360px; } -.emoji-person_with_pouting_face_tone3 { background-position: -700px -380px; } -.emoji-person_with_pouting_face_tone4 { background-position: -700px -400px; } -.emoji-person_with_pouting_face_tone5 { background-position: -700px -420px; } -.emoji-pick { background-position: -700px -440px; } -.emoji-pig { background-position: -700px -460px; } -.emoji-pig2 { background-position: -700px -480px; } -.emoji-pig_nose { background-position: -700px -500px; } -.emoji-pill { background-position: -700px -520px; } -.emoji-pineapple { background-position: -700px -540px; } -.emoji-ping_pong { background-position: -700px -560px; } -.emoji-pisces { background-position: -700px -580px; } -.emoji-pizza { background-position: -700px -600px; } -.emoji-place_of_worship { background-position: -700px -620px; } -.emoji-play_pause { background-position: -700px -640px; } -.emoji-point_down { background-position: -700px -660px; } -.emoji-point_down_tone1 { background-position: -700px -680px; } -.emoji-point_down_tone2 { background-position: 0 -700px; } -.emoji-point_down_tone3 { background-position: -20px -700px; } -.emoji-point_down_tone4 { background-position: -40px -700px; } -.emoji-point_down_tone5 { background-position: -60px -700px; } -.emoji-point_left { background-position: -80px -700px; } -.emoji-point_left_tone1 { background-position: -100px -700px; } -.emoji-point_left_tone2 { background-position: -120px -700px; } -.emoji-point_left_tone3 { background-position: -140px -700px; } -.emoji-point_left_tone4 { background-position: -160px -700px; } -.emoji-point_left_tone5 { background-position: -180px -700px; } -.emoji-point_right { background-position: -200px -700px; } -.emoji-point_right_tone1 { background-position: -220px -700px; } -.emoji-point_right_tone2 { background-position: -240px -700px; } -.emoji-point_right_tone3 { background-position: -260px -700px; } -.emoji-point_right_tone4 { background-position: -280px -700px; } -.emoji-point_right_tone5 { background-position: -300px -700px; } -.emoji-point_up { background-position: -320px -700px; } -.emoji-point_up_2 { background-position: -340px -700px; } -.emoji-point_up_2_tone1 { background-position: -360px -700px; } -.emoji-point_up_2_tone2 { background-position: -380px -700px; } -.emoji-point_up_2_tone3 { background-position: -400px -700px; } -.emoji-point_up_2_tone4 { background-position: -420px -700px; } -.emoji-point_up_2_tone5 { background-position: -440px -700px; } -.emoji-point_up_tone1 { background-position: -460px -700px; } -.emoji-point_up_tone2 { background-position: -480px -700px; } -.emoji-point_up_tone3 { background-position: -500px -700px; } -.emoji-point_up_tone4 { background-position: -520px -700px; } -.emoji-point_up_tone5 { background-position: -540px -700px; } -.emoji-police_car { background-position: -560px -700px; } -.emoji-poodle { background-position: -580px -700px; } -.emoji-poop { background-position: -600px -700px; } -.emoji-popcorn { background-position: -620px -700px; } -.emoji-post_office { background-position: -640px -700px; } -.emoji-postal_horn { background-position: -660px -700px; } -.emoji-postbox { background-position: -680px -700px; } -.emoji-potable_water { background-position: -700px -700px; } -.emoji-potato { background-position: -720px 0; } -.emoji-pouch { background-position: -720px -20px; } -.emoji-poultry_leg { background-position: -720px -40px; } -.emoji-pound { background-position: -720px -60px; } -.emoji-pouting_cat { background-position: -720px -80px; } -.emoji-pray { background-position: -720px -100px; } -.emoji-pray_tone1 { background-position: -720px -120px; } -.emoji-pray_tone2 { background-position: -720px -140px; } -.emoji-pray_tone3 { background-position: -720px -160px; } -.emoji-pray_tone4 { background-position: -720px -180px; } -.emoji-pray_tone5 { background-position: -720px -200px; } -.emoji-prayer_beads { background-position: -720px -220px; } -.emoji-pregnant_woman { background-position: -720px -240px; } -.emoji-pregnant_woman_tone1 { background-position: -720px -260px; } -.emoji-pregnant_woman_tone2 { background-position: -720px -280px; } -.emoji-pregnant_woman_tone3 { background-position: -720px -300px; } -.emoji-pregnant_woman_tone4 { background-position: -720px -320px; } -.emoji-pregnant_woman_tone5 { background-position: -720px -340px; } -.emoji-prince { background-position: -720px -360px; } -.emoji-prince_tone1 { background-position: -720px -380px; } -.emoji-prince_tone2 { background-position: -720px -400px; } -.emoji-prince_tone3 { background-position: -720px -420px; } -.emoji-prince_tone4 { background-position: -720px -440px; } -.emoji-prince_tone5 { background-position: -720px -460px; } -.emoji-princess { background-position: -720px -480px; } -.emoji-princess_tone1 { background-position: -720px -500px; } -.emoji-princess_tone2 { background-position: -720px -520px; } -.emoji-princess_tone3 { background-position: -720px -540px; } -.emoji-princess_tone4 { background-position: -720px -560px; } -.emoji-princess_tone5 { background-position: -720px -580px; } -.emoji-printer { background-position: -720px -600px; } -.emoji-projector { background-position: -720px -620px; } -.emoji-punch { background-position: -720px -640px; } -.emoji-punch_tone1 { background-position: -720px -660px; } -.emoji-punch_tone2 { background-position: -720px -680px; } -.emoji-punch_tone3 { background-position: -720px -700px; } -.emoji-punch_tone4 { background-position: 0 -720px; } -.emoji-punch_tone5 { background-position: -20px -720px; } -.emoji-purple_heart { background-position: -40px -720px; } -.emoji-purse { background-position: -60px -720px; } -.emoji-pushpin { background-position: -80px -720px; } -.emoji-put_litter_in_its_place { background-position: -100px -720px; } -.emoji-question { background-position: -120px -720px; } -.emoji-rabbit { background-position: -140px -720px; } -.emoji-rabbit2 { background-position: -160px -720px; } -.emoji-race_car { background-position: -180px -720px; } -.emoji-racehorse { background-position: -200px -720px; } -.emoji-radio { background-position: -220px -720px; } -.emoji-radio_button { background-position: -240px -720px; } -.emoji-radioactive { background-position: -260px -720px; } -.emoji-rage { background-position: -280px -720px; } -.emoji-railway_car { background-position: -300px -720px; } -.emoji-railway_track { background-position: -320px -720px; } -.emoji-rainbow { background-position: -340px -720px; } -.emoji-raised_back_of_hand { background-position: -360px -720px; } -.emoji-raised_back_of_hand_tone1 { background-position: -380px -720px; } -.emoji-raised_back_of_hand_tone2 { background-position: -400px -720px; } -.emoji-raised_back_of_hand_tone3 { background-position: -420px -720px; } -.emoji-raised_back_of_hand_tone4 { background-position: -440px -720px; } -.emoji-raised_back_of_hand_tone5 { background-position: -460px -720px; } -.emoji-raised_hand { background-position: -480px -720px; } -.emoji-raised_hand_tone1 { background-position: -500px -720px; } -.emoji-raised_hand_tone2 { background-position: -520px -720px; } -.emoji-raised_hand_tone3 { background-position: -540px -720px; } -.emoji-raised_hand_tone4 { background-position: -560px -720px; } -.emoji-raised_hand_tone5 { background-position: -580px -720px; } -.emoji-raised_hands { background-position: -600px -720px; } -.emoji-raised_hands_tone1 { background-position: -620px -720px; } -.emoji-raised_hands_tone2 { background-position: -640px -720px; } -.emoji-raised_hands_tone3 { background-position: -660px -720px; } -.emoji-raised_hands_tone4 { background-position: -680px -720px; } -.emoji-raised_hands_tone5 { background-position: -700px -720px; } -.emoji-raising_hand { background-position: -720px -720px; } -.emoji-raising_hand_tone1 { background-position: -740px 0; } -.emoji-raising_hand_tone2 { background-position: -740px -20px; } -.emoji-raising_hand_tone3 { background-position: -740px -40px; } -.emoji-raising_hand_tone4 { background-position: -740px -60px; } -.emoji-raising_hand_tone5 { background-position: -740px -80px; } -.emoji-ram { background-position: -740px -100px; } -.emoji-ramen { background-position: -740px -120px; } -.emoji-rat { background-position: -740px -140px; } -.emoji-record_button { background-position: -740px -160px; } -.emoji-recycle { background-position: -740px -180px; } -.emoji-red_car { background-position: -740px -200px; } -.emoji-red_circle { background-position: -740px -220px; } -.emoji-registered { background-position: -740px -240px; } -.emoji-relaxed { background-position: -740px -260px; } -.emoji-relieved { background-position: -740px -280px; } -.emoji-reminder_ribbon { background-position: -740px -300px; } -.emoji-repeat { background-position: -740px -320px; } -.emoji-repeat_one { background-position: -740px -340px; } -.emoji-restroom { background-position: -740px -360px; } -.emoji-revolving_hearts { background-position: -740px -380px; } -.emoji-rewind { background-position: -740px -400px; } -.emoji-rhino { background-position: -740px -420px; } -.emoji-ribbon { background-position: -740px -440px; } -.emoji-rice { background-position: -740px -460px; } -.emoji-rice_ball { background-position: -740px -480px; } -.emoji-rice_cracker { background-position: -740px -500px; } -.emoji-rice_scene { background-position: -740px -520px; } -.emoji-right_facing_fist { background-position: -740px -540px; } -.emoji-right_facing_fist_tone1 { background-position: -740px -560px; } -.emoji-right_facing_fist_tone2 { background-position: -740px -580px; } -.emoji-right_facing_fist_tone3 { background-position: -740px -600px; } -.emoji-right_facing_fist_tone4 { background-position: -740px -620px; } -.emoji-right_facing_fist_tone5 { background-position: -740px -640px; } -.emoji-ring { background-position: -740px -660px; } -.emoji-robot { background-position: -740px -680px; } -.emoji-rocket { background-position: -740px -700px; } -.emoji-rofl { background-position: -740px -720px; } -.emoji-roller_coaster { background-position: 0 -740px; } -.emoji-rolling_eyes { background-position: -20px -740px; } -.emoji-rooster { background-position: -40px -740px; } -.emoji-rose { background-position: -60px -740px; } -.emoji-rosette { background-position: -80px -740px; } -.emoji-rotating_light { background-position: -100px -740px; } -.emoji-round_pushpin { background-position: -120px -740px; } -.emoji-rowboat { background-position: -140px -740px; } -.emoji-rowboat_tone1 { background-position: -160px -740px; } -.emoji-rowboat_tone2 { background-position: -180px -740px; } -.emoji-rowboat_tone3 { background-position: -200px -740px; } -.emoji-rowboat_tone4 { background-position: -220px -740px; } -.emoji-rowboat_tone5 { background-position: -240px -740px; } -.emoji-rugby_football { background-position: -260px -740px; } -.emoji-runner { background-position: -280px -740px; } -.emoji-runner_tone1 { background-position: -300px -740px; } -.emoji-runner_tone2 { background-position: -320px -740px; } -.emoji-runner_tone3 { background-position: -340px -740px; } -.emoji-runner_tone4 { background-position: -360px -740px; } -.emoji-runner_tone5 { background-position: -380px -740px; } -.emoji-running_shirt_with_sash { background-position: -400px -740px; } -.emoji-sa { background-position: -420px -740px; } -.emoji-sagittarius { background-position: -440px -740px; } -.emoji-sailboat { background-position: -460px -740px; } -.emoji-sake { background-position: -480px -740px; } -.emoji-salad { background-position: -500px -740px; } -.emoji-sandal { background-position: -520px -740px; } -.emoji-santa { background-position: -540px -740px; } -.emoji-santa_tone1 { background-position: -560px -740px; } -.emoji-santa_tone2 { background-position: -580px -740px; } -.emoji-santa_tone3 { background-position: -600px -740px; } -.emoji-santa_tone4 { background-position: -620px -740px; } -.emoji-santa_tone5 { background-position: -640px -740px; } -.emoji-satellite { background-position: -660px -740px; } -.emoji-satellite_orbital { background-position: -680px -740px; } -.emoji-saxophone { background-position: -700px -740px; } -.emoji-scales { background-position: -720px -740px; } -.emoji-school { background-position: -740px -740px; } -.emoji-school_satchel { background-position: -760px 0; } -.emoji-scissors { background-position: -760px -20px; } -.emoji-scooter { background-position: -760px -40px; } -.emoji-scorpion { background-position: -760px -60px; } -.emoji-scorpius { background-position: -760px -80px; } -.emoji-scream { background-position: -760px -100px; } -.emoji-scream_cat { background-position: -760px -120px; } -.emoji-scroll { background-position: -760px -140px; } -.emoji-seat { background-position: -760px -160px; } -.emoji-second_place { background-position: -760px -180px; } -.emoji-secret { background-position: -760px -200px; } -.emoji-see_no_evil { background-position: -760px -220px; } -.emoji-seedling { background-position: -760px -240px; } -.emoji-selfie { background-position: -760px -260px; } -.emoji-selfie_tone1 { background-position: -760px -280px; } -.emoji-selfie_tone2 { background-position: -760px -300px; } -.emoji-selfie_tone3 { background-position: -760px -320px; } -.emoji-selfie_tone4 { background-position: -760px -340px; } -.emoji-selfie_tone5 { background-position: -760px -360px; } -.emoji-seven { background-position: -760px -380px; } -.emoji-shallow_pan_of_food { background-position: -760px -400px; } -.emoji-shamrock { background-position: -760px -420px; } -.emoji-shark { background-position: -760px -440px; } -.emoji-shaved_ice { background-position: -760px -460px; } -.emoji-sheep { background-position: -760px -480px; } -.emoji-shell { background-position: -760px -500px; } -.emoji-shield { background-position: -760px -520px; } -.emoji-shinto_shrine { background-position: -760px -540px; } -.emoji-ship { background-position: -760px -560px; } -.emoji-shirt { background-position: -760px -580px; } -.emoji-shopping_bags { background-position: -760px -600px; } -.emoji-shopping_cart { background-position: -760px -620px; } -.emoji-shower { background-position: -760px -640px; } -.emoji-shrimp { background-position: -760px -660px; } -.emoji-shrug { background-position: -760px -680px; } -.emoji-shrug_tone1 { background-position: -760px -700px; } -.emoji-shrug_tone2 { background-position: -760px -720px; } -.emoji-shrug_tone3 { background-position: -760px -740px; } -.emoji-shrug_tone4 { background-position: 0 -760px; } -.emoji-shrug_tone5 { background-position: -20px -760px; } -.emoji-signal_strength { background-position: -40px -760px; } -.emoji-six { background-position: -60px -760px; } -.emoji-six_pointed_star { background-position: -80px -760px; } -.emoji-ski { background-position: -100px -760px; } -.emoji-skier { background-position: -120px -760px; } -.emoji-skull { background-position: -140px -760px; } -.emoji-skull_crossbones { background-position: -160px -760px; } -.emoji-sleeping { background-position: -180px -760px; } -.emoji-sleeping_accommodation { background-position: -200px -760px; } -.emoji-sleepy { background-position: -220px -760px; } -.emoji-slight_frown { background-position: -240px -760px; } -.emoji-slight_smile { background-position: -260px -760px; } -.emoji-slot_machine { background-position: -280px -760px; } -.emoji-small_blue_diamond { background-position: -300px -760px; } -.emoji-small_orange_diamond { background-position: -320px -760px; } -.emoji-small_red_triangle { background-position: -340px -760px; } -.emoji-small_red_triangle_down { background-position: -360px -760px; } -.emoji-smile { background-position: -380px -760px; } -.emoji-smile_cat { background-position: -400px -760px; } -.emoji-smiley { background-position: -420px -760px; } -.emoji-smiley_cat { background-position: -440px -760px; } -.emoji-smiling_imp { background-position: -460px -760px; } -.emoji-smirk { background-position: -480px -760px; } -.emoji-smirk_cat { background-position: -500px -760px; } -.emoji-smoking { background-position: -520px -760px; } -.emoji-snail { background-position: -540px -760px; } -.emoji-snake { background-position: -560px -760px; } -.emoji-sneezing_face { background-position: -580px -760px; } -.emoji-snowboarder { background-position: -600px -760px; } -.emoji-snowflake { background-position: -620px -760px; } -.emoji-snowman { background-position: -640px -760px; } -.emoji-snowman2 { background-position: -660px -760px; } -.emoji-sob { background-position: -680px -760px; } -.emoji-soccer { background-position: -700px -760px; } -.emoji-soon { background-position: -720px -760px; } -.emoji-sos { background-position: -740px -760px; } -.emoji-sound { background-position: -760px -760px; } -.emoji-space_invader { background-position: -780px 0; } -.emoji-spades { background-position: -780px -20px; } -.emoji-spaghetti { background-position: -780px -40px; } -.emoji-sparkle { background-position: -780px -60px; } -.emoji-sparkler { background-position: -780px -80px; } -.emoji-sparkles { background-position: -780px -100px; } -.emoji-sparkling_heart { background-position: -780px -120px; } -.emoji-speak_no_evil { background-position: -780px -140px; } -.emoji-speaker { background-position: -780px -160px; } -.emoji-speaking_head { background-position: -780px -180px; } -.emoji-speech_balloon { background-position: -780px -200px; } -.emoji-speech_left { background-position: -780px -220px; } -.emoji-speedboat { background-position: -780px -240px; } -.emoji-spider { background-position: -780px -260px; } -.emoji-spider_web { background-position: -780px -280px; } -.emoji-spoon { background-position: -780px -300px; } -.emoji-spy { background-position: -780px -320px; } -.emoji-spy_tone1 { background-position: -780px -340px; } -.emoji-spy_tone2 { background-position: -780px -360px; } -.emoji-spy_tone3 { background-position: -780px -380px; } -.emoji-spy_tone4 { background-position: -780px -400px; } -.emoji-spy_tone5 { background-position: -780px -420px; } -.emoji-squid { background-position: -780px -440px; } -.emoji-stadium { background-position: -780px -460px; } -.emoji-star { background-position: -780px -480px; } -.emoji-star2 { background-position: -780px -500px; } -.emoji-star_and_crescent { background-position: -780px -520px; } -.emoji-star_of_david { background-position: -780px -540px; } -.emoji-stars { background-position: -780px -560px; } -.emoji-station { background-position: -780px -580px; } -.emoji-statue_of_liberty { background-position: -780px -600px; } -.emoji-steam_locomotive { background-position: -780px -620px; } -.emoji-stew { background-position: -780px -640px; } -.emoji-stop_button { background-position: -780px -660px; } -.emoji-stopwatch { background-position: -780px -680px; } -.emoji-straight_ruler { background-position: -780px -700px; } -.emoji-strawberry { background-position: -780px -720px; } -.emoji-stuck_out_tongue { background-position: -780px -740px; } -.emoji-stuck_out_tongue_closed_eyes { background-position: -780px -760px; } -.emoji-stuck_out_tongue_winking_eye { background-position: 0 -780px; } -.emoji-stuffed_flatbread { background-position: -20px -780px; } -.emoji-sun_with_face { background-position: -40px -780px; } -.emoji-sunflower { background-position: -60px -780px; } -.emoji-sunglasses { background-position: -80px -780px; } -.emoji-sunny { background-position: -100px -780px; } -.emoji-sunrise { background-position: -120px -780px; } -.emoji-sunrise_over_mountains { background-position: -140px -780px; } -.emoji-surfer { background-position: -160px -780px; } -.emoji-surfer_tone1 { background-position: -180px -780px; } -.emoji-surfer_tone2 { background-position: -200px -780px; } -.emoji-surfer_tone3 { background-position: -220px -780px; } -.emoji-surfer_tone4 { background-position: -240px -780px; } -.emoji-surfer_tone5 { background-position: -260px -780px; } -.emoji-sushi { background-position: -280px -780px; } -.emoji-suspension_railway { background-position: -300px -780px; } -.emoji-sweat { background-position: -320px -780px; } -.emoji-sweat_drops { background-position: -340px -780px; } -.emoji-sweat_smile { background-position: -360px -780px; } -.emoji-sweet_potato { background-position: -380px -780px; } -.emoji-swimmer { background-position: -400px -780px; } -.emoji-swimmer_tone1 { background-position: -420px -780px; } -.emoji-swimmer_tone2 { background-position: -440px -780px; } -.emoji-swimmer_tone3 { background-position: -460px -780px; } -.emoji-swimmer_tone4 { background-position: -480px -780px; } -.emoji-swimmer_tone5 { background-position: -500px -780px; } -.emoji-symbols { background-position: -520px -780px; } -.emoji-synagogue { background-position: -540px -780px; } -.emoji-syringe { background-position: -560px -780px; } -.emoji-taco { background-position: -580px -780px; } -.emoji-tada { background-position: -600px -780px; } -.emoji-tanabata_tree { background-position: -620px -780px; } -.emoji-tangerine { background-position: -640px -780px; } -.emoji-taurus { background-position: -660px -780px; } -.emoji-taxi { background-position: -680px -780px; } -.emoji-tea { background-position: -700px -780px; } -.emoji-telephone { background-position: -720px -780px; } -.emoji-telephone_receiver { background-position: -740px -780px; } -.emoji-telescope { background-position: -760px -780px; } -.emoji-ten { background-position: -780px -780px; } -.emoji-tennis { background-position: -800px 0; } -.emoji-tent { background-position: -800px -20px; } -.emoji-thermometer { background-position: -800px -40px; } -.emoji-thermometer_face { background-position: -800px -60px; } -.emoji-thinking { background-position: -800px -80px; } -.emoji-third_place { background-position: -800px -100px; } -.emoji-thought_balloon { background-position: -800px -120px; } -.emoji-three { background-position: -800px -140px; } -.emoji-thumbsdown { background-position: -800px -160px; } -.emoji-thumbsdown_tone1 { background-position: -800px -180px; } -.emoji-thumbsdown_tone2 { background-position: -800px -200px; } -.emoji-thumbsdown_tone3 { background-position: -800px -220px; } -.emoji-thumbsdown_tone4 { background-position: -800px -240px; } -.emoji-thumbsdown_tone5 { background-position: -800px -260px; } -.emoji-thumbsup { background-position: -800px -280px; } -.emoji-thumbsup_tone1 { background-position: -800px -300px; } -.emoji-thumbsup_tone2 { background-position: -800px -320px; } -.emoji-thumbsup_tone3 { background-position: -800px -340px; } -.emoji-thumbsup_tone4 { background-position: -800px -360px; } -.emoji-thumbsup_tone5 { background-position: -800px -380px; } -.emoji-thunder_cloud_rain { background-position: -800px -400px; } -.emoji-ticket { background-position: -800px -420px; } -.emoji-tickets { background-position: -800px -440px; } -.emoji-tiger { background-position: -800px -460px; } -.emoji-tiger2 { background-position: -800px -480px; } -.emoji-timer { background-position: -800px -500px; } -.emoji-tired_face { background-position: -800px -520px; } -.emoji-tm { background-position: -800px -540px; } -.emoji-toilet { background-position: -800px -560px; } -.emoji-tokyo_tower { background-position: -800px -580px; } -.emoji-tomato { background-position: -800px -600px; } -.emoji-tone1 { background-position: -800px -620px; } -.emoji-tone2 { background-position: -800px -640px; } -.emoji-tone3 { background-position: -800px -660px; } -.emoji-tone4 { background-position: -800px -680px; } -.emoji-tone5 { background-position: -800px -700px; } -.emoji-tongue { background-position: -800px -720px; } -.emoji-tools { background-position: -800px -740px; } -.emoji-top { background-position: -800px -760px; } -.emoji-tophat { background-position: -800px -780px; } -.emoji-track_next { background-position: 0 -800px; } -.emoji-track_previous { background-position: -20px -800px; } -.emoji-trackball { background-position: -40px -800px; } -.emoji-tractor { background-position: -60px -800px; } -.emoji-traffic_light { background-position: -80px -800px; } -.emoji-train { background-position: -100px -800px; } -.emoji-train2 { background-position: -120px -800px; } -.emoji-tram { background-position: -140px -800px; } -.emoji-triangular_flag_on_post { background-position: -160px -800px; } -.emoji-triangular_ruler { background-position: -180px -800px; } -.emoji-trident { background-position: -200px -800px; } -.emoji-triumph { background-position: -220px -800px; } -.emoji-trolleybus { background-position: -240px -800px; } -.emoji-trophy { background-position: -260px -800px; } -.emoji-tropical_drink { background-position: -280px -800px; } -.emoji-tropical_fish { background-position: -300px -800px; } -.emoji-truck { background-position: -320px -800px; } -.emoji-trumpet { background-position: -340px -800px; } -.emoji-tulip { background-position: -360px -800px; } -.emoji-tumbler_glass { background-position: -380px -800px; } -.emoji-turkey { background-position: -400px -800px; } -.emoji-turtle { background-position: -420px -800px; } -.emoji-tv { background-position: -440px -800px; } -.emoji-twisted_rightwards_arrows { background-position: -460px -800px; } -.emoji-two { background-position: -480px -800px; } -.emoji-two_hearts { background-position: -500px -800px; } -.emoji-two_men_holding_hands { background-position: -520px -800px; } -.emoji-two_women_holding_hands { background-position: -540px -800px; } -.emoji-u5272 { background-position: -560px -800px; } -.emoji-u5408 { background-position: -580px -800px; } -.emoji-u55b6 { background-position: -600px -800px; } -.emoji-u6307 { background-position: -620px -800px; } -.emoji-u6708 { background-position: -640px -800px; } -.emoji-u6709 { background-position: -660px -800px; } -.emoji-u6e80 { background-position: -680px -800px; } -.emoji-u7121 { background-position: -700px -800px; } -.emoji-u7533 { background-position: -720px -800px; } -.emoji-u7981 { background-position: -740px -800px; } -.emoji-u7a7a { background-position: -760px -800px; } -.emoji-umbrella { background-position: -780px -800px; } -.emoji-umbrella2 { background-position: -800px -800px; } -.emoji-unamused { background-position: -820px 0; } -.emoji-underage { background-position: -820px -20px; } -.emoji-unicorn { background-position: -820px -40px; } -.emoji-unlock { background-position: -820px -60px; } -.emoji-up { background-position: -820px -80px; } -.emoji-upside_down { background-position: -820px -100px; } -.emoji-urn { background-position: -820px -120px; } -.emoji-v { background-position: -820px -140px; } -.emoji-v_tone1 { background-position: -820px -160px; } -.emoji-v_tone2 { background-position: -820px -180px; } -.emoji-v_tone3 { background-position: -820px -200px; } -.emoji-v_tone4 { background-position: -820px -220px; } -.emoji-v_tone5 { background-position: -820px -240px; } -.emoji-vertical_traffic_light { background-position: -820px -260px; } -.emoji-vhs { background-position: -820px -280px; } -.emoji-vibration_mode { background-position: -820px -300px; } -.emoji-video_camera { background-position: -820px -320px; } -.emoji-video_game { background-position: -820px -340px; } -.emoji-violin { background-position: -820px -360px; } -.emoji-virgo { background-position: -820px -380px; } -.emoji-volcano { background-position: -820px -400px; } -.emoji-volleyball { background-position: -820px -420px; } -.emoji-vs { background-position: -820px -440px; } -.emoji-vulcan { background-position: -820px -460px; } -.emoji-vulcan_tone1 { background-position: -820px -480px; } -.emoji-vulcan_tone2 { background-position: -820px -500px; } -.emoji-vulcan_tone3 { background-position: -820px -520px; } -.emoji-vulcan_tone4 { background-position: -820px -540px; } -.emoji-vulcan_tone5 { background-position: -820px -560px; } -.emoji-walking { background-position: -820px -580px; } -.emoji-walking_tone1 { background-position: -820px -600px; } -.emoji-walking_tone2 { background-position: -820px -620px; } -.emoji-walking_tone3 { background-position: -820px -640px; } -.emoji-walking_tone4 { background-position: -820px -660px; } -.emoji-walking_tone5 { background-position: -820px -680px; } -.emoji-waning_crescent_moon { background-position: -820px -700px; } -.emoji-waning_gibbous_moon { background-position: -820px -720px; } -.emoji-warning { background-position: -820px -740px; } -.emoji-wastebasket { background-position: -820px -760px; } -.emoji-watch { background-position: -820px -780px; } -.emoji-water_buffalo { background-position: -820px -800px; } -.emoji-water_polo { background-position: 0 -820px; } -.emoji-water_polo_tone1 { background-position: -20px -820px; } -.emoji-water_polo_tone2 { background-position: -40px -820px; } -.emoji-water_polo_tone3 { background-position: -60px -820px; } -.emoji-water_polo_tone4 { background-position: -80px -820px; } -.emoji-water_polo_tone5 { background-position: -100px -820px; } -.emoji-watermelon { background-position: -120px -820px; } -.emoji-wave { background-position: -140px -820px; } -.emoji-wave_tone1 { background-position: -160px -820px; } -.emoji-wave_tone2 { background-position: -180px -820px; } -.emoji-wave_tone3 { background-position: -200px -820px; } -.emoji-wave_tone4 { background-position: -220px -820px; } -.emoji-wave_tone5 { background-position: -240px -820px; } -.emoji-wavy_dash { background-position: -260px -820px; } -.emoji-waxing_crescent_moon { background-position: -280px -820px; } -.emoji-waxing_gibbous_moon { background-position: -300px -820px; } -.emoji-wc { background-position: -320px -820px; } -.emoji-weary { background-position: -340px -820px; } -.emoji-wedding { background-position: -360px -820px; } -.emoji-whale { background-position: -380px -820px; } -.emoji-whale2 { background-position: -400px -820px; } -.emoji-wheel_of_dharma { background-position: -420px -820px; } -.emoji-wheelchair { background-position: -440px -820px; } -.emoji-white_check_mark { background-position: -460px -820px; } -.emoji-white_circle { background-position: -480px -820px; } -.emoji-white_flower { background-position: -500px -820px; } -.emoji-white_large_square { background-position: -520px -820px; } -.emoji-white_medium_small_square { background-position: -540px -820px; } -.emoji-white_medium_square { background-position: -560px -820px; } -.emoji-white_small_square { background-position: -580px -820px; } -.emoji-white_square_button { background-position: -600px -820px; } -.emoji-white_sun_cloud { background-position: -620px -820px; } -.emoji-white_sun_rain_cloud { background-position: -640px -820px; } -.emoji-white_sun_small_cloud { background-position: -660px -820px; } -.emoji-wilted_rose { background-position: -680px -820px; } -.emoji-wind_blowing_face { background-position: -700px -820px; } -.emoji-wind_chime { background-position: -720px -820px; } -.emoji-wine_glass { background-position: -740px -820px; } -.emoji-wink { background-position: -760px -820px; } -.emoji-wolf { background-position: -780px -820px; } -.emoji-woman { background-position: -800px -820px; } -.emoji-woman_tone1 { background-position: -820px -820px; } -.emoji-woman_tone2 { background-position: -840px 0; } -.emoji-woman_tone3 { background-position: -840px -20px; } -.emoji-woman_tone4 { background-position: -840px -40px; } -.emoji-woman_tone5 { background-position: -840px -60px; } -.emoji-womans_clothes { background-position: -840px -80px; } -.emoji-womans_hat { background-position: -840px -100px; } -.emoji-womens { background-position: -840px -120px; } -.emoji-worried { background-position: -840px -140px; } -.emoji-wrench { background-position: -840px -160px; } -.emoji-wrestlers { background-position: -840px -180px; } -.emoji-wrestlers_tone1 { background-position: -840px -200px; } -.emoji-wrestlers_tone2 { background-position: -840px -220px; } -.emoji-wrestlers_tone3 { background-position: -840px -240px; } -.emoji-wrestlers_tone4 { background-position: -840px -260px; } -.emoji-wrestlers_tone5 { background-position: -840px -280px; } -.emoji-writing_hand { background-position: -840px -300px; } -.emoji-writing_hand_tone1 { background-position: -840px -320px; } -.emoji-writing_hand_tone2 { background-position: -840px -340px; } -.emoji-writing_hand_tone3 { background-position: -840px -360px; } -.emoji-writing_hand_tone4 { background-position: -840px -380px; } -.emoji-writing_hand_tone5 { background-position: -840px -400px; } -.emoji-x { background-position: -840px -420px; } -.emoji-yellow_heart { background-position: -840px -440px; } -.emoji-yen { background-position: -840px -460px; } -.emoji-yin_yang { background-position: -840px -480px; } -.emoji-yum { background-position: -840px -500px; } -.emoji-zap { background-position: -840px -520px; } -.emoji-zero { background-position: -840px -540px; } -.emoji-zipper_mouth { background-position: -840px -560px; } -.emoji-100 { background-position: -840px -580px; } - -.emoji-icon { - background-image: image-url('emoji.png'); - background-repeat: no-repeat; - color: transparent; - text-indent: -99em; - height: 20px; - width: 20px; - - @media only screen and (-webkit-min-device-pixel-ratio: 2), - only screen and (min--moz-device-pixel-ratio: 2), - only screen and (-o-min-device-pixel-ratio: 2/1), - only screen and (min-device-pixel-ratio: 2), - only screen and (min-resolution: 192dpi), - only screen and (min-resolution: 2dppx) { - background-image: image-url('emoji@2x.png'); - background-size: 860px 840px; - } -} diff --git a/app/assets/stylesheets/framework/emoji_sprites.scss b/app/assets/stylesheets/framework/emoji_sprites.scss new file mode 100644 index 00000000000..0174e17b660 --- /dev/null +++ b/app/assets/stylesheets/framework/emoji_sprites.scss @@ -0,0 +1,1813 @@ +.emoji-zzz { background-position: 0 0; } +.emoji-1234 { background-position: -20px 0; } +.emoji-1F627 { background-position: 0 -20px; } +.emoji-8ball { background-position: -20px -20px; } +.emoji-a { background-position: -40px 0; } +.emoji-ab { background-position: -40px -20px; } +.emoji-abc { background-position: 0 -40px; } +.emoji-abcd { background-position: -20px -40px; } +.emoji-accept { background-position: -40px -40px; } +.emoji-aerial_tramway { background-position: -60px 0; } +.emoji-airplane { background-position: -60px -20px; } +.emoji-airplane_arriving { background-position: -60px -40px; } +.emoji-airplane_departure { background-position: 0 -60px; } +.emoji-airplane_small { background-position: -20px -60px; } +.emoji-alarm_clock { background-position: -40px -60px; } +.emoji-alembic { background-position: -60px -60px; } +.emoji-alien { background-position: -80px 0; } +.emoji-ambulance { background-position: -80px -20px; } +.emoji-amphora { background-position: -80px -40px; } +.emoji-anchor { background-position: -80px -60px; } +.emoji-angel { background-position: 0 -80px; } +.emoji-angel_tone1 { background-position: -20px -80px; } +.emoji-angel_tone2 { background-position: -40px -80px; } +.emoji-angel_tone3 { background-position: -60px -80px; } +.emoji-angel_tone4 { background-position: -80px -80px; } +.emoji-angel_tone5 { background-position: -100px 0; } +.emoji-anger { background-position: -100px -20px; } +.emoji-anger_right { background-position: -100px -40px; } +.emoji-angry { background-position: -100px -60px; } +.emoji-ant { background-position: -100px -80px; } +.emoji-apple { background-position: 0 -100px; } +.emoji-aquarius { background-position: -20px -100px; } +.emoji-aries { background-position: -40px -100px; } +.emoji-arrow_backward { background-position: -60px -100px; } +.emoji-arrow_double_down { background-position: -80px -100px; } +.emoji-arrow_double_up { background-position: -100px -100px; } +.emoji-arrow_down { background-position: -120px 0; } +.emoji-arrow_down_small { background-position: -120px -20px; } +.emoji-arrow_forward { background-position: -120px -40px; } +.emoji-arrow_heading_down { background-position: -120px -60px; } +.emoji-arrow_heading_up { background-position: -120px -80px; } +.emoji-arrow_left { background-position: -120px -100px; } +.emoji-arrow_lower_left { background-position: 0 -120px; } +.emoji-arrow_lower_right { background-position: -20px -120px; } +.emoji-arrow_right { background-position: -40px -120px; } +.emoji-arrow_right_hook { background-position: -60px -120px; } +.emoji-arrow_up { background-position: -80px -120px; } +.emoji-arrow_up_down { background-position: -100px -120px; } +.emoji-arrow_up_small { background-position: -120px -120px; } +.emoji-arrow_upper_left { background-position: -140px 0; } +.emoji-arrow_upper_right { background-position: -140px -20px; } +.emoji-arrows_clockwise { background-position: -140px -40px; } +.emoji-arrows_counterclockwise { background-position: -140px -60px; } +.emoji-art { background-position: -140px -80px; } +.emoji-articulated_lorry { background-position: -140px -100px; } +.emoji-asterisk { background-position: -140px -120px; } +.emoji-astonished { background-position: 0 -140px; } +.emoji-athletic_shoe { background-position: -20px -140px; } +.emoji-atm { background-position: -40px -140px; } +.emoji-atom { background-position: -60px -140px; } +.emoji-avocado { background-position: -80px -140px; } +.emoji-b { background-position: -100px -140px; } +.emoji-baby { background-position: -120px -140px; } +.emoji-baby_bottle { background-position: -140px -140px; } +.emoji-baby_chick { background-position: -160px 0; } +.emoji-baby_symbol { background-position: -160px -20px; } +.emoji-baby_tone1 { background-position: -160px -40px; } +.emoji-baby_tone2 { background-position: -160px -60px; } +.emoji-baby_tone3 { background-position: -160px -80px; } +.emoji-baby_tone4 { background-position: -160px -100px; } +.emoji-baby_tone5 { background-position: -160px -120px; } +.emoji-back { background-position: -160px -140px; } +.emoji-bacon { background-position: 0 -160px; } +.emoji-badminton { background-position: -20px -160px; } +.emoji-baggage_claim { background-position: -40px -160px; } +.emoji-balloon { background-position: -60px -160px; } +.emoji-ballot_box { background-position: -80px -160px; } +.emoji-ballot_box_with_check { background-position: -100px -160px; } +.emoji-bamboo { background-position: -120px -160px; } +.emoji-banana { background-position: -140px -160px; } +.emoji-bangbang { background-position: -160px -160px; } +.emoji-bank { background-position: -180px 0; } +.emoji-bar_chart { background-position: -180px -20px; } +.emoji-barber { background-position: -180px -40px; } +.emoji-baseball { background-position: -180px -60px; } +.emoji-basketball { background-position: -180px -80px; } +.emoji-basketball_player { background-position: -180px -100px; } +.emoji-basketball_player_tone1 { background-position: -180px -120px; } +.emoji-basketball_player_tone2 { background-position: -180px -140px; } +.emoji-basketball_player_tone3 { background-position: -180px -160px; } +.emoji-basketball_player_tone4 { background-position: 0 -180px; } +.emoji-basketball_player_tone5 { background-position: -20px -180px; } +.emoji-bat { background-position: -40px -180px; } +.emoji-bath { background-position: -60px -180px; } +.emoji-bath_tone1 { background-position: -80px -180px; } +.emoji-bath_tone2 { background-position: -100px -180px; } +.emoji-bath_tone3 { background-position: -120px -180px; } +.emoji-bath_tone4 { background-position: -140px -180px; } +.emoji-bath_tone5 { background-position: -160px -180px; } +.emoji-bathtub { background-position: -180px -180px; } +.emoji-battery { background-position: -200px 0; } +.emoji-beach { background-position: -200px -20px; } +.emoji-beach_umbrella { background-position: -200px -40px; } +.emoji-bear { background-position: -200px -60px; } +.emoji-bed { background-position: -200px -80px; } +.emoji-bee { background-position: -200px -100px; } +.emoji-beer { background-position: -200px -120px; } +.emoji-beers { background-position: -200px -140px; } +.emoji-beetle { background-position: -200px -160px; } +.emoji-beginner { background-position: -200px -180px; } +.emoji-bell { background-position: 0 -200px; } +.emoji-bellhop { background-position: -20px -200px; } +.emoji-bento { background-position: -40px -200px; } +.emoji-bicyclist { background-position: -60px -200px; } +.emoji-bicyclist_tone1 { background-position: -80px -200px; } +.emoji-bicyclist_tone2 { background-position: -100px -200px; } +.emoji-bicyclist_tone3 { background-position: -120px -200px; } +.emoji-bicyclist_tone4 { background-position: -140px -200px; } +.emoji-bicyclist_tone5 { background-position: -160px -200px; } +.emoji-bike { background-position: -180px -200px; } +.emoji-bikini { background-position: -200px -200px; } +.emoji-biohazard { background-position: -220px 0; } +.emoji-bird { background-position: -220px -20px; } +.emoji-birthday { background-position: -220px -40px; } +.emoji-black_circle { background-position: -220px -60px; } +.emoji-black_heart { background-position: -220px -80px; } +.emoji-black_joker { background-position: -220px -100px; } +.emoji-black_large_square { background-position: -220px -120px; } +.emoji-black_medium_small_square { background-position: -220px -140px; } +.emoji-black_medium_square { background-position: -220px -160px; } +.emoji-black_nib { background-position: -220px -180px; } +.emoji-black_small_square { background-position: -220px -200px; } +.emoji-black_square_button { background-position: 0 -220px; } +.emoji-blossom { background-position: -20px -220px; } +.emoji-blowfish { background-position: -40px -220px; } +.emoji-blue_book { background-position: -60px -220px; } +.emoji-blue_car { background-position: -80px -220px; } +.emoji-blue_heart { background-position: -100px -220px; } +.emoji-blush { background-position: -120px -220px; } +.emoji-boar { background-position: -140px -220px; } +.emoji-bomb { background-position: -160px -220px; } +.emoji-book { background-position: -180px -220px; } +.emoji-bookmark { background-position: -200px -220px; } +.emoji-bookmark_tabs { background-position: -220px -220px; } +.emoji-books { background-position: -240px 0; } +.emoji-boom { background-position: -240px -20px; } +.emoji-boot { background-position: -240px -40px; } +.emoji-bouquet { background-position: -240px -60px; } +.emoji-bow { background-position: -240px -80px; } +.emoji-bow_and_arrow { background-position: -240px -100px; } +.emoji-bow_tone1 { background-position: -240px -120px; } +.emoji-bow_tone2 { background-position: -240px -140px; } +.emoji-bow_tone3 { background-position: -240px -160px; } +.emoji-bow_tone4 { background-position: -240px -180px; } +.emoji-bow_tone5 { background-position: -240px -200px; } +.emoji-bowling { background-position: -240px -220px; } +.emoji-boxing_glove { background-position: 0 -240px; } +.emoji-boy { background-position: -20px -240px; } +.emoji-boy_tone1 { background-position: -40px -240px; } +.emoji-boy_tone2 { background-position: -60px -240px; } +.emoji-boy_tone3 { background-position: -80px -240px; } +.emoji-boy_tone4 { background-position: -100px -240px; } +.emoji-boy_tone5 { background-position: -120px -240px; } +.emoji-bread { background-position: -140px -240px; } +.emoji-bride_with_veil { background-position: -160px -240px; } +.emoji-bride_with_veil_tone1 { background-position: -180px -240px; } +.emoji-bride_with_veil_tone2 { background-position: -200px -240px; } +.emoji-bride_with_veil_tone3 { background-position: -220px -240px; } +.emoji-bride_with_veil_tone4 { background-position: -240px -240px; } +.emoji-bride_with_veil_tone5 { background-position: -260px 0; } +.emoji-bridge_at_night { background-position: -260px -20px; } +.emoji-briefcase { background-position: -260px -40px; } +.emoji-broken_heart { background-position: -260px -60px; } +.emoji-bug { background-position: -260px -80px; } +.emoji-bulb { background-position: -260px -100px; } +.emoji-bullettrain_front { background-position: -260px -120px; } +.emoji-bullettrain_side { background-position: -260px -140px; } +.emoji-burrito { background-position: -260px -160px; } +.emoji-bus { background-position: -260px -180px; } +.emoji-busstop { background-position: -260px -200px; } +.emoji-bust_in_silhouette { background-position: -260px -220px; } +.emoji-busts_in_silhouette { background-position: -260px -240px; } +.emoji-butterfly { background-position: 0 -260px; } +.emoji-cactus { background-position: -20px -260px; } +.emoji-cake { background-position: -40px -260px; } +.emoji-calendar { background-position: -60px -260px; } +.emoji-calendar_spiral { background-position: -80px -260px; } +.emoji-call_me { background-position: -100px -260px; } +.emoji-call_me_tone1 { background-position: -120px -260px; } +.emoji-call_me_tone2 { background-position: -140px -260px; } +.emoji-call_me_tone3 { background-position: -160px -260px; } +.emoji-call_me_tone4 { background-position: -180px -260px; } +.emoji-call_me_tone5 { background-position: -200px -260px; } +.emoji-calling { background-position: -220px -260px; } +.emoji-camel { background-position: -240px -260px; } +.emoji-camera { background-position: -260px -260px; } +.emoji-camera_with_flash { background-position: -280px 0; } +.emoji-camping { background-position: -280px -20px; } +.emoji-cancer { background-position: -280px -40px; } +.emoji-candle { background-position: -280px -60px; } +.emoji-candy { background-position: -280px -80px; } +.emoji-canoe { background-position: -280px -100px; } +.emoji-capital_abcd { background-position: -280px -120px; } +.emoji-capricorn { background-position: -280px -140px; } +.emoji-card_box { background-position: -280px -160px; } +.emoji-card_index { background-position: -280px -180px; } +.emoji-carousel_horse { background-position: -280px -200px; } +.emoji-carrot { background-position: -280px -220px; } +.emoji-cartwheel { background-position: -280px -240px; } +.emoji-cartwheel_tone1 { background-position: -280px -260px; } +.emoji-cartwheel_tone2 { background-position: 0 -280px; } +.emoji-cartwheel_tone3 { background-position: -20px -280px; } +.emoji-cartwheel_tone4 { background-position: -40px -280px; } +.emoji-cartwheel_tone5 { background-position: -60px -280px; } +.emoji-cat { background-position: -80px -280px; } +.emoji-cat2 { background-position: -100px -280px; } +.emoji-cd { background-position: -120px -280px; } +.emoji-chains { background-position: -140px -280px; } +.emoji-champagne { background-position: -160px -280px; } +.emoji-champagne_glass { background-position: -180px -280px; } +.emoji-chart { background-position: -200px -280px; } +.emoji-chart_with_downwards_trend { background-position: -220px -280px; } +.emoji-chart_with_upwards_trend { background-position: -240px -280px; } +.emoji-checkered_flag { background-position: -260px -280px; } +.emoji-cheese { background-position: -280px -280px; } +.emoji-cherries { background-position: -300px 0; } +.emoji-cherry_blossom { background-position: -300px -20px; } +.emoji-chestnut { background-position: -300px -40px; } +.emoji-chicken { background-position: -300px -60px; } +.emoji-children_crossing { background-position: -300px -80px; } +.emoji-chipmunk { background-position: -300px -100px; } +.emoji-chocolate_bar { background-position: -300px -120px; } +.emoji-christmas_tree { background-position: -300px -140px; } +.emoji-church { background-position: -300px -160px; } +.emoji-cinema { background-position: -300px -180px; } +.emoji-circus_tent { background-position: -300px -200px; } +.emoji-city_dusk { background-position: -300px -220px; } +.emoji-city_sunset { background-position: -300px -240px; } +.emoji-cityscape { background-position: -300px -260px; } +.emoji-cl { background-position: -300px -280px; } +.emoji-clap { background-position: 0 -300px; } +.emoji-clap_tone1 { background-position: -20px -300px; } +.emoji-clap_tone2 { background-position: -40px -300px; } +.emoji-clap_tone3 { background-position: -60px -300px; } +.emoji-clap_tone4 { background-position: -80px -300px; } +.emoji-clap_tone5 { background-position: -100px -300px; } +.emoji-clapper { background-position: -120px -300px; } +.emoji-classical_building { background-position: -140px -300px; } +.emoji-clipboard { background-position: -160px -300px; } +.emoji-clock { background-position: -180px -300px; } +.emoji-clock1 { background-position: -200px -300px; } +.emoji-clock10 { background-position: -220px -300px; } +.emoji-clock1030 { background-position: -240px -300px; } +.emoji-clock11 { background-position: -260px -300px; } +.emoji-clock1130 { background-position: -280px -300px; } +.emoji-clock12 { background-position: -300px -300px; } +.emoji-clock1230 { background-position: -320px 0; } +.emoji-clock130 { background-position: -320px -20px; } +.emoji-clock2 { background-position: -320px -40px; } +.emoji-clock230 { background-position: -320px -60px; } +.emoji-clock3 { background-position: -320px -80px; } +.emoji-clock330 { background-position: -320px -100px; } +.emoji-clock4 { background-position: -320px -120px; } +.emoji-clock430 { background-position: -320px -140px; } +.emoji-clock5 { background-position: -320px -160px; } +.emoji-clock530 { background-position: -320px -180px; } +.emoji-clock6 { background-position: -320px -200px; } +.emoji-clock630 { background-position: -320px -220px; } +.emoji-clock7 { background-position: -320px -240px; } +.emoji-clock730 { background-position: -320px -260px; } +.emoji-clock8 { background-position: -320px -280px; } +.emoji-clock830 { background-position: -320px -300px; } +.emoji-clock9 { background-position: 0 -320px; } +.emoji-clock930 { background-position: -20px -320px; } +.emoji-closed_book { background-position: -40px -320px; } +.emoji-closed_lock_with_key { background-position: -60px -320px; } +.emoji-closed_umbrella { background-position: -80px -320px; } +.emoji-cloud { background-position: -100px -320px; } +.emoji-cloud_lightning { background-position: -120px -320px; } +.emoji-cloud_rain { background-position: -140px -320px; } +.emoji-cloud_snow { background-position: -160px -320px; } +.emoji-cloud_tornado { background-position: -180px -320px; } +.emoji-clown { background-position: -200px -320px; } +.emoji-clubs { background-position: -220px -320px; } +.emoji-cocktail { background-position: -240px -320px; } +.emoji-coffee { background-position: -260px -320px; } +.emoji-coffin { background-position: -280px -320px; } +.emoji-cold_sweat { background-position: -300px -320px; } +.emoji-comet { background-position: -320px -320px; } +.emoji-compression { background-position: -340px 0; } +.emoji-computer { background-position: -340px -20px; } +.emoji-confetti_ball { background-position: -340px -40px; } +.emoji-confounded { background-position: -340px -60px; } +.emoji-confused { background-position: -340px -80px; } +.emoji-congratulations { background-position: -340px -100px; } +.emoji-construction { background-position: -340px -120px; } +.emoji-construction_site { background-position: -340px -140px; } +.emoji-construction_worker { background-position: -340px -160px; } +.emoji-construction_worker_tone1 { background-position: -340px -180px; } +.emoji-construction_worker_tone2 { background-position: -340px -200px; } +.emoji-construction_worker_tone3 { background-position: -340px -220px; } +.emoji-construction_worker_tone4 { background-position: -340px -240px; } +.emoji-construction_worker_tone5 { background-position: -340px -260px; } +.emoji-control_knobs { background-position: -340px -280px; } +.emoji-convenience_store { background-position: -340px -300px; } +.emoji-cookie { background-position: -340px -320px; } +.emoji-cooking { background-position: 0 -340px; } +.emoji-cool { background-position: -20px -340px; } +.emoji-cop { background-position: -40px -340px; } +.emoji-cop_tone1 { background-position: -60px -340px; } +.emoji-cop_tone2 { background-position: -80px -340px; } +.emoji-cop_tone3 { background-position: -100px -340px; } +.emoji-cop_tone4 { background-position: -120px -340px; } +.emoji-cop_tone5 { background-position: -140px -340px; } +.emoji-copyright { background-position: -160px -340px; } +.emoji-corn { background-position: -180px -340px; } +.emoji-couch { background-position: -200px -340px; } +.emoji-couple { background-position: -220px -340px; } +.emoji-couple_mm { background-position: -240px -340px; } +.emoji-couple_with_heart { background-position: -260px -340px; } +.emoji-couple_ww { background-position: -280px -340px; } +.emoji-couplekiss { background-position: -300px -340px; } +.emoji-cow { background-position: -320px -340px; } +.emoji-cow2 { background-position: -340px -340px; } +.emoji-cowboy { background-position: -360px 0; } +.emoji-crab { background-position: -360px -20px; } +.emoji-crayon { background-position: -360px -40px; } +.emoji-credit_card { background-position: -360px -60px; } +.emoji-crescent_moon { background-position: -360px -80px; } +.emoji-cricket { background-position: -360px -100px; } +.emoji-crocodile { background-position: -360px -120px; } +.emoji-croissant { background-position: -360px -140px; } +.emoji-cross { background-position: -360px -160px; } +.emoji-crossed_flags { background-position: -360px -180px; } +.emoji-crossed_swords { background-position: -360px -200px; } +.emoji-crown { background-position: -360px -220px; } +.emoji-cruise_ship { background-position: -360px -240px; } +.emoji-cry { background-position: -360px -260px; } +.emoji-crying_cat_face { background-position: -360px -280px; } +.emoji-crystal_ball { background-position: -360px -300px; } +.emoji-cucumber { background-position: -360px -320px; } +.emoji-cupid { background-position: -360px -340px; } +.emoji-curly_loop { background-position: 0 -360px; } +.emoji-currency_exchange { background-position: -20px -360px; } +.emoji-curry { background-position: -40px -360px; } +.emoji-custard { background-position: -60px -360px; } +.emoji-customs { background-position: -80px -360px; } +.emoji-cyclone { background-position: -100px -360px; } +.emoji-dagger { background-position: -120px -360px; } +.emoji-dancer { background-position: -140px -360px; } +.emoji-dancer_tone1 { background-position: -160px -360px; } +.emoji-dancer_tone2 { background-position: -180px -360px; } +.emoji-dancer_tone3 { background-position: -200px -360px; } +.emoji-dancer_tone4 { background-position: -220px -360px; } +.emoji-dancer_tone5 { background-position: -240px -360px; } +.emoji-dancers { background-position: -260px -360px; } +.emoji-dango { background-position: -280px -360px; } +.emoji-dark_sunglasses { background-position: -300px -360px; } +.emoji-dart { background-position: -320px -360px; } +.emoji-dash { background-position: -340px -360px; } +.emoji-date { background-position: -360px -360px; } +.emoji-deciduous_tree { background-position: -380px 0; } +.emoji-deer { background-position: -380px -20px; } +.emoji-department_store { background-position: -380px -40px; } +.emoji-desert { background-position: -380px -60px; } +.emoji-desktop { background-position: -380px -80px; } +.emoji-diamond_shape_with_a_dot_inside { background-position: -380px -100px; } +.emoji-diamonds { background-position: -380px -120px; } +.emoji-disappointed { background-position: -380px -140px; } +.emoji-disappointed_relieved { background-position: -380px -160px; } +.emoji-dividers { background-position: -380px -180px; } +.emoji-dizzy { background-position: -380px -200px; } +.emoji-dizzy_face { background-position: -380px -220px; } +.emoji-do_not_litter { background-position: -380px -240px; } +.emoji-dog { background-position: -380px -260px; } +.emoji-dog2 { background-position: -380px -280px; } +.emoji-dollar { background-position: -380px -300px; } +.emoji-dolls { background-position: -380px -320px; } +.emoji-dolphin { background-position: -380px -340px; } +.emoji-door { background-position: -380px -360px; } +.emoji-doughnut { background-position: 0 -380px; } +.emoji-dove { background-position: -20px -380px; } +.emoji-dragon { background-position: -40px -380px; } +.emoji-dragon_face { background-position: -60px -380px; } +.emoji-dress { background-position: -80px -380px; } +.emoji-dromedary_camel { background-position: -100px -380px; } +.emoji-drooling_face { background-position: -120px -380px; } +.emoji-droplet { background-position: -140px -380px; } +.emoji-drum { background-position: -160px -380px; } +.emoji-duck { background-position: -180px -380px; } +.emoji-dvd { background-position: -200px -380px; } +.emoji-e-mail { background-position: -220px -380px; } +.emoji-eagle { background-position: -240px -380px; } +.emoji-ear { background-position: -260px -380px; } +.emoji-ear_of_rice { background-position: -280px -380px; } +.emoji-ear_tone1 { background-position: -300px -380px; } +.emoji-ear_tone2 { background-position: -320px -380px; } +.emoji-ear_tone3 { background-position: -340px -380px; } +.emoji-ear_tone4 { background-position: -360px -380px; } +.emoji-ear_tone5 { background-position: -380px -380px; } +.emoji-earth_africa { background-position: -400px 0; } +.emoji-earth_americas { background-position: -400px -20px; } +.emoji-earth_asia { background-position: -400px -40px; } +.emoji-egg { background-position: -400px -60px; } +.emoji-eggplant { background-position: -400px -80px; } +.emoji-eight { background-position: -400px -100px; } +.emoji-eight_pointed_black_star { background-position: -400px -120px; } +.emoji-eight_spoked_asterisk { background-position: -400px -140px; } +.emoji-eject { background-position: -400px -160px; } +.emoji-electric_plug { background-position: -400px -180px; } +.emoji-elephant { background-position: -400px -200px; } +.emoji-end { background-position: -400px -220px; } +.emoji-envelope { background-position: -400px -240px; } +.emoji-envelope_with_arrow { background-position: -400px -260px; } +.emoji-euro { background-position: -400px -280px; } +.emoji-european_castle { background-position: -400px -300px; } +.emoji-european_post_office { background-position: -400px -320px; } +.emoji-evergreen_tree { background-position: -400px -340px; } +.emoji-exclamation { background-position: -400px -360px; } +.emoji-expressionless { background-position: -400px -380px; } +.emoji-eye { background-position: 0 -400px; } +.emoji-eye_in_speech_bubble { background-position: -20px -400px; } +.emoji-eyeglasses { background-position: -40px -400px; } +.emoji-eyes { background-position: -60px -400px; } +.emoji-face_palm { background-position: -80px -400px; } +.emoji-face_palm_tone1 { background-position: -100px -400px; } +.emoji-face_palm_tone2 { background-position: -120px -400px; } +.emoji-face_palm_tone3 { background-position: -140px -400px; } +.emoji-face_palm_tone4 { background-position: -160px -400px; } +.emoji-face_palm_tone5 { background-position: -180px -400px; } +.emoji-factory { background-position: -200px -400px; } +.emoji-fallen_leaf { background-position: -220px -400px; } +.emoji-family { background-position: -240px -400px; } +.emoji-family_mmb { background-position: -260px -400px; } +.emoji-family_mmbb { background-position: -280px -400px; } +.emoji-family_mmg { background-position: -300px -400px; } +.emoji-family_mmgb { background-position: -320px -400px; } +.emoji-family_mmgg { background-position: -340px -400px; } +.emoji-family_mwbb { background-position: -360px -400px; } +.emoji-family_mwg { background-position: -380px -400px; } +.emoji-family_mwgb { background-position: -400px -400px; } +.emoji-family_mwgg { background-position: -420px 0; } +.emoji-family_wwb { background-position: -420px -20px; } +.emoji-family_wwbb { background-position: -420px -40px; } +.emoji-family_wwg { background-position: -420px -60px; } +.emoji-family_wwgb { background-position: -420px -80px; } +.emoji-family_wwgg { background-position: -420px -100px; } +.emoji-fast_forward { background-position: -420px -120px; } +.emoji-fax { background-position: -420px -140px; } +.emoji-fearful { background-position: -420px -160px; } +.emoji-feet { background-position: -420px -180px; } +.emoji-fencer { background-position: -420px -200px; } +.emoji-ferris_wheel { background-position: -420px -220px; } +.emoji-ferry { background-position: -420px -240px; } +.emoji-field_hockey { background-position: -420px -260px; } +.emoji-file_cabinet { background-position: -420px -280px; } +.emoji-file_folder { background-position: -420px -300px; } +.emoji-film_frames { background-position: -420px -320px; } +.emoji-fingers_crossed { background-position: -420px -340px; } +.emoji-fingers_crossed_tone1 { background-position: -420px -360px; } +.emoji-fingers_crossed_tone2 { background-position: -420px -380px; } +.emoji-fingers_crossed_tone3 { background-position: -420px -400px; } +.emoji-fingers_crossed_tone4 { background-position: 0 -420px; } +.emoji-fingers_crossed_tone5 { background-position: -20px -420px; } +.emoji-fire { background-position: -40px -420px; } +.emoji-fire_engine { background-position: -60px -420px; } +.emoji-fireworks { background-position: -80px -420px; } +.emoji-first_place { background-position: -100px -420px; } +.emoji-first_quarter_moon { background-position: -120px -420px; } +.emoji-first_quarter_moon_with_face { background-position: -140px -420px; } +.emoji-fish { background-position: -160px -420px; } +.emoji-fish_cake { background-position: -180px -420px; } +.emoji-fishing_pole_and_fish { background-position: -200px -420px; } +.emoji-fist { background-position: -220px -420px; } +.emoji-fist_tone1 { background-position: -240px -420px; } +.emoji-fist_tone2 { background-position: -260px -420px; } +.emoji-fist_tone3 { background-position: -280px -420px; } +.emoji-fist_tone4 { background-position: -300px -420px; } +.emoji-fist_tone5 { background-position: -320px -420px; } +.emoji-five { background-position: -340px -420px; } +.emoji-flag_ac { background-position: -360px -420px; } +.emoji-flag_ad { background-position: -380px -420px; } +.emoji-flag_ae { background-position: -400px -420px; } +.emoji-flag_af { background-position: -420px -420px; } +.emoji-flag_ag { background-position: -440px 0; } +.emoji-flag_ai { background-position: -440px -20px; } +.emoji-flag_al { background-position: -440px -40px; } +.emoji-flag_am { background-position: -440px -60px; } +.emoji-flag_ao { background-position: -440px -80px; } +.emoji-flag_aq { background-position: -440px -100px; } +.emoji-flag_ar { background-position: -440px -120px; } +.emoji-flag_as { background-position: -440px -140px; } +.emoji-flag_at { background-position: -440px -160px; } +.emoji-flag_au { background-position: -440px -180px; } +.emoji-flag_aw { background-position: -440px -200px; } +.emoji-flag_ax { background-position: -440px -220px; } +.emoji-flag_az { background-position: -440px -240px; } +.emoji-flag_ba { background-position: -440px -260px; } +.emoji-flag_bb { background-position: -440px -280px; } +.emoji-flag_bd { background-position: -440px -300px; } +.emoji-flag_be { background-position: -440px -320px; } +.emoji-flag_bf { background-position: -440px -340px; } +.emoji-flag_bg { background-position: -440px -360px; } +.emoji-flag_bh { background-position: -440px -380px; } +.emoji-flag_bi { background-position: -440px -400px; } +.emoji-flag_bj { background-position: -440px -420px; } +.emoji-flag_bl { background-position: 0 -440px; } +.emoji-flag_black { background-position: -20px -440px; } +.emoji-flag_bm { background-position: -40px -440px; } +.emoji-flag_bn { background-position: -60px -440px; } +.emoji-flag_bo { background-position: -80px -440px; } +.emoji-flag_bq { background-position: -100px -440px; } +.emoji-flag_br { background-position: -120px -440px; } +.emoji-flag_bs { background-position: -140px -440px; } +.emoji-flag_bt { background-position: -160px -440px; } +.emoji-flag_bv { background-position: -180px -440px; } +.emoji-flag_bw { background-position: -200px -440px; } +.emoji-flag_by { background-position: -220px -440px; } +.emoji-flag_bz { background-position: -240px -440px; } +.emoji-flag_ca { background-position: -260px -440px; } +.emoji-flag_cc { background-position: -280px -440px; } +.emoji-flag_cd { background-position: -300px -440px; } +.emoji-flag_cf { background-position: -320px -440px; } +.emoji-flag_cg { background-position: -340px -440px; } +.emoji-flag_ch { background-position: -360px -440px; } +.emoji-flag_ci { background-position: -380px -440px; } +.emoji-flag_ck { background-position: -400px -440px; } +.emoji-flag_cl { background-position: -420px -440px; } +.emoji-flag_cm { background-position: -440px -440px; } +.emoji-flag_cn { background-position: -460px 0; } +.emoji-flag_co { background-position: -460px -20px; } +.emoji-flag_cp { background-position: -460px -40px; } +.emoji-flag_cr { background-position: -460px -60px; } +.emoji-flag_cu { background-position: -460px -80px; } +.emoji-flag_cv { background-position: -460px -100px; } +.emoji-flag_cw { background-position: -460px -120px; } +.emoji-flag_cx { background-position: -460px -140px; } +.emoji-flag_cy { background-position: -460px -160px; } +.emoji-flag_cz { background-position: -460px -180px; } +.emoji-flag_de { background-position: -460px -200px; } +.emoji-flag_dg { background-position: -460px -220px; } +.emoji-flag_dj { background-position: -460px -240px; } +.emoji-flag_dk { background-position: -460px -260px; } +.emoji-flag_dm { background-position: -460px -280px; } +.emoji-flag_do { background-position: -460px -300px; } +.emoji-flag_dz { background-position: -460px -320px; } +.emoji-flag_ea { background-position: -460px -340px; } +.emoji-flag_ec { background-position: -460px -360px; } +.emoji-flag_ee { background-position: -460px -380px; } +.emoji-flag_eg { background-position: -460px -400px; } +.emoji-flag_eh { background-position: -460px -420px; } +.emoji-flag_er { background-position: -460px -440px; } +.emoji-flag_es { background-position: 0 -460px; } +.emoji-flag_et { background-position: -20px -460px; } +.emoji-flag_eu { background-position: -40px -460px; } +.emoji-flag_fi { background-position: -60px -460px; } +.emoji-flag_fj { background-position: -80px -460px; } +.emoji-flag_fk { background-position: -100px -460px; } +.emoji-flag_fm { background-position: -120px -460px; } +.emoji-flag_fo { background-position: -140px -460px; } +.emoji-flag_fr { background-position: -160px -460px; } +.emoji-flag_ga { background-position: -180px -460px; } +.emoji-flag_gb { background-position: -200px -460px; } +.emoji-flag_gd { background-position: -220px -460px; } +.emoji-flag_ge { background-position: -240px -460px; } +.emoji-flag_gf { background-position: -260px -460px; } +.emoji-flag_gg { background-position: -280px -460px; } +.emoji-flag_gh { background-position: -300px -460px; } +.emoji-flag_gi { background-position: -320px -460px; } +.emoji-flag_gl { background-position: -340px -460px; } +.emoji-flag_gm { background-position: -360px -460px; } +.emoji-flag_gn { background-position: -380px -460px; } +.emoji-flag_gp { background-position: -400px -460px; } +.emoji-flag_gq { background-position: -420px -460px; } +.emoji-flag_gr { background-position: -440px -460px; } +.emoji-flag_gs { background-position: -460px -460px; } +.emoji-flag_gt { background-position: -480px 0; } +.emoji-flag_gu { background-position: -480px -20px; } +.emoji-flag_gw { background-position: -480px -40px; } +.emoji-flag_gy { background-position: -480px -60px; } +.emoji-flag_hk { background-position: -480px -80px; } +.emoji-flag_hm { background-position: -480px -100px; } +.emoji-flag_hn { background-position: -480px -120px; } +.emoji-flag_hr { background-position: -480px -140px; } +.emoji-flag_ht { background-position: -480px -160px; } +.emoji-flag_hu { background-position: -480px -180px; } +.emoji-flag_ic { background-position: -480px -200px; } +.emoji-flag_id { background-position: -480px -220px; } +.emoji-flag_ie { background-position: -480px -240px; } +.emoji-flag_il { background-position: -480px -260px; } +.emoji-flag_im { background-position: -480px -280px; } +.emoji-flag_in { background-position: -480px -300px; } +.emoji-flag_io { background-position: -480px -320px; } +.emoji-flag_iq { background-position: -480px -340px; } +.emoji-flag_ir { background-position: -480px -360px; } +.emoji-flag_is { background-position: -480px -380px; } +.emoji-flag_it { background-position: -480px -400px; } +.emoji-flag_je { background-position: -480px -420px; } +.emoji-flag_jm { background-position: -480px -440px; } +.emoji-flag_jo { background-position: -480px -460px; } +.emoji-flag_jp { background-position: 0 -480px; } +.emoji-flag_ke { background-position: -20px -480px; } +.emoji-flag_kg { background-position: -40px -480px; } +.emoji-flag_kh { background-position: -60px -480px; } +.emoji-flag_ki { background-position: -80px -480px; } +.emoji-flag_km { background-position: -100px -480px; } +.emoji-flag_kn { background-position: -120px -480px; } +.emoji-flag_kp { background-position: -140px -480px; } +.emoji-flag_kr { background-position: -160px -480px; } +.emoji-flag_kw { background-position: -180px -480px; } +.emoji-flag_ky { background-position: -200px -480px; } +.emoji-flag_kz { background-position: -220px -480px; } +.emoji-flag_la { background-position: -240px -480px; } +.emoji-flag_lb { background-position: -260px -480px; } +.emoji-flag_lc { background-position: -280px -480px; } +.emoji-flag_li { background-position: -300px -480px; } +.emoji-flag_lk { background-position: -320px -480px; } +.emoji-flag_lr { background-position: -340px -480px; } +.emoji-flag_ls { background-position: -360px -480px; } +.emoji-flag_lt { background-position: -380px -480px; } +.emoji-flag_lu { background-position: -400px -480px; } +.emoji-flag_lv { background-position: -420px -480px; } +.emoji-flag_ly { background-position: -440px -480px; } +.emoji-flag_ma { background-position: -460px -480px; } +.emoji-flag_mc { background-position: -480px -480px; } +.emoji-flag_md { background-position: -500px 0; } +.emoji-flag_me { background-position: -500px -20px; } +.emoji-flag_mf { background-position: -500px -40px; } +.emoji-flag_mg { background-position: -500px -60px; } +.emoji-flag_mh { background-position: -500px -80px; } +.emoji-flag_mk { background-position: -500px -100px; } +.emoji-flag_ml { background-position: -500px -120px; } +.emoji-flag_mm { background-position: -500px -140px; } +.emoji-flag_mn { background-position: -500px -160px; } +.emoji-flag_mo { background-position: -500px -180px; } +.emoji-flag_mp { background-position: -500px -200px; } +.emoji-flag_mq { background-position: -500px -220px; } +.emoji-flag_mr { background-position: -500px -240px; } +.emoji-flag_ms { background-position: -500px -260px; } +.emoji-flag_mt { background-position: -500px -280px; } +.emoji-flag_mu { background-position: -500px -300px; } +.emoji-flag_mv { background-position: -500px -320px; } +.emoji-flag_mw { background-position: -500px -340px; } +.emoji-flag_mx { background-position: -500px -360px; } +.emoji-flag_my { background-position: -500px -380px; } +.emoji-flag_mz { background-position: -500px -400px; } +.emoji-flag_na { background-position: -500px -420px; } +.emoji-flag_nc { background-position: -500px -440px; } +.emoji-flag_ne { background-position: -500px -460px; } +.emoji-flag_nf { background-position: -500px -480px; } +.emoji-flag_ng { background-position: 0 -500px; } +.emoji-flag_ni { background-position: -20px -500px; } +.emoji-flag_nl { background-position: -40px -500px; } +.emoji-flag_no { background-position: -60px -500px; } +.emoji-flag_np { background-position: -80px -500px; } +.emoji-flag_nr { background-position: -100px -500px; } +.emoji-flag_nu { background-position: -120px -500px; } +.emoji-flag_nz { background-position: -140px -500px; } +.emoji-flag_om { background-position: -160px -500px; } +.emoji-flag_pa { background-position: -180px -500px; } +.emoji-flag_pe { background-position: -200px -500px; } +.emoji-flag_pf { background-position: -220px -500px; } +.emoji-flag_pg { background-position: -240px -500px; } +.emoji-flag_ph { background-position: -260px -500px; } +.emoji-flag_pk { background-position: -280px -500px; } +.emoji-flag_pl { background-position: -300px -500px; } +.emoji-flag_pm { background-position: -320px -500px; } +.emoji-flag_pn { background-position: -340px -500px; } +.emoji-flag_pr { background-position: -360px -500px; } +.emoji-flag_ps { background-position: -380px -500px; } +.emoji-flag_pt { background-position: -400px -500px; } +.emoji-flag_pw { background-position: -420px -500px; } +.emoji-flag_py { background-position: -440px -500px; } +.emoji-flag_qa { background-position: -460px -500px; } +.emoji-flag_re { background-position: -480px -500px; } +.emoji-flag_ro { background-position: -500px -500px; } +.emoji-flag_rs { background-position: -520px 0; } +.emoji-flag_ru { background-position: -520px -20px; } +.emoji-flag_rw { background-position: -520px -40px; } +.emoji-flag_sa { background-position: -520px -60px; } +.emoji-flag_sb { background-position: -520px -80px; } +.emoji-flag_sc { background-position: -520px -100px; } +.emoji-flag_sd { background-position: -520px -120px; } +.emoji-flag_se { background-position: -520px -140px; } +.emoji-flag_sg { background-position: -520px -160px; } +.emoji-flag_sh { background-position: -520px -180px; } +.emoji-flag_si { background-position: -520px -200px; } +.emoji-flag_sj { background-position: -520px -220px; } +.emoji-flag_sk { background-position: -520px -240px; } +.emoji-flag_sl { background-position: -520px -260px; } +.emoji-flag_sm { background-position: -520px -280px; } +.emoji-flag_sn { background-position: -520px -300px; } +.emoji-flag_so { background-position: -520px -320px; } +.emoji-flag_sr { background-position: -520px -340px; } +.emoji-flag_ss { background-position: -520px -360px; } +.emoji-flag_st { background-position: -520px -380px; } +.emoji-flag_sv { background-position: -520px -400px; } +.emoji-flag_sx { background-position: -520px -420px; } +.emoji-flag_sy { background-position: -520px -440px; } +.emoji-flag_sz { background-position: -520px -460px; } +.emoji-flag_ta { background-position: -520px -480px; } +.emoji-flag_tc { background-position: -520px -500px; } +.emoji-flag_td { background-position: 0 -520px; } +.emoji-flag_tf { background-position: -20px -520px; } +.emoji-flag_tg { background-position: -40px -520px; } +.emoji-flag_th { background-position: -60px -520px; } +.emoji-flag_tj { background-position: -80px -520px; } +.emoji-flag_tk { background-position: -100px -520px; } +.emoji-flag_tl { background-position: -120px -520px; } +.emoji-flag_tm { background-position: -140px -520px; } +.emoji-flag_tn { background-position: -160px -520px; } +.emoji-flag_to { background-position: -180px -520px; } +.emoji-flag_tr { background-position: -200px -520px; } +.emoji-flag_tt { background-position: -220px -520px; } +.emoji-flag_tv { background-position: -240px -520px; } +.emoji-flag_tw { background-position: -260px -520px; } +.emoji-flag_tz { background-position: -280px -520px; } +.emoji-flag_ua { background-position: -300px -520px; } +.emoji-flag_ug { background-position: -320px -520px; } +.emoji-flag_um { background-position: -340px -520px; } +.emoji-flag_us { background-position: -360px -520px; } +.emoji-flag_uy { background-position: -380px -520px; } +.emoji-flag_uz { background-position: -400px -520px; } +.emoji-flag_va { background-position: -420px -520px; } +.emoji-flag_vc { background-position: -440px -520px; } +.emoji-flag_ve { background-position: -460px -520px; } +.emoji-flag_vg { background-position: -480px -520px; } +.emoji-flag_vi { background-position: -500px -520px; } +.emoji-flag_vn { background-position: -520px -520px; } +.emoji-flag_vu { background-position: -540px 0; } +.emoji-flag_wf { background-position: -540px -20px; } +.emoji-flag_white { background-position: -540px -40px; } +.emoji-flag_ws { background-position: -540px -60px; } +.emoji-flag_xk { background-position: -540px -80px; } +.emoji-flag_ye { background-position: -540px -100px; } +.emoji-flag_yt { background-position: -540px -120px; } +.emoji-flag_za { background-position: -540px -140px; } +.emoji-flag_zm { background-position: -540px -160px; } +.emoji-flag_zw { background-position: -540px -180px; } +.emoji-flags { background-position: -540px -200px; } +.emoji-flashlight { background-position: -540px -220px; } +.emoji-fleur-de-lis { background-position: -540px -240px; } +.emoji-floppy_disk { background-position: -540px -260px; } +.emoji-flower_playing_cards { background-position: -540px -280px; } +.emoji-flushed { background-position: -540px -300px; } +.emoji-fog { background-position: -540px -320px; } +.emoji-foggy { background-position: -540px -340px; } +.emoji-football { background-position: -540px -360px; } +.emoji-footprints { background-position: -540px -380px; } +.emoji-fork_and_knife { background-position: -540px -400px; } +.emoji-fork_knife_plate { background-position: -540px -420px; } +.emoji-fountain { background-position: -540px -440px; } +.emoji-four { background-position: -540px -460px; } +.emoji-four_leaf_clover { background-position: -540px -480px; } +.emoji-fox { background-position: -540px -500px; } +.emoji-frame_photo { background-position: -540px -520px; } +.emoji-free { background-position: 0 -540px; } +.emoji-french_bread { background-position: -20px -540px; } +.emoji-fried_shrimp { background-position: -40px -540px; } +.emoji-fries { background-position: -60px -540px; } +.emoji-frog { background-position: -80px -540px; } +.emoji-frowning { background-position: -100px -540px; } +.emoji-frowning2 { background-position: -120px -540px; } +.emoji-fuelpump { background-position: -140px -540px; } +.emoji-full_moon { background-position: -160px -540px; } +.emoji-full_moon_with_face { background-position: -180px -540px; } +.emoji-game_die { background-position: -200px -540px; } +.emoji-gay_pride_flag { background-position: -220px -540px; } +.emoji-gear { background-position: -240px -540px; } +.emoji-gem { background-position: -260px -540px; } +.emoji-gemini { background-position: -280px -540px; } +.emoji-ghost { background-position: -300px -540px; } +.emoji-gift { background-position: -320px -540px; } +.emoji-gift_heart { background-position: -340px -540px; } +.emoji-girl { background-position: -360px -540px; } +.emoji-girl_tone1 { background-position: -380px -540px; } +.emoji-girl_tone2 { background-position: -400px -540px; } +.emoji-girl_tone3 { background-position: -420px -540px; } +.emoji-girl_tone4 { background-position: -440px -540px; } +.emoji-girl_tone5 { background-position: -460px -540px; } +.emoji-globe_with_meridians { background-position: -480px -540px; } +.emoji-goal { background-position: -500px -540px; } +.emoji-goat { background-position: -520px -540px; } +.emoji-golf { background-position: -540px -540px; } +.emoji-golfer { background-position: -560px 0; } +.emoji-gorilla { background-position: -560px -20px; } +.emoji-grapes { background-position: -560px -40px; } +.emoji-green_apple { background-position: -560px -60px; } +.emoji-green_book { background-position: -560px -80px; } +.emoji-green_heart { background-position: -560px -100px; } +.emoji-grey_exclamation { background-position: -560px -120px; } +.emoji-grey_question { background-position: -560px -140px; } +.emoji-grimacing { background-position: -560px -160px; } +.emoji-grin { background-position: -560px -180px; } +.emoji-grinning { background-position: -560px -200px; } +.emoji-guardsman { background-position: -560px -220px; } +.emoji-guardsman_tone1 { background-position: -560px -240px; } +.emoji-guardsman_tone2 { background-position: -560px -260px; } +.emoji-guardsman_tone3 { background-position: -560px -280px; } +.emoji-guardsman_tone4 { background-position: -560px -300px; } +.emoji-guardsman_tone5 { background-position: -560px -320px; } +.emoji-guitar { background-position: -560px -340px; } +.emoji-gun { background-position: -560px -360px; } +.emoji-haircut { background-position: -560px -380px; } +.emoji-haircut_tone1 { background-position: -560px -400px; } +.emoji-haircut_tone2 { background-position: -560px -420px; } +.emoji-haircut_tone3 { background-position: -560px -440px; } +.emoji-haircut_tone4 { background-position: -560px -460px; } +.emoji-haircut_tone5 { background-position: -560px -480px; } +.emoji-hamburger { background-position: -560px -500px; } +.emoji-hammer { background-position: -560px -520px; } +.emoji-hammer_pick { background-position: -560px -540px; } +.emoji-hamster { background-position: 0 -560px; } +.emoji-hand_splayed { background-position: -20px -560px; } +.emoji-hand_splayed_tone1 { background-position: -40px -560px; } +.emoji-hand_splayed_tone2 { background-position: -60px -560px; } +.emoji-hand_splayed_tone3 { background-position: -80px -560px; } +.emoji-hand_splayed_tone4 { background-position: -100px -560px; } +.emoji-hand_splayed_tone5 { background-position: -120px -560px; } +.emoji-handbag { background-position: -140px -560px; } +.emoji-handball { background-position: -160px -560px; } +.emoji-handball_tone1 { background-position: -180px -560px; } +.emoji-handball_tone2 { background-position: -200px -560px; } +.emoji-handball_tone3 { background-position: -220px -560px; } +.emoji-handball_tone4 { background-position: -240px -560px; } +.emoji-handball_tone5 { background-position: -260px -560px; } +.emoji-handshake { background-position: -280px -560px; } +.emoji-handshake_tone1 { background-position: -300px -560px; } +.emoji-handshake_tone2 { background-position: -320px -560px; } +.emoji-handshake_tone3 { background-position: -340px -560px; } +.emoji-handshake_tone4 { background-position: -360px -560px; } +.emoji-handshake_tone5 { background-position: -380px -560px; } +.emoji-hash { background-position: -400px -560px; } +.emoji-hatched_chick { background-position: -420px -560px; } +.emoji-hatching_chick { background-position: -440px -560px; } +.emoji-head_bandage { background-position: -460px -560px; } +.emoji-headphones { background-position: -480px -560px; } +.emoji-hear_no_evil { background-position: -500px -560px; } +.emoji-heart { background-position: -520px -560px; } +.emoji-heart_decoration { background-position: -540px -560px; } +.emoji-heart_exclamation { background-position: -560px -560px; } +.emoji-heart_eyes { background-position: -580px 0; } +.emoji-heart_eyes_cat { background-position: -580px -20px; } +.emoji-heartbeat { background-position: -580px -40px; } +.emoji-heartpulse { background-position: -580px -60px; } +.emoji-hearts { background-position: -580px -80px; } +.emoji-heavy_check_mark { background-position: -580px -100px; } +.emoji-heavy_division_sign { background-position: -580px -120px; } +.emoji-heavy_dollar_sign { background-position: -580px -140px; } +.emoji-heavy_minus_sign { background-position: -580px -160px; } +.emoji-heavy_multiplication_x { background-position: -580px -180px; } +.emoji-heavy_plus_sign { background-position: -580px -200px; } +.emoji-helicopter { background-position: -580px -220px; } +.emoji-helmet_with_cross { background-position: -580px -240px; } +.emoji-herb { background-position: -580px -260px; } +.emoji-hibiscus { background-position: -580px -280px; } +.emoji-high_brightness { background-position: -580px -300px; } +.emoji-high_heel { background-position: -580px -320px; } +.emoji-hockey { background-position: -580px -340px; } +.emoji-hole { background-position: -580px -360px; } +.emoji-homes { background-position: -580px -380px; } +.emoji-honey_pot { background-position: -580px -400px; } +.emoji-horse { background-position: -580px -420px; } +.emoji-horse_racing { background-position: -580px -440px; } +.emoji-horse_racing_tone1 { background-position: -580px -460px; } +.emoji-horse_racing_tone2 { background-position: -580px -480px; } +.emoji-horse_racing_tone3 { background-position: -580px -500px; } +.emoji-horse_racing_tone4 { background-position: -580px -520px; } +.emoji-horse_racing_tone5 { background-position: -580px -540px; } +.emoji-hospital { background-position: -580px -560px; } +.emoji-hot_pepper { background-position: 0 -580px; } +.emoji-hotdog { background-position: -20px -580px; } +.emoji-hotel { background-position: -40px -580px; } +.emoji-hotsprings { background-position: -60px -580px; } +.emoji-hourglass { background-position: -80px -580px; } +.emoji-hourglass_flowing_sand { background-position: -100px -580px; } +.emoji-house { background-position: -120px -580px; } +.emoji-house_abandoned { background-position: -140px -580px; } +.emoji-house_with_garden { background-position: -160px -580px; } +.emoji-hugging { background-position: -180px -580px; } +.emoji-hushed { background-position: -200px -580px; } +.emoji-ice_cream { background-position: -220px -580px; } +.emoji-ice_skate { background-position: -240px -580px; } +.emoji-icecream { background-position: -260px -580px; } +.emoji-id { background-position: -280px -580px; } +.emoji-ideograph_advantage { background-position: -300px -580px; } +.emoji-imp { background-position: -320px -580px; } +.emoji-inbox_tray { background-position: -340px -580px; } +.emoji-incoming_envelope { background-position: -360px -580px; } +.emoji-information_desk_person { background-position: -380px -580px; } +.emoji-information_desk_person_tone1 { background-position: -400px -580px; } +.emoji-information_desk_person_tone2 { background-position: -420px -580px; } +.emoji-information_desk_person_tone3 { background-position: -440px -580px; } +.emoji-information_desk_person_tone4 { background-position: -460px -580px; } +.emoji-information_desk_person_tone5 { background-position: -480px -580px; } +.emoji-information_source { background-position: -500px -580px; } +.emoji-innocent { background-position: -520px -580px; } +.emoji-interrobang { background-position: -540px -580px; } +.emoji-iphone { background-position: -560px -580px; } +.emoji-island { background-position: -580px -580px; } +.emoji-izakaya_lantern { background-position: -600px 0; } +.emoji-jack_o_lantern { background-position: -600px -20px; } +.emoji-japan { background-position: -600px -40px; } +.emoji-japanese_castle { background-position: -600px -60px; } +.emoji-japanese_goblin { background-position: -600px -80px; } +.emoji-japanese_ogre { background-position: -600px -100px; } +.emoji-jeans { background-position: -600px -120px; } +.emoji-joy { background-position: -600px -140px; } +.emoji-joy_cat { background-position: -600px -160px; } +.emoji-joystick { background-position: -600px -180px; } +.emoji-juggling { background-position: -600px -200px; } +.emoji-juggling_tone1 { background-position: -600px -220px; } +.emoji-juggling_tone2 { background-position: -600px -240px; } +.emoji-juggling_tone3 { background-position: -600px -260px; } +.emoji-juggling_tone4 { background-position: -600px -280px; } +.emoji-juggling_tone5 { background-position: -600px -300px; } +.emoji-kaaba { background-position: -600px -320px; } +.emoji-key { background-position: -600px -340px; } +.emoji-key2 { background-position: -600px -360px; } +.emoji-keyboard { background-position: -600px -380px; } +.emoji-kimono { background-position: -600px -400px; } +.emoji-kiss { background-position: -600px -420px; } +.emoji-kiss_mm { background-position: -600px -440px; } +.emoji-kiss_ww { background-position: -600px -460px; } +.emoji-kissing { background-position: -600px -480px; } +.emoji-kissing_cat { background-position: -600px -500px; } +.emoji-kissing_closed_eyes { background-position: -600px -520px; } +.emoji-kissing_heart { background-position: -600px -540px; } +.emoji-kissing_smiling_eyes { background-position: -600px -560px; } +.emoji-kiwi { background-position: -600px -580px; } +.emoji-knife { background-position: 0 -600px; } +.emoji-koala { background-position: -20px -600px; } +.emoji-koko { background-position: -40px -600px; } +.emoji-label { background-position: -60px -600px; } +.emoji-large_blue_circle { background-position: -80px -600px; } +.emoji-large_blue_diamond { background-position: -100px -600px; } +.emoji-large_orange_diamond { background-position: -120px -600px; } +.emoji-last_quarter_moon { background-position: -140px -600px; } +.emoji-last_quarter_moon_with_face { background-position: -160px -600px; } +.emoji-laughing { background-position: -180px -600px; } +.emoji-leaves { background-position: -200px -600px; } +.emoji-ledger { background-position: -220px -600px; } +.emoji-left_facing_fist { background-position: -240px -600px; } +.emoji-left_facing_fist_tone1 { background-position: -260px -600px; } +.emoji-left_facing_fist_tone2 { background-position: -280px -600px; } +.emoji-left_facing_fist_tone3 { background-position: -300px -600px; } +.emoji-left_facing_fist_tone4 { background-position: -320px -600px; } +.emoji-left_facing_fist_tone5 { background-position: -340px -600px; } +.emoji-left_luggage { background-position: -360px -600px; } +.emoji-left_right_arrow { background-position: -380px -600px; } +.emoji-leftwards_arrow_with_hook { background-position: -400px -600px; } +.emoji-lemon { background-position: -420px -600px; } +.emoji-leo { background-position: -440px -600px; } +.emoji-leopard { background-position: -460px -600px; } +.emoji-level_slider { background-position: -480px -600px; } +.emoji-levitate { background-position: -500px -600px; } +.emoji-libra { background-position: -520px -600px; } +.emoji-lifter { background-position: -540px -600px; } +.emoji-lifter_tone1 { background-position: -560px -600px; } +.emoji-lifter_tone2 { background-position: -580px -600px; } +.emoji-lifter_tone3 { background-position: -600px -600px; } +.emoji-lifter_tone4 { background-position: -620px 0; } +.emoji-lifter_tone5 { background-position: -620px -20px; } +.emoji-light_rail { background-position: -620px -40px; } +.emoji-link { background-position: -620px -60px; } +.emoji-lion_face { background-position: -620px -80px; } +.emoji-lips { background-position: -620px -100px; } +.emoji-lipstick { background-position: -620px -120px; } +.emoji-lizard { background-position: -620px -140px; } +.emoji-lock { background-position: -620px -160px; } +.emoji-lock_with_ink_pen { background-position: -620px -180px; } +.emoji-lollipop { background-position: -620px -200px; } +.emoji-loop { background-position: -620px -220px; } +.emoji-loud_sound { background-position: -620px -240px; } +.emoji-loudspeaker { background-position: -620px -260px; } +.emoji-love_hotel { background-position: -620px -280px; } +.emoji-love_letter { background-position: -620px -300px; } +.emoji-low_brightness { background-position: -620px -320px; } +.emoji-lying_face { background-position: -620px -340px; } +.emoji-m { background-position: -620px -360px; } +.emoji-mag { background-position: -620px -380px; } +.emoji-mag_right { background-position: -620px -400px; } +.emoji-mahjong { background-position: -620px -420px; } +.emoji-mailbox { background-position: -620px -440px; } +.emoji-mailbox_closed { background-position: -620px -460px; } +.emoji-mailbox_with_mail { background-position: -620px -480px; } +.emoji-mailbox_with_no_mail { background-position: -620px -500px; } +.emoji-man { background-position: -620px -520px; } +.emoji-man_dancing { background-position: -620px -540px; } +.emoji-man_dancing_tone1 { background-position: -620px -560px; } +.emoji-man_dancing_tone2 { background-position: -620px -580px; } +.emoji-man_dancing_tone3 { background-position: -620px -600px; } +.emoji-man_dancing_tone4 { background-position: 0 -620px; } +.emoji-man_dancing_tone5 { background-position: -20px -620px; } +.emoji-man_in_tuxedo { background-position: -40px -620px; } +.emoji-man_in_tuxedo_tone1 { background-position: -60px -620px; } +.emoji-man_in_tuxedo_tone2 { background-position: -80px -620px; } +.emoji-man_in_tuxedo_tone3 { background-position: -100px -620px; } +.emoji-man_in_tuxedo_tone4 { background-position: -120px -620px; } +.emoji-man_in_tuxedo_tone5 { background-position: -140px -620px; } +.emoji-man_tone1 { background-position: -160px -620px; } +.emoji-man_tone2 { background-position: -180px -620px; } +.emoji-man_tone3 { background-position: -200px -620px; } +.emoji-man_tone4 { background-position: -220px -620px; } +.emoji-man_tone5 { background-position: -240px -620px; } +.emoji-man_with_gua_pi_mao { background-position: -260px -620px; } +.emoji-man_with_gua_pi_mao_tone1 { background-position: -280px -620px; } +.emoji-man_with_gua_pi_mao_tone2 { background-position: -300px -620px; } +.emoji-man_with_gua_pi_mao_tone3 { background-position: -320px -620px; } +.emoji-man_with_gua_pi_mao_tone4 { background-position: -340px -620px; } +.emoji-man_with_gua_pi_mao_tone5 { background-position: -360px -620px; } +.emoji-man_with_turban { background-position: -380px -620px; } +.emoji-man_with_turban_tone1 { background-position: -400px -620px; } +.emoji-man_with_turban_tone2 { background-position: -420px -620px; } +.emoji-man_with_turban_tone3 { background-position: -440px -620px; } +.emoji-man_with_turban_tone4 { background-position: -460px -620px; } +.emoji-man_with_turban_tone5 { background-position: -480px -620px; } +.emoji-mans_shoe { background-position: -500px -620px; } +.emoji-map { background-position: -520px -620px; } +.emoji-maple_leaf { background-position: -540px -620px; } +.emoji-martial_arts_uniform { background-position: -560px -620px; } +.emoji-mask { background-position: -580px -620px; } +.emoji-massage { background-position: -600px -620px; } +.emoji-massage_tone1 { background-position: -620px -620px; } +.emoji-massage_tone2 { background-position: -640px 0; } +.emoji-massage_tone3 { background-position: -640px -20px; } +.emoji-massage_tone4 { background-position: -640px -40px; } +.emoji-massage_tone5 { background-position: -640px -60px; } +.emoji-meat_on_bone { background-position: -640px -80px; } +.emoji-medal { background-position: -640px -100px; } +.emoji-mega { background-position: -640px -120px; } +.emoji-melon { background-position: -640px -140px; } +.emoji-menorah { background-position: -640px -160px; } +.emoji-mens { background-position: -640px -180px; } +.emoji-metal { background-position: -640px -200px; } +.emoji-metal_tone1 { background-position: -640px -220px; } +.emoji-metal_tone2 { background-position: -640px -240px; } +.emoji-metal_tone3 { background-position: -640px -260px; } +.emoji-metal_tone4 { background-position: -640px -280px; } +.emoji-metal_tone5 { background-position: -640px -300px; } +.emoji-metro { background-position: -640px -320px; } +.emoji-microphone { background-position: -640px -340px; } +.emoji-microphone2 { background-position: -640px -360px; } +.emoji-microscope { background-position: -640px -380px; } +.emoji-middle_finger { background-position: -640px -400px; } +.emoji-middle_finger_tone1 { background-position: -640px -420px; } +.emoji-middle_finger_tone2 { background-position: -640px -440px; } +.emoji-middle_finger_tone3 { background-position: -640px -460px; } +.emoji-middle_finger_tone4 { background-position: -640px -480px; } +.emoji-middle_finger_tone5 { background-position: -640px -500px; } +.emoji-military_medal { background-position: -640px -520px; } +.emoji-milk { background-position: -640px -540px; } +.emoji-milky_way { background-position: -640px -560px; } +.emoji-minibus { background-position: -640px -580px; } +.emoji-minidisc { background-position: -640px -600px; } +.emoji-mobile_phone_off { background-position: -640px -620px; } +.emoji-money_mouth { background-position: 0 -640px; } +.emoji-money_with_wings { background-position: -20px -640px; } +.emoji-moneybag { background-position: -40px -640px; } +.emoji-monkey { background-position: -60px -640px; } +.emoji-monkey_face { background-position: -80px -640px; } +.emoji-monorail { background-position: -100px -640px; } +.emoji-mortar_board { background-position: -120px -640px; } +.emoji-mosque { background-position: -140px -640px; } +.emoji-motor_scooter { background-position: -160px -640px; } +.emoji-motorboat { background-position: -180px -640px; } +.emoji-motorcycle { background-position: -200px -640px; } +.emoji-motorway { background-position: -220px -640px; } +.emoji-mount_fuji { background-position: -240px -640px; } +.emoji-mountain { background-position: -260px -640px; } +.emoji-mountain_bicyclist { background-position: -280px -640px; } +.emoji-mountain_bicyclist_tone1 { background-position: -300px -640px; } +.emoji-mountain_bicyclist_tone2 { background-position: -320px -640px; } +.emoji-mountain_bicyclist_tone3 { background-position: -340px -640px; } +.emoji-mountain_bicyclist_tone4 { background-position: -360px -640px; } +.emoji-mountain_bicyclist_tone5 { background-position: -380px -640px; } +.emoji-mountain_cableway { background-position: -400px -640px; } +.emoji-mountain_railway { background-position: -420px -640px; } +.emoji-mountain_snow { background-position: -440px -640px; } +.emoji-mouse { background-position: -460px -640px; } +.emoji-mouse2 { background-position: -480px -640px; } +.emoji-mouse_three_button { background-position: -500px -640px; } +.emoji-movie_camera { background-position: -520px -640px; } +.emoji-moyai { background-position: -540px -640px; } +.emoji-mrs_claus { background-position: -560px -640px; } +.emoji-mrs_claus_tone1 { background-position: -580px -640px; } +.emoji-mrs_claus_tone2 { background-position: -600px -640px; } +.emoji-mrs_claus_tone3 { background-position: -620px -640px; } +.emoji-mrs_claus_tone4 { background-position: -640px -640px; } +.emoji-mrs_claus_tone5 { background-position: -660px 0; } +.emoji-muscle { background-position: -660px -20px; } +.emoji-muscle_tone1 { background-position: -660px -40px; } +.emoji-muscle_tone2 { background-position: -660px -60px; } +.emoji-muscle_tone3 { background-position: -660px -80px; } +.emoji-muscle_tone4 { background-position: -660px -100px; } +.emoji-muscle_tone5 { background-position: -660px -120px; } +.emoji-mushroom { background-position: -660px -140px; } +.emoji-musical_keyboard { background-position: -660px -160px; } +.emoji-musical_note { background-position: -660px -180px; } +.emoji-musical_score { background-position: -660px -200px; } +.emoji-mute { background-position: -660px -220px; } +.emoji-nail_care { background-position: -660px -240px; } +.emoji-nail_care_tone1 { background-position: -660px -260px; } +.emoji-nail_care_tone2 { background-position: -660px -280px; } +.emoji-nail_care_tone3 { background-position: -660px -300px; } +.emoji-nail_care_tone4 { background-position: -660px -320px; } +.emoji-nail_care_tone5 { background-position: -660px -340px; } +.emoji-name_badge { background-position: -660px -360px; } +.emoji-nauseated_face { background-position: -660px -380px; } +.emoji-necktie { background-position: -660px -400px; } +.emoji-negative_squared_cross_mark { background-position: -660px -420px; } +.emoji-nerd { background-position: -660px -440px; } +.emoji-neutral_face { background-position: -660px -460px; } +.emoji-new { background-position: -660px -480px; } +.emoji-new_moon { background-position: -660px -500px; } +.emoji-new_moon_with_face { background-position: -660px -520px; } +.emoji-newspaper { background-position: -660px -540px; } +.emoji-newspaper2 { background-position: -660px -560px; } +.emoji-ng { background-position: -660px -580px; } +.emoji-night_with_stars { background-position: -660px -600px; } +.emoji-nine { background-position: -660px -620px; } +.emoji-no_bell { background-position: -660px -640px; } +.emoji-no_bicycles { background-position: 0 -660px; } +.emoji-no_entry { background-position: -20px -660px; } +.emoji-no_entry_sign { background-position: -40px -660px; } +.emoji-no_good { background-position: -60px -660px; } +.emoji-no_good_tone1 { background-position: -80px -660px; } +.emoji-no_good_tone2 { background-position: -100px -660px; } +.emoji-no_good_tone3 { background-position: -120px -660px; } +.emoji-no_good_tone4 { background-position: -140px -660px; } +.emoji-no_good_tone5 { background-position: -160px -660px; } +.emoji-no_mobile_phones { background-position: -180px -660px; } +.emoji-no_mouth { background-position: -200px -660px; } +.emoji-no_pedestrians { background-position: -220px -660px; } +.emoji-no_smoking { background-position: -240px -660px; } +.emoji-non-potable_water { background-position: -260px -660px; } +.emoji-nose { background-position: -280px -660px; } +.emoji-nose_tone1 { background-position: -300px -660px; } +.emoji-nose_tone2 { background-position: -320px -660px; } +.emoji-nose_tone3 { background-position: -340px -660px; } +.emoji-nose_tone4 { background-position: -360px -660px; } +.emoji-nose_tone5 { background-position: -380px -660px; } +.emoji-notebook { background-position: -400px -660px; } +.emoji-notebook_with_decorative_cover { background-position: -420px -660px; } +.emoji-notepad_spiral { background-position: -440px -660px; } +.emoji-notes { background-position: -460px -660px; } +.emoji-nut_and_bolt { background-position: -480px -660px; } +.emoji-o { background-position: -500px -660px; } +.emoji-o2 { background-position: -520px -660px; } +.emoji-ocean { background-position: -540px -660px; } +.emoji-octagonal_sign { background-position: -560px -660px; } +.emoji-octopus { background-position: -580px -660px; } +.emoji-oden { background-position: -600px -660px; } +.emoji-office { background-position: -620px -660px; } +.emoji-oil { background-position: -640px -660px; } +.emoji-ok { background-position: -660px -660px; } +.emoji-ok_hand { background-position: -680px 0; } +.emoji-ok_hand_tone1 { background-position: -680px -20px; } +.emoji-ok_hand_tone2 { background-position: -680px -40px; } +.emoji-ok_hand_tone3 { background-position: -680px -60px; } +.emoji-ok_hand_tone4 { background-position: -680px -80px; } +.emoji-ok_hand_tone5 { background-position: -680px -100px; } +.emoji-ok_woman { background-position: -680px -120px; } +.emoji-ok_woman_tone1 { background-position: -680px -140px; } +.emoji-ok_woman_tone2 { background-position: -680px -160px; } +.emoji-ok_woman_tone3 { background-position: -680px -180px; } +.emoji-ok_woman_tone4 { background-position: -680px -200px; } +.emoji-ok_woman_tone5 { background-position: -680px -220px; } +.emoji-older_man { background-position: -680px -240px; } +.emoji-older_man_tone1 { background-position: -680px -260px; } +.emoji-older_man_tone2 { background-position: -680px -280px; } +.emoji-older_man_tone3 { background-position: -680px -300px; } +.emoji-older_man_tone4 { background-position: -680px -320px; } +.emoji-older_man_tone5 { background-position: -680px -340px; } +.emoji-older_woman { background-position: -680px -360px; } +.emoji-older_woman_tone1 { background-position: -680px -380px; } +.emoji-older_woman_tone2 { background-position: -680px -400px; } +.emoji-older_woman_tone3 { background-position: -680px -420px; } +.emoji-older_woman_tone4 { background-position: -680px -440px; } +.emoji-older_woman_tone5 { background-position: -680px -460px; } +.emoji-om_symbol { background-position: -680px -480px; } +.emoji-on { background-position: -680px -500px; } +.emoji-oncoming_automobile { background-position: -680px -520px; } +.emoji-oncoming_bus { background-position: -680px -540px; } +.emoji-oncoming_police_car { background-position: -680px -560px; } +.emoji-oncoming_taxi { background-position: -680px -580px; } +.emoji-one { background-position: -680px -600px; } +.emoji-open_file_folder { background-position: -680px -620px; } +.emoji-open_hands { background-position: -680px -640px; } +.emoji-open_hands_tone1 { background-position: -680px -660px; } +.emoji-open_hands_tone2 { background-position: 0 -680px; } +.emoji-open_hands_tone3 { background-position: -20px -680px; } +.emoji-open_hands_tone4 { background-position: -40px -680px; } +.emoji-open_hands_tone5 { background-position: -60px -680px; } +.emoji-open_mouth { background-position: -80px -680px; } +.emoji-ophiuchus { background-position: -100px -680px; } +.emoji-orange_book { background-position: -120px -680px; } +.emoji-orthodox_cross { background-position: -140px -680px; } +.emoji-outbox_tray { background-position: -160px -680px; } +.emoji-owl { background-position: -180px -680px; } +.emoji-ox { background-position: -200px -680px; } +.emoji-package { background-position: -220px -680px; } +.emoji-page_facing_up { background-position: -240px -680px; } +.emoji-page_with_curl { background-position: -260px -680px; } +.emoji-pager { background-position: -280px -680px; } +.emoji-paintbrush { background-position: -300px -680px; } +.emoji-palm_tree { background-position: -320px -680px; } +.emoji-pancakes { background-position: -340px -680px; } +.emoji-panda_face { background-position: -360px -680px; } +.emoji-paperclip { background-position: -380px -680px; } +.emoji-paperclips { background-position: -400px -680px; } +.emoji-park { background-position: -420px -680px; } +.emoji-parking { background-position: -440px -680px; } +.emoji-part_alternation_mark { background-position: -460px -680px; } +.emoji-partly_sunny { background-position: -480px -680px; } +.emoji-passport_control { background-position: -500px -680px; } +.emoji-pause_button { background-position: -520px -680px; } +.emoji-peace { background-position: -540px -680px; } +.emoji-peach { background-position: -560px -680px; } +.emoji-peanuts { background-position: -580px -680px; } +.emoji-pear { background-position: -600px -680px; } +.emoji-pen_ballpoint { background-position: -620px -680px; } +.emoji-pen_fountain { background-position: -640px -680px; } +.emoji-pencil { background-position: -660px -680px; } +.emoji-pencil2 { background-position: -680px -680px; } +.emoji-penguin { background-position: -700px 0; } +.emoji-pensive { background-position: -700px -20px; } +.emoji-performing_arts { background-position: -700px -40px; } +.emoji-persevere { background-position: -700px -60px; } +.emoji-person_frowning { background-position: -700px -80px; } +.emoji-person_frowning_tone1 { background-position: -700px -100px; } +.emoji-person_frowning_tone2 { background-position: -700px -120px; } +.emoji-person_frowning_tone3 { background-position: -700px -140px; } +.emoji-person_frowning_tone4 { background-position: -700px -160px; } +.emoji-person_frowning_tone5 { background-position: -700px -180px; } +.emoji-person_with_blond_hair { background-position: -700px -200px; } +.emoji-person_with_blond_hair_tone1 { background-position: -700px -220px; } +.emoji-person_with_blond_hair_tone2 { background-position: -700px -240px; } +.emoji-person_with_blond_hair_tone3 { background-position: -700px -260px; } +.emoji-person_with_blond_hair_tone4 { background-position: -700px -280px; } +.emoji-person_with_blond_hair_tone5 { background-position: -700px -300px; } +.emoji-person_with_pouting_face { background-position: -700px -320px; } +.emoji-person_with_pouting_face_tone1 { background-position: -700px -340px; } +.emoji-person_with_pouting_face_tone2 { background-position: -700px -360px; } +.emoji-person_with_pouting_face_tone3 { background-position: -700px -380px; } +.emoji-person_with_pouting_face_tone4 { background-position: -700px -400px; } +.emoji-person_with_pouting_face_tone5 { background-position: -700px -420px; } +.emoji-pick { background-position: -700px -440px; } +.emoji-pig { background-position: -700px -460px; } +.emoji-pig2 { background-position: -700px -480px; } +.emoji-pig_nose { background-position: -700px -500px; } +.emoji-pill { background-position: -700px -520px; } +.emoji-pineapple { background-position: -700px -540px; } +.emoji-ping_pong { background-position: -700px -560px; } +.emoji-pisces { background-position: -700px -580px; } +.emoji-pizza { background-position: -700px -600px; } +.emoji-place_of_worship { background-position: -700px -620px; } +.emoji-play_pause { background-position: -700px -640px; } +.emoji-point_down { background-position: -700px -660px; } +.emoji-point_down_tone1 { background-position: -700px -680px; } +.emoji-point_down_tone2 { background-position: 0 -700px; } +.emoji-point_down_tone3 { background-position: -20px -700px; } +.emoji-point_down_tone4 { background-position: -40px -700px; } +.emoji-point_down_tone5 { background-position: -60px -700px; } +.emoji-point_left { background-position: -80px -700px; } +.emoji-point_left_tone1 { background-position: -100px -700px; } +.emoji-point_left_tone2 { background-position: -120px -700px; } +.emoji-point_left_tone3 { background-position: -140px -700px; } +.emoji-point_left_tone4 { background-position: -160px -700px; } +.emoji-point_left_tone5 { background-position: -180px -700px; } +.emoji-point_right { background-position: -200px -700px; } +.emoji-point_right_tone1 { background-position: -220px -700px; } +.emoji-point_right_tone2 { background-position: -240px -700px; } +.emoji-point_right_tone3 { background-position: -260px -700px; } +.emoji-point_right_tone4 { background-position: -280px -700px; } +.emoji-point_right_tone5 { background-position: -300px -700px; } +.emoji-point_up { background-position: -320px -700px; } +.emoji-point_up_2 { background-position: -340px -700px; } +.emoji-point_up_2_tone1 { background-position: -360px -700px; } +.emoji-point_up_2_tone2 { background-position: -380px -700px; } +.emoji-point_up_2_tone3 { background-position: -400px -700px; } +.emoji-point_up_2_tone4 { background-position: -420px -700px; } +.emoji-point_up_2_tone5 { background-position: -440px -700px; } +.emoji-point_up_tone1 { background-position: -460px -700px; } +.emoji-point_up_tone2 { background-position: -480px -700px; } +.emoji-point_up_tone3 { background-position: -500px -700px; } +.emoji-point_up_tone4 { background-position: -520px -700px; } +.emoji-point_up_tone5 { background-position: -540px -700px; } +.emoji-police_car { background-position: -560px -700px; } +.emoji-poodle { background-position: -580px -700px; } +.emoji-poop { background-position: -600px -700px; } +.emoji-popcorn { background-position: -620px -700px; } +.emoji-post_office { background-position: -640px -700px; } +.emoji-postal_horn { background-position: -660px -700px; } +.emoji-postbox { background-position: -680px -700px; } +.emoji-potable_water { background-position: -700px -700px; } +.emoji-potato { background-position: -720px 0; } +.emoji-pouch { background-position: -720px -20px; } +.emoji-poultry_leg { background-position: -720px -40px; } +.emoji-pound { background-position: -720px -60px; } +.emoji-pouting_cat { background-position: -720px -80px; } +.emoji-pray { background-position: -720px -100px; } +.emoji-pray_tone1 { background-position: -720px -120px; } +.emoji-pray_tone2 { background-position: -720px -140px; } +.emoji-pray_tone3 { background-position: -720px -160px; } +.emoji-pray_tone4 { background-position: -720px -180px; } +.emoji-pray_tone5 { background-position: -720px -200px; } +.emoji-prayer_beads { background-position: -720px -220px; } +.emoji-pregnant_woman { background-position: -720px -240px; } +.emoji-pregnant_woman_tone1 { background-position: -720px -260px; } +.emoji-pregnant_woman_tone2 { background-position: -720px -280px; } +.emoji-pregnant_woman_tone3 { background-position: -720px -300px; } +.emoji-pregnant_woman_tone4 { background-position: -720px -320px; } +.emoji-pregnant_woman_tone5 { background-position: -720px -340px; } +.emoji-prince { background-position: -720px -360px; } +.emoji-prince_tone1 { background-position: -720px -380px; } +.emoji-prince_tone2 { background-position: -720px -400px; } +.emoji-prince_tone3 { background-position: -720px -420px; } +.emoji-prince_tone4 { background-position: -720px -440px; } +.emoji-prince_tone5 { background-position: -720px -460px; } +.emoji-princess { background-position: -720px -480px; } +.emoji-princess_tone1 { background-position: -720px -500px; } +.emoji-princess_tone2 { background-position: -720px -520px; } +.emoji-princess_tone3 { background-position: -720px -540px; } +.emoji-princess_tone4 { background-position: -720px -560px; } +.emoji-princess_tone5 { background-position: -720px -580px; } +.emoji-printer { background-position: -720px -600px; } +.emoji-projector { background-position: -720px -620px; } +.emoji-punch { background-position: -720px -640px; } +.emoji-punch_tone1 { background-position: -720px -660px; } +.emoji-punch_tone2 { background-position: -720px -680px; } +.emoji-punch_tone3 { background-position: -720px -700px; } +.emoji-punch_tone4 { background-position: 0 -720px; } +.emoji-punch_tone5 { background-position: -20px -720px; } +.emoji-purple_heart { background-position: -40px -720px; } +.emoji-purse { background-position: -60px -720px; } +.emoji-pushpin { background-position: -80px -720px; } +.emoji-put_litter_in_its_place { background-position: -100px -720px; } +.emoji-question { background-position: -120px -720px; } +.emoji-rabbit { background-position: -140px -720px; } +.emoji-rabbit2 { background-position: -160px -720px; } +.emoji-race_car { background-position: -180px -720px; } +.emoji-racehorse { background-position: -200px -720px; } +.emoji-radio { background-position: -220px -720px; } +.emoji-radio_button { background-position: -240px -720px; } +.emoji-radioactive { background-position: -260px -720px; } +.emoji-rage { background-position: -280px -720px; } +.emoji-railway_car { background-position: -300px -720px; } +.emoji-railway_track { background-position: -320px -720px; } +.emoji-rainbow { background-position: -340px -720px; } +.emoji-raised_back_of_hand { background-position: -360px -720px; } +.emoji-raised_back_of_hand_tone1 { background-position: -380px -720px; } +.emoji-raised_back_of_hand_tone2 { background-position: -400px -720px; } +.emoji-raised_back_of_hand_tone3 { background-position: -420px -720px; } +.emoji-raised_back_of_hand_tone4 { background-position: -440px -720px; } +.emoji-raised_back_of_hand_tone5 { background-position: -460px -720px; } +.emoji-raised_hand { background-position: -480px -720px; } +.emoji-raised_hand_tone1 { background-position: -500px -720px; } +.emoji-raised_hand_tone2 { background-position: -520px -720px; } +.emoji-raised_hand_tone3 { background-position: -540px -720px; } +.emoji-raised_hand_tone4 { background-position: -560px -720px; } +.emoji-raised_hand_tone5 { background-position: -580px -720px; } +.emoji-raised_hands { background-position: -600px -720px; } +.emoji-raised_hands_tone1 { background-position: -620px -720px; } +.emoji-raised_hands_tone2 { background-position: -640px -720px; } +.emoji-raised_hands_tone3 { background-position: -660px -720px; } +.emoji-raised_hands_tone4 { background-position: -680px -720px; } +.emoji-raised_hands_tone5 { background-position: -700px -720px; } +.emoji-raising_hand { background-position: -720px -720px; } +.emoji-raising_hand_tone1 { background-position: -740px 0; } +.emoji-raising_hand_tone2 { background-position: -740px -20px; } +.emoji-raising_hand_tone3 { background-position: -740px -40px; } +.emoji-raising_hand_tone4 { background-position: -740px -60px; } +.emoji-raising_hand_tone5 { background-position: -740px -80px; } +.emoji-ram { background-position: -740px -100px; } +.emoji-ramen { background-position: -740px -120px; } +.emoji-rat { background-position: -740px -140px; } +.emoji-record_button { background-position: -740px -160px; } +.emoji-recycle { background-position: -740px -180px; } +.emoji-red_car { background-position: -740px -200px; } +.emoji-red_circle { background-position: -740px -220px; } +.emoji-registered { background-position: -740px -240px; } +.emoji-relaxed { background-position: -740px -260px; } +.emoji-relieved { background-position: -740px -280px; } +.emoji-reminder_ribbon { background-position: -740px -300px; } +.emoji-repeat { background-position: -740px -320px; } +.emoji-repeat_one { background-position: -740px -340px; } +.emoji-restroom { background-position: -740px -360px; } +.emoji-revolving_hearts { background-position: -740px -380px; } +.emoji-rewind { background-position: -740px -400px; } +.emoji-rhino { background-position: -740px -420px; } +.emoji-ribbon { background-position: -740px -440px; } +.emoji-rice { background-position: -740px -460px; } +.emoji-rice_ball { background-position: -740px -480px; } +.emoji-rice_cracker { background-position: -740px -500px; } +.emoji-rice_scene { background-position: -740px -520px; } +.emoji-right_facing_fist { background-position: -740px -540px; } +.emoji-right_facing_fist_tone1 { background-position: -740px -560px; } +.emoji-right_facing_fist_tone2 { background-position: -740px -580px; } +.emoji-right_facing_fist_tone3 { background-position: -740px -600px; } +.emoji-right_facing_fist_tone4 { background-position: -740px -620px; } +.emoji-right_facing_fist_tone5 { background-position: -740px -640px; } +.emoji-ring { background-position: -740px -660px; } +.emoji-robot { background-position: -740px -680px; } +.emoji-rocket { background-position: -740px -700px; } +.emoji-rofl { background-position: -740px -720px; } +.emoji-roller_coaster { background-position: 0 -740px; } +.emoji-rolling_eyes { background-position: -20px -740px; } +.emoji-rooster { background-position: -40px -740px; } +.emoji-rose { background-position: -60px -740px; } +.emoji-rosette { background-position: -80px -740px; } +.emoji-rotating_light { background-position: -100px -740px; } +.emoji-round_pushpin { background-position: -120px -740px; } +.emoji-rowboat { background-position: -140px -740px; } +.emoji-rowboat_tone1 { background-position: -160px -740px; } +.emoji-rowboat_tone2 { background-position: -180px -740px; } +.emoji-rowboat_tone3 { background-position: -200px -740px; } +.emoji-rowboat_tone4 { background-position: -220px -740px; } +.emoji-rowboat_tone5 { background-position: -240px -740px; } +.emoji-rugby_football { background-position: -260px -740px; } +.emoji-runner { background-position: -280px -740px; } +.emoji-runner_tone1 { background-position: -300px -740px; } +.emoji-runner_tone2 { background-position: -320px -740px; } +.emoji-runner_tone3 { background-position: -340px -740px; } +.emoji-runner_tone4 { background-position: -360px -740px; } +.emoji-runner_tone5 { background-position: -380px -740px; } +.emoji-running_shirt_with_sash { background-position: -400px -740px; } +.emoji-sa { background-position: -420px -740px; } +.emoji-sagittarius { background-position: -440px -740px; } +.emoji-sailboat { background-position: -460px -740px; } +.emoji-sake { background-position: -480px -740px; } +.emoji-salad { background-position: -500px -740px; } +.emoji-sandal { background-position: -520px -740px; } +.emoji-santa { background-position: -540px -740px; } +.emoji-santa_tone1 { background-position: -560px -740px; } +.emoji-santa_tone2 { background-position: -580px -740px; } +.emoji-santa_tone3 { background-position: -600px -740px; } +.emoji-santa_tone4 { background-position: -620px -740px; } +.emoji-santa_tone5 { background-position: -640px -740px; } +.emoji-satellite { background-position: -660px -740px; } +.emoji-satellite_orbital { background-position: -680px -740px; } +.emoji-saxophone { background-position: -700px -740px; } +.emoji-scales { background-position: -720px -740px; } +.emoji-school { background-position: -740px -740px; } +.emoji-school_satchel { background-position: -760px 0; } +.emoji-scissors { background-position: -760px -20px; } +.emoji-scooter { background-position: -760px -40px; } +.emoji-scorpion { background-position: -760px -60px; } +.emoji-scorpius { background-position: -760px -80px; } +.emoji-scream { background-position: -760px -100px; } +.emoji-scream_cat { background-position: -760px -120px; } +.emoji-scroll { background-position: -760px -140px; } +.emoji-seat { background-position: -760px -160px; } +.emoji-second_place { background-position: -760px -180px; } +.emoji-secret { background-position: -760px -200px; } +.emoji-see_no_evil { background-position: -760px -220px; } +.emoji-seedling { background-position: -760px -240px; } +.emoji-selfie { background-position: -760px -260px; } +.emoji-selfie_tone1 { background-position: -760px -280px; } +.emoji-selfie_tone2 { background-position: -760px -300px; } +.emoji-selfie_tone3 { background-position: -760px -320px; } +.emoji-selfie_tone4 { background-position: -760px -340px; } +.emoji-selfie_tone5 { background-position: -760px -360px; } +.emoji-seven { background-position: -760px -380px; } +.emoji-shallow_pan_of_food { background-position: -760px -400px; } +.emoji-shamrock { background-position: -760px -420px; } +.emoji-shark { background-position: -760px -440px; } +.emoji-shaved_ice { background-position: -760px -460px; } +.emoji-sheep { background-position: -760px -480px; } +.emoji-shell { background-position: -760px -500px; } +.emoji-shield { background-position: -760px -520px; } +.emoji-shinto_shrine { background-position: -760px -540px; } +.emoji-ship { background-position: -760px -560px; } +.emoji-shirt { background-position: -760px -580px; } +.emoji-shopping_bags { background-position: -760px -600px; } +.emoji-shopping_cart { background-position: -760px -620px; } +.emoji-shower { background-position: -760px -640px; } +.emoji-shrimp { background-position: -760px -660px; } +.emoji-shrug { background-position: -760px -680px; } +.emoji-shrug_tone1 { background-position: -760px -700px; } +.emoji-shrug_tone2 { background-position: -760px -720px; } +.emoji-shrug_tone3 { background-position: -760px -740px; } +.emoji-shrug_tone4 { background-position: 0 -760px; } +.emoji-shrug_tone5 { background-position: -20px -760px; } +.emoji-signal_strength { background-position: -40px -760px; } +.emoji-six { background-position: -60px -760px; } +.emoji-six_pointed_star { background-position: -80px -760px; } +.emoji-ski { background-position: -100px -760px; } +.emoji-skier { background-position: -120px -760px; } +.emoji-skull { background-position: -140px -760px; } +.emoji-skull_crossbones { background-position: -160px -760px; } +.emoji-sleeping { background-position: -180px -760px; } +.emoji-sleeping_accommodation { background-position: -200px -760px; } +.emoji-sleepy { background-position: -220px -760px; } +.emoji-slight_frown { background-position: -240px -760px; } +.emoji-slight_smile { background-position: -260px -760px; } +.emoji-slot_machine { background-position: -280px -760px; } +.emoji-small_blue_diamond { background-position: -300px -760px; } +.emoji-small_orange_diamond { background-position: -320px -760px; } +.emoji-small_red_triangle { background-position: -340px -760px; } +.emoji-small_red_triangle_down { background-position: -360px -760px; } +.emoji-smile { background-position: -380px -760px; } +.emoji-smile_cat { background-position: -400px -760px; } +.emoji-smiley { background-position: -420px -760px; } +.emoji-smiley_cat { background-position: -440px -760px; } +.emoji-smiling_imp { background-position: -460px -760px; } +.emoji-smirk { background-position: -480px -760px; } +.emoji-smirk_cat { background-position: -500px -760px; } +.emoji-smoking { background-position: -520px -760px; } +.emoji-snail { background-position: -540px -760px; } +.emoji-snake { background-position: -560px -760px; } +.emoji-sneezing_face { background-position: -580px -760px; } +.emoji-snowboarder { background-position: -600px -760px; } +.emoji-snowflake { background-position: -620px -760px; } +.emoji-snowman { background-position: -640px -760px; } +.emoji-snowman2 { background-position: -660px -760px; } +.emoji-sob { background-position: -680px -760px; } +.emoji-soccer { background-position: -700px -760px; } +.emoji-soon { background-position: -720px -760px; } +.emoji-sos { background-position: -740px -760px; } +.emoji-sound { background-position: -760px -760px; } +.emoji-space_invader { background-position: -780px 0; } +.emoji-spades { background-position: -780px -20px; } +.emoji-spaghetti { background-position: -780px -40px; } +.emoji-sparkle { background-position: -780px -60px; } +.emoji-sparkler { background-position: -780px -80px; } +.emoji-sparkles { background-position: -780px -100px; } +.emoji-sparkling_heart { background-position: -780px -120px; } +.emoji-speak_no_evil { background-position: -780px -140px; } +.emoji-speaker { background-position: -780px -160px; } +.emoji-speaking_head { background-position: -780px -180px; } +.emoji-speech_balloon { background-position: -780px -200px; } +.emoji-speech_left { background-position: -780px -220px; } +.emoji-speedboat { background-position: -780px -240px; } +.emoji-spider { background-position: -780px -260px; } +.emoji-spider_web { background-position: -780px -280px; } +.emoji-spoon { background-position: -780px -300px; } +.emoji-spy { background-position: -780px -320px; } +.emoji-spy_tone1 { background-position: -780px -340px; } +.emoji-spy_tone2 { background-position: -780px -360px; } +.emoji-spy_tone3 { background-position: -780px -380px; } +.emoji-spy_tone4 { background-position: -780px -400px; } +.emoji-spy_tone5 { background-position: -780px -420px; } +.emoji-squid { background-position: -780px -440px; } +.emoji-stadium { background-position: -780px -460px; } +.emoji-star { background-position: -780px -480px; } +.emoji-star2 { background-position: -780px -500px; } +.emoji-star_and_crescent { background-position: -780px -520px; } +.emoji-star_of_david { background-position: -780px -540px; } +.emoji-stars { background-position: -780px -560px; } +.emoji-station { background-position: -780px -580px; } +.emoji-statue_of_liberty { background-position: -780px -600px; } +.emoji-steam_locomotive { background-position: -780px -620px; } +.emoji-stew { background-position: -780px -640px; } +.emoji-stop_button { background-position: -780px -660px; } +.emoji-stopwatch { background-position: -780px -680px; } +.emoji-straight_ruler { background-position: -780px -700px; } +.emoji-strawberry { background-position: -780px -720px; } +.emoji-stuck_out_tongue { background-position: -780px -740px; } +.emoji-stuck_out_tongue_closed_eyes { background-position: -780px -760px; } +.emoji-stuck_out_tongue_winking_eye { background-position: 0 -780px; } +.emoji-stuffed_flatbread { background-position: -20px -780px; } +.emoji-sun_with_face { background-position: -40px -780px; } +.emoji-sunflower { background-position: -60px -780px; } +.emoji-sunglasses { background-position: -80px -780px; } +.emoji-sunny { background-position: -100px -780px; } +.emoji-sunrise { background-position: -120px -780px; } +.emoji-sunrise_over_mountains { background-position: -140px -780px; } +.emoji-surfer { background-position: -160px -780px; } +.emoji-surfer_tone1 { background-position: -180px -780px; } +.emoji-surfer_tone2 { background-position: -200px -780px; } +.emoji-surfer_tone3 { background-position: -220px -780px; } +.emoji-surfer_tone4 { background-position: -240px -780px; } +.emoji-surfer_tone5 { background-position: -260px -780px; } +.emoji-sushi { background-position: -280px -780px; } +.emoji-suspension_railway { background-position: -300px -780px; } +.emoji-sweat { background-position: -320px -780px; } +.emoji-sweat_drops { background-position: -340px -780px; } +.emoji-sweat_smile { background-position: -360px -780px; } +.emoji-sweet_potato { background-position: -380px -780px; } +.emoji-swimmer { background-position: -400px -780px; } +.emoji-swimmer_tone1 { background-position: -420px -780px; } +.emoji-swimmer_tone2 { background-position: -440px -780px; } +.emoji-swimmer_tone3 { background-position: -460px -780px; } +.emoji-swimmer_tone4 { background-position: -480px -780px; } +.emoji-swimmer_tone5 { background-position: -500px -780px; } +.emoji-symbols { background-position: -520px -780px; } +.emoji-synagogue { background-position: -540px -780px; } +.emoji-syringe { background-position: -560px -780px; } +.emoji-taco { background-position: -580px -780px; } +.emoji-tada { background-position: -600px -780px; } +.emoji-tanabata_tree { background-position: -620px -780px; } +.emoji-tangerine { background-position: -640px -780px; } +.emoji-taurus { background-position: -660px -780px; } +.emoji-taxi { background-position: -680px -780px; } +.emoji-tea { background-position: -700px -780px; } +.emoji-telephone { background-position: -720px -780px; } +.emoji-telephone_receiver { background-position: -740px -780px; } +.emoji-telescope { background-position: -760px -780px; } +.emoji-ten { background-position: -780px -780px; } +.emoji-tennis { background-position: -800px 0; } +.emoji-tent { background-position: -800px -20px; } +.emoji-thermometer { background-position: -800px -40px; } +.emoji-thermometer_face { background-position: -800px -60px; } +.emoji-thinking { background-position: -800px -80px; } +.emoji-third_place { background-position: -800px -100px; } +.emoji-thought_balloon { background-position: -800px -120px; } +.emoji-three { background-position: -800px -140px; } +.emoji-thumbsdown { background-position: -800px -160px; } +.emoji-thumbsdown_tone1 { background-position: -800px -180px; } +.emoji-thumbsdown_tone2 { background-position: -800px -200px; } +.emoji-thumbsdown_tone3 { background-position: -800px -220px; } +.emoji-thumbsdown_tone4 { background-position: -800px -240px; } +.emoji-thumbsdown_tone5 { background-position: -800px -260px; } +.emoji-thumbsup { background-position: -800px -280px; } +.emoji-thumbsup_tone1 { background-position: -800px -300px; } +.emoji-thumbsup_tone2 { background-position: -800px -320px; } +.emoji-thumbsup_tone3 { background-position: -800px -340px; } +.emoji-thumbsup_tone4 { background-position: -800px -360px; } +.emoji-thumbsup_tone5 { background-position: -800px -380px; } +.emoji-thunder_cloud_rain { background-position: -800px -400px; } +.emoji-ticket { background-position: -800px -420px; } +.emoji-tickets { background-position: -800px -440px; } +.emoji-tiger { background-position: -800px -460px; } +.emoji-tiger2 { background-position: -800px -480px; } +.emoji-timer { background-position: -800px -500px; } +.emoji-tired_face { background-position: -800px -520px; } +.emoji-tm { background-position: -800px -540px; } +.emoji-toilet { background-position: -800px -560px; } +.emoji-tokyo_tower { background-position: -800px -580px; } +.emoji-tomato { background-position: -800px -600px; } +.emoji-tone1 { background-position: -800px -620px; } +.emoji-tone2 { background-position: -800px -640px; } +.emoji-tone3 { background-position: -800px -660px; } +.emoji-tone4 { background-position: -800px -680px; } +.emoji-tone5 { background-position: -800px -700px; } +.emoji-tongue { background-position: -800px -720px; } +.emoji-tools { background-position: -800px -740px; } +.emoji-top { background-position: -800px -760px; } +.emoji-tophat { background-position: -800px -780px; } +.emoji-track_next { background-position: 0 -800px; } +.emoji-track_previous { background-position: -20px -800px; } +.emoji-trackball { background-position: -40px -800px; } +.emoji-tractor { background-position: -60px -800px; } +.emoji-traffic_light { background-position: -80px -800px; } +.emoji-train { background-position: -100px -800px; } +.emoji-train2 { background-position: -120px -800px; } +.emoji-tram { background-position: -140px -800px; } +.emoji-triangular_flag_on_post { background-position: -160px -800px; } +.emoji-triangular_ruler { background-position: -180px -800px; } +.emoji-trident { background-position: -200px -800px; } +.emoji-triumph { background-position: -220px -800px; } +.emoji-trolleybus { background-position: -240px -800px; } +.emoji-trophy { background-position: -260px -800px; } +.emoji-tropical_drink { background-position: -280px -800px; } +.emoji-tropical_fish { background-position: -300px -800px; } +.emoji-truck { background-position: -320px -800px; } +.emoji-trumpet { background-position: -340px -800px; } +.emoji-tulip { background-position: -360px -800px; } +.emoji-tumbler_glass { background-position: -380px -800px; } +.emoji-turkey { background-position: -400px -800px; } +.emoji-turtle { background-position: -420px -800px; } +.emoji-tv { background-position: -440px -800px; } +.emoji-twisted_rightwards_arrows { background-position: -460px -800px; } +.emoji-two { background-position: -480px -800px; } +.emoji-two_hearts { background-position: -500px -800px; } +.emoji-two_men_holding_hands { background-position: -520px -800px; } +.emoji-two_women_holding_hands { background-position: -540px -800px; } +.emoji-u5272 { background-position: -560px -800px; } +.emoji-u5408 { background-position: -580px -800px; } +.emoji-u55b6 { background-position: -600px -800px; } +.emoji-u6307 { background-position: -620px -800px; } +.emoji-u6708 { background-position: -640px -800px; } +.emoji-u6709 { background-position: -660px -800px; } +.emoji-u6e80 { background-position: -680px -800px; } +.emoji-u7121 { background-position: -700px -800px; } +.emoji-u7533 { background-position: -720px -800px; } +.emoji-u7981 { background-position: -740px -800px; } +.emoji-u7a7a { background-position: -760px -800px; } +.emoji-umbrella { background-position: -780px -800px; } +.emoji-umbrella2 { background-position: -800px -800px; } +.emoji-unamused { background-position: -820px 0; } +.emoji-underage { background-position: -820px -20px; } +.emoji-unicorn { background-position: -820px -40px; } +.emoji-unlock { background-position: -820px -60px; } +.emoji-up { background-position: -820px -80px; } +.emoji-upside_down { background-position: -820px -100px; } +.emoji-urn { background-position: -820px -120px; } +.emoji-v { background-position: -820px -140px; } +.emoji-v_tone1 { background-position: -820px -160px; } +.emoji-v_tone2 { background-position: -820px -180px; } +.emoji-v_tone3 { background-position: -820px -200px; } +.emoji-v_tone4 { background-position: -820px -220px; } +.emoji-v_tone5 { background-position: -820px -240px; } +.emoji-vertical_traffic_light { background-position: -820px -260px; } +.emoji-vhs { background-position: -820px -280px; } +.emoji-vibration_mode { background-position: -820px -300px; } +.emoji-video_camera { background-position: -820px -320px; } +.emoji-video_game { background-position: -820px -340px; } +.emoji-violin { background-position: -820px -360px; } +.emoji-virgo { background-position: -820px -380px; } +.emoji-volcano { background-position: -820px -400px; } +.emoji-volleyball { background-position: -820px -420px; } +.emoji-vs { background-position: -820px -440px; } +.emoji-vulcan { background-position: -820px -460px; } +.emoji-vulcan_tone1 { background-position: -820px -480px; } +.emoji-vulcan_tone2 { background-position: -820px -500px; } +.emoji-vulcan_tone3 { background-position: -820px -520px; } +.emoji-vulcan_tone4 { background-position: -820px -540px; } +.emoji-vulcan_tone5 { background-position: -820px -560px; } +.emoji-walking { background-position: -820px -580px; } +.emoji-walking_tone1 { background-position: -820px -600px; } +.emoji-walking_tone2 { background-position: -820px -620px; } +.emoji-walking_tone3 { background-position: -820px -640px; } +.emoji-walking_tone4 { background-position: -820px -660px; } +.emoji-walking_tone5 { background-position: -820px -680px; } +.emoji-waning_crescent_moon { background-position: -820px -700px; } +.emoji-waning_gibbous_moon { background-position: -820px -720px; } +.emoji-warning { background-position: -820px -740px; } +.emoji-wastebasket { background-position: -820px -760px; } +.emoji-watch { background-position: -820px -780px; } +.emoji-water_buffalo { background-position: -820px -800px; } +.emoji-water_polo { background-position: 0 -820px; } +.emoji-water_polo_tone1 { background-position: -20px -820px; } +.emoji-water_polo_tone2 { background-position: -40px -820px; } +.emoji-water_polo_tone3 { background-position: -60px -820px; } +.emoji-water_polo_tone4 { background-position: -80px -820px; } +.emoji-water_polo_tone5 { background-position: -100px -820px; } +.emoji-watermelon { background-position: -120px -820px; } +.emoji-wave { background-position: -140px -820px; } +.emoji-wave_tone1 { background-position: -160px -820px; } +.emoji-wave_tone2 { background-position: -180px -820px; } +.emoji-wave_tone3 { background-position: -200px -820px; } +.emoji-wave_tone4 { background-position: -220px -820px; } +.emoji-wave_tone5 { background-position: -240px -820px; } +.emoji-wavy_dash { background-position: -260px -820px; } +.emoji-waxing_crescent_moon { background-position: -280px -820px; } +.emoji-waxing_gibbous_moon { background-position: -300px -820px; } +.emoji-wc { background-position: -320px -820px; } +.emoji-weary { background-position: -340px -820px; } +.emoji-wedding { background-position: -360px -820px; } +.emoji-whale { background-position: -380px -820px; } +.emoji-whale2 { background-position: -400px -820px; } +.emoji-wheel_of_dharma { background-position: -420px -820px; } +.emoji-wheelchair { background-position: -440px -820px; } +.emoji-white_check_mark { background-position: -460px -820px; } +.emoji-white_circle { background-position: -480px -820px; } +.emoji-white_flower { background-position: -500px -820px; } +.emoji-white_large_square { background-position: -520px -820px; } +.emoji-white_medium_small_square { background-position: -540px -820px; } +.emoji-white_medium_square { background-position: -560px -820px; } +.emoji-white_small_square { background-position: -580px -820px; } +.emoji-white_square_button { background-position: -600px -820px; } +.emoji-white_sun_cloud { background-position: -620px -820px; } +.emoji-white_sun_rain_cloud { background-position: -640px -820px; } +.emoji-white_sun_small_cloud { background-position: -660px -820px; } +.emoji-wilted_rose { background-position: -680px -820px; } +.emoji-wind_blowing_face { background-position: -700px -820px; } +.emoji-wind_chime { background-position: -720px -820px; } +.emoji-wine_glass { background-position: -740px -820px; } +.emoji-wink { background-position: -760px -820px; } +.emoji-wolf { background-position: -780px -820px; } +.emoji-woman { background-position: -800px -820px; } +.emoji-woman_tone1 { background-position: -820px -820px; } +.emoji-woman_tone2 { background-position: -840px 0; } +.emoji-woman_tone3 { background-position: -840px -20px; } +.emoji-woman_tone4 { background-position: -840px -40px; } +.emoji-woman_tone5 { background-position: -840px -60px; } +.emoji-womans_clothes { background-position: -840px -80px; } +.emoji-womans_hat { background-position: -840px -100px; } +.emoji-womens { background-position: -840px -120px; } +.emoji-worried { background-position: -840px -140px; } +.emoji-wrench { background-position: -840px -160px; } +.emoji-wrestlers { background-position: -840px -180px; } +.emoji-wrestlers_tone1 { background-position: -840px -200px; } +.emoji-wrestlers_tone2 { background-position: -840px -220px; } +.emoji-wrestlers_tone3 { background-position: -840px -240px; } +.emoji-wrestlers_tone4 { background-position: -840px -260px; } +.emoji-wrestlers_tone5 { background-position: -840px -280px; } +.emoji-writing_hand { background-position: -840px -300px; } +.emoji-writing_hand_tone1 { background-position: -840px -320px; } +.emoji-writing_hand_tone2 { background-position: -840px -340px; } +.emoji-writing_hand_tone3 { background-position: -840px -360px; } +.emoji-writing_hand_tone4 { background-position: -840px -380px; } +.emoji-writing_hand_tone5 { background-position: -840px -400px; } +.emoji-x { background-position: -840px -420px; } +.emoji-yellow_heart { background-position: -840px -440px; } +.emoji-yen { background-position: -840px -460px; } +.emoji-yin_yang { background-position: -840px -480px; } +.emoji-yum { background-position: -840px -500px; } +.emoji-zap { background-position: -840px -520px; } +.emoji-zero { background-position: -840px -540px; } +.emoji-zipper_mouth { background-position: -840px -560px; } +.emoji-100 { background-position: -840px -580px; } + +.emoji-icon { + background-image: image-url('emoji.png'); + background-repeat: no-repeat; + color: transparent; + text-indent: -99em; + height: 20px; + width: 20px; + + @media only screen and (-webkit-min-device-pixel-ratio: 2), + only screen and (min--moz-device-pixel-ratio: 2), + only screen and (-o-min-device-pixel-ratio: 2/1), + only screen and (min-device-pixel-ratio: 2), + only screen and (min-resolution: 192dpi), + only screen and (min-resolution: 2dppx) { + background-image: image-url('emoji@2x.png'); + background-size: 860px 840px; + } +} diff --git a/app/assets/stylesheets/framework/gitlab-theme.scss b/app/assets/stylesheets/framework/gitlab-theme.scss deleted file mode 100644 index db36e27fa74..00000000000 --- a/app/assets/stylesheets/framework/gitlab-theme.scss +++ /dev/null @@ -1,274 +0,0 @@ -/** - * Styles the GitLab application with a specific color theme - */ - -@mixin gitlab-theme($color-100, $color-200, $color-500, $color-700, $color-800, $color-900, $color-alternate) { - // Header - - .navbar-gitlab { - background-color: $color-900; - - .navbar-collapse { - color: $color-200; - } - - .container-fluid { - .navbar-toggle { - border-left: 1px solid lighten($color-700, 10%); - } - } - - .navbar-sub-nav, - .navbar-nav { - > li { - > a:hover, - > a:focus { - background-color: rgba($color-200, .2); - } - - &.active > a, - &.dropdown.open > a { - color: $color-900; - background-color: $color-alternate; - } - - &.line-separator { - border-left: 1px solid rgba($color-200, .2); - } - } - } - - .navbar-sub-nav { - color: $color-200; - } - - .nav { - > li { - color: $color-200; - - > a { - &.header-user-dropdown-toggle { - .header-user-avatar { - border-color: $color-200; - } - } - - &:hover, - &:focus { - @media (min-width: $screen-sm-min) { - background-color: rgba($color-200, .2); - } - - svg { - fill: currentColor; - } - } - } - - &.active > a, - &.dropdown.open > a { - color: $color-900; - background-color: $color-alternate; - - &:hover { - svg { - fill: $color-900; - } - } - } - - .impersonated-user, - .impersonated-user:hover { - svg { - fill: $color-900; - } - } - } - } - } - - .navbar .title { - > a { - &:hover, - &:focus { - background-color: rgba($color-200, .2); - } - } - } - - .search { - form { - background-color: rgba($color-200, .2); - - &:hover { - background-color: rgba($color-200, .3); - } - } - - .location-badge { - color: $color-100; - background-color: rgba($color-200, .1); - border-right: 1px solid $color-800; - } - - .search-input::placeholder { - color: rgba($color-200, .8); - } - - .search-input-wrap { - .search-icon, - .clear-icon { - fill: rgba($color-200, .8); - } - } - - &.search-active { - form { - background-color: $white-light; - } - - .location-badge { - color: $gl-text-color; - } - - .search-input-wrap { - .search-icon { - fill: rgba($color-200, .8); - } - } - } - } - - .btn-sign-in { - background-color: $color-100; - color: $color-900; - } - - - // Sidebar - .nav-sidebar li.active { - box-shadow: inset 4px 0 0 $color-700; - - > a { - color: $color-800; - } - - svg { - fill: $color-800; - } - } - - .sidebar-top-level-items > li.active .badge { - color: $color-800; - } - - .nav-links li.active a { - border-bottom-color: $color-500; - - .badge { - font-weight: $gl-font-weight-bold; - } - } -} - - -body { - &.ui_indigo { - @include gitlab-theme($indigo-100, $indigo-200, $indigo-500, $indigo-700, $indigo-800, $indigo-900, $white-light); - } - - &.ui_dark { - @include gitlab-theme($theme-gray-100, $theme-gray-200, $theme-gray-500, $theme-gray-700, $theme-gray-800, $theme-gray-900, $white-light); - } - - &.ui_blue { - @include gitlab-theme($theme-blue-100, $theme-blue-200, $theme-blue-500, $theme-blue-700, $theme-blue-800, $theme-blue-900, $white-light); - } - - &.ui_green { - @include gitlab-theme($theme-green-100, $theme-green-200, $theme-green-500, $theme-green-700, $theme-green-800, $theme-green-900, $white-light); - } - - &.ui_light { - @include gitlab-theme($theme-gray-900, $theme-gray-700, $theme-gray-800, $theme-gray-700, $theme-gray-700, $theme-gray-100, $theme-gray-700); - - .navbar-gitlab { - background-color: $theme-gray-100; - box-shadow: 0 1px 0 0 $border-color; - - .logo-text svg { - fill: $theme-gray-900; - } - - .navbar-sub-nav, - .navbar-nav { - > li { - > a:hover, - > a:focus { - color: $theme-gray-900; - } - - &.active > a, - &.active > a:hover { - color: $white-light; - } - } - } - - .container-fluid { - .navbar-toggle, - .navbar-toggle:hover { - color: $theme-gray-700; - border-left: 1px solid $theme-gray-200; - } - } - } - - .search { - form { - background-color: $white-light; - box-shadow: inset 0 0 0 1px $border-color; - - &:hover { - background-color: $white-light; - box-shadow: inset 0 0 0 1px $blue-200; - - .location-badge { - box-shadow: inset 0 0 0 1px $blue-200; - } - } - } - - .search-input-wrap { - .search-icon { - fill: $theme-gray-200; - } - - .search-input { - color: $gl-text-color; - } - } - - .location-badge { - color: $theme-gray-700; - box-shadow: inset 0 0 0 1px $border-color; - background-color: $nav-badge-bg; - border-right: 0; - } - } - - .nav-sidebar li.active { - > a { - color: $theme-gray-900; - } - - svg { - fill: $theme-gray-900; - } - } - - .sidebar-top-level-items > li.active .badge { - color: $theme-gray-900; - } - } -} diff --git a/app/assets/stylesheets/framework/gitlab_theme.scss b/app/assets/stylesheets/framework/gitlab_theme.scss new file mode 100644 index 00000000000..db36e27fa74 --- /dev/null +++ b/app/assets/stylesheets/framework/gitlab_theme.scss @@ -0,0 +1,274 @@ +/** + * Styles the GitLab application with a specific color theme + */ + +@mixin gitlab-theme($color-100, $color-200, $color-500, $color-700, $color-800, $color-900, $color-alternate) { + // Header + + .navbar-gitlab { + background-color: $color-900; + + .navbar-collapse { + color: $color-200; + } + + .container-fluid { + .navbar-toggle { + border-left: 1px solid lighten($color-700, 10%); + } + } + + .navbar-sub-nav, + .navbar-nav { + > li { + > a:hover, + > a:focus { + background-color: rgba($color-200, .2); + } + + &.active > a, + &.dropdown.open > a { + color: $color-900; + background-color: $color-alternate; + } + + &.line-separator { + border-left: 1px solid rgba($color-200, .2); + } + } + } + + .navbar-sub-nav { + color: $color-200; + } + + .nav { + > li { + color: $color-200; + + > a { + &.header-user-dropdown-toggle { + .header-user-avatar { + border-color: $color-200; + } + } + + &:hover, + &:focus { + @media (min-width: $screen-sm-min) { + background-color: rgba($color-200, .2); + } + + svg { + fill: currentColor; + } + } + } + + &.active > a, + &.dropdown.open > a { + color: $color-900; + background-color: $color-alternate; + + &:hover { + svg { + fill: $color-900; + } + } + } + + .impersonated-user, + .impersonated-user:hover { + svg { + fill: $color-900; + } + } + } + } + } + + .navbar .title { + > a { + &:hover, + &:focus { + background-color: rgba($color-200, .2); + } + } + } + + .search { + form { + background-color: rgba($color-200, .2); + + &:hover { + background-color: rgba($color-200, .3); + } + } + + .location-badge { + color: $color-100; + background-color: rgba($color-200, .1); + border-right: 1px solid $color-800; + } + + .search-input::placeholder { + color: rgba($color-200, .8); + } + + .search-input-wrap { + .search-icon, + .clear-icon { + fill: rgba($color-200, .8); + } + } + + &.search-active { + form { + background-color: $white-light; + } + + .location-badge { + color: $gl-text-color; + } + + .search-input-wrap { + .search-icon { + fill: rgba($color-200, .8); + } + } + } + } + + .btn-sign-in { + background-color: $color-100; + color: $color-900; + } + + + // Sidebar + .nav-sidebar li.active { + box-shadow: inset 4px 0 0 $color-700; + + > a { + color: $color-800; + } + + svg { + fill: $color-800; + } + } + + .sidebar-top-level-items > li.active .badge { + color: $color-800; + } + + .nav-links li.active a { + border-bottom-color: $color-500; + + .badge { + font-weight: $gl-font-weight-bold; + } + } +} + + +body { + &.ui_indigo { + @include gitlab-theme($indigo-100, $indigo-200, $indigo-500, $indigo-700, $indigo-800, $indigo-900, $white-light); + } + + &.ui_dark { + @include gitlab-theme($theme-gray-100, $theme-gray-200, $theme-gray-500, $theme-gray-700, $theme-gray-800, $theme-gray-900, $white-light); + } + + &.ui_blue { + @include gitlab-theme($theme-blue-100, $theme-blue-200, $theme-blue-500, $theme-blue-700, $theme-blue-800, $theme-blue-900, $white-light); + } + + &.ui_green { + @include gitlab-theme($theme-green-100, $theme-green-200, $theme-green-500, $theme-green-700, $theme-green-800, $theme-green-900, $white-light); + } + + &.ui_light { + @include gitlab-theme($theme-gray-900, $theme-gray-700, $theme-gray-800, $theme-gray-700, $theme-gray-700, $theme-gray-100, $theme-gray-700); + + .navbar-gitlab { + background-color: $theme-gray-100; + box-shadow: 0 1px 0 0 $border-color; + + .logo-text svg { + fill: $theme-gray-900; + } + + .navbar-sub-nav, + .navbar-nav { + > li { + > a:hover, + > a:focus { + color: $theme-gray-900; + } + + &.active > a, + &.active > a:hover { + color: $white-light; + } + } + } + + .container-fluid { + .navbar-toggle, + .navbar-toggle:hover { + color: $theme-gray-700; + border-left: 1px solid $theme-gray-200; + } + } + } + + .search { + form { + background-color: $white-light; + box-shadow: inset 0 0 0 1px $border-color; + + &:hover { + background-color: $white-light; + box-shadow: inset 0 0 0 1px $blue-200; + + .location-badge { + box-shadow: inset 0 0 0 1px $blue-200; + } + } + } + + .search-input-wrap { + .search-icon { + fill: $theme-gray-200; + } + + .search-input { + color: $gl-text-color; + } + } + + .location-badge { + color: $theme-gray-700; + box-shadow: inset 0 0 0 1px $border-color; + background-color: $nav-badge-bg; + border-right: 0; + } + } + + .nav-sidebar li.active { + > a { + color: $theme-gray-900; + } + + svg { + fill: $theme-gray-900; + } + } + + .sidebar-top-level-items > li.active .badge { + color: $theme-gray-900; + } + } +} diff --git a/app/assets/stylesheets/framework/page-header.scss b/app/assets/stylesheets/framework/page-header.scss deleted file mode 100644 index 0c879f40930..00000000000 --- a/app/assets/stylesheets/framework/page-header.scss +++ /dev/null @@ -1,66 +0,0 @@ -.page-content-header { - line-height: 34px; - padding: 10px 0; - margin-bottom: 0; - - @media (min-width: $screen-sm-min) { - display: flex; - align-items: center; - - .header-main-content { - flex: 1; - } - } - - .header-action-buttons { - i { - color: $gl-text-color-secondary; - font-size: 13px; - margin-right: 3px; - } - - @media (max-width: $screen-xs-max) { - .btn { - width: 100%; - margin-top: 10px; - } - - .dropdown { - width: 100%; - } - } - } - - .avatar { - @extend .avatar-inline; - margin-left: 0; - - @media (min-width: $screen-sm-min) { - margin-left: 4px; - } - } - - .commit-committer-link, - .commit-author-link { - color: $gl-text-color; - font-weight: $gl-font-weight-bold; - } - - .commit-info { - &.branches { - margin-left: 8px; - } - } - - .ci-status-link { - svg { - position: relative; - top: 2px; - margin: 0 2px 0 3px; - } - } - - .ci-status { - margin-right: 10px; - } -} diff --git a/app/assets/stylesheets/framework/page_header.scss b/app/assets/stylesheets/framework/page_header.scss new file mode 100644 index 00000000000..0c879f40930 --- /dev/null +++ b/app/assets/stylesheets/framework/page_header.scss @@ -0,0 +1,66 @@ +.page-content-header { + line-height: 34px; + padding: 10px 0; + margin-bottom: 0; + + @media (min-width: $screen-sm-min) { + display: flex; + align-items: center; + + .header-main-content { + flex: 1; + } + } + + .header-action-buttons { + i { + color: $gl-text-color-secondary; + font-size: 13px; + margin-right: 3px; + } + + @media (max-width: $screen-xs-max) { + .btn { + width: 100%; + margin-top: 10px; + } + + .dropdown { + width: 100%; + } + } + } + + .avatar { + @extend .avatar-inline; + margin-left: 0; + + @media (min-width: $screen-sm-min) { + margin-left: 4px; + } + } + + .commit-committer-link, + .commit-author-link { + color: $gl-text-color; + font-weight: $gl-font-weight-bold; + } + + .commit-info { + &.branches { + margin-left: 8px; + } + } + + .ci-status-link { + svg { + position: relative; + top: 2px; + margin: 0 2px 0 3px; + } + } + + .ci-status { + margin-right: 10px; + } +} diff --git a/app/assets/stylesheets/framework/secondary-navigation-elements.scss b/app/assets/stylesheets/framework/secondary-navigation-elements.scss deleted file mode 100644 index 17c31d6b184..00000000000 --- a/app/assets/stylesheets/framework/secondary-navigation-elements.scss +++ /dev/null @@ -1,379 +0,0 @@ -// For tabbed navigation links, scrolling tabs, etc. For all top/main navigation, -// please check nav.scss -.nav-links { - display: flex; - padding: 0; - margin: 0; - list-style: none; - height: auto; - border-bottom: 1px solid $border-color; - - li { - display: flex; - - a { - padding: $gl-btn-padding; - padding-bottom: 11px; - font-size: 14px; - line-height: 28px; - color: $gl-text-color-secondary; - border-bottom: 2px solid transparent; - white-space: nowrap; - - &:hover, - &:active, - &:focus { - text-decoration: none; - color: $black; - border-bottom: 2px solid $gray-darkest; - - .badge { - color: $black; - } - } - } - - &.active a { - color: $black; - font-weight: $gl-font-weight-bold; - - .badge { - color: $black; - } - } - } -} - -.top-area { - @include clearfix; - border-bottom: 1px solid $border-color; - - .nav-text { - padding-top: 16px; - padding-bottom: 11px; - display: inline-block; - line-height: 28px; - white-space: normal; - - /* Small devices (phones, tablets, 768px and lower) */ - @media (max-width: $screen-xs-max) { - width: 100%; - } - } - - .nav-links { - margin-bottom: 0; - border-bottom: 0; - float: left; - - &.wide { - width: 100%; - display: block; - } - - &.scrolling-tabs { - float: left; - } - - li a { - padding: 16px 15px 11px; - } - - /* Small devices (phones, tablets, 768px and lower) */ - @media (max-width: $screen-xs-max) { - width: 100%; - - &.mobile-separator { - border-bottom: 1px solid $border-color; - } - } - } - - .nav-controls { - display: inline-block; - float: right; - text-align: right; - padding: 11px 0; - margin-bottom: 0; - - > .btn, - > .btn-container, - > .dropdown, - > input, - > form { - margin-right: $gl-padding-top; - display: inline-block; - vertical-align: top; - - &:last-child { - margin-right: 0; - float: right; - } - } - - > .btn-grouped { - float: none; - } - - .icon-label { - display: none; - } - - input { - display: inline-block; - position: relative; - - /* Medium devices (desktops, 992px and up) */ - @media (min-width: $screen-md-min) { width: 200px; } - - /* Large devices (large desktops, 1200px and up) */ - @media (min-width: $screen-lg-min) { width: 250px; } - - &.input-short { - /* Medium devices (desktops, 992px and up) */ - @media (min-width: $screen-md-min) { width: 170px; } - - /* Large devices (large desktops, 1200px and up) */ - @media (min-width: $screen-lg-min) { width: 210px; } - } - } - - @media (max-width: $screen-xs-max) { - padding-bottom: 0; - width: 100%; - - .btn, - form, - .dropdown, - .dropdown-toggle, - .dropdown-menu-toggle, - .form-control { - margin: 0 0 10px; - display: block; - width: 100%; - } - - form { - display: block; - height: auto; - margin-bottom: 14px; - - input { - width: 100%; - margin: 0 0 10px; - } - } - - .input-short { - width: 100%; - } - - .icon-label { - display: inline-block; - } - - .project-item-select-holder { - margin: 0; - width: 100%; - } - } - } - - &.adjust { - .nav-text, - .nav-controls { - width: auto; - - @media (max-width: $screen-xs-max) { - width: 100%; - } - } - } - - &.multi-line { - .nav-text { - line-height: 20px; - } - - .nav-controls { - padding: 17px 0; - } - } - - pre { - width: 100%; - } - - @media (max-width: $screen-xs-max) { - flex-flow: row wrap; - - .nav-controls { - $controls-margin: $btn-xs-side-margin - 2px; - flex: 0 0 100%; - - &.controls-flex { - display: flex; - flex-flow: row wrap; - align-items: center; - justify-content: center; - padding: 0 0 $gl-padding-top; - } - - .controls-item, - .controls-item-full, - .controls-item:last-child { - flex: 1 1 35%; - display: block; - width: 100%; - margin: $controls-margin; - - .btn, - .dropdown { - margin: 0; - } - } - - .controls-item-full { - flex: 1 1 100%; - } - } - } -} - -.scrolling-tabs-container { - position: relative; - - .merge-request-tabs-container & { - overflow: hidden; - } - - .nav-links { - @include scrolling-links(); - } - - .fade-right { - @include fade(left, $gray-light); - right: -5px; - - .fa { - right: -7px; - } - } - - .fade-left { - @include fade(right, $gray-light); - left: -5px; - text-align: center; - - .fa { - left: -7px; - } - } -} - -.inner-page-scroll-tabs { - position: relative; - - .fade-right { - @include fade(left, $white-light); - right: 0; - text-align: right; - - .fa { - right: 5px; - } - } - - .fade-left { - @include fade(right, $white-light); - left: 0; - text-align: left; - - .fa { - left: 5px; - } - } - - .fade-right, - .fade-left { - top: 16px; - bottom: auto; - } - - &.is-smaller { - .fade-right, - .fade-left { - top: 11px; - } - } -} - -.nav-block { - position: relative; - - .nav-links { - @include scrolling-links(); - - .fade-right { - @include fade(left, $white-light); - right: -5px; - - .fa { - right: -7px; - } - } - - .fade-left { - @include fade(right, $white-light); - left: -5px; - - .fa { - left: -7px; - } - } - } - - &.activities { - border-bottom: 1px solid $border-color; - - .nav-links { - border-bottom: 0; - } - } -} - -.project-item-select-holder.btn-group { - display: flex; - overflow: hidden; - float: right; - - .new-project-item-link { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } - - .new-project-item-select-button { - width: 32px; - } -} - -.empty-state .project-item-select-holder.btn-group { - float: none; - display: inline-block; - - .btn { - // overrides styles applied to plain `.empty-state .btn` - margin: 10px 0; - max-width: 300px; - width: auto; - - @media(max-width: $screen-xs-max) { - max-width: 250px; - } - } -} - -.new-project-item-select-button .fa-caret-down { - margin-left: 2px; -} diff --git a/app/assets/stylesheets/framework/secondary_navigation_elements.scss b/app/assets/stylesheets/framework/secondary_navigation_elements.scss new file mode 100644 index 00000000000..17c31d6b184 --- /dev/null +++ b/app/assets/stylesheets/framework/secondary_navigation_elements.scss @@ -0,0 +1,379 @@ +// For tabbed navigation links, scrolling tabs, etc. For all top/main navigation, +// please check nav.scss +.nav-links { + display: flex; + padding: 0; + margin: 0; + list-style: none; + height: auto; + border-bottom: 1px solid $border-color; + + li { + display: flex; + + a { + padding: $gl-btn-padding; + padding-bottom: 11px; + font-size: 14px; + line-height: 28px; + color: $gl-text-color-secondary; + border-bottom: 2px solid transparent; + white-space: nowrap; + + &:hover, + &:active, + &:focus { + text-decoration: none; + color: $black; + border-bottom: 2px solid $gray-darkest; + + .badge { + color: $black; + } + } + } + + &.active a { + color: $black; + font-weight: $gl-font-weight-bold; + + .badge { + color: $black; + } + } + } +} + +.top-area { + @include clearfix; + border-bottom: 1px solid $border-color; + + .nav-text { + padding-top: 16px; + padding-bottom: 11px; + display: inline-block; + line-height: 28px; + white-space: normal; + + /* Small devices (phones, tablets, 768px and lower) */ + @media (max-width: $screen-xs-max) { + width: 100%; + } + } + + .nav-links { + margin-bottom: 0; + border-bottom: 0; + float: left; + + &.wide { + width: 100%; + display: block; + } + + &.scrolling-tabs { + float: left; + } + + li a { + padding: 16px 15px 11px; + } + + /* Small devices (phones, tablets, 768px and lower) */ + @media (max-width: $screen-xs-max) { + width: 100%; + + &.mobile-separator { + border-bottom: 1px solid $border-color; + } + } + } + + .nav-controls { + display: inline-block; + float: right; + text-align: right; + padding: 11px 0; + margin-bottom: 0; + + > .btn, + > .btn-container, + > .dropdown, + > input, + > form { + margin-right: $gl-padding-top; + display: inline-block; + vertical-align: top; + + &:last-child { + margin-right: 0; + float: right; + } + } + + > .btn-grouped { + float: none; + } + + .icon-label { + display: none; + } + + input { + display: inline-block; + position: relative; + + /* Medium devices (desktops, 992px and up) */ + @media (min-width: $screen-md-min) { width: 200px; } + + /* Large devices (large desktops, 1200px and up) */ + @media (min-width: $screen-lg-min) { width: 250px; } + + &.input-short { + /* Medium devices (desktops, 992px and up) */ + @media (min-width: $screen-md-min) { width: 170px; } + + /* Large devices (large desktops, 1200px and up) */ + @media (min-width: $screen-lg-min) { width: 210px; } + } + } + + @media (max-width: $screen-xs-max) { + padding-bottom: 0; + width: 100%; + + .btn, + form, + .dropdown, + .dropdown-toggle, + .dropdown-menu-toggle, + .form-control { + margin: 0 0 10px; + display: block; + width: 100%; + } + + form { + display: block; + height: auto; + margin-bottom: 14px; + + input { + width: 100%; + margin: 0 0 10px; + } + } + + .input-short { + width: 100%; + } + + .icon-label { + display: inline-block; + } + + .project-item-select-holder { + margin: 0; + width: 100%; + } + } + } + + &.adjust { + .nav-text, + .nav-controls { + width: auto; + + @media (max-width: $screen-xs-max) { + width: 100%; + } + } + } + + &.multi-line { + .nav-text { + line-height: 20px; + } + + .nav-controls { + padding: 17px 0; + } + } + + pre { + width: 100%; + } + + @media (max-width: $screen-xs-max) { + flex-flow: row wrap; + + .nav-controls { + $controls-margin: $btn-xs-side-margin - 2px; + flex: 0 0 100%; + + &.controls-flex { + display: flex; + flex-flow: row wrap; + align-items: center; + justify-content: center; + padding: 0 0 $gl-padding-top; + } + + .controls-item, + .controls-item-full, + .controls-item:last-child { + flex: 1 1 35%; + display: block; + width: 100%; + margin: $controls-margin; + + .btn, + .dropdown { + margin: 0; + } + } + + .controls-item-full { + flex: 1 1 100%; + } + } + } +} + +.scrolling-tabs-container { + position: relative; + + .merge-request-tabs-container & { + overflow: hidden; + } + + .nav-links { + @include scrolling-links(); + } + + .fade-right { + @include fade(left, $gray-light); + right: -5px; + + .fa { + right: -7px; + } + } + + .fade-left { + @include fade(right, $gray-light); + left: -5px; + text-align: center; + + .fa { + left: -7px; + } + } +} + +.inner-page-scroll-tabs { + position: relative; + + .fade-right { + @include fade(left, $white-light); + right: 0; + text-align: right; + + .fa { + right: 5px; + } + } + + .fade-left { + @include fade(right, $white-light); + left: 0; + text-align: left; + + .fa { + left: 5px; + } + } + + .fade-right, + .fade-left { + top: 16px; + bottom: auto; + } + + &.is-smaller { + .fade-right, + .fade-left { + top: 11px; + } + } +} + +.nav-block { + position: relative; + + .nav-links { + @include scrolling-links(); + + .fade-right { + @include fade(left, $white-light); + right: -5px; + + .fa { + right: -7px; + } + } + + .fade-left { + @include fade(right, $white-light); + left: -5px; + + .fa { + left: -7px; + } + } + } + + &.activities { + border-bottom: 1px solid $border-color; + + .nav-links { + border-bottom: 0; + } + } +} + +.project-item-select-holder.btn-group { + display: flex; + overflow: hidden; + float: right; + + .new-project-item-link { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .new-project-item-select-button { + width: 32px; + } +} + +.empty-state .project-item-select-holder.btn-group { + float: none; + display: inline-block; + + .btn { + // overrides styles applied to plain `.empty-state .btn` + margin: 10px 0; + max-width: 300px; + width: auto; + + @media(max-width: $screen-xs-max) { + max-width: 250px; + } + } +} + +.new-project-item-select-button .fa-caret-down { + margin-left: 2px; +} diff --git a/app/assets/stylesheets/framework/stacked-progress-bar.scss b/app/assets/stylesheets/framework/stacked-progress-bar.scss deleted file mode 100644 index 4869cda73e5..00000000000 --- a/app/assets/stylesheets/framework/stacked-progress-bar.scss +++ /dev/null @@ -1,54 +0,0 @@ -.stacked-progress-bar { - display: flex; - height: 16px; - border-radius: 10px; - overflow: hidden; - background-color: $theme-gray-100; - - .status-unavailable, - .status-green, - .status-neutral, - .status-red, { - height: 100%; - min-width: 25px; - padding: 0 5px; - font-size: $tooltip-font-size; - font-weight: normal; - color: $white-light; - line-height: 16px; - - &:hover { - cursor: pointer; - } - } - - .status-unavailable { - padding: 0 10px; - color: $theme-gray-700; - } - - .status-green { - background-color: $green-500; - - &:hover { - background-color: $green-600; - } - } - - .status-neutral { - background-color: $theme-gray-200; - color: $gl-gray-dark; - - &:hover { - background-color: $theme-gray-300; - } - } - - .status-red { - background-color: $red-500; - - &:hover { - background-color: $red-600; - } - } -} diff --git a/app/assets/stylesheets/framework/stacked_progress_bar.scss b/app/assets/stylesheets/framework/stacked_progress_bar.scss new file mode 100644 index 00000000000..4869cda73e5 --- /dev/null +++ b/app/assets/stylesheets/framework/stacked_progress_bar.scss @@ -0,0 +1,54 @@ +.stacked-progress-bar { + display: flex; + height: 16px; + border-radius: 10px; + overflow: hidden; + background-color: $theme-gray-100; + + .status-unavailable, + .status-green, + .status-neutral, + .status-red, { + height: 100%; + min-width: 25px; + padding: 0 5px; + font-size: $tooltip-font-size; + font-weight: normal; + color: $white-light; + line-height: 16px; + + &:hover { + cursor: pointer; + } + } + + .status-unavailable { + padding: 0 10px; + color: $theme-gray-700; + } + + .status-green { + background-color: $green-500; + + &:hover { + background-color: $green-600; + } + } + + .status-neutral { + background-color: $theme-gray-200; + color: $gl-gray-dark; + + &:hover { + background-color: $theme-gray-300; + } + } + + .status-red { + background-color: $red-500; + + &:hover { + background-color: $red-600; + } + } +} diff --git a/lib/tasks/gemojione.rake b/lib/tasks/gemojione.rake index c2d3a6b6950..c6942d22926 100644 --- a/lib/tasks/gemojione.rake +++ b/lib/tasks/gemojione.rake @@ -115,7 +115,7 @@ namespace :gemojione do end end - style_path = Rails.root.join(*%w(app assets stylesheets framework emoji-sprites.scss)) + style_path = Rails.root.join(*%w(app assets stylesheets framework emoji_sprites.scss)) # Combine the resized assets into a packed sprite and re-generate the SCSS SpriteFactory.cssurl = "image-url('$IMAGE')" -- cgit v1.2.1 From da64e97e0c84f0e3354126bc427c34f7a0924d52 Mon Sep 17 00:00:00 2001 From: Dylan Griffith Date: Fri, 9 Feb 2018 16:44:30 +1100 Subject: Make GITLAB_FEATURES in build_spec compatible with EE Right now this fails in EE since the EE codebase defaults to having a starter license which means there are features in this value. This seems to be incompatible with the statement that tests should behave the same in CE as EE but I think that since there is a before on all EE specs creating a starter license it unfortunately does not behave that way. This is needed for #40994 and fixes the failing specs in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/4393 --- spec/models/ci/build_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 9e159c3f1fe..d1952061498 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1413,7 +1413,7 @@ describe Ci::Build do [ { key: 'CI', value: 'true', public: true }, { key: 'GITLAB_CI', value: 'true', public: true }, - { key: 'GITLAB_FEATURES', value: '', public: true }, + { key: 'GITLAB_FEATURES', value: project.namespace.features.join(','), public: true }, { key: 'CI_SERVER_NAME', value: 'GitLab', public: true }, { key: 'CI_SERVER_VERSION', value: Gitlab::VERSION, public: true }, { key: 'CI_SERVER_REVISION', value: Gitlab::REVISION, public: true }, -- cgit v1.2.1 From 589f6b1907f1492396e02d12964984e0ed273a00 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 7 Feb 2018 15:54:23 -0800 Subject: Set initial password for instance in LDAP QA test For a new instance, the root password needs to be set, regardless of whether LDAP is enabled. --- qa/qa/page/main/login.rb | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index 0d1ffd9694a..fd49b27cb1a 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -31,22 +31,29 @@ module QA end end + def set_initial_password_if_present + if page.has_content?('Change your password') + fill_in :user_password, with: Runtime::User.password + fill_in :user_password_confirmation, with: Runtime::User.password + click_button 'Change your password' + end + end + def sign_in_using_ldap_credentials - click_link 'LDAP' + using_wait_time 0 do + set_initial_password_if_present - fill_in :username, with: Runtime::User.name - fill_in :password, with: Runtime::User.password + click_link 'LDAP' - click_button 'Sign in' + fill_in :username, with: Runtime::User.name + fill_in :password, with: Runtime::User.password + click_button 'Sign in' + end end def sign_in_using_credentials using_wait_time 0 do - if page.has_content?('Change your password') - fill_in :user_password, with: Runtime::User.password - fill_in :user_password_confirmation, with: Runtime::User.password - click_button 'Change your password' - end + set_initial_password_if_present click_link 'Standard' if page.has_content?('LDAP') -- cgit v1.2.1 From 5f62a935c3522517bffb6f4e0f48271dd81a9f39 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 9 Feb 2018 17:25:43 +0800 Subject: Move all ENV to Runtime::Env --- qa/qa/runtime/env.rb | 12 ++++++++++++ qa/qa/runtime/namespace.rb | 2 +- qa/qa/runtime/user.rb | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 56944e8b641..115d5ee58d1 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -16,6 +16,18 @@ module QA def personal_access_token ENV['PERSONAL_ACCESS_TOKEN'] end + + def user_username + ENV['GITLAB_USERNAME'] + end + + def user_password + ENV['GITLAB_PASSWORD'] + end + + def sandbox_name + ENV['GITLAB_SANDBOX_NAME'] + end end end end diff --git a/qa/qa/runtime/namespace.rb b/qa/qa/runtime/namespace.rb index 2ff5686c78d..8d05b387416 100644 --- a/qa/qa/runtime/namespace.rb +++ b/qa/qa/runtime/namespace.rb @@ -16,7 +16,7 @@ module QA end def sandbox_name - ENV['GITLAB_SANDBOX_NAME'] || 'gitlab-qa-sandbox' + Runtime::Env.sandbox_name || 'gitlab-qa-sandbox' end end end diff --git a/qa/qa/runtime/user.rb b/qa/qa/runtime/user.rb index 60027c89ab1..6b377f6b287 100644 --- a/qa/qa/runtime/user.rb +++ b/qa/qa/runtime/user.rb @@ -4,11 +4,11 @@ module QA extend self def name - ENV['GITLAB_USERNAME'] || 'root' + Runtime::Env.user_username || 'root' end def password - ENV['GITLAB_PASSWORD'] || '5iveL!fe' + Runtime::Env.user_password || '5iveL!fe' end end end -- cgit v1.2.1 From c5a3dfe1a67184fe9fc215907030506db404a3eb Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Fri, 9 Feb 2018 10:53:07 +0000 Subject: Improve docs about allowing some side effects on the constructor --- doc/development/fe_guide/style_guide_js.md | 33 ++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/doc/development/fe_guide/style_guide_js.md b/doc/development/fe_guide/style_guide_js.md index 02773162801..2e2d58b6d66 100644 --- a/doc/development/fe_guide/style_guide_js.md +++ b/doc/development/fe_guide/style_guide_js.md @@ -207,10 +207,39 @@ Do not use them anymore and feel free to remove them when refactoring legacy cod var c = pureFunction(values.foo); ``` -1. Avoid constructors with side-effects +1. Avoid constructors with side-effects. +Although we aim for code without side-effects we need some side-effects for our code to run. + +If the class won't do anything if we only instantiate it, it's ok to add side effects into the constructor (_Note:_ The following it's just an example. If the all purpose of the class is to add an event listener and handle the callback a function will be more suitable.) + +```javascript +// Bad +export class Foo { + constructor() { + this.init(); + } + init() { + document.addEventListener('click', this.handleCallback) + }, + handleCallback() { + + } +} + +// Good +export class Foo { + constructor() { + document.addEventListener() + } + handleCallback() { + } +} +``` + +On the other hand, if a class only needs to extend a third party/add event listeners in some specific cases, they should be inited oustside of the constructor. 1. Prefer `.map`, `.reduce` or `.filter` over `.forEach` -A forEach will cause side effects, it will be mutating the array being iterated. Prefer using `.map`, +A forEach will most likely cause side effects, it will be mutating the array being iterated. Prefer using `.map`, `.reduce` or `.filter` ```javascript const users = [ { name: 'Foo' }, { name: 'Bar' } ]; -- cgit v1.2.1 From 49f4b34be31e9ca78ff2355d5e94044cf8b8daa4 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Fri, 9 Feb 2018 10:55:19 +0000 Subject: Remove not needed default statement --- .../components/states/mr_widget_missing_branch.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue index 94eca0e9288..718c0e4b3c6 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue @@ -17,7 +17,6 @@ mr: { type: Object, required: true, - default: () => ({}), }, }, computed: { -- cgit v1.2.1 From 71c948d63743c80f50cdd929728bb074d9deeace Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Fri, 9 Feb 2018 11:14:48 +0000 Subject: Replace $.post in importer status with axios --- app/assets/javascripts/importer_status.js | 68 ++++++++++------ app/controllers/import/bitbucket_controller.rb | 22 +++-- app/controllers/import/fogbugz_controller.rb | 16 ++-- app/controllers/import/github_controller.rb | 19 +++-- app/controllers/import/gitlab_controller.rb | 18 ++-- app/controllers/import/google_code_controller.rb | 16 ++-- app/serializers/project_serializer.rb | 3 + app/views/import/base/create.js.haml | 13 --- app/views/import/base/unauthorized.js.haml | 14 ---- .../import/bitbucket_controller_spec.rb | 88 +++++++++++++------- spec/controllers/import/gitlab_controller_spec.rb | 85 +++++++++++++------ spec/javascripts/importer_status_spec.js | 47 +++++++++++ .../githubish_import_controller_shared_examples.rb | 95 ++++++++++++++-------- 13 files changed, 328 insertions(+), 176 deletions(-) create mode 100644 app/serializers/project_serializer.rb delete mode 100644 app/views/import/base/create.js.haml delete mode 100644 app/views/import/base/unauthorized.js.haml create mode 100644 spec/javascripts/importer_status_spec.js diff --git a/app/assets/javascripts/importer_status.js b/app/assets/javascripts/importer_status.js index 1dc70872d92..134a503864e 100644 --- a/app/assets/javascripts/importer_status.js +++ b/app/assets/javascripts/importer_status.js @@ -1,3 +1,7 @@ +import { __ } from './locale'; +import axios from './lib/utils/axios_utils'; +import flash from './flash'; + class ImporterStatus { constructor(jobsUrl, importUrl) { this.jobsUrl = jobsUrl; @@ -9,29 +13,7 @@ class ImporterStatus { initStatusPage() { $('.js-add-to-import') .off('click') - .on('click', (event) => { - const $btn = $(event.currentTarget); - const $tr = $btn.closest('tr'); - const $targetField = $tr.find('.import-target'); - const $namespaceInput = $targetField.find('.js-select-namespace option:selected'); - const id = $tr.attr('id').replace('repo_', ''); - let targetNamespace; - let newName; - if ($namespaceInput.length > 0) { - targetNamespace = $namespaceInput[0].innerHTML; - newName = $targetField.find('#path').prop('value'); - $targetField.empty().append(`${targetNamespace}/${newName}`); - } - $btn.disable().addClass('is-loading'); - - return $.post(this.importUrl, { - repo_id: id, - target_namespace: targetNamespace, - new_name: newName, - }, { - dataType: 'script', - }); - }); + .on('click', this.addToImport.bind(this)); $('.js-import-all') .off('click') @@ -44,6 +26,39 @@ class ImporterStatus { }); } + addToImport(event) { + const $btn = $(event.currentTarget); + const $tr = $btn.closest('tr'); + const $targetField = $tr.find('.import-target'); + const $namespaceInput = $targetField.find('.js-select-namespace option:selected'); + const id = $tr.attr('id').replace('repo_', ''); + let targetNamespace; + let newName; + if ($namespaceInput.length > 0) { + targetNamespace = $namespaceInput[0].innerHTML; + newName = $targetField.find('#path').prop('value'); + $targetField.empty().append(`${targetNamespace}/${newName}`); + } + $btn.disable().addClass('is-loading'); + + return axios.post(this.importUrl, { + repo_id: id, + target_namespace: targetNamespace, + new_name: newName, + }) + .then(({ data }) => { + const job = $(`tr#repo_${id}`); + job.attr('id', `project_${data.id}`); + + job.find('.import-target').html(`${data.full_path}`); + $('table.import-jobs tbody').prepend(job); + + job.addClass('active'); + job.find('.import-actions').html(' started'); + }) + .catch(() => flash(__('An error occurred while importing project'))); + } + setAutoUpdate() { return setInterval(() => $.get(this.jobsUrl, data => $.each(data, (i, job) => { const jobItem = $(`#project_${job.id}`); @@ -71,7 +86,7 @@ class ImporterStatus { } // eslint-disable-next-line consistent-return -export default function initImporterStatus() { +function initImporterStatus() { const importerStatus = document.querySelector('.js-importer-status'); if (importerStatus) { @@ -79,3 +94,8 @@ export default function initImporterStatus() { return new ImporterStatus(data.jobsImportPath, data.importPath); } } + +export { + initImporterStatus as default, + ImporterStatus, +}; diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb index 5ad1e116e4e..13ea736688d 100644 --- a/app/controllers/import/bitbucket_controller.rb +++ b/app/controllers/import/bitbucket_controller.rb @@ -37,24 +37,30 @@ class Import::BitbucketController < Import::BaseController def create bitbucket_client = Bitbucket::Client.new(credentials) - @repo_id = params[:repo_id].to_s - name = @repo_id.gsub('___', '/') + repo_id = params[:repo_id].to_s + name = repo_id.gsub('___', '/') repo = bitbucket_client.repo(name) - @project_name = params[:new_name].presence || repo.name + project_name = params[:new_name].presence || repo.name repo_owner = repo.owner repo_owner = current_user.username if repo_owner == bitbucket_client.user.username namespace_path = params[:new_namespace].presence || repo_owner + target_namespace = find_or_create_namespace(namespace_path, current_user) - @target_namespace = find_or_create_namespace(namespace_path, current_user) - - if current_user.can?(:create_projects, @target_namespace) + if current_user.can?(:create_projects, target_namespace) # The token in a session can be expired, we need to get most recent one because # Bitbucket::Connection class refreshes it. session[:bitbucket_token] = bitbucket_client.connection.token - @project = Gitlab::BitbucketImport::ProjectCreator.new(repo, @project_name, @target_namespace, current_user, credentials).execute + + project = Gitlab::BitbucketImport::ProjectCreator.new(repo, project_name, target_namespace, current_user, credentials).execute + + if project.persisted? + render json: ProjectSerializer.new.represent(project) + else + render json: { errors: project.errors.full_messages }, status: :unprocessable_entity + end else - render 'unauthorized' + render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity end end diff --git a/app/controllers/import/fogbugz_controller.rb b/app/controllers/import/fogbugz_controller.rb index 5df6bd34185..669eb31a995 100644 --- a/app/controllers/import/fogbugz_controller.rb +++ b/app/controllers/import/fogbugz_controller.rb @@ -58,17 +58,17 @@ class Import::FogbugzController < Import::BaseController end def create - @repo_id = params[:repo_id] - repo = client.repo(@repo_id) + repo = client.repo(params[:repo_id]) fb_session = { uri: session[:fogbugz_uri], token: session[:fogbugz_token] } - @target_namespace = current_user.namespace - @project_name = repo.name - - namespace = @target_namespace - umap = session[:fogbugz_user_map] || client.user_map - @project = Gitlab::FogbugzImport::ProjectCreator.new(repo, fb_session, namespace, current_user, umap).execute + project = Gitlab::FogbugzImport::ProjectCreator.new(repo, fb_session, current_user.namespace, current_user, umap).execute + + if project.persisted? + render json: ProjectSerializer.new.represent(project) + else + render json: { errors: project.errors.full_messages }, status: :unprocessable_entity + end end private diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb index b8ba7921613..69fb8121ded 100644 --- a/app/controllers/import/github_controller.rb +++ b/app/controllers/import/github_controller.rb @@ -36,16 +36,21 @@ class Import::GithubController < Import::BaseController end def create - @repo_id = params[:repo_id].to_i - repo = client.repo(@repo_id) - @project_name = params[:new_name].presence || repo.name + repo = client.repo(params[:repo_id].to_i) + project_name = params[:new_name].presence || repo.name namespace_path = params[:target_namespace].presence || current_user.namespace_path - @target_namespace = find_or_create_namespace(namespace_path, current_user.namespace_path) + target_namespace = find_or_create_namespace(namespace_path, current_user.namespace_path) - if can?(current_user, :create_projects, @target_namespace) - @project = Gitlab::LegacyGithubImport::ProjectCreator.new(repo, @project_name, @target_namespace, current_user, access_params, type: provider).execute + if can?(current_user, :create_projects, target_namespace) + project = Gitlab::LegacyGithubImport::ProjectCreator.new(repo, project_name, target_namespace, current_user, access_params, type: provider).execute + + if project.persisted? + render json: ProjectSerializer.new.represent(project) + else + render json: { errors: project.errors.full_messages }, status: :unprocessable_entity + end else - render 'unauthorized' + render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity end end diff --git a/app/controllers/import/gitlab_controller.rb b/app/controllers/import/gitlab_controller.rb index 407154e59a0..18f1d20f5a9 100644 --- a/app/controllers/import/gitlab_controller.rb +++ b/app/controllers/import/gitlab_controller.rb @@ -24,15 +24,19 @@ class Import::GitlabController < Import::BaseController end def create - @repo_id = params[:repo_id].to_i - repo = client.project(@repo_id) - @project_name = repo['name'] - @target_namespace = find_or_create_namespace(repo['namespace']['path'], client.user['username']) + repo = client.project(params[:repo_id].to_i) + target_namespace = find_or_create_namespace(repo['namespace']['path'], client.user['username']) - if current_user.can?(:create_projects, @target_namespace) - @project = Gitlab::GitlabImport::ProjectCreator.new(repo, @target_namespace, current_user, access_params).execute + if current_user.can?(:create_projects, target_namespace) + project = Gitlab::GitlabImport::ProjectCreator.new(repo, target_namespace, current_user, access_params).execute + + if project.persisted? + render json: ProjectSerializer.new.represent(project) + else + render json: { errors: project.errors.full_messages }, status: :unprocessable_entity + end else - render 'unauthorized' + render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity end end diff --git a/app/controllers/import/google_code_controller.rb b/app/controllers/import/google_code_controller.rb index 7d7f13ce5d5..baa19fb383d 100644 --- a/app/controllers/import/google_code_controller.rb +++ b/app/controllers/import/google_code_controller.rb @@ -85,16 +85,16 @@ class Import::GoogleCodeController < Import::BaseController end def create - @repo_id = params[:repo_id] - repo = client.repo(@repo_id) - @target_namespace = current_user.namespace - @project_name = repo.name - - namespace = @target_namespace - + repo = client.repo(params[:repo_id]) user_map = session[:google_code_user_map] - @project = Gitlab::GoogleCodeImport::ProjectCreator.new(repo, namespace, current_user, user_map).execute + project = Gitlab::GoogleCodeImport::ProjectCreator.new(repo, current_user.namespace, current_user, user_map).execute + + if project.persisted? + render json: ProjectSerializer.new.represent(project) + else + render json: { errors: project.errors.full_messages }, status: :unprocessable_entity + end end private diff --git a/app/serializers/project_serializer.rb b/app/serializers/project_serializer.rb new file mode 100644 index 00000000000..74de1e79a8f --- /dev/null +++ b/app/serializers/project_serializer.rb @@ -0,0 +1,3 @@ +class ProjectSerializer < BaseSerializer + entity ProjectEntity +end diff --git a/app/views/import/base/create.js.haml b/app/views/import/base/create.js.haml deleted file mode 100644 index 4dc3a4a0acf..00000000000 --- a/app/views/import/base/create.js.haml +++ /dev/null @@ -1,13 +0,0 @@ -- if @project.persisted? - :plain - job = $("tr#repo_#{@repo_id}") - job.attr("id", "project_#{@project.id}") - target_field = job.find(".import-target") - target_field.empty() - target_field.append('#{link_to @project.full_path, project_path(@project)}') - $("table.import-jobs tbody").prepend(job) - job.addClass("active").find(".import-actions").html(" started") -- else - :plain - job = $("tr#repo_#{@repo_id}") - job.find(".import-actions").html(" Error saving project: #{escape_javascript(h(@project.errors.full_messages.join(',')))}") diff --git a/app/views/import/base/unauthorized.js.haml b/app/views/import/base/unauthorized.js.haml deleted file mode 100644 index ada5f99f4e2..00000000000 --- a/app/views/import/base/unauthorized.js.haml +++ /dev/null @@ -1,14 +0,0 @@ -:plain - tr = $("tr#repo_#{@repo_id}") - target_field = tr.find(".import-target") - import_button = tr.find(".btn-import") - origin_target = target_field.text() - project_name = "#{@project_name}" - origin_namespace = "#{@target_namespace.full_path}" - target_field.empty() - target_field.append("

This namespace has already been taken! Please choose another one.

") - target_field.append("") - target_field.append("/" + project_name) - target_field.data("project_name", project_name) - target_field.find('input').prop("value", origin_namespace) - import_button.enable().removeClass('is-loading') diff --git a/spec/controllers/import/bitbucket_controller_spec.rb b/spec/controllers/import/bitbucket_controller_spec.rb index e8707760a5a..9c7a54f9ed4 100644 --- a/spec/controllers/import/bitbucket_controller_spec.rb +++ b/spec/controllers/import/bitbucket_controller_spec.rb @@ -84,20 +84,42 @@ describe Import::BitbucketController do double(slug: "vim", owner: bitbucket_username, name: 'vim') end + let(:project) { create(:project) } + before do allow_any_instance_of(Bitbucket::Client).to receive(:repo).and_return(bitbucket_repo) allow_any_instance_of(Bitbucket::Client).to receive(:user).and_return(bitbucket_user) assign_session_tokens end + it 'returns 200 response when the project is imported successfully' do + allow(Gitlab::BitbucketImport::ProjectCreator) + .to receive(:new).with(bitbucket_repo, bitbucket_repo.name, user.namespace, user, access_params) + .and_return(double(execute: project)) + + post :create, format: :json + + expect(response).to have_gitlab_http_status(200) + end + + it 'returns 422 response when the project could not be imported' do + allow(Gitlab::BitbucketImport::ProjectCreator) + .to receive(:new).with(bitbucket_repo, bitbucket_repo.name, user.namespace, user, access_params) + .and_return(double(execute: build(:project))) + + post :create, format: :json + + expect(response).to have_gitlab_http_status(422) + end + context "when the repository owner is the Bitbucket user" do context "when the Bitbucket user and GitLab user's usernames match" do it "takes the current user's namespace" do expect(Gitlab::BitbucketImport::ProjectCreator) .to receive(:new).with(bitbucket_repo, bitbucket_repo.name, user.namespace, user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end @@ -107,9 +129,9 @@ describe Import::BitbucketController do it "takes the current user's namespace" do expect(Gitlab::BitbucketImport::ProjectCreator) .to receive(:new).with(bitbucket_repo, bitbucket_repo.name, user.namespace, user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end @@ -120,7 +142,7 @@ describe Import::BitbucketController do allow(controller).to receive(:current_user).and_return(user) allow(user).to receive(:can?).and_return(false) - post :create, format: :js + post :create, format: :json end end end @@ -143,9 +165,9 @@ describe Import::BitbucketController do it "takes the existing namespace" do expect(Gitlab::BitbucketImport::ProjectCreator) .to receive(:new).with(bitbucket_repo, bitbucket_repo.name, existing_namespace, user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end @@ -154,7 +176,7 @@ describe Import::BitbucketController do expect(Gitlab::BitbucketImport::ProjectCreator) .not_to receive(:new) - post :create, format: :js + post :create, format: :json end end end @@ -163,17 +185,17 @@ describe Import::BitbucketController do context "when current user can create namespaces" do it "creates the namespace" do expect(Gitlab::BitbucketImport::ProjectCreator) - .to receive(:new).and_return(double(execute: true)) + .to receive(:new).and_return(double(execute: project)) - expect { post :create, format: :js }.to change(Namespace, :count).by(1) + expect { post :create, format: :json }.to change(Namespace, :count).by(1) end it "takes the new namespace" do expect(Gitlab::BitbucketImport::ProjectCreator) .to receive(:new).with(bitbucket_repo, bitbucket_repo.name, an_instance_of(Group), user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end @@ -184,17 +206,17 @@ describe Import::BitbucketController do it "doesn't create the namespace" do expect(Gitlab::BitbucketImport::ProjectCreator) - .to receive(:new).and_return(double(execute: true)) + .to receive(:new).and_return(double(execute: project)) - expect { post :create, format: :js }.not_to change(Namespace, :count) + expect { post :create, format: :json }.not_to change(Namespace, :count) end it "takes the current user's namespace" do expect(Gitlab::BitbucketImport::ProjectCreator) .to receive(:new).with(bitbucket_repo, bitbucket_repo.name, user.namespace, user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end end @@ -212,9 +234,9 @@ describe Import::BitbucketController do it 'takes the selected namespace and name' do expect(Gitlab::BitbucketImport::ProjectCreator) .to receive(:new).with(bitbucket_repo, test_name, nested_namespace, user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: nested_namespace.full_path, new_name: test_name, format: :js } + post :create, { target_namespace: nested_namespace.full_path, new_name: test_name, format: :json } end end @@ -224,26 +246,26 @@ describe Import::BitbucketController do it 'takes the selected namespace and name' do expect(Gitlab::BitbucketImport::ProjectCreator) .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :js } + post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json } end it 'creates the namespaces' do allow(Gitlab::BitbucketImport::ProjectCreator) .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - expect { post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :js } } + expect { post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json } } .to change { Namespace.count }.by(2) end it 'new namespace has the right parent' do allow(Gitlab::BitbucketImport::ProjectCreator) .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :js } + post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json } expect(Namespace.find_by_path_or_name('bar').parent.path).to eq('foo') end @@ -256,19 +278,29 @@ describe Import::BitbucketController do it 'takes the selected namespace and name' do expect(Gitlab::BitbucketImport::ProjectCreator) .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :js } + post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :json } end it 'creates the namespaces' do allow(Gitlab::BitbucketImport::ProjectCreator) .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - expect { post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :js } } + expect { post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :json } } .to change { Namespace.count }.by(2) end end + + context 'when user can not create projects in the chosen namespace' do + it 'returns 422 response' do + other_namespace = create(:group, name: 'other_namespace') + + post :create, { target_namespace: other_namespace.name, format: :json } + + expect(response).to have_gitlab_http_status(422) + end + end end end diff --git a/spec/controllers/import/gitlab_controller_spec.rb b/spec/controllers/import/gitlab_controller_spec.rb index faf1e6f63ea..d902c6210f5 100644 --- a/spec/controllers/import/gitlab_controller_spec.rb +++ b/spec/controllers/import/gitlab_controller_spec.rb @@ -57,6 +57,7 @@ describe Import::GitlabController do end describe "POST create" do + let(:project) { create(:project) } let(:gitlab_username) { user.username } let(:gitlab_user) do { username: gitlab_username }.with_indifferent_access @@ -75,14 +76,34 @@ describe Import::GitlabController do assign_session_token end + it 'returns 200 response when the project is imported successfully' do + allow(Gitlab::GitlabImport::ProjectCreator) + .to receive(:new).with(gitlab_repo, user.namespace, user, access_params) + .and_return(double(execute: project)) + + post :create, format: :json + + expect(response).to have_gitlab_http_status(200) + end + + it 'returns 422 response when the project could not be imported' do + allow(Gitlab::GitlabImport::ProjectCreator) + .to receive(:new).with(gitlab_repo, user.namespace, user, access_params) + .and_return(double(execute: build(:project))) + + post :create, format: :json + + expect(response).to have_gitlab_http_status(422) + end + context "when the repository owner is the GitLab.com user" do context "when the GitLab.com user and GitLab server user's usernames match" do it "takes the current user's namespace" do expect(Gitlab::GitlabImport::ProjectCreator) .to receive(:new).with(gitlab_repo, user.namespace, user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end @@ -92,9 +113,9 @@ describe Import::GitlabController do it "takes the current user's namespace" do expect(Gitlab::GitlabImport::ProjectCreator) .to receive(:new).with(gitlab_repo, user.namespace, user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end end @@ -118,9 +139,9 @@ describe Import::GitlabController do it "takes the existing namespace" do expect(Gitlab::GitlabImport::ProjectCreator) .to receive(:new).with(gitlab_repo, existing_namespace, user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end @@ -129,7 +150,7 @@ describe Import::GitlabController do expect(Gitlab::GitlabImport::ProjectCreator) .not_to receive(:new) - post :create, format: :js + post :create, format: :json end end end @@ -138,17 +159,17 @@ describe Import::GitlabController do context "when current user can create namespaces" do it "creates the namespace" do expect(Gitlab::GitlabImport::ProjectCreator) - .to receive(:new).and_return(double(execute: true)) + .to receive(:new).and_return(double(execute: project)) - expect { post :create, format: :js }.to change(Namespace, :count).by(1) + expect { post :create, format: :json }.to change(Namespace, :count).by(1) end it "takes the new namespace" do expect(Gitlab::GitlabImport::ProjectCreator) .to receive(:new).with(gitlab_repo, an_instance_of(Group), user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end @@ -159,17 +180,17 @@ describe Import::GitlabController do it "doesn't create the namespace" do expect(Gitlab::GitlabImport::ProjectCreator) - .to receive(:new).and_return(double(execute: true)) + .to receive(:new).and_return(double(execute: project)) - expect { post :create, format: :js }.not_to change(Namespace, :count) + expect { post :create, format: :json }.not_to change(Namespace, :count) end it "takes the current user's namespace" do expect(Gitlab::GitlabImport::ProjectCreator) .to receive(:new).with(gitlab_repo, user.namespace, user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end end @@ -185,9 +206,9 @@ describe Import::GitlabController do it 'takes the selected namespace and name' do expect(Gitlab::GitlabImport::ProjectCreator) .to receive(:new).with(gitlab_repo, nested_namespace, user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: nested_namespace.full_path, format: :js } + post :create, { target_namespace: nested_namespace.full_path, format: :json } end end @@ -197,26 +218,26 @@ describe Import::GitlabController do it 'takes the selected namespace and name' do expect(Gitlab::GitlabImport::ProjectCreator) .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/bar', format: :js } + post :create, { target_namespace: 'foo/bar', format: :json } end it 'creates the namespaces' do allow(Gitlab::GitlabImport::ProjectCreator) .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - expect { post :create, { target_namespace: 'foo/bar', format: :js } } + expect { post :create, { target_namespace: 'foo/bar', format: :json } } .to change { Namespace.count }.by(2) end it 'new namespace has the right parent' do allow(Gitlab::GitlabImport::ProjectCreator) .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/bar', format: :js } + post :create, { target_namespace: 'foo/bar', format: :json } expect(Namespace.find_by_path_or_name('bar').parent.path).to eq('foo') end @@ -229,20 +250,30 @@ describe Import::GitlabController do it 'takes the selected namespace and name' do expect(Gitlab::GitlabImport::ProjectCreator) .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/foobar/bar', format: :js } + post :create, { target_namespace: 'foo/foobar/bar', format: :json } end it 'creates the namespaces' do allow(Gitlab::GitlabImport::ProjectCreator) .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - expect { post :create, { target_namespace: 'foo/foobar/bar', format: :js } } + expect { post :create, { target_namespace: 'foo/foobar/bar', format: :json } } .to change { Namespace.count }.by(2) end end + + context 'when user can not create projects in the chosen namespace' do + it 'returns 422 response' do + other_namespace = create(:group, name: 'other_namespace') + + post :create, { target_namespace: other_namespace.name, format: :json } + + expect(response).to have_gitlab_http_status(422) + end + end end end end diff --git a/spec/javascripts/importer_status_spec.js b/spec/javascripts/importer_status_spec.js new file mode 100644 index 00000000000..bb49c576e91 --- /dev/null +++ b/spec/javascripts/importer_status_spec.js @@ -0,0 +1,47 @@ +import { ImporterStatus } from '~/importer_status'; +import axios from '~/lib/utils/axios_utils'; +import MockAdapter from 'axios-mock-adapter'; + +describe('Importer Status', () => { + describe('addToImport', () => { + let instance; + let mock; + const importUrl = '/import_url'; + + beforeEach(() => { + setFixtures(` + + + + + + + `); + spyOn(ImporterStatus.prototype, 'initStatusPage').and.callFake(() => {}); + spyOn(ImporterStatus.prototype, 'setAutoUpdate').and.callFake(() => {}); + instance = new ImporterStatus('', importUrl); + mock = new MockAdapter(axios); + }); + + afterEach(() => { + mock.restore(); + }); + + it('sets table row to active after post request', (done) => { + mock.onPost(importUrl).reply(200, { + id: 1, + full_path: '/full_path', + }); + + instance.addToImport({ + currentTarget: document.querySelector('.js-add-to-import'), + }) + .then(() => { + expect(document.querySelector('tr').classList.contains('active')).toEqual(true); + done(); + }) + .catch(done.fail); + }); + }); +}); diff --git a/spec/support/controllers/githubish_import_controller_shared_examples.rb b/spec/support/controllers/githubish_import_controller_shared_examples.rb index a0839eefe6c..793bacf25c7 100644 --- a/spec/support/controllers/githubish_import_controller_shared_examples.rb +++ b/spec/support/controllers/githubish_import_controller_shared_examples.rb @@ -92,6 +92,7 @@ end shared_examples 'a GitHub-ish import controller: POST create' do let(:user) { create(:user) } + let(:project) { create(:project) } let(:provider_username) { user.username } let(:provider_user) { OpenStruct.new(login: provider_username) } let(:provider_repo) do @@ -107,14 +108,34 @@ shared_examples 'a GitHub-ish import controller: POST create' do assign_session_token(provider) end + it 'returns 200 response when the project is imported successfully' do + allow(Gitlab::LegacyGithubImport::ProjectCreator) + .to receive(:new).with(provider_repo, provider_repo.name, user.namespace, user, access_params, type: provider) + .and_return(double(execute: project)) + + post :create, format: :json + + expect(response).to have_gitlab_http_status(200) + end + + it 'returns 422 response when the project could not be imported' do + allow(Gitlab::LegacyGithubImport::ProjectCreator) + .to receive(:new).with(provider_repo, provider_repo.name, user.namespace, user, access_params, type: provider) + .and_return(double(execute: build(:project))) + + post :create, format: :json + + expect(response).to have_gitlab_http_status(422) + end + context "when the repository owner is the provider user" do context "when the provider user and GitLab user's usernames match" do it "takes the current user's namespace" do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, provider_repo.name, user.namespace, user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end @@ -124,9 +145,9 @@ shared_examples 'a GitHub-ish import controller: POST create' do it "takes the current user's namespace" do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, provider_repo.name, user.namespace, user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end end @@ -151,9 +172,9 @@ shared_examples 'a GitHub-ish import controller: POST create' do it "takes the existing namespace" do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, provider_repo.name, existing_namespace, user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end @@ -163,9 +184,9 @@ shared_examples 'a GitHub-ish import controller: POST create' do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, provider_repo.name, user.namespace, user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end end @@ -174,17 +195,17 @@ shared_examples 'a GitHub-ish import controller: POST create' do context "when current user can create namespaces" do it "creates the namespace" do expect(Gitlab::LegacyGithubImport::ProjectCreator) - .to receive(:new).and_return(double(execute: true)) + .to receive(:new).and_return(double(execute: project)) - expect { post :create, target_namespace: provider_repo.name, format: :js }.to change(Namespace, :count).by(1) + expect { post :create, target_namespace: provider_repo.name, format: :json }.to change(Namespace, :count).by(1) end it "takes the new namespace" do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, provider_repo.name, an_instance_of(Group), user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, target_namespace: provider_repo.name, format: :js + post :create, target_namespace: provider_repo.name, format: :json end end @@ -195,17 +216,17 @@ shared_examples 'a GitHub-ish import controller: POST create' do it "doesn't create the namespace" do expect(Gitlab::LegacyGithubImport::ProjectCreator) - .to receive(:new).and_return(double(execute: true)) + .to receive(:new).and_return(double(execute: project)) - expect { post :create, format: :js }.not_to change(Namespace, :count) + expect { post :create, format: :json }.not_to change(Namespace, :count) end it "takes the current user's namespace" do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, provider_repo.name, user.namespace, user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, format: :js + post :create, format: :json end end end @@ -221,17 +242,17 @@ shared_examples 'a GitHub-ish import controller: POST create' do it 'takes the selected namespace and name' do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, test_namespace, user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: test_namespace.name, new_name: test_name, format: :js } + post :create, { target_namespace: test_namespace.name, new_name: test_name, format: :json } end it 'takes the selected name and default namespace' do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, user.namespace, user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { new_name: test_name, format: :js } + post :create, { new_name: test_name, format: :json } end end @@ -247,9 +268,9 @@ shared_examples 'a GitHub-ish import controller: POST create' do it 'takes the selected namespace and name' do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, nested_namespace, user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: nested_namespace.full_path, new_name: test_name, format: :js } + post :create, { target_namespace: nested_namespace.full_path, new_name: test_name, format: :json } end end @@ -259,26 +280,26 @@ shared_examples 'a GitHub-ish import controller: POST create' do it 'takes the selected namespace and name' do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :js } + post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json } end it 'creates the namespaces' do allow(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - expect { post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :js } } + expect { post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json } } .to change { Namespace.count }.by(2) end it 'new namespace has the right parent' do allow(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :js } + post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json } expect(Namespace.find_by_path_or_name('bar').parent.path).to eq('foo') end @@ -291,19 +312,29 @@ shared_examples 'a GitHub-ish import controller: POST create' do it 'takes the selected namespace and name' do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :js } + post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :json } end it 'creates the namespaces' do allow(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: project)) - expect { post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :js } } + expect { post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :json } } .to change { Namespace.count }.by(2) end end + + context 'when user can not create projects in the chosen namespace' do + it 'returns 422 response' do + other_namespace = create(:group, name: 'other_namespace') + + post :create, { target_namespace: other_namespace.name, format: :json } + + expect(response).to have_gitlab_http_status(422) + end + end end end -- cgit v1.2.1 From 27a70018842e1ac130403db319ab013270901e6e Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Fri, 9 Feb 2018 12:27:55 +0100 Subject: Do not attach runner to a non-exsiting network in QA --- qa/qa/service/runner.rb | 10 +++++++++- qa/qa/service/shellout.rb | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/qa/qa/service/runner.rb b/qa/qa/service/runner.rb index d0ee33c69f2..c0352e0467a 100644 --- a/qa/qa/service/runner.rb +++ b/qa/qa/service/runner.rb @@ -15,6 +15,14 @@ module QA @tags = %w[qa test] end + def network + shell "docker network inspect #{@network}" + rescue CommandError + 'bridge' + else + @network + end + def pull shell "docker pull #{@image}" end @@ -22,7 +30,7 @@ module QA def register! shell <<~CMD.tr("\n", ' ') docker run -d --rm --entrypoint=/bin/sh - --network #{@network} --name #{@name} + --network #{network} --name #{@name} -e CI_SERVER_URL=#{@address} -e REGISTER_NON_INTERACTIVE=true -e REGISTRATION_TOKEN=#{@token} diff --git a/qa/qa/service/shellout.rb b/qa/qa/service/shellout.rb index 898febde63c..76fb2af6319 100644 --- a/qa/qa/service/shellout.rb +++ b/qa/qa/service/shellout.rb @@ -3,6 +3,8 @@ require 'open3' module QA module Service module Shellout + CommandError = Class.new(StandardError) + ## # TODO, make it possible to use generic QA framework classes # as a library - gitlab-org/gitlab-qa#94 @@ -14,7 +16,7 @@ module QA out.each { |line| puts line } if wait.value.exited? && wait.value.exitstatus.nonzero? - raise "Command `#{command}` failed!" + raise CommandError, "Command `#{command}` failed!" end end end -- cgit v1.2.1 From 369d18cb298356e8043554613ddf1a9853803c60 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Fri, 9 Feb 2018 11:17:58 +0000 Subject: Adds tooltip for environment name Adds CSS for child envrionments --- .../environments/components/environment_item.vue | 31 ++++++++++++++-------- app/assets/stylesheets/pages/environments.scss | 4 +++ changelogs/unreleased/42922-environment-name.yml | 5 ++++ 3 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 changelogs/unreleased/42922-environment-name.yml diff --git a/app/assets/javascripts/environments/components/environment_item.vue b/app/assets/javascripts/environments/components/environment_item.vue index a9d554e549e..79326ca3487 100644 --- a/app/assets/javascripts/environments/components/environment_item.vue +++ b/app/assets/javascripts/environments/components/environment_item.vue @@ -1,8 +1,9 @@ ") + expect(result.to_html).to include("alert(1)") + end + end + context "when no language is specified" do it "highlights as plaintext" do result = filter('
def fun end
') + expect(result.to_html).to eq('
def fun end
') end + + include_examples "XSS prevention", "" end context "when a valid language is specified" do it "highlights as that language" do result = filter('
def fun end
') + expect(result.to_html).to eq('
def fun end
') end + + include_examples "XSS prevention", "ruby" end context "when an invalid language is specified" do it "highlights as plaintext" do result = filter('
This is a test
') + expect(result.to_html).to eq('
This is a test
') end + + include_examples "XSS prevention", "gnuplot" end - context "when Rouge formatting fails" do + context "languages that should be passed through" do + %w(math mermaid plantuml).each do |lang| + context "when #{lang} is specified" do + it "highlights as plaintext but with the correct language attribute and class" do + result = filter(%{
This is a test
}) + + expect(result.to_html).to eq(%{
This is a test
}) + end + + include_examples "XSS prevention", lang + end + end + end + + context "when Rouge lexing fails" do before do - allow_any_instance_of(Rouge::Formatter).to receive(:format).and_raise(StandardError) + allow_any_instance_of(Rouge::Lexers::Ruby).to receive(:stream_tokens).and_raise(StandardError) end it "highlights as plaintext" do result = filter('
This is a test
') - expect(result.to_html).to eq('
This is a test
') + + expect(result.to_html).to eq('
This is a test
') + end + + include_examples "XSS prevention", "ruby" + end + + context "when Rouge lexing fails after a retry" do + before do + allow_any_instance_of(Rouge::Lexers::PlainText).to receive(:stream_tokens).and_raise(StandardError) + end + + it "does not add highlighting classes" do + result = filter('
This is a test
') + + expect(result.to_html).to eq('
This is a test
') end + + include_examples "XSS prevention", "ruby" end end -- cgit v1.2.1 From fec9fb05a5775b864ef6768df166d39fcb2be4bc Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 18 Jan 2018 23:10:19 +0000 Subject: Merge branch 'security-10-4-todo-api-reveals-sensitive-information' into 'security-10-4' Restrict Todo API mark_as_done endpoint to the user's todos only --- .../security-10-4-todo-api-reveals-sensitive-information.yml | 5 +++++ lib/api/todos.rb | 2 +- lib/api/v3/todos.rb | 2 +- spec/requests/api/todos_spec.rb | 6 ++++++ spec/requests/api/v3/todos_spec.rb | 6 ++++++ 5 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/security-10-4-todo-api-reveals-sensitive-information.yml diff --git a/changelogs/unreleased/security-10-4-todo-api-reveals-sensitive-information.yml b/changelogs/unreleased/security-10-4-todo-api-reveals-sensitive-information.yml new file mode 100644 index 00000000000..329825d1e73 --- /dev/null +++ b/changelogs/unreleased/security-10-4-todo-api-reveals-sensitive-information.yml @@ -0,0 +1,5 @@ +--- +title: Restrict Todo API mark_as_done endpoint to the user's todos only +merge_request: +author: +type: security diff --git a/lib/api/todos.rb b/lib/api/todos.rb index ffccfebe752..c6dbcf84e3a 100644 --- a/lib/api/todos.rb +++ b/lib/api/todos.rb @@ -60,7 +60,7 @@ module API end post ':id/mark_as_done' do TodoService.new.mark_todos_as_done_by_ids(params[:id], current_user) - todo = Todo.find(params[:id]) + todo = current_user.todos.find(params[:id]) present todo, with: Entities::Todo, current_user: current_user end diff --git a/lib/api/v3/todos.rb b/lib/api/v3/todos.rb index 2f2cf259987..3e2c61f6dbd 100644 --- a/lib/api/v3/todos.rb +++ b/lib/api/v3/todos.rb @@ -12,7 +12,7 @@ module API end delete ':id' do TodoService.new.mark_todos_as_done_by_ids(params[:id], current_user) - todo = Todo.find(params[:id]) + todo = current_user.todos.find(params[:id]) present todo, with: ::API::Entities::Todo, current_user: current_user end diff --git a/spec/requests/api/todos_spec.rb b/spec/requests/api/todos_spec.rb index fb3a33cadff..2ee8d150dc8 100644 --- a/spec/requests/api/todos_spec.rb +++ b/spec/requests/api/todos_spec.rb @@ -129,6 +129,12 @@ describe API::Todos do post api("/todos/#{pending_1.id}/mark_as_done", john_doe) end + + it 'returns 404 if the todo does not belong to the current user' do + post api("/todos/#{pending_1.id}/mark_as_done", author_1) + + expect(response.status).to eq(404) + end end end diff --git a/spec/requests/api/v3/todos_spec.rb b/spec/requests/api/v3/todos_spec.rb index 53fd962272a..ea648e3917f 100644 --- a/spec/requests/api/v3/todos_spec.rb +++ b/spec/requests/api/v3/todos_spec.rb @@ -38,6 +38,12 @@ describe API::V3::Todos do delete v3_api("/todos/#{pending_1.id}", john_doe) end + + it 'returns 404 if the todo does not belong to the current user' do + delete v3_api("/todos/#{pending_1.id}", author_1) + + expect(response.status).to eq(404) + end end end -- cgit v1.2.1 From 68e31c098ec3984c42b921c07fec8593116e77ce Mon Sep 17 00:00:00 2001 From: James Lopez Date: Fri, 26 Jan 2018 15:39:10 +0000 Subject: Merge branch 'fix/gh-namespace-issue' into 'security-10-4' [10.4] Fix GH namespace security issue --- app/controllers/import/base_controller.rb | 24 +++------ app/services/groups/nested_create_service.rb | 10 ++-- changelogs/unreleased/fix-gh-namespace-issue.yml | 5 ++ .../import/bitbucket_controller_spec.rb | 10 ++-- spec/controllers/import/gitlab_controller_spec.rb | 10 ++-- .../githubish_import_controller_shared_examples.rb | 57 ++++++++++++++++++++-- 6 files changed, 87 insertions(+), 29 deletions(-) create mode 100644 changelogs/unreleased/fix-gh-namespace-issue.yml diff --git a/app/controllers/import/base_controller.rb b/app/controllers/import/base_controller.rb index 9de0297ecfd..c84fc2d305d 100644 --- a/app/controllers/import/base_controller.rb +++ b/app/controllers/import/base_controller.rb @@ -2,26 +2,16 @@ class Import::BaseController < ApplicationController private def find_or_create_namespace(names, owner) - return current_user.namespace if names == owner - return current_user.namespace unless current_user.can_create_group? - names = params[:target_namespace].presence || names - full_path_namespace = Namespace.find_by_full_path(names) - return full_path_namespace if full_path_namespace + return current_user.namespace if names == owner + + group = Groups::NestedCreateService.new(current_user, group_path: names).execute - names.split('/').inject(nil) do |parent, name| - begin - namespace = Group.create!(name: name, - path: name, - owner: current_user, - parent: parent) - namespace.add_owner(current_user) + group.errors.any? ? current_user.namespace : group + rescue => e + Gitlab::AppLogger.error(e) - namespace - rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid - Namespace.where(parent: parent).find_by_path_or_name(name) - end - end + current_user.namespace end end diff --git a/app/services/groups/nested_create_service.rb b/app/services/groups/nested_create_service.rb index d6f08fc3cce..5c337a9faa5 100644 --- a/app/services/groups/nested_create_service.rb +++ b/app/services/groups/nested_create_service.rb @@ -11,8 +11,8 @@ module Groups def execute return nil unless group_path - if group = Group.find_by_full_path(group_path) - return group + if namespace = namespace_or_group(group_path) + return namespace end if group_path.include?('/') && !Group.supports_nested_groups? @@ -40,10 +40,14 @@ module Groups ) new_params[:visibility_level] ||= Gitlab::CurrentSettings.current_application_settings.default_group_visibility - last_group = Group.find_by_full_path(partial_path) || Groups::CreateService.new(current_user, new_params).execute + last_group = namespace_or_group(partial_path) || Groups::CreateService.new(current_user, new_params).execute end last_group end + + def namespace_or_group(group_path) + Namespace.find_by_full_path(group_path) + end end end diff --git a/changelogs/unreleased/fix-gh-namespace-issue.yml b/changelogs/unreleased/fix-gh-namespace-issue.yml new file mode 100644 index 00000000000..2db7abb9d58 --- /dev/null +++ b/changelogs/unreleased/fix-gh-namespace-issue.yml @@ -0,0 +1,5 @@ +--- +title: Fix namespace access issue for GitHub, BitBucket, and GitLab.com project importers +merge_request: +author: +type: security diff --git a/spec/controllers/import/bitbucket_controller_spec.rb b/spec/controllers/import/bitbucket_controller_spec.rb index 9c7a54f9ed4..2be46049aab 100644 --- a/spec/controllers/import/bitbucket_controller_spec.rb +++ b/spec/controllers/import/bitbucket_controller_spec.rb @@ -222,7 +222,7 @@ describe Import::BitbucketController do end end - context 'user has chosen an existing nested namespace and name for the project' do + context 'user has chosen an existing nested namespace and name for the project', :postgresql do let(:parent_namespace) { create(:group, name: 'foo', owner: user) } let(:nested_namespace) { create(:group, name: 'bar', parent: parent_namespace) } let(:test_name) { 'test_name' } @@ -240,7 +240,7 @@ describe Import::BitbucketController do end end - context 'user has chosen a non-existent nested namespaces and name for the project' do + context 'user has chosen a non-existent nested namespaces and name for the project', :postgresql do let(:test_name) { 'test_name' } it 'takes the selected namespace and name' do @@ -271,10 +271,14 @@ describe Import::BitbucketController do end end - context 'user has chosen existent and non-existent nested namespaces and name for the project' do + context 'user has chosen existent and non-existent nested namespaces and name for the project', :postgresql do let(:test_name) { 'test_name' } let!(:parent_namespace) { create(:group, name: 'foo', owner: user) } + before do + parent_namespace.add_owner(user) + end + it 'takes the selected namespace and name' do expect(Gitlab::BitbucketImport::ProjectCreator) .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) diff --git a/spec/controllers/import/gitlab_controller_spec.rb b/spec/controllers/import/gitlab_controller_spec.rb index d902c6210f5..e958be077c2 100644 --- a/spec/controllers/import/gitlab_controller_spec.rb +++ b/spec/controllers/import/gitlab_controller_spec.rb @@ -195,7 +195,7 @@ describe Import::GitlabController do end end - context 'user has chosen an existing nested namespace for the project' do + context 'user has chosen an existing nested namespace for the project', :postgresql do let(:parent_namespace) { create(:group, name: 'foo', owner: user) } let(:nested_namespace) { create(:group, name: 'bar', parent: parent_namespace) } @@ -212,7 +212,7 @@ describe Import::GitlabController do end end - context 'user has chosen a non-existent nested namespaces for the project' do + context 'user has chosen a non-existent nested namespaces for the project', :postgresql do let(:test_name) { 'test_name' } it 'takes the selected namespace and name' do @@ -243,10 +243,14 @@ describe Import::GitlabController do end end - context 'user has chosen existent and non-existent nested namespaces and name for the project' do + context 'user has chosen existent and non-existent nested namespaces and name for the project', :postgresql do let(:test_name) { 'test_name' } let!(:parent_namespace) { create(:group, name: 'foo', owner: user) } + before do + parent_namespace.add_owner(user) + end + it 'takes the selected namespace and name' do expect(Gitlab::GitlabImport::ProjectCreator) .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) diff --git a/spec/support/controllers/githubish_import_controller_shared_examples.rb b/spec/support/controllers/githubish_import_controller_shared_examples.rb index 793bacf25c7..e848efd402f 100644 --- a/spec/support/controllers/githubish_import_controller_shared_examples.rb +++ b/spec/support/controllers/githubish_import_controller_shared_examples.rb @@ -256,7 +256,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do end end - context 'user has chosen an existing nested namespace and name for the project' do + context 'user has chosen an existing nested namespace and name for the project', :postgresql do let(:parent_namespace) { create(:group, name: 'foo', owner: user) } let(:nested_namespace) { create(:group, name: 'bar', parent: parent_namespace) } let(:test_name) { 'test_name' } @@ -274,7 +274,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do end end - context 'user has chosen a non-existent nested namespaces and name for the project' do + context 'user has chosen a non-existent nested namespaces and name for the project', :postgresql do let(:test_name) { 'test_name' } it 'takes the selected namespace and name' do @@ -305,10 +305,14 @@ shared_examples 'a GitHub-ish import controller: POST create' do end end - context 'user has chosen existent and non-existent nested namespaces and name for the project' do + context 'user has chosen existent and non-existent nested namespaces and name for the project', :postgresql do let(:test_name) { 'test_name' } let!(:parent_namespace) { create(:group, name: 'foo', owner: user) } + before do + parent_namespace.add_owner(user) + end + it 'takes the selected namespace and name' do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) @@ -325,6 +329,53 @@ shared_examples 'a GitHub-ish import controller: POST create' do expect { post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :json } } .to change { Namespace.count }.by(2) end + + it 'does not create a new namespace under the user namespace' do + expect(Gitlab::LegacyGithubImport::ProjectCreator) + .to receive(:new).with(provider_repo, test_name, user.namespace, user, access_params, type: provider) + .and_return(double(execute: true)) + + expect { post :create, { target_namespace: "#{user.namespace_path}/test_group", new_name: test_name, format: :js } } + .not_to change { Namespace.count } + end + end + + context 'user cannot create a subgroup inside a group is not a member of' do + let(:test_name) { 'test_name' } + let!(:parent_namespace) { create(:group, name: 'foo') } + + it 'does not take the selected namespace and name' do + expect(Gitlab::LegacyGithubImport::ProjectCreator) + .to receive(:new).with(provider_repo, test_name, user.namespace, user, access_params, type: provider) + .and_return(double(execute: true)) + + post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :js } + end + + it 'does not create the namespaces' do + allow(Gitlab::LegacyGithubImport::ProjectCreator) + .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) + .and_return(double(execute: true)) + + expect { post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :js } } + .not_to change { Namespace.count } + end + end + + context 'user can use a group without having permissions to create a group' do + let(:test_name) { 'test_name' } + let!(:group) { create(:group, name: 'foo') } + + it 'takes the selected namespace and name' do + group.add_owner(user) + user.update!(can_create_group: false) + + expect(Gitlab::LegacyGithubImport::ProjectCreator) + .to receive(:new).with(provider_repo, test_name, group, user, access_params, type: provider) + .and_return(double(execute: true)) + + post :create, { target_namespace: 'foo', new_name: test_name, format: :js } + end end context 'when user can not create projects in the chosen namespace' do -- cgit v1.2.1 From 02f93da8600a77e1502e89c3a65513a806c0d847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Fri, 26 Jan 2018 17:05:04 +0000 Subject: Merge branch 'mc/bug/38984-wildcard-protected-tags' into 'security-10-4' Fix using wildcards in protected tags to expose protected variables --- app/models/project.rb | 5 ++++- changelogs/unreleased/mc-bug-38984-wildcard-protected-tags.yml | 5 +++++ spec/models/ci/build_spec.rb | 8 ++++---- spec/models/group_spec.rb | 8 ++++++-- spec/models/project_spec.rb | 8 ++++++-- 5 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 changelogs/unreleased/mc-bug-38984-wildcard-protected-tags.yml diff --git a/app/models/project.rb b/app/models/project.rb index 0590cc1c720..3893b1818f3 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1589,8 +1589,11 @@ class Project < ActiveRecord::Base end def protected_for?(ref) - ProtectedBranch.protected?(self, ref) || + if repository.branch_exists?(ref) + ProtectedBranch.protected?(self, ref) + elsif repository.tag_exists?(ref) ProtectedTag.protected?(self, ref) + end end def deployment_variables diff --git a/changelogs/unreleased/mc-bug-38984-wildcard-protected-tags.yml b/changelogs/unreleased/mc-bug-38984-wildcard-protected-tags.yml new file mode 100644 index 00000000000..27219b096af --- /dev/null +++ b/changelogs/unreleased/mc-bug-38984-wildcard-protected-tags.yml @@ -0,0 +1,5 @@ +--- +title: Fix wilcard protected tags protecting all branches +merge_request: +author: +type: security diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 9e159c3f1fe..78fcbf6d47e 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1590,7 +1590,7 @@ describe Ci::Build do context 'when the branch is protected' do before do - create(:protected_branch, project: build.project, name: build.ref) + allow(build.project).to receive(:protected_for?).with(build.ref).and_return(true) end it { is_expected.to include(protected_variable) } @@ -1598,7 +1598,7 @@ describe Ci::Build do context 'when the tag is protected' do before do - create(:protected_tag, project: build.project, name: build.ref) + allow(build.project).to receive(:protected_for?).with(build.ref).and_return(true) end it { is_expected.to include(protected_variable) } @@ -1635,7 +1635,7 @@ describe Ci::Build do context 'when the branch is protected' do before do - create(:protected_branch, project: build.project, name: build.ref) + allow(build.project).to receive(:protected_for?).with(build.ref).and_return(true) end it { is_expected.to include(protected_variable) } @@ -1643,7 +1643,7 @@ describe Ci::Build do context 'when the tag is protected' do before do - create(:protected_tag, project: build.project, name: build.ref) + allow(build.project).to receive(:protected_for?).with(build.ref).and_return(true) end it { is_expected.to include(protected_variable) } diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 338fb314ee9..4f16b73ef38 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -549,7 +549,7 @@ describe Group do context 'when the ref is a protected branch' do before do - create(:protected_branch, name: 'ref', project: project) + allow(project).to receive(:protected_for?).with('ref').and_return(true) end it_behaves_like 'ref is protected' @@ -557,7 +557,7 @@ describe Group do context 'when the ref is a protected tag' do before do - create(:protected_tag, name: 'ref', project: project) + allow(project).to receive(:protected_for?).with('ref').and_return(true) end it_behaves_like 'ref is protected' @@ -571,6 +571,10 @@ describe Group do let(:variable_child_2) { create(:ci_group_variable, group: group_child_2) } let(:variable_child_3) { create(:ci_group_variable, group: group_child_3) } + before do + allow(project).to receive(:protected_for?).with('ref').and_return(true) + end + it 'returns all variables belong to the group and parent groups' do expected_array1 = [protected_variable, secret_variable] expected_array2 = [variable_child, variable_child_2, variable_child_3] diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 50b8bb7acb3..ee04d74d848 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -2092,7 +2092,7 @@ describe Project do context 'when the ref is a protected branch' do before do - create(:protected_branch, name: 'ref', project: project) + allow(project).to receive(:protected_for?).with('ref').and_return(true) end it_behaves_like 'ref is protected' @@ -2100,7 +2100,7 @@ describe Project do context 'when the ref is a protected tag' do before do - create(:protected_tag, name: 'ref', project: project) + allow(project).to receive(:protected_for?).with('ref').and_return(true) end it_behaves_like 'ref is protected' @@ -2125,6 +2125,8 @@ describe Project do context 'when the ref is a protected branch' do before do + allow(project).to receive(:repository).and_call_original + allow(project).to receive_message_chain(:repository, :branch_exists?).and_return(true) create(:protected_branch, name: 'ref', project: project) end @@ -2135,6 +2137,8 @@ describe Project do context 'when the ref is a protected tag' do before do + allow(project).to receive_message_chain(:repository, :branch_exists?).and_return(false) + allow(project).to receive_message_chain(:repository, :tag_exists?).and_return(true) create(:protected_tag, name: 'ref', project: project) end -- cgit v1.2.1 From 06e9faa3574738a2e32d8c1c1e1636cdff1c2489 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 9 Feb 2018 12:16:49 -0600 Subject: Remove changelogs for already-released security patches --- changelogs/unreleased/fix-gh-namespace-issue.yml | 5 ----- changelogs/unreleased/fix-stored-xss-in-code-blocks.yml | 5 ----- changelogs/unreleased/mc-bug-38984-wildcard-protected-tags.yml | 5 ----- .../security-10-4-todo-api-reveals-sensitive-information.yml | 5 ----- 4 files changed, 20 deletions(-) delete mode 100644 changelogs/unreleased/fix-gh-namespace-issue.yml delete mode 100644 changelogs/unreleased/fix-stored-xss-in-code-blocks.yml delete mode 100644 changelogs/unreleased/mc-bug-38984-wildcard-protected-tags.yml delete mode 100644 changelogs/unreleased/security-10-4-todo-api-reveals-sensitive-information.yml diff --git a/changelogs/unreleased/fix-gh-namespace-issue.yml b/changelogs/unreleased/fix-gh-namespace-issue.yml deleted file mode 100644 index 2db7abb9d58..00000000000 --- a/changelogs/unreleased/fix-gh-namespace-issue.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Fix namespace access issue for GitHub, BitBucket, and GitLab.com project importers -merge_request: -author: -type: security diff --git a/changelogs/unreleased/fix-stored-xss-in-code-blocks.yml b/changelogs/unreleased/fix-stored-xss-in-code-blocks.yml deleted file mode 100644 index b595459ee6b..00000000000 --- a/changelogs/unreleased/fix-stored-xss-in-code-blocks.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Fix stored XSS in code blocks that ignore highlighting -merge_request: -author: -type: security diff --git a/changelogs/unreleased/mc-bug-38984-wildcard-protected-tags.yml b/changelogs/unreleased/mc-bug-38984-wildcard-protected-tags.yml deleted file mode 100644 index 27219b096af..00000000000 --- a/changelogs/unreleased/mc-bug-38984-wildcard-protected-tags.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Fix wilcard protected tags protecting all branches -merge_request: -author: -type: security diff --git a/changelogs/unreleased/security-10-4-todo-api-reveals-sensitive-information.yml b/changelogs/unreleased/security-10-4-todo-api-reveals-sensitive-information.yml deleted file mode 100644 index 329825d1e73..00000000000 --- a/changelogs/unreleased/security-10-4-todo-api-reveals-sensitive-information.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Restrict Todo API mark_as_done endpoint to the user's todos only -merge_request: -author: -type: security -- cgit v1.2.1 From b60a39f26023207a0e5a63559ec3d2592a3246f0 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 9 Feb 2018 12:18:40 -0600 Subject: Default CI variables to unprotected See https://gitlab.com/gitlab-org/gitlab-ce/issues/42928 --- app/assets/javascripts/ci_variable_list/ci_variable_list.js | 2 +- app/views/ci/variables/_variable_row.html.haml | 2 +- spec/javascripts/ci_variable_list/ci_variable_list_spec.js | 2 +- spec/support/features/variable_list_shared_examples.rb | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/ci_variable_list/ci_variable_list.js b/app/assets/javascripts/ci_variable_list/ci_variable_list.js index d91789c2192..3467e88119b 100644 --- a/app/assets/javascripts/ci_variable_list/ci_variable_list.js +++ b/app/assets/javascripts/ci_variable_list/ci_variable_list.js @@ -39,7 +39,7 @@ export default class VariableList { }, protected: { selector: '.js-ci-variable-input-protected', - default: 'true', + default: 'false', }, environment_scope: { // We can't use a `.js-` class here because diff --git a/app/views/ci/variables/_variable_row.html.haml b/app/views/ci/variables/_variable_row.html.haml index 495a55660cb..15201780451 100644 --- a/app/views/ci/variables/_variable_row.html.haml +++ b/app/views/ci/variables/_variable_row.html.haml @@ -5,7 +5,7 @@ - id = variable&.id - key = variable&.key - value = variable&.value -- is_protected = variable && !only_key_value ? variable.protected : true +- is_protected = variable && !only_key_value ? variable.protected : false - id_input_name = "#{form_field}[variables_attributes][][id]" - destroy_input_name = "#{form_field}[variables_attributes][][_destroy]" diff --git a/spec/javascripts/ci_variable_list/ci_variable_list_spec.js b/spec/javascripts/ci_variable_list/ci_variable_list_spec.js index 6ab7b50e035..8acb346901f 100644 --- a/spec/javascripts/ci_variable_list/ci_variable_list_spec.js +++ b/spec/javascripts/ci_variable_list/ci_variable_list_spec.js @@ -126,7 +126,7 @@ describe('VariableList', () => { // Check for the correct default in the new row const $protectedInput = $wrapper.find('.js-row:last-child').find('.js-ci-variable-input-protected'); - expect($protectedInput.val()).toBe('true'); + expect($protectedInput.val()).toBe('false'); }) .then(done) .catch(done.fail); diff --git a/spec/support/features/variable_list_shared_examples.rb b/spec/support/features/variable_list_shared_examples.rb index 83bf06b6727..4315bf5d037 100644 --- a/spec/support/features/variable_list_shared_examples.rb +++ b/spec/support/features/variable_list_shared_examples.rb @@ -41,13 +41,13 @@ shared_examples 'variable list' do end end - it 'adds new unprotected variable' do + it 'adds new protected variable' do page.within('.js-ci-variable-list-section .js-row:last-child') do find('.js-ci-variable-input-key').set('key') find('.js-ci-variable-input-value').set('key value') find('.ci-variable-protected-item .js-project-feature-toggle').click - expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false') + expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true') end click_button('Save variables') @@ -59,7 +59,7 @@ shared_examples 'variable list' do page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do expect(find('.js-ci-variable-input-key').value).to eq('key') expect(find('.js-ci-variable-input-value', visible: false).value).to eq('key value') - expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false') + expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true') end end @@ -143,7 +143,6 @@ shared_examples 'variable list' do page.within('.js-ci-variable-list-section .js-row:last-child') do find('.js-ci-variable-input-key').set('unprotected_key') find('.js-ci-variable-input-value').set('unprotected_value') - find('.ci-variable-protected-item .js-project-feature-toggle').click expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false') end @@ -178,6 +177,7 @@ shared_examples 'variable list' do page.within('.js-ci-variable-list-section .js-row:last-child') do find('.js-ci-variable-input-key').set('protected_key') find('.js-ci-variable-input-value').set('protected_value') + find('.ci-variable-protected-item .js-project-feature-toggle').click expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true') end -- cgit v1.2.1 From 118619ea8203d0d4b9da119238a7486075e87f99 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 9 Feb 2018 18:25:58 +0000 Subject: Convert groups_select ajax to use axios --- app/assets/javascripts/groups_select.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/groups_select.js b/app/assets/javascripts/groups_select.js index a69a0bde17b..65a2395fe29 100644 --- a/app/assets/javascripts/groups_select.js +++ b/app/assets/javascripts/groups_select.js @@ -1,5 +1,6 @@ +import axios from './lib/utils/axios_utils'; import Api from './api'; -import { normalizeCRLFHeaders } from './lib/utils/common_utils'; +import { normalizeHeaders } from './lib/utils/common_utils'; export default function groupsSelect() { // Needs to be accessible in rspec @@ -17,24 +18,23 @@ export default function groupsSelect() { dataType: 'json', quietMillis: 250, transport(params) { - return $.ajax(params) - .then((data, status, xhr) => { - const results = data || []; - - const headers = normalizeCRLFHeaders(xhr.getAllResponseHeaders()); + axios[params.type.toLowerCase()](params.url, { + params: params.data, + }) + .then((res) => { + const results = res.data || []; + const headers = normalizeHeaders(res.headers); const currentPage = parseInt(headers['X-PAGE'], 10) || 0; const totalPages = parseInt(headers['X-TOTAL-PAGES'], 10) || 0; const more = currentPage < totalPages; - return { + params.success({ results, pagination: { more, }, - }; - }) - .then(params.success) - .fail(params.error); + }); + }).catch(params.error); }, data(search, page) { return { -- cgit v1.2.1 From d637f87f88b40704291d7a01032af09853afb4e4 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Fri, 9 Feb 2018 17:07:20 +0000 Subject: Makes close/reopen issue request to inside the vue app --- app/assets/javascripts/issue.js | 75 ++++++++++++++-------- .../javascripts/notes/components/comment_form.vue | 28 ++++---- app/assets/javascripts/notes/index.js | 2 + .../javascripts/notes/services/notes_service.js | 3 + app/assets/javascripts/notes/stores/actions.js | 33 ++++++++++ app/assets/javascripts/notes/stores/getters.js | 1 + .../javascripts/notes/stores/mutation_types.js | 4 ++ app/assets/javascripts/notes/stores/mutations.js | 8 +++ app/views/projects/issues/_discussion.html.haml | 2 + changelogs/unreleased/42923-close-issue.yml | 5 ++ spec/javascripts/notes/helpers.js | 12 ++++ spec/javascripts/notes/mock_data.js | 2 + spec/javascripts/notes/stores/actions_spec.js | 71 ++++++++++++++++++++ 13 files changed, 206 insertions(+), 40 deletions(-) create mode 100644 changelogs/unreleased/42923-close-issue.yml create mode 100644 spec/javascripts/notes/helpers.js diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js index ff65ea99e9a..1bf3dc1da91 100644 --- a/app/assets/javascripts/issue.js +++ b/app/assets/javascripts/issue.js @@ -25,6 +25,51 @@ export default class Issue { if (Issue.createMrDropdownWrap) { this.createMergeRequestDropdown = new CreateMergeRequestDropdown(Issue.createMrDropdownWrap); } + + // Listen to state changes in the Vue app + document.addEventListener('issuable_vue_app:change', (event) => { + this.updateTopState(event.detail.isClosed, event.detail.data); + }); + } + + /** + * This method updates the top area of the issue. + * + * Once the issue state changes, either through a click on the top area (jquery) + * or a click on the bottom area (Vue) we need to update the top area. + * + * @param {Boolean} isClosed + * @param {Array} data + * @param {String} issueFailMessage + */ + updateTopState(isClosed, data, issueFailMessage = 'Unable to update this issue at this time.') { + if ('id' in data) { + const isClosedBadge = $('div.status-box-issue-closed'); + const isOpenBadge = $('div.status-box-open'); + const projectIssuesCounter = $('.issue_counter'); + + isClosedBadge.toggleClass('hidden', !isClosed); + isOpenBadge.toggleClass('hidden', isClosed); + + $(document).trigger('issuable:change', isClosed); + this.toggleCloseReopenButton(isClosed); + + let numProjectIssues = Number(projectIssuesCounter.first().text().trim().replace(/[^\d]/, '')); + numProjectIssues = isClosed ? numProjectIssues - 1 : numProjectIssues + 1; + projectIssuesCounter.text(addDelimiter(numProjectIssues)); + + if (this.createMergeRequestDropdown) { + if (isClosed) { + this.createMergeRequestDropdown.unavailable(); + this.createMergeRequestDropdown.disable(); + } else { + // We should check in case a branch was created in another tab + this.createMergeRequestDropdown.checkAbilityToCreateBranch(); + } + } + } else { + flash(issueFailMessage); + } } initIssueBtnEventListeners() { @@ -45,34 +90,8 @@ export default class Issue { url = $button.attr('href'); return axios.put(url) .then(({ data }) => { - const isClosedBadge = $('div.status-box-issue-closed'); - const isOpenBadge = $('div.status-box-open'); - const projectIssuesCounter = $('.issue_counter'); - - if ('id' in data) { - const isClosed = $button.hasClass('btn-close'); - isClosedBadge.toggleClass('hidden', !isClosed); - isOpenBadge.toggleClass('hidden', isClosed); - - $(document).trigger('issuable:change', isClosed); - this.toggleCloseReopenButton(isClosed); - - let numProjectIssues = Number(projectIssuesCounter.first().text().trim().replace(/[^\d]/, '')); - numProjectIssues = isClosed ? numProjectIssues - 1 : numProjectIssues + 1; - projectIssuesCounter.text(addDelimiter(numProjectIssues)); - - if (this.createMergeRequestDropdown) { - if (isClosed) { - this.createMergeRequestDropdown.unavailable(); - this.createMergeRequestDropdown.disable(); - } else { - // We should check in case a branch was created in another tab - this.createMergeRequestDropdown.checkAbilityToCreateBranch(); - } - } - } else { - flash(issueFailMessage); - } + const isClosed = $button.hasClass('btn-close'); + this.updateTopState(isClosed, data); }) .catch(() => flash(issueFailMessage)) .then(() => { diff --git a/app/assets/javascripts/notes/components/comment_form.vue b/app/assets/javascripts/notes/components/comment_form.vue index 3c8452ac808..7b54edb0c2a 100644 --- a/app/assets/javascripts/notes/components/comment_form.vue +++ b/app/assets/javascripts/notes/components/comment_form.vue @@ -2,6 +2,7 @@ import { mapActions, mapGetters } from 'vuex'; import _ from 'underscore'; import Autosize from 'autosize'; + import { __ } from '~/locale'; import Flash from '../../flash'; import Autosave from '../../autosave'; import TaskList from '../../task_list'; @@ -30,9 +31,6 @@ return { note: '', noteType: constants.COMMENT, - // Can't use mapGetters, - // this needs to be in the data object because it belongs to the state - issueState: this.$store.getters.getNoteableData.state, isSubmitting: false, isSubmitButtonDisabled: true, }; @@ -43,7 +41,11 @@ 'getUserData', 'getNoteableData', 'getNotesData', + 'getIssueState', ]), + issueState() { + return this.getIssueState; + }, isLoggedIn() { return this.getUserData.id; }, @@ -71,8 +73,6 @@ return { 'btn-reopen': !this.isIssueOpen, 'btn-close': this.isIssueOpen, - 'js-note-target-close': this.isIssueOpen, - 'js-note-target-reopen': !this.isIssueOpen, }; }, markdownDocsPath() { @@ -105,7 +105,7 @@ mounted() { // jQuery is needed here because it is a custom event being dispatched with jQuery. $(document).on('issuable:change', (e, isClosed) => { - this.issueState = isClosed ? constants.CLOSED : constants.REOPENED; + this.toggleIssueLocalState(isClosed ? constants.CLOSED : constants.REOPENED); }); this.initAutoSave(); @@ -117,6 +117,9 @@ 'stopPolling', 'restartPolling', 'removePlaceholderNotes', + 'closeIssue', + 'reopenIssue', + 'toggleIssueLocalState', ]), setIsSubmitButtonDisabled(note, isSubmitting) { if (!_.isEmpty(note) && !isSubmitting) { @@ -185,12 +188,13 @@ Please check your network connection and try again.`; } }, toggleIssueState() { - this.issueState = this.isIssueOpen ? constants.CLOSED : constants.REOPENED; - - // This is out of scope for the Notes Vue component. - // It was the shortest path to update the issue state and relevant places. - const btnClass = this.isIssueOpen ? 'btn-reopen' : 'btn-close'; - $(`.js-btn-issue-action.${btnClass}:visible`).trigger('click'); + if (this.isIssueOpen) { + this.closeIssue() + .catch(() => Flash(__('Something went wrong while closing the issue. Please try again later'))); + } else { + this.reopenIssue() + .catch(() => Flash(__('Something went wrong while reopening the issue. Please try again later'))); + } }, discard(shouldClear = true) { // `blur` is needed to clear slash commands autocomplete cache if event fired. diff --git a/app/assets/javascripts/notes/index.js b/app/assets/javascripts/notes/index.js index d250dd8d25b..48e7cfddb63 100644 --- a/app/assets/javascripts/notes/index.js +++ b/app/assets/javascripts/notes/index.js @@ -28,6 +28,8 @@ document.addEventListener('DOMContentLoaded', () => new Vue({ notesPath: notesDataset.notesPath, markdownDocsPath: notesDataset.markdownDocsPath, quickActionsDocsPath: notesDataset.quickActionsDocsPath, + closeIssuePath: notesDataset.closeIssuePath, + reopenIssuePath: notesDataset.reopenIssuePath, }, }; }, diff --git a/app/assets/javascripts/notes/services/notes_service.js b/app/assets/javascripts/notes/services/notes_service.js index b51b0cb2013..b8e7ffc8c46 100644 --- a/app/assets/javascripts/notes/services/notes_service.js +++ b/app/assets/javascripts/notes/services/notes_service.js @@ -32,4 +32,7 @@ export default { toggleAward(endpoint, data) { return Vue.http.post(endpoint, data, { emulateJSON: true }); }, + toggleIssueState(endpoint, data) { + return Vue.http.put(endpoint, data); + }, }; diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 085b18642ba..1877d5bf959 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -61,6 +61,39 @@ export const createNewNote = ({ commit }, { endpoint, data }) => service export const removePlaceholderNotes = ({ commit }) => commit(types.REMOVE_PLACEHOLDER_NOTES); +export const closeIssue = ({ commit, dispatch, state }) => service + .toggleIssueState(state.notesData.closeIssuePath) + .then(res => res.json()) + .then((data) => { + commit(types.CLOSE_ISSUE); + dispatch('emitStateChangedEvent', data); + }); + +export const reopenIssue = ({ commit, dispatch, state }) => service + .toggleIssueState(state.notesData.reopenIssuePath) + .then(res => res.json()) + .then((data) => { + commit(types.REOPEN_ISSUE); + dispatch('emitStateChangedEvent', data); + }); + +export const emitStateChangedEvent = ({ commit }, data) => { + const event = new CustomEvent('issuable_vue_app:change', { detail: { + data, + isClosed: data.state === constants.CLOSED, + } }); + + document.dispatchEvent(event); +}; + +export const toggleIssueLocalState = ({ commit }, newState) => { + if (newState === constants.CLOSED) { + commit(types.CLOSE_ISSUE); + } else if (newState === constants.REOPENED) { + commit(types.REOPEN_ISSUE); + } +}; + export const saveNote = ({ commit, dispatch }, noteData) => { const { note } = noteData.data.note; let placeholderText = note; diff --git a/app/assets/javascripts/notes/stores/getters.js b/app/assets/javascripts/notes/stores/getters.js index e18b277119e..38b48c3bbe4 100644 --- a/app/assets/javascripts/notes/stores/getters.js +++ b/app/assets/javascripts/notes/stores/getters.js @@ -8,6 +8,7 @@ export const getNotesDataByProp = state => prop => state.notesData[prop]; export const getNoteableData = state => state.noteableData; export const getNoteableDataByProp = state => prop => state.noteableData[prop]; +export const getIssueState = state => state.noteableData.state; export const getUserData = state => state.userData || {}; export const getUserDataByProp = state => prop => state.userData && state.userData[prop]; diff --git a/app/assets/javascripts/notes/stores/mutation_types.js b/app/assets/javascripts/notes/stores/mutation_types.js index d520c197407..6d7c3bbae0f 100644 --- a/app/assets/javascripts/notes/stores/mutation_types.js +++ b/app/assets/javascripts/notes/stores/mutation_types.js @@ -12,3 +12,7 @@ export const SHOW_PLACEHOLDER_NOTE = 'SHOW_PLACEHOLDER_NOTE'; export const TOGGLE_AWARD = 'TOGGLE_AWARD'; export const TOGGLE_DISCUSSION = 'TOGGLE_DISCUSSION'; export const UPDATE_NOTE = 'UPDATE_NOTE'; + +// Issue +export const CLOSE_ISSUE = 'CLOSE_ISSUE'; +export const REOPEN_ISSUE = 'REOPEN_ISSUE'; diff --git a/app/assets/javascripts/notes/stores/mutations.js b/app/assets/javascripts/notes/stores/mutations.js index 20f81a430c2..b3f66578c9a 100644 --- a/app/assets/javascripts/notes/stores/mutations.js +++ b/app/assets/javascripts/notes/stores/mutations.js @@ -152,4 +152,12 @@ export default { noteObj.notes.splice(noteObj.notes.indexOf(comment), 1, note); } }, + + [types.CLOSE_ISSUE](state) { + Object.assign(state.noteableData, { state: constants.CLOSED }); + }, + + [types.REOPEN_ISSUE](state) { + Object.assign(state.noteableData, { state: constants.REOPENED }); + }, }; diff --git a/app/views/projects/issues/_discussion.html.haml b/app/views/projects/issues/_discussion.html.haml index 9779c1985d5..11b5e02f1e0 100644 --- a/app/views/projects/issues/_discussion.html.haml +++ b/app/views/projects/issues/_discussion.html.haml @@ -12,6 +12,8 @@ markdown_docs_path: help_page_path('user/markdown'), quick_actions_docs_path: help_page_path('user/project/quick_actions'), notes_path: notes_url, + close_issue_path: issue_path(@issue, issue: { state_event: :close }, format: 'json'), + reopen_issue_path: issue_path(@issue, issue: { state_event: :reopen }, format: 'json'), last_fetched_at: Time.now.to_i, noteable_data: serialize_issuable(@issue), current_user_data: UserSerializer.new.represent(current_user, only_path: true).to_json } } diff --git a/changelogs/unreleased/42923-close-issue.yml b/changelogs/unreleased/42923-close-issue.yml new file mode 100644 index 00000000000..e332bbf5dec --- /dev/null +++ b/changelogs/unreleased/42923-close-issue.yml @@ -0,0 +1,5 @@ +--- +title: Fix close button on issues not working on mobile +merge_request: +author: +type: fixed diff --git a/spec/javascripts/notes/helpers.js b/spec/javascripts/notes/helpers.js new file mode 100644 index 00000000000..a7663710a56 --- /dev/null +++ b/spec/javascripts/notes/helpers.js @@ -0,0 +1,12 @@ +// eslint-disable-next-line import/prefer-default-export +export const resetStore = (store) => { + store.replaceState({ + notes: [], + targetNoteHash: null, + lastFetchedAt: null, + + notesData: {}, + userData: {}, + noteableData: {}, + }); +}; diff --git a/spec/javascripts/notes/mock_data.js b/spec/javascripts/notes/mock_data.js index f0c800c759d..ccf4bd070c2 100644 --- a/spec/javascripts/notes/mock_data.js +++ b/spec/javascripts/notes/mock_data.js @@ -7,6 +7,8 @@ export const notesDataMock = { notesPath: '/gitlab-org/gitlab-ce/noteable/issue/98/notes', quickActionsDocsPath: '/help/user/project/quick_actions', registerPath: '/users/sign_in?redirect_to_referer=yes#register-pane', + closeIssuePath: '/twitter/flight/issues/9.json?issue%5Bstate_event%5D=close', + reopenIssuePath: '/twitter/flight/issues/9.json?issue%5Bstate_event%5D=reopen', }; export const userDataMock = { diff --git a/spec/javascripts/notes/stores/actions_spec.js b/spec/javascripts/notes/stores/actions_spec.js index e092320f9a3..6508f4772d2 100644 --- a/spec/javascripts/notes/stores/actions_spec.js +++ b/spec/javascripts/notes/stores/actions_spec.js @@ -1,8 +1,16 @@ +import Vue from 'vue'; +import _ from 'underscore'; import * as actions from '~/notes/stores/actions'; +import store from '~/notes/stores'; import testAction from '../../helpers/vuex_action_helper'; +import { resetStore } from '../helpers'; import { discussionMock, notesDataMock, userDataMock, noteableDataMock, individualNote } from '../mock_data'; describe('Actions Notes Store', () => { + afterEach(() => { + resetStore(store); + }); + describe('setNotesData', () => { it('should set received notes data', (done) => { testAction(actions.setNotesData, null, { notesData: {} }, [ @@ -58,4 +66,67 @@ describe('Actions Notes Store', () => { ], done); }); }); + + describe('async methods', () => { + const interceptor = (request, next) => { + next(request.respondWith(JSON.stringify({}), { + status: 200, + })); + }; + + beforeEach(() => { + Vue.http.interceptors.push(interceptor); + }); + + afterEach(() => { + Vue.http.interceptors = _.without(Vue.http.interceptors, interceptor); + }); + + describe('closeIssue', () => { + it('sets state as closed', (done) => { + store.dispatch('closeIssue', { notesData: { closeIssuePath: '' } }) + .then(() => { + expect(store.state.noteableData.state).toEqual('closed'); + done(); + }) + .catch(done.fail); + }); + }); + + describe('reopenIssue', () => { + it('sets state as reopened', (done) => { + store.dispatch('reopenIssue', { notesData: { reopenIssuePath: '' } }) + .then(() => { + expect(store.state.noteableData.state).toEqual('reopened'); + done(); + }) + .catch(done.fail); + }); + }); + }); + + describe('emitStateChangedEvent', () => { + it('emits an event on the document', () => { + document.addEventListener('issuable_vue_app:change', (event) => { + expect(event.detail.data).toEqual({ id: '1', state: 'closed' }); + expect(event.detail.isClosed).toEqual(true); + }); + + store.dispatch('emitStateChangedEvent', { id: '1', state: 'closed' }); + }); + }); + + describe('toggleIssueLocalState', () => { + it('sets issue state as closed', (done) => { + testAction(actions.toggleIssueLocalState, 'closed', {}, [ + { type: 'CLOSE_ISSUE', payload: 'closed' }, + ], done); + }); + + it('sets issue state as reopened', (done) => { + testAction(actions.toggleIssueLocalState, 'reopened', {}, [ + { type: 'REOPEN_ISSUE', payload: 'reopened' }, + ], done); + }); + }); }); -- cgit v1.2.1 From f7401f70734446d082ba815477ae11a31fe7524b Mon Sep 17 00:00:00 2001 From: Onuwa Nnachi Isaac Date: Fri, 9 Feb 2018 20:05:51 +0100 Subject: Fix breadcrumb on labels page for groups --- app/helpers/groups_helper.rb | 2 +- app/views/groups/labels/new.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 23de3590b93..d248c556234 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -39,7 +39,7 @@ module GroupsHelper full_title += render "layouts/nav/breadcrumbs/collapsed_dropdown", location: :before, title: _("Show parent subgroups") full_title += breadcrumb_list_item group_title_link(group) - full_title += ' · '.html_safe + link_to(simple_sanitize(name), url, class: 'group-path breadcrumb-item-text js-breadcrumb-item-text') if name + full_title += ''.html_safe + link_to(simple_sanitize(name), url, class: 'group-path breadcrumb-item-text js-breadcrumb-item-text') if name full_title.html_safe end diff --git a/app/views/groups/labels/new.html.haml b/app/views/groups/labels/new.html.haml index ae240490bbd..934ebe11c73 100644 --- a/app/views/groups/labels/new.html.haml +++ b/app/views/groups/labels/new.html.haml @@ -1,6 +1,6 @@ - breadcrumb_title "Labels" - page_title 'New Label' -- header_title group_title(@group, 'Labels', group_labels_path(@group)) +- header_title group_title(@group, '', group_labels_path(@group)) %h3.page-title New Label -- cgit v1.2.1 From 56a41ceb7aa3250c4ac7e6fc466a1ddb6bceda25 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 9 Feb 2018 13:14:29 -0600 Subject: Resolve failures in GitHub-ish import controller specs --- .../controllers/githubish_import_controller_shared_examples.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/support/controllers/githubish_import_controller_shared_examples.rb b/spec/support/controllers/githubish_import_controller_shared_examples.rb index e848efd402f..3321f920666 100644 --- a/spec/support/controllers/githubish_import_controller_shared_examples.rb +++ b/spec/support/controllers/githubish_import_controller_shared_examples.rb @@ -333,7 +333,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do it 'does not create a new namespace under the user namespace' do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, user.namespace, user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: build_stubbed(:project))) expect { post :create, { target_namespace: "#{user.namespace_path}/test_group", new_name: test_name, format: :js } } .not_to change { Namespace.count } @@ -347,7 +347,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do it 'does not take the selected namespace and name' do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, user.namespace, user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: build_stubbed(:project))) post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :js } end @@ -355,7 +355,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do it 'does not create the namespaces' do allow(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, kind_of(Namespace), user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: build_stubbed(:project))) expect { post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :js } } .not_to change { Namespace.count } @@ -372,7 +372,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do expect(Gitlab::LegacyGithubImport::ProjectCreator) .to receive(:new).with(provider_repo, test_name, group, user, access_params, type: provider) - .and_return(double(execute: true)) + .and_return(double(execute: build_stubbed(:project))) post :create, { target_namespace: 'foo', new_name: test_name, format: :js } end -- cgit v1.2.1 From 43876e5c8ce563abb46bc84c185ba46dcaaa7905 Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Fri, 9 Feb 2018 21:35:32 +0100 Subject: Remove confirmation_input --- .../vue_shared/components/confirmation_input.vue | 62 --------------------- .../components/confirmation_input_spec.js | 63 ---------------------- 2 files changed, 125 deletions(-) delete mode 100644 app/assets/javascripts/vue_shared/components/confirmation_input.vue delete mode 100644 spec/javascripts/vue_shared/components/confirmation_input_spec.js diff --git a/app/assets/javascripts/vue_shared/components/confirmation_input.vue b/app/assets/javascripts/vue_shared/components/confirmation_input.vue deleted file mode 100644 index 1aa03ea6317..00000000000 --- a/app/assets/javascripts/vue_shared/components/confirmation_input.vue +++ /dev/null @@ -1,62 +0,0 @@ - - - diff --git a/spec/javascripts/vue_shared/components/confirmation_input_spec.js b/spec/javascripts/vue_shared/components/confirmation_input_spec.js deleted file mode 100644 index a6a12614e77..00000000000 --- a/spec/javascripts/vue_shared/components/confirmation_input_spec.js +++ /dev/null @@ -1,63 +0,0 @@ -import Vue from 'vue'; -import confirmationInput from '~/vue_shared/components/confirmation_input.vue'; -import mountComponent from '../../helpers/vue_mount_component_helper'; - -describe('Confirmation input component', () => { - const Component = Vue.extend(confirmationInput); - const props = { - inputId: 'dummy-id', - confirmationKey: 'confirmation-key', - confirmationValue: 'confirmation-value', - }; - let vm; - - afterEach(() => { - vm.$destroy(); - }); - - describe('props', () => { - beforeEach(() => { - vm = mountComponent(Component, props); - }); - - it('sets id of the input field to inputId', () => { - expect(vm.$refs.enteredValue.id).toBe(props.inputId); - }); - - it('sets name of the input field to confirmationKey', () => { - expect(vm.$refs.enteredValue.name).toBe(props.confirmationKey); - }); - }); - - describe('computed', () => { - describe('inputLabel', () => { - it('escapes confirmationValue by default', () => { - vm = mountComponent(Component, { ...props, confirmationValue: 'nds escap"ng' }); - expect(vm.inputLabel).toBe('Type n<e></e>ds escap"ng to confirm:'); - }); - - it('does not escape confirmationValue if escapeValue is false', () => { - vm = mountComponent(Component, { ...props, confirmationValue: 'nds escap"ng', shouldEscapeConfirmationValue: false }); - expect(vm.inputLabel).toBe('Type nds escap"ng to confirm:'); - }); - }); - }); - - describe('methods', () => { - describe('hasCorrectValue', () => { - beforeEach(() => { - vm = mountComponent(Component, props); - }); - - it('returns false if entered value is incorrect', () => { - vm.$refs.enteredValue.value = 'incorrect'; - expect(vm.hasCorrectValue()).toBe(false); - }); - - it('returns true if entered value is correct', () => { - vm.$refs.enteredValue.value = props.confirmationValue; - expect(vm.hasCorrectValue()).toBe(true); - }); - }); - }); -}); -- cgit v1.2.1 From 0d9107374a2caddea61351d2fd5ba619cb69df81 Mon Sep 17 00:00:00 2001 From: Ahmad Sherif Date: Fri, 9 Feb 2018 18:58:29 +0100 Subject: Return a warning string if we try to encode to unsupported encoding Fixes gitlab-development-kit#321 --- lib/gitlab/encoding_helper.rb | 6 +++--- spec/lib/gitlab/encoding_helper_spec.rb | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/encoding_helper.rb b/lib/gitlab/encoding_helper.rb index c0edcabc6fd..6659efa0961 100644 --- a/lib/gitlab/encoding_helper.rb +++ b/lib/gitlab/encoding_helper.rb @@ -28,9 +28,9 @@ module Gitlab # encode and clean the bad chars message.replace clean(message) - rescue ArgumentError - return nil - rescue + rescue ArgumentError => e + return unless e.message.include?('unknown encoding name') + encoding = detect ? detect[:encoding] : "unknown" "--broken encoding: #{encoding}" end diff --git a/spec/lib/gitlab/encoding_helper_spec.rb b/spec/lib/gitlab/encoding_helper_spec.rb index 4e9367323cb..83d431a7458 100644 --- a/spec/lib/gitlab/encoding_helper_spec.rb +++ b/spec/lib/gitlab/encoding_helper_spec.rb @@ -24,6 +24,11 @@ describe Gitlab::EncodingHelper do 'removes invalid bytes from ASCII-8bit encoded multibyte string. This can occur when a git diff match line truncates in the middle of a multibyte character. This occurs after the second word in this example. The test string is as short as we can get while still triggering the error condition when not looking at `detect[:confidence]`.', "mu ns\xC3\n Lorem ipsum dolor sit amet, consectetur adipisicing ut\xC3\xA0y\xC3\xB9abcd\xC3\xB9efg kia elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non p\n {: .normal_pn}\n \n-Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in\n# *Lorem ipsum\xC3\xB9l\xC3\xB9l\xC3\xA0 dolor\xC3\xB9k\xC3\xB9 sit\xC3\xA8b\xC3\xA8 N\xC3\xA8 amet b\xC3\xA0d\xC3\xAC*\n+# *consectetur\xC3\xB9l\xC3\xB9l\xC3\xA0 adipisicing\xC3\xB9k\xC3\xB9 elit\xC3\xA8b\xC3\xA8 N\xC3\xA8 sed do\xC3\xA0d\xC3\xAC*{: .italic .smcaps}\n \n \xEF\x9B\xA1 eiusmod tempor incididunt, ut\xC3\xAAn\xC3\xB9 labore et dolore. Tw\xC4\x83nj\xC3\xAC magna aliqua. Ut enim ad minim veniam\n {: .normal}\n@@ -9,5 +9,5 @@ quis nostrud\xC3\xAAt\xC3\xB9 exercitiation ullamco laboris m\xC3\xB9s\xC3\xB9k\xC3\xB9abc\xC3\xB9 nisi ".force_encoding('ASCII-8BIT'), "mu ns\n Lorem ipsum dolor sit amet, consectetur adipisicing ut\xC3\xA0y\xC3\xB9abcd\xC3\xB9efg kia elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non p\n {: .normal_pn}\n \n-Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in\n# *Lorem ipsum\xC3\xB9l\xC3\xB9l\xC3\xA0 dolor\xC3\xB9k\xC3\xB9 sit\xC3\xA8b\xC3\xA8 N\xC3\xA8 amet b\xC3\xA0d\xC3\xAC*\n+# *consectetur\xC3\xB9l\xC3\xB9l\xC3\xA0 adipisicing\xC3\xB9k\xC3\xB9 elit\xC3\xA8b\xC3\xA8 N\xC3\xA8 sed do\xC3\xA0d\xC3\xAC*{: .italic .smcaps}\n \n \xEF\x9B\xA1 eiusmod tempor incididunt, ut\xC3\xAAn\xC3\xB9 labore et dolore. Tw\xC4\x83nj\xC3\xAC magna aliqua. Ut enim ad minim veniam\n {: .normal}\n@@ -9,5 +9,5 @@ quis nostrud\xC3\xAAt\xC3\xB9 exercitiation ullamco laboris m\xC3\xB9s\xC3\xB9k\xC3\xB9abc\xC3\xB9 nisi " + ], + [ + 'string with detected encoding that is not supported in Ruby', + "\xFFe,i\xFF,\xB8oi,'\xB8,\xFF,-", + "--broken encoding: IBM420_ltr" ] ].each do |description, test_string, xpect| it description do -- cgit v1.2.1 From 73f999d436b438b61efed262fba70497c40808e9 Mon Sep 17 00:00:00 2001 From: Lars Kumbier Date: Sat, 10 Feb 2018 16:15:15 +0100 Subject: Fixes an invalid documentation for the .gitlab-ci.yml cache:key --- doc/ci/yaml/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 4a650303d45..80ab63468f2 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -276,7 +276,7 @@ To enable per-branch caching: ```yaml cache: - key: "$CI_COMMIT_REF_NAME" + key: "$CI_COMMIT_REF_SLUG" untracked: true ``` @@ -284,7 +284,7 @@ To enable per-job and per-branch caching: ```yaml cache: - key: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME" + key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" untracked: true ``` @@ -292,7 +292,7 @@ To enable per-branch and per-stage caching: ```yaml cache: - key: "$CI_JOB_STAGE-$CI_COMMIT_REF_NAME" + key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG" untracked: true ``` @@ -301,7 +301,7 @@ If you use **Windows Batch** to run your shell scripts you need to replace ```yaml cache: - key: "%CI_JOB_STAGE%-%CI_COMMIT_REF_NAME%" + key: "%CI_JOB_STAGE%-%CI_COMMIT_REF_SLUG%" untracked: true ``` @@ -310,7 +310,7 @@ If you use **Windows PowerShell** to run your shell scripts you need to replace ```yaml cache: - key: "$env:CI_JOB_STAGE-$env:CI_COMMIT_REF_NAME" + key: "$env:CI_JOB_STAGE-$env:CI_COMMIT_REF_SLUG" untracked: true ``` -- cgit v1.2.1 From 6771108d6fc31947c0c2d060ead5739bd84983d3 Mon Sep 17 00:00:00 2001 From: Ben Bodenmiller Date: Sun, 11 Feb 2018 06:31:31 +0000 Subject: Remove double negative --- doc/administration/operations/fast_ssh_key_lookup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/administration/operations/fast_ssh_key_lookup.md b/doc/administration/operations/fast_ssh_key_lookup.md index 9d1589d84aa..a795d5116ea 100644 --- a/doc/administration/operations/fast_ssh_key_lookup.md +++ b/doc/administration/operations/fast_ssh_key_lookup.md @@ -56,7 +56,7 @@ new one, and attempting to pull a repo. > **Warning:** Do not disable writes until SSH is confirmed to be working perfectly, because the file will quickly become out-of-date. -In the case of lookup failures (which are not uncommon), the `authorized_keys` +In the case of lookup failures (which are common), the `authorized_keys` file will still be scanned. So git SSH performance will still be slow for many users as long as a large file exists. -- cgit v1.2.1 From dc8cf732078dc03af52e4821683ea1c04946091e Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 10 Feb 2018 14:20:44 -0800 Subject: GitLab QA: Add GITLAB_USER_TYPE to support different login types (e.g. standard, LDAP) GITLAB_USERNAME and GITLAB_PASSWORD may be specified for an LDAP login, but QA scenarios may need to know which type it is in order to log in successfully. --- qa/README.md | 6 ++++++ qa/qa/page/main/login.rb | 10 +++++++++- qa/qa/runtime/env.rb | 10 ++++++++++ qa/qa/runtime/user.rb | 4 ++++ qa/spec/runtime/env_spec.rb | 21 +++++++++++++++++++++ 5 files changed, 50 insertions(+), 1 deletion(-) diff --git a/qa/README.md b/qa/README.md index 44f3e262f4d..3a99a30d379 100644 --- a/qa/README.md +++ b/qa/README.md @@ -78,6 +78,12 @@ If your user doesn't have permission to default sandbox group GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password GITLAB_SANDBOX_NAME=jsmith-qa-sandbox bin/qa Test::Instance https://gitlab.example.com ``` +In addition, the `GITLAB_USER_TYPE` can be set to "ldap" to sign in as an LDAP user: + +``` +GITLAB_USER_TYPE=ldap GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password GITLAB_SANDBOX_NAME=jsmith-qa-sandbox bin/qa Test::Instance https://gitlab.example.com +``` + All [supported environment variables are here](https://gitlab.com/gitlab-org/gitlab-qa#supported-environment-variables). ### Building a Docker image to test diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index fd49b27cb1a..a8a5601dbe6 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -39,6 +39,14 @@ module QA end end + def sign_in_using_credentials + if Runtime::User.ldap_user? + sign_in_using_ldap_credentials + else + sign_in_using_gitlab_credentials + end + end + def sign_in_using_ldap_credentials using_wait_time 0 do set_initial_password_if_present @@ -51,7 +59,7 @@ module QA end end - def sign_in_using_credentials + def sign_in_using_gitlab_credentials using_wait_time 0 do set_initial_password_if_present diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 115d5ee58d1..5401372e225 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -17,6 +17,16 @@ module QA ENV['PERSONAL_ACCESS_TOKEN'] end + # By default, "standard" denotes a standard GitLab user login. + # Set this to "ldap" if the user should be logged in via LDAP. + def user_type + (ENV['GITLAB_USER_TYPE'] || 'standard').tap do |type| + unless %w(ldap standard).include?(type) + raise ArgumentError.new("Invalid user type '#{type}': must be 'ldap' or 'standard'") + end + end + end + def user_username ENV['GITLAB_USERNAME'] end diff --git a/qa/qa/runtime/user.rb b/qa/qa/runtime/user.rb index 6b377f6b287..39e6adf9522 100644 --- a/qa/qa/runtime/user.rb +++ b/qa/qa/runtime/user.rb @@ -10,6 +10,10 @@ module QA def password Runtime::Env.user_password || '5iveL!fe' end + + def ldap_user? + Runtime::Env.user_type == 'ldap' + end end end end diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb index 103573db6be..2b6365dbc41 100644 --- a/qa/spec/runtime/env_spec.rb +++ b/qa/spec/runtime/env_spec.rb @@ -55,4 +55,25 @@ describe QA::Runtime::Env do end end end + + describe '.user_type' do + it 'returns standard if not defined' do + expect(described_class.user_type).to eq('standard') + end + + it 'returns standard as defined' do + stub_env('GITLAB_USER_TYPE', 'standard') + expect(described_class.user_type).to eq('standard') + end + + it 'returns ldap as defined' do + stub_env('GITLAB_USER_TYPE', 'ldap') + expect(described_class.user_type).to eq('ldap') + end + + it 'returns an error if invalid user type' do + stub_env('GITLAB_USER_TYPE', 'foobar') + expect { described_class.user_type }.to raise_error(ArgumentError) + end + end end -- cgit v1.2.1 From 4e732deca8feb3d3c1a0538ddb9a98e3c442bb27 Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Mon, 12 Feb 2018 18:20:52 +1100 Subject: Prevent MR Widget error when no CI configured --- .../javascripts/vue_merge_request_widget/mr_widget_options.js | 1 + changelogs/unreleased/34130-null-pipes.yml | 5 +++++ spec/javascripts/vue_mr_widget/mr_widget_options_spec.js | 9 +++++++++ 3 files changed, 15 insertions(+) create mode 100644 changelogs/unreleased/34130-null-pipes.yml diff --git a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js index edf67fcd0a7..d8f0442ef9d 100644 --- a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js +++ b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js @@ -152,6 +152,7 @@ export default { }, handleNotification(data) { if (data.ci_status === this.mr.ciStatus) return; + if (!data.pipeline) return; const label = data.pipeline.details.status.label; const title = `Pipeline ${label}`; diff --git a/changelogs/unreleased/34130-null-pipes.yml b/changelogs/unreleased/34130-null-pipes.yml new file mode 100644 index 00000000000..a56e5cf8db2 --- /dev/null +++ b/changelogs/unreleased/34130-null-pipes.yml @@ -0,0 +1,5 @@ +--- +title: Prevent MR Widget error when no CI configured +merge_request: +author: +type: fixed diff --git a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js index cd00d0a39a3..45035effe81 100644 --- a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js +++ b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js @@ -295,6 +295,15 @@ describe('mrWidgetOptions', () => { expect(notify.notifyMe).not.toHaveBeenCalled(); }); + + it('should not notify if no pipeline provided', () => { + vm.handleNotification({ + ...data, + pipeline: undefined, + }); + + expect(notify.notifyMe).not.toHaveBeenCalled(); + }); }); describe('resumePolling', () => { -- cgit v1.2.1 From bc2739a52ff9a5366d3d668ef0ee07e91974c540 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 12 Feb 2018 16:43:32 +0800 Subject: Adopt Git style URI --- qa/qa/git/repository.rb | 14 ++++++ .../features/cicd/pull_with_deploy_key_spec.rb | 2 +- qa/spec/git/repository_spec.rb | 52 ++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 qa/spec/git/repository_spec.rb diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb index 8f999511d58..606fc66b4d5 100644 --- a/qa/qa/git/repository.rb +++ b/qa/qa/git/repository.rb @@ -1,3 +1,4 @@ +require 'cgi' require 'uri' module QA @@ -5,6 +6,19 @@ module QA class Repository include Scenario::Actable + # See: config/initializers/1_settings.rb + # Settings#build_gitlab_shell_ssh_path_prefix + def self.parse_uri(git_uri) + if git_uri.start_with?('ssh://') + URI.parse(git_uri) + else + *rest, path = git_uri.split(':') + # Host cannot have : so we'll need to escape it + user_host = rest.join('%3A').sub(/\A\[(.+)\]\z/, '\1') + URI.parse("ssh://#{user_host}/#{path}") + end + end + def self.perform(*args) Dir.mktmpdir do |dir| Dir.chdir(dir) { super } diff --git a/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb b/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb index 39c600aee87..c1fa8d5b58a 100644 --- a/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb +++ b/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb @@ -45,7 +45,7 @@ module QA repository_location end - repository_uri = URI.parse(repository_url) + repository_uri = Git::Repository.parse_uri(repository_url) gitlab_ci = <<~YAML diff --git a/qa/spec/git/repository_spec.rb b/qa/spec/git/repository_spec.rb new file mode 100644 index 00000000000..ae58355d199 --- /dev/null +++ b/qa/spec/git/repository_spec.rb @@ -0,0 +1,52 @@ +describe QA::Git::Repository do + describe '.parse_uri' do + context 'when URI starts with ssh://' do + context 'when URI has port' do + it 'parses correctly' do + uri = described_class + .parse_uri('ssh://git@qa.test:2222/sandbox/qa/repo.git') + + expect(uri.user).to eq('git') + expect(uri.host).to eq('qa.test') + expect(uri.port).to eq(2222) + expect(uri.path).to eq('/sandbox/qa/repo.git') + end + end + + context 'when URI does not have port' do + it 'parses correctly' do + uri = described_class + .parse_uri('ssh://git@qa.test/sandbox/qa/repo.git') + + expect(uri.user).to eq('git') + expect(uri.host).to eq('qa.test') + expect(uri.path).to eq('/sandbox/qa/repo.git') + end + end + end + + context 'when URI does not start with ssh://' do + context 'when host does not have colons' do + it 'parses correctly' do + uri = described_class + .parse_uri('git@qa.test:sandbox/qa/repo.git') + + expect(uri.user).to eq('git') + expect(uri.host).to eq('qa.test') + expect(uri.path).to eq('/sandbox/qa/repo.git') + end + end + + context 'when host has a colon' do + it 'parses correctly' do + uri = described_class + .parse_uri('[git@qa:test]:sandbox/qa/repo.git') + + expect(uri.user).to eq('git') + expect(uri.host).to eq('qa%3Atest') + expect(uri.path).to eq('/sandbox/qa/repo.git') + end + end + end + end +end -- cgit v1.2.1 From 853c80a9f72219d327fba1b92b539871086a08c9 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Mon, 12 Feb 2018 08:54:31 +0000 Subject: Put back class names used in shared test --- app/assets/javascripts/notes/components/comment_form.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/javascripts/notes/components/comment_form.vue b/app/assets/javascripts/notes/components/comment_form.vue index 7b54edb0c2a..c96f3336d28 100644 --- a/app/assets/javascripts/notes/components/comment_form.vue +++ b/app/assets/javascripts/notes/components/comment_form.vue @@ -73,6 +73,8 @@ return { 'btn-reopen': !this.isIssueOpen, 'btn-close': this.isIssueOpen, + 'js-note-target-close': this.isIssueOpen, + 'js-note-target-reopen': !this.isIssueOpen, }; }, markdownDocsPath() { -- cgit v1.2.1 From 525d58303ba21601a03b847316642cf3e8d3c6d9 Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Tue, 6 Feb 2018 17:20:07 +0200 Subject: Move IssuableTimeTracker vue component --- .../time_tracking/sidebar_time_tracking.js | 4 +- .../components/time_tracking/time_tracker.js | 163 -------------------- .../components/time_tracking/time_tracker.vue | 168 +++++++++++++++++++++ ...or-move-issuable-time-tracker-vue-component.yml | 5 + spec/javascripts/issuable_time_tracker_spec.js | 2 +- 5 files changed, 176 insertions(+), 166 deletions(-) delete mode 100644 app/assets/javascripts/sidebar/components/time_tracking/time_tracker.js create mode 100644 app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue create mode 100644 changelogs/unreleased/refactor-move-issuable-time-tracker-vue-component.yml diff --git a/app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.js b/app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.js index d32fe4abc7d..782e4ba4fad 100644 --- a/app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.js +++ b/app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.js @@ -2,7 +2,7 @@ import _ from 'underscore'; import '~/smart_interval'; -import timeTracker from './time_tracker'; +import IssuableTimeTracker from './time_tracker.vue'; import Store from '../../stores/sidebar_store'; import Mediator from '../../sidebar_mediator'; @@ -16,7 +16,7 @@ export default { }; }, components: { - 'issuable-time-tracker': timeTracker, + IssuableTimeTracker, }, methods: { listenForQuickActions() { diff --git a/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.js b/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.js deleted file mode 100644 index 866178e2b23..00000000000 --- a/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.js +++ /dev/null @@ -1,163 +0,0 @@ -import timeTrackingHelpState from './help_state'; -import timeTrackingCollapsedState from './collapsed_state'; -import timeTrackingSpentOnlyPane from './spent_only_pane'; -import timeTrackingNoTrackingPane from './no_tracking_pane'; -import timeTrackingEstimateOnlyPane from './estimate_only_pane'; -import timeTrackingComparisonPane from './comparison_pane'; - -import eventHub from '../../event_hub'; - -export default { - name: 'issuable-time-tracker', - props: { - time_estimate: { - type: Number, - required: true, - }, - time_spent: { - type: Number, - required: true, - }, - human_time_estimate: { - type: String, - required: false, - default: '', - }, - human_time_spent: { - type: String, - required: false, - default: '', - }, - rootPath: { - type: String, - required: true, - }, - }, - data() { - return { - showHelp: false, - }; - }, - components: { - 'time-tracking-collapsed-state': timeTrackingCollapsedState, - 'time-tracking-estimate-only-pane': timeTrackingEstimateOnlyPane, - 'time-tracking-spent-only-pane': timeTrackingSpentOnlyPane, - 'time-tracking-no-tracking-pane': timeTrackingNoTrackingPane, - 'time-tracking-comparison-pane': timeTrackingComparisonPane, - 'time-tracking-help-state': timeTrackingHelpState, - }, - computed: { - timeSpent() { - return this.time_spent; - }, - timeEstimate() { - return this.time_estimate; - }, - timeEstimateHumanReadable() { - return this.human_time_estimate; - }, - timeSpentHumanReadable() { - return this.human_time_spent; - }, - hasTimeSpent() { - return !!this.timeSpent; - }, - hasTimeEstimate() { - return !!this.timeEstimate; - }, - showComparisonState() { - return this.hasTimeEstimate && this.hasTimeSpent; - }, - showEstimateOnlyState() { - return this.hasTimeEstimate && !this.hasTimeSpent; - }, - showSpentOnlyState() { - return this.hasTimeSpent && !this.hasTimeEstimate; - }, - showNoTimeTrackingState() { - return !this.hasTimeEstimate && !this.hasTimeSpent; - }, - showHelpState() { - return !!this.showHelp; - }, - }, - methods: { - toggleHelpState(show) { - this.showHelp = show; - }, - update(data) { - this.time_estimate = data.time_estimate; - this.time_spent = data.time_spent; - this.human_time_estimate = data.human_time_estimate; - this.human_time_spent = data.human_time_spent; - }, - }, - created() { - eventHub.$on('timeTracker:updateData', this.update); - }, - template: ` -
- -
- {{ __('Time tracking') }} -
-