[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#855137: unblock: mathjax/2.7.0-2



Control: retitle -1 unblock: mathjax/2.7.0-2

Hi, and sorry for the delay.

On Wed, Feb 22, 2017 at 08:58:00PM +0000, Niels Thykier wrote:
> Control: tags -1 confirmed
>
> Hi,
>
> Assuming it is just introducing that package and replacing a file or two
> with a symlink (or a href in HTML), then we are ok with granting the
> exception (assuming it can be implemented in a timely fashion).
>
> Please let us know once the new package is ready and mathjax is updated
> and ready for our review.

Actually I have found a way to implement my original plan. Now the
accessibility-menu.js extension is bundled with MathJax package (so that
it no longer loads any resources via HTTP by default), but when one actually
wants to enable some accessibility features, the corresponding extensions
are loaded via HTTP.

Packaging the whole MathJax-a11y repository is harder than it seemed to me:
it depends on https://github.com/zorkow/speech-rule-engine which is not yet
packaged. So I did not go this way for Stretch.

The new version has just been accepted, the debdiff is attached.

--
Dmitry Shachnev
diff -Nru mathjax-2.7.0/debian/changelog mathjax-2.7.0/debian/changelog
--- mathjax-2.7.0/debian/changelog	2016-10-17 14:16:58.000000000 +0300
+++ mathjax-2.7.0/debian/changelog	2017-03-02 11:10:34.000000000 +0300
@@ -1,3 +1,10 @@
+mathjax (2.7.0-2) unstable; urgency=medium
+
+  * Install accessibility-menu.js into the main extensions directory,
+    and make all configurations load it from there (closes: #854399).
+
+ -- Dmitry Shachnev <mitya57@debian.org>  Thu, 02 Mar 2017 11:10:34 +0300
+
 mathjax (2.7.0-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru mathjax-2.7.0/debian/combiner/combineMJlist mathjax-2.7.0/debian/combiner/combineMJlist
--- mathjax-2.7.0/debian/combiner/combineMJlist	2016-10-17 14:16:58.000000000 +0300
+++ mathjax-2.7.0/debian/combiner/combineMJlist	2017-03-02 11:10:34.000000000 +0300
@@ -55,7 +55,7 @@
 print CONFIG $config;
 
 print CONFIG "MathJax.Hub.Config({\n";
-print CONFIG "  extensions: ['[Contrib]/a11y/accessibility-menu.js']";
+print CONFIG "  extensions: ['accessibility-menu.js']";
 print CONFIG ",\n  ",join("\n  ",@config) if scalar(@config);
 print CONFIG "\n});\n\n";
 
diff -Nru mathjax-2.7.0/debian/combiner/combineMJlist-unpacked mathjax-2.7.0/debian/combiner/combineMJlist-unpacked
--- mathjax-2.7.0/debian/combiner/combineMJlist-unpacked	2016-10-17 14:16:58.000000000 +0300
+++ mathjax-2.7.0/debian/combiner/combineMJlist-unpacked	2017-03-02 11:10:34.000000000 +0300
@@ -42,7 +42,7 @@
   if ($file =~ m!^config/(.*)!) {push(@CONFIG,"\"$1\"")}
 }
 
-push(@EXTENSIONS,'"[Contrib]/a11y/accessibility-menu.js"');
+push(@EXTENSIONS,'"accessibility-menu.js"');
 
 @HUB = ();
 push(@HUB,"config: [".join(",",@CONFIG)."]") if scalar(@CONFIG);
diff -Nru mathjax-2.7.0/debian/patches/local_accessibility_menu.diff mathjax-2.7.0/debian/patches/local_accessibility_menu.diff
--- mathjax-2.7.0/debian/patches/local_accessibility_menu.diff	1970-01-01 03:00:00.000000000 +0300
+++ mathjax-2.7.0/debian/patches/local_accessibility_menu.diff	2017-03-02 11:10:34.000000000 +0300
@@ -0,0 +1,199 @@
+Description: load accessibility-menu.js from local extensions directory
+ This extension was loaded from external source, which is considered a privacy
+ breach. Instead we can install it and load from a local path.
+ .
+ This file is copied from MathJax-a11y repository, the changes are:
+ - replacing the file path in loadComplete call;
+ - using *['default'] instead of *.default to make yui-compressor happy.
+Author: Dmitry Shachnev <mitya57@debian.org>
+Forwarded: not-needed
+Last-Update: 2017-02-28
+
+--- /dev/null
++++ b/unpacked/extensions/accessibility-menu.js
+@@ -0,0 +1,185 @@
++/*************************************************************
++ *
++ *  [Contrib]/a11y/accessibility-menu.js
++ *  
++ *  A thin extension to add opt-in menu items for the accessibility
++ *  extensions in the a11y contributed directory.
++ *
++ *  ---------------------------------------------------------------------
++ *  
++ *  Copyright (c) 2016 The MathJax Consortium
++ * 
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ * 
++ *      http://www.apache.org/licenses/LICENSE-2.0
++ * 
++ *  Unless required by applicable law or agreed to in writing, software
++ *  distributed under the License is distributed on an "AS IS" BASIS,
++ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ *  See the License for the specific language governing permissions and
++ *  limitations under the License.
++ */
++
++(function(HUB,EXTENSIONS) {
++  var SETTINGS = HUB.config.menuSettings;
++  var ITEM, MENU; // filled in when MathMenu extension loads
++  
++  var BIND = (Function.prototype.bind ? function (f,t) {return f.bind(t)} :
++              function (f,t) {return function () {f.apply(t,arguments)}});
++  var KEYS = Object.keys || function (obj) {
++    var keys = [];
++    for (var id in obj) {if (obj.hasOwnProperty(id)) keys.push(id)}
++    return keys;
++  };
++  
++  //
++  //  Set up the a11y path,if it isn't already in place
++  //
++  var PATH = MathJax.Ajax.config.path;
++  if (!PATH.a11y) PATH.a11y =
++      (PATH.Contrib ? PATH.Contrib + "/a11y" : 
++      (String(location.protocol).match(/^https?:/) ? "" : "http:") + 
++        "//cdn.mathjax.org/mathjax/contrib/a11y");
++
++  var Accessibility = EXTENSIONS["accessibility-menu"] = {
++    version: '1.1',
++    prefix: '', //'Accessibility-',
++    'default': {},
++    modules: [],
++    MakeOption: function(name) {
++      return Accessibility.prefix + name;
++    },
++    GetOption: function(option) {
++      return SETTINGS[Accessibility.MakeOption(option)];
++    },
++    AddDefaults: function() {
++      var keys = KEYS(Accessibility['default']);
++      for (var i = 0, key; key = keys[i]; i++) {
++        var option = Accessibility.MakeOption(key);
++        if (typeof(SETTINGS[option]) === 'undefined') {
++          SETTINGS[option] = Accessibility['default'][key];
++        }
++      }
++    },
++    // Attaches the menu items;
++    AddMenu: function() {
++      var items = Array(this.modules.length);
++      for (var i = 0, module; module = this.modules[i]; i++) items[i] = module.placeHolder;
++      var menu = MENU.FindId('Accessibility');
++      if (menu) {
++        items.unshift(ITEM.RULE());
++        menu.submenu.items.push.apply(menu.submenu.items,items);
++      } else {
++        var renderer = (MENU.FindId("Settings","Renderer")||{}).submenu;
++        if (renderer) {
++          // move AssitiveMML and InTabOrder from Renderer to Accessibility menu
++          items.unshift(ITEM.RULE());
++          items.unshift(renderer.items.pop());
++          items.unshift(renderer.items.pop());
++        }
++        items.unshift("Accessibility");
++        var menu = ITEM.SUBMENU.apply(ITEM.SUBMENU,items);
++        var locale = MENU.IndexOfId('Locale');
++        if (locale) {
++          MENU.items.splice(locale,0,menu);
++        } else {
++          MENU.items.push(ITEM.RULE(), menu);
++        }
++      }
++    },
++    Register: function(module) {
++      Accessibility['default'][module.option] = false;
++      Accessibility.modules.push(module);
++    },
++    Startup: function() {
++      ITEM = MathJax.Menu.ITEM;
++      MENU = MathJax.Menu.menu;
++      for (var i = 0, module; module = this.modules[i]; i++) module.CreateMenu();
++      this.AddMenu();
++    },
++    LoadExtensions: function () {
++      var extensions = [];
++      for (var i = 0, module; module = this.modules[i]; i++) {
++        if (SETTINGS[module.option]) extensions.push(module.module);
++      }
++      return (extensions.length ? HUB.Startup.loadArray(extensions) : null);
++    }
++  };
++
++  var ModuleLoader = MathJax.Extension.ModuleLoader = MathJax.Object.Subclass({
++    option: '',
++    name: ['',''],
++    module: '',
++    placeHolder: null,
++    submenu: false,
++    extension: null,
++    Init: function(option, name, module, extension, submenu) {
++      this.option = option;
++      this.name = [name.replace(/ /g,''),name];
++      this.module = module;
++      this.extension = extension;
++      this.submenu = (submenu || false);
++    },
++    CreateMenu: function() {
++      var load = BIND(this.Load,this);
++      if (this.submenu) {
++        this.placeHolder =
++          ITEM.SUBMENU(this.name,
++            ITEM.CHECKBOX(["Activate","Activate"],
++                          Accessibility.MakeOption(this.option), {action: load}),
++            ITEM.RULE(),
++            ITEM.COMMAND(["OptionsWhenActive","(Options when Active)"],null,{disabled:true})
++          );
++      } else {
++        this.placeHolder = ITEM.CHECKBOX(
++          this.name, Accessibility.MakeOption(this.option), {action: load}
++        );
++      }
++    },
++    Load: function() {
++      HUB.Queue(["Require",MathJax.Ajax,this.module,["Enable",this]]);
++    },
++    Enable: function(menu) {
++      var extension = MathJax.Extension[this.extension];
++      if (extension) {
++        extension.Enable(true,true);
++        MathJax.Menu.saveCookie();
++      }
++    }
++  });
++
++  Accessibility.Register(
++    ModuleLoader(
++      'collapsible', 'Collapsible Math', '[a11y]/collapsible.js', 'collapsible'
++    )
++  );
++  Accessibility.Register(
++    ModuleLoader(
++      'autocollapse', 'Auto Collapse', '[a11y]/auto-collapse.js', 'auto-collapse'
++    )
++  );
++  Accessibility.Register(
++    ModuleLoader(
++      'explorer', 'Explorer', '[a11y]/explorer.js', 'explorer', true
++    )
++  );
++
++  Accessibility.AddDefaults();
++  
++  HUB.Register.StartupHook('End Extensions', function () {
++    HUB.Register.StartupHook('MathMenu Ready', function () {
++      Accessibility.Startup();
++      HUB.Startup.signal.Post('Accessibility Menu Ready');
++    },5);   // run before other extensions' menu hooks even if they are loaded first
++  },5);
++  
++  MathJax.Callback.Queue(
++    ["LoadExtensions",Accessibility],
++    ["loadComplete",MathJax.Ajax,"[MathJax]/extensions/accessibility-menu.js"]
++  );
++
++})(MathJax.Hub,MathJax.Extension);
++
++
diff -Nru mathjax-2.7.0/debian/patches/series mathjax-2.7.0/debian/patches/series
--- mathjax-2.7.0/debian/patches/series	2016-10-17 14:16:58.000000000 +0300
+++ mathjax-2.7.0/debian/patches/series	2017-03-02 11:10:34.000000000 +0300
@@ -1,2 +1,3 @@
 no_extra_fonts.diff
 update_url.diff
+local_accessibility_menu.diff
diff -Nru mathjax-2.7.0/debian/README.source mathjax-2.7.0/debian/README.source
--- mathjax-2.7.0/debian/README.source	2016-10-17 14:16:58.000000000 +0300
+++ mathjax-2.7.0/debian/README.source	2017-03-02 11:10:34.000000000 +0300
@@ -7,6 +7,7 @@
 
 * Use Debian yui-compressor path (`/usr/share/yui-compressor/yui-compressor.jar`)
   in `packer/packMJfile`;
+* Use local version of accessibility-menu extension in the combiner lists;
 * Replace current working directory in MathJax with `MathJax` string;
 * Do not require the configuration script.
 

Attachment: signature.asc
Description: PGP signature


Reply to: