www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

mathtex-script-type.js (4293B)


      1 (function webpackUniversalModuleDefinition(root, factory) {
      2 	if(typeof exports === 'object' && typeof module === 'object')
      3 		module.exports = factory(require("katex"));
      4 	else if(typeof define === 'function' && define.amd)
      5 		define(["katex"], factory);
      6 	else {
      7 		var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]);
      8 		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
      9 	}
     10 })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__974__) {
     11 return /******/ (function() { // webpackBootstrap
     12 /******/ 	"use strict";
     13 /******/ 	var __webpack_modules__ = ({
     14 
     15 /***/ 974:
     16 /***/ (function(module) {
     17 
     18 module.exports = __WEBPACK_EXTERNAL_MODULE__974__;
     19 
     20 /***/ })
     21 
     22 /******/ 	});
     23 /************************************************************************/
     24 /******/ 	// The module cache
     25 /******/ 	var __webpack_module_cache__ = {};
     26 /******/ 	
     27 /******/ 	// The require function
     28 /******/ 	function __webpack_require__(moduleId) {
     29 /******/ 		// Check if module is in cache
     30 /******/ 		if(__webpack_module_cache__[moduleId]) {
     31 /******/ 			return __webpack_module_cache__[moduleId].exports;
     32 /******/ 		}
     33 /******/ 		// Create a new module (and put it into the cache)
     34 /******/ 		var module = __webpack_module_cache__[moduleId] = {
     35 /******/ 			// no module.id needed
     36 /******/ 			// no module.loaded needed
     37 /******/ 			exports: {}
     38 /******/ 		};
     39 /******/ 	
     40 /******/ 		// Execute the module function
     41 /******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
     42 /******/ 	
     43 /******/ 		// Return the exports of the module
     44 /******/ 		return module.exports;
     45 /******/ 	}
     46 /******/ 	
     47 /************************************************************************/
     48 /******/ 	/* webpack/runtime/compat get default export */
     49 /******/ 	!function() {
     50 /******/ 		// getDefaultExport function for compatibility with non-harmony modules
     51 /******/ 		__webpack_require__.n = function(module) {
     52 /******/ 			var getter = module && module.__esModule ?
     53 /******/ 				function() { return module['default']; } :
     54 /******/ 				function() { return module; };
     55 /******/ 			__webpack_require__.d(getter, { a: getter });
     56 /******/ 			return getter;
     57 /******/ 		};
     58 /******/ 	}();
     59 /******/ 	
     60 /******/ 	/* webpack/runtime/define property getters */
     61 /******/ 	!function() {
     62 /******/ 		// define getter functions for harmony exports
     63 /******/ 		__webpack_require__.d = function(exports, definition) {
     64 /******/ 			for(var key in definition) {
     65 /******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
     66 /******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
     67 /******/ 				}
     68 /******/ 			}
     69 /******/ 		};
     70 /******/ 	}();
     71 /******/ 	
     72 /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
     73 /******/ 	!function() {
     74 /******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
     75 /******/ 	}();
     76 /******/ 	
     77 /************************************************************************/
     78 var __webpack_exports__ = {};
     79 // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
     80 !function() {
     81 /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(974);
     82 /* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
     83 
     84 var scripts = document.body.getElementsByTagName("script");
     85 scripts = Array.prototype.slice.call(scripts);
     86 scripts.forEach(function (script) {
     87   if (!script.type || !script.type.match(/math\/tex/i)) {
     88     return -1;
     89   }
     90 
     91   var display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null;
     92   var katexElement = document.createElement(display ? "div" : "span");
     93   katexElement.setAttribute("class", display ? "equation" : "inline-equation");
     94 
     95   try {
     96     katex__WEBPACK_IMPORTED_MODULE_0___default().render(script.text, katexElement, {
     97       displayMode: display
     98     });
     99   } catch (err) {
    100     //console.error(err); linter doesn't like this
    101     katexElement.textContent = script.text;
    102   }
    103 
    104   script.parentNode.replaceChild(katexElement, script);
    105 });
    106 }();
    107 __webpack_exports__ = __webpack_exports__.default;
    108 /******/ 	return __webpack_exports__;
    109 /******/ })()
    110 ;
    111 });