829个文件已删除
18个文件已修改
212个文件已添加
| | |
| | | // æ¥è¯¢ä½æ£æ¥ååå¨å表 |
| | | export function getReportList(cusPhone) { |
| | | return request({ |
| | | url: '/cus/getReport/getReportList', |
| | | method: 'get', |
| | | params: { |
| | | cusPhone: cusPhone |
| | | url: '/cus/getReport/tijianjilu', |
| | | method: 'post', |
| | | data: { |
| | | idCard:cusPhone |
| | | } |
| | | }) |
| | | } |
| | |
| | | data:data |
| | | }) |
| | | } |
| | | // æ¥è¯¢ä½æ£æ¥ååå¨è¯¦ç» |
| | | export function getwenzhenxinxi(data) { |
| | | return request({ |
| | | url: '/cus/wx/wenzhenxinxi', |
| | | method: 'post', |
| | | data:data |
| | | }) |
| | | } |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // æ¥è¯¢é¢åºä¿¡æ¯å表 |
| | | export function getTiJianList(cusIdCard) { |
| | | export function getTiJianList(data) { |
| | | return request({ |
| | | url: '/cus/appOrder/getTiJianList?cusIdCard=' + cusIdCard , |
| | | method: 'get', |
| | | url: '/cus/wx/tijianjilu', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | export function getPaiDuiList(data) { |
| | | return request({ |
| | | url: '/cus/wx/tijianjiluxiangqing', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // ä¿®æ¹é®è¯ |
| | | export function getPaiDuiList(tjNumber) { |
| | | return request({ |
| | | url: '/cus/appOrder/getPaiDuiList?tjNumber=' + tjNumber , |
| | | method: 'get', |
| | | }) |
| | | } |
| | |
| | | // baseUrl: 'https://ltpeis.xaltjdkj.cn:5011/ltkj-admin', |
| | | // baseUrl: 'https://ltpeis.xaltjdkj.cn:5021', |
| | | // baseUrl: 'http://ltpeis.xaltjdkj.cn:5801', |
| | | baseUrl: 'http://192.168.1.113:5011', |
| | | baseUrl: 'http://192.168.1.244:5011', |
| | | |
| | | // åºç¨ä¿¡æ¯ |
| | | appInfo: { |
| | |
| | | "node": ">= 0.6" |
| | | } |
| | | }, |
| | | "node_modules/mp-html": { |
| | | "version": "2.5.1", |
| | | "resolved": "https://registry.npmmirror.com/mp-html/-/mp-html-2.5.1.tgz", |
| | | "integrity": "sha512-7BEH8dnQ89kOIyjdoYni8zcc0QAg+lgEWg0n9or9q2D4l26JNG+KPzHfttDyisC/5S7aPBblpXrFTYQv475w/Q==" |
| | | }, |
| | | "node_modules/neo-async": { |
| | | "version": "2.6.2", |
| | | "resolved": "https://registry.npmmirror.com/neo-async/-/neo-async-2.6.2.tgz", |
New file |
| | |
| | | { |
| | | "env": { |
| | | "browser": true, |
| | | "es6": true, |
| | | "node": true |
| | | }, |
| | | "extends": [ |
| | | "eslint:recommended", |
| | | "plugin:vue/essential" |
| | | ], |
| | | "globals": { |
| | | "Component": "readonly", |
| | | "wx": "readonly", |
| | | "qq": "readonly", |
| | | "swan": "readonly", |
| | | "my": "readonly", |
| | | "tt": "readonly", |
| | | "uni": "readonly", |
| | | "plus": "readonly", |
| | | "weex": "readonly", |
| | | "requirePlugin": "readonly" |
| | | }, |
| | | "rules": { |
| | | "semi": [ |
| | | "error", |
| | | "never" |
| | | ], |
| | | "no-console": "error" |
| | | } |
| | | } |
New file |
| | |
| | | --- |
| | | name: æäº¤ Bug |
| | | about: 妿åç°æé¨ååè½è¡¨ç°ä¸ææ¡£æè¿°ä¸ç¬¦æåºéï¼è¯·éæ©æ¤æ¨¡æ¿åé¦ |
| | | title: '' |
| | | labels: '' |
| | | assignees: '' |
| | | |
| | | --- |
| | | |
| | | <!--注æï¼å¿
é¡»ä¸¥æ ¼æç
§ä¸åè¦æ±åé¦ bugï¼ä»¥ä¾¿å°½å¿«ç¡®å®é®é¢å¹¶ä¿®å¤ï¼ä¸ç¬¦åè¦æ±çåé¦ä¸äºå¤ç--> |
| | | |
| | | ## 使ç¨ç¯å¢ |
| | | <!--请注æä½¿ç¨çå°ç¨åºå¹³å°ååºç¡åºçæ¬çç¯å¢ä¿¡æ¯--> |
| | | |
| | | ## é®é¢æè¿° |
| | | <!--è¯·è¯¦ç»æè¿°éå°çé®é¢ï¼å¯ä»¥é䏿ªå¾--> |
| | | |
| | | ## å¤ç°æ¹å¼ |
| | | <!-- |
| | | 注æï¼æ æ³å¤ç°çé®é¢å°ä¸äºå¤ç |
| | | 妿尿¨ä½¿ç¨ç html å
容æ·è´å°ç¤ºä¾é¡¹ç®ä¸å°±è½å¤ç°é®é¢ï¼è¯·å¨ä¸æ¹é䏿¨ä½¿ç¨ç html å
容 |
| | | 妿å¨ç¤ºä¾é¡¹ç®ä¸æ æ³å¤ç°ï¼è¯·éä¸è½å¤å¤ç°ç demo 项ç®å¹¶è¯´æå¤ç°æ¹å¼ |
| | | --> |
New file |
| | |
| | | --- |
| | | name: æ°åè½éæ± |
| | | about: 妿éè¦æäºæ°åè½æææ¹è¿å»ºè®®ï¼è¯·éæ©æ¤æ¨¡æ¿åé¦ |
| | | title: '' |
| | | labels: '' |
| | | assignees: '' |
| | | |
| | | --- |
| | | |
| | | <!--注æï¼æåºçæ°åè½ææ¹è¿å»ºè®®åºæä¸å®çåºç¨åºæ¯åéç¨æ§ï¼å¦ææ¨å·²ç»å®ç°äºæ¹è¿å¯ä»¥ç´æ¥æäº¤ pr--> |
| | | |
| | | ## æ°åè½æè¿° |
| | | |
| | | ## åºç¨åºæ¯ |
New file |
| | |
| | | --- |
| | | name: å¨è¯¢é®é¢ |
| | | about: 妿æ¾ä¸å°ææ¡£å¯¹æåè½çæè¿°ææè¿°ä¸æ¸
ï¼è¯·éæ©æ¤æ¨¡æ¿å¨è¯¢ |
| | | title: '' |
| | | labels: '' |
| | | assignees: '' |
| | | |
| | | --- |
| | | |
| | | <!--注æï¼æé®å请确认已ç»å¨ææ¡£ä¸æ¥æ¾è¿æ²¡æç¸å
³èµææææ¡£æ²¡ææè¿°æ¸
æ¥--> |
| | | |
| | | ## é®é¢æè¿° |
New file |
| | |
| | | { |
| | | "extends": [ |
| | | "stylelint-config-standard", |
| | | "stylelint-config-recess-order" |
| | | ] |
| | | } |
New file |
| | |
| | | MIT License |
| | | |
| | | Copyright (c) 2019-present Jin Yufeng |
| | | |
| | | 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. |
New file |
| | |
| | | # mp-html |
| | | |
| | | > ä¸ä¸ªå¼ºå¤§çå°ç¨åºå¯ææ¬ç»ä»¶ |
| | | |
| | |  |
| | |  |
| | | [](https://www.npmjs.com/package/mp-html) |
| | |  |
| | | [](https://coveralls.io/github/jin-yufeng/mp-html?branch=master) |
| | |  |
| | | [](https://standardjs.com) |
| | | |
| | | ## åè½ä»ç» |
| | | - æ¯æå¨å¤ä¸ªä¸»æµçå°ç¨åºå¹³å°å `uni-app` ä¸ä½¿ç¨ |
| | | - æ¯æä¸°å¯çæ ç¾ï¼å
æ¬ `table`ã`video`ã`svg` çï¼ |
| | | - æ¯æä¸°å¯çäºä»¶ææï¼èªå¨é¢è§å¾çã龿¥å¤ççï¼ |
| | | - æ¯æè®¾ç½®å ä½å¾ï¼å è½½ä¸ãåºéæ¶ãé¢è§æ¶ï¼ |
| | | - æ¯æéç¹è·³è½¬ãé¿æå¤å¶ç丰å¯åè½ |
| | | - æ¯æå¤§é¨å *html* å®ä½ |
| | | - 丰å¯çæä»¶ï¼å
³é®è¯æç´¢ãå
容ç¼è¾ã`latex` å
¬å¼çï¼ |
| | | - æçé«ãå®¹éæ§å¼ºä¸è½»éåï¼`â25KB`ï¼`9KB gzipped`ï¼ |
| | | |
| | | æ¥ç [åè½ä»ç»](https://jin-yufeng.github.io/mp-html/#/overview/feature) äºè§£æ´å¤ |
| | | |
| | | ## ä½¿ç¨æ¹æ³ |
| | | ### åçå¹³å° |
| | | - `npm` æ¹å¼ |
| | | 1. å¨é¡¹ç®ç®å½ä¸å®è£
ç»ä»¶å
|
| | | |
| | | ```bash |
| | | npm install mp-html |
| | | ``` |
| | | 2. å¼åè
å·¥å
·ä¸å¾é `ä½¿ç¨ npm 模å`ï¼è¥æ²¡ææ¤é项åä¸éè¦ï¼å¹¶ç¹å» `å·¥å
· - æå»º npm` |
| | | 3. å¨éè¦ä½¿ç¨é¡µé¢ç `json` æä»¶ä¸æ·»å |
| | | |
| | | ```json |
| | | { |
| | | "usingComponents": { |
| | | "mp-html": "mp-html" |
| | | } |
| | | } |
| | | ``` |
| | | 4. å¨éè¦ä½¿ç¨é¡µé¢ç `wxml` æä»¶ä¸æ·»å |
| | | |
| | | ```html |
| | | <mp-html content="{{html}}" /> |
| | | ``` |
| | | 5. å¨éè¦ä½¿ç¨é¡µé¢ç `js` æä»¶ä¸æ·»å |
| | | |
| | | ```javascript |
| | | Page({ |
| | | onLoad () { |
| | | this.setData({ |
| | | html: '<div>Hello World!</div>' |
| | | }) |
| | | } |
| | | }) |
| | | ``` |
| | | - æºç æ¹å¼ |
| | | 1. å°æºç ä¸å¯¹åºå¹³å°ç代ç å
ï¼`dist/platform`ï¼æ·è´å° `components` ç®å½ä¸ï¼æ´å为 `mp-html` |
| | | 2. å¨éè¦ä½¿ç¨é¡µé¢ç `json` æä»¶ä¸æ·»å |
| | | |
| | | ```json |
| | | { |
| | | "usingComponents": { |
| | | "mp-html": "/components/mp-html/index" |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | åç»æ¥éª¤åä¸ |
| | | |
| | | æ¥ç [å¿«éå¼å§](https://jin-yufeng.github.io/mp-html/#/overview/quickstart) äºè§£æ´å¤ |
| | | |
| | | ### uni-app |
| | | - æºç æ¹å¼ |
| | | 1. å°æºç ä¸ `dist/uni-app` å
çå
容æ·è´å°é¡¹ç®æ ¹ç®å½ä¸ |
| | | å¯ä»¥ç´æ¥éè¿ [æä»¶å¸åº](https://ext.dcloud.net.cn/plugin?id=805) å¼å
¥ |
| | | 2. å¨éè¦ä½¿ç¨é¡µé¢ç `vue` æä»¶ä¸æ·»å |
| | | |
| | | ```vue |
| | | <template> |
| | | <view> |
| | | <mp-html :content="html" /> |
| | | </view> |
| | | </template> |
| | | <script> |
| | | import mpHtml from '@/components/mp-html/mp-html' |
| | | export default { |
| | | // HBuilderX 2.5.5+ å¯ä»¥éè¿ easycom èªå¨å¼å
¥ |
| | | components: { |
| | | mpHtml |
| | | }, |
| | | data () { |
| | | return { |
| | | html: '<div>Hello World!</div>' |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | ``` |
| | | - `npm` æ¹å¼ |
| | | 1. å¨é¡¹ç®ç®å½ä¸å®è£
ç»ä»¶å
|
| | | |
| | | ```bash |
| | | npm install mp-html |
| | | ``` |
| | | 2. å¨éè¦ä½¿ç¨é¡µé¢ç `vue` æä»¶ä¸æ·»å |
| | | |
| | | ```vue |
| | | <template> |
| | | <view> |
| | | <mp-html :content="html" /> |
| | | </view> |
| | | </template> |
| | | <script> |
| | | import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html' |
| | | export default { |
| | | // ä¸å¯çç¥ |
| | | components: { |
| | | mpHtml |
| | | }, |
| | | data () { |
| | | return { |
| | | html: '<div>Hello World!</div>' |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | ``` |
| | | |
| | | ä½¿ç¨ `cli` æ¹å¼è¿è¡ç项ç®ï¼éè¿ `npm` æ¹å¼å¼å
¥æ¶ï¼éè¦å¨ `vue.config.js` ä¸é
ç½® `transpileDependencies`ï¼è¯¦æ
å¯è§ [#330](https://github.com/jin-yufeng/mp-html/issues/330#issuecomment-913617687) |
| | | å¦æå¨ `nvue` ä¸ä½¿ç¨è¿è¦å° `dist/uni-app/static` ç®å½ä¸çå
容æ·è´å°é¡¹ç®ç `static` ç®å½ä¸ï¼å¦åæ æ³è¿è¡ |
| | | |
| | | æ¥ç [å¿«éå¼å§](https://jin-yufeng.github.io/mp-html/#/overview/quickstart) äºè§£æ´å¤ |
| | | |
| | | ## ç»ä»¶å±æ§ |
| | | |
| | | | 屿§ | ç±»å | é»è®¤å¼ | 说æ | |
| | | |:---:|:---:|:---:|---| |
| | | | container-style | String | | 容å¨çæ ·å¼ï¼[2.1.0+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v210)ï¼ | |
| | | | content | String | | ç¨äºæ¸²æç html å符串 | |
| | | | copy-link | Boolean | true | æ¯å¦å
许å¤é¨é¾æ¥è¢«ç¹å»æ¶èªå¨å¤å¶ | |
| | | | domain | String | | 主ååï¼ç¨äºé¾æ¥æ¼æ¥ï¼ | |
| | | | error-img | String | | å¾çåºéæ¶çå ä½å¾é¾æ¥ | |
| | | | lazy-load | Boolean | false | æ¯å¦å¼å¯å¾çæå è½½ | |
| | | | loading-img | String | | å¾çå è½½è¿ç¨ä¸çå ä½å¾é¾æ¥ | |
| | | | pause-video | Boolean | true | æ¯å¦å¨ææ¾ä¸ä¸ªè§é¢æ¶èªå¨æåå
¶ä»è§é¢ | |
| | | | preview-img | Boolean | true | æ¯å¦å
许å¾ç被ç¹å»æ¶èªå¨é¢è§ | |
| | | | scroll-table | Boolean | false | æ¯å¦ç»æ¯ä¸ªè¡¨æ ¼æ·»å ä¸ä¸ªæ»å¨å±ä½¿å
¶è½åç¬æ¨ªåæ»å¨ | |
| | | | selectable | Boolean | false | æ¯å¦å¼å¯ææ¬é¿æå¤å¶ | |
| | | | set-title | Boolean | true | æ¯å¦å° title æ ç¾çå
容设置å°é¡µé¢æ é¢ | |
| | | | show-img-menu | Boolean | true | æ¯å¦å
许å¾çè¢«é¿ææ¶æ¾ç¤ºèå | |
| | | | tag-style | Object | | 设置æ ç¾çé»è®¤æ ·å¼ | |
| | | | use-anchor | Boolean | false | æ¯å¦ä½¿ç¨éç¹é¾æ¥ | |
| | | |
| | | æ¥ç [屿§](https://jin-yufeng.github.io/mp-html/#/basic/prop) äºè§£æ´å¤ |
| | | |
| | | ## ç»ä»¶äºä»¶ |
| | | |
| | | | åç§° | è§¦åæ¶æº | |
| | | |:---:|---| |
| | | | load | dom æ å è½½å®æ¯æ¶ | |
| | | | ready | å¾çå è½½å®æ¯æ¶ | |
| | | | error | åçæ¸²æéè¯¯æ¶ | |
| | | | imgtap | å¾ç被ç¹å»æ¶ | |
| | | | linktap | 龿¥è¢«ç¹å»æ¶ | |
| | | |
| | | æ¥ç [äºä»¶](https://jin-yufeng.github.io/mp-html/#/basic/event) äºè§£æ´å¤ |
| | | |
| | | ## api |
| | | ç»ä»¶å®ä¾ä¸æä¾äºä¸äº `api` æ¹æ³å¯ä¾è°ç¨ |
| | | |
| | | | åç§° | ä½ç¨ | |
| | | |:---:|---| |
| | | | in | å°éç¹è·³è½¬çèå´éå®å¨ä¸ä¸ª scroll-view å
| |
| | | | navigateTo | éç¹è·³è½¬ | |
| | | | getText | è·åææ¬å
容 | |
| | | | getRect | è·å坿æ¬å
容çä½ç½®åå¤§å° | |
| | | | setContent | è®¾ç½®å¯ææ¬å
容 | |
| | | | imgList | è·åææå¾ççæ°ç» | |
| | | | pauseMedia | æåææ¾é³è§é¢ï¼[2.2.2+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v222)ï¼ | |
| | | | setPlaybackRate | 设置é³è§é¢ææ¾éçï¼[2.4.0+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v240)ï¼ | |
| | | |
| | | æ¥ç [api](https://jin-yufeng.github.io/mp-html/#/advanced/api) äºè§£æ´å¤ |
| | | |
| | | ## æä»¶æ©å± |
| | | é¤åºæ¬åè½å¤ï¼æ¬ç»ä»¶è¿æä¾äºä¸°å¯çæ©å±ï¼å¯æç
§éè¦éç¨ |
| | | |
| | | | åç§° | ä½ç¨ | |
| | | |:---:|---| |
| | | | audio | é³ä¹ææ¾å¨ | |
| | | | editable | 坿æ¬ç¼è¾ | |
| | | | emoji | è§£æ emoji | |
| | | | highlight | 代ç åé«äº®æ¾ç¤º | |
| | | | markdown | 渲æ markdown | |
| | | | search | å
³é®è¯æç´¢ | |
| | | | style | å¹é
style æ ç¾ä¸çæ ·å¼ | |
| | | | txv-video | 使ç¨è
¾è®¯è§é¢ | |
| | | | img-cache | å¾çç¼å by [@PentaTea](https://github.com/PentaTea) | |
| | | | latex | 渲æ latex å
¬å¼ by [@Zeng-J](https://github.com/Zeng-J) | |
| | | | card | å¡çå±ç¤º by [@whoooami](https://github.com/whoooami) | |
| | | |
| | | æ¥ç [æä»¶](https://jin-yufeng.github.io/mp-html/#/advanced/plugin) äºè§£æ´å¤ |
| | | |
| | | ## 许å¯ä¸æ¯æ |
| | | - è®¸å¯ |
| | | æ¨å¯ä»¥å
è´¹ç使ç¨ï¼å
æ¬åç¨ï¼ãå¤å¶æä¿®æ¹æ¬ç»ä»¶ [MIT License](https://github.com/jin-yufeng/mp-html/blob/master/LICENSE) |
| | | å¨ç¨äºç产ç¯å¢åå¡å¿
ç»è¿å
åæµè¯ï¼ç±æä»¶ `bug` 带æ¥çæå¤±æ¦ä¸è´è´£ï¼å¯ä»¥èªè¡ä¿®æ¹æºç ï¼ |
| | | |
| | | - èç³» |
| | | 欢è¿å å
¥ `QQ` 交æµç¾¤ï¼ |
| | | 群1ï¼å·²æ»¡ï¼ï¼`699734691` |
| | | 群2ï¼å·²æ»¡ï¼ï¼`778239129` |
| | | 群3ï¼`960265313` |
| | | |
| | | ## æ´æ°æ¥å¿ |
| | | - v2.5.1 (20250420) |
| | | 1. `U` `uni-app` å
éé
鸿è `APP` [详ç»](https://github.com/jin-yufeng/mp-html/issues/615) |
| | | 2. `U` 微信å°ç¨åºæ¿æ¢åºå¼ `api` `getSystemInfoSync` [详ç»](https://github.com/jin-yufeng/mp-html/issues/613) |
| | | 3. `F` ä¿®å¤äºå¾®ä¿¡å°ç¨åº `glass-easel` æ¡æ¶ä¸çæºæ¢è¡å¼å¸¸çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/pull/607) by [@PaperStrike](https://github.com/PaperStrike) |
| | | 4. `F` ä¿®å¤äº `uni-app` å
`app` ç«¯ææ¾è§é¢å¯è½æ¥éçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/617) |
| | | 5. `F` ä¿®å¤äº `latex` æä»¶å¯è½åºç° `xxx can be used only in display mode` çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/632) |
| | | 6. `F` ä¿®å¤äº `uni-app` å
`latex` å
¬å¼å¯è½ä¸æ¾ç¤ºçé®é¢ [#599](https://github.com/jin-yufeng/mp-html/issues/599)ã[#627](https://github.com/jin-yufeng/mp-html/issues/627) |
| | | |
| | | - v2.5.0 (20240422) |
| | | 1. `U` `play` äºä»¶å¢å è¿å `src` çä¿¡æ¯ [详ç»](https://github.com/jin-yufeng/mp-html/issues/526) |
| | | 2. `U` `preview-img` 屿§æ¯æè®¾ç½®ä¸º `all` å¼å¯ `base64` å¾çé¢è§ [详ç»](https://github.com/jin-yufeng/mp-html/issues/536) |
| | | 3. `U` `editable` æä»¶å¢å ç®ææ¨¡å¼ï¼ç¹å»æåç´æ¥ç¼è¾ï¼ |
| | | 4. `U` `latex` æä»¶æ¯æå级å
¬å¼ [详ç»](https://github.com/jin-yufeng/mp-html/issues/582) |
| | | 5. `F` ä¿®å¤äºè¡¨æ ¼é¨åæ
åµä¸èæ¯ä¸¢å¤±çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/587) |
| | | 6. `F` ä¿®å¤äºé¨å `svg` æ æ³æ¾ç¤ºçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/591) |
| | | 7. `F` ä¿®å¤äº `uni-app` å
`h5` å `app` 端é¨åæ
åµä¸æ ·å¼æ æ³è¯å«çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/518) |
| | | 8. `F` ä¿®å¤äº `latex` æä»¶é¨åæ
åµä¸æ¾ç¤ºä¸æ£ç¡®çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/580) |
| | | 9. `F` ä¿®å¤äº `editable` æä»¶è¡¨æ ¼æ æ³å é¤çé®é¢ |
| | | 10. `F` ä¿®å¤äº `editable` æä»¶ `uni-app` å
`vue3` `h5` 端ç¹å»å¾çæ¥éçé®é¢ |
| | | 11. `F` ä¿®å¤äº `editable` æä»¶ `uni-app` å
ç¹å»è¡¨æ ¼æ²¡æèåæ çé®é¢ |
| | | |
| | | ä» `1.x` çåçº§æ¹æ³å¯è§ [æ´æ°æå](https://jin-yufeng.github.io/mp-html/#/changelog/changelog?id=v200) |
| | | |
| | | æ¥ç [æ´æ°æ¥å¿](https://jin-yufeng.github.io/mp-html/#/changelog/changelog) äºè§£æ´å¤ |
New file |
| | |
| | | ._root{padding:1px 0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}._select{-webkit-user-select:text;user-select:text} |
New file |
| | |
| | | <view class="_root {{selectable?'_select':''}}" style="{{containerStyle}}"><slot a:if="{{!nodes[0]}}"/><node id="_root" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]}}" onAdd="_add"/></view> |
New file |
| | |
| | | "use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}/*! |
| | | * mp-html v2.5.1 |
| | | * https://github.com/jin-yufeng/mp-html |
| | | * |
| | | * Released under the MIT license |
| | | * Author: Jin Yufeng |
| | | */ |
| | | var t=require("./parser"),n=[];Component({data:{nodes:[]},props:{containerStyle:"",content:"",copyLink:!0,domain:"",errorImg:"",lazyLoad:!1,loadingImg:"",pauseVideo:!0,previewImg:!0,scrollTable:!1,setTitle:!0,showImgMenu:!0,tagStyle:{}},didMount:function(){this.plugins=[];for(var e=n.length;e--;)this.plugins.push(new n[e](this));this.props.content&&this.setContent(this.props.content)},didUpdate:function(e){e.content!==this.props.content&&this.setContent(this.props.content)},didUnmount:function(){this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){var i=this;return new Promise(function(o,r){if(!i.props.useAnchor)return void r(Error("Anchor is disabled"));var s=my.createSelectorQuery().select((i._in?i._in.selector:"._root")+(t?"".concat(" ","#").concat(t):"")).boundingClientRect();i._in?s.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect():s.selectViewport().scrollOffset(),s.exec(function(t){if(!t[0])return void r(Error("Label not found"));var s=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(i.props.useAnchor)||0);i._in?i._in.page.setData(e({},i._in.scrollTop,s)):my.pageScrollTo({scrollTop:s,duration:300}),o()})})},getText:function(e){var t="";return function e(n){for(var i=0;i<n.length;i++){var o=n[i];if("text"===o.type)t+=o.text.replace(/&/g,"&");else if("br"===o.name)t+="\n";else{var r="p"===o.name||"div"===o.name||"tr"===o.name||"li"===o.name||"h"===o.name[0]&&o.name[1]>"0"&&o.name[1]<"7";r&&t&&"\n"!==t[t.length-1]&&(t+="\n"),o.children&&e(o.children),r&&"\n"!==t[t.length-1]?t+="\n":"td"!==o.name&&"th"!==o.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){return new Promise(function(e,t){my.createSelectorQuery().select("._root").boundingClientRect().exec(function(n){return n[0]?e(n[0]):t(Error("Root label not found"))})})},pauseMedia:function(){for(var e=(this._videos||[]).length;e--;)this._videos[e].pause()},setPlaybackRate:function(e){this.playbackRate=e;for(var t=(this._videos||[]).length;t--;)this._videos[t].playbackRate(e)},setContent:function(e,n){var i=this;this.imgList&&n||(this.imgList=[]),this._videos=[];var o={},r=new t(this).parse(e);if(n)for(var s=this.data.nodes.length,a=r.length;a--;)o["nodes[".concat(s+a,"]")]=r[a];else o.nodes=r;if(this.setData(o,function(){i._hook("onLoad"),i.props.onLoad&&i.props.onLoad()}),this.props.lazyLoad||this.imgList._unloadimgs<this.imgList.length/2){var l=0,c=function e(t){t&&t.height||(t={}),t.height===l?i.props.onReady&&i.props.onReady(t):(l=t.height,setTimeout(function(){i.getRect().then(e).catch(e)},350))};this.getRect().then(c).catch(c)}else this.imgList._unloadimgs||this.getRect().then(function(e){i.props.onReady&&i.props.onReady(e)}).catch(function(){i.props.onReady&&i.props.onReady({})})},_hook:function(e){for(var t=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.root=this}}}); |
New file |
| | |
| | | {"component":true,"usingComponents":{"node":"./node/node"}} |
New file |
| | |
| | | ._a{padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._img{max-width:100%;-webkit-touch-callout:none}._b,._strong{font-weight:700}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:700}._ins{text-decoration:underline}._li{display:list-item}._ol{list-style-type:decimal}._ol,._ul{display:block;padding-left:40px;margin:1em 0}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}._tbody,._tfoot,._thead{display:table-row-group}._tr{display:table-row}._td,._th{display:table-cell;vertical-align:middle}._th{font-weight:700;text-align:center}._ul{list-style-type:disc}._ul ._ul{margin:0;list-style-type:circle}._ul ._ul ._ul{list-style-type:square}._abbr,._b,._code,._del,._em,._i,._ins,._label,._q,._span,._strong,._sub,._sup{display:inline} |
New file |
| | |
| | | <template name="el"><block a:if="{{n.name==='img'}}"><rich-text a:if="{{n.t}}" style="display:{{n.t}}" nodes="<img class='_img' style='{{n.attrs.style}}' src='{{n.attrs.src}}'>" data-i="{{i}}" catchTap="imgTap"/><block a:else><image a:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix"/><image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{ctrl[i]===-1?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))}}" lazy-load="{{opts[0]}}" data-i="{{i}}" onLoad="imgLoad" onError="mediaError" catchTap="imgTap" onLongTap="noop"/></block></block><text a:elif="{{n.name==='br'}}">{{'\n'}}</text><view a:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchTap="linkTap"><template is="node" data="{{childs:n.children,path:i+'_',opts:opts,ctrl:ctrl}}"></template></view><video a:elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" object-fit="{{n.attrs['object-fit']}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" onPlay="play" onError="mediaError"/><audio a:elif="{{n.name==='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" onPlay="play" onError="mediaError"/><rich-text a:else id="{{n.attrs.id}}" style="display:inline;{{n.f}}" nodes="{{[n]}}"/></template><template name="node"><block a:for="{{childs}}" a:for-item="n" a:for-index="i" a:key="i"><template a:if="{{!n.c}}" is="el" data="{{n:n,i:path+i,opts:opts,ctrl:ctrl}}"/><view a:else id="{{n.attrs.id}}" class="_{{n.name}} {{n.attrs.class}}" style="{{n.attrs.style}}"><template is="node" data="{{childs:n.children,path:path+i+'_',opts:opts,ctrl:ctrl}}"></template></view></block></template><template is="node" data="{{childs:childs,path:'',opts:opts,ctrl:ctrl}}"></template> |
New file |
| | |
| | | "use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function e(e){for(var i=1;i<arguments.length;i++){var o=null!=arguments[i]?arguments[i]:{};i%2?t(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function r(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Component({data:{ctrl:{}},props:{childs:[],opts:[]},options:{addGlobalClass:!0},didMount:function(){this.props.onAdd(this)},methods:{noop:function(){},getNode:function(t){try{for(var e=t.split("_"),r=this.props.childs[e[0]],i=1;i<e.length;i++)r=r.children[e[i]];return r}catch(t){return{text:"",attrs:{},children:[]}}},play:function(t){var r=t.target.dataset.i,i=this.getNode(r);if(this.root.props.onPlay&&this.root.props.onPlay({source:i.name,attrs:e(e({},i.attrs),{},{src:i.src[this.data.ctrl[r]||0]})}),this.root.props.pauseVideo){for(var o=!1,a=t.target.id,s=this.root._videos.length;s--;)this.root._videos[s].id===a?o=!0:this.root._videos[s].pause();if(!o){var n=my.createVideoContext(a,this);n.id=a,this.root.playbackRate&&n.playbackRate(this.root.playbackRate),this.root._videos.push(n)}}},imgTap:function(t){var e=this.getNode(t.target.dataset.i);if(e.a)return this.linkTap(e.a);if(!e.attrs.ignore&&(this.root.props.onImgtap&&this.root.props.onImgtap(e.attrs),this.root.props.previewImg)){var r=e.i;my.previewImage({enablesavephoto:this.root.props.showImgMenu,enableShowPhotoDownload:this.root.props.showImgMenu,current:r,urls:this.root.imgList})}},imgLoad:function(t){var e,i=t.target.dataset.i,o=this.getNode(i);o.w?(this.props.opts[1]&&!this.data.ctrl[i]||-1===this.data.ctrl[i])&&(e=1):e=t.detail.width,e&&this.setData(r({},"ctrl."+i,e)),this.checkReady()},checkReady:function(){var t=this;this.root.props.lazyLoad||(this.root.imgList._unloadimgs-=1,this.root.imgList._unloadimgs||setTimeout(function(){t.root.getRect().then(function(e){t.root.props.onReady&&t.root.props.onReady(e)}).catch(function(){t.root.props.onReady&&t.root.props.onReady({})})},350))},linkTap:function(t){var e=t.currentTarget?this.getNode(t.currentTarget.dataset.i):{},r=e.attrs||t,i=r.href;this.root.props.onLinktap&&this.root.props.onLinktap(Object.assign({innerText:this.root.getText(e.children||[])},r)),i&&("#"===i[0]?this.root.navigateTo(i.substring(1)).catch(function(){}):i.split("?")[0].includes("://")?this.root.props.copyLink&&my.setClipboard({text:i,success:function(){return my.showToast({content:"龿¥å·²å¤å¶"})}}):my.navigateTo({url:i,fail:function(){my.switchTab({url:i,fail:function(){}})}}))},mediaError:function(t){var e=t.target.dataset.i,i=this.getNode(e);if("video"===i.name||"audio"===i.name){var o=(this.data.ctrl[e]||0)+1;if(o>i.src.length&&(o=0),o<i.src.length)return this.setData(r({},"ctrl."+e,o))}else"img"===i.name&&(this.props.opts[2]&&this.setData(r({},"ctrl."+e,-1)),this.checkReady());this.root&&this.root.props.onError&&this.root.props.onError({source:i.name,attrs:i.attrs,errMsg:t.detail.errMsg})}}}); |
New file |
| | |
| | | {"component":true,"usingComponents":{"node":"./node"}} |
New file |
| | |
| | | "use strict";function t(t,e){var s;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(s=i(t))||e&&t&&"number"==typeof t.length){s&&(t=s);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,l=!1;return{s:function(){s=t[Symbol.iterator]()},n:function(){var t=s.next();return o=t.done,t},e:function(t){l=!0,r=t},f:function(){try{o||null==s.return||s.return()}finally{if(l)throw r}}}}function i(t,i){if(t){if("string"==typeof t)return e(t,i);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?e(t,i):void 0}}function e(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=new Array(i);e<i;e++)s[e]=t[e];return s}function s(t){for(var i=Object.create(null),e=t.split(","),s=e.length;s--;)i[e[s]]=!0;return i}function n(t,i){for(var e=t.indexOf("&");-1!==e;){var s=t.indexOf(";",e+3),n=void 0;if(-1===s)break;"#"===t[e+1]?(n=parseInt(("x"===t[e+2]?"0":"")+t.substring(e+2,s)),isNaN(n)||(t=t.substr(0,e)+String.fromCharCode(n)+t.substr(s+1))):(n=t.substring(e+1,s),(l.entities[n]||"amp"===n&&i)&&(t=t.substr(0,e)+(l.entities[n]||"&")+t.substr(s+1))),e=t.indexOf("&",e+1)}return t}function a(t){for(var i=t.length-1,e=i;e>=-1;e--)(-1===e||t[e].c||!t[e].name||"div"!==t[e].name&&"p"!==t[e].name&&"h"!==t[e].name[0]||(t[e].attrs.style||"").includes("inline"))&&(i-e>=5&&t.splice(e+1,i-e,{name:"div",attrs:{},children:t.slice(e+1,i+1)}),i=e-1)}function r(t){this.options=t.props||{},this.tagStyle=Object.assign({},l.tagStyle,this.options.tagStyle),this.imgList=t.imgList||[],this.imgList._unloadimgs=0,this.plugins=t.plugins||[],this.attrs=Object.create(null),this.stack=[],this.nodes=[],this.pre=(this.options.containerStyle||"").includes("white-space")&&this.options.containerStyle.includes("pre")?2:0}function o(t){this.handler=t}var l={trustTags:s("a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video"),blockTags:s("address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section"),ignoreTags:s("area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr"),voidTags:s("area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr"),entities:{lt:"<",gt:">",quot:'"',apos:"'",ensp:"â",emsp:"â",nbsp:" ",semi:";",ndash:"â",mdash:"â",middot:"·",lsquo:"â",rsquo:"â",ldquo:"â",rdquo:"â",bull:"â¢",hellip:"â¦",larr:"â",uarr:"â",rarr:"â",darr:"â"},tagStyle:{address:"font-style:italic",big:"display:inline;font-size:1.2em",caption:"display:table-caption;text-align:center",center:"text-align:center",cite:"font-style:italic",dd:"margin-left:40px",mark:"background-color:yellow",pre:"font-family:monospace;white-space:pre",s:"text-decoration:line-through",small:"display:inline;font-size:0.8em",strike:"text-decoration:line-through",u:"text-decoration:underline"},svgDict:{animatetransform:"animateTransform",lineargradient:"linearGradient",viewbox:"viewBox",attributename:"attributeName",repeatcount:"repeatCount",repeatdur:"repeatDur",foreignobject:"foreignObject"}},h={},c,d,p=my.getSystemInfoSync();c=p.windowWidth;var u=s(" ,\r,\n,\t,\f"),f=0;r.prototype.parse=function(t){for(var i=this.plugins.length;i--;)this.plugins[i].onUpdate&&(t=this.plugins[i].onUpdate(t,l)||t);for(new o(this).parse(t);this.stack.length;)this.popNode();return this.nodes.length>50&&a(this.nodes),this.nodes},r.prototype.expose=function(){for(var t=this.stack.length;t--;){var i=this.stack[t];if(i.c||"a"===i.name||"video"===i.name||"audio"===i.name)return;i.c=1}},r.prototype.hook=function(t){for(var i=this.plugins.length;i--;)if(this.plugins[i].onParse&&!1===this.plugins[i].onParse(t,this))return!1;return!0},r.prototype.getUrl=function(t){var i=this.options.domain;return"/"===t[0]?"/"===t[1]?t=(i?i.split("://")[0]:"http")+":"+t:i&&(t=i+t):!i||t.includes("data:")||t.includes("://")||(t=i+"/"+t),t},r.prototype.parseStyle=function(t){var i=t.attrs,e=(this.tagStyle[t.name]||"").split(";").concat((i.style||"").split(";")),s={},n="";i.id&&!this.xml&&(this.options.useAnchor?this.expose():"img"!==t.name&&"a"!==t.name&&"video"!==t.name&&"audio"!==t.name&&(i.id=void 0)),i.width&&(s.width=parseFloat(i.width)+(i.width.includes("%")?"%":"px"),i.width=void 0),i.height&&(s.height=parseFloat(i.height)+(i.height.includes("%")?"%":"px"),i.height=void 0);for(var a=0,r=e.length;a<r;a++){var o=e[a].split(":");if(!(o.length<2)){var l=o.shift().trim().toLowerCase(),h=o.join(":").trim();if("-"===h[0]&&h.lastIndexOf("-")>0||h.includes("safe"))n+=";".concat(l,":").concat(h);else if(!s[l]||h.includes("import")||!s[l].includes("import")){if(h.includes("url")){var d=h.indexOf("(")+1;if(d){for(;'"'===h[d]||"'"===h[d]||u[h[d]];)d++;h=h.substr(0,d)+this.getUrl(h.substr(d))}}else h.includes("rpx")&&(h=h.replace(/[0-9.]+\s*rpx/g,function(t){return parseFloat(t)*c/750+"px"}));s[l]=h}}}return t.attrs.style=n,s},r.prototype.onTagName=function(t){this.tagName=this.xml?t:t.toLowerCase(),"svg"===this.tagName&&(this.xml=(this.xml||0)+1,l.ignoreTags.style=void 0)},r.prototype.onAttrName=function(t){t=this.xml?t:t.toLowerCase(),"data-"===t.substr(0,5)?"data-src"!==t||this.attrs.src?"img"===this.tagName||"a"===this.tagName?this.attrName=t:this.attrName=void 0:this.attrName="src":(this.attrName=t,this.attrs[t]="T")},r.prototype.onAttrVal=function(t){var i=this.attrName||"";"style"===i||"href"===i?this.attrs[i]=n(t,!0):i.includes("src")?this.attrs[i]=this.getUrl(n(t,!0)):i&&(this.attrs[i]=t)},r.prototype.onOpenTag=function(t){var i=Object.create(null);i.name=this.tagName,i.attrs=this.attrs,this.attrs=Object.create(null);var e=i.attrs,s=this.stack[this.stack.length-1],n=s?s.children:this.nodes,a=this.xml?t:l.voidTags[i.name];if(h[i.name]&&(e.class=h[i.name]+(e.class?" "+e.class:"")),"embed"===i.name){var r=e.src||"";r.includes(".mp4")||r.includes(".3gp")||r.includes(".m3u8")||(e.type||"").includes("video")?i.name="video":(r.includes(".mp3")||r.includes(".wav")||r.includes(".aac")||r.includes(".m4a")||(e.type||"").includes("audio"))&&(i.name="audio"),e.autostart&&(e.autoplay="T"),e.controls="T"}if("video"!==i.name&&"audio"!==i.name||("video"!==i.name||e.id||(e.id="v"+f++),e.controls||e.autoplay||(e.controls="T"),i.src=[],e.src&&(i.src.push(e.src),e.src=void 0),this.expose()),a){if(!this.hook(i)||l.ignoreTags[i.name])return void("base"!==i.name||this.options.domain?"source"===i.name&&s&&("video"===s.name||"audio"===s.name)&&e.src&&s.src.push(e.src):this.options.domain=e.href);var o=this.parseStyle(i);if("img"===i.name){if(e.src&&(e.src.includes("webp")&&(i.webp="T"),e.src.includes("data:")&&"all"!==this.options.previewImg&&!e["original-src"]&&(e.ignore="T"),!e.ignore||i.webp||e.src.includes("cloud://"))){for(var d=this.stack.length;d--;){var p=this.stack[d];"table"!==p.name||i.webp||e.src.includes("cloud://")||(!o.display||o.display.includes("inline")?i.t="inline-block":i.t=o.display,o.display=void 0);var u=p.attrs.style||"";if(!u.includes("flex:")||u.includes("flex:0")||u.includes("flex: 0")||o.width&&!(parseInt(o.width)>100))if(u.includes("flex")&&"100%"===o.width)for(var g=d+1;g<this.stack.length;g++){var m=this.stack[g].attrs.style||"";if(!m.includes(";width")&&!m.includes(" width")&&0!==m.indexOf("width")){o.width="";break}}else u.includes("inline-block")&&(o.width&&"%"===o.width[o.width.length-1]?(p.attrs.style+=";max-width:"+o.width,o.width=""):p.attrs.style+=";max-width:100%");else{o.width="100% !important",o.height="";for(var v=d+1;v<this.stack.length;v++)this.stack[v].attrs.style=(this.stack[v].attrs.style||"").replace("inline-","")}"a"===p.name?i.a=p.attrs:p.c=1}i.i=this.imgList.length;var y=e["original-src"]||e.src;this.imgList.push(y),i.t||(this.imgList._unloadimgs+=1)}"inline"===o.display&&(o.display=""),e.ignore&&(o["max-width"]=o["max-width"]||"100%",e.style+=";-webkit-touch-callout:none"),parseInt(o.width)>c&&(o.height=void 0),isNaN(parseInt(o.width))||(i.w="T"),!isNaN(parseInt(o.height))&&(!o.height.includes("%")||s&&(s.attrs.style||"").includes("height"))&&(i.h="T"),i.w&&i.h&&o["object-fit"]&&("contain"===o["object-fit"]?i.m="aspectFit":"cover"===o["object-fit"]&&(i.m="aspectFill"))}else if("svg"===i.name)return n.push(i),this.stack.push(i),void this.popNode();for(var b in o)o[b]&&(e.style+=";".concat(b,":").concat(o[b].replace(" !important","")));e.style=e.style.substr(1)||void 0}else("pre"===i.name||(e.style||"").includes("white-space")&&e.style.includes("pre"))&&2!==this.pre&&(this.pre=i.pre=1),i.children=[],this.stack.push(i);n.push(i)},r.prototype.onCloseTag=function(t){t=this.xml?t:t.toLowerCase();var i;for(i=this.stack.length;i--&&this.stack[i].name!==t;);if(-1!==i)for(;this.stack.length>i;)this.popNode();else if("p"===t||"br"===t){var e=this.stack.length?this.stack[this.stack.length-1].children:this.nodes;e.push({name:t,attrs:{class:h[t],style:this.tagStyle[t]}})}},r.prototype.popNode=function(){var i=this.stack.pop(),e=i.attrs,s=i.children,n=this.stack[this.stack.length-1],r=n?n.children:this.nodes;if(!this.hook(i)||l.ignoreTags[i.name])return"title"===i.name&&s.length&&"text"===s[0].type&&this.options.setTitle&&my.setNavigationBar({title:s[0].text}),void r.pop();if(i.pre&&2!==this.pre){this.pre=i.pre=void 0;for(var o=this.stack.length;o--;)this.stack[o].pre&&(this.pre=1)}if("svg"===i.name){if(this.xml>1)return void this.xml--;var h="",d=e.style;return e.style="",e.xmlns="http://www.w3.org/2000/svg",function i(e){if("text"===e.type)return void(h+=e.text);var s=l.svgDict[e.name]||e.name;if("foreignObject"===s){var n,a=t(e.children||[]);try{for(a.s();!(n=a.n()).done;){var r=n.value;if(r.attrs&&!r.attrs.xmlns){r.attrs.xmlns="http://www.w3.org/1999/xhtml";break}}}catch(t){a.e(t)}finally{a.f()}}h+="<"+s;for(var o in e.attrs){var c=e.attrs[o];c&&(h+=" ".concat(l.svgDict[o]||o,'="').concat(c.replace(/"/g,""),'"'))}if(e.children){h+=">";for(var d=0;d<e.children.length;d++)i(e.children[d]);h+="</"+s+">"}else h+="/>"}(i),i.name="img",i.attrs={src:"data:image/svg+xml;utf8,"+h.replace(/#/g,"%23"),style:d,ignore:"T"},i.children=void 0,this.xml=!1,void(l.ignoreTags.style=!0)}var p={};if(e.align&&("table"===i.name?"center"===e.align?p["margin-inline-start"]=p["margin-inline-end"]="auto":p.float=e.align:p["text-align"]=e.align,e.align=void 0),e.dir&&(p.direction=e.dir,e.dir=void 0),"font"===i.name&&(e.color&&(p.color=e.color,e.color=void 0),e.face&&(p["font-family"]=e.face,e.face=void 0),e.size)){var u=parseInt(e.size);isNaN(u)||(u<1?u=1:u>7&&(u=7),p["font-size"]=["x-small","small","medium","large","x-large","xx-large","xxx-large"][u-1]),e.size=void 0}if((e.class||"").includes("align-center")&&(p["text-align"]="center"),Object.assign(p,this.parseStyle(i)),"table"!==i.name&&parseInt(p.width)>c&&(p["max-width"]="100%",p["box-sizing"]="border-box"),l.blockTags[i.name])i.name="div";else if(l.trustTags[i.name]||this.xml)if("a"===i.name||"ad"===i.name)this.expose();else if("video"===i.name||"audio"===i.name)(p.height||"").includes("auto")&&(p.height=void 0),i.children=void 0;else if("ul"!==i.name&&"ol"!==i.name||!i.c)if("table"===i.name){var f=parseFloat(e.cellpadding),g=parseFloat(e.cellspacing),m=parseFloat(e.border),v=p["border-color"],y=p["border-style"];if(i.c&&(isNaN(f)&&(f=2),isNaN(g)&&(g=2)),m&&(e.style+=";border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray")),i.flag&&i.c){i.flag=void 0,p.display="grid","collapse"===p["border-collapse"]&&(p["border-collapse"]=void 0,g=0),g?(p["grid-gap"]=g+"px",p.padding=g+"px"):m&&(e.style+=";border-left:0;border-top:0");var b=[],x=[],w=[],k={};!function i(e){for(var s=0;s<e.length;s++)if("tr"===e[s].name)x.push(e[s]);else if("colgroup"===e[s].name){var n,a=1,r=t(e[s].children||[]);try{for(r.s();!(n=r.n()).done;){var o=n.value;if("col"===o.name){var l=o.attrs.style||"",h=l.indexOf("width")?l.indexOf(";width"):0;if(-1!==h){var c=l.indexOf(";",h+6);-1===c&&(c=l.length),b[a]=l.substring(h?h+7:6,c)}a+=1}}}catch(t){r.e(t)}finally{r.f()}}else i(e[s].children||[])}(s);for(var N=1;N<=x.length;N++){for(var T=1,O=0;O<x[N-1].children.length;O++){var j=x[N-1].children[O];if("td"===j.name||"th"===j.name){for(;k[N+"."+T];)T++;j.c=1;var S=j.attrs.style||"",A=S.indexOf("width")?S.indexOf(";width"):0;if(-1!==A){var C=S.indexOf(";",A+6);-1===C&&(C=S.length),j.attrs.colspan||(b[T]=S.substring(A?A+7:6,C)),S=S.substr(0,A)+S.substr(C)}if(S+=";display:flex;flex-direction:column",-1!==(A=S.indexOf("vertical-align"))){var I=S.substr(A+15,10);I.includes("middle")?S+=";justify-content:center":I.includes("bottom")&&(S+=";justify-content:flex-end")}else S+=";justify-content:center";if(-1!==(A=S.indexOf("text-align"))){var z=S.substr(A+11,10);z.includes("center")?S+=";justify-content: center":z.includes("right")&&(S+=";justify-content: right")}if(S=(m?";border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray")+(g?"":";border-right:0;border-bottom:0"):"")+(f?";padding:".concat(f,"px"):"")+";"+S,j.attrs.colspan&&(S+=";grid-column-start:".concat(T,";grid-column-end:").concat(T+parseInt(j.attrs.colspan)),j.attrs.rowspan||(S+=";grid-row-start:".concat(N,";grid-row-end:").concat(N+1)),T+=parseInt(j.attrs.colspan)-1),j.attrs.rowspan){S+=";grid-row-start:".concat(N,";grid-row-end:").concat(N+parseInt(j.attrs.rowspan)),j.attrs.colspan||(S+=";grid-column-start:".concat(T,";grid-column-end:").concat(T+1));for(var L=1;L<j.attrs.rowspan;L++)for(var F=0;F<(j.attrs.colspan||1);F++)k[N+L+"."+(T-F)]=1}S&&(j.attrs.style=S),w.push(j),T++}}if(1===N){for(var q="",U=1;U<T;U++)q+=(b[U]?b[U]:"auto")+" ";p["grid-template-columns"]=q}}i.children=w}else i.c&&(p.display="table"),isNaN(g)||(p["border-spacing"]=g+"px"),(m||f||i.c)&&function t(e){for(var s=0;s<e.length;s++){var n=e[s];i.c&&(n.c=1),"th"===n.name||"td"===n.name?(m&&(n.attrs.style="border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray",";").concat(n.attrs.style||"")),f&&(n.attrs.style="padding:".concat(f,"px;").concat(n.attrs.style||""))):n.children&&t(n.children)}}(s);if(this.options.scrollTable&&!(e.style||"").includes("inline")){var V=Object.assign({},i);i.name="div",i.attrs={style:"overflow-x:auto;padding:1px"},i.children=[V],e=V.attrs}}else if(("tbody"===i.name||"tr"===i.name)&&i.flag&&i.c)i.flag=void 0,function t(i){for(var e=0;e<i.length;e++)if("td"===i[e].name)for(var s=0,n=["color","background","background-color"];s<n.length;s++){var a=n[s];p[a]&&(i[e].attrs.style=a+":"+p[a]+";"+(i[e].attrs.style||""))}else t(i[e].children||[])}(s);else if("td"!==i.name&&"th"!==i.name||!e.colspan&&!e.rowspan){if("ruby"===i.name){i.name="span";for(var D=0;D<s.length-1;D++)"text"===s[D].type&&"rt"===s[D+1].name&&(s[D]={name:"span",attrs:{style:"display:inline-block;text-align:center"},children:[{name:"div",attrs:{style:"font-size:50%;"+(s[D+1].attrs.style||"")},children:s[D+1].children},s[D]]},s.splice(D+1,1))}}else for(var B=this.stack.length;B--;)"table"!==this.stack[B].name&&"tbody"!==this.stack[B].name&&"tr"!==this.stack[B].name||(this.stack[B].flag=1);else{var P={a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"};P[e.type]&&(e.style+=";list-style-type:"+P[e.type],e.type=void 0),i.c=1;for(var Z=s.length;Z--;)"li"===s[Z].name&&(s[Z].c=1)}else i.name="span";if((p.display||"").includes("flex")&&!i.c)for(var _=s.length;_--;){var E=s[_];E.f&&(E.attrs.style=(E.attrs.style||"")+E.f,E.f=void 0)}var G=n&&((n.attrs.style||"").includes("flex")||(n.attrs.style||"").includes("grid"))&&!i.c;G&&(i.f=";max-width:100%"),s.length>=50&&i.c&&!(p.display||"").includes("flex")&&a(s);for(var M in p)if(p[M]){var W=";".concat(M,":").concat(p[M].replace(" !important",""));G&&(M.includes("flex")&&"flex-direction"!==M||"align-self"===M||M.includes("grid")||"-"===p[M][0]||M.includes("width")&&W.includes("%"))?(i.f+=W,"width"===M&&(e.style+=";width:100%")):e.style+=W}e.style=e.style.substr(1)||void 0},r.prototype.onText=function(t){if(!this.pre){for(var i,e="",s=0,a=t.length;s<a;s++)u[t[s]]?(" "!==e[e.length-1]&&(e+=" "),"\n"!==t[s]||i||(i=!0)):e+=t[s];if(" "===e&&i)return;t=e}var r=Object.create(null);if(r.type="text",r.text=n(t),this.hook(r)){(this.stack.length?this.stack[this.stack.length-1].children:this.nodes).push(r)}},o.prototype.parse=function(t){this.content=t||"",this.i=0,this.start=0,this.state=this.text;for(var i=this.content.length;-1!==this.i&&this.i<i;)this.state()},o.prototype.checkClose=function(t){var i="/"===this.content[this.i];return!!(">"===this.content[this.i]||i&&">"===this.content[this.i+1])&&(t&&this.handler[t](this.content.substring(this.start,this.i)),this.i+=i?2:1,this.start=this.i,this.handler.onOpenTag(i),"script"===this.handler.tagName?(this.i=this.content.indexOf("</",this.i),-1!==this.i&&(this.i+=2,this.start=this.i),this.state=this.endTag):this.state=this.text,!0)},o.prototype.text=function(){if(this.i=this.content.indexOf("<",this.i),-1===this.i)return void(this.start<this.content.length&&this.handler.onText(this.content.substring(this.start,this.content.length)));var t=this.content[this.i+1];if(t>="a"&&t<="z"||t>="A"&&t<="Z")this.start!==this.i&&this.handler.onText(this.content.substring(this.start,this.i)),this.start=++this.i,this.state=this.tagName;else if("/"===t||"!"===t||"?"===t){this.start!==this.i&&this.handler.onText(this.content.substring(this.start,this.i));var i=this.content[this.i+2];if("/"===t&&(i>="a"&&i<="z"||i>="A"&&i<="Z"))return this.i+=2,this.start=this.i,void(this.state=this.endTag);var e="--\x3e";"!"===t&&"-"===this.content[this.i+2]&&"-"===this.content[this.i+3]||(e=">"),this.i=this.content.indexOf(e,this.i),-1!==this.i&&(this.i+=e.length,this.start=this.i)}else this.i++},o.prototype.tagName=function(){if(u[this.content[this.i]]){for(this.handler.onTagName(this.content.substring(this.start,this.i));u[this.content[++this.i]];);this.i<this.content.length&&!this.checkClose()&&(this.start=this.i,this.state=this.attrName)}else this.checkClose("onTagName")||this.i++},o.prototype.attrName=function(){var t=this.content[this.i];if(u[t]||"="===t){this.handler.onAttrName(this.content.substring(this.start,this.i));for(var i="="===t,e=this.content.length;++this.i<e;)if(t=this.content[this.i],!u[t]){if(this.checkClose())return;if(i)return this.start=this.i,void(this.state=this.attrVal);if("="!==this.content[this.i])return this.start=this.i,void(this.state=this.attrName);i=!0}}else this.checkClose("onAttrName")||this.i++},o.prototype.attrVal=function(){var t=this.content[this.i],i=this.content.length;if('"'===t||"'"===t){if(this.start=++this.i,this.i=this.content.indexOf(t,this.i),-1===this.i)return;this.handler.onAttrVal(this.content.substring(this.start,this.i))}else for(;this.i<i;this.i++){if(u[this.content[this.i]]){this.handler.onAttrVal(this.content.substring(this.start,this.i));break}if(this.checkClose("onAttrVal"))return}for(;u[this.content[++this.i]];);this.i<i&&!this.checkClose()&&(this.start=this.i,this.state=this.attrName)},o.prototype.endTag=function(){var t=this.content[this.i];if(u[t]||">"===t||"/"===t){if(this.handler.onCloseTag(this.content.substring(this.start,this.i)),">"!==t&&(this.i=this.content.indexOf(">",this.i),-1===this.i))return;this.start=++this.i,this.state=this.text}else this.i++},module.exports=r; |
New file |
| | |
| | | ._root{padding:1px 0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}._select{-webkit-user-select:text;user-select:text} |
New file |
| | |
| | | "use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}/*! |
| | | * mp-html v2.5.1 |
| | | * https://github.com/jin-yufeng/mp-html |
| | | * |
| | | * Released under the MIT license |
| | | * Author: Jin Yufeng |
| | | */ |
| | | var t=require("./parser"),n=[];Component({data:{nodes:[]},properties:{containerStyle:String,content:{type:String,value:"",observer:function(e){this.setContent(e)}},copyLink:{type:Boolean,value:!0},domain:String,errorImg:String,lazyLoad:Boolean,loadingImg:String,pauseVideo:{type:Boolean,value:!0},previewImg:{type:null,value:!0},scrollTable:Boolean,selectable:null,setTitle:{type:Boolean,value:!0},showImgMenu:{type:Boolean,value:!0},tagStyle:Object,useAnchor:null},created:function(){this.plugins=[];for(var e=n.length;e--;)this.plugins.push(new n[e](this))},detached:function(){this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){var i=this;return new Promise(function(o,r){if(!i.data.useAnchor)return void r(Error("Anchor is disabled"));var a=swan.createSelectorQuery().in(i._in?i._in.page:i).select((i._in?i._in.selector:"._root")+(t?"".concat(" ","#").concat(t):"")).boundingClientRect();i._in?a.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect():a.selectViewport().scrollOffset(),a.exec(function(t){if(!t[0])return void r(Error("Label not found"));var a=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(i.data.useAnchor)||0);i._in?i._in.page.setData(e({},i._in.scrollTop,a)):swan.pageScrollTo({scrollTop:a,duration:300}),o()})})},getText:function(e){var t="";return function e(n){for(var i=0;i<n.length;i++){var o=n[i];if("text"===o.type)t+=o.text.replace(/&/g,"&");else if("br"===o.name)t+="\n";else{var r="p"===o.name||"div"===o.name||"tr"===o.name||"li"===o.name||"h"===o.name[0]&&o.name[1]>"0"&&o.name[1]<"7";r&&t&&"\n"!==t[t.length-1]&&(t+="\n"),o.children&&e(o.children),r&&"\n"!==t[t.length-1]?t+="\n":"td"!==o.name&&"th"!==o.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){var e=this;return new Promise(function(t,n){swan.createSelectorQuery().in(e).select("._root").boundingClientRect().exec(function(e){return e[0]?t(e[0]):n(Error("Root label not found"))})})},pauseMedia:function(){for(var e=(this._videos||[]).length;e--;)this._videos[e].pause()},setPlaybackRate:function(e){this.playbackRate=e;for(var t=(this._videos||[]).length;t--;)this._videos[t].playbackRate(e)},setContent:function(e,n){var i=this;this.imgList&&n||(this.imgList=[]),this._videos=[];var o={},r=new t(this).parse(e);if(n)for(var a=this.data.nodes.length,s=r.length;s--;)o["nodes[".concat(a+s,"]")]=r[s];else o.nodes=r;if(this.setData(o,function(){i._hook("onLoad"),i.triggerEvent("load")}),this.data.lazyLoad||this.imgList._unloadimgs<this.imgList.length/2){var l=0,c=function e(t){t&&t.height||(t={}),t.height===l?i.triggerEvent("ready",t):(l=t.height,setTimeout(function(){i.getRect().then(e).catch(e)},350))};this.getRect().then(c).catch(c)}else this.imgList._unloadimgs||this.getRect().then(function(e){i.triggerEvent("ready",e)}).catch(function(){i.triggerEvent("ready",{})})},_hook:function(e){for(var t=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.detail.root=this}}}); |
New file |
| | |
| | | {"component":true,"usingComponents":{"node":"./node/node"}} |
New file |
| | |
| | | <view class="_root {{selectable?'_select':''}}" style="{{containerStyle}}"><slot s-if="!nodes[0]"/><node id="_root" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]}}" catchadd="_add"/></view> |
New file |
| | |
| | | ._a{padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._img{max-width:100%;-webkit-touch-callout:none}._b,._strong{font-weight:700}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:700}._ins{text-decoration:underline}._li{display:list-item}._ol{list-style-type:decimal}._ol,._ul{display:block;padding-left:40px;margin:1em 0}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}._tbody,._tfoot,._thead{display:table-row-group}._tr{display:table-row}._td,._th{display:table-cell;vertical-align:middle}._th{font-weight:700;text-align:center}._ul{list-style-type:disc}._ul ._ul{margin:0;list-style-type:circle}._ul ._ul ._ul{list-style-type:square}._abbr,._b,._code,._del,._em,._i,._ins,._label,._q,._span,._strong,._sub,._sup{display:inline}._blockquote,._div,._p{display:block} |
New file |
| | |
| | | "use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function e(e){for(var i=1;i<arguments.length;i++){var o=null!=arguments[i]?arguments[i]:{};i%2?t(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function r(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Component({data:{ctrl:{}},properties:{childs:Array,opts:Array},options:{addGlobalClass:!0},attached:function(){this.triggerEvent("add",this,{bubbles:!0,composed:!0})},methods:{noop:function(){},getNode:function(t){try{for(var e=t.split("_"),r=this.data.childs[e[0]],i=1;i<e.length;i++)r=r.children[e[i]];return r}catch(t){return{text:"",attrs:{},children:[]}}},play:function(t){var r=t.target.dataset.i,i=this.getNode(r);if(this.root.triggerEvent("play",{source:i.name,attrs:e(e({},i.attrs),{},{src:i.src[this.data.ctrl[r]||0]})}),this.root.data.pauseVideo){for(var o=!1,a=t.target.id,s=this.root._videos.length;s--;)this.root._videos[s].id===a?o=!0:this.root._videos[s].pause();if(!o){var n=swan.createVideoContext(a);n.id=a,this.root.playbackRate&&n.playbackRate(this.root.playbackRate),this.root._videos.push(n)}}},imgTap:function(t){var e=this.getNode(t.target.dataset.i);if(e.a)return this.linkTap(e.a);if(!e.attrs.ignore&&(this.root.triggerEvent("imgtap",e.attrs),this.root.data.previewImg)){var r=this.root.imgList[e.i];swan.previewImage({current:r,urls:this.root.imgList})}},imgLoad:function(t){var e,i=t.target.dataset.i,o=this.getNode(i);o.w?(this.data.opts[1]&&!this.data.ctrl[i]||-1===this.data.ctrl[i])&&(e=1):e=t.detail.width,e&&this.setData(r({},"ctrl."+i,e)),this.checkReady()},checkReady:function(){var t=this;this.root.data.lazyLoad||(this.root.imgList._unloadimgs-=1,this.root.imgList._unloadimgs||setTimeout(function(){t.root.getRect().then(function(e){t.root.triggerEvent("ready",e)}).catch(function(){t.root.triggerEvent("ready",{})})},350))},linkTap:function(t){var e=t.currentTarget?this.getNode(t.currentTarget.dataset.i):{},r=e.attrs||t,i=r.href;this.root.triggerEvent("linktap",Object.assign({innerText:this.root.getText(e.children||[])},r)),i&&("#"===i[0]?this.root.navigateTo(i.substring(1)).catch(function(){}):i.split("?")[0].includes("://")?this.root.data.copyLink&&swan.setClipboardData({data:i,success:function(){return swan.showToast({title:"龿¥å·²å¤å¶"})}}):swan.navigateTo({url:i,fail:function(){swan.switchTab({url:i,fail:function(){}})}}))},mediaError:function(t){var e=t.target.dataset.i,i=this.getNode(e);if("video"===i.name||"audio"===i.name){var o=(this.data.ctrl[e]||0)+1;if(o>i.src.length&&(o=0),o<i.src.length)return this.setData(r({},"ctrl."+e,o))}else"img"===i.name&&(this.data.opts[2]&&this.setData(r({},"ctrl."+e,-1)),this.checkReady());this.root&&this.root.triggerEvent("error",{source:i.name,attrs:i.attrs,errMsg:t.detail.errMsg})}}}); |
New file |
| | |
| | | {"component":true,"usingComponents":{"node":"./node"}} |
New file |
| | |
| | | <template name="el"><block s-if="n.name==='img'"><rich-text s-if="n.t" style="display:{{n.t}}" nodes="<img class='_img' style='{{n.attrs.style}}' src='{{n.attrs.src}}'>" data-i="{{i}}" catchtap="imgTap"/><block s-else><image s-if="(opts[1]&&!ctrl[i])||ctrl[i]<0" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix"/><image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{ctrl[i]===-1?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))}}" lazy-load="{{opts[0]}}" webp="{{n.webp}}" image-menu-prevent="{{!opts[3]||n.attrs.ignore}}" data-i="{{i}}" bindload="imgLoad" binderror="mediaError" catchtap="imgTap" bindlongpress="noop"/></block></block><text s-elif="{{n.name==='br'}}">{{'\n'}}</text><view s-elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchtap="linkTap"><block s-for="n.children" s-key="index"><template is="el" data="{{{n:item,i:i+'_'+index,opts:opts,ctrl:ctrl}}}"></template></block></view><video s-elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" object-fit="{{n.attrs['object-fit']}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><audio s-elif="{{n.name==='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><rich-text s-else id="{{n.attrs.id}}" style="{{n.f}}" selectable="{{opts[4]}}" nodes="{{[n]}}"/></template><block s-for="childs" s-for-item="n1" s-for-index="i1" s-key="i1"><template s-if="!n1.c" is="el" data="{{{n:n1,i:''+i1,opts:opts,ctrl:ctrl}}}"/><view s-else id="{{n1.attrs.id}}" class="_{{n1.name}} {{n1.attrs.class}}" style="{{n1.attrs.style}}"><block s-for="n1.children" s-for-item="n2" s-for-index="i2" s-key="i2"><template s-if="!n2.c" is="el" data="{{{n:n2,i:i1+'_'+i2,opts:opts,ctrl:ctrl}}}"/><view s-else id="{{n2.attrs.id}}" class="_{{n2.name}} {{n2.attrs.class}}" style="{{n2.attrs.style}}"><block s-for="n2.children" s-for-item="n3" s-for-index="i3" s-key="i3"><template s-if="!n3.c" is="el" data="{{{n:n3,i:i1+'_'+i2+'_'+i3,opts:opts,ctrl:ctrl}}}"/><view s-else id="{{n3.attrs.id}}" class="_{{n3.name}} {{n3.attrs.class}}" style="{{n3.attrs.style}}"><block s-for="n3.children" s-for-item="n4" s-for-index="i4" s-key="i4"><template s-if="!n4.c" is="el" data="{{{n:n4,i:i1+'_'+i2+'_'+i3+'_'+i4,opts:opts,ctrl:ctrl}}}"/><view s-else id="{{n4.attrs.id}}" class="_{{n4.name}} {{n4.attrs.class}}" style="{{n4.attrs.style}}"><block s-for="n4.children" s-for-item="n5" s-for-index="i5" s-key="i5"><template s-if="!n5.c" is="el" data="{{{n:n5,i:i1+'_'+i2+'_'+i3+'_'+i4+'_'+i5,opts:opts,ctrl:ctrl}}}"/><node s-else id="{{n5.attrs.id}}" class="_{{n5.name}} {{n5.attrs.class}}" style="{{n5.attrs.style}}" childs="{{n5.children}}" opts="{{opts}}"/></block></view></block></view></block></view></block></view></block> |
New file |
| | |
| | | "use strict";function t(t,e){var s;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(s=i(t))||e&&t&&"number"==typeof t.length){s&&(t=s);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,l=!1;return{s:function(){s=t[Symbol.iterator]()},n:function(){var t=s.next();return o=t.done,t},e:function(t){l=!0,r=t},f:function(){try{o||null==s.return||s.return()}finally{if(l)throw r}}}}function i(t,i){if(t){if("string"==typeof t)return e(t,i);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?e(t,i):void 0}}function e(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=new Array(i);e<i;e++)s[e]=t[e];return s}function s(t){for(var i=Object.create(null),e=t.split(","),s=e.length;s--;)i[e[s]]=!0;return i}function n(t,i){for(var e=t.indexOf("&");-1!==e;){var s=t.indexOf(";",e+3),n=void 0;if(-1===s)break;"#"===t[e+1]?(n=parseInt(("x"===t[e+2]?"0":"")+t.substring(e+2,s)),isNaN(n)||(t=t.substr(0,e)+String.fromCharCode(n)+t.substr(s+1))):(n=t.substring(e+1,s),(l.entities[n]||"amp"===n&&i)&&(t=t.substr(0,e)+(l.entities[n]||"&")+t.substr(s+1))),e=t.indexOf("&",e+1)}return t}function a(t){for(var i=t.length-1,e=i;e>=-1;e--)(-1===e||t[e].c||!t[e].name||"div"!==t[e].name&&"p"!==t[e].name&&"h"!==t[e].name[0]||(t[e].attrs.style||"").includes("inline"))&&(i-e>=5&&t.splice(e+1,i-e,{name:"div",attrs:{},children:t.slice(e+1,i+1)}),i=e-1)}function r(t){this.options=t.data||{},this.tagStyle=Object.assign({},l.tagStyle,this.options.tagStyle),this.imgList=t.imgList||[],this.imgList._unloadimgs=0,this.plugins=t.plugins||[],this.attrs=Object.create(null),this.stack=[],this.nodes=[],this.pre=(this.options.containerStyle||"").includes("white-space")&&this.options.containerStyle.includes("pre")?2:0}function o(t){this.handler=t}var l={trustTags:s("a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video"),blockTags:s("address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section"),ignoreTags:s("area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr"),voidTags:s("area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr"),entities:{lt:"<",gt:">",quot:'"',apos:"'",ensp:"â",emsp:"â",nbsp:" ",semi:";",ndash:"â",mdash:"â",middot:"·",lsquo:"â",rsquo:"â",ldquo:"â",rdquo:"â",bull:"â¢",hellip:"â¦",larr:"â",uarr:"â",rarr:"â",darr:"â"},tagStyle:{address:"font-style:italic",big:"display:inline;font-size:1.2em",caption:"display:table-caption;text-align:center",center:"text-align:center",cite:"font-style:italic",dd:"margin-left:40px",mark:"background-color:yellow",pre:"font-family:monospace;white-space:pre",s:"text-decoration:line-through",small:"display:inline;font-size:0.8em",strike:"text-decoration:line-through",u:"text-decoration:underline"},svgDict:{animatetransform:"animateTransform",lineargradient:"linearGradient",viewbox:"viewBox",attributename:"attributeName",repeatcount:"repeatCount",repeatdur:"repeatDur",foreignobject:"foreignObject"}},h={},c,d,p=swan.getSystemInfoSync();c=p.windowWidth;var u=s(" ,\r,\n,\t,\f"),f=0;r.prototype.parse=function(t){for(var i=this.plugins.length;i--;)this.plugins[i].onUpdate&&(t=this.plugins[i].onUpdate(t,l)||t);for(new o(this).parse(t);this.stack.length;)this.popNode();return this.nodes.length>50&&a(this.nodes),this.nodes},r.prototype.expose=function(){for(var t=this.stack.length;t--;){var i=this.stack[t];if(i.c||"a"===i.name||"video"===i.name||"audio"===i.name)return;i.c=1}},r.prototype.hook=function(t){for(var i=this.plugins.length;i--;)if(this.plugins[i].onParse&&!1===this.plugins[i].onParse(t,this))return!1;return!0},r.prototype.getUrl=function(t){var i=this.options.domain;return"/"===t[0]?"/"===t[1]?t=(i?i.split("://")[0]:"http")+":"+t:i&&(t=i+t):!i||t.includes("data:")||t.includes("://")||(t=i+"/"+t),t},r.prototype.parseStyle=function(t){var i=t.attrs,e=(this.tagStyle[t.name]||"").split(";").concat((i.style||"").split(";")),s={},n="";i.id&&!this.xml&&(this.options.useAnchor?this.expose():"img"!==t.name&&"a"!==t.name&&"video"!==t.name&&"audio"!==t.name&&(i.id=void 0)),i.width&&(s.width=parseFloat(i.width)+(i.width.includes("%")?"%":"px"),i.width=void 0),i.height&&(s.height=parseFloat(i.height)+(i.height.includes("%")?"%":"px"),i.height=void 0);for(var a=0,r=e.length;a<r;a++){var o=e[a].split(":");if(!(o.length<2)){var l=o.shift().trim().toLowerCase(),h=o.join(":").trim();if("-"===h[0]&&h.lastIndexOf("-")>0||h.includes("safe"))n+=";".concat(l,":").concat(h);else if(!s[l]||h.includes("import")||!s[l].includes("import")){if(h.includes("url")){var d=h.indexOf("(")+1;if(d){for(;'"'===h[d]||"'"===h[d]||u[h[d]];)d++;h=h.substr(0,d)+this.getUrl(h.substr(d))}}else h.includes("rpx")&&(h=h.replace(/[0-9.]+\s*rpx/g,function(t){return parseFloat(t)*c/750+"px"}));s[l]=h}}}return t.attrs.style=n,s},r.prototype.onTagName=function(t){this.tagName=this.xml?t:t.toLowerCase(),"svg"===this.tagName&&(this.xml=(this.xml||0)+1,l.ignoreTags.style=void 0)},r.prototype.onAttrName=function(t){t=this.xml?t:t.toLowerCase(),"data-"===t.substr(0,5)?"data-src"!==t||this.attrs.src?"img"===this.tagName||"a"===this.tagName?this.attrName=t:this.attrName=void 0:this.attrName="src":(this.attrName=t,this.attrs[t]="T")},r.prototype.onAttrVal=function(t){var i=this.attrName||"";"style"===i||"href"===i?this.attrs[i]=n(t,!0):i.includes("src")?this.attrs[i]=this.getUrl(n(t,!0)):i&&(this.attrs[i]=t)},r.prototype.onOpenTag=function(t){var i=Object.create(null);i.name=this.tagName,i.attrs=this.attrs,this.attrs=Object.create(null);var e=i.attrs,s=this.stack[this.stack.length-1],n=s?s.children:this.nodes,a=this.xml?t:l.voidTags[i.name];if(h[i.name]&&(e.class=h[i.name]+(e.class?" "+e.class:"")),"embed"===i.name){var r=e.src||"";r.includes(".mp4")||r.includes(".3gp")||r.includes(".m3u8")||(e.type||"").includes("video")?i.name="video":(r.includes(".mp3")||r.includes(".wav")||r.includes(".aac")||r.includes(".m4a")||(e.type||"").includes("audio"))&&(i.name="audio"),e.autostart&&(e.autoplay="T"),e.controls="T"}if("video"!==i.name&&"audio"!==i.name||("video"!==i.name||e.id||(e.id="v"+f++),e.controls||e.autoplay||(e.controls="T"),i.src=[],e.src&&(i.src.push(e.src),e.src=void 0),this.expose()),a){if(!this.hook(i)||l.ignoreTags[i.name])return void("base"!==i.name||this.options.domain?"source"===i.name&&s&&("video"===s.name||"audio"===s.name)&&e.src&&s.src.push(e.src):this.options.domain=e.href);var o=this.parseStyle(i);if("img"===i.name){if(e.src&&(e.src.includes("webp")&&(i.webp="T"),e.src.includes("data:")&&"all"!==this.options.previewImg&&!e["original-src"]&&(e.ignore="T"),!e.ignore||i.webp||e.src.includes("cloud://"))){for(var d=this.stack.length;d--;){var p=this.stack[d];"table"!==p.name||i.webp||e.src.includes("cloud://")||(!o.display||o.display.includes("inline")?i.t="inline-block":i.t=o.display,o.display=void 0);var u=p.attrs.style||"";if(!u.includes("flex:")||u.includes("flex:0")||u.includes("flex: 0")||o.width&&!(parseInt(o.width)>100))if(u.includes("flex")&&"100%"===o.width)for(var g=d+1;g<this.stack.length;g++){var m=this.stack[g].attrs.style||"";if(!m.includes(";width")&&!m.includes(" width")&&0!==m.indexOf("width")){o.width="";break}}else u.includes("inline-block")&&(o.width&&"%"===o.width[o.width.length-1]?(p.attrs.style+=";max-width:"+o.width,o.width=""):p.attrs.style+=";max-width:100%");else{o.width="100% !important",o.height="";for(var v=d+1;v<this.stack.length;v++)this.stack[v].attrs.style=(this.stack[v].attrs.style||"").replace("inline-","")}"a"===p.name?i.a=p.attrs:p.c=1}i.i=this.imgList.length;var y=e["original-src"]||e.src;if(this.imgList.includes(y)){var b=y.indexOf("://");if(-1!==b){b+=3;for(var x=y.substr(0,b);b<y.length&&"/"!==y[b];b++)x+=Math.random()>.5?y[b].toUpperCase():y[b];x+=y.substr(b),y=x}}this.imgList.push(y),i.t||(this.imgList._unloadimgs+=1)}"inline"===o.display&&(o.display=""),e.ignore&&(o["max-width"]=o["max-width"]||"100%",e.style+=";-webkit-touch-callout:none"),parseInt(o.width)>c&&(o.height=void 0),isNaN(parseInt(o.width))||(i.w="T"),!isNaN(parseInt(o.height))&&(!o.height.includes("%")||s&&(s.attrs.style||"").includes("height"))&&(i.h="T"),i.w&&i.h&&o["object-fit"]&&("contain"===o["object-fit"]?i.m="aspectFit":"cover"===o["object-fit"]&&(i.m="aspectFill"))}else if("svg"===i.name)return n.push(i),this.stack.push(i),void this.popNode();for(var w in o)o[w]&&(e.style+=";".concat(w,":").concat(o[w].replace(" !important","")));e.style=e.style.substr(1)||void 0,e.style||delete e.style}else("pre"===i.name||(e.style||"").includes("white-space")&&e.style.includes("pre"))&&2!==this.pre&&(this.pre=i.pre=1),i.children=[],this.stack.push(i);n.push(i)},r.prototype.onCloseTag=function(t){t=this.xml?t:t.toLowerCase();var i;for(i=this.stack.length;i--&&this.stack[i].name!==t;);if(-1!==i)for(;this.stack.length>i;)this.popNode();else if("p"===t||"br"===t){var e=this.stack.length?this.stack[this.stack.length-1].children:this.nodes;e.push({name:t,attrs:{class:h[t],style:this.tagStyle[t]}})}},r.prototype.popNode=function(){var i=this.stack.pop(),e=i.attrs,s=i.children,n=this.stack[this.stack.length-1],r=n?n.children:this.nodes;if(!this.hook(i)||l.ignoreTags[i.name])return"title"===i.name&&s.length&&"text"===s[0].type&&this.options.setTitle&&swan.setNavigationBarTitle({title:s[0].text}),void r.pop();if(i.pre&&2!==this.pre){this.pre=i.pre=void 0;for(var o=this.stack.length;o--;)this.stack[o].pre&&(this.pre=1)}if("svg"===i.name){if(this.xml>1)return void this.xml--;var h="",d=e.style;return e.style="",e.xmlns="http://www.w3.org/2000/svg",function i(e){if("text"===e.type)return void(h+=e.text);var s=l.svgDict[e.name]||e.name;if("foreignObject"===s){var n,a=t(e.children||[]);try{for(a.s();!(n=a.n()).done;){var r=n.value;if(r.attrs&&!r.attrs.xmlns){r.attrs.xmlns="http://www.w3.org/1999/xhtml";break}}}catch(t){a.e(t)}finally{a.f()}}h+="<"+s;for(var o in e.attrs){var c=e.attrs[o];c&&(h+=" ".concat(l.svgDict[o]||o,'="').concat(c.replace(/"/g,""),'"'))}if(e.children){h+=">";for(var d=0;d<e.children.length;d++)i(e.children[d]);h+="</"+s+">"}else h+="/>"}(i),i.name="img",i.attrs={src:"data:image/svg+xml;utf8,"+h.replace(/#/g,"%23"),style:d,ignore:"T"},i.children=void 0,this.xml=!1,void(l.ignoreTags.style=!0)}var p={};if(e.align&&("table"===i.name?"center"===e.align?p["margin-inline-start"]=p["margin-inline-end"]="auto":p.float=e.align:p["text-align"]=e.align,e.align=void 0),e.dir&&(p.direction=e.dir,e.dir=void 0),"font"===i.name&&(e.color&&(p.color=e.color,e.color=void 0),e.face&&(p["font-family"]=e.face,e.face=void 0),e.size)){var u=parseInt(e.size);isNaN(u)||(u<1?u=1:u>7&&(u=7),p["font-size"]=["x-small","small","medium","large","x-large","xx-large","xxx-large"][u-1]),e.size=void 0}if((e.class||"").includes("align-center")&&(p["text-align"]="center"),Object.assign(p,this.parseStyle(i)),"table"!==i.name&&parseInt(p.width)>c&&(p["max-width"]="100%",p["box-sizing"]="border-box"),l.blockTags[i.name])i.name="div";else if(l.trustTags[i.name]||this.xml)if("a"===i.name||"ad"===i.name)this.expose();else if("video"===i.name||"audio"===i.name)(p.height||"").includes("auto")&&(p.height=void 0),i.children=void 0;else if("ul"!==i.name&&"ol"!==i.name||!i.c)if("table"===i.name){var f=parseFloat(e.cellpadding),g=parseFloat(e.cellspacing),m=parseFloat(e.border),v=p["border-color"],y=p["border-style"];if(i.c&&(isNaN(f)&&(f=2),isNaN(g)&&(g=2)),m&&(e.style+=";border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray")),i.flag&&i.c){i.flag=void 0,p.display="grid","collapse"===p["border-collapse"]&&(p["border-collapse"]=void 0,g=0),g?(p["grid-gap"]=g+"px",p.padding=g+"px"):m&&(e.style+=";border-left:0;border-top:0");var b=[],x=[],w=[],k={};!function i(e){for(var s=0;s<e.length;s++)if("tr"===e[s].name)x.push(e[s]);else if("colgroup"===e[s].name){var n,a=1,r=t(e[s].children||[]);try{for(r.s();!(n=r.n()).done;){var o=n.value;if("col"===o.name){var l=o.attrs.style||"",h=l.indexOf("width")?l.indexOf(";width"):0;if(-1!==h){var c=l.indexOf(";",h+6);-1===c&&(c=l.length),b[a]=l.substring(h?h+7:6,c)}a+=1}}}catch(t){r.e(t)}finally{r.f()}}else i(e[s].children||[])}(s);for(var N=1;N<=x.length;N++){for(var T=1,O=0;O<x[N-1].children.length;O++){var j=x[N-1].children[O];if("td"===j.name||"th"===j.name){for(;k[N+"."+T];)T++;j.c=1;var S=j.attrs.style||"",C=S.indexOf("width")?S.indexOf(";width"):0;if(-1!==C){var A=S.indexOf(";",C+6);-1===A&&(A=S.length),j.attrs.colspan||(b[T]=S.substring(C?C+7:6,A)),S=S.substr(0,C)+S.substr(A)}if(S+=";display:flex;flex-direction:column",-1!==(C=S.indexOf("vertical-align"))){var I=S.substr(C+15,10);I.includes("middle")?S+=";justify-content:center":I.includes("bottom")&&(S+=";justify-content:flex-end")}else S+=";justify-content:center";if(-1!==(C=S.indexOf("text-align"))){var L=S.substr(C+11,10);L.includes("center")?S+=";justify-content: center":L.includes("right")&&(S+=";justify-content: right")}if(S=(m?";border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray")+(g?"":";border-right:0;border-bottom:0"):"")+(f?";padding:".concat(f,"px"):"")+";"+S,j.attrs.colspan&&(S+=";grid-column-start:".concat(T,";grid-column-end:").concat(T+parseInt(j.attrs.colspan)),j.attrs.rowspan||(S+=";grid-row-start:".concat(N,";grid-row-end:").concat(N+1)),T+=parseInt(j.attrs.colspan)-1),j.attrs.rowspan){S+=";grid-row-start:".concat(N,";grid-row-end:").concat(N+parseInt(j.attrs.rowspan)),j.attrs.colspan||(S+=";grid-column-start:".concat(T,";grid-column-end:").concat(T+1));for(var z=1;z<j.attrs.rowspan;z++)for(var F=0;F<(j.attrs.colspan||1);F++)k[N+z+"."+(T-F)]=1}S&&(j.attrs.style=S),w.push(j),T++}}if(1===N){for(var q="",U=1;U<T;U++)q+=(b[U]?b[U]:"auto")+" ";p["grid-template-columns"]=q}}i.children=w}else i.c&&(p.display="table"),isNaN(g)||(p["border-spacing"]=g+"px"),(m||f||i.c)&&function t(e){for(var s=0;s<e.length;s++){var n=e[s];i.c&&(n.c=1),"th"===n.name||"td"===n.name?(m&&(n.attrs.style="border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray",";").concat(n.attrs.style||"")),f&&(n.attrs.style="padding:".concat(f,"px;").concat(n.attrs.style||""))):n.children&&t(n.children)}}(s);if(this.options.scrollTable&&!(e.style||"").includes("inline")){var V=Object.assign({},i);i.name="div",i.attrs={style:"overflow-x:auto;padding:1px"},i.children=[V],e=V.attrs}}else if(("tbody"===i.name||"tr"===i.name)&&i.flag&&i.c)i.flag=void 0,function t(i){for(var e=0;e<i.length;e++)if("td"===i[e].name)for(var s=0,n=["color","background","background-color"];s<n.length;s++){var a=n[s];p[a]&&(i[e].attrs.style=a+":"+p[a]+";"+(i[e].attrs.style||""))}else t(i[e].children||[])}(s);else if("td"!==i.name&&"th"!==i.name||!e.colspan&&!e.rowspan){if("ruby"===i.name){i.name="span";for(var D=0;D<s.length-1;D++)"text"===s[D].type&&"rt"===s[D+1].name&&(s[D]={name:"span",attrs:{style:"display:inline-block;text-align:center"},children:[{name:"div",attrs:{style:"font-size:50%;"+(s[D+1].attrs.style||"")},children:s[D+1].children},s[D]]},s.splice(D+1,1))}}else for(var B=this.stack.length;B--;)"table"!==this.stack[B].name&&"tbody"!==this.stack[B].name&&"tr"!==this.stack[B].name||(this.stack[B].flag=1);else{var M={a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"};M[e.type]&&(e.style+=";list-style-type:"+M[e.type],e.type=void 0),i.c=1;for(var P=s.length;P--;)"li"===s[P].name&&(s[P].c=1)}else i.name="span";if((p.display||"").includes("flex")&&!i.c)for(var Z=s.length;Z--;){var _=s[Z];_.f&&(_.attrs.style=(_.attrs.style||"")+_.f,_.f=void 0)}var E=n&&((n.attrs.style||"").includes("flex")||(n.attrs.style||"").includes("grid"))&&!i.c;E&&(i.f=";max-width:100%"),s.length>=50&&i.c&&!(p.display||"").includes("flex")&&a(s);for(var G in p)if(p[G]){var W=";".concat(G,":").concat(p[G].replace(" !important",""));E&&(G.includes("flex")&&"flex-direction"!==G||"align-self"===G||G.includes("grid")||"-"===p[G][0]||G.includes("width")&&W.includes("%"))?(i.f+=W,"width"===G&&(e.style+=";width:100%")):e.style+=W}e.style=e.style.substr(1)||void 0,e.style||delete e.style},r.prototype.onText=function(t){if(!this.pre){for(var i,e="",s=0,a=t.length;s<a;s++)u[t[s]]?(" "!==e[e.length-1]&&(e+=" "),"\n"!==t[s]||i||(i=!0)):e+=t[s];if(" "===e&&i)return;t=e}var r=Object.create(null);if(r.type="text",r.text=n(t),this.hook(r)){(this.stack.length?this.stack[this.stack.length-1].children:this.nodes).push(r)}},o.prototype.parse=function(t){this.content=t||"",this.i=0,this.start=0,this.state=this.text;for(var i=this.content.length;-1!==this.i&&this.i<i;)this.state()},o.prototype.checkClose=function(t){var i="/"===this.content[this.i];return!!(">"===this.content[this.i]||i&&">"===this.content[this.i+1])&&(t&&this.handler[t](this.content.substring(this.start,this.i)),this.i+=i?2:1,this.start=this.i,this.handler.onOpenTag(i),"script"===this.handler.tagName?(this.i=this.content.indexOf("</",this.i),-1!==this.i&&(this.i+=2,this.start=this.i),this.state=this.endTag):this.state=this.text,!0)},o.prototype.text=function(){if(this.i=this.content.indexOf("<",this.i),-1===this.i)return void(this.start<this.content.length&&this.handler.onText(this.content.substring(this.start,this.content.length)));var t=this.content[this.i+1];if(t>="a"&&t<="z"||t>="A"&&t<="Z")this.start!==this.i&&this.handler.onText(this.content.substring(this.start,this.i)),this.start=++this.i,this.state=this.tagName;else if("/"===t||"!"===t||"?"===t){this.start!==this.i&&this.handler.onText(this.content.substring(this.start,this.i));var i=this.content[this.i+2];if("/"===t&&(i>="a"&&i<="z"||i>="A"&&i<="Z"))return this.i+=2,this.start=this.i,void(this.state=this.endTag);var e="--\x3e";"!"===t&&"-"===this.content[this.i+2]&&"-"===this.content[this.i+3]||(e=">"),this.i=this.content.indexOf(e,this.i),-1!==this.i&&(this.i+=e.length,this.start=this.i)}else this.i++},o.prototype.tagName=function(){if(u[this.content[this.i]]){for(this.handler.onTagName(this.content.substring(this.start,this.i));u[this.content[++this.i]];);this.i<this.content.length&&!this.checkClose()&&(this.start=this.i,this.state=this.attrName)}else this.checkClose("onTagName")||this.i++},o.prototype.attrName=function(){var t=this.content[this.i];if(u[t]||"="===t){this.handler.onAttrName(this.content.substring(this.start,this.i));for(var i="="===t,e=this.content.length;++this.i<e;)if(t=this.content[this.i],!u[t]){if(this.checkClose())return;if(i)return this.start=this.i,void(this.state=this.attrVal);if("="!==this.content[this.i])return this.start=this.i,void(this.state=this.attrName);i=!0}}else this.checkClose("onAttrName")||this.i++},o.prototype.attrVal=function(){var t=this.content[this.i],i=this.content.length;if('"'===t||"'"===t){if(this.start=++this.i,this.i=this.content.indexOf(t,this.i),-1===this.i)return;this.handler.onAttrVal(this.content.substring(this.start,this.i))}else for(;this.i<i;this.i++){if(u[this.content[this.i]]){this.handler.onAttrVal(this.content.substring(this.start,this.i));break}if(this.checkClose("onAttrVal"))return}for(;u[this.content[++this.i]];);this.i<i&&!this.checkClose()&&(this.start=this.i,this.state=this.attrName)},o.prototype.endTag=function(){var t=this.content[this.i];if(u[t]||">"===t||"/"===t){if(this.handler.onCloseTag(this.content.substring(this.start,this.i)),">"!==t&&(this.i=this.content.indexOf(">",this.i),-1===this.i))return;this.start=++this.i,this.state=this.text}else this.i++},module.exports=r; |
New file |
| | |
| | | "use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}/*! |
| | | * mp-html v2.5.1 |
| | | * https://github.com/jin-yufeng/mp-html |
| | | * |
| | | * Released under the MIT license |
| | | * Author: Jin Yufeng |
| | | */ |
| | | var t=require("./parser"),n=[];Component({data:{nodes:[]},properties:{containerStyle:String,content:{type:String,value:"",observer:function(e){this.setContent(e)}},copyLink:{type:Boolean,value:!0},domain:String,errorImg:String,lazyLoad:Boolean,loadingImg:String,pauseVideo:{type:Boolean,value:!0},previewImg:{type:null,value:!0},scrollTable:Boolean,selectable:null,setTitle:{type:Boolean,value:!0},showImgMenu:{type:Boolean,value:!0},tagStyle:Object,useAnchor:null},created:function(){this.plugins=[];for(var e=n.length;e--;)this.plugins.push(new n[e](this))},detached:function(){this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){var i=this;return new Promise(function(o,r){if(!i.data.useAnchor)return void r(Error("Anchor is disabled"));var a=qq.createSelectorQuery().in(i._in?i._in.page:i).select((i._in?i._in.selector:"._root")+(t?"".concat(">>>","#").concat(t):"")).boundingClientRect();i._in?a.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect():a.selectViewport().scrollOffset(),a.exec(function(t){if(!t[0])return void r(Error("Label not found"));var a=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(i.data.useAnchor)||0);i._in?i._in.page.setData(e({},i._in.scrollTop,a)):qq.pageScrollTo({scrollTop:a,duration:300}),o()})})},getText:function(e){var t="";return function e(n){for(var i=0;i<n.length;i++){var o=n[i];if("text"===o.type)t+=o.text.replace(/&/g,"&");else if("br"===o.name)t+="\n";else{var r="p"===o.name||"div"===o.name||"tr"===o.name||"li"===o.name||"h"===o.name[0]&&o.name[1]>"0"&&o.name[1]<"7";r&&t&&"\n"!==t[t.length-1]&&(t+="\n"),o.children&&e(o.children),r&&"\n"!==t[t.length-1]?t+="\n":"td"!==o.name&&"th"!==o.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){var e=this;return new Promise(function(t,n){qq.createSelectorQuery().in(e).select("._root").boundingClientRect().exec(function(e){return e[0]?t(e[0]):n(Error("Root label not found"))})})},pauseMedia:function(){for(var e=(this._videos||[]).length;e--;)this._videos[e].pause()},setPlaybackRate:function(e){this.playbackRate=e;for(var t=(this._videos||[]).length;t--;)this._videos[t].playbackRate(e)},setContent:function(e,n){var i=this;this.imgList&&n||(this.imgList=[]),this._videos=[];var o={},r=new t(this).parse(e);if(n)for(var a=this.data.nodes.length,s=r.length;s--;)o["nodes[".concat(a+s,"]")]=r[s];else o.nodes=r;if(this.setData(o,function(){i._hook("onLoad"),i.triggerEvent("load")}),this.data.lazyLoad||this.imgList._unloadimgs<this.imgList.length/2){var l=0,c=function e(t){t&&t.height||(t={}),t.height===l?i.triggerEvent("ready",t):(l=t.height,setTimeout(function(){i.getRect().then(e).catch(e)},350))};this.getRect().then(c).catch(c)}else this.imgList._unloadimgs||this.getRect().then(function(e){i.triggerEvent("ready",e)}).catch(function(){i.triggerEvent("ready",{})})},_hook:function(e){for(var t=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.detail.root=this}}}); |
New file |
| | |
| | | {"component":true,"usingComponents":{"node":"./node/node"}} |
New file |
| | |
| | | <view class="_root {{selectable?'_select':''}}" style="{{containerStyle}}"><slot qq:if="{{!nodes[0]}}"/><node id="_root" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]}}" catchadd="_add"/></view> |
New file |
| | |
| | | ._root{padding:1px 0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}._select{-webkit-user-select:text;user-select:text} |
New file |
| | |
| | | "use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function e(e){for(var i=1;i<arguments.length;i++){var o=null!=arguments[i]?arguments[i]:{};i%2?t(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function r(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Component({data:{ctrl:{}},properties:{childs:Array,opts:Array},options:{addGlobalClass:!0},attached:function(){this.triggerEvent("add",this,{bubbles:!0,composed:!0})},methods:{noop:function(){},getNode:function(t){try{for(var e=t.split("_"),r=this.data.childs[e[0]],i=1;i<e.length;i++)r=r.children[e[i]];return r}catch(t){return{text:"",attrs:{},children:[]}}},play:function(t){var r=t.target.dataset.i,i=this.getNode(r);if(this.root.triggerEvent("play",{source:i.name,attrs:e(e({},i.attrs),{},{src:i.src[this.data.ctrl[r]||0]})}),this.root.data.pauseVideo){for(var o=!1,a=t.target.id,s=this.root._videos.length;s--;)this.root._videos[s].id===a?o=!0:this.root._videos[s].pause();if(!o){var n=qq.createVideoContext(a,this);n.id=a,this.root.playbackRate&&n.playbackRate(this.root.playbackRate),this.root._videos.push(n)}}},imgTap:function(t){var e=this.getNode(t.target.dataset.i);if(e.a)return this.linkTap(e.a);if(!e.attrs.ignore&&(this.root.triggerEvent("imgtap",e.attrs),this.root.data.previewImg)){var r=this.root.imgList[e.i];qq.previewImage({current:r,urls:this.root.imgList})}},imgLoad:function(t){var e,i=t.target.dataset.i,o=this.getNode(i);o.w?(this.data.opts[1]&&!this.data.ctrl[i]||-1===this.data.ctrl[i])&&(e=1):e=t.detail.width,e&&this.setData(r({},"ctrl."+i,e)),this.checkReady()},checkReady:function(){var t=this;this.root.data.lazyLoad||(this.root.imgList._unloadimgs-=1,this.root.imgList._unloadimgs||setTimeout(function(){t.root.getRect().then(function(e){t.root.triggerEvent("ready",e)}).catch(function(){t.root.triggerEvent("ready",{})})},350))},linkTap:function(t){var e=t.currentTarget?this.getNode(t.currentTarget.dataset.i):{},r=e.attrs||t,i=r.href;this.root.triggerEvent("linktap",Object.assign({innerText:this.root.getText(e.children||[])},r)),i&&("#"===i[0]?this.root.navigateTo(i.substring(1)).catch(function(){}):i.split("?")[0].includes("://")?this.root.data.copyLink&&qq.setClipboardData({data:i,success:function(){return qq.showToast({title:"龿¥å·²å¤å¶"})}}):qq.navigateTo({url:i,fail:function(){qq.switchTab({url:i,fail:function(){}})}}))},mediaError:function(t){var e=t.target.dataset.i,i=this.getNode(e);if("video"===i.name||"audio"===i.name){var o=(this.data.ctrl[e]||0)+1;if(o>i.src.length&&(o=0),o<i.src.length)return this.setData(r({},"ctrl."+e,o))}else"img"===i.name&&(this.data.opts[2]&&this.setData(r({},"ctrl."+e,-1)),this.checkReady());this.root&&this.root.triggerEvent("error",{source:i.name,attrs:i.attrs,errMsg:t.detail.errMsg})}}}); |
New file |
| | |
| | | {"component":true,"usingComponents":{"node":"./node"}} |
New file |
| | |
| | | <qs module="isInline">var e={abbr:!0,b:!0,big:!0,code:!0,del:!0,em:!0,i:!0,ins:!0,label:!0,q:!0,small:!0,span:!0,strong:!0,sub:!0,sup:!0};module.exports=function(n,i){return e[n]||-1!==(i||"").indexOf("inline")};</qs><template name="el"><block qq:if="{{n.name==='img'}}"><rich-text qq:if="{{n.t}}" style="display:{{n.t}}" nodes="<img class='_img' style='{{n.attrs.style}}' src='{{n.attrs.src}}'>" data-i="{{i}}" catchtap="imgTap"/><block qq:else><image qq:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix"/><image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{ctrl[i]===-1?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))}}" lazy-load="{{opts[0]}}" data-i="{{i}}" bindload="imgLoad" binderror="mediaError" catchtap="imgTap" bindlongpress="noop"/></block></block><text qq:elif="{{n.text}}" decode>{{n.text}}</text><text qq:elif="{{n.name==='br'}}">{{'\n'}}</text><view qq:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchtap="linkTap"><node childs="{{n.children}}" opts="{{opts}}" style="display:inherit"/></view><video qq:elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" object-fit="{{n.attrs['object-fit']}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><audio qq:elif="{{n.name==='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><rich-text qq:else id="{{n.attrs.id}}" style="{{n.f}}" nodes="{{[n]}}"/></template><block qq:for="{{childs}}" qq:for-item="n1" qq:for-index="i1" qq:key="i1"><template qq:if="{{!n1.c&&(!n1.children||n1.name==='a'||!isInline(n1.name,n1.attrs.style))}}" is="el" data="{{n:n1,i:''+i1,opts:opts,ctrl:ctrl}}"/><view qq:else id="{{n1.attrs.id}}" class="_{{n1.name}} {{n1.attrs.class}}" style="{{n1.attrs.style}}"><block qq:for="{{n1.children}}" qq:for-item="n2" qq:for-index="i2" qq:key="i2"><template qq:if="{{!n2.c&&(!n2.children||n2.name==='a'||!isInline(n2.name,n2.attrs.style))}}" is="el" data="{{n:n2,i:i1+'_'+i2,opts:opts,ctrl:ctrl}}"/><view qq:else id="{{n2.attrs.id}}" class="_{{n2.name}} {{n2.attrs.class}}" style="{{n2.attrs.style}}"><block qq:for="{{n2.children}}" qq:for-item="n3" qq:for-index="i3" qq:key="i3"><template qq:if="{{!n3.c&&(!n3.children||n3.name==='a'||!isInline(n3.name,n3.attrs.style))}}" is="el" data="{{n:n3,i:i1+'_'+i2+'_'+i3,opts:opts,ctrl:ctrl}}"/><view qq:else id="{{n3.attrs.id}}" class="_{{n3.name}} {{n3.attrs.class}}" style="{{n3.attrs.style}}"><block qq:for="{{n3.children}}" qq:for-item="n4" qq:for-index="i4" qq:key="i4"><template qq:if="{{!n4.c&&(!n4.children||n4.name==='a'||!isInline(n4.name,n4.attrs.style))}}" is="el" data="{{n:n4,i:i1+'_'+i2+'_'+i3+'_'+i4,opts:opts,ctrl:ctrl}}"/><view qq:else id="{{n4.attrs.id}}" class="_{{n4.name}} {{n4.attrs.class}}" style="{{n4.attrs.style}}"><block qq:for="{{n4.children}}" qq:for-item="n5" qq:for-index="i5" qq:key="i5"><template qq:if="{{!n5.c&&(!n5.children||n5.name==='a'||!isInline(n5.name,n5.attrs.style))}}" is="el" data="{{n:n5,i:i1+'_'+i2+'_'+i3+'_'+i4+'_'+i5,opts:opts,ctrl:ctrl}}"/><node qq:else id="{{n5.attrs.id}}" class="_{{n5.name}} {{n5.attrs.class}}" style="{{n5.attrs.style}}" childs="{{n5.children}}" opts="{{opts}}"/></block></view></block></view></block></view></block></view></block> |
New file |
| | |
| | | ._a{padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._img{max-width:100%;-webkit-touch-callout:none}._b,._strong{font-weight:700}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:700}._ins{text-decoration:underline}._li{display:list-item}._ol{list-style-type:decimal}._ol,._ul{display:block;padding-left:40px;margin:1em 0}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}._tbody,._tfoot,._thead{display:table-row-group}._tr{display:table-row}._td,._th{display:table-cell;vertical-align:middle}._th{font-weight:700;text-align:center}._ul{list-style-type:disc}._ul ._ul{margin:0;list-style-type:circle}._ul ._ul ._ul{list-style-type:square}._abbr,._b,._code,._del,._em,._i,._ins,._label,._q,._span,._strong,._sub,._sup{display:inline}._blockquote,._div,._p{display:block} |
New file |
| | |
| | | "use strict";function t(t,e){var s;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(s=i(t))||e&&t&&"number"==typeof t.length){s&&(t=s);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,l=!1;return{s:function(){s=t[Symbol.iterator]()},n:function(){var t=s.next();return o=t.done,t},e:function(t){l=!0,r=t},f:function(){try{o||null==s.return||s.return()}finally{if(l)throw r}}}}function i(t,i){if(t){if("string"==typeof t)return e(t,i);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?e(t,i):void 0}}function e(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=new Array(i);e<i;e++)s[e]=t[e];return s}function s(t){for(var i=Object.create(null),e=t.split(","),s=e.length;s--;)i[e[s]]=!0;return i}function n(t,i){for(var e=t.indexOf("&");-1!==e;){var s=t.indexOf(";",e+3),n=void 0;if(-1===s)break;"#"===t[e+1]?(n=parseInt(("x"===t[e+2]?"0":"")+t.substring(e+2,s)),isNaN(n)||(t=t.substr(0,e)+String.fromCharCode(n)+t.substr(s+1))):(n=t.substring(e+1,s),(l.entities[n]||"amp"===n&&i)&&(t=t.substr(0,e)+(l.entities[n]||"&")+t.substr(s+1))),e=t.indexOf("&",e+1)}return t}function a(t){for(var i=t.length-1,e=i;e>=-1;e--)(-1===e||t[e].c||!t[e].name||"div"!==t[e].name&&"p"!==t[e].name&&"h"!==t[e].name[0]||(t[e].attrs.style||"").includes("inline"))&&(i-e>=5&&t.splice(e+1,i-e,{name:"div",attrs:{},children:t.slice(e+1,i+1)}),i=e-1)}function r(t){this.options=t.data||{},this.tagStyle=Object.assign({},l.tagStyle,this.options.tagStyle),this.imgList=t.imgList||[],this.imgList._unloadimgs=0,this.plugins=t.plugins||[],this.attrs=Object.create(null),this.stack=[],this.nodes=[],this.pre=(this.options.containerStyle||"").includes("white-space")&&this.options.containerStyle.includes("pre")?2:0}function o(t){this.handler=t}var l={trustTags:s("a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video"),blockTags:s("address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section"),ignoreTags:s("area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr"),voidTags:s("area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr"),entities:{lt:"<",gt:">",quot:'"',apos:"'",ensp:"â",emsp:"â",nbsp:" ",semi:";",ndash:"â",mdash:"â",middot:"·",lsquo:"â",rsquo:"â",ldquo:"â",rdquo:"â",bull:"â¢",hellip:"â¦",larr:"â",uarr:"â",rarr:"â",darr:"â"},tagStyle:{address:"font-style:italic",big:"display:inline;font-size:1.2em",caption:"display:table-caption;text-align:center",center:"text-align:center",cite:"font-style:italic",dd:"margin-left:40px",mark:"background-color:yellow",pre:"font-family:monospace;white-space:pre",s:"text-decoration:line-through",small:"display:inline;font-size:0.8em",strike:"text-decoration:line-through",u:"text-decoration:underline"},svgDict:{animatetransform:"animateTransform",lineargradient:"linearGradient",viewbox:"viewBox",attributename:"attributeName",repeatcount:"repeatCount",repeatdur:"repeatDur",foreignobject:"foreignObject"}},h={},c,d,p=qq.getSystemInfoSync();c=p.windowWidth;var u=s(" ,\r,\n,\t,\f"),f=0;r.prototype.parse=function(t){for(var i=this.plugins.length;i--;)this.plugins[i].onUpdate&&(t=this.plugins[i].onUpdate(t,l)||t);for(new o(this).parse(t);this.stack.length;)this.popNode();return this.nodes.length>50&&a(this.nodes),this.nodes},r.prototype.expose=function(){for(var t=this.stack.length;t--;){var i=this.stack[t];if(i.c||"a"===i.name||"video"===i.name||"audio"===i.name)return;i.c=1}},r.prototype.hook=function(t){for(var i=this.plugins.length;i--;)if(this.plugins[i].onParse&&!1===this.plugins[i].onParse(t,this))return!1;return!0},r.prototype.getUrl=function(t){var i=this.options.domain;return"/"===t[0]?"/"===t[1]?t=(i?i.split("://")[0]:"http")+":"+t:i&&(t=i+t):!i||t.includes("data:")||t.includes("://")||(t=i+"/"+t),t},r.prototype.parseStyle=function(t){var i=t.attrs,e=(this.tagStyle[t.name]||"").split(";").concat((i.style||"").split(";")),s={},n="";i.id&&!this.xml&&(this.options.useAnchor?this.expose():"img"!==t.name&&"a"!==t.name&&"video"!==t.name&&"audio"!==t.name&&(i.id=void 0)),i.width&&(s.width=parseFloat(i.width)+(i.width.includes("%")?"%":"px"),i.width=void 0),i.height&&(s.height=parseFloat(i.height)+(i.height.includes("%")?"%":"px"),i.height=void 0);for(var a=0,r=e.length;a<r;a++){var o=e[a].split(":");if(!(o.length<2)){var l=o.shift().trim().toLowerCase(),h=o.join(":").trim();if("-"===h[0]&&h.lastIndexOf("-")>0||h.includes("safe"))n+=";".concat(l,":").concat(h);else if(!s[l]||h.includes("import")||!s[l].includes("import")){if(h.includes("url")){var d=h.indexOf("(")+1;if(d){for(;'"'===h[d]||"'"===h[d]||u[h[d]];)d++;h=h.substr(0,d)+this.getUrl(h.substr(d))}}else h.includes("rpx")&&(h=h.replace(/[0-9.]+\s*rpx/g,function(t){return parseFloat(t)*c/750+"px"}));s[l]=h}}}return t.attrs.style=n,s},r.prototype.onTagName=function(t){this.tagName=this.xml?t:t.toLowerCase(),"svg"===this.tagName&&(this.xml=(this.xml||0)+1,l.ignoreTags.style=void 0)},r.prototype.onAttrName=function(t){t=this.xml?t:t.toLowerCase(),"data-"===t.substr(0,5)?"data-src"!==t||this.attrs.src?"img"===this.tagName||"a"===this.tagName?this.attrName=t:this.attrName=void 0:this.attrName="src":(this.attrName=t,this.attrs[t]="T")},r.prototype.onAttrVal=function(t){var i=this.attrName||"";"style"===i||"href"===i?this.attrs[i]=n(t,!0):i.includes("src")?this.attrs[i]=this.getUrl(n(t,!0)):i&&(this.attrs[i]=t)},r.prototype.onOpenTag=function(t){var i=Object.create(null);i.name=this.tagName,i.attrs=this.attrs,this.attrs=Object.create(null);var e=i.attrs,s=this.stack[this.stack.length-1],n=s?s.children:this.nodes,a=this.xml?t:l.voidTags[i.name];if(h[i.name]&&(e.class=h[i.name]+(e.class?" "+e.class:"")),"embed"===i.name){var r=e.src||"";r.includes(".mp4")||r.includes(".3gp")||r.includes(".m3u8")||(e.type||"").includes("video")?i.name="video":(r.includes(".mp3")||r.includes(".wav")||r.includes(".aac")||r.includes(".m4a")||(e.type||"").includes("audio"))&&(i.name="audio"),e.autostart&&(e.autoplay="T"),e.controls="T"}if("video"!==i.name&&"audio"!==i.name||("video"!==i.name||e.id||(e.id="v"+f++),e.controls||e.autoplay||(e.controls="T"),i.src=[],e.src&&(i.src.push(e.src),e.src=void 0),this.expose()),a){if(!this.hook(i)||l.ignoreTags[i.name])return void("base"!==i.name||this.options.domain?"source"===i.name&&s&&("video"===s.name||"audio"===s.name)&&e.src&&s.src.push(e.src):this.options.domain=e.href);var o=this.parseStyle(i);if("img"===i.name){if(e.src&&(e.src.includes("webp")&&(i.webp="T"),e.src.includes("data:")&&"all"!==this.options.previewImg&&!e["original-src"]&&(e.ignore="T"),!e.ignore||i.webp||e.src.includes("cloud://"))){for(var d=this.stack.length;d--;){var p=this.stack[d];"table"!==p.name||i.webp||e.src.includes("cloud://")||(!o.display||o.display.includes("inline")?i.t="inline-block":i.t=o.display,o.display=void 0);var u=p.attrs.style||"";if(!u.includes("flex:")||u.includes("flex:0")||u.includes("flex: 0")||o.width&&!(parseInt(o.width)>100))if(u.includes("flex")&&"100%"===o.width)for(var g=d+1;g<this.stack.length;g++){var m=this.stack[g].attrs.style||"";if(!m.includes(";width")&&!m.includes(" width")&&0!==m.indexOf("width")){o.width="";break}}else u.includes("inline-block")&&(o.width&&"%"===o.width[o.width.length-1]?(p.attrs.style+=";max-width:"+o.width,o.width=""):p.attrs.style+=";max-width:100%");else{o.width="100% !important",o.height="";for(var v=d+1;v<this.stack.length;v++)this.stack[v].attrs.style=(this.stack[v].attrs.style||"").replace("inline-","")}"a"===p.name?i.a=p.attrs:p.c=1}i.i=this.imgList.length;var y=e["original-src"]||e.src;if(this.imgList.includes(y)){var b=y.indexOf("://");if(-1!==b){b+=3;for(var x=y.substr(0,b);b<y.length&&"/"!==y[b];b++)x+=Math.random()>.5?y[b].toUpperCase():y[b];x+=y.substr(b),y=x}}this.imgList.push(y),i.t||(this.imgList._unloadimgs+=1)}"inline"===o.display&&(o.display=""),e.ignore&&(o["max-width"]=o["max-width"]||"100%",e.style+=";-webkit-touch-callout:none"),parseInt(o.width)>c&&(o.height=void 0),isNaN(parseInt(o.width))||(i.w="T"),!isNaN(parseInt(o.height))&&(!o.height.includes("%")||s&&(s.attrs.style||"").includes("height"))&&(i.h="T"),i.w&&i.h&&o["object-fit"]&&("contain"===o["object-fit"]?i.m="aspectFit":"cover"===o["object-fit"]&&(i.m="aspectFill"))}else if("svg"===i.name)return n.push(i),this.stack.push(i),void this.popNode();for(var w in o)o[w]&&(e.style+=";".concat(w,":").concat(o[w].replace(" !important","")));e.style=e.style.substr(1)||void 0}else("pre"===i.name||(e.style||"").includes("white-space")&&e.style.includes("pre"))&&2!==this.pre&&(this.pre=i.pre=1),i.children=[],this.stack.push(i);n.push(i)},r.prototype.onCloseTag=function(t){t=this.xml?t:t.toLowerCase();var i;for(i=this.stack.length;i--&&this.stack[i].name!==t;);if(-1!==i)for(;this.stack.length>i;)this.popNode();else if("p"===t||"br"===t){var e=this.stack.length?this.stack[this.stack.length-1].children:this.nodes;e.push({name:t,attrs:{class:h[t],style:this.tagStyle[t]}})}},r.prototype.popNode=function(){var i=this.stack.pop(),e=i.attrs,s=i.children,n=this.stack[this.stack.length-1],r=n?n.children:this.nodes;if(!this.hook(i)||l.ignoreTags[i.name])return"title"===i.name&&s.length&&"text"===s[0].type&&this.options.setTitle&&qq.setNavigationBarTitle({title:s[0].text}),void r.pop();if(i.pre&&2!==this.pre){this.pre=i.pre=void 0;for(var o=this.stack.length;o--;)this.stack[o].pre&&(this.pre=1)}if("svg"===i.name){if(this.xml>1)return void this.xml--;var h="",d=e.style;return e.style="",e.xmlns="http://www.w3.org/2000/svg",function i(e){if("text"===e.type)return void(h+=e.text);var s=l.svgDict[e.name]||e.name;if("foreignObject"===s){var n,a=t(e.children||[]);try{for(a.s();!(n=a.n()).done;){var r=n.value;if(r.attrs&&!r.attrs.xmlns){r.attrs.xmlns="http://www.w3.org/1999/xhtml";break}}}catch(t){a.e(t)}finally{a.f()}}h+="<"+s;for(var o in e.attrs){var c=e.attrs[o];c&&(h+=" ".concat(l.svgDict[o]||o,'="').concat(c.replace(/"/g,""),'"'))}if(e.children){h+=">";for(var d=0;d<e.children.length;d++)i(e.children[d]);h+="</"+s+">"}else h+="/>"}(i),i.name="img",i.attrs={src:"data:image/svg+xml;utf8,"+h.replace(/#/g,"%23"),style:d,ignore:"T"},i.children=void 0,this.xml=!1,void(l.ignoreTags.style=!0)}var p={};if(e.align&&("table"===i.name?"center"===e.align?p["margin-inline-start"]=p["margin-inline-end"]="auto":p.float=e.align:p["text-align"]=e.align,e.align=void 0),e.dir&&(p.direction=e.dir,e.dir=void 0),"font"===i.name&&(e.color&&(p.color=e.color,e.color=void 0),e.face&&(p["font-family"]=e.face,e.face=void 0),e.size)){var u=parseInt(e.size);isNaN(u)||(u<1?u=1:u>7&&(u=7),p["font-size"]=["x-small","small","medium","large","x-large","xx-large","xxx-large"][u-1]),e.size=void 0}if((e.class||"").includes("align-center")&&(p["text-align"]="center"),Object.assign(p,this.parseStyle(i)),"table"!==i.name&&parseInt(p.width)>c&&(p["max-width"]="100%",p["box-sizing"]="border-box"),l.blockTags[i.name])i.name="div";else if(l.trustTags[i.name]||this.xml)if("a"===i.name||"ad"===i.name)this.expose();else if("video"===i.name||"audio"===i.name)(p.height||"").includes("auto")&&(p.height=void 0),i.children=void 0;else if("ul"!==i.name&&"ol"!==i.name||!i.c)if("table"===i.name){var f=parseFloat(e.cellpadding),g=parseFloat(e.cellspacing),m=parseFloat(e.border),v=p["border-color"],y=p["border-style"];if(i.c&&(isNaN(f)&&(f=2),isNaN(g)&&(g=2)),m&&(e.style+=";border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray")),i.flag&&i.c){i.flag=void 0,p.display="grid","collapse"===p["border-collapse"]&&(p["border-collapse"]=void 0,g=0),g?(p["grid-gap"]=g+"px",p.padding=g+"px"):m&&(e.style+=";border-left:0;border-top:0");var b=[],x=[],w=[],k={};!function i(e){for(var s=0;s<e.length;s++)if("tr"===e[s].name)x.push(e[s]);else if("colgroup"===e[s].name){var n,a=1,r=t(e[s].children||[]);try{for(r.s();!(n=r.n()).done;){var o=n.value;if("col"===o.name){var l=o.attrs.style||"",h=l.indexOf("width")?l.indexOf(";width"):0;if(-1!==h){var c=l.indexOf(";",h+6);-1===c&&(c=l.length),b[a]=l.substring(h?h+7:6,c)}a+=1}}}catch(t){r.e(t)}finally{r.f()}}else i(e[s].children||[])}(s);for(var N=1;N<=x.length;N++){for(var T=1,O=0;O<x[N-1].children.length;O++){var j=x[N-1].children[O];if("td"===j.name||"th"===j.name){for(;k[N+"."+T];)T++;j.c=1;var S=j.attrs.style||"",C=S.indexOf("width")?S.indexOf(";width"):0;if(-1!==C){var A=S.indexOf(";",C+6);-1===A&&(A=S.length),j.attrs.colspan||(b[T]=S.substring(C?C+7:6,A)),S=S.substr(0,C)+S.substr(A)}if(S+=";display:flex;flex-direction:column",-1!==(C=S.indexOf("vertical-align"))){var I=S.substr(C+15,10);I.includes("middle")?S+=";justify-content:center":I.includes("bottom")&&(S+=";justify-content:flex-end")}else S+=";justify-content:center";if(-1!==(C=S.indexOf("text-align"))){var L=S.substr(C+11,10);L.includes("center")?S+=";justify-content: center":L.includes("right")&&(S+=";justify-content: right")}if(S=(m?";border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray")+(g?"":";border-right:0;border-bottom:0"):"")+(f?";padding:".concat(f,"px"):"")+";"+S,j.attrs.colspan&&(S+=";grid-column-start:".concat(T,";grid-column-end:").concat(T+parseInt(j.attrs.colspan)),j.attrs.rowspan||(S+=";grid-row-start:".concat(N,";grid-row-end:").concat(N+1)),T+=parseInt(j.attrs.colspan)-1),j.attrs.rowspan){S+=";grid-row-start:".concat(N,";grid-row-end:").concat(N+parseInt(j.attrs.rowspan)),j.attrs.colspan||(S+=";grid-column-start:".concat(T,";grid-column-end:").concat(T+1));for(var z=1;z<j.attrs.rowspan;z++)for(var F=0;F<(j.attrs.colspan||1);F++)k[N+z+"."+(T-F)]=1}S&&(j.attrs.style=S),w.push(j),T++}}if(1===N){for(var q="",U=1;U<T;U++)q+=(b[U]?b[U]:"auto")+" ";p["grid-template-columns"]=q}}i.children=w}else i.c&&(p.display="table"),isNaN(g)||(p["border-spacing"]=g+"px"),(m||f||i.c)&&function t(e){for(var s=0;s<e.length;s++){var n=e[s];i.c&&(n.c=1),"th"===n.name||"td"===n.name?(m&&(n.attrs.style="border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray",";").concat(n.attrs.style||"")),f&&(n.attrs.style="padding:".concat(f,"px;").concat(n.attrs.style||""))):n.children&&t(n.children)}}(s);if(this.options.scrollTable&&!(e.style||"").includes("inline")){var V=Object.assign({},i);i.name="div",i.attrs={style:"overflow-x:auto;padding:1px"},i.children=[V],e=V.attrs}}else if(("tbody"===i.name||"tr"===i.name)&&i.flag&&i.c)i.flag=void 0,function t(i){for(var e=0;e<i.length;e++)if("td"===i[e].name)for(var s=0,n=["color","background","background-color"];s<n.length;s++){var a=n[s];p[a]&&(i[e].attrs.style=a+":"+p[a]+";"+(i[e].attrs.style||""))}else t(i[e].children||[])}(s);else if("td"!==i.name&&"th"!==i.name||!e.colspan&&!e.rowspan){if("ruby"===i.name){i.name="span";for(var D=0;D<s.length-1;D++)"text"===s[D].type&&"rt"===s[D+1].name&&(s[D]={name:"span",attrs:{style:"display:inline-block;text-align:center"},children:[{name:"div",attrs:{style:"font-size:50%;"+(s[D+1].attrs.style||"")},children:s[D+1].children},s[D]]},s.splice(D+1,1))}}else for(var B=this.stack.length;B--;)"table"!==this.stack[B].name&&"tbody"!==this.stack[B].name&&"tr"!==this.stack[B].name||(this.stack[B].flag=1);else{var M={a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"};M[e.type]&&(e.style+=";list-style-type:"+M[e.type],e.type=void 0),i.c=1;for(var P=s.length;P--;)"li"===s[P].name&&(s[P].c=1)}else i.name="span";if((p.display||"").includes("flex")&&!i.c)for(var Z=s.length;Z--;){var _=s[Z];_.f&&(_.attrs.style=(_.attrs.style||"")+_.f,_.f=void 0)}var E=n&&((n.attrs.style||"").includes("flex")||(n.attrs.style||"").includes("grid"))&&!i.c&&!(p.display||"").includes("inline");E&&(i.f=";max-width:100%"),s.length>=50&&i.c&&!(p.display||"").includes("flex")&&a(s);for(var G in p)if(p[G]){var W=";".concat(G,":").concat(p[G].replace(" !important",""));E&&(G.includes("flex")&&"flex-direction"!==G||"align-self"===G||G.includes("grid")||"-"===p[G][0]||G.includes("width")&&W.includes("%"))?(i.f+=W,"width"===G&&(e.style+=";width:100%")):e.style+=W}e.style=e.style.substr(1)||void 0},r.prototype.onText=function(t){if(!this.pre){for(var i,e="",s=0,a=t.length;s<a;s++)u[t[s]]?(" "!==e[e.length-1]&&(e+=" "),"\n"!==t[s]||i||(i=!0)):e+=t[s];if(" "===e&&i)return;t=e}var r=Object.create(null);if(r.type="text",r.text=n(t),this.hook(r)){(this.stack.length?this.stack[this.stack.length-1].children:this.nodes).push(r)}},o.prototype.parse=function(t){this.content=t||"",this.i=0,this.start=0,this.state=this.text;for(var i=this.content.length;-1!==this.i&&this.i<i;)this.state()},o.prototype.checkClose=function(t){var i="/"===this.content[this.i];return!!(">"===this.content[this.i]||i&&">"===this.content[this.i+1])&&(t&&this.handler[t](this.content.substring(this.start,this.i)),this.i+=i?2:1,this.start=this.i,this.handler.onOpenTag(i),"script"===this.handler.tagName?(this.i=this.content.indexOf("</",this.i),-1!==this.i&&(this.i+=2,this.start=this.i),this.state=this.endTag):this.state=this.text,!0)},o.prototype.text=function(){if(this.i=this.content.indexOf("<",this.i),-1===this.i)return void(this.start<this.content.length&&this.handler.onText(this.content.substring(this.start,this.content.length)));var t=this.content[this.i+1];if(t>="a"&&t<="z"||t>="A"&&t<="Z")this.start!==this.i&&this.handler.onText(this.content.substring(this.start,this.i)),this.start=++this.i,this.state=this.tagName;else if("/"===t||"!"===t||"?"===t){this.start!==this.i&&this.handler.onText(this.content.substring(this.start,this.i));var i=this.content[this.i+2];if("/"===t&&(i>="a"&&i<="z"||i>="A"&&i<="Z"))return this.i+=2,this.start=this.i,void(this.state=this.endTag);var e="--\x3e";"!"===t&&"-"===this.content[this.i+2]&&"-"===this.content[this.i+3]||(e=">"),this.i=this.content.indexOf(e,this.i),-1!==this.i&&(this.i+=e.length,this.start=this.i)}else this.i++},o.prototype.tagName=function(){if(u[this.content[this.i]]){for(this.handler.onTagName(this.content.substring(this.start,this.i));u[this.content[++this.i]];);this.i<this.content.length&&!this.checkClose()&&(this.start=this.i,this.state=this.attrName)}else this.checkClose("onTagName")||this.i++},o.prototype.attrName=function(){var t=this.content[this.i];if(u[t]||"="===t){this.handler.onAttrName(this.content.substring(this.start,this.i));for(var i="="===t,e=this.content.length;++this.i<e;)if(t=this.content[this.i],!u[t]){if(this.checkClose())return;if(i)return this.start=this.i,void(this.state=this.attrVal);if("="!==this.content[this.i])return this.start=this.i,void(this.state=this.attrName);i=!0}}else this.checkClose("onAttrName")||this.i++},o.prototype.attrVal=function(){var t=this.content[this.i],i=this.content.length;if('"'===t||"'"===t){if(this.start=++this.i,this.i=this.content.indexOf(t,this.i),-1===this.i)return;this.handler.onAttrVal(this.content.substring(this.start,this.i))}else for(;this.i<i;this.i++){if(u[this.content[this.i]]){this.handler.onAttrVal(this.content.substring(this.start,this.i));break}if(this.checkClose("onAttrVal"))return}for(;u[this.content[++this.i]];);this.i<i&&!this.checkClose()&&(this.start=this.i,this.state=this.attrName)},o.prototype.endTag=function(){var t=this.content[this.i];if(u[t]||">"===t||"/"===t){if(this.handler.onCloseTag(this.content.substring(this.start,this.i)),">"!==t&&(this.i=this.content.indexOf(">",this.i),-1===this.i))return;this.start=++this.i,this.state=this.text}else this.i++},module.exports=r; |
New file |
| | |
| | | "use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}/*! |
| | | * mp-html v2.5.1 |
| | | * https://github.com/jin-yufeng/mp-html |
| | | * |
| | | * Released under the MIT license |
| | | * Author: Jin Yufeng |
| | | */ |
| | | var t=require("./parser"),n=[];Component({data:{nodes:[]},properties:{containerStyle:String,content:{type:String,value:"",observer:function(e){this.setContent(e)}},copyLink:{type:Boolean,value:!0},domain:String,errorImg:String,lazyLoad:Boolean,loadingImg:String,pauseVideo:{type:Boolean,value:!0},previewImg:{type:null,value:!0},scrollTable:Boolean,selectable:null,setTitle:{type:Boolean,value:!0},showImgMenu:{type:Boolean,value:!0},tagStyle:Object,useAnchor:null},created:function(){this.plugins=[];for(var e=n.length;e--;)this.plugins.push(new n[e](this))},detached:function(){this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){var i=this;return new Promise(function(o,r){if(!i.data.useAnchor)return void r(Error("Anchor is disabled"));var a=tt.createSelectorQuery().in(i._in?i._in.page:i).select((i._in?i._in.selector:"._root")+(t?"".concat(">>>","#").concat(t):"")).boundingClientRect();i._in?a.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect():a.selectViewport().scrollOffset(),a.exec(function(t){if(!t[0])return void r(Error("Label not found"));var a=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(i.data.useAnchor)||0);i._in?i._in.page.setData(e({},i._in.scrollTop,a)):tt.pageScrollTo({scrollTop:a,duration:300}),o()})})},getText:function(e){var t="";return function e(n){for(var i=0;i<n.length;i++){var o=n[i];if("text"===o.type)t+=o.text.replace(/&/g,"&");else if("br"===o.name)t+="\n";else{var r="p"===o.name||"div"===o.name||"tr"===o.name||"li"===o.name||"h"===o.name[0]&&o.name[1]>"0"&&o.name[1]<"7";r&&t&&"\n"!==t[t.length-1]&&(t+="\n"),o.children&&e(o.children),r&&"\n"!==t[t.length-1]?t+="\n":"td"!==o.name&&"th"!==o.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){var e=this;return new Promise(function(t,n){tt.createSelectorQuery().in(e).select("._root").boundingClientRect().exec(function(e){return e[0]?t(e[0]):n(Error("Root label not found"))})})},pauseMedia:function(){for(var e=(this._videos||[]).length;e--;)this._videos[e].pause()},setPlaybackRate:function(e){this.playbackRate=e;for(var t=(this._videos||[]).length;t--;)this._videos[t].playbackRate(e)},setContent:function(e,n){var i=this;this.imgList&&n||(this.imgList=[]),this._videos=[];var o={},r=new t(this).parse(e);if(n)for(var a=this.data.nodes.length,s=r.length;s--;)o["nodes[".concat(a+s,"]")]=r[s];else o.nodes=r;if(this.setData(o),this.selectComponent("#_root",function(e){e.root=i,i._hook("onLoad"),i.triggerEvent("load")}),this.data.lazyLoad||this.imgList._unloadimgs<this.imgList.length/2){var l=0,c=function e(t){t&&t.height||(t={}),t.height===l?i.triggerEvent("ready",t):(l=t.height,setTimeout(function(){i.getRect().then(e).catch(e)},350))};this.getRect().then(c).catch(c)}else this.imgList._unloadimgs||this.getRect().then(function(e){i.triggerEvent("ready",e)}).catch(function(){i.triggerEvent("ready",{})})},_hook:function(e){for(var t=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()}}}); |
New file |
| | |
| | | {"component":true,"usingComponents":{"node":"./node/node"}} |
New file |
| | |
| | | <view class="_root {{selectable?'_select':''}}" style="{{containerStyle}}"><slot tt:if="{{!nodes[0]}}"/><node id="_root" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]}}"/></view> |
New file |
| | |
| | | ._root{padding:1px 0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}._select{-webkit-user-select:text;user-select:text} |
New file |
| | |
| | | "use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function e(e){for(var i=1;i<arguments.length;i++){var o=null!=arguments[i]?arguments[i]:{};i%2?t(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function r(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Component({data:{ctrl:{}},properties:{childs:Array,opts:Array},options:{addGlobalClass:!0},methods:{noop:function(){},getNode:function(t){try{for(var e=t.split("_"),r=this.data.childs[e[0]],i=1;i<e.length;i++)r=r.children[e[i]];return r}catch(t){return{text:"",attrs:{},children:[]}}},play:function(t){var r=t.target.dataset.i,i=this.getNode(r);if(this.root.triggerEvent("play",{source:i.name,attrs:e(e({},i.attrs),{},{src:i.src[this.data.ctrl[r]||0]})}),this.root.data.pauseVideo){for(var o=!1,a=t.target.id,s=this.root._videos.length;s--;)this.root._videos[s].id===a?o=!0:this.root._videos[s].pause();if(!o){var n=tt.createVideoContext(a,this);n.id=a,this.root.playbackRate&&n.playbackRate(this.root.playbackRate),this.root._videos.push(n)}}},imgTap:function(t){var e=this.getNode(t.target.dataset.i);if(e.a)return this.linkTap(e.a);if(!e.attrs.ignore&&(this.root.triggerEvent("imgtap",e.attrs),this.root.data.previewImg)){var r=this.root.imgList[e.i];tt.previewImage({current:r,urls:this.root.imgList})}},imgLoad:function(t){var e,i=t.target.dataset.i,o=this.getNode(i);o.w?(this.data.opts[1]&&!this.data.ctrl[i]||-1===this.data.ctrl[i])&&(e=1):e=t.detail.width,e&&e!==this.data.ctrl[i]&&this.setData(r({},"ctrl."+i,e)),this.checkReady()},checkReady:function(){var t=this;this.root.data.lazyLoad||(this.root.imgList._unloadimgs-=1,this.root.imgList._unloadimgs||setTimeout(function(){t.root.getRect().then(function(e){t.root.triggerEvent("ready",e)}).catch(function(){t.root.triggerEvent("ready",{})})},350))},linkTap:function(t){var e=t.currentTarget?this.getNode(t.currentTarget.dataset.i):{},r=e.attrs||t,i=r.href;this.root.triggerEvent("linktap",Object.assign({innerText:this.root.getText(e.children||[])},r)),i&&("#"===i[0]?this.root.navigateTo(i.substring(1)).catch(function(){}):i.split("?")[0].includes("://")?this.root.data.copyLink&&tt.setClipboardData({data:i,success:function(){return tt.showToast({title:"龿¥å·²å¤å¶"})}}):tt.navigateTo({url:i,fail:function(){tt.switchTab({url:i,fail:function(){}})}}))},mediaError:function(t){var e=t.target.dataset.i,i=this.getNode(e);if("video"===i.name||"audio"===i.name){var o=(this.data.ctrl[e]||0)+1;if(o>i.src.length&&(o=0),o<i.src.length)return this.setData(r({},"ctrl."+e,o))}else"img"===i.name&&(this.data.opts[2]&&this.setData(r({},"ctrl."+e,-1)),this.checkReady());this.root&&this.root.triggerEvent("error",{source:i.name,attrs:i.attrs,errMsg:t.detail.errMsg})}}}); |
New file |
| | |
| | | {"component":true,"usingComponents":{"node":"./node"}} |
New file |
| | |
| | | <template name="el"><block tt:if="{{n.name==='img'}}"><rich-text tt:if="{{n.t}}" style="display:{{n.t}}" nodes="<img class='_img' style='{{n.attrs.style}}' src='{{n.attrs.src}}'>" data-i="{{i}}" catchtap="imgTap"/><block tt:else><image tt:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix"/><image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{ctrl[i]===-1?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))}}" lazy-load="{{opts[0]}}" data-i="{{i}}" bindload="imgLoad" binderror="mediaError" catchtap="imgTap" bindlongpress="noop"/></block></block><text tt:elif="{{n.text}}" decode>{{n.text}}</text><text tt:elif="{{n.name==='br'}}">{{'\n'}}</text><view tt:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchtap="linkTap"><template is="node" data="{{childs:n.children,path:i+'_',opts:opts,ctrl:ctrl}}"></template></view><video tt:elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" object-fit="{{n.attrs['object-fit']}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><rich-text tt:else id="{{n.attrs.id}}" style="{{n.f}}" nodes="{{[n]}}"/></template><template name="node"><block tt:for="{{childs}}" tt:for-item="n" tt:for-index="i" tt:key="i"><template tt:if="{{!n.c}}" is="el" data="{{n:n,i:path+i,opts:opts,ctrl:ctrl}}"/><view tt:else id="{{n.attrs.id}}" class="_{{n.name}} {{n.attrs.class}}" style="{{n.attrs.style}}"><template is="node" data="{{childs:n.children,path:path+i+'_',opts:opts,ctrl:ctrl}}"></template></view></block></template><template is="node" data="{{childs:childs,path:'',opts:opts,ctrl:ctrl}}"></template> |
New file |
| | |
| | | ._a{padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._img{max-width:100%;-webkit-touch-callout:none}._b,._strong{font-weight:700}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:700}._ins{text-decoration:underline}._li{display:list-item}._ol{list-style-type:decimal}._ol,._ul{display:block;padding-left:40px;margin:1em 0}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}._tbody,._tfoot,._thead{display:table-row-group}._tr{display:table-row}._td,._th{display:table-cell;vertical-align:middle}._th{font-weight:700;text-align:center}._ul{list-style-type:disc}._ul ._ul{margin:0;list-style-type:circle}._ul ._ul ._ul{list-style-type:square}._abbr,._b,._code,._del,._em,._i,._ins,._label,._q,._span,._strong,._sub,._sup{display:inline} |
New file |
| | |
| | | "use strict";function t(t,e){var s;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(s=i(t))||e&&t&&"number"==typeof t.length){s&&(t=s);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,l=!1;return{s:function(){s=t[Symbol.iterator]()},n:function(){var t=s.next();return o=t.done,t},e:function(t){l=!0,r=t},f:function(){try{o||null==s.return||s.return()}finally{if(l)throw r}}}}function i(t,i){if(t){if("string"==typeof t)return e(t,i);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?e(t,i):void 0}}function e(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=new Array(i);e<i;e++)s[e]=t[e];return s}function s(t){for(var i=Object.create(null),e=t.split(","),s=e.length;s--;)i[e[s]]=!0;return i}function n(t,i){for(var e=t.indexOf("&");-1!==e;){var s=t.indexOf(";",e+3),n=void 0;if(-1===s)break;"#"===t[e+1]?(n=parseInt(("x"===t[e+2]?"0":"")+t.substring(e+2,s)),isNaN(n)||(t=t.substr(0,e)+String.fromCharCode(n)+t.substr(s+1))):(n=t.substring(e+1,s),(l.entities[n]||"amp"===n&&i)&&(t=t.substr(0,e)+(l.entities[n]||"&")+t.substr(s+1))),e=t.indexOf("&",e+1)}return t}function a(t){for(var i=t.length-1,e=i;e>=-1;e--)(-1===e||t[e].c||!t[e].name||"div"!==t[e].name&&"p"!==t[e].name&&"h"!==t[e].name[0]||(t[e].attrs.style||"").includes("inline"))&&(i-e>=5&&t.splice(e+1,i-e,{name:"div",attrs:{},children:t.slice(e+1,i+1)}),i=e-1)}function r(t){this.options=t.data||{},this.tagStyle=Object.assign({},l.tagStyle,this.options.tagStyle),this.imgList=t.imgList||[],this.imgList._unloadimgs=0,this.plugins=t.plugins||[],this.attrs=Object.create(null),this.stack=[],this.nodes=[],this.pre=(this.options.containerStyle||"").includes("white-space")&&this.options.containerStyle.includes("pre")?2:0}function o(t){this.handler=t}var l={trustTags:s("a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video"),blockTags:s("address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section"),ignoreTags:s("area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr"),voidTags:s("area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr"),entities:{lt:"<",gt:">",quot:'"',apos:"'",ensp:"â",emsp:"â",nbsp:" ",semi:";",ndash:"â",mdash:"â",middot:"·",lsquo:"â",rsquo:"â",ldquo:"â",rdquo:"â",bull:"â¢",hellip:"â¦",larr:"â",uarr:"â",rarr:"â",darr:"â"},tagStyle:{address:"font-style:italic",big:"display:inline;font-size:1.2em",caption:"display:table-caption;text-align:center",center:"text-align:center",cite:"font-style:italic",dd:"margin-left:40px",mark:"background-color:yellow",pre:"font-family:monospace;white-space:pre",s:"text-decoration:line-through",small:"display:inline;font-size:0.8em",strike:"text-decoration:line-through",u:"text-decoration:underline"},svgDict:{animatetransform:"animateTransform",lineargradient:"linearGradient",viewbox:"viewBox",attributename:"attributeName",repeatcount:"repeatCount",repeatdur:"repeatDur",foreignobject:"foreignObject"}},h={},c,d,p=tt.getSystemInfoSync();c=p.windowWidth;var u=s(" ,\r,\n,\t,\f"),f=0;r.prototype.parse=function(t){for(var i=this.plugins.length;i--;)this.plugins[i].onUpdate&&(t=this.plugins[i].onUpdate(t,l)||t);for(new o(this).parse(t);this.stack.length;)this.popNode();return this.nodes.length>50&&a(this.nodes),this.nodes},r.prototype.expose=function(){for(var t=this.stack.length;t--;){var i=this.stack[t];if(i.c||"a"===i.name||"video"===i.name||"audio"===i.name)return;i.c=1}},r.prototype.hook=function(t){for(var i=this.plugins.length;i--;)if(this.plugins[i].onParse&&!1===this.plugins[i].onParse(t,this))return!1;return!0},r.prototype.getUrl=function(t){var i=this.options.domain;return"/"===t[0]?"/"===t[1]?t=(i?i.split("://")[0]:"http")+":"+t:i&&(t=i+t):!i||t.includes("data:")||t.includes("://")||(t=i+"/"+t),t},r.prototype.parseStyle=function(t){var i=t.attrs,e=(this.tagStyle[t.name]||"").split(";").concat((i.style||"").split(";")),s={},n="";i.id&&!this.xml&&(this.options.useAnchor?this.expose():"img"!==t.name&&"a"!==t.name&&"video"!==t.name&&"audio"!==t.name&&(i.id=void 0)),i.width&&(s.width=parseFloat(i.width)+(i.width.includes("%")?"%":"px"),i.width=void 0),i.height&&(s.height=parseFloat(i.height)+(i.height.includes("%")?"%":"px"),i.height=void 0);for(var a=0,r=e.length;a<r;a++){var o=e[a].split(":");if(!(o.length<2)){var l=o.shift().trim().toLowerCase(),h=o.join(":").trim();if("-"===h[0]&&h.lastIndexOf("-")>0||h.includes("safe"))n+=";".concat(l,":").concat(h);else if(!s[l]||h.includes("import")||!s[l].includes("import")){if(h.includes("url")){var d=h.indexOf("(")+1;if(d){for(;'"'===h[d]||"'"===h[d]||u[h[d]];)d++;h=h.substr(0,d)+this.getUrl(h.substr(d))}}else h.includes("rpx")&&(h=h.replace(/[0-9.]+\s*rpx/g,function(t){return parseFloat(t)*c/750+"px"}));s[l]=h}}}return t.attrs.style=n,s},r.prototype.onTagName=function(t){this.tagName=this.xml?t:t.toLowerCase(),"svg"===this.tagName&&(this.xml=(this.xml||0)+1,l.ignoreTags.style=void 0)},r.prototype.onAttrName=function(t){t=this.xml?t:t.toLowerCase(),"data-"===t.substr(0,5)?"data-src"!==t||this.attrs.src?"img"===this.tagName||"a"===this.tagName?this.attrName=t:this.attrName=void 0:this.attrName="src":(this.attrName=t,this.attrs[t]="T")},r.prototype.onAttrVal=function(t){var i=this.attrName||"";"style"===i||"href"===i?this.attrs[i]=n(t,!0):i.includes("src")?this.attrs[i]=this.getUrl(n(t,!0)):i&&(this.attrs[i]=t)},r.prototype.onOpenTag=function(t){var i=Object.create(null);i.name=this.tagName,i.attrs=this.attrs,this.attrs=Object.create(null);var e=i.attrs,s=this.stack[this.stack.length-1],n=s?s.children:this.nodes,a=this.xml?t:l.voidTags[i.name];if(h[i.name]&&(e.class=h[i.name]+(e.class?" "+e.class:"")),"embed"===i.name){var r=e.src||"";r.includes(".mp4")||r.includes(".3gp")||r.includes(".m3u8")||(e.type||"").includes("video")?i.name="video":(r.includes(".mp3")||r.includes(".wav")||r.includes(".aac")||r.includes(".m4a")||(e.type||"").includes("audio"))&&(i.name="audio"),e.autostart&&(e.autoplay="T"),e.controls="T"}if("video"!==i.name&&"audio"!==i.name||("video"!==i.name||e.id||(e.id="v"+f++),e.controls||e.autoplay||(e.controls="T"),i.src=[],e.src&&(i.src.push(e.src),e.src=void 0),this.expose()),a){if(!this.hook(i)||l.ignoreTags[i.name])return void("base"!==i.name||this.options.domain?"source"===i.name&&s&&("video"===s.name||"audio"===s.name)&&e.src&&s.src.push(e.src):this.options.domain=e.href);var o=this.parseStyle(i);if("img"===i.name){if(e.src&&(e.src.includes("webp")&&(i.webp="T"),e.src.includes("data:")&&"all"!==this.options.previewImg&&!e["original-src"]&&(e.ignore="T"),!e.ignore||i.webp||e.src.includes("cloud://"))){for(var d=this.stack.length;d--;){var p=this.stack[d];"table"!==p.name||i.webp||e.src.includes("cloud://")||(!o.display||o.display.includes("inline")?i.t="inline-block":i.t=o.display,o.display=void 0);var u=p.attrs.style||"";if(!u.includes("flex:")||u.includes("flex:0")||u.includes("flex: 0")||o.width&&!(parseInt(o.width)>100))if(u.includes("flex")&&"100%"===o.width)for(var g=d+1;g<this.stack.length;g++){var m=this.stack[g].attrs.style||"";if(!m.includes(";width")&&!m.includes(" width")&&0!==m.indexOf("width")){o.width="";break}}else u.includes("inline-block")&&(o.width&&"%"===o.width[o.width.length-1]?(p.attrs.style+=";max-width:"+o.width,o.width=""):p.attrs.style+=";max-width:100%");else{o.width="100% !important",o.height="";for(var v=d+1;v<this.stack.length;v++)this.stack[v].attrs.style=(this.stack[v].attrs.style||"").replace("inline-","")}"a"===p.name?i.a=p.attrs:p.c=1}i.i=this.imgList.length;var y=e["original-src"]||e.src;if(this.imgList.includes(y)){var b=y.indexOf("://");if(-1!==b){b+=3;for(var x=y.substr(0,b);b<y.length&&"/"!==y[b];b++)x+=Math.random()>.5?y[b].toUpperCase():y[b];x+=y.substr(b),y=x}}this.imgList.push(y),i.t||(this.imgList._unloadimgs+=1)}"inline"===o.display&&(o.display=""),e.ignore&&(o["max-width"]=o["max-width"]||"100%",e.style+=";-webkit-touch-callout:none"),parseInt(o.width)>c&&(o.height=void 0),isNaN(parseInt(o.width))||(i.w="T"),!isNaN(parseInt(o.height))&&(!o.height.includes("%")||s&&(s.attrs.style||"").includes("height"))&&(i.h="T"),i.w&&i.h&&o["object-fit"]&&("contain"===o["object-fit"]?i.m="aspectFit":"cover"===o["object-fit"]&&(i.m="aspectFill"))}else if("svg"===i.name)return n.push(i),this.stack.push(i),void this.popNode();for(var w in o)o[w]&&(e.style+=";".concat(w,":").concat(o[w].replace(" !important","")));e.style=e.style.substr(1)||void 0}else("pre"===i.name||(e.style||"").includes("white-space")&&e.style.includes("pre"))&&2!==this.pre&&(this.pre=i.pre=1),i.children=[],this.stack.push(i);n.push(i)},r.prototype.onCloseTag=function(t){t=this.xml?t:t.toLowerCase();var i;for(i=this.stack.length;i--&&this.stack[i].name!==t;);if(-1!==i)for(;this.stack.length>i;)this.popNode();else if("p"===t||"br"===t){var e=this.stack.length?this.stack[this.stack.length-1].children:this.nodes;e.push({name:t,attrs:{class:h[t],style:this.tagStyle[t]}})}},r.prototype.popNode=function(){var i=this.stack.pop(),e=i.attrs,s=i.children,n=this.stack[this.stack.length-1],r=n?n.children:this.nodes;if(!this.hook(i)||l.ignoreTags[i.name])return"title"===i.name&&s.length&&"text"===s[0].type&&this.options.setTitle&&tt.setNavigationBarTitle({title:s[0].text}),void r.pop();if(i.pre&&2!==this.pre){this.pre=i.pre=void 0;for(var o=this.stack.length;o--;)this.stack[o].pre&&(this.pre=1)}if("svg"===i.name){if(this.xml>1)return void this.xml--;var h="",d=e.style;return e.style="",e.xmlns="http://www.w3.org/2000/svg",function i(e){if("text"===e.type)return void(h+=e.text);var s=l.svgDict[e.name]||e.name;if("foreignObject"===s){var n,a=t(e.children||[]);try{for(a.s();!(n=a.n()).done;){var r=n.value;if(r.attrs&&!r.attrs.xmlns){r.attrs.xmlns="http://www.w3.org/1999/xhtml";break}}}catch(t){a.e(t)}finally{a.f()}}h+="<"+s;for(var o in e.attrs){var c=e.attrs[o];c&&(h+=" ".concat(l.svgDict[o]||o,'="').concat(c.replace(/"/g,""),'"'))}if(e.children){h+=">";for(var d=0;d<e.children.length;d++)i(e.children[d]);h+="</"+s+">"}else h+="/>"}(i),i.name="img",i.attrs={src:"data:image/svg+xml;utf8,"+h.replace(/#/g,"%23"),style:d,ignore:"T"},i.children=void 0,this.xml=!1,void(l.ignoreTags.style=!0)}var p={};if(e.align&&("table"===i.name?"center"===e.align?p["margin-inline-start"]=p["margin-inline-end"]="auto":p.float=e.align:p["text-align"]=e.align,e.align=void 0),e.dir&&(p.direction=e.dir,e.dir=void 0),"font"===i.name&&(e.color&&(p.color=e.color,e.color=void 0),e.face&&(p["font-family"]=e.face,e.face=void 0),e.size)){var u=parseInt(e.size);isNaN(u)||(u<1?u=1:u>7&&(u=7),p["font-size"]=["x-small","small","medium","large","x-large","xx-large","xxx-large"][u-1]),e.size=void 0}if((e.class||"").includes("align-center")&&(p["text-align"]="center"),Object.assign(p,this.parseStyle(i)),"table"!==i.name&&parseInt(p.width)>c&&(p["max-width"]="100%",p["box-sizing"]="border-box"),l.blockTags[i.name])i.name="div";else if(l.trustTags[i.name]||this.xml)if("a"===i.name||"ad"===i.name)this.expose();else if("video"===i.name||"audio"===i.name)(p.height||"").includes("auto")&&(p.height=void 0),i.children=void 0;else if("ul"!==i.name&&"ol"!==i.name||!i.c)if("table"===i.name){var f=parseFloat(e.cellpadding),g=parseFloat(e.cellspacing),m=parseFloat(e.border),v=p["border-color"],y=p["border-style"];if(i.c&&(isNaN(f)&&(f=2),isNaN(g)&&(g=2)),m&&(e.style+=";border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray")),i.flag&&i.c){i.flag=void 0,p.display="grid","collapse"===p["border-collapse"]&&(p["border-collapse"]=void 0,g=0),g?(p["grid-gap"]=g+"px",p.padding=g+"px"):m&&(e.style+=";border-left:0;border-top:0");var b=[],x=[],w=[],k={};!function i(e){for(var s=0;s<e.length;s++)if("tr"===e[s].name)x.push(e[s]);else if("colgroup"===e[s].name){var n,a=1,r=t(e[s].children||[]);try{for(r.s();!(n=r.n()).done;){var o=n.value;if("col"===o.name){var l=o.attrs.style||"",h=l.indexOf("width")?l.indexOf(";width"):0;if(-1!==h){var c=l.indexOf(";",h+6);-1===c&&(c=l.length),b[a]=l.substring(h?h+7:6,c)}a+=1}}}catch(t){r.e(t)}finally{r.f()}}else i(e[s].children||[])}(s);for(var N=1;N<=x.length;N++){for(var T=1,O=0;O<x[N-1].children.length;O++){var j=x[N-1].children[O];if("td"===j.name||"th"===j.name){for(;k[N+"."+T];)T++;j.c=1;var S=j.attrs.style||"",C=S.indexOf("width")?S.indexOf(";width"):0;if(-1!==C){var A=S.indexOf(";",C+6);-1===A&&(A=S.length),j.attrs.colspan||(b[T]=S.substring(C?C+7:6,A)),S=S.substr(0,C)+S.substr(A)}if(S+=";display:flex;flex-direction:column",-1!==(C=S.indexOf("vertical-align"))){var I=S.substr(C+15,10);I.includes("middle")?S+=";justify-content:center":I.includes("bottom")&&(S+=";justify-content:flex-end")}else S+=";justify-content:center";if(-1!==(C=S.indexOf("text-align"))){var L=S.substr(C+11,10);L.includes("center")?S+=";justify-content: center":L.includes("right")&&(S+=";justify-content: right")}if(S=(m?";border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray")+(g?"":";border-right:0;border-bottom:0"):"")+(f?";padding:".concat(f,"px"):"")+";"+S,j.attrs.colspan&&(S+=";grid-column-start:".concat(T,";grid-column-end:").concat(T+parseInt(j.attrs.colspan)),j.attrs.rowspan||(S+=";grid-row-start:".concat(N,";grid-row-end:").concat(N+1)),T+=parseInt(j.attrs.colspan)-1),j.attrs.rowspan){S+=";grid-row-start:".concat(N,";grid-row-end:").concat(N+parseInt(j.attrs.rowspan)),j.attrs.colspan||(S+=";grid-column-start:".concat(T,";grid-column-end:").concat(T+1));for(var z=1;z<j.attrs.rowspan;z++)for(var F=0;F<(j.attrs.colspan||1);F++)k[N+z+"."+(T-F)]=1}S&&(j.attrs.style=S),w.push(j),T++}}if(1===N){for(var q="",U=1;U<T;U++)q+=(b[U]?b[U]:"auto")+" ";p["grid-template-columns"]=q}}i.children=w}else i.c&&(p.display="table"),isNaN(g)||(p["border-spacing"]=g+"px"),(m||f||i.c)&&function t(e){for(var s=0;s<e.length;s++){var n=e[s];i.c&&(n.c=1),"th"===n.name||"td"===n.name?(m&&(n.attrs.style="border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray",";").concat(n.attrs.style||"")),f&&(n.attrs.style="padding:".concat(f,"px;").concat(n.attrs.style||""))):n.children&&t(n.children)}}(s);if(this.options.scrollTable&&!(e.style||"").includes("inline")){var V=Object.assign({},i);i.name="div",i.attrs={style:"overflow-x:auto;padding:1px"},i.children=[V],e=V.attrs}}else if(("tbody"===i.name||"tr"===i.name)&&i.flag&&i.c)i.flag=void 0,function t(i){for(var e=0;e<i.length;e++)if("td"===i[e].name)for(var s=0,n=["color","background","background-color"];s<n.length;s++){var a=n[s];p[a]&&(i[e].attrs.style=a+":"+p[a]+";"+(i[e].attrs.style||""))}else t(i[e].children||[])}(s);else if("td"!==i.name&&"th"!==i.name||!e.colspan&&!e.rowspan){if("ruby"===i.name){i.name="span";for(var D=0;D<s.length-1;D++)"text"===s[D].type&&"rt"===s[D+1].name&&(s[D]={name:"span",attrs:{style:"display:inline-block;text-align:center"},children:[{name:"div",attrs:{style:"font-size:50%;"+(s[D+1].attrs.style||"")},children:s[D+1].children},s[D]]},s.splice(D+1,1))}}else for(var B=this.stack.length;B--;)"table"!==this.stack[B].name&&"tbody"!==this.stack[B].name&&"tr"!==this.stack[B].name||(this.stack[B].flag=1);else{var M={a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"};M[e.type]&&(e.style+=";list-style-type:"+M[e.type],e.type=void 0),i.c=1;for(var P=s.length;P--;)"li"===s[P].name&&(s[P].c=1)}else i.name="span";if((p.display||"").includes("flex")&&!i.c)for(var Z=s.length;Z--;){var _=s[Z];_.f&&(_.attrs.style=(_.attrs.style||"")+_.f,_.f=void 0)}var E=n&&((n.attrs.style||"").includes("flex")||(n.attrs.style||"").includes("grid"))&&!i.c;E&&(i.f=";max-width:100%"),s.length>=50&&i.c&&!(p.display||"").includes("flex")&&a(s);for(var G in p)if(p[G]){var W=";".concat(G,":").concat(p[G].replace(" !important",""));E&&(G.includes("flex")&&"flex-direction"!==G||"align-self"===G||G.includes("grid")||"-"===p[G][0]||G.includes("width")&&W.includes("%"))?(i.f+=W,"width"===G&&(e.style+=";width:100%")):e.style+=W}e.style=e.style.substr(1)||void 0},r.prototype.onText=function(t){if(!this.pre){for(var i,e="",s=0,a=t.length;s<a;s++)u[t[s]]?(" "!==e[e.length-1]&&(e+=" "),"\n"!==t[s]||i||(i=!0)):e+=t[s];if(" "===e&&i)return;t=e}var r=Object.create(null);if(r.type="text",r.text=n(t),this.hook(r)){(this.stack.length?this.stack[this.stack.length-1].children:this.nodes).push(r)}},o.prototype.parse=function(t){this.content=t||"",this.i=0,this.start=0,this.state=this.text;for(var i=this.content.length;-1!==this.i&&this.i<i;)this.state()},o.prototype.checkClose=function(t){var i="/"===this.content[this.i];return!!(">"===this.content[this.i]||i&&">"===this.content[this.i+1])&&(t&&this.handler[t](this.content.substring(this.start,this.i)),this.i+=i?2:1,this.start=this.i,this.handler.onOpenTag(i),"script"===this.handler.tagName?(this.i=this.content.indexOf("</",this.i),-1!==this.i&&(this.i+=2,this.start=this.i),this.state=this.endTag):this.state=this.text,!0)},o.prototype.text=function(){if(this.i=this.content.indexOf("<",this.i),-1===this.i)return void(this.start<this.content.length&&this.handler.onText(this.content.substring(this.start,this.content.length)));var t=this.content[this.i+1];if(t>="a"&&t<="z"||t>="A"&&t<="Z")this.start!==this.i&&this.handler.onText(this.content.substring(this.start,this.i)),this.start=++this.i,this.state=this.tagName;else if("/"===t||"!"===t||"?"===t){this.start!==this.i&&this.handler.onText(this.content.substring(this.start,this.i));var i=this.content[this.i+2];if("/"===t&&(i>="a"&&i<="z"||i>="A"&&i<="Z"))return this.i+=2,this.start=this.i,void(this.state=this.endTag);var e="--\x3e";"!"===t&&"-"===this.content[this.i+2]&&"-"===this.content[this.i+3]||(e=">"),this.i=this.content.indexOf(e,this.i),-1!==this.i&&(this.i+=e.length,this.start=this.i)}else this.i++},o.prototype.tagName=function(){if(u[this.content[this.i]]){for(this.handler.onTagName(this.content.substring(this.start,this.i));u[this.content[++this.i]];);this.i<this.content.length&&!this.checkClose()&&(this.start=this.i,this.state=this.attrName)}else this.checkClose("onTagName")||this.i++},o.prototype.attrName=function(){var t=this.content[this.i];if(u[t]||"="===t){this.handler.onAttrName(this.content.substring(this.start,this.i));for(var i="="===t,e=this.content.length;++this.i<e;)if(t=this.content[this.i],!u[t]){if(this.checkClose())return;if(i)return this.start=this.i,void(this.state=this.attrVal);if("="!==this.content[this.i])return this.start=this.i,void(this.state=this.attrName);i=!0}}else this.checkClose("onAttrName")||this.i++},o.prototype.attrVal=function(){var t=this.content[this.i],i=this.content.length;if('"'===t||"'"===t){if(this.start=++this.i,this.i=this.content.indexOf(t,this.i),-1===this.i)return;this.handler.onAttrVal(this.content.substring(this.start,this.i))}else for(;this.i<i;this.i++){if(u[this.content[this.i]]){this.handler.onAttrVal(this.content.substring(this.start,this.i));break}if(this.checkClose("onAttrVal"))return}for(;u[this.content[++this.i]];);this.i<i&&!this.checkClose()&&(this.start=this.i,this.state=this.attrName)},o.prototype.endTag=function(){var t=this.content[this.i];if(u[t]||">"===t||"/"===t){if(this.handler.onCloseTag(this.content.substring(this.start,this.i)),">"!==t&&(this.i=this.content.indexOf(">",this.i),-1===this.i))return;this.start=++this.i,this.state=this.text}else this.i++},module.exports=r; |
New file |
| | |
| | | "use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}/*! |
| | | * mp-html v2.5.1 |
| | | * https://github.com/jin-yufeng/mp-html |
| | | * |
| | | * Released under the MIT license |
| | | * Author: Jin Yufeng |
| | | */ |
| | | var t=require("./parser"),n=[];Component({data:{nodes:[]},properties:{containerStyle:String,content:{type:String,value:"",observer:function(e){this.setContent(e)}},copyLink:{type:Boolean,value:!0},domain:String,errorImg:String,lazyLoad:Boolean,loadingImg:String,pauseVideo:{type:Boolean,value:!0},previewImg:{type:null,value:!0},scrollTable:Boolean,selectable:null,setTitle:{type:Boolean,value:!0},showImgMenu:{type:Boolean,value:!0},tagStyle:Object,useAnchor:null},created:function(){this.plugins=[];for(var e=n.length;e--;)this.plugins.push(new n[e](this))},detached:function(){this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){var i=this;return new Promise(function(o,r){if(!i.data.useAnchor)return void r(Error("Anchor is disabled"));var a=wx.createSelectorQuery().in(i._in?i._in.page:i).select((i._in?i._in.selector:"._root")+(t?"".concat(">>>","#").concat(t):"")).boundingClientRect();i._in?a.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect():a.selectViewport().scrollOffset(),a.exec(function(t){if(!t[0])return void r(Error("Label not found"));var a=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(i.data.useAnchor)||0);i._in?i._in.page.setData(e({},i._in.scrollTop,a)):wx.pageScrollTo({scrollTop:a,duration:300}),o()})})},getText:function(e){var t="";return function e(n){for(var i=0;i<n.length;i++){var o=n[i];if("text"===o.type)t+=o.text.replace(/&/g,"&");else if("br"===o.name)t+="\n";else{var r="p"===o.name||"div"===o.name||"tr"===o.name||"li"===o.name||"h"===o.name[0]&&o.name[1]>"0"&&o.name[1]<"7";r&&t&&"\n"!==t[t.length-1]&&(t+="\n"),o.children&&e(o.children),r&&"\n"!==t[t.length-1]?t+="\n":"td"!==o.name&&"th"!==o.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){var e=this;return new Promise(function(t,n){wx.createSelectorQuery().in(e).select("._root").boundingClientRect().exec(function(e){return e[0]?t(e[0]):n(Error("Root label not found"))})})},pauseMedia:function(){for(var e=(this._videos||[]).length;e--;)this._videos[e].pause()},setPlaybackRate:function(e){this.playbackRate=e;for(var t=(this._videos||[]).length;t--;)this._videos[t].playbackRate(e)},setContent:function(e,n){var i=this;this.imgList&&n||(this.imgList=[]),this._videos=[];var o={},r=new t(this).parse(e);if(n)for(var a=this.data.nodes.length,s=r.length;s--;)o["nodes[".concat(a+s,"]")]=r[s];else o.nodes=r;if(this.setData(o,function(){i._hook("onLoad"),i.triggerEvent("load")}),this.data.lazyLoad||this.imgList._unloadimgs<this.imgList.length/2){var l=0,c=function e(t){t&&t.height||(t={}),t.height===l?i.triggerEvent("ready",t):(l=t.height,setTimeout(function(){i.getRect().then(e).catch(e)},350))};this.getRect().then(c).catch(c)}else this.imgList._unloadimgs||this.getRect().then(function(e){i.triggerEvent("ready",e)}).catch(function(){i.triggerEvent("ready",{})})},_hook:function(e){for(var t=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.detail.root=this}}}); |
New file |
| | |
| | | {"component":true,"usingComponents":{"node":"./node/node"}} |
New file |
| | |
| | | <view class="_root {{selectable?'_select':''}}" style="{{containerStyle}}"><slot wx:if="{{!nodes[0]}}"/><node id="_root" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]}}" catchadd="_add"/></view> |
New file |
| | |
| | | ._root{padding:1px 0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}._select{-webkit-user-select:text;user-select:text} |
New file |
| | |
| | | "use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function e(e){for(var i=1;i<arguments.length;i++){var o=null!=arguments[i]?arguments[i]:{};i%2?t(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function r(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Component({data:{ctrl:{},isiOS:wx.getSystemInfoSync().system.includes("iOS")},properties:{childs:Array,opts:Array},options:{addGlobalClass:!0},attached:function(){this.triggerEvent("add",this,{bubbles:!0,composed:!0})},methods:{noop:function(){},getNode:function(t){try{for(var e=t.split("_"),r=this.data.childs[e[0]],i=1;i<e.length;i++)r=r.children[e[i]];return r}catch(t){return{text:"",attrs:{},children:[]}}},play:function(t){var r=t.target.dataset.i,i=this.getNode(r);if(this.root.triggerEvent("play",{source:i.name,attrs:e(e({},i.attrs),{},{src:i.src[this.data.ctrl[r]||0]})}),this.root.data.pauseVideo){for(var o=!1,s=t.target.id,a=this.root._videos.length;a--;)this.root._videos[a].id===s?o=!0:this.root._videos[a].pause();if(!o){var n=wx.createVideoContext(s,this);n.id=s,this.root.playbackRate&&n.playbackRate(this.root.playbackRate),this.root._videos.push(n)}}},imgTap:function(t){var e=this.getNode(t.target.dataset.i);if(e.a)return this.linkTap(e.a);if(!e.attrs.ignore&&(this.root.triggerEvent("imgtap",e.attrs),this.root.data.previewImg)){var r=this.root.imgList[e.i];wx.previewImage({showmenu:this.root.data.showImgMenu,current:r,urls:this.root.imgList})}},imgLoad:function(t){var e,i=t.target.dataset.i,o=this.getNode(i);o.w?(this.data.opts[1]&&!this.data.ctrl[i]||-1===this.data.ctrl[i])&&(e=1):e=t.detail.width,e&&this.setData(r({},"ctrl."+i,e)),this.checkReady()},checkReady:function(){var t=this;this.root.data.lazyLoad||(this.root.imgList._unloadimgs-=1,this.root.imgList._unloadimgs||setTimeout(function(){t.root.getRect().then(function(e){t.root.triggerEvent("ready",e)}).catch(function(){t.root.triggerEvent("ready",{})})},350))},linkTap:function(t){var e=t.currentTarget?this.getNode(t.currentTarget.dataset.i):{},r=e.attrs||t,i=r.href;this.root.triggerEvent("linktap",Object.assign({innerText:this.root.getText(e.children||[])},r)),i&&("#"===i[0]?this.root.navigateTo(i.substring(1)).catch(function(){}):i.split("?")[0].includes("://")?this.root.data.copyLink&&wx.setClipboardData({data:i,success:function(){return wx.showToast({title:"龿¥å·²å¤å¶"})}}):wx.navigateTo({url:i,fail:function(){wx.switchTab({url:i,fail:function(){}})}}))},mediaError:function(t){var e=t.target.dataset.i,i=this.getNode(e);if("video"===i.name||"audio"===i.name){var o=(this.data.ctrl[e]||0)+1;if(o>i.src.length&&(o=0),o<i.src.length)return this.setData(r({},"ctrl."+e,o))}else"img"===i.name&&(this.data.opts[2]&&this.setData(r({},"ctrl."+e,-1)),this.checkReady());this.root&&this.root.triggerEvent("error",{source:i.name,attrs:i.attrs,errMsg:t.detail.errMsg})}}}); |
New file |
| | |
| | | {"component":true,"usingComponents":{"node":"./node"}} |
New file |
| | |
| | | <wxs module="isInline">var e={abbr:!0,b:!0,big:!0,code:!0,del:!0,em:!0,i:!0,ins:!0,label:!0,q:!0,small:!0,span:!0,strong:!0,sub:!0,sup:!0};module.exports=function(n,i){return e[n]||-1!==(i||"").indexOf("inline")};</wxs><template name="el"><block wx:if="{{n.name==='img'}}"><rich-text wx:if="{{n.t}}" style="display:{{n.t}}" nodes="<img class='_img' style='{{n.attrs.style}}' src='{{n.attrs.src}}'>" data-i="{{i}}" catchtap="imgTap"/><block wx:else><image wx:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix"/><image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{ctrl[i]===-1?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))}}" lazy-load="{{opts[0]}}" webp="{{n.webp}}" show-menu-by-longpress="{{opts[3]&&!n.attrs.ignore}}" data-i="{{i}}" bindload="imgLoad" binderror="mediaError" catchtap="imgTap" bindlongpress="noop"/></block></block><text wx:elif="{{n.text}}" user-select="{{opts[4]=='force'&&isiOS}}" decode>{{n.text}}</text><text wx:elif="{{n.name==='br'}}">{{'\n'}}</text><view wx:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchtap="linkTap"><node childs="{{n.children}}" opts="{{opts}}" style="display:inherit"/></view><video wx:elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" object-fit="{{n.attrs['object-fit']}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><audio wx:elif="{{n.name==='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><rich-text wx:else id="{{n.attrs.id}}" style="{{n.f}}" user-select="{{opts[4]}}" nodes="{{[n]}}"/></template><block wx:for="{{childs}}" wx:for-item="n1" wx:for-index="i1" wx:key="i1"><template wx:if="{{!n1.c&&(!n1.children||n1.name==='a'||!isInline(n1.name,n1.attrs.style))}}" is="el" data="{{n:n1,i:''+i1,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n1.attrs.id}}" class="_{{n1.name}} {{n1.attrs.class}}" style="{{n1.attrs.style}}"><block wx:for="{{n1.children}}" wx:for-item="n2" wx:for-index="i2" wx:key="i2"><template wx:if="{{!n2.c&&(!n2.children||n2.name==='a'||!isInline(n2.name,n2.attrs.style))}}" is="el" data="{{n:n2,i:i1+'_'+i2,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n2.attrs.id}}" class="_{{n2.name}} {{n2.attrs.class}}" style="{{n2.attrs.style}}"><block wx:for="{{n2.children}}" wx:for-item="n3" wx:for-index="i3" wx:key="i3"><template wx:if="{{!n3.c&&(!n3.children||n3.name==='a'||!isInline(n3.name,n3.attrs.style))}}" is="el" data="{{n:n3,i:i1+'_'+i2+'_'+i3,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n3.attrs.id}}" class="_{{n3.name}} {{n3.attrs.class}}" style="{{n3.attrs.style}}"><block wx:for="{{n3.children}}" wx:for-item="n4" wx:for-index="i4" wx:key="i4"><template wx:if="{{!n4.c&&(!n4.children||n4.name==='a'||!isInline(n4.name,n4.attrs.style))}}" is="el" data="{{n:n4,i:i1+'_'+i2+'_'+i3+'_'+i4,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n4.attrs.id}}" class="_{{n4.name}} {{n4.attrs.class}}" style="{{n4.attrs.style}}"><block wx:for="{{n4.children}}" wx:for-item="n5" wx:for-index="i5" wx:key="i5"><template wx:if="{{!n5.c&&(!n5.children||n5.name==='a'||!isInline(n5.name,n5.attrs.style))}}" is="el" data="{{n:n5,i:i1+'_'+i2+'_'+i3+'_'+i4+'_'+i5,opts:opts,ctrl:ctrl}}"/><node wx:else id="{{n5.attrs.id}}" class="_{{n5.name}} {{n5.attrs.class}}" style="{{n5.attrs.style}}" childs="{{n5.children}}" opts="{{opts}}"/></block></view></block></view></block></view></block></view></block> |
New file |
| | |
| | | ._a{padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._img{max-width:100%;-webkit-touch-callout:none}._b,._strong{font-weight:700}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:700}._ins{text-decoration:underline}._li{display:list-item}._ol{list-style-type:decimal}._ol,._ul{display:block;padding-left:40px;margin:1em 0}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}._tbody,._tfoot,._thead{display:table-row-group}._tr{display:table-row}._td,._th{display:table-cell;vertical-align:middle}._th{font-weight:700;text-align:center}._ul{list-style-type:disc}._ul ._ul{margin:0;list-style-type:circle}._ul ._ul ._ul{list-style-type:square}._abbr,._b,._code,._del,._em,._i,._ins,._label,._q,._span,._strong,._sub,._sup{display:inline}._blockquote,._div,._p{display:block} |
New file |
| | |
| | | "use strict";function t(t,e){var s;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(s=i(t))||e&&t&&"number"==typeof t.length){s&&(t=s);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,l=!1;return{s:function(){s=t[Symbol.iterator]()},n:function(){var t=s.next();return o=t.done,t},e:function(t){l=!0,r=t},f:function(){try{o||null==s.return||s.return()}finally{if(l)throw r}}}}function i(t,i){if(t){if("string"==typeof t)return e(t,i);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?e(t,i):void 0}}function e(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=new Array(i);e<i;e++)s[e]=t[e];return s}function s(t){for(var i=Object.create(null),e=t.split(","),s=e.length;s--;)i[e[s]]=!0;return i}function n(t,i){for(var e=t.indexOf("&");-1!==e;){var s=t.indexOf(";",e+3),n=void 0;if(-1===s)break;"#"===t[e+1]?(n=parseInt(("x"===t[e+2]?"0":"")+t.substring(e+2,s)),isNaN(n)||(t=t.substr(0,e)+String.fromCharCode(n)+t.substr(s+1))):(n=t.substring(e+1,s),(l.entities[n]||"amp"===n&&i)&&(t=t.substr(0,e)+(l.entities[n]||"&")+t.substr(s+1))),e=t.indexOf("&",e+1)}return t}function a(t){for(var i=t.length-1,e=i;e>=-1;e--)(-1===e||t[e].c||!t[e].name||"div"!==t[e].name&&"p"!==t[e].name&&"h"!==t[e].name[0]||(t[e].attrs.style||"").includes("inline"))&&(i-e>=5&&t.splice(e+1,i-e,{name:"div",attrs:{},children:t.slice(e+1,i+1)}),i=e-1)}function r(t){this.options=t.data||{},this.tagStyle=Object.assign({},l.tagStyle,this.options.tagStyle),this.imgList=t.imgList||[],this.imgList._unloadimgs=0,this.plugins=t.plugins||[],this.attrs=Object.create(null),this.stack=[],this.nodes=[],this.pre=(this.options.containerStyle||"").includes("white-space")&&this.options.containerStyle.includes("pre")?2:0}function o(t){this.handler=t}var l={trustTags:s("a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video"),blockTags:s("address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section"),ignoreTags:s("area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr"),voidTags:s("area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr"),entities:{lt:"<",gt:">",quot:'"',apos:"'",ensp:"â",emsp:"â",nbsp:" ",semi:";",ndash:"â",mdash:"â",middot:"·",lsquo:"â",rsquo:"â",ldquo:"â",rdquo:"â",bull:"â¢",hellip:"â¦",larr:"â",uarr:"â",rarr:"â",darr:"â"},tagStyle:{address:"font-style:italic",big:"display:inline;font-size:1.2em",caption:"display:table-caption;text-align:center",center:"text-align:center",cite:"font-style:italic",dd:"margin-left:40px",mark:"background-color:yellow",pre:"font-family:monospace;white-space:pre",s:"text-decoration:line-through",small:"display:inline;font-size:0.8em",strike:"text-decoration:line-through",u:"text-decoration:underline"},svgDict:{animatetransform:"animateTransform",lineargradient:"linearGradient",viewbox:"viewBox",attributename:"attributeName",repeatcount:"repeatCount",repeatdur:"repeatDur",foreignobject:"foreignObject"}},h={},c,d;if(wx.canIUse("getWindowInfo"))c=wx.getWindowInfo().windowWidth,d=wx.getDeviceInfo().system;else{var p=wx.getSystemInfoSync();c=p.windowWidth,d=p.system}var u=s(" ,\r,\n,\t,\f"),f=0;r.prototype.parse=function(t){for(var i=this.plugins.length;i--;)this.plugins[i].onUpdate&&(t=this.plugins[i].onUpdate(t,l)||t);for(new o(this).parse(t);this.stack.length;)this.popNode();return this.nodes.length>50&&a(this.nodes),this.nodes},r.prototype.expose=function(){for(var t=this.stack.length;t--;){var i=this.stack[t];if(i.c||"a"===i.name||"video"===i.name||"audio"===i.name)return;i.c=1}},r.prototype.hook=function(t){for(var i=this.plugins.length;i--;)if(this.plugins[i].onParse&&!1===this.plugins[i].onParse(t,this))return!1;return!0},r.prototype.getUrl=function(t){var i=this.options.domain;return"/"===t[0]?"/"===t[1]?t=(i?i.split("://")[0]:"http")+":"+t:i&&(t=i+t):!i||t.includes("data:")||t.includes("://")||(t=i+"/"+t),t},r.prototype.parseStyle=function(t){var i=t.attrs,e=(this.tagStyle[t.name]||"").split(";").concat((i.style||"").split(";")),s={},n="";i.id&&!this.xml&&(this.options.useAnchor?this.expose():"img"!==t.name&&"a"!==t.name&&"video"!==t.name&&"audio"!==t.name&&(i.id=void 0)),i.width&&(s.width=parseFloat(i.width)+(i.width.includes("%")?"%":"px"),i.width=void 0),i.height&&(s.height=parseFloat(i.height)+(i.height.includes("%")?"%":"px"),i.height=void 0);for(var a=0,r=e.length;a<r;a++){var o=e[a].split(":");if(!(o.length<2)){var l=o.shift().trim().toLowerCase(),h=o.join(":").trim();if("-"===h[0]&&h.lastIndexOf("-")>0||h.includes("safe"))n+=";".concat(l,":").concat(h);else if(!s[l]||h.includes("import")||!s[l].includes("import")){if(h.includes("url")){var d=h.indexOf("(")+1;if(d){for(;'"'===h[d]||"'"===h[d]||u[h[d]];)d++;h=h.substr(0,d)+this.getUrl(h.substr(d))}}else h.includes("rpx")&&(h=h.replace(/[0-9.]+\s*rpx/g,function(t){return parseFloat(t)*c/750+"px"}));s[l]=h}}}return t.attrs.style=n,s},r.prototype.onTagName=function(t){this.tagName=this.xml?t:t.toLowerCase(),"svg"===this.tagName&&(this.xml=(this.xml||0)+1,l.ignoreTags.style=void 0)},r.prototype.onAttrName=function(t){t=this.xml?t:t.toLowerCase(),"data-"===t.substr(0,5)?"data-src"!==t||this.attrs.src?"img"===this.tagName||"a"===this.tagName?this.attrName=t:this.attrName=void 0:this.attrName="src":(this.attrName=t,this.attrs[t]="T")},r.prototype.onAttrVal=function(t){var i=this.attrName||"";"style"===i||"href"===i?this.attrs[i]=n(t,!0):i.includes("src")?this.attrs[i]=this.getUrl(n(t,!0)):i&&(this.attrs[i]=t)},r.prototype.onOpenTag=function(t){var i=Object.create(null);i.name=this.tagName,i.attrs=this.attrs,this.attrs=Object.create(null);var e=i.attrs,s=this.stack[this.stack.length-1],n=s?s.children:this.nodes,a=this.xml?t:l.voidTags[i.name];if(h[i.name]&&(e.class=h[i.name]+(e.class?" "+e.class:"")),"embed"===i.name){var r=e.src||"";r.includes(".mp4")||r.includes(".3gp")||r.includes(".m3u8")||(e.type||"").includes("video")?i.name="video":(r.includes(".mp3")||r.includes(".wav")||r.includes(".aac")||r.includes(".m4a")||(e.type||"").includes("audio"))&&(i.name="audio"),e.autostart&&(e.autoplay="T"),e.controls="T"}if("video"!==i.name&&"audio"!==i.name||("video"!==i.name||e.id||(e.id="v"+f++),e.controls||e.autoplay||(e.controls="T"),i.src=[],e.src&&(i.src.push(e.src),e.src=void 0),this.expose()),a){if(!this.hook(i)||l.ignoreTags[i.name])return void("base"!==i.name||this.options.domain?"source"===i.name&&s&&("video"===s.name||"audio"===s.name)&&e.src&&s.src.push(e.src):this.options.domain=e.href);var o=this.parseStyle(i);if("img"===i.name){if(e.src&&(e.src.includes("webp")&&(i.webp="T"),e.src.includes("data:")&&"all"!==this.options.previewImg&&!e["original-src"]&&(e.ignore="T"),!e.ignore||i.webp||e.src.includes("cloud://"))){for(var d=this.stack.length;d--;){var p=this.stack[d];"table"!==p.name||i.webp||e.src.includes("cloud://")||(!o.display||o.display.includes("inline")?i.t="inline-block":i.t=o.display,o.display=void 0);var u=p.attrs.style||"";if(!u.includes("flex:")||u.includes("flex:0")||u.includes("flex: 0")||o.width&&!(parseInt(o.width)>100))if(u.includes("flex")&&"100%"===o.width)for(var g=d+1;g<this.stack.length;g++){var m=this.stack[g].attrs.style||"";if(!m.includes(";width")&&!m.includes(" width")&&0!==m.indexOf("width")){o.width="";break}}else u.includes("inline-block")&&(o.width&&"%"===o.width[o.width.length-1]?(p.attrs.style+=";max-width:"+o.width,o.width=""):p.attrs.style+=";max-width:100%");else{o.width="100% !important",o.height="";for(var v=d+1;v<this.stack.length;v++)this.stack[v].attrs.style=(this.stack[v].attrs.style||"").replace("inline-","")}"a"===p.name?i.a=p.attrs:p.c=1}i.i=this.imgList.length;var y=e["original-src"]||e.src;if(this.imgList.includes(y)){var b=y.indexOf("://");if(-1!==b){b+=3;for(var x=y.substr(0,b);b<y.length&&"/"!==y[b];b++)x+=Math.random()>.5?y[b].toUpperCase():y[b];x+=y.substr(b),y=x}}this.imgList.push(y),i.t||(this.imgList._unloadimgs+=1)}"inline"===o.display&&(o.display=""),e.ignore&&(o["max-width"]=o["max-width"]||"100%",e.style+=";-webkit-touch-callout:none"),parseInt(o.width)>c&&(o.height=void 0),isNaN(parseInt(o.width))||(i.w="T"),!isNaN(parseInt(o.height))&&(!o.height.includes("%")||s&&(s.attrs.style||"").includes("height"))&&(i.h="T"),i.w&&i.h&&o["object-fit"]&&("contain"===o["object-fit"]?i.m="aspectFit":"cover"===o["object-fit"]&&(i.m="aspectFill"))}else if("svg"===i.name)return n.push(i),this.stack.push(i),void this.popNode();for(var w in o)o[w]&&(e.style+=";".concat(w,":").concat(o[w].replace(" !important","")));e.style=e.style.substr(1)||void 0}else("pre"===i.name||(e.style||"").includes("white-space")&&e.style.includes("pre"))&&2!==this.pre&&(this.pre=i.pre=1),i.children=[],this.stack.push(i);n.push(i)},r.prototype.onCloseTag=function(t){t=this.xml?t:t.toLowerCase();var i;for(i=this.stack.length;i--&&this.stack[i].name!==t;);if(-1!==i)for(;this.stack.length>i;)this.popNode();else if("p"===t||"br"===t){var e=this.stack.length?this.stack[this.stack.length-1].children:this.nodes;e.push({name:t,attrs:{class:h[t],style:this.tagStyle[t]}})}},r.prototype.popNode=function(){var i=this.stack.pop(),e=i.attrs,s=i.children,n=this.stack[this.stack.length-1],r=n?n.children:this.nodes;if(!this.hook(i)||l.ignoreTags[i.name])return"title"===i.name&&s.length&&"text"===s[0].type&&this.options.setTitle&&wx.setNavigationBarTitle({title:s[0].text}),void r.pop();if(i.pre&&2!==this.pre){this.pre=i.pre=void 0;for(var o=this.stack.length;o--;)this.stack[o].pre&&(this.pre=1)}if("svg"===i.name){if(this.xml>1)return void this.xml--;var h="",d=e.style;return e.style="",e.xmlns="http://www.w3.org/2000/svg",function i(e){if("text"===e.type)return void(h+=e.text);var s=l.svgDict[e.name]||e.name;if("foreignObject"===s){var n,a=t(e.children||[]);try{for(a.s();!(n=a.n()).done;){var r=n.value;if(r.attrs&&!r.attrs.xmlns){r.attrs.xmlns="http://www.w3.org/1999/xhtml";break}}}catch(t){a.e(t)}finally{a.f()}}h+="<"+s;for(var o in e.attrs){var c=e.attrs[o];c&&(h+=" ".concat(l.svgDict[o]||o,'="').concat(c.replace(/"/g,""),'"'))}if(e.children){h+=">";for(var d=0;d<e.children.length;d++)i(e.children[d]);h+="</"+s+">"}else h+="/>"}(i),i.name="img",i.attrs={src:"data:image/svg+xml;utf8,"+h.replace(/#/g,"%23"),style:d,ignore:"T"},i.children=void 0,this.xml=!1,void(l.ignoreTags.style=!0)}var p={};if(e.align&&("table"===i.name?"center"===e.align?p["margin-inline-start"]=p["margin-inline-end"]="auto":p.float=e.align:p["text-align"]=e.align,e.align=void 0),e.dir&&(p.direction=e.dir,e.dir=void 0),"font"===i.name&&(e.color&&(p.color=e.color,e.color=void 0),e.face&&(p["font-family"]=e.face,e.face=void 0),e.size)){var u=parseInt(e.size);isNaN(u)||(u<1?u=1:u>7&&(u=7),p["font-size"]=["x-small","small","medium","large","x-large","xx-large","xxx-large"][u-1]),e.size=void 0}if((e.class||"").includes("align-center")&&(p["text-align"]="center"),Object.assign(p,this.parseStyle(i)),"table"!==i.name&&parseInt(p.width)>c&&(p["max-width"]="100%",p["box-sizing"]="border-box"),l.blockTags[i.name])i.name="div";else if(l.trustTags[i.name]||this.xml)if("a"===i.name||"ad"===i.name)this.expose();else if("video"===i.name||"audio"===i.name)(p.height||"").includes("auto")&&(p.height=void 0),i.children=void 0;else if("ul"!==i.name&&"ol"!==i.name||!i.c)if("table"===i.name){var f=parseFloat(e.cellpadding),g=parseFloat(e.cellspacing),m=parseFloat(e.border),v=p["border-color"],y=p["border-style"];if(i.c&&(isNaN(f)&&(f=2),isNaN(g)&&(g=2)),m&&(e.style+=";border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray")),i.flag&&i.c){i.flag=void 0,p.display="grid","collapse"===p["border-collapse"]&&(p["border-collapse"]=void 0,g=0),g?(p["grid-gap"]=g+"px",p.padding=g+"px"):m&&(e.style+=";border-left:0;border-top:0");var b=[],x=[],w=[],k={};!function i(e){for(var s=0;s<e.length;s++)if("tr"===e[s].name)x.push(e[s]);else if("colgroup"===e[s].name){var n,a=1,r=t(e[s].children||[]);try{for(r.s();!(n=r.n()).done;){var o=n.value;if("col"===o.name){var l=o.attrs.style||"",h=l.indexOf("width")?l.indexOf(";width"):0;if(-1!==h){var c=l.indexOf(";",h+6);-1===c&&(c=l.length),b[a]=l.substring(h?h+7:6,c)}a+=1}}}catch(t){r.e(t)}finally{r.f()}}else i(e[s].children||[])}(s);for(var N=1;N<=x.length;N++){for(var T=1,O=0;O<x[N-1].children.length;O++){var j=x[N-1].children[O];if("td"===j.name||"th"===j.name){for(;k[N+"."+T];)T++;j.c=1;var I=j.attrs.style||"",S=I.indexOf("width")?I.indexOf(";width"):0;if(-1!==S){var C=I.indexOf(";",S+6);-1===C&&(C=I.length),j.attrs.colspan||(b[T]=I.substring(S?S+7:6,C)),I=I.substr(0,S)+I.substr(C)}if(I+=";display:flex;flex-direction:column",-1!==(S=I.indexOf("vertical-align"))){var A=I.substr(S+15,10);A.includes("middle")?I+=";justify-content:center":A.includes("bottom")&&(I+=";justify-content:flex-end")}else I+=";justify-content:center";if(-1!==(S=I.indexOf("text-align"))){var L=I.substr(S+11,10);L.includes("center")?I+=";justify-content: center":L.includes("right")&&(I+=";justify-content: right")}if(I=(m?";border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray")+(g?"":";border-right:0;border-bottom:0"):"")+(f?";padding:".concat(f,"px"):"")+";"+I,j.attrs.colspan&&(I+=";grid-column-start:".concat(T,";grid-column-end:").concat(T+parseInt(j.attrs.colspan)),j.attrs.rowspan||(I+=";grid-row-start:".concat(N,";grid-row-end:").concat(N+1)),T+=parseInt(j.attrs.colspan)-1),j.attrs.rowspan){I+=";grid-row-start:".concat(N,";grid-row-end:").concat(N+parseInt(j.attrs.rowspan)),j.attrs.colspan||(I+=";grid-column-start:".concat(T,";grid-column-end:").concat(T+1));for(var z=1;z<j.attrs.rowspan;z++)for(var U=0;U<(j.attrs.colspan||1);U++)k[N+z+"."+(T-U)]=1}I&&(j.attrs.style=I),w.push(j),T++}}if(1===N){for(var F="",q=1;q<T;q++)F+=(b[q]?b[q]:"auto")+" ";p["grid-template-columns"]=F}}i.children=w}else i.c&&(p.display="table"),isNaN(g)||(p["border-spacing"]=g+"px"),(m||f||i.c)&&function t(e){for(var s=0;s<e.length;s++){var n=e[s];i.c&&(n.c=1),"th"===n.name||"td"===n.name?(m&&(n.attrs.style="border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray",";").concat(n.attrs.style||"")),f&&(n.attrs.style="padding:".concat(f,"px;").concat(n.attrs.style||""))):n.children&&t(n.children)}}(s);if(this.options.scrollTable&&!(e.style||"").includes("inline")){var V=Object.assign({},i);i.name="div",i.attrs={style:"overflow-x:auto;padding:1px"},i.children=[V],e=V.attrs}}else if(("tbody"===i.name||"tr"===i.name)&&i.flag&&i.c)i.flag=void 0,function t(i){for(var e=0;e<i.length;e++)if("td"===i[e].name)for(var s=0,n=["color","background","background-color"];s<n.length;s++){var a=n[s];p[a]&&(i[e].attrs.style=a+":"+p[a]+";"+(i[e].attrs.style||""))}else t(i[e].children||[])}(s);else if("td"!==i.name&&"th"!==i.name||!e.colspan&&!e.rowspan){if("ruby"===i.name){i.name="span";for(var D=0;D<s.length-1;D++)"text"===s[D].type&&"rt"===s[D+1].name&&(s[D]={name:"span",attrs:{style:"display:inline-block;text-align:center"},children:[{name:"div",attrs:{style:"font-size:50%;"+(s[D+1].attrs.style||"")},children:s[D+1].children},s[D]]},s.splice(D+1,1))}}else for(var W=this.stack.length;W--;)"table"!==this.stack[W].name&&"tbody"!==this.stack[W].name&&"tr"!==this.stack[W].name||(this.stack[W].flag=1);else{var B={a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"};B[e.type]&&(e.style+=";list-style-type:"+B[e.type],e.type=void 0),i.c=1;for(var M=s.length;M--;)"li"===s[M].name&&(s[M].c=1)}else i.name="span";if((p.display||"").includes("flex")&&!i.c)for(var P=s.length;P--;){var Z=s[P];Z.f&&(Z.attrs.style=(Z.attrs.style||"")+Z.f,Z.f=void 0)}var _=n&&((n.attrs.style||"").includes("flex")||(n.attrs.style||"").includes("grid"))&&!i.c&&!(p.display||"").includes("inline");_&&(i.f=";max-width:100%"),s.length>=50&&i.c&&!(p.display||"").includes("flex")&&a(s);for(var E in p)if(p[E]){var G=";".concat(E,":").concat(p[E].replace(" !important",""));_&&(E.includes("flex")&&"flex-direction"!==E||"align-self"===E||E.includes("grid")||"-"===p[E][0]||E.includes("width")&&G.includes("%"))?(i.f+=G,"width"===E&&(e.style+=";width:100%")):e.style+=G}e.style=e.style.substr(1)||void 0},r.prototype.onText=function(t){if(!this.pre){for(var i,e="",s=0,a=t.length;s<a;s++)u[t[s]]?(" "!==e[e.length-1]&&(e+=" "),"\n"!==t[s]||i||(i=!0)):e+=t[s];if(" "===e&&i)return;t=e}var r=Object.create(null);if(r.type="text",r.text=n(t),this.hook(r)){"force"===this.options.selectable&&d.includes("iOS")&&!wx.canIUse("rich-text.user-select")&&this.expose();(this.stack.length?this.stack[this.stack.length-1].children:this.nodes).push(r)}},o.prototype.parse=function(t){this.content=t||"",this.i=0,this.start=0,this.state=this.text;for(var i=this.content.length;-1!==this.i&&this.i<i;)this.state()},o.prototype.checkClose=function(t){var i="/"===this.content[this.i];return!!(">"===this.content[this.i]||i&&">"===this.content[this.i+1])&&(t&&this.handler[t](this.content.substring(this.start,this.i)),this.i+=i?2:1,this.start=this.i,this.handler.onOpenTag(i),"script"===this.handler.tagName?(this.i=this.content.indexOf("</",this.i),-1!==this.i&&(this.i+=2,this.start=this.i),this.state=this.endTag):this.state=this.text,!0)},o.prototype.text=function(){if(this.i=this.content.indexOf("<",this.i),-1===this.i)return void(this.start<this.content.length&&this.handler.onText(this.content.substring(this.start,this.content.length)));var t=this.content[this.i+1];if(t>="a"&&t<="z"||t>="A"&&t<="Z")this.start!==this.i&&this.handler.onText(this.content.substring(this.start,this.i)),this.start=++this.i,this.state=this.tagName;else if("/"===t||"!"===t||"?"===t){this.start!==this.i&&this.handler.onText(this.content.substring(this.start,this.i));var i=this.content[this.i+2];if("/"===t&&(i>="a"&&i<="z"||i>="A"&&i<="Z"))return this.i+=2,this.start=this.i,void(this.state=this.endTag);var e="--\x3e";"!"===t&&"-"===this.content[this.i+2]&&"-"===this.content[this.i+3]||(e=">"),this.i=this.content.indexOf(e,this.i),-1!==this.i&&(this.i+=e.length,this.start=this.i)}else this.i++},o.prototype.tagName=function(){if(u[this.content[this.i]]){for(this.handler.onTagName(this.content.substring(this.start,this.i));u[this.content[++this.i]];);this.i<this.content.length&&!this.checkClose()&&(this.start=this.i,this.state=this.attrName)}else this.checkClose("onTagName")||this.i++},o.prototype.attrName=function(){var t=this.content[this.i];if(u[t]||"="===t){this.handler.onAttrName(this.content.substring(this.start,this.i));for(var i="="===t,e=this.content.length;++this.i<e;)if(t=this.content[this.i],!u[t]){if(this.checkClose())return;if(i)return this.start=this.i,void(this.state=this.attrVal);if("="!==this.content[this.i])return this.start=this.i,void(this.state=this.attrName);i=!0}}else this.checkClose("onAttrName")||this.i++},o.prototype.attrVal=function(){var t=this.content[this.i],i=this.content.length;if('"'===t||"'"===t){if(this.start=++this.i,this.i=this.content.indexOf(t,this.i),-1===this.i)return;this.handler.onAttrVal(this.content.substring(this.start,this.i))}else for(;this.i<i;this.i++){if(u[this.content[this.i]]){this.handler.onAttrVal(this.content.substring(this.start,this.i));break}if(this.checkClose("onAttrVal"))return}for(;u[this.content[++this.i]];);this.i<i&&!this.checkClose()&&(this.start=this.i,this.state=this.attrName)},o.prototype.endTag=function(){var t=this.content[this.i];if(u[t]||">"===t||"/"===t){if(this.handler.onCloseTag(this.content.substring(this.start,this.i)),">"!==t&&(this.i=this.content.indexOf(">",this.i),-1===this.i))return;this.start=++this.i,this.state=this.text}else this.i++},module.exports=r; |
New file |
| | |
| | | <template> |
| | | <view id="_root" :class="(selectable?'_select ':'')+'_root'" :style="containerStyle"> |
| | | <slot v-if="!nodes[0]" /> |
| | | <!-- #ifndef APP-PLUS-NVUE --> |
| | | <node v-else :childs="nodes" :opts="[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]" name="span" /> |
| | | <!-- #endif --> |
| | | <!-- #ifdef APP-PLUS-NVUE --> |
| | | <web-view ref="web" src="/static/app-plus/mp-html/local.html" :style="'margin-top:-2px;height:' + height + 'px'" @onPostMessage="_onMessage" /> |
| | | <!-- #endif --> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | /** |
| | | * mp-html v2.5.1 |
| | | * @description 坿æ¬ç»ä»¶ |
| | | * @tutorial https://github.com/jin-yufeng/mp-html |
| | | * @property {String} container-style 容å¨çæ ·å¼ |
| | | * @property {String} content ç¨äºæ¸²æç html å符串 |
| | | * @property {Boolean} copy-link æ¯å¦å
许å¤é¨é¾æ¥è¢«ç¹å»æ¶èªå¨å¤å¶ |
| | | * @property {String} domain 主ååï¼ç¨äºæ¼æ¥é¾æ¥ |
| | | * @property {String} error-img å¾çåºéæ¶çå ä½å¾é¾æ¥ |
| | | * @property {Boolean} lazy-load æ¯å¦å¼å¯å¾çæå è½½ |
| | | * @property {string} loading-img å¾çå è½½è¿ç¨ä¸çå ä½å¾é¾æ¥ |
| | | * @property {Boolean} pause-video æ¯å¦å¨ææ¾ä¸ä¸ªè§é¢æ¶èªå¨æåå
¶ä»è§é¢ |
| | | * @property {Boolean} preview-img æ¯å¦å
许å¾ç被ç¹å»æ¶èªå¨é¢è§ |
| | | * @property {Boolean} scroll-table æ¯å¦ç»æ¯ä¸ªè¡¨æ ¼æ·»å ä¸ä¸ªæ»å¨å±ä½¿å
¶è½åç¬æ¨ªåæ»å¨ |
| | | * @property {Boolean | String} selectable æ¯å¦å¼å¯é¿æå¤å¶ |
| | | * @property {Boolean} set-title æ¯å¦å° title æ ç¾çå
容设置å°é¡µé¢æ é¢ |
| | | * @property {Boolean} show-img-menu æ¯å¦å
许å¾çè¢«é¿ææ¶æ¾ç¤ºèå |
| | | * @property {Object} tag-style æ ç¾çé»è®¤æ ·å¼ |
| | | * @property {Boolean | Number} use-anchor æ¯å¦ä½¿ç¨éç¹é¾æ¥ |
| | | * @event {Function} load dom ç»æå è½½å®æ¯æ¶è§¦å |
| | | * @event {Function} ready ææå¾çå è½½å®æ¯æ¶è§¦å |
| | | * @event {Function} imgtap å¾ç被ç¹å»æ¶è§¦å |
| | | * @event {Function} linktap 龿¥è¢«ç¹å»æ¶è§¦å |
| | | * @event {Function} play é³è§é¢ææ¾æ¶è§¦å |
| | | * @event {Function} error åªä½å è½½åºéæ¶è§¦å |
| | | */ |
| | | // #ifndef APP-PLUS-NVUE |
| | | import node from './node/node' |
| | | // #endif |
| | | import Parser from './parser' |
| | | const plugins=[] |
| | | // #ifdef APP-PLUS-NVUE |
| | | const dom = weex.requireModule('dom') |
| | | // #endif |
| | | export default { |
| | | name: 'mp-html', |
| | | data () { |
| | | return { |
| | | nodes: [], |
| | | // #ifdef APP-PLUS-NVUE |
| | | height: 3 |
| | | // #endif |
| | | } |
| | | }, |
| | | props: { |
| | | containerStyle: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | content: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | copyLink: { |
| | | type: [Boolean, String], |
| | | default: true |
| | | }, |
| | | domain: String, |
| | | errorImg: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | lazyLoad: { |
| | | type: [Boolean, String], |
| | | default: false |
| | | }, |
| | | loadingImg: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | pauseVideo: { |
| | | type: [Boolean, String], |
| | | default: true |
| | | }, |
| | | previewImg: { |
| | | type: [Boolean, String], |
| | | default: true |
| | | }, |
| | | scrollTable: [Boolean, String], |
| | | selectable: [Boolean, String], |
| | | setTitle: { |
| | | type: [Boolean, String], |
| | | default: true |
| | | }, |
| | | showImgMenu: { |
| | | type: [Boolean, String], |
| | | default: true |
| | | }, |
| | | tagStyle: Object, |
| | | useAnchor: [Boolean, Number] |
| | | }, |
| | | // #ifdef VUE3 |
| | | emits: ['load', 'ready', 'imgtap', 'linktap', 'play', 'error'], |
| | | // #endif |
| | | // #ifndef APP-PLUS-NVUE |
| | | components: { |
| | | node |
| | | }, |
| | | // #endif |
| | | watch: { |
| | | content (content) { |
| | | this.setContent(content) |
| | | } |
| | | }, |
| | | created () { |
| | | this.plugins = [] |
| | | for (let i = plugins.length; i--;) { |
| | | this.plugins.push(new plugins[i](this)) |
| | | } |
| | | }, |
| | | mounted () { |
| | | if (this.content && !this.nodes.length) { |
| | | this.setContent(this.content) |
| | | } |
| | | }, |
| | | beforeDestroy () { |
| | | this._hook('onDetached') |
| | | }, |
| | | methods: { |
| | | /** |
| | | * @description å°éç¹è·³è½¬çèå´éå®å¨ä¸ä¸ª scroll-view å
|
| | | * @param {Object} page scroll-view æå¨é¡µé¢çç¤ºä¾ |
| | | * @param {String} selector scroll-view çéæ©å¨ |
| | | * @param {String} scrollTop scroll-view scroll-top 屿§ç»å®çåéå |
| | | */ |
| | | in (page, selector, scrollTop) { |
| | | // #ifndef APP-PLUS-NVUE |
| | | if (page && selector && scrollTop) { |
| | | this._in = { |
| | | page, |
| | | selector, |
| | | scrollTop |
| | | } |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * @description éç¹è·³è½¬ |
| | | * @param {String} id è¦è·³è½¬çéç¹ id |
| | | * @param {Number} offset 跳转ä½ç½®çåç§»é |
| | | * @returns {Promise} |
| | | */ |
| | | navigateTo (id, offset) { |
| | | return new Promise((resolve, reject) => { |
| | | if (!this.useAnchor) { |
| | | reject(Error('Anchor is disabled')) |
| | | return |
| | | } |
| | | offset = offset || parseInt(this.useAnchor) || 0 |
| | | // #ifdef APP-PLUS-NVUE |
| | | if (!id) { |
| | | dom.scrollToElement(this.$refs.web, { |
| | | offset |
| | | }) |
| | | resolve() |
| | | } else { |
| | | this._navigateTo = { |
| | | resolve, |
| | | reject, |
| | | offset |
| | | } |
| | | this.$refs.web.evalJs('uni.postMessage({data:{action:"getOffset",offset:(document.getElementById(' + id + ')||{}).offsetTop}})') |
| | | } |
| | | // #endif |
| | | // #ifndef APP-PLUS-NVUE |
| | | let deep = ' ' |
| | | // #ifdef MP-WEIXIN || MP-QQ || MP-TOUTIAO |
| | | deep = '>>>' |
| | | // #endif |
| | | const selector = uni.createSelectorQuery() |
| | | // #ifndef MP-ALIPAY |
| | | .in(this._in ? this._in.page : this) |
| | | // #endif |
| | | .select((this._in ? this._in.selector : '._root') + (id ? `${deep}#${id}` : '')).boundingClientRect() |
| | | if (this._in) { |
| | | selector.select(this._in.selector).scrollOffset() |
| | | .select(this._in.selector).boundingClientRect() |
| | | } else { |
| | | // è·å scroll-view çä½ç½®åæ»å¨è·ç¦» |
| | | selector.selectViewport().scrollOffset() // è·åçªå£çæ»å¨è·ç¦» |
| | | } |
| | | selector.exec(res => { |
| | | if (!res[0]) { |
| | | reject(Error('Label not found')) |
| | | return |
| | | } |
| | | const scrollTop = res[1].scrollTop + res[0].top - (res[2] ? res[2].top : 0) + offset |
| | | if (this._in) { |
| | | // scroll-view 跳转 |
| | | this._in.page[this._in.scrollTop] = scrollTop |
| | | } else { |
| | | // 页é¢è·³è½¬ |
| | | uni.pageScrollTo({ |
| | | scrollTop, |
| | | duration: 300 |
| | | }) |
| | | } |
| | | resolve() |
| | | }) |
| | | // #endif |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * @description è·åææ¬å
容 |
| | | * @return {String} |
| | | */ |
| | | getText (nodes) { |
| | | let text = ''; |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | const node = nodes[i] |
| | | if (node.type === 'text') { |
| | | text += node.text.replace(/&/g, '&') |
| | | } else if (node.name === 'br') { |
| | | text += '\n' |
| | | } else { |
| | | // å级æ ç¾ååå æ¢è¡ |
| | | const isBlock = node.name === 'p' || node.name === 'div' || node.name === 'tr' || node.name === 'li' || (node.name[0] === 'h' && node.name[1] > '0' && node.name[1] < '7') |
| | | if (isBlock && text && text[text.length - 1] !== '\n') { |
| | | text += '\n' |
| | | } |
| | | // éå½è·ååèç¹çææ¬ |
| | | if (node.children) { |
| | | traversal(node.children) |
| | | } |
| | | if (isBlock && text[text.length - 1] !== '\n') { |
| | | text += '\n' |
| | | } else if (node.name === 'td' || node.name === 'th') { |
| | | text += '\t' |
| | | } |
| | | } |
| | | } |
| | | })(nodes || this.nodes) |
| | | return text |
| | | }, |
| | | |
| | | /** |
| | | * @description è·åå
容大å°åä½ç½® |
| | | * @return {Promise} |
| | | */ |
| | | getRect () { |
| | | return new Promise((resolve, reject) => { |
| | | uni.createSelectorQuery() |
| | | // #ifndef MP-ALIPAY |
| | | .in(this) |
| | | // #endif |
| | | .select('#_root').boundingClientRect().exec(res => res[0] ? resolve(res[0]) : reject(Error('Root label not found'))) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * @description æåææ¾åªä½ |
| | | */ |
| | | pauseMedia () { |
| | | for (let i = (this._videos || []).length; i--;) { |
| | | this._videos[i].pause() |
| | | } |
| | | // #ifdef APP-PLUS |
| | | const command = 'for(var e=document.getElementsByTagName("video"),i=e.length;i--;)e[i].pause()' |
| | | // #ifndef APP-PLUS-NVUE |
| | | let page = this.$parent |
| | | while (!page.$scope) page = page.$parent |
| | | page.$scope.$getAppWebview().evalJS(command) |
| | | // #endif |
| | | // #ifdef APP-PLUS-NVUE |
| | | this.$refs.web.evalJs(command) |
| | | // #endif |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * @description 设置åªä½ææ¾éç |
| | | * @param {Number} rate ææ¾éç |
| | | */ |
| | | setPlaybackRate (rate) { |
| | | this.playbackRate = rate |
| | | for (let i = (this._videos || []).length; i--;) { |
| | | this._videos[i].playbackRate(rate) |
| | | } |
| | | // #ifdef APP-PLUS |
| | | const command = 'for(var e=document.getElementsByTagName("video"),i=e.length;i--;)e[i].playbackRate=' + rate |
| | | // #ifndef APP-PLUS-NVUE |
| | | let page = this.$parent |
| | | while (!page.$scope) page = page.$parent |
| | | page.$scope.$getAppWebview().evalJS(command) |
| | | // #endif |
| | | // #ifdef APP-PLUS-NVUE |
| | | this.$refs.web.evalJs(command) |
| | | // #endif |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * @description 设置å
容 |
| | | * @param {String} content html å
容 |
| | | * @param {Boolean} append æ¯å¦å¨å°¾é¨è¿½å |
| | | */ |
| | | setContent (content, append) { |
| | | if (!append || !this.imgList) { |
| | | this.imgList = [] |
| | | } |
| | | const nodes = new Parser(this).parse(content) |
| | | // #ifdef APP-PLUS-NVUE |
| | | if (this._ready) { |
| | | this._set(nodes, append) |
| | | } |
| | | // #endif |
| | | this.$set(this, 'nodes', append ? (this.nodes || []).concat(nodes) : nodes) |
| | | |
| | | // #ifndef APP-PLUS-NVUE |
| | | this._videos = [] |
| | | this.$nextTick(() => { |
| | | this._hook('onLoad') |
| | | this.$emit('load') |
| | | }) |
| | | |
| | | if (this.lazyLoad || this.imgList._unloadimgs < this.imgList.length / 2) { |
| | | // 设置æå è½½ï¼æ¯ 350ms è·åé«åº¦ï¼ä¸åå认为å è½½å®æ¯ |
| | | let height = 0 |
| | | const callback = rect => { |
| | | if (!rect || !rect.height) rect = {} |
| | | // 350ms æ»é«åº¦æ åå就触å ready äºä»¶ |
| | | if (rect.height === height) { |
| | | this.$emit('ready', rect) |
| | | } else { |
| | | height = rect.height |
| | | setTimeout(() => { |
| | | this.getRect().then(callback).catch(callback) |
| | | }, 350) |
| | | } |
| | | } |
| | | this.getRect().then(callback).catch(callback) |
| | | } else { |
| | | // æªè®¾ç½®æå è½½ï¼çå¾
ææå¾çå è½½å®æ¯ |
| | | if (!this.imgList._unloadimgs) { |
| | | this.getRect().then(rect => { |
| | | this.$emit('ready', rect) |
| | | }).catch(() => { |
| | | this.$emit('ready', {}) |
| | | }) |
| | | } |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * @description è°ç¨æä»¶é©å彿° |
| | | */ |
| | | _hook (name) { |
| | | for (let i = plugins.length; i--;) { |
| | | if (this.plugins[i][name]) { |
| | | this.plugins[i][name]() |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // #ifdef APP-PLUS-NVUE |
| | | /** |
| | | * @description 设置å
容 |
| | | */ |
| | | _set (nodes, append) { |
| | | this.$refs.web.evalJs('setContent(' + JSON.stringify(nodes).replace(/%22/g, '') + ',' + JSON.stringify([this.containerStyle.replace(/(?:margin|padding)[^;]+/g, ''), this.errorImg, this.loadingImg, this.pauseVideo, this.scrollTable, this.selectable]) + ',' + append + ')') |
| | | }, |
| | | |
| | | /** |
| | | * @description æ¥æ¶å° web-view æ¶æ¯ |
| | | */ |
| | | _onMessage (e) { |
| | | const message = e.detail.data[0] |
| | | switch (message.action) { |
| | | // web-view åå§å宿¯ |
| | | case 'onJSBridgeReady': |
| | | this._ready = true |
| | | if (this.nodes) { |
| | | this._set(this.nodes) |
| | | } |
| | | break |
| | | // å
容 dom å è½½å®æ¯ |
| | | case 'onLoad': |
| | | this.height = message.height |
| | | this._hook('onLoad') |
| | | this.$emit('load') |
| | | break |
| | | // ææå¾çå è½½å®æ¯ |
| | | case 'onReady': |
| | | this.getRect().then(res => { |
| | | this.$emit('ready', res) |
| | | }).catch(() => { |
| | | this.$emit('ready', {}) |
| | | }) |
| | | break |
| | | // æ»é«åº¦åçåå |
| | | case 'onHeightChange': |
| | | this.height = message.height |
| | | break |
| | | // å¾çç¹å» |
| | | case 'onImgTap': |
| | | this.$emit('imgtap', message.attrs) |
| | | if (this.previewImg) { |
| | | uni.previewImage({ |
| | | current: parseInt(message.attrs.i), |
| | | urls: this.imgList |
| | | }) |
| | | } |
| | | break |
| | | // 龿¥ç¹å» |
| | | case 'onLinkTap': { |
| | | const href = message.attrs.href |
| | | this.$emit('linktap', message.attrs) |
| | | if (href) { |
| | | // éç¹è·³è½¬ |
| | | if (href[0] === '#') { |
| | | if (this.useAnchor) { |
| | | dom.scrollToElement(this.$refs.web, { |
| | | offset: message.offset |
| | | }) |
| | | } |
| | | } else if (href.includes('://')) { |
| | | // æå¼å¤é¾ |
| | | if (this.copyLink) { |
| | | plus.runtime.openWeb(href) |
| | | } |
| | | } else { |
| | | uni.navigateTo({ |
| | | url: href, |
| | | fail () { |
| | | uni.switchTab({ |
| | | url: href |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | break |
| | | } |
| | | case 'onPlay': |
| | | this.$emit('play') |
| | | break |
| | | // è·åå°éç¹çåç§»é |
| | | case 'getOffset': |
| | | if (typeof message.offset === 'number') { |
| | | dom.scrollToElement(this.$refs.web, { |
| | | offset: message.offset + this._navigateTo.offset |
| | | }) |
| | | this._navigateTo.resolve() |
| | | } else { |
| | | this._navigateTo.reject(Error('Label not found')) |
| | | } |
| | | break |
| | | // ç¹å» |
| | | case 'onClick': |
| | | this.$emit('tap') |
| | | this.$emit('click') |
| | | break |
| | | // åºé |
| | | case 'onError': |
| | | this.$emit('error', { |
| | | source: message.source, |
| | | attrs: message.attrs |
| | | }) |
| | | } |
| | | } |
| | | // #endif |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | /* #ifndef APP-PLUS-NVUE */ |
| | | /* æ ¹èç¹æ ·å¼ */ |
| | | ._root { |
| | | padding: 1px 0; |
| | | overflow-x: auto; |
| | | overflow-y: hidden; |
| | | -webkit-overflow-scrolling: touch; |
| | | } |
| | | |
| | | /* é¿æå¤å¶ */ |
| | | ._select { |
| | | user-select: text; |
| | | } |
| | | /* #endif */ |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <view :id="attrs.id" :class="'_block _'+name+' '+attrs.class" :style="attrs.style"> |
| | | <block v-for="(n, i) in childs" v-bind:key="i"> |
| | | <!-- å¾ç --> |
| | | <!-- å ä½å¾ --> |
| | | <image v-if="n.name==='img'&&!n.t&&((opts[1]&&!ctrl[i])||ctrl[i]<0)" class="_img" :style="n.attrs.style" :src="ctrl[i]<0?opts[2]:opts[1]" mode="widthFix" /> |
| | | <!-- æ¾ç¤ºå¾ç --> |
| | | <!-- #ifdef H5 || (APP-PLUS && VUE2) --> |
| | | <img v-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" /> |
| | | <!-- #endif --> |
| | | <!-- #ifndef H5 || (APP-PLUS && VUE2) --> |
| | | <!-- è¡¨æ ¼ä¸çå¾çï¼ä½¿ç¨ rich-text 鲿¢å¤§å°ä¸æ£ç¡® --> |
| | | <rich-text v-if="n.name==='img'&&n.t" :style="'display:'+n.t" :nodes="[{attrs:{style:n.attrs.style||'',src:n.attrs.src},name:'img'}]" :data-i="i" @tap.stop="imgTap" /> |
| | | <!-- #endif --> |
| | | <!-- #ifdef APP-HARMONY --> |
| | | <image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+ctrl[i]+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" /> |
| | | <!-- #endif --> |
| | | <!-- #ifndef H5 || APP-PLUS || MP-KUAISHOU --> |
| | | <image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;height:1px;'+n.attrs.style" :src="n.attrs.src" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))" :lazy-load="opts[0]" :webp="n.webp" :show-menu-by-longpress="opts[3]&&!n.attrs.ignore" :image-menu-prevent="!opts[3]||n.attrs.ignore" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" /> |
| | | <!-- #endif --> |
| | | <!-- #ifdef MP-KUAISHOU --> |
| | | <image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+n.attrs.style" :src="n.attrs.src" :lazy-load="opts[0]" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap"></image> |
| | | <!-- #endif --> |
| | | <!-- #ifdef APP-PLUS && VUE3 --> |
| | | <image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||''))" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" /> |
| | | <!-- #endif --> |
| | | <!-- ææ¬ --> |
| | | <!-- #ifdef MP-WEIXIN --> |
| | | <text v-else-if="n.text" :user-select="opts[4]=='force'&&isiOS" decode>{{n.text}}</text> |
| | | <!-- #endif --> |
| | | <!-- #ifndef MP-WEIXIN || MP-BAIDU || MP-ALIPAY || MP-TOUTIAO --> |
| | | <text v-else-if="n.text" decode>{{n.text}}</text> |
| | | <!-- #endif --> |
| | | <text v-else-if="n.name==='br'">\n</text> |
| | | <!-- 龿¥ --> |
| | | <view v-else-if="n.name==='a'" :id="n.attrs.id" :class="(n.attrs.href?'_a ':'')+n.attrs.class" hover-class="_hover" :style="'display:inline;'+n.attrs.style" :data-i="i" @tap.stop="linkTap"> |
| | | <node name="span" :childs="n.children" :opts="opts" style="display:inherit" /> |
| | | </view> |
| | | <!-- è§é¢ --> |
| | | <!-- #ifdef APP-PLUS --> |
| | | <view v-else-if="n.html" :id="n.attrs.id" :class="'_video '+n.attrs.class" :style="n.attrs.style" v-html="n.html" :data-i="i" @vplay.stop="play" /> |
| | | <!-- #endif --> |
| | | <!-- #ifndef APP-PLUS --> |
| | | <video v-else-if="n.name==='video'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :autoplay="n.attrs.autoplay" :controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :object-fit="n.attrs['object-fit']" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" @play="play" @error="mediaError" /> |
| | | <!-- #endif --> |
| | | <!-- #ifdef H5 || APP-PLUS --> |
| | | <iframe v-else-if="n.name==='iframe'" :style="n.attrs.style" :allowfullscreen="n.attrs.allowfullscreen" :frameborder="n.attrs.frameborder" :src="n.attrs.src" /> |
| | | <embed v-else-if="n.name==='embed'" :style="n.attrs.style" :src="n.attrs.src" /> |
| | | <!-- #endif --> |
| | | <!-- #ifndef MP-TOUTIAO || ((H5 || APP-PLUS) && VUE3) --> |
| | | <!-- é³é¢ --> |
| | | <audio v-else-if="n.name==='audio'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :author="n.attrs.author" :controls="n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" @play="play" @error="mediaError" /> |
| | | <!-- #endif --> |
| | | <view v-else-if="(n.name==='table'&&n.c)||n.name==='li'" :id="n.attrs.id" :class="'_'+n.name+' '+n.attrs.class" :style="n.attrs.style"> |
| | | <node v-if="n.name==='li'" :childs="n.children" :opts="opts" /> |
| | | <view v-else v-for="(tbody, x) in n.children" v-bind:key="x" :class="'_'+tbody.name+' '+tbody.attrs.class" :style="tbody.attrs.style"> |
| | | <node v-if="tbody.name==='td'||tbody.name==='th'" :childs="tbody.children" :opts="opts" /> |
| | | <block v-else v-for="(tr, y) in tbody.children" v-bind:key="y"> |
| | | <view v-if="tr.name==='td'||tr.name==='th'" :class="'_'+tr.name+' '+tr.attrs.class" :style="tr.attrs.style"> |
| | | <node :childs="tr.children" :opts="opts" /> |
| | | </view> |
| | | <view v-else :class="'_'+tr.name+' '+tr.attrs.class" :style="tr.attrs.style"> |
| | | <view v-for="(td, z) in tr.children" v-bind:key="z" :class="'_'+td.name+' '+td.attrs.class" :style="td.attrs.style"> |
| | | <node :childs="td.children" :opts="opts" /> |
| | | </view> |
| | | </view> |
| | | </block> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- å¯ææ¬ --> |
| | | <!-- #ifdef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) --> |
| | | <rich-text v-else-if="!n.c&&!handler.isInline(n.name, n.attrs.style)" :id="n.attrs.id" :style="n.f" :user-select="opts[4]" :nodes="[n]" /> |
| | | <!-- #endif --> |
| | | <!-- #ifndef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) --> |
| | | <rich-text v-else-if="!n.c" :id="n.attrs.id" :style="'display:inline;'+n.f" :preview="false" :selectable="opts[4]" :user-select="opts[4]" :nodes="[n]" /> |
| | | <!-- #endif --> |
| | | <!-- ç»§ç»éå½ --> |
| | | <view v-else-if="n.c===2" :id="n.attrs.id" :class="'_block _'+n.name+' '+n.attrs.class" :style="n.f+';'+n.attrs.style"> |
| | | <node v-for="(n2, j) in n.children" v-bind:key="j" :style="n2.f" :name="n2.name" :attrs="n2.attrs" :childs="n2.children" :opts="opts" /> |
| | | </view> |
| | | <node v-else :style="n.f" :name="n.name" :attrs="n.attrs" :childs="n.children" :opts="opts" /> |
| | | </block> |
| | | </view> |
| | | </template> |
| | | <script module="handler" lang="wxs"> |
| | | // è¡å
æ ç¾å表 |
| | | var inlineTags = { |
| | | abbr: true, |
| | | b: true, |
| | | big: true, |
| | | code: true, |
| | | del: true, |
| | | em: true, |
| | | i: true, |
| | | ins: true, |
| | | label: true, |
| | | q: true, |
| | | small: true, |
| | | span: true, |
| | | strong: true, |
| | | sub: true, |
| | | sup: true |
| | | } |
| | | /** |
| | | * @description 夿æ¯å¦ä¸ºè¡å
æ ç¾ |
| | | */ |
| | | module.exports = { |
| | | isInline: function (tagName, style) { |
| | | return inlineTags[tagName] || (style || '').indexOf('display:inline') !== -1 |
| | | } |
| | | } |
| | | </script> |
| | | <script> |
| | | |
| | | import node from './node' |
| | | export default { |
| | | name: 'node', |
| | | options: { |
| | | // #ifdef MP-WEIXIN |
| | | virtualHost: true, |
| | | // #endif |
| | | // #ifdef MP-TOUTIAO |
| | | addGlobalClass: false |
| | | // #endif |
| | | }, |
| | | data () { |
| | | return { |
| | | ctrl: {}, |
| | | // #ifdef MP-WEIXIN |
| | | isiOS: uni.getSystemInfoSync().system.includes('iOS') |
| | | // #endif |
| | | } |
| | | }, |
| | | props: { |
| | | name: String, |
| | | attrs: { |
| | | type: Object, |
| | | default () { |
| | | return {} |
| | | } |
| | | }, |
| | | childs: Array, |
| | | opts: Array |
| | | }, |
| | | components: { |
| | | |
| | | // #ifndef ((H5 || APP-PLUS) && VUE3) || APP-HARMONY |
| | | node |
| | | // #endif |
| | | }, |
| | | mounted () { |
| | | this.$nextTick(() => { |
| | | for (this.root = this.$parent; this.root.$options.name !== 'mp-html'; this.root = this.root.$parent); |
| | | }) |
| | | // #ifdef H5 || APP-PLUS |
| | | if (this.opts[0]) { |
| | | let i |
| | | for (i = this.childs.length; i--;) { |
| | | if (this.childs[i].name === 'img') break |
| | | } |
| | | if (i !== -1) { |
| | | this.observer = uni.createIntersectionObserver(this).relativeToViewport({ |
| | | top: 500, |
| | | bottom: 500 |
| | | }) |
| | | this.observer.observe('._img', res => { |
| | | if (res.intersectionRatio) { |
| | | this.$set(this.ctrl, 'load', 1) |
| | | this.observer.disconnect() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | // #endif |
| | | }, |
| | | beforeDestroy () { |
| | | // #ifdef H5 || APP-PLUS |
| | | if (this.observer) { |
| | | this.observer.disconnect() |
| | | } |
| | | // #endif |
| | | }, |
| | | methods:{ |
| | | // #ifdef MP-WEIXIN |
| | | toJSON () { return this }, |
| | | // #endif |
| | | /** |
| | | * @description ææ¾è§é¢äºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | play (e) { |
| | | const i = e.currentTarget.dataset.i |
| | | const node = this.childs[i] |
| | | this.root.$emit('play', { |
| | | source: node.name, |
| | | attrs: { |
| | | ...node.attrs, |
| | | src: node.src[this.ctrl[i] || 0] |
| | | } |
| | | }) |
| | | // #ifndef APP-PLUS |
| | | if (this.root.pauseVideo) { |
| | | let flag = false |
| | | const id = e.target.id |
| | | for (let i = this.root._videos.length; i--;) { |
| | | if (this.root._videos[i].id === id) { |
| | | flag = true |
| | | } else { |
| | | this.root._videos[i].pause() // èªå¨æåå
¶ä»è§é¢ |
| | | } |
| | | } |
| | | // å°èªå·±å å
¥å表 |
| | | if (!flag) { |
| | | const ctx = uni.createVideoContext(id |
| | | // #ifndef MP-BAIDU |
| | | , this |
| | | // #endif |
| | | ) |
| | | ctx.id = id |
| | | if (this.root.playbackRate) { |
| | | ctx.playbackRate(this.root.playbackRate) |
| | | } |
| | | this.root._videos.push(ctx) |
| | | } |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * @description å¾çç¹å»äºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | imgTap (e) { |
| | | const node = this.childs[e.currentTarget.dataset.i] |
| | | if (node.a) { |
| | | this.linkTap(node.a) |
| | | return |
| | | } |
| | | if (node.attrs.ignore) return |
| | | // #ifdef H5 || APP-PLUS |
| | | node.attrs.src = node.attrs.src || node.attrs['data-src'] |
| | | // #endif |
| | | // #ifndef APP-HARMONY |
| | | this.root.$emit('imgtap', node.attrs) |
| | | // #endif |
| | | // #ifdef APP-HARMONY |
| | | this.root.$emit('imgtap', { |
| | | ...node.attrs |
| | | }) |
| | | // #endif |
| | | // èªå¨é¢è§å¾ç |
| | | if (this.root.previewImg) { |
| | | uni.previewImage({ |
| | | // #ifdef MP-WEIXIN |
| | | showmenu: this.root.showImgMenu, |
| | | // #endif |
| | | // #ifdef MP-ALIPAY |
| | | enablesavephoto: this.root.showImgMenu, |
| | | enableShowPhotoDownload: this.root.showImgMenu, |
| | | // #endif |
| | | current: parseInt(node.attrs.i), |
| | | urls: this.root.imgList |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description å¾çé¿æ |
| | | */ |
| | | imgLongTap (e) { |
| | | // #ifdef APP-PLUS |
| | | const attrs = this.childs[e.currentTarget.dataset.i].attrs |
| | | if (this.opts[3] && !attrs.ignore) { |
| | | uni.showActionSheet({ |
| | | itemList: ['ä¿åå¾ç'], |
| | | success: () => { |
| | | const save = path => { |
| | | uni.saveImageToPhotosAlbum({ |
| | | filePath: path, |
| | | success () { |
| | | uni.showToast({ |
| | | title: 'ä¿åæå' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | if (this.root.imgList[attrs.i].startsWith('http')) { |
| | | uni.downloadFile({ |
| | | url: this.root.imgList[attrs.i], |
| | | success: res => save(res.tempFilePath) |
| | | }) |
| | | } else { |
| | | save(this.root.imgList[attrs.i]) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * @description å¾çå è½½å®æäºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | imgLoad (e) { |
| | | const i = e.currentTarget.dataset.i |
| | | /* #ifndef H5 || (APP-PLUS && VUE2) */ |
| | | if (!this.childs[i].w) { |
| | | // 设置å宽度 |
| | | this.$set(this.ctrl, i, e.detail.width) |
| | | } else /* #endif */ if ((this.opts[1] && !this.ctrl[i]) || this.ctrl[i] === -1) { |
| | | // å è½½å®æ¯ï¼åæ¶å è½½ä¸å ä½å¾ |
| | | this.$set(this.ctrl, i, 1) |
| | | } |
| | | this.checkReady() |
| | | }, |
| | | |
| | | /** |
| | | * @description æ£æ¥æ¯å¦ææå¾çå è½½å®æ¯ |
| | | */ |
| | | checkReady () { |
| | | if (this.root && !this.root.lazyLoad) { |
| | | this.root._unloadimgs -= 1 |
| | | if (!this.root._unloadimgs) { |
| | | setTimeout(() => { |
| | | this.root.getRect().then(rect => { |
| | | this.root.$emit('ready', rect) |
| | | }).catch(() => { |
| | | this.root.$emit('ready', {}) |
| | | }) |
| | | }, 350) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description 龿¥ç¹å»äºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | linkTap (e) { |
| | | const node = e.currentTarget ? this.childs[e.currentTarget.dataset.i] : {} |
| | | const attrs = node.attrs || e |
| | | const href = attrs.href |
| | | this.root.$emit('linktap', Object.assign({ |
| | | innerText: this.root.getText(node.children || []) // 龿¥å
çææ¬å
容 |
| | | }, attrs)) |
| | | if (href) { |
| | | if (href[0] === '#') { |
| | | // 跳转éç¹ |
| | | this.root.navigateTo(href.substring(1)).catch(() => { }) |
| | | } else if (href.split('?')[0].includes('://')) { |
| | | // å¤å¶å¤é¨é¾æ¥ |
| | | if (this.root.copyLink) { |
| | | // #ifdef H5 |
| | | window.open(href) |
| | | // #endif |
| | | // #ifdef MP |
| | | uni.setClipboardData({ |
| | | data: href, |
| | | success: () => |
| | | uni.showToast({ |
| | | title: '龿¥å·²å¤å¶' |
| | | }) |
| | | }) |
| | | // #endif |
| | | // #ifdef APP-PLUS |
| | | plus.runtime.openWeb(href) |
| | | // #endif |
| | | } |
| | | } else { |
| | | // è·³è½¬é¡µé¢ |
| | | uni.navigateTo({ |
| | | url: href, |
| | | fail () { |
| | | uni.switchTab({ |
| | | url: href, |
| | | fail () { } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description é误äºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | mediaError (e) { |
| | | const i = e.currentTarget.dataset.i |
| | | const node = this.childs[i] |
| | | // å è½½å
¶ä»æº |
| | | if (node.name === 'video' || node.name === 'audio') { |
| | | let index = (this.ctrl[i] || 0) + 1 |
| | | if (index > node.src.length) { |
| | | index = 0 |
| | | } |
| | | if (index < node.src.length) { |
| | | this.$set(this.ctrl, i, index) |
| | | return |
| | | } |
| | | } else if (node.name === 'img') { |
| | | // #ifdef H5 && VUE3 |
| | | if (this.opts[0] && !this.ctrl.load) return |
| | | // #endif |
| | | // æ¾ç¤ºé误å ä½å¾ |
| | | if (this.opts[2]) { |
| | | this.$set(this.ctrl, i, -1) |
| | | } |
| | | this.checkReady() |
| | | } |
| | | if (this.root) { |
| | | this.root.$emit('error', { |
| | | source: node.name, |
| | | attrs: node.attrs, |
| | | // #ifndef H5 && VUE3 |
| | | errMsg: e.detail.errMsg |
| | | // #endif |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style> |
| | | /* a æ ç¾é»è®¤ææ */ |
| | | ._a { |
| | | padding: 1.5px 0 1.5px 0; |
| | | color: #366092; |
| | | word-break: break-all; |
| | | } |
| | | |
| | | /* a æ ç¾ç¹å»æææ */ |
| | | ._hover { |
| | | text-decoration: underline; |
| | | opacity: 0.7; |
| | | } |
| | | |
| | | /* å¾çé»è®¤ææ */ |
| | | ._img { |
| | | max-width: 100%; |
| | | -webkit-touch-callout: none; |
| | | } |
| | | |
| | | /* å
鍿 ·å¼ */ |
| | | |
| | | ._block { |
| | | display: block; |
| | | } |
| | | |
| | | ._b, |
| | | ._strong { |
| | | font-weight: bold; |
| | | } |
| | | |
| | | ._code { |
| | | font-family: monospace; |
| | | } |
| | | |
| | | ._del { |
| | | text-decoration: line-through; |
| | | } |
| | | |
| | | ._em, |
| | | ._i { |
| | | font-style: italic; |
| | | } |
| | | |
| | | ._h1 { |
| | | font-size: 2em; |
| | | } |
| | | |
| | | ._h2 { |
| | | font-size: 1.5em; |
| | | } |
| | | |
| | | ._h3 { |
| | | font-size: 1.17em; |
| | | } |
| | | |
| | | ._h5 { |
| | | font-size: 0.83em; |
| | | } |
| | | |
| | | ._h6 { |
| | | font-size: 0.67em; |
| | | } |
| | | |
| | | ._h1, |
| | | ._h2, |
| | | ._h3, |
| | | ._h4, |
| | | ._h5, |
| | | ._h6 { |
| | | display: block; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | ._image { |
| | | height: 1px; |
| | | } |
| | | |
| | | ._ins { |
| | | text-decoration: underline; |
| | | } |
| | | |
| | | ._li { |
| | | display: list-item; |
| | | } |
| | | |
| | | ._ol { |
| | | list-style-type: decimal; |
| | | } |
| | | |
| | | ._ol, |
| | | ._ul { |
| | | display: block; |
| | | padding-left: 40px; |
| | | margin: 1em 0; |
| | | } |
| | | |
| | | ._q::before { |
| | | content: '"'; |
| | | } |
| | | |
| | | ._q::after { |
| | | content: '"'; |
| | | } |
| | | |
| | | ._sub { |
| | | font-size: smaller; |
| | | vertical-align: sub; |
| | | } |
| | | |
| | | ._sup { |
| | | font-size: smaller; |
| | | vertical-align: super; |
| | | } |
| | | |
| | | ._thead, |
| | | ._tbody, |
| | | ._tfoot { |
| | | display: table-row-group; |
| | | } |
| | | |
| | | ._tr { |
| | | display: table-row; |
| | | } |
| | | |
| | | ._td, |
| | | ._th { |
| | | display: table-cell; |
| | | vertical-align: middle; |
| | | } |
| | | |
| | | ._th { |
| | | font-weight: bold; |
| | | text-align: center; |
| | | } |
| | | |
| | | ._ul { |
| | | list-style-type: disc; |
| | | } |
| | | |
| | | ._ul ._ul { |
| | | margin: 0; |
| | | list-style-type: circle; |
| | | } |
| | | |
| | | ._ul ._ul ._ul { |
| | | list-style-type: square; |
| | | } |
| | | |
| | | ._abbr, |
| | | ._b, |
| | | ._code, |
| | | ._del, |
| | | ._em, |
| | | ._i, |
| | | ._ins, |
| | | ._label, |
| | | ._q, |
| | | ._span, |
| | | ._strong, |
| | | ._sub, |
| | | ._sup { |
| | | display: inline; |
| | | } |
| | | |
| | | /* #ifdef APP-PLUS */ |
| | | ._video { |
| | | width: 300px; |
| | | height: 225px; |
| | | } |
| | | /* #endif */ |
| | | </style> |
New file |
| | |
| | | /** |
| | | * @fileoverview html è§£æå¨ |
| | | */ |
| | | |
| | | // é
ç½® |
| | | const config = { |
| | | // ä¿¡ä»»çæ ç¾ï¼ä¿ææ ç¾åä¸åï¼ |
| | | trustTags: makeMap('a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'), |
| | | |
| | | // å级æ ç¾ï¼è½¬ä¸º divï¼å
¶ä»çéä¿¡ä»»æ ç¾è½¬ä¸º spanï¼ |
| | | blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'), |
| | | |
| | | // #ifdef (MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE3 |
| | | // è¡å
æ ç¾ |
| | | inlineTags: makeMap('abbr,b,big,code,del,em,i,ins,label,q,small,span,strong,sub,sup'), |
| | | // #endif |
| | | |
| | | // è¦ç§»é¤çæ ç¾ |
| | | ignoreTags: makeMap('area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr'), |
| | | |
| | | // èªéåçæ ç¾ |
| | | voidTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'), |
| | | |
| | | // html å®ä½ |
| | | entities: { |
| | | lt: '<', |
| | | gt: '>', |
| | | quot: '"', |
| | | apos: "'", |
| | | ensp: '\u2002', |
| | | emsp: '\u2003', |
| | | nbsp: '\xA0', |
| | | semi: ';', |
| | | ndash: 'â', |
| | | mdash: 'â', |
| | | middot: '·', |
| | | lsquo: 'â', |
| | | rsquo: 'â', |
| | | ldquo: 'â', |
| | | rdquo: 'â', |
| | | bull: 'â¢', |
| | | hellip: 'â¦', |
| | | larr: 'â', |
| | | uarr: 'â', |
| | | rarr: 'â', |
| | | darr: 'â' |
| | | }, |
| | | |
| | | // é»è®¤çæ ç¾æ ·å¼ |
| | | tagStyle: { |
| | | // #ifndef APP-PLUS-NVUE |
| | | address: 'font-style:italic', |
| | | big: 'display:inline;font-size:1.2em', |
| | | caption: 'display:table-caption;text-align:center', |
| | | center: 'text-align:center', |
| | | cite: 'font-style:italic', |
| | | dd: 'margin-left:40px', |
| | | mark: 'background-color:yellow', |
| | | pre: 'font-family:monospace;white-space:pre', |
| | | s: 'text-decoration:line-through', |
| | | small: 'display:inline;font-size:0.8em', |
| | | strike: 'text-decoration:line-through', |
| | | u: 'text-decoration:underline' |
| | | // #endif |
| | | }, |
| | | |
| | | // svg 大å°å对ç
§è¡¨ |
| | | svgDict: { |
| | | animatetransform: 'animateTransform', |
| | | lineargradient: 'linearGradient', |
| | | viewbox: 'viewBox', |
| | | attributename: 'attributeName', |
| | | repeatcount: 'repeatCount', |
| | | repeatdur: 'repeatDur', |
| | | foreignobject: 'foreignObject' |
| | | } |
| | | } |
| | | const tagSelector={} |
| | | let windowWidth, system |
| | | // #ifdef MP-WEIXIN |
| | | if (uni.canIUse('getWindowInfo')) { |
| | | windowWidth = uni.getWindowInfo().windowWidth |
| | | system = uni.getDeviceInfo().system |
| | | } else { |
| | | // #endif |
| | | const systemInfo = uni.getSystemInfoSync() |
| | | windowWidth = systemInfo.windowWidth |
| | | // #ifdef MP-WEIXIN |
| | | system = systemInfo.system |
| | | } |
| | | // #endif |
| | | const blankChar = makeMap(' ,\r,\n,\t,\f') |
| | | let idIndex = 0 |
| | | |
| | | // #ifdef H5 || APP-PLUS |
| | | config.ignoreTags.iframe = undefined |
| | | config.trustTags.iframe = true |
| | | config.ignoreTags.embed = undefined |
| | | config.trustTags.embed = true |
| | | // #endif |
| | | // #ifdef APP-PLUS-NVUE |
| | | config.ignoreTags.source = undefined |
| | | config.ignoreTags.style = undefined |
| | | // #endif |
| | | |
| | | /** |
| | | * @description å建 map |
| | | * @param {String} str éå·åé |
| | | */ |
| | | function makeMap (str) { |
| | | const map = Object.create(null) |
| | | const list = str.split(',') |
| | | for (let i = list.length; i--;) { |
| | | map[list[i]] = true |
| | | } |
| | | return map |
| | | } |
| | | |
| | | /** |
| | | * @description è§£ç html å®ä½ |
| | | * @param {String} str è¦è§£ç çå符串 |
| | | * @param {Boolean} amp è¦ä¸è¦è§£ç & |
| | | * @returns {String} è§£ç åçå符串 |
| | | */ |
| | | function decodeEntity (str, amp) { |
| | | let i = str.indexOf('&') |
| | | while (i !== -1) { |
| | | const j = str.indexOf(';', i + 3) |
| | | let code |
| | | if (j === -1) break |
| | | if (str[i + 1] === '#') { |
| | | // { å½¢å¼çå®ä½ |
| | | code = parseInt((str[i + 2] === 'x' ? '0' : '') + str.substring(i + 2, j)) |
| | | if (!isNaN(code)) { |
| | | str = str.substr(0, i) + String.fromCharCode(code) + str.substr(j + 1) |
| | | } |
| | | } else { |
| | | // å½¢å¼çå®ä½ |
| | | code = str.substring(i + 1, j) |
| | | if (config.entities[code] || (code === 'amp' && amp)) { |
| | | str = str.substr(0, i) + (config.entities[code] || '&') + str.substr(j + 1) |
| | | } |
| | | } |
| | | i = str.indexOf('&', i + 1) |
| | | } |
| | | return str |
| | | } |
| | | |
| | | /** |
| | | * @description åå¹¶å¤ä¸ªå级æ ç¾ï¼å å¿«é¿å
容渲æ |
| | | * @param {Array} nodes è¦åå¹¶çæ ç¾æ°ç» |
| | | */ |
| | | function mergeNodes (nodes) { |
| | | let i = nodes.length - 1 |
| | | for (let j = i; j >= -1; j--) { |
| | | if (j === -1 || nodes[j].c || !nodes[j].name || (nodes[j].name !== 'div' && nodes[j].name !== 'p' && nodes[j].name[0] !== 'h') || (nodes[j].attrs.style || '').includes('inline')) { |
| | | if (i - j >= 5) { |
| | | nodes.splice(j + 1, i - j, { |
| | | name: 'div', |
| | | attrs: {}, |
| | | children: nodes.slice(j + 1, i + 1) |
| | | }) |
| | | } |
| | | i = j - 1 |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description html è§£æå¨ |
| | | * @param {Object} vm ç»ä»¶å®ä¾ |
| | | */ |
| | | function Parser (vm) { |
| | | this.options = vm || {} |
| | | this.tagStyle = Object.assign({}, config.tagStyle, this.options.tagStyle) |
| | | this.imgList = vm.imgList || [] |
| | | this.imgList._unloadimgs = 0 |
| | | this.plugins = vm.plugins || [] |
| | | this.attrs = Object.create(null) |
| | | this.stack = [] |
| | | this.nodes = [] |
| | | this.pre = (this.options.containerStyle || '').includes('white-space') && this.options.containerStyle.includes('pre') ? 2 : 0 |
| | | } |
| | | |
| | | /** |
| | | * @description æ§è¡è§£æ |
| | | * @param {String} content è¦è§£æçææ¬ |
| | | */ |
| | | Parser.prototype.parse = function (content) { |
| | | // æä»¶å¤ç |
| | | for (let i = this.plugins.length; i--;) { |
| | | if (this.plugins[i].onUpdate) { |
| | | content = this.plugins[i].onUpdate(content, config) || content |
| | | } |
| | | } |
| | | |
| | | new Lexer(this).parse(content) |
| | | // åºæ æªéåçæ ç¾ |
| | | while (this.stack.length) { |
| | | this.popNode() |
| | | } |
| | | if (this.nodes.length > 50) { |
| | | mergeNodes(this.nodes) |
| | | } |
| | | return this.nodes |
| | | } |
| | | |
| | | /** |
| | | * @description å°æ ç¾æ´é²åºæ¥ï¼ä¸è¢« rich-text å
å«ï¼ |
| | | */ |
| | | Parser.prototype.expose = function () { |
| | | // #ifndef APP-PLUS-NVUE |
| | | for (let i = this.stack.length; i--;) { |
| | | const item = this.stack[i] |
| | | if (item.c || item.name === 'a' || item.name === 'video' || item.name === 'audio') return |
| | | item.c = 1 |
| | | } |
| | | // #endif |
| | | } |
| | | |
| | | /** |
| | | * @description å¤çæä»¶ |
| | | * @param {Object} node è¦å¤ççæ ç¾ |
| | | * @returns {Boolean} æ¯å¦è¦ç§»é¤æ¤æ ç¾ |
| | | */ |
| | | Parser.prototype.hook = function (node) { |
| | | for (let i = this.plugins.length; i--;) { |
| | | if (this.plugins[i].onParse && this.plugins[i].onParse(node, this) === false) { |
| | | return false |
| | | } |
| | | } |
| | | return true |
| | | } |
| | | |
| | | /** |
| | | * @description å°é¾æ¥æ¼æ¥ä¸ä¸»åå |
| | | * @param {String} url éè¦æ¼æ¥ç龿¥ |
| | | * @returns {String} æ¼æ¥åç龿¥ |
| | | */ |
| | | Parser.prototype.getUrl = function (url) { |
| | | const domain = this.options.domain |
| | | if (url[0] === '/') { |
| | | if (url[1] === '/') { |
| | | // // å¼å¤´çè¡¥å
åè®®å |
| | | url = (domain ? domain.split('://')[0] : 'http') + ':' + url |
| | | } else if (domain) { |
| | | // å¦åè¡¥å
æ´ä¸ªåå |
| | | url = domain + url |
| | | } /* #ifdef APP-PLUS */ else { |
| | | url = plus.io.convertLocalFileSystemURL(url) |
| | | } /* #endif */ |
| | | } else if (!url.includes('data:') && !url.includes('://')) { |
| | | if (domain) { |
| | | url = domain + '/' + url |
| | | } /* #ifdef APP-PLUS */ else { |
| | | url = plus.io.convertLocalFileSystemURL(url) |
| | | } /* #endif */ |
| | | } |
| | | return url |
| | | } |
| | | |
| | | /** |
| | | * @description è§£ææ ·å¼è¡¨ |
| | | * @param {Object} node æ ç¾ |
| | | * @returns {Object} |
| | | */ |
| | | Parser.prototype.parseStyle = function (node) { |
| | | const attrs = node.attrs |
| | | const list = (this.tagStyle[node.name] || '').split(';').concat((attrs.style || '').split(';')) |
| | | const styleObj = {} |
| | | let tmp = '' |
| | | |
| | | if (attrs.id && !this.xml) { |
| | | // æ´é²éç¹ |
| | | if (this.options.useAnchor) { |
| | | this.expose() |
| | | } else if (node.name !== 'img' && node.name !== 'a' && node.name !== 'video' && node.name !== 'audio') { |
| | | attrs.id = undefined |
| | | } |
| | | } |
| | | |
| | | // è½¬æ¢ width å height 屿§ |
| | | if (attrs.width) { |
| | | styleObj.width = parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px') |
| | | attrs.width = undefined |
| | | } |
| | | if (attrs.height) { |
| | | styleObj.height = parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px') |
| | | attrs.height = undefined |
| | | } |
| | | |
| | | for (let i = 0, len = list.length; i < len; i++) { |
| | | const info = list[i].split(':') |
| | | if (info.length < 2) continue |
| | | const key = info.shift().trim().toLowerCase() |
| | | let value = info.join(':').trim() |
| | | if ((value[0] === '-' && value.lastIndexOf('-') > 0) || value.includes('safe')) { |
| | | // å
¼å®¹æ§ç css ä¸å缩 |
| | | tmp += `;${key}:${value}` |
| | | } else if (!styleObj[key] || value.includes('import') || !styleObj[key].includes('import')) { |
| | | // éå¤çæ ·å¼è¿è¡è¦ç |
| | | if (value.includes('url')) { |
| | | // å¡«å
龿¥ |
| | | let j = value.indexOf('(') + 1 |
| | | if (j) { |
| | | while (value[j] === '"' || value[j] === "'" || blankChar[value[j]]) { |
| | | j++ |
| | | } |
| | | value = value.substr(0, j) + this.getUrl(value.substr(j)) |
| | | } |
| | | } else if (value.includes('rpx')) { |
| | | // è½¬æ¢ rpxï¼rich-text å
é¨ä¸æ¯æ rpxï¼ |
| | | value = value.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * windowWidth / 750 + 'px') |
| | | } |
| | | styleObj[key] = value |
| | | } |
| | | } |
| | | |
| | | node.attrs.style = tmp |
| | | return styleObj |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°æ ç¾å |
| | | * @param {String} name æ ç¾å |
| | | * @private |
| | | */ |
| | | Parser.prototype.onTagName = function (name) { |
| | | this.tagName = this.xml ? name : name.toLowerCase() |
| | | if (this.tagName === 'svg') { |
| | | this.xml = (this.xml || 0) + 1 // svg æ ç¾å
大å°åææ |
| | | config.ignoreTags.style = undefined // svg æ ç¾å
style å¯ç¨ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°å±æ§å |
| | | * @param {String} name 屿§å |
| | | * @private |
| | | */ |
| | | Parser.prototype.onAttrName = function (name) { |
| | | name = this.xml ? name : name.toLowerCase() |
| | | // #ifdef (VUE3 && (H5 || APP-PLUS)) || APP-PLUS-NVUE |
| | | if (name.includes('?') || name.includes(';')) { |
| | | this.attrName = undefined |
| | | return |
| | | } |
| | | // #endif |
| | | if (name.substr(0, 5) === 'data-') { |
| | | if (name === 'data-src' && !this.attrs.src) { |
| | | // data-src èªå¨è½¬ä¸º src |
| | | this.attrName = 'src' |
| | | } else if (this.tagName === 'img' || this.tagName === 'a') { |
| | | // a å img æ ç¾ä¿ç data- ç屿§ï¼å¯ä»¥å¨ imgtap å linktap äºä»¶ä¸ä½¿ç¨ |
| | | this.attrName = name |
| | | } else { |
| | | // å©ä½çç§»é¤ä»¥åå°å¤§å° |
| | | this.attrName = undefined |
| | | } |
| | | } else { |
| | | this.attrName = name |
| | | this.attrs[name] = 'T' // boolean å屿§ç¼ºç设置 |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°å±æ§å¼ |
| | | * @param {String} val 屿§å¼ |
| | | * @private |
| | | */ |
| | | Parser.prototype.onAttrVal = function (val) { |
| | | const name = this.attrName || '' |
| | | if (name === 'style' || name === 'href') { |
| | | // é¨å屿§è¿è¡å®ä½è§£ç |
| | | this.attrs[name] = decodeEntity(val, true) |
| | | } else if (name.includes('src')) { |
| | | // æ¼æ¥ä¸»åå |
| | | this.attrs[name] = this.getUrl(decodeEntity(val, true)) |
| | | } else if (name) { |
| | | this.attrs[name] = val |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°æ ç¾å¼å§ |
| | | * @param {Boolean} selfClose æ¯å¦æèªéåæ è¯ /> |
| | | * @private |
| | | */ |
| | | Parser.prototype.onOpenTag = function (selfClose) { |
| | | // æ¼è£
node |
| | | const node = Object.create(null) |
| | | node.name = this.tagName |
| | | node.attrs = this.attrs |
| | | // é¿å
å 为èªå¨ diff ä½¿å¾ type 被设置为 null 导è´é¨åå
容䏿¾ç¤º |
| | | if (this.options.nodes.length) { |
| | | node.type = 'node' |
| | | } |
| | | this.attrs = Object.create(null) |
| | | |
| | | const attrs = node.attrs |
| | | const parent = this.stack[this.stack.length - 1] |
| | | const siblings = parent ? parent.children : this.nodes |
| | | const close = this.xml ? selfClose : config.voidTags[node.name] |
| | | |
| | | // æ¿æ¢æ ç¾åéæ©å¨ |
| | | if (tagSelector[node.name]) { |
| | | attrs.class = tagSelector[node.name] + (attrs.class ? ' ' + attrs.class : '') |
| | | } |
| | | |
| | | // è½¬æ¢ embed æ ç¾ |
| | | if (node.name === 'embed') { |
| | | // #ifndef H5 || APP-PLUS |
| | | const src = attrs.src || '' |
| | | // æç
§åç¼åå type å° embed 转为 video æ audio |
| | | if (src.includes('.mp4') || src.includes('.3gp') || src.includes('.m3u8') || (attrs.type || '').includes('video')) { |
| | | node.name = 'video' |
| | | } else if (src.includes('.mp3') || src.includes('.wav') || src.includes('.aac') || src.includes('.m4a') || (attrs.type || '').includes('audio')) { |
| | | node.name = 'audio' |
| | | } |
| | | if (attrs.autostart) { |
| | | attrs.autoplay = 'T' |
| | | } |
| | | attrs.controls = 'T' |
| | | // #endif |
| | | // #ifdef H5 || APP-PLUS |
| | | this.expose() |
| | | // #endif |
| | | } |
| | | |
| | | // #ifndef APP-PLUS-NVUE |
| | | // å¤çé³è§é¢ |
| | | if (node.name === 'video' || node.name === 'audio') { |
| | | // 设置 id 以便è·å context |
| | | if (node.name === 'video' && !attrs.id) { |
| | | attrs.id = 'v' + idIndex++ |
| | | } |
| | | // 没æè®¾ç½® controls 乿²¡æè®¾ç½® autoplay çèªå¨è®¾ç½® controls |
| | | if (!attrs.controls && !attrs.autoplay) { |
| | | attrs.controls = 'T' |
| | | } |
| | | // ç¨æ°ç»å卿æå¯ç¨ç source |
| | | node.src = [] |
| | | if (attrs.src) { |
| | | node.src.push(attrs.src) |
| | | attrs.src = undefined |
| | | } |
| | | this.expose() |
| | | } |
| | | // #endif |
| | | |
| | | // å¤çèªéåæ ç¾ |
| | | if (close) { |
| | | if (!this.hook(node) || config.ignoreTags[node.name]) { |
| | | // éè¿ base æ ç¾è®¾ç½®ä¸»åå |
| | | if (node.name === 'base' && !this.options.domain) { |
| | | this.options.domain = attrs.href |
| | | } /* #ifndef APP-PLUS-NVUE */ else if (node.name === 'source' && parent && (parent.name === 'video' || parent.name === 'audio') && attrs.src) { |
| | | // 设置 source æ ç¾ï¼ä»
ç¶èç¹ä¸º video æ audio æ¶ææï¼ |
| | | parent.src.push(attrs.src) |
| | | } /* #endif */ |
| | | return |
| | | } |
| | | |
| | | // è§£æ style |
| | | const styleObj = this.parseStyle(node) |
| | | |
| | | // å¤çå¾ç |
| | | if (node.name === 'img') { |
| | | if (attrs.src) { |
| | | // æ è®° webp |
| | | if (attrs.src.includes('webp')) { |
| | | node.webp = 'T' |
| | | } |
| | | // data url å¾çå¦ææ²¡æè®¾ç½® original-src é»è®¤ä¸ºä¸å¯é¢è§çå°å¾ç |
| | | if (attrs.src.includes('data:') && this.options.previewImg !== 'all' && !attrs['original-src']) { |
| | | attrs.ignore = 'T' |
| | | } |
| | | if (!attrs.ignore || node.webp || attrs.src.includes('cloud://')) { |
| | | for (let i = this.stack.length; i--;) { |
| | | const item = this.stack[i] |
| | | if (item.name === 'a') { |
| | | node.a = item.attrs |
| | | } |
| | | if (item.name === 'table' && !node.webp && !attrs.src.includes('cloud://')) { |
| | | if (!styleObj.display || styleObj.display.includes('inline')) { |
| | | node.t = 'inline-block' |
| | | } else { |
| | | node.t = styleObj.display |
| | | } |
| | | styleObj.display = undefined |
| | | } |
| | | // #ifndef H5 || APP-PLUS |
| | | const style = item.attrs.style || '' |
| | | if (style.includes('flex:') && !style.includes('flex:0') && !style.includes('flex: 0') && (!styleObj.width || parseInt(styleObj.width) > 100)) { |
| | | styleObj.width = '100% !important' |
| | | styleObj.height = '' |
| | | for (let j = i + 1; j < this.stack.length; j++) { |
| | | this.stack[j].attrs.style = (this.stack[j].attrs.style || '').replace('inline-', '') |
| | | } |
| | | } else if (style.includes('flex') && styleObj.width === '100%') { |
| | | for (let j = i + 1; j < this.stack.length; j++) { |
| | | const style = this.stack[j].attrs.style || '' |
| | | if (!style.includes(';width') && !style.includes(' width') && style.indexOf('width') !== 0) { |
| | | styleObj.width = '' |
| | | break |
| | | } |
| | | } |
| | | } else if (style.includes('inline-block')) { |
| | | if (styleObj.width && styleObj.width[styleObj.width.length - 1] === '%') { |
| | | item.attrs.style += ';max-width:' + styleObj.width |
| | | styleObj.width = '' |
| | | } else { |
| | | item.attrs.style += ';max-width:100%' |
| | | } |
| | | } |
| | | // #endif |
| | | item.c = 1 |
| | | } |
| | | attrs.i = this.imgList.length.toString() |
| | | let src = attrs['original-src'] || attrs.src |
| | | // #ifndef H5 || MP-ALIPAY || APP-PLUS || MP-360 |
| | | if (this.imgList.includes(src)) { |
| | | // 妿æéå¤ç龿¥å对ååè¿è¡éæºå¤§å°å忢é¿å
é¢è§æ¶éä½ |
| | | let i = src.indexOf('://') |
| | | if (i !== -1) { |
| | | i += 3 |
| | | let newSrc = src.substr(0, i) |
| | | for (; i < src.length; i++) { |
| | | if (src[i] === '/') break |
| | | newSrc += Math.random() > 0.5 ? src[i].toUpperCase() : src[i] |
| | | } |
| | | newSrc += src.substr(i) |
| | | src = newSrc |
| | | } |
| | | } |
| | | // #endif |
| | | this.imgList.push(src) |
| | | if (!node.t) { |
| | | this.imgList._unloadimgs += 1 |
| | | } |
| | | // #ifdef H5 || APP-PLUS |
| | | if (this.options.lazyLoad) { |
| | | attrs['data-src'] = attrs.src |
| | | attrs.src = undefined |
| | | } |
| | | // #endif |
| | | } |
| | | } |
| | | if (styleObj.display === 'inline') { |
| | | styleObj.display = '' |
| | | } |
| | | // #ifndef APP-PLUS-NVUE |
| | | if (attrs.ignore) { |
| | | styleObj['max-width'] = styleObj['max-width'] || '100%' |
| | | attrs.style += ';-webkit-touch-callout:none' |
| | | } |
| | | // #endif |
| | | // 设置ç宽度è¶
åºå±å¹ï¼ä¸ºé¿å
åå½¢ï¼é«åº¦è½¬ä¸ºèªå¨ |
| | | if (parseInt(styleObj.width) > windowWidth) { |
| | | styleObj.height = undefined |
| | | } |
| | | // è®°å½æ¯å¦è®¾ç½®äºå®½é« |
| | | if (!isNaN(parseInt(styleObj.width))) { |
| | | node.w = 'T' |
| | | } |
| | | if (!isNaN(parseInt(styleObj.height)) && (!styleObj.height.includes('%') || (parent && (parent.attrs.style || '').includes('height')))) { |
| | | node.h = 'T' |
| | | } |
| | | if (node.w && node.h && styleObj['object-fit']) { |
| | | if (styleObj['object-fit'] === 'contain') { |
| | | node.m = 'aspectFit' |
| | | } else if (styleObj['object-fit'] === 'cover') { |
| | | node.m = 'aspectFill' |
| | | } |
| | | } |
| | | } else if (node.name === 'svg') { |
| | | siblings.push(node) |
| | | this.stack.push(node) |
| | | this.popNode() |
| | | return |
| | | } |
| | | for (const key in styleObj) { |
| | | if (styleObj[key]) { |
| | | attrs.style += `;${key}:${styleObj[key].replace(' !important', '')}` |
| | | } |
| | | } |
| | | attrs.style = attrs.style.substr(1) || undefined |
| | | // #ifdef (MP-WEIXIN || MP-QQ) && VUE3 |
| | | if (!attrs.style) { |
| | | delete attrs.style |
| | | } |
| | | // #endif |
| | | } else { |
| | | if ((node.name === 'pre' || ((attrs.style || '').includes('white-space') && attrs.style.includes('pre'))) && this.pre !== 2) { |
| | | this.pre = node.pre = 1 |
| | | } |
| | | node.children = [] |
| | | this.stack.push(node) |
| | | } |
| | | |
| | | // å å
¥èç¹æ |
| | | siblings.push(node) |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°æ ç¾ç»æ |
| | | * @param {String} name æ ç¾å |
| | | * @private |
| | | */ |
| | | Parser.prototype.onCloseTag = function (name) { |
| | | // 便¬¡åºæ å°å¹é
ä¸ºæ¢ |
| | | name = this.xml ? name : name.toLowerCase() |
| | | let i |
| | | for (i = this.stack.length; i--;) { |
| | | if (this.stack[i].name === name) break |
| | | } |
| | | if (i !== -1) { |
| | | while (this.stack.length > i) { |
| | | this.popNode() |
| | | } |
| | | } else if (name === 'p' || name === 'br') { |
| | | const siblings = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes |
| | | siblings.push({ |
| | | name, |
| | | attrs: { |
| | | class: tagSelector[name] || '', |
| | | style: this.tagStyle[name] || '' |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description å¤çæ ç¾åºæ |
| | | * @private |
| | | */ |
| | | Parser.prototype.popNode = function () { |
| | | const node = this.stack.pop() |
| | | let attrs = node.attrs |
| | | const children = node.children |
| | | const parent = this.stack[this.stack.length - 1] |
| | | const siblings = parent ? parent.children : this.nodes |
| | | |
| | | if (!this.hook(node) || config.ignoreTags[node.name]) { |
| | | // è·åæ é¢ |
| | | if (node.name === 'title' && children.length && children[0].type === 'text' && this.options.setTitle) { |
| | | uni.setNavigationBarTitle({ |
| | | title: children[0].text |
| | | }) |
| | | } |
| | | siblings.pop() |
| | | return |
| | | } |
| | | |
| | | if (node.pre && this.pre !== 2) { |
| | | // æ¯å¦å并空ç½ç¬¦æ è¯ |
| | | this.pre = node.pre = undefined |
| | | for (let i = this.stack.length; i--;) { |
| | | if (this.stack[i].pre) { |
| | | this.pre = 1 |
| | | } |
| | | } |
| | | } |
| | | |
| | | const styleObj = {} |
| | | |
| | | // è½¬æ¢ svg |
| | | if (node.name === 'svg') { |
| | | if (this.xml > 1) { |
| | | // å¤å± svg åµå¥ |
| | | this.xml-- |
| | | return |
| | | } |
| | | // #ifdef APP-PLUS-NVUE |
| | | (function traversal (node) { |
| | | if (node.name) { |
| | | // è°æ´ svg ç大å°å |
| | | node.name = config.svgDict[node.name] || node.name |
| | | for (const item in node.attrs) { |
| | | if (config.svgDict[item]) { |
| | | node.attrs[config.svgDict[item]] = node.attrs[item] |
| | | node.attrs[item] = undefined |
| | | } |
| | | } |
| | | for (let i = 0; i < (node.children || []).length; i++) { |
| | | traversal(node.children[i]) |
| | | } |
| | | } |
| | | })(node) |
| | | // #endif |
| | | // #ifndef APP-PLUS-NVUE |
| | | let src = '' |
| | | const style = attrs.style |
| | | attrs.style = '' |
| | | attrs.xmlns = 'http://www.w3.org/2000/svg'; |
| | | (function traversal (node) { |
| | | if (node.type === 'text') { |
| | | src += node.text |
| | | return |
| | | } |
| | | const name = config.svgDict[node.name] || node.name |
| | | if (name === 'foreignObject') { |
| | | for (const child of (node.children || [])) { |
| | | if (child.attrs && !child.attrs.xmlns) { |
| | | child.attrs.xmlns = 'http://www.w3.org/1999/xhtml' |
| | | break |
| | | } |
| | | } |
| | | } |
| | | src += '<' + name |
| | | for (const item in node.attrs) { |
| | | const val = node.attrs[item] |
| | | if (val) { |
| | | src += ` ${config.svgDict[item] || item}="${val.replace(/"/g, '')}"` |
| | | } |
| | | } |
| | | if (!node.children) { |
| | | src += '/>' |
| | | } else { |
| | | src += '>' |
| | | for (let i = 0; i < node.children.length; i++) { |
| | | traversal(node.children[i]) |
| | | } |
| | | src += '</' + name + '>' |
| | | } |
| | | })(node) |
| | | node.name = 'img' |
| | | node.attrs = { |
| | | src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'), |
| | | style, |
| | | ignore: 'T' |
| | | } |
| | | node.children = undefined |
| | | // #endif |
| | | this.xml = false |
| | | config.ignoreTags.style = true |
| | | return |
| | | } |
| | | |
| | | // #ifndef APP-PLUS-NVUE |
| | | // è½¬æ¢ align 屿§ |
| | | if (attrs.align) { |
| | | if (node.name === 'table') { |
| | | if (attrs.align === 'center') { |
| | | styleObj['margin-inline-start'] = styleObj['margin-inline-end'] = 'auto' |
| | | } else { |
| | | styleObj.float = attrs.align |
| | | } |
| | | } else { |
| | | styleObj['text-align'] = attrs.align |
| | | } |
| | | attrs.align = undefined |
| | | } |
| | | |
| | | // è½¬æ¢ dir 屿§ |
| | | if (attrs.dir) { |
| | | styleObj.direction = attrs.dir |
| | | attrs.dir = undefined |
| | | } |
| | | |
| | | // è½¬æ¢ font æ ç¾ç屿§ |
| | | if (node.name === 'font') { |
| | | if (attrs.color) { |
| | | styleObj.color = attrs.color |
| | | attrs.color = undefined |
| | | } |
| | | if (attrs.face) { |
| | | styleObj['font-family'] = attrs.face |
| | | attrs.face = undefined |
| | | } |
| | | if (attrs.size) { |
| | | let size = parseInt(attrs.size) |
| | | if (!isNaN(size)) { |
| | | if (size < 1) { |
| | | size = 1 |
| | | } else if (size > 7) { |
| | | size = 7 |
| | | } |
| | | styleObj['font-size'] = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', 'xxx-large'][size - 1] |
| | | } |
| | | attrs.size = undefined |
| | | } |
| | | } |
| | | // #endif |
| | | |
| | | // ä¸äºç¼è¾å¨çèªå¸¦ class |
| | | if ((attrs.class || '').includes('align-center')) { |
| | | styleObj['text-align'] = 'center' |
| | | } |
| | | |
| | | Object.assign(styleObj, this.parseStyle(node)) |
| | | |
| | | if (node.name !== 'table' && parseInt(styleObj.width) > windowWidth) { |
| | | styleObj['max-width'] = '100%' |
| | | styleObj['box-sizing'] = 'border-box' |
| | | } |
| | | |
| | | // #ifndef APP-PLUS-NVUE |
| | | if (config.blockTags[node.name]) { |
| | | node.name = 'div' |
| | | } else if (!config.trustTags[node.name] && !this.xml) { |
| | | // æªç¥æ ç¾è½¬ä¸º spanï¼é¿å
æ æ³æ¾ç¤º |
| | | node.name = 'span' |
| | | } |
| | | |
| | | if (node.name === 'a' || node.name === 'ad' |
| | | // #ifdef H5 || APP-PLUS |
| | | || node.name === 'iframe' // eslint-disable-line |
| | | // #endif |
| | | ) { |
| | | this.expose() |
| | | } else if (node.name === 'video') { |
| | | if ((styleObj.height || '').includes('auto')) { |
| | | styleObj.height = undefined |
| | | } |
| | | /* #ifdef APP-PLUS */ |
| | | let str = '<video style="width:100%;height:100%"' |
| | | for (const item in attrs) { |
| | | if (attrs[item]) { |
| | | str += ' ' + item + '="' + attrs[item] + '"' |
| | | } |
| | | } |
| | | if (this.options.pauseVideo) { |
| | | str += ' onplay="this.dispatchEvent(new CustomEvent(\'vplay\',{bubbles:!0}));for(var e=document.getElementsByTagName(\'video\'),t=0;t<e.length;t++)e[t]!=this&&e[t].pause()"' |
| | | } |
| | | str += '>' |
| | | for (let i = 0; i < node.src.length; i++) { |
| | | str += '<source src="' + node.src[i] + '">' |
| | | } |
| | | str += '</video>' |
| | | node.html = str |
| | | /* #endif */ |
| | | } else if ((node.name === 'ul' || node.name === 'ol') && node.c) { |
| | | // å表å¤ç |
| | | const types = { |
| | | a: 'lower-alpha', |
| | | A: 'upper-alpha', |
| | | i: 'lower-roman', |
| | | I: 'upper-roman' |
| | | } |
| | | if (types[attrs.type]) { |
| | | attrs.style += ';list-style-type:' + types[attrs.type] |
| | | attrs.type = undefined |
| | | } |
| | | for (let i = children.length; i--;) { |
| | | if (children[i].name === 'li') { |
| | | children[i].c = 1 |
| | | } |
| | | } |
| | | } else if (node.name === 'table') { |
| | | // è¡¨æ ¼å¤ç |
| | | // cellpaddingãcellspacingãborder è¿å 个常ç¨è¡¨æ ¼å±æ§éè¦éè¿è½¬æ¢å®ç° |
| | | let padding = parseFloat(attrs.cellpadding) |
| | | let spacing = parseFloat(attrs.cellspacing) |
| | | const border = parseFloat(attrs.border) |
| | | const bordercolor = styleObj['border-color'] |
| | | const borderstyle = styleObj['border-style'] |
| | | if (node.c) { |
| | | // padding å spacing é»è®¤ 2 |
| | | if (isNaN(padding)) { |
| | | padding = 2 |
| | | } |
| | | if (isNaN(spacing)) { |
| | | spacing = 2 |
| | | } |
| | | } |
| | | if (border) { |
| | | attrs.style += `;border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'}` |
| | | } |
| | | if (node.flag && node.c) { |
| | | // æ colspan æ rowspan ä¸å«æé¾æ¥çè¡¨æ ¼éè¿ grid å¸å±å®ç° |
| | | styleObj.display = 'grid' |
| | | if (styleObj['border-collapse'] === 'collapse') { |
| | | styleObj['border-collapse'] = undefined |
| | | spacing = 0 |
| | | } |
| | | if (spacing) { |
| | | styleObj['grid-gap'] = spacing + 'px' |
| | | styleObj.padding = spacing + 'px' |
| | | } else if (border) { |
| | | // æ é´éçæ
åµä¸é¿å
è¾¹æ¡éå |
| | | attrs.style += ';border-left:0;border-top:0' |
| | | } |
| | | |
| | | const width = [] // è¡¨æ ¼çå宽 |
| | | const trList = [] // tr å表 |
| | | const cells = [] // ä¿åæ°çåå
æ ¼ |
| | | const map = {}; // 被åå¹¶åå
æ ¼å ç¨çæ ¼å |
| | | |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].name === 'tr') { |
| | | trList.push(nodes[i]) |
| | | } else if (nodes[i].name === 'colgroup') { |
| | | let colI = 1 |
| | | for (const col of (nodes[i].children || [])) { |
| | | if (col.name === 'col') { |
| | | const style = col.attrs.style || '' |
| | | const start = style.indexOf('width') ? style.indexOf(';width') : 0 |
| | | // æååºå®½åº¦ |
| | | if (start !== -1) { |
| | | let end = style.indexOf(';', start + 6) |
| | | if (end === -1) { |
| | | end = style.length |
| | | } |
| | | width[colI] = style.substring(start ? start + 7 : 6, end) |
| | | } |
| | | colI += 1 |
| | | } |
| | | } |
| | | } else { |
| | | traversal(nodes[i].children || []) |
| | | } |
| | | } |
| | | })(children) |
| | | |
| | | for (let row = 1; row <= trList.length; row++) { |
| | | let col = 1 |
| | | for (let j = 0; j < trList[row - 1].children.length; j++) { |
| | | const td = trList[row - 1].children[j] |
| | | if (td.name === 'td' || td.name === 'th') { |
| | | // è¿ä¸ªæ ¼å被ä¸é¢çåå
æ ¼å ç¨ï¼ååå·++ |
| | | while (map[row + '.' + col]) { |
| | | col++ |
| | | } |
| | | let style = td.attrs.style || '' |
| | | let start = style.indexOf('width') ? style.indexOf(';width') : 0 |
| | | // æååº td ç宽度 |
| | | if (start !== -1) { |
| | | let end = style.indexOf(';', start + 6) |
| | | if (end === -1) { |
| | | end = style.length |
| | | } |
| | | if (!td.attrs.colspan) { |
| | | width[col] = style.substring(start ? start + 7 : 6, end) |
| | | } |
| | | style = style.substr(0, start) + style.substr(end) |
| | | } |
| | | // 设置ç«ç´å¯¹é½ |
| | | style += ';display:flex' |
| | | start = style.indexOf('vertical-align') |
| | | if (start !== -1) { |
| | | const val = style.substr(start + 15, 10) |
| | | if (val.includes('middle')) { |
| | | style += ';align-items:center' |
| | | } else if (val.includes('bottom')) { |
| | | style += ';align-items:flex-end' |
| | | } |
| | | } else { |
| | | style += ';align-items:center' |
| | | } |
| | | // è®¾ç½®æ°´å¹³å¯¹é½ |
| | | start = style.indexOf('text-align') |
| | | if (start !== -1) { |
| | | const val = style.substr(start + 11, 10) |
| | | if (val.includes('center')) { |
| | | style += ';justify-content: center' |
| | | } else if (val.includes('right')) { |
| | | style += ';justify-content: right' |
| | | } |
| | | } |
| | | style = (border ? `;border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'}` + (spacing ? '' : ';border-right:0;border-bottom:0') : '') + (padding ? `;padding:${padding}px` : '') + ';' + style |
| | | // å¤çååå¹¶ |
| | | if (td.attrs.colspan) { |
| | | style += `;grid-column-start:${col};grid-column-end:${col + parseInt(td.attrs.colspan)}` |
| | | if (!td.attrs.rowspan) { |
| | | style += `;grid-row-start:${row};grid-row-end:${row + 1}` |
| | | } |
| | | col += parseInt(td.attrs.colspan) - 1 |
| | | } |
| | | // å¤çè¡åå¹¶ |
| | | if (td.attrs.rowspan) { |
| | | style += `;grid-row-start:${row};grid-row-end:${row + parseInt(td.attrs.rowspan)}` |
| | | if (!td.attrs.colspan) { |
| | | style += `;grid-column-start:${col};grid-column-end:${col + 1}` |
| | | } |
| | | // è®°å½ä¸æ¹åå
æ ¼è¢«å ç¨ |
| | | for (let rowspan = 1; rowspan < td.attrs.rowspan; rowspan++) { |
| | | for (let colspan = 0; colspan < (td.attrs.colspan || 1); colspan++) { |
| | | map[(row + rowspan) + '.' + (col - colspan)] = 1 |
| | | } |
| | | } |
| | | } |
| | | if (style) { |
| | | td.attrs.style = style |
| | | } |
| | | cells.push(td) |
| | | col++ |
| | | } |
| | | } |
| | | if (row === 1) { |
| | | let temp = '' |
| | | for (let i = 1; i < col; i++) { |
| | | temp += (width[i] ? width[i] : 'auto') + ' ' |
| | | } |
| | | styleObj['grid-template-columns'] = temp |
| | | } |
| | | } |
| | | node.children = cells |
| | | } else { |
| | | // 没æä½¿ç¨åå¹¶åå
æ ¼çè¡¨æ ¼éè¿ table å¸å±å®ç° |
| | | if (node.c) { |
| | | styleObj.display = 'table' |
| | | } |
| | | if (!isNaN(spacing)) { |
| | | styleObj['border-spacing'] = spacing + 'px' |
| | | } |
| | | if (border || padding) { |
| | | // éå |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | const td = nodes[i] |
| | | if (td.name === 'th' || td.name === 'td') { |
| | | if (border) { |
| | | td.attrs.style = `border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'};${td.attrs.style || ''}` |
| | | } |
| | | if (padding) { |
| | | td.attrs.style = `padding:${padding}px;${td.attrs.style || ''}` |
| | | } |
| | | } else if (td.children) { |
| | | traversal(td.children) |
| | | } |
| | | } |
| | | })(children) |
| | | } |
| | | } |
| | | // ç»è¡¨æ ¼æ·»å ä¸ä¸ªåç¬çæ¨ªåæ»å¨å± |
| | | if (this.options.scrollTable && !(attrs.style || '').includes('inline')) { |
| | | const table = Object.assign({}, node) |
| | | node.name = 'div' |
| | | node.attrs = { |
| | | style: 'overflow:auto' |
| | | } |
| | | node.children = [table] |
| | | attrs = table.attrs |
| | | } |
| | | } else if ((node.name === 'tbody' || node.name === 'tr') && node.flag && node.c) { |
| | | node.flag = undefined; |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].name === 'td') { |
| | | // é¢è²æ ·å¼è®¾ç½®ç»åå
æ ¼é¿å
丢失 |
| | | for (const style of ['color', 'background', 'background-color']) { |
| | | if (styleObj[style]) { |
| | | nodes[i].attrs.style = style + ':' + styleObj[style] + ';' + (nodes[i].attrs.style || '') |
| | | } |
| | | } |
| | | } else { |
| | | traversal(nodes[i].children || []) |
| | | } |
| | | } |
| | | })(children) |
| | | } else if ((node.name === 'td' || node.name === 'th') && (attrs.colspan || attrs.rowspan)) { |
| | | for (let i = this.stack.length; i--;) { |
| | | if (this.stack[i].name === 'table' || this.stack[i].name === 'tbody' || this.stack[i].name === 'tr') { |
| | | this.stack[i].flag = 1 // æç¤ºå«æåå¹¶åå
æ ¼ |
| | | } |
| | | } |
| | | } else if (node.name === 'ruby') { |
| | | // è½¬æ¢ ruby |
| | | node.name = 'span' |
| | | for (let i = 0; i < children.length - 1; i++) { |
| | | if (children[i].type === 'text' && children[i + 1].name === 'rt') { |
| | | children[i] = { |
| | | name: 'div', |
| | | attrs: { |
| | | style: 'display:inline-block;text-align:center' |
| | | }, |
| | | children: [{ |
| | | name: 'div', |
| | | attrs: { |
| | | style: 'font-size:50%;' + (children[i + 1].attrs.style || '') |
| | | }, |
| | | children: children[i + 1].children |
| | | }, children[i]] |
| | | } |
| | | children.splice(i + 1, 1) |
| | | } |
| | | } |
| | | } else if (node.c) { |
| | | (function traversal (node) { |
| | | node.c = 2 |
| | | for (let i = node.children.length; i--;) { |
| | | const child = node.children[i] |
| | | // #ifdef (MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE3 |
| | | if (child.name && (config.inlineTags[child.name] || ((child.attrs.style || '').includes('inline') && child.children)) && !child.c) { |
| | | traversal(child) |
| | | } |
| | | // #endif |
| | | if (!child.c || child.name === 'table') { |
| | | node.c = 1 |
| | | } |
| | | } |
| | | })(node) |
| | | } |
| | | |
| | | if ((styleObj.display || '').includes('flex') && !node.c) { |
| | | for (let i = children.length; i--;) { |
| | | const item = children[i] |
| | | if (item.f) { |
| | | item.attrs.style = (item.attrs.style || '') + item.f |
| | | item.f = undefined |
| | | } |
| | | } |
| | | } |
| | | // flex å¸å±æ¶é¨åæ ·å¼éè¦æåå° rich-text å¤å± |
| | | const flex = parent && ((parent.attrs.style || '').includes('flex') || (parent.attrs.style || '').includes('grid')) |
| | | // #ifdef MP-WEIXIN |
| | | // æ£æ¥åºç¡åºçæ¬ virtualHost æ¯å¦å¯ç¨ |
| | | && !(node.c && wx.getNFCAdapter) // eslint-disable-line |
| | | // #endif |
| | | // #ifndef MP-WEIXIN || MP-QQ || MP-BAIDU || MP-TOUTIAO |
| | | && !node.c // eslint-disable-line |
| | | // #endif |
| | | if (flex) { |
| | | node.f = ';max-width:100%' |
| | | } |
| | | |
| | | if (children.length >= 50 && node.c && !(styleObj.display || '').includes('flex')) { |
| | | mergeNodes(children) |
| | | } |
| | | // #endif |
| | | |
| | | for (const key in styleObj) { |
| | | if (styleObj[key]) { |
| | | const val = `;${key}:${styleObj[key].replace(' !important', '')}` |
| | | /* #ifndef APP-PLUS-NVUE */ |
| | | if (flex && ((key.includes('flex') && key !== 'flex-direction') || key === 'align-self' || key.includes('grid') || styleObj[key][0] === '-' || (key.includes('width') && val.includes('%')))) { |
| | | node.f += val |
| | | if (key === 'width') { |
| | | attrs.style += ';width:100%' |
| | | } |
| | | } else /* #endif */ { |
| | | attrs.style += val |
| | | } |
| | | } |
| | | } |
| | | attrs.style = attrs.style.substr(1) || undefined |
| | | // #ifdef (MP-WEIXIN || MP-QQ) && VUE3 |
| | | for (const key in attrs) { |
| | | if (!attrs[key]) { |
| | | delete attrs[key] |
| | | } |
| | | } |
| | | // #endif |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°ææ¬ |
| | | * @param {String} text ææ¬å
容 |
| | | */ |
| | | Parser.prototype.onText = function (text) { |
| | | if (!this.pre) { |
| | | // å并空ç½ç¬¦ |
| | | let trim = '' |
| | | let flag |
| | | for (let i = 0, len = text.length; i < len; i++) { |
| | | if (!blankChar[text[i]]) { |
| | | trim += text[i] |
| | | } else { |
| | | if (trim[trim.length - 1] !== ' ') { |
| | | trim += ' ' |
| | | } |
| | | if (text[i] === '\n' && !flag) { |
| | | flag = true |
| | | } |
| | | } |
| | | } |
| | | // å»é¤å«ææ¢è¡ç¬¦ç空串 |
| | | if (trim === ' ') { |
| | | if (flag) return |
| | | // #ifdef VUE3 |
| | | else { |
| | | const parent = this.stack[this.stack.length - 1] |
| | | if (parent && parent.name[0] === 't') return |
| | | } |
| | | // #endif |
| | | } |
| | | text = trim |
| | | } |
| | | const node = Object.create(null) |
| | | node.type = 'text' |
| | | // #ifdef (MP-BAIDU || MP-ALIPAY || MP-TOUTIAO) && VUE3 |
| | | node.attrs = {} |
| | | // #endif |
| | | node.text = decodeEntity(text) |
| | | if (this.hook(node)) { |
| | | // #ifdef MP-WEIXIN |
| | | if (this.options.selectable === 'force' && system.includes('iOS') && !uni.canIUse('rich-text.user-select')) { |
| | | this.expose() |
| | | } |
| | | // #endif |
| | | const siblings = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes |
| | | siblings.push(node) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description html è¯æ³åæå¨ |
| | | * @param {Object} handler é«å±å¤çå¨ |
| | | */ |
| | | function Lexer (handler) { |
| | | this.handler = handler |
| | | } |
| | | |
| | | /** |
| | | * @description æ§è¡è§£æ |
| | | * @param {String} content è¦è§£æçææ¬ |
| | | */ |
| | | Lexer.prototype.parse = function (content) { |
| | | this.content = content || '' |
| | | this.i = 0 // æ è®°è§£æä½ç½® |
| | | this.start = 0 // æ è®°ä¸ä¸ªåè¯çå¼å§ä½ç½® |
| | | this.state = this.text // å½åç¶æ |
| | | for (let len = this.content.length; this.i !== -1 && this.i < len;) { |
| | | this.state() |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description æ£æ¥æ ç¾æ¯å¦éå |
| | | * @param {String} method 妿éåè¦è¿è¡çæä½ |
| | | * @returns {Boolean} æ¯å¦éå |
| | | * @private |
| | | */ |
| | | Lexer.prototype.checkClose = function (method) { |
| | | const selfClose = this.content[this.i] === '/' |
| | | if (this.content[this.i] === '>' || (selfClose && this.content[this.i + 1] === '>')) { |
| | | if (method) { |
| | | this.handler[method](this.content.substring(this.start, this.i)) |
| | | } |
| | | this.i += selfClose ? 2 : 1 |
| | | this.start = this.i |
| | | this.handler.onOpenTag(selfClose) |
| | | if (this.handler.tagName === 'script') { |
| | | this.i = this.content.indexOf('</', this.i) |
| | | if (this.i !== -1) { |
| | | this.i += 2 |
| | | this.start = this.i |
| | | } |
| | | this.state = this.endTag |
| | | } else { |
| | | this.state = this.text |
| | | } |
| | | return true |
| | | } |
| | | return false |
| | | } |
| | | |
| | | /** |
| | | * @description ææ¬ç¶æ |
| | | * @private |
| | | */ |
| | | Lexer.prototype.text = function () { |
| | | this.i = this.content.indexOf('<', this.i) // æ¥æ¾æè¿çæ ç¾ |
| | | if (this.i === -1) { |
| | | // æ²¡ææ ç¾äº |
| | | if (this.start < this.content.length) { |
| | | this.handler.onText(this.content.substring(this.start, this.content.length)) |
| | | } |
| | | return |
| | | } |
| | | const c = this.content[this.i + 1] |
| | | if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) { |
| | | // æ ç¾å¼å¤´ |
| | | if (this.start !== this.i) { |
| | | this.handler.onText(this.content.substring(this.start, this.i)) |
| | | } |
| | | this.start = ++this.i |
| | | this.state = this.tagName |
| | | } else if (c === '/' || c === '!' || c === '?') { |
| | | if (this.start !== this.i) { |
| | | this.handler.onText(this.content.substring(this.start, this.i)) |
| | | } |
| | | const next = this.content[this.i + 2] |
| | | if (c === '/' && ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z'))) { |
| | | // æ ç¾ç»å°¾ |
| | | this.i += 2 |
| | | this.start = this.i |
| | | this.state = this.endTag |
| | | return |
| | | } |
| | | // å¤ç注é |
| | | let end = '-->' |
| | | if (c !== '!' || this.content[this.i + 2] !== '-' || this.content[this.i + 3] !== '-') { |
| | | end = '>' |
| | | } |
| | | this.i = this.content.indexOf(end, this.i) |
| | | if (this.i !== -1) { |
| | | this.i += end.length |
| | | this.start = this.i |
| | | } |
| | | } else { |
| | | this.i++ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description æ ç¾åç¶æ |
| | | * @private |
| | | */ |
| | | Lexer.prototype.tagName = function () { |
| | | if (blankChar[this.content[this.i]]) { |
| | | // è§£æå°æ ç¾å |
| | | this.handler.onTagName(this.content.substring(this.start, this.i)) |
| | | while (blankChar[this.content[++this.i]]); |
| | | if (this.i < this.content.length && !this.checkClose()) { |
| | | this.start = this.i |
| | | this.state = this.attrName |
| | | } |
| | | } else if (!this.checkClose('onTagName')) { |
| | | this.i++ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 屿§åç¶æ |
| | | * @private |
| | | */ |
| | | Lexer.prototype.attrName = function () { |
| | | let c = this.content[this.i] |
| | | if (blankChar[c] || c === '=') { |
| | | // è§£æå°å±æ§å |
| | | this.handler.onAttrName(this.content.substring(this.start, this.i)) |
| | | let needVal = c === '=' |
| | | const len = this.content.length |
| | | while (++this.i < len) { |
| | | c = this.content[this.i] |
| | | if (!blankChar[c]) { |
| | | if (this.checkClose()) return |
| | | if (needVal) { |
| | | // çå·åéå°ç¬¬ä¸ä¸ªé空å符 |
| | | this.start = this.i |
| | | this.state = this.attrVal |
| | | return |
| | | } |
| | | if (this.content[this.i] === '=') { |
| | | needVal = true |
| | | } else { |
| | | this.start = this.i |
| | | this.state = this.attrName |
| | | return |
| | | } |
| | | } |
| | | } |
| | | } else if (!this.checkClose('onAttrName')) { |
| | | this.i++ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 屿§å¼ç¶æ |
| | | * @private |
| | | */ |
| | | Lexer.prototype.attrVal = function () { |
| | | const c = this.content[this.i] |
| | | const len = this.content.length |
| | | if (c === '"' || c === "'") { |
| | | // æåå·ç屿§ |
| | | this.start = ++this.i |
| | | this.i = this.content.indexOf(c, this.i) |
| | | if (this.i === -1) return |
| | | this.handler.onAttrVal(this.content.substring(this.start, this.i)) |
| | | } else { |
| | | // 没æåå·ç屿§ |
| | | for (; this.i < len; this.i++) { |
| | | if (blankChar[this.content[this.i]]) { |
| | | this.handler.onAttrVal(this.content.substring(this.start, this.i)) |
| | | break |
| | | } else if (this.checkClose('onAttrVal')) return |
| | | } |
| | | } |
| | | while (blankChar[this.content[++this.i]]); |
| | | if (this.i < len && !this.checkClose()) { |
| | | this.start = this.i |
| | | this.state = this.attrName |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description ç»ææ ç¾ç¶æ |
| | | * @returns {String} ç»æçæ ç¾å |
| | | * @private |
| | | */ |
| | | Lexer.prototype.endTag = function () { |
| | | const c = this.content[this.i] |
| | | if (blankChar[c] || c === '>' || c === '/') { |
| | | this.handler.onCloseTag(this.content.substring(this.start, this.i)) |
| | | if (c !== '>') { |
| | | this.i = this.content.indexOf('>', this.i) |
| | | if (this.i === -1) return |
| | | } |
| | | this.start = ++this.i |
| | | this.state = this.text |
| | | } else { |
| | | this.i++ |
| | | } |
| | | } |
| | | |
| | | export default Parser |
New file |
| | |
| | | "use strict";function t(t){for(var e=Object.create(null),n=t.attributes.length;n--;)e[t.attributes[n].name]=t.attributes[n].value;return e}function e(){a[1]&&(this.src=a[1],this.onerror=null),this.onclick=null,this.ontouchstart=null,uni.postMessage({data:{action:"onError",source:"img",attrs:t(this)}})}function n(){window.unloadimgs-=1,0===window.unloadimgs&&uni.postMessage({data:{action:"onReady"}})}function o(r,s,c){for(var d=0;d<r.length;d++)!function(d){var u=r[d],l=void 0;if(u.type&&"node"!==u.type)l=document.createTextNode(u.text.replace(/&/g,"&"));else{var g=u.name;"svg"===g&&(c="http://www.w3.org/2000/svg"),"html"!==g&&"body"!==g||(g="div"),l=c?document.createElementNS(c,g):document.createElement(g);for(var p in u.attrs)l.setAttribute(p,u.attrs[p]);if(u.children&&o(u.children,l,c),"img"===g){if(window.unloadimgs+=1,l.onload=n,l.onerror=n,!l.src&&l.getAttribute("data-src")&&(l.src=l.getAttribute("data-src")),u.attrs.ignore||(l.onclick=function(e){e.stopPropagation(),uni.postMessage({data:{action:"onImgTap",attrs:t(this)}})}),a[2]){var h=new Image;h.src=l.src,l.src=a[2],h.onload=function(){l.src=this.src},h.onerror=function(){l.onerror()}}l.onerror=e}else if("a"===g)l.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault();var n,o=this.getAttribute("href");o&&"#"===o[0]&&(n=(document.getElementById(o.substr(1))||{}).offsetTop),uni.postMessage({data:{action:"onLinkTap",attrs:t(this),offset:n}})},!0);else if("video"===g||"audio"===g)i.push(l),u.attrs.autoplay||u.attrs.controls||l.setAttribute("controls","true"),l.onplay=function(){if(uni.postMessage({data:{action:"onPlay"}}),a[3])for(var t=0;t<i.length;t++)i[t]!==this&&i[t].pause()},l.onerror=function(){uni.postMessage({data:{action:"onError",source:g,attrs:t(this)}})};else if("table"===g&&a[4]&&!l.style.cssText.includes("inline")){var f=document.createElement("div");f.style.overflow="auto",f.appendChild(l),l=f}else"svg"===g&&(c=void 0)}s.appendChild(l)}(d)}document.addEventListener("UniAppJSBridgeReady",function(){document.body.onclick=function(){return uni.postMessage({data:{action:"onClick"}})},uni.postMessage({data:{action:"onJSBridgeReady"}})});var a,i=[];window.setContent=function(t,e,n){var r=document.getElementById("content");e[0]&&(document.body.style.cssText=e[0]),e[5]||(r.style.userSelect="none"),n||(r.innerHTML="",i=[]),a=e,window.unloadimgs=0;var s=document.createDocumentFragment();o(t,s),r.appendChild(s);var c=r.scrollHeight;uni.postMessage({data:{action:"onLoad",height:c}}),window.unloadimgs||uni.postMessage({data:{action:"onReady",height:c}}),clearInterval(window.timer),window.timer=setInterval(function(){r.scrollHeight!==c&&(c=r.scrollHeight,uni.postMessage({data:{action:"onHeightChange",height:c}}))},350)},window.onunload=function(){clearInterval(window.timer)}; |
New file |
| | |
| | | !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).uni=n()}(this,(function(){"use strict";try{var e={};Object.defineProperty(e,"passive",{get:function(){!0}}),window.addEventListener("test-passive",null,e)}catch(e){}var n=Object.prototype.hasOwnProperty;function t(e,t){return n.call(e,t)}var i=[],a=function(e,n){var t={options:{timestamp:+new Date},name:e,arg:n};if(window.__dcloud_weex_postMessage||window.__dcloud_weex_){if("postMessage"===e){var a={data:[n]};return window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessage(a):window.__dcloud_weex_.postMessage(JSON.stringify(a))}var o={type:"WEB_INVOKE_APPSERVICE",args:{data:t,webviewIds:i}};window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessageToService(o):window.__dcloud_weex_.postMessageToService(JSON.stringify(o))}if(!window.plus)return window.parent.postMessage({type:"WEB_INVOKE_APPSERVICE",data:t,pageId:""},"*");if(0===i.length){var r=plus.webview.currentWebview();if(!r)throw new Error("plus.webview.currentWebview() is undefined");var d=r.parent(),s="";s=d?d.id:r.id,i.push(s)}if(plus.webview.getWebviewById("__uniapp__service"))plus.webview.postMessageToUniNView({type:"WEB_INVOKE_APPSERVICE",args:{data:t,webviewIds:i}},"__uniapp__service");else{var w=JSON.stringify(t);plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat("WEB_INVOKE_APPSERVICE",'",').concat(w,",").concat(JSON.stringify(i),");"))}},o={navigateTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("navigateTo",{url:encodeURI(n)})},navigateBack:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delta;a("navigateBack",{delta:parseInt(n)||1})},switchTab:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("switchTab",{url:encodeURI(n)})},reLaunch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("reLaunch",{url:encodeURI(n)})},redirectTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("redirectTo",{url:encodeURI(n)})},getEnv:function(e){window.plus?e({plus:!0}):e({h5:!0})},postMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a("postMessage",e.data||{})}},r=/uni-app/i.test(navigator.userAgent),d=/Html5Plus/i.test(navigator.userAgent),s=/complete|loaded|interactive/;var w=window.my&&navigator.userAgent.indexOf("AlipayClient")>-1;var u=window.swan&&window.swan.webView&&/swan/i.test(navigator.userAgent);var c=window.qq&&window.qq.miniProgram&&/QQ/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var g=window.tt&&window.tt.miniProgram&&/toutiaomicroapp/i.test(navigator.userAgent);var v=window.wx&&window.wx.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var p=window.qa&&/quickapp/i.test(navigator.userAgent);for(var l,_=function(){window.UniAppJSBridge=!0,document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady",{bubbles:!0,cancelable:!0}))},f=[function(e){if(r||d)return window.__dcloud_weex_postMessage||window.__dcloud_weex_?document.addEventListener("DOMContentLoaded",e):window.plus&&s.test(document.readyState)?setTimeout(e,0):document.addEventListener("plusready",e),o},function(e){if(v)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.wx.miniProgram},function(e){if(c)return window.QQJSBridge&&window.QQJSBridge.invoke?setTimeout(e,0):document.addEventListener("QQJSBridgeReady",e),window.qq.miniProgram},function(e){if(w){document.addEventListener("DOMContentLoaded",e);var n=window.my;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(u)return document.addEventListener("DOMContentLoaded",e),window.swan.webView},function(e){if(g)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(p){window.QaJSBridge&&window.QaJSBridge.invoke?setTimeout(e,0):document.addEventListener("QaJSBridgeReady",e);var n=window.qa;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){return document.addEventListener("DOMContentLoaded",e),o}],m=0;m<f.length&&!(l=f[m](_));m++);l||(l={});var E="undefined"!=typeof uni?uni:{};if(!E.navigateTo)for(var b in l)t(l,b)&&(E[b]=l[b]);return E.webView=l,E})); |
New file |
| | |
| | | <head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><style>body,html{width:100%;height:100%;overflow-x:scroll;overflow-y:hidden}body{margin:0}video{width:300px;height:225px}img{max-width:100%;-webkit-touch-callout:none}</style></head><body><div id="content" style="overflow:hidden"></div><script type="text/javascript" src="./js/uni.webview.min.js"></script><script type="text/javascript" src="./js/handler.js"></script></body> |
New file |
| | |
| | | # mp-html |
| | | |
| | | > ä¸ä¸ªå¼ºå¤§çå°ç¨åºå¯ææ¬ç»ä»¶ |
| | | |
| | |  |
| | |  |
| | | [](https://www.npmjs.com/package/mp-html) |
| | |  |
| | | [](https://coveralls.io/github/jin-yufeng/mp-html?branch=master) |
| | |  |
| | | [](https://standardjs.com) |
| | | |
| | | ## ð¢ æ¦åµ :id=overview |
| | | æ¾ç¤ºå¨æ *html* å¯ææ¬æ¯å¾å¤åºç¨å¿
è¦çéæ±ï¼å°ç¨åºå¹³å°ä¸æ¯æ *dom* æä½ä½¿å¾è¿æä¸ºä¸ä¸ªé¾é¢ï¼å
¶èªå¸¦ç *rich-text* ç»ä»¶æ¯æçæ ç¾å°ä¸å±è½ææäºä»¶ï¼é¾ä»¥å®é
åºç¨ãå æ¤å°±æäºè¿æ ·ä¸ä¸ªè½å¤ä¾¿æ·çå¨å°ç¨åºå¹³å°ä¸å¤ç坿æ¬çç»ä»¶ï¼è¿æ¯æä¸°å¯çæ©å±åè½ã |
| | | |
| | | ## ð ç¹æ§ :id=feature |
| | | - æ¯æå¨å¤ä¸ªä¸»æµçå°ç¨åºå¹³å°å *uni-app* ä¸ä½¿ç¨ |
| | | - æ¯æä¸°å¯çæ ç¾ï¼å
æ¬ *table*ã*video*ã*svg* çï¼ |
| | | - æ¯æä¸°å¯çäºä»¶ææï¼èªå¨é¢è§å¾çã龿¥å¤ççï¼ |
| | | - æ¯æè®¾ç½®å ä½å¾ï¼å è½½ä¸ãåºéæ¶ãé¢è§æ¶ï¼ |
| | | - æ¯æéç¹è·³è½¬ãé¿æå¤å¶ç丰å¯åè½ |
| | | - æ¯æå¤§é¨å *html* å®ä½ |
| | | - 丰å¯çæä»¶ï¼å
³é®è¯æç´¢ãå
容ç¼è¾ã*latex* å
¬å¼ çï¼ |
| | | - æçé«ãå®¹éæ§å¼ºä¸è½»éåï¼*â25KB*ï¼*9KB gzipped*ï¼ |
| | | |
| | | æ¥ç [åè½ä»ç»](overview/feature) äºè§£æ´å¤ |
| | | |
| | | ## ð ä½¿ç¨æ¡ä¾ :id=case |
| | | |
| | | | [宿¹ç¤ºä¾](https://github.com/jin-yufeng/mp-html-demo) | 欢ååå | å¤ä¹çæ´» | 飿³æ¥ | å¾®æ
| å¤å
¸æå¦åèé
读 | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | |  |  |  |  |  |  | |
| | | |
| | | | ç§å¦å¤ä¹ | [ç¨åºåææ¯ä¹æ
](https://github.com/fendoudebb/z-blog-wx) | å
¸å
¸å客 | ä¼ç§ç¬è®° | 365 å·é¢ | ååå
±äº«ä¹¦ | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | |  |  |  |  |  |  | |
| | | |
| | | | [ææ¯æº share](https://github.com/wangsrGit119/mini-blog-halo) | ä½ ç代ç åççæ£ | è°å¦ | å°è«åå°¼ | [æ¨¡çæ¼ç¤º](https://github.com/zhihuifanqiechaodan/miniprogram-template) | AIç¦å | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | |  |  |  |  |  |  | |
| | | |
| | | 以䏿åä¸åå
åï¼æ´å¤å¯è§ [ä½¿ç¨æ¡ä¾æ¶é](https://github.com/jin-yufeng/mp-html/issues/27)ï¼æ¬¢è¿æ·»å ï¼ |
| | | |
| | | ## ð èç³»ä¸æ¯æ :id=sponsor |
| | |  |
| | |  |
| | | |
| | | ## ð è®¸å¯ :id=license |
| | | [MIT License](https://github.com/jin-yufeng/mp-html/blob/master/LICENSE) |
| | | |
| | | ?> æ¨å¯ä»¥å
è´¹ç使ç¨ï¼å
æ¬åç¨ï¼ãå¤å¶æä¿®æ¹æ¬ç»ä»¶ |
| | | |
| | | !> å¨ç¨äºç产ç¯å¢åï¼å¡å¿
è¿è¡ä»ç»æµè¯ï¼ç±æ¬ç»ä»¶ *bug* 带æ¥çæå¤±æ¦ä¸è´è´£ |
| | | |
| | | --- |
| | | Powered by docsify |
New file |
| | |
| | |  |
| | | |
| | | # mp-html <small>2.5.1</small> |
| | | |
| | | > ä¸ä¸ªå¼ºå¤§çå°ç¨åºå¯ææ¬ç»ä»¶ |
| | | |
| | | - å
¨é¢çæ ç¾æ¯æ |
| | | - å¤å¹³å°ä½¿ç¨æ¯æ |
| | | - 丰å¯çéå åè½ |
| | | |
| | | [GitHub](https://github.com/jin-yufeng/mp-html) |
| | | [å¿«éå¼å§](/overview/quickstart) |
New file |
| | |
| | | - æ¦è§ |
| | | - [ð å¿«éå¼å§](overview/quickstart) |
| | | - [ð åè½ä»ç»](overview/feature) |
| | | |
| | | - åºæ¬ä½¿ç¨ |
| | | - [ð¨ 屿§](basic/prop) |
| | | - [ð« äºä»¶](basic/event) |
| | | |
| | | - è¿é¶ä½¿ç¨ |
| | | - [ð api](advanced/api) |
| | | - [ð æä»¶](advanced/plugin) |
| | | - [ð§ äºæ¬¡å¼å](advanced/develop) |
| | | |
| | | - çé®è§£ç |
| | | - [ð 常è§é®é¢](question/faq) |
| | | - [ð© åé¦](question/feedback) |
| | | - [ð è´¡ç®æå](question/contribution) |
| | | |
| | | - æ´æ°æ¥å¿ |
| | | - [ð æ´æ°æ¥å¿](changelog/changelog) |
New file |
| | |
| | | # ð api |
| | | ç»ä»¶çå®ä¾ä¸æè½½äºä¸äºå®ç¨ç *api* æ¹æ³å¯ä¾è°ç¨ |
| | | |
| | | ## è·åç»ä»¶å®ä¾ :id=getCompent |
| | | - *uni-app* |
| | | ```vue |
| | | <template> |
| | | <view> |
| | | <mp-html ref="article" /> |
| | | </view> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | onLoad () { |
| | | var ctx = this.$refs.article |
| | | } |
| | | } |
| | | </script> |
| | | ``` |
| | | |
| | | - æ¯ä»å®å°ç¨åº |
| | | éå¼å¯ [component2](https://opendocs.alipay.com/mini/framework/component-ref) æ¨¡å¼ |
| | | ```axml |
| | | <mp-html ref="article"> |
| | | ``` |
| | | ```javascript |
| | | Page({ |
| | | article (ctx) { |
| | | // è·å¾ç»ä»¶å®ä¾ |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | - å
¶ä»å°ç¨åºå¹³å° |
| | | ```wxml |
| | | <mp-html id="article" /> |
| | | ``` |
| | | ```javascript |
| | | Page({ |
| | | onLoad () { |
| | | // 微信ãQQãç¾åº¦ |
| | | var ctx = this.selectComponent('#article') |
| | | // å¤´æ¡ |
| | | this.selectComponent('#article', ctx => { |
| | | |
| | | }) |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | ## in |
| | | åè½ï¼å°éç¹è·³è½¬çèå´éå®å¨ä¸ä¸ª *scroll-view*ï¼éè¦å¼å¯çºµåæ»å¨ï¼å
|
| | | è¾å
¥å¼ï¼ |
| | | |
| | | | åæ°å | ç±»å | å¿
å¡« | é»è®¤å¼ | 说æ | |
| | | |:---:|:---:|:---:|:---:|---| |
| | | | page | object | æ¯ | - | scroll-view æ ç¾æå¨é¡µé¢å®ä¾ | |
| | | | selector | string | æ¯ | - | scroll-view æ ç¾ çéæ©å¨ | |
| | | | scrollTop | string | æ¯ | - | scroll-view æ ç¾ scrollTop 屿§ç»å®çåéå | |
| | | |
| | | è¿åå¼ï¼æ |
| | | 示ä¾ï¼ |
| | | ```wxml |
| | | <scroll-view id="scroll" style="height:300px" scroll-top="{{top}}" scroll-y scroll-with-animation> |
| | | <mp-html id="article" content="{{html}}" /> |
| | | </scroll-view> |
| | | ``` |
| | | ```javascript |
| | | Page({ |
| | | onLoad () { |
| | | // ctx 为ç»ä»¶å®ä¾ |
| | | ctx.in(this, '#scroll', 'top') |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | !> å¨ *scroll-view* ä¸ä½¿ç¨æ¶éè¦æ³¨æå¦æä½¿ç¨äºè§é¢ï¼éè¦ä¿è¯è¯¥å¹³å°ç *video* æ ç¾æ¯æå屿¸²æ |
| | | |
| | | ## navigateTo |
| | | åè½ï¼éç¹è·³è½¬ |
| | | åææ¯ [use-anchor](basic/prop#use-anchor) 屿§çå¼ä¸º *true* |
| | | å¿
é¡»å¨ [load](basic/event#load) äºä»¶è§¦åå使ç¨ï¼å»ºè®®å¨ [ready](basic/event#ready) äºä»¶è§¦åå使ç¨ä»¥ä¿è¯è·³è½¬ä½ç½®åç¡® |
| | | |
| | | è¾å
¥å¼ï¼ |
| | | |
| | | | åæ°å | ç±»å | å¿
å¡« | é»è®¤å¼ | 说æ | |
| | | |:---:|:---:|:---:|:---:|---| |
| | | | id | string | å¦ | - | è¦è·³è½¬çéç¹ idï¼ä¸ºç©ºå跳转å°å¼å¤´ | |
| | | | offset | number | å¦ | 0 | 跳转ä½ç½®çåç§»é | |
| | | |
| | | è¿åå¼ï¼**Promise** |
| | | |
| | | è¯¥æ¹æ³ä¸ä¼ å
¥ç *offset* ä¼å
级é«äº [use-anchor](basic/prop#use-anchor) 屿§ |
| | | |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | Page({ |
| | | ready () { |
| | | // ctx 为ç»ä»¶å®ä¾ |
| | | ctx.navigateTo('anchor').then(() => { |
| | | console.log('跳转æå') |
| | | }).catch(err => { |
| | | console.log('跳转失败ï¼', err) |
| | | }) |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | ## getText |
| | | åè½ï¼è·åææ¬å
容 |
| | | å¿
é¡»å¨ [load](basic/event#load) äºä»¶è§¦ååä½¿ç¨ |
| | | è¾å
¥å¼ï¼æ |
| | | è¿åå¼ï¼**String** |
| | | |
| | | ## getRect |
| | | åè½ï¼è·å坿æ¬å
容çä½ç½®åå¤§å° |
| | | 妿å¼å¯äº [lazy-load](basic/prop#lazy-load)ï¼[ready](basic/event#ready) äºä»¶è¿åç䏿¯æç»å¤§å°ï¼å¯éè¿æ¤æ¹æ³è·å¾å®æ¶ç大å°åä½ç½®ä¿¡æ¯ |
| | | è¾å
¥å¼ï¼æ |
| | | è¿åå¼ï¼**Promise** |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | Page({ |
| | | getRect () { |
| | | // ctx 为ç»ä»¶å®ä¾ |
| | | ctx.getRect().then(rect => { |
| | | console.log(rect) // boundingClientRect ä¿¡æ¯ |
| | | }).catch(err => { |
| | | console.log('è·å失败', err) |
| | | }) |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | !> è¯¥æ¹æ³æå°æ¦çå¯è½è·å失败ï¼éè¦å好é误å¤ç |
| | | |
| | | ## setContent |
| | | åè½ï¼è®¾ç½®å¯ææ¬å
容 |
| | | æ¤æ¹æ³çåè½ä¸ [content](basic/prop#content) 屿§åºæ¬ä¸è´ï¼ä½æ¤æ¹æ³ç设置ä¸éè¦ç»è¿è§å¾å±ä¸å¯ä»¥ä»å°¾é¨è¿½å |
| | | è¾å
¥å¼ï¼ |
| | | |
| | | | åæ°å | ç±»å | å¿
å¡« | é»è®¤å¼ | 说æ | |
| | | |:---:|:---:|:---:|:---:|---| |
| | | | content | string | æ¯ | - | è¦æ¸²æç html å符串 | |
| | | | append | boolean | å¦ | false | æ¯å¦ä»å°¾é¨è¿½å | |
| | | |
| | | è¿åå¼ï¼æ |
| | | |
| | | !> è°ç¨æ¤æ¹æ³ä¼è§¦å [load](basic/event#load) å [ready](basic/event#ready) äºä»¶ï¼è¯·å¿å¨äºä»¶å¤ç彿°ä¸è°ç¨ï¼å¦åå¯è½é·å
¥æ»å¾ªç¯ |
| | | |
| | | ## imgList |
| | | åè½ï¼è·åææå¾ççæ°ç» |
| | | 该æ°ç»ç¨äºå¾çé¢è§ï¼å¯¹å
¶è¿è¡ä¿®æ¹å¯ä»¥å¨èªå¨é¢è§æ¶çæï¼å¦ä¿®æ¹ä¸ºé«æ¸
å¾é¾æ¥æè½¬å *base64*ï¼ |
| | | |
| | | !> è¿æ¯ä¸ä¸ªå±æ§ï¼ä¸æ¯ä¸ä¸ªå½æ° |
| | | 请ä¸è¦å¢å æ¤æ°ç»ï¼å¯ä»¥ä¿®æ¹ï¼ï¼å¦åå¨èªå¨é¢è§æ¶å¯è½åºç°é®é¢ |
| | | |
| | | ```javascript |
| | | Page({ |
| | | load () { |
| | | // ctx 为ç»ä»¶å®ä¾ |
| | | var cover = ctx.imgList[0] // é¦å¼ å¾å¯ä»¥ä½ä¸ºè½¬åå°é¢å¾ |
| | | ctx.imgList.forEach((src, i, array) => { |
| | | console.log(src) |
| | | |
| | | // æ¿æ¢ä¸ºé«æ¸
å¾é¾æ¥ |
| | | array[i] = src.replace('thumb', '') |
| | | |
| | | // 转å base64 便äºé¢è§ |
| | | var fs = wx.getFileSystemManager && wx.getFileSystemManager() |
| | | var info = src.match(/data:image\/(\S+?);(\S+?),(.+)/) |
| | | if (!info) return |
| | | var filePath = `${wx.env.USER_DATA_PATH}/${Date.now()}.${info[1]}` |
| | | fs && fs.writeFile({ |
| | | filePath, |
| | | data: info[3], |
| | | encoding: info[2], |
| | | success: () => array[i] = filePath |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | ## pauseMedia |
| | | ?> [2.2.2](changelog/changelog#v222) çæ¬èµ·æ¯æ |
| | | |
| | | åè½ï¼æåæ£å¨ææ¾çè§é¢æé³é¢ |
| | | |
| | | ?> å [play](basic/event#play) äºä»¶é
åå¯ä»¥å®ç°ä¸é¡µé¢ä¸å
¶ä»é³è§é¢è¿è¡äºæ¥ææ¾ |
| | | |
| | | è¾å
¥å¼ï¼æ |
| | | è¿åå¼ï¼æ |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | Page({ |
| | | onHide () { |
| | | // ctx 为ç»ä»¶å®ä¾ |
| | | ctx.pauseMedia() // 页é¢è·³è½¬æéèæ¶æåææ¾ |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | ## setPlaybackRate |
| | | ?> [2.4.0](changelog/changelog#v240) çæ¬èµ·æ¯æ |
| | | |
| | | åè½ï¼è®¾ç½®é³è§é¢çææ¾éç |
| | | |
| | | è¾å
¥å¼ï¼ |
| | | |
| | | | åæ°å | ç±»å | å¿
å¡« | é»è®¤å¼ | 说æ | |
| | | |:---:|:---:|:---:|:---:|---| |
| | | | rate | number | æ¯ | - | ææ¾éçï¼ä¸è¬æ¯æ 0.5~2.0 | |
| | | |
| | | è¿åå¼ï¼æ |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | Page({ |
| | | // ç¹å»è®¾ç½®éçæé® |
| | | setPlaybackRate () { |
| | | wx.showActionSheet({ |
| | | itemList: ['0.5', '1.0', '1.25', '1.5', '2.0'], |
| | | success: res => { |
| | | const rate = [0.5, 1.0, 1.25, 1.5, 2.0][res.tapIndex] |
| | | // ctx 为ç»ä»¶å®ä¾ |
| | | ctx.setPlaybackRate(rate) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | ``` |
New file |
| | |
| | | # äºæ¬¡å¼å :id=develop |
| | | |
| | | ## ð£ 说æ :id=notice |
| | | äºæ¬¡å¼åè¯·å¨ *src* ç®å½ä¸è¿è¡ä¿®æ¹ï¼ä¿®æ¹å®æåå¯éè¿ä¸è¿°æ¹æ³èªå¨çæåå¹³å°ç代ç å
|
| | | 为æ¹ä¾¿ç»´æ¤ï¼æ¬é¡¹ç®åçå
å¤ä¸ªå¹³å°å
±ç¨ä¸å¥æºä»£ç ï¼å¨ç¼åæ¶ç´æ¥æç
§å¾®ä¿¡ç«¯çåæ³è¿è¡ç¼åå³å¯ï¼[çæä»£ç å
](#pack) æ¶ä¼èªå¨è¿è¡è½¬æ¢ |
| | | èªå¨è½¬æ¢å·²ç»æ¹å¹³äºå¤§é¨åå¹³å°ä¹é´çå·®å¼ï¼æä»¶åç¼åã*api* æ ¼å¼çï¼ï¼éè¦æ³¨æçæ¯ **访é®ç»ä»¶ç屿§** æ¶ï¼è¯·éè¿ *this.properties* 访é®è䏿¯ *this.data*ï¼å ä¸ºå¨æ¯ä»å®å¹³å°ä¸ä¸¤è
ä¸äºé |
| | | |
| | | 个å«é®é¢å¯ä»¥èªè¡ä¿®æ¹ *tools/converter.js* è¿è¡å¤ç |
| | | |
| | | é项ç®ç»æï¼ |
| | | ``` |
| | | ââdevï¼çæçåå¹³å°ç¤ºä¾é¡¹ç®ï¼ |
| | | ââdistï¼çæçåå¹³å°ä»£ç å
ï¼ |
| | | â ââmp-alipay |
| | | â ââmp-baidu |
| | | â ââmp-qq |
| | | â ââmp-toutiao |
| | | â ââmp-weixin |
| | | â ââuni-app |
| | | ââdocsï¼ææ¡£ï¼ç± docsify çæï¼ |
| | | ââpluginsï¼æä»¶æºä»£ç ï¼ |
| | | ââsrcï¼ç»ä»¶æºä»£ç ï¼ |
| | | â ââminiprogramï¼åçå
æºä»£ç ï¼ |
| | | â ââuni-appï¼uni-app å
æºä»£ç ï¼ |
| | | ââtestï¼æµè¯ä»£ç ï¼ |
| | | ââtoolsï¼æå»ºå·¥å
·ï¼ |
| | | â ââdemoï¼ç¤ºä¾é¡¹ç®æºä»£ç ï¼ |
| | | â â ââminiprogramï¼åçå¹³å°ç¤ºä¾é¡¹ç®ï¼ |
| | | â â ââuni-appï¼uni-app å¹³å°ç¤ºä¾é¡¹ç®ï¼ |
| | | | ââconfig.jsï¼æå»ºå·¥å
·çé
ç½®é¡¹ï¼ |
| | | | ââconverter.jsï¼å°å¾®ä¿¡ç«¯ç代ç 转æ¢å°å个平å°ï¼ |
| | | | ââifdef.jsï¼å¤çæ¡ä»¶ç¼è¯ï¼ |
| | | | ââminifier.jsï¼å¤ç json å wxs çåç¼©ï¼ |
| | | | ââplugin.jsï¼å¤çæä»¶æå»ºï¼ |
| | | ââ.eslintrc.jsonï¼eslint é
ç½®ï¼ |
| | | ââ.stylelintrc.jsonï¼stylelint é
ç½®ï¼ |
| | | ââgulpfile.jsï¼gulp çææä»¶ï¼ |
| | | ââLICENSEï¼è®¸å¯è¯ MITï¼ |
| | | ââpackage.jsonï¼é¡¹ç®é
ç½®ï¼ |
| | | ``` |
| | | |
| | | ?> 对äºè¾å¤æçä¿®æ¹ï¼å¦æè½éè¿ [ç¼åæä»¶](advanced/plugin#develop) æ¹å¼å®ç°æ´æ¨èæä»¶æ¹å¼ï¼è¿æ ·å¨ç»ä»¶å
åçº§çæ¶å便äºç»´æ¤å管ç |
| | | |
| | | ## ð æ¡ä»¶ç¼è¯ :id=ifdef |
| | | ä¸åå¹³å°ä¹é´ä¸äºå·®å¼çå°æ¹å¯è½æ æ³ç®åçéè¿æ¿æ¢è§£å³ï¼å æ¤æ¬é¡¹ç®ä¸å¼å
¥äºä¸ç§æ¡ä»¶ç¼è¯æºå¶è§£å³å¹³å°å·®å¼ï¼å¯å¨ä¿®æ¹æ¶å 以å©ç¨ï¼æ¡ä»¶ç¼è¯æ¯æå¨çæå
çè¿ç¨ä¸å°±ä»
ä¿çæ¬å¹³å°éè¦ç代ç ï¼ä¸è¿è¡è¿ç¨ä¸ç *if* 夿ä¸åï¼ |
| | | |
| | | æ¹å¼ *1*ï¼éç¨äº *js*ã*wxml*ã*wxss* æä»¶ï¼ |
| | | ä»
卿平å°ä¸éè¦ä½¿ç¨çä»£ç æ¾å¨ä¸¤ä¸ªæ³¨éï¼åç§æ³¨éæ ¼å¼çå¯ï¼ä¹é´å³å¯ï¼ç¤ºä¾ï¼ |
| | | ```javascript |
| | | // #ifdef MP-WEIXIN |
| | | console.log('è¿æ¯å¾®ä¿¡å¹³å°') |
| | | // #endif |
| | | // #ifndef MP-WEIXIN |
| | | console.log('è¿ä¸æ¯å¾®ä¿¡å¹³å°') |
| | | // #endif |
| | | ``` |
| | | |
| | | æ¹å¼ *2*ï¼éç¨äº *wxml* æä»¶ï¼ |
| | | 对äºä»
卿ä¸å¹³å°ä½¿ç¨ç屿§ï¼å¯å¨å±æ§ååå *å¹³å°å:* ï¼ç¤ºä¾ï¼ |
| | | ```wxml |
| | | <!-- show-menu-by-longpress 屿§å°ä»
被çæå°å¾®ä¿¡å
ä¸ --> |
| | | <image mp-weixin:show-menu-by-longpress="xxx" /> |
| | | ``` |
| | | |
| | | 说æï¼ |
| | | 1. å¯ç¨çå¹³å°åç§°ï¼*mp-weixin*, *mp-qq*, *mp-baidu*, *mp-alipay*, *mp-toutiao*ï¼ä¸åºå大å°åï¼ |
| | | 2. *#if(n)def* å *#endif* å¿
é¡»æå¯¹åºç°ï¼å¦å伿¥éï¼å¯ä»¥å¤å±åµå¥ï¼ |
| | | 3. 妿ç¼è¯è¿ç¨ä¸åç°é®é¢å¯ä»¥èªè¡ä¿®æ¹ *tools/ifdef.js* è¿è¡å¤ç |
| | | |
| | | ## ð¦ çæç»ä»¶å
:id=pack |
| | | ä¿®æ¹å®æåï¼å¯æä»¥ä¸æ¥éª¤çææ°çç»ä»¶å
|
| | | å¨ *mp-html* æä»¶å¤¹ä¸æ§è¡ï¼ |
| | | |
| | | ?> 以ä¸å½ä»¤éè¦å¨ç»ä»¶å
æ ¹ç®å½ä¸æ§è¡ï¼å³å
å« [package.json](https://github.com/jin-yufeng/mp-html/blob/master/package.json) çç®å½ï¼å¦æéè¿ *npm* è·åå°±æ¯ *node_modules/mp-html*ï¼ |
| | | |
| | | 1. å®è£
ä¾èµ |
| | | ```bash |
| | | # éè¿ npm å®è£
|
| | | npm install |
| | | # æéè¿ yarn å®è£
|
| | | yarn |
| | | ``` |
| | | 2. çæä»£ç å
å° *dist* æä»¶å¤¹ |
| | | ```bash |
| | | # çæå¾®ä¿¡å
å° dist/mp-weixin |
| | | npm run build:weixin |
| | | # çæ qq å
å° dist/mp-qq |
| | | npm run build:qq |
| | | # çæç¾åº¦å
å° dist/mp-baidu |
| | | npm run build:baidu |
| | | # çææ¯ä»å®å
å° dist/mp-alipay |
| | | npm run build:alipay |
| | | # çæå¤´æ¡å
å° dist/mp-toutiao |
| | | npm run build:toutiao |
| | | # çæ uni-app å
å° dist/uni-app |
| | | npm run build:uni-app |
| | | # çæææå
|
| | | npm run build |
| | | ``` |
| | | |
| | | ?> å¦éä¿®æ¹æå
è¿ç¨ä¸çé
ç½®ï¼*babel*, *uglifyJs* çï¼ï¼å¯ä»¥å¯¹ *tools/config.js* è¿è¡ä¿®æ¹ |
| | | |
| | | ## ð¦ æ£æ¥åæµè¯ :id=test |
| | | å设已å®è£
好ä¾èµ |
| | | |
| | | ```bash |
| | | npm run lint # eslint æ£æ¥ |
| | | npm run lintcss # stylelint æ£æ¥ |
| | | npm run lintcss --fix # æ£æ¥å¹¶ä¿®å¤ |
| | | npm run test # æ§è¡ jest æµè¯ |
| | | npm run coverage # æµè¯ä»£ç è¦çç |
| | | ``` |
| | | |
| | | å¯ä»¥å *test* ç®å½ä¸æ·»å æ°çæµè¯ç¨ä¾è¿è¡æµè¯ |
New file |
| | |
| | | # ð æä»¶ :id=plugin |
| | | |
| | | > å¯ä»¥å¨è¿ééæ©éè¦çæä»¶ä»¥å®ç°æ´å 丰å¯çåè½ |
| | | |
| | | ## ä½¿ç¨æä»¶ :id=use |
| | | |
| | | !> ç´æ¥å°æä»¶æä»¶å¤¹æ·è´å°ç»ä»¶å
䏿 æ³çæï¼è¯·éè¿ä»¥ä¸æ¹å¼çæå
嫿©å±çç»ä»¶å
|
| | | |
| | | #### å°ç¨åºæ¹å¼ |
| | | !> 该æ¹å¼æä¸å¯ç¨ |
| | | |
| | | ?> 该æ¹å¼éåä¸çæ *npm* çç¨æ· |
| | | |
| | | 1. éè¿ [å°ç¨åºæ¹å¼](overview/quickstart#mp) è·åå
嫿©å±æä»¶çç»ä»¶å
|
| | | 2. å°ä¸è½½çç»ä»¶å
è§£åï¼åçå°ç¨åºå¤å¶å° *components* ç®å½ä¸ï¼*uni-app* å¤å¶å°é¡¹ç®æ ¹ç®å½ä¸ï¼æç
§æºç æ¹å¼å¼å
¥å³å¯ï¼è¯¦è§ [å¼å
¥æ¹å¼](overview/quickstart#use) |
| | | |
| | | #### npm æ¹å¼ |
| | | |
| | | 1. è·å宿´çç»ä»¶å
|
| | | éè¿ [npm](overview/quickstart#npm) æ [git](overview/quickstart#git) çæ¹å¼è·å **å
å«å®æ´é¡¹ç®** çç»ä»¶å
ï¼æ³¨æä» *uni-app* çæä»¶å¸åºä¸å¯¼å
¥çå
ä¸ä»
å
å«æå»ºåçç»ä»¶ï¼**ä¸å
å«** æå»ºå·¥å
·åæä»¶ï¼ |
| | |  |
| | | 2. éæ©éè¦çæä»¶ |
| | | åè䏿¹æä»¶ä½¿ç¨è¯´æï¼ç¡®å®è¦ä½¿ç¨çæä»¶ï¼å°å
¶åç§°å¡«å
¥ [tools/config.js](https://github.com/jin-yufeng/mp-html/blob/master/tools/config.js#L8) ä¸ç *plugins* ä¸ |
| | | 妿æ³ä»
å¨é¨åå¹³å°ä½¿ç¨è¯¥æä»¶ï¼å¯ä»¥å¨è¯¥æä»¶ç®å½ä¸ç *build.js* ç *platform* åæ®µä¸å¡«å
¥éè¦çå¹³å°åç§° |
| | |  |
| | | 3. çæç»ä»¶å
|
| | | è®¾ç½®å®æåï¼å¯éè¿é¡¹ç®æä¾çå½ä»¤è¡å·¥å
·çææ°çç»ä»¶å
ï¼å
·ä½è§ [çæç»ä»¶å
](advanced/develop#pack) |
| | |  |
| | |  |
| | | 4. æç
§æºç æ *npm* æ¹å¼å¼å
¥æå»ºåçç»ä»¶å
è¿è¡ä½¿ç¨å³å¯ï¼è¯¦è§ [å¼å
¥æ¹å¼](overview/quickstart#use) |
| | | |
| | | ## audio |
| | | åè½ï¼é³ä¹ææ¾å¨ |
| | | 大å°ï¼*â4KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â(nvue 䏿¯æ) | |
| | | |
| | | !> ç¾åº¦å°ç¨åºåçå
卿¤ [é®é¢](https://smartprogram.baidu.com/forum/topic/show/125787) æªè§£å³åæ æ³ä½¿ç¨ |
| | | |
| | | 说æï¼ |
| | | å¨å¤§å¤æ°å°ç¨åºå¹³å°ï¼*audio* æ ç¾å·²è¢«åºå¼ææ æ³ä½¿ç¨ï¼æ¬æä»¶å¯ä»¥ä»£æ¿ *audio* æ ç¾ææ¾é³ä¹ï¼å¹¶å®ç°ä»¥ä¸ä¼åï¼ |
| | | 1. [pause-video](basic/prop#pause-video) 屿§ä¹å¯ä»¥åºç¨äºé³é¢ï¼å³ææ¾ä¸ä¸ªé³è§é¢æ¶å¯ä»¥èªå¨æåå
¶ä»æ£å¨ææ¾çé³è§é¢ |
| | | 2. å¢å äºä¸ä¸ªå¯ä»¥æå¨çè¿åº¦æ¡ |
| | | 3. ç»ä»¶å¤§å°å¯ä»¥æ ¹æ®é¡µé¢å®½åº¦èªå¨è°æ´ |
| | | 4. æ¯æ *autoplay* 屿§ |
| | | 5. ææ¾è¢«åå°æææ¶ï¼é¡µé¢æ¾ç¤ºåèªå¨ç»§ç»ææ¾ |
| | | |
| | | åºç¡åºè¦æ±ï¼ |
| | | æ¯ä»å® *1.23.4+* ï¼å
¶ä½å¹³å°æ»¡è¶³ [æä½è¦æ±](question/faq#lib) å³å¯ |
| | | 第 *5* æ¡ä»
微信 *2.2.3+* ã*QQ*ãç¾åº¦æ¯æ |
| | | |
| | | ?> 妿叿页é¢ä¸ä½¿ç¨æ¬ç»ä»¶ï¼ç»ä»¶çè·¯å¾ä¸º *path/to/mp-html/audio/audio* |
| | | 屿§åäºä»¶åºæ¬å *audio* ç»ä»¶ï¼ç»ä»¶å®ä¾ä¸æä¾äº *setSrc*ã*play*ã*seek*ã*pause*ã*stop* æ¹æ³å¯ä¾æ§å¶ææ¾ç¶æ |
| | | |
| | | ## editable |
| | | åè½ï¼å¯ææ¬ç¼è¾ |
| | | ä¸è¡¨ååºäºæ¬æä»¶ä¸åç *editor* ç»ä»¶çåè½å·®å¼ï¼å¯æééç¨ |
| | | |
| | | | ç»ä»¶ | ä¼ç¹ | ç¼ºç¹ | |
| | | |:---:|:---:|:---:| |
| | | | åç *editor* | åºå±éè¿ *contenteditable* å®ç°ï¼ç¼è¾æµç
| æ¯ææ ç¾å°ï¼ä¸æ¯æé³è§é¢ãè¡¨æ ¼ä»¥å *section* çå¸¸ç¨æ ç¾ï¼ãé¨åå°ç¨åºå¹³å°ä¸æ¯ææä½çæ¬ä¸å
¼å®¹ | |
| | | | æ¬æä»¶ | æ¯ææ ç¾å
¨é¢ãæ¯æå¹³å°å
¨é¢ | ç¼è¾çµæ´»æ§ä¸å¤å¼º | |
| | | |
| | | 大å°ï¼*â17.5KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â(nvue 䏿¯æ) | |
| | | |
| | | ##### 示ä¾é¡¹ç® :id=editable_demo |
| | | 微信å°ç¨åºç¹å» [代ç çæ®µ](https://developers.weixin.qq.com/s/S2ZpZDm87fQP) å³å¯å¨å¾®ä¿¡å¼åè
å·¥å
·ä¸å¯¼å
¥ï¼*uni-app* ä¸è½½ [示ä¾é¡¹ç®](https://mp-html.oss-cn-hangzhou.aliyuncs.com/editable.zip) å¨ *HBuilder X* 䏿å¼å³å¯ä½éªï¼æ³¨æç¤ºä¾é¡¹ç®ä¸ä¸ä¸å®å
嫿æ°çæ¬ï¼ä»
ä¾åèä½¿ç¨æ¹æ³ |
| | | |
| | | ?> ä¹å¯ä»¥åè示ä¾å°ç¨åº [æºä»£ç ](https://github.com/jin-yufeng/mp-html-demo) |
| | | |
| | | 说æï¼ |
| | | å¼å
¥æ¬æä»¶åï¼ä¼ç»ç»ä»¶æ·»å 以ä¸å±æ§ï¼ |
| | | |
| | | | 屿§å | ç±»å | é»è®¤å¼ | 说æ | |
| | | |:---:|:---:|:---:|:---:| |
| | | | editable | Boolean | false | æ¯å¦å¼å¯å
容ç¼è¾ | |
| | | | placeholder | String | 请è¾å
¥ | è¾å
¥æ¡ä¸ºç©ºæ¶å ä½ç¬¦ï¼[2.1.0+](changelog/changelog#v210)ï¼ | |
| | | |
| | | ?> [2.5.0](changelog/changelog#v250) çæ¬èµ·æ¯æå° *editable* 屿§è®¾ç½®ä¸º *"simple"* æ¥å¼å¯ç®ææ¨¡å¼ï¼ç®ææ¨¡å¼ä¸ï¼ç¹å»æåå
å®¹ç´æ¥è¿å
¥ç¼è¾ï¼ä¸åå¼¹åºæä½èåæ åæ¹æ¡ |
| | | |
| | | æ·»å 以ä¸äºä»¶ï¼ |
| | | |
| | | | äºä»¶å | è§¦åæ¶æº | ç¨é | |
| | | |:---:|:---:|:---:| |
| | | | removeï¼[2.2.0+](changelog/changelog#v220)ï¼ | å é¤å¾ç/è§é¢/é³é¢æ ç¾æ¶ | å é¤å·²ä¸ä¼ ççº¿ä¸æä»¶ | |
| | | |
| | | æ¯æä»¥ä¸æä½ï¼ |
| | | |
| | | | ç±»å | æä½ | |
| | | |:---:|:---:| |
| | | | ææ¬ | ä¿®æ¹ | |
| | | | å¾ç | æ´æ¢é¾æ¥ãè°æ´å®½åº¦ã设置æè¶
龿¥ï¼[2.0.4+](changelog/changelog#v204)ï¼ã设置é¢è§å¾é¾æ¥ãç¦ç¨é¢è§ãå é¤ | |
| | | | 龿¥ | æ´æ¢é¾æ¥ãå é¤ | |
| | | | é³è§é¢ | 设置å°é¢ãè®¾ç½®å¾ªç¯ææ¾ã设置èªå¨ææ¾ï¼[2.2.0+](changelog/changelog#v220)ï¼ãå é¤ | |
| | | | æ®éæ ç¾ | 设置åä½å¤§å°ãé¢è²ï¼[2.4.2+](changelog/changelog#v242)ï¼ãæä½ãç²ä½ãä¸å线ï¼[2.0.4+](changelog/changelog#v204)ï¼ãå±
ä¸ã缩è¿ãå é¤ | |
| | | |
| | | ?> [2.2.1](changelog/changelog#v221) çæ¬èµ·æææ ç¾æ¯æä¸ä¸ç§»å¨æä½ï¼ä½ä»
éå级æ ç¾é´ç§»å¨ï¼å³å¨æå级æ ç¾ä¸é第ä¸ä¸ªï¼ææåä¸ä¸ªï¼æ¶å¯ä»¥ä¸ç§»ï¼æä¸ç§»ï¼ |
| | | |
| | | ?> 卿¯ä»å®å°ç¨åºä¸ä½¿ç¨æ¶éè¦å¨é¡µé¢æ ·å¼ä¸æ·»å *page { position: relative; }* é¿å
*tooltip* éä½ |
| | | |
| | | ?> èå项å¯ä»¥éè¿ç¼è¾ *plugins/editable/config.js* è¿è¡ä¿®æ¹ï¼ä»
å¯ä»¥å åæè°æ´é¡ºåºï¼æ·»å ææ´åæ æï¼é¢è²è®¾ç½®é¤å¤ï¼ |
| | | |
| | | [ç»ä»¶å®ä¾](advanced/api#getCompent) 䏿ä¾äºä»¥ä¸æ¹æ³ï¼*editable* 屿§ä¸º *true* æ¶æå¯ä»¥è°ç¨ï¼ï¼ |
| | | |
| | | | åç§° | åè½ | |
| | | |:---:|:---:| |
| | | | undo | æ¤éä¸ä¸ªæä½ | |
| | | | redo | éåä¸ä¸ªæä½ | |
| | | | insertHtml | å¨å
æ 夿å
¥æå® html å
容ï¼[2.1.0+](changelog/changelog#v210)ï¼ | |
| | | | insertImg | å¨å
æ 夿å
¥ä¸å¼ å¾ç | |
| | | | insertTable(rows, cols) | å¨å
æ 夿å
¥ä¸ä¸ª rows è¡ cols åçè¡¨æ ¼ï¼[2.1.3+](changelog/changelog#v213)ï¼ | |
| | | | insertVideo | å¨å
æ 夿å
¥ä¸ä¸ªè§é¢ | |
| | | | insertAudio | å¨å
æ 夿å
¥ä¸ä¸ªé³é¢ | |
| | | | insertLink | å¨å
æ 夿å
¥ä¸ä¸ªé¾æ¥ | |
| | | | insertText | å¨å
æ 夿å
¥ä¸æ®µææ¬ | |
| | | | clear | æ¸
空å
容 | |
| | | | getContent | è·åç¼è¾åç html å
容 | |
| | | |
| | | ?> èèå°ä¸ååºæ¯ä¸å¸æè·å龿¥çæ¹æ³ä¸åï¼éè¦å¨åå§æ¶ç»ç»ä»¶è®¾ç½®ä¸ä¸ª *getSrc* æ¹æ³ï¼å¦åæå
¥å¾çãé³è§é¢ã龿¥æä¿®æ¹é¾æ¥çæä½æ æ³ä½¿ç¨ï¼ï¼æ¯æ¬¡ç»ä»¶å
éè¦é¾æ¥æ¶ä¼è°ç¨æ¤æ¹æ³ï¼å¼åè
å¯å¨æ¤æ¹æ³ä¸èªè¡å³å®å¦ä½è·å龿¥ï¼è¿å **线ä¸å°å** å³å¯ï¼å
·ä½ç¨æ³è§ä¸æ¹ç¤ºä¾ï¼ |
| | | [2.2.0](changelog/changelog#v220) çæ¬èµ·è®¾ç½®äº [domain](basic/prop#domain) 屿§æ¶ï¼è¿åçå°åå¯ä»¥ç¼ºç主åå |
| | | |
| | | ç¼è¾å®æåï¼éè¿ *getContent* æ¹æ³è·åç¼è¾åç *html*ï¼æåå° *editable* 屿§è®¾ç½®ä¸º *false* å³å¯æ£å¸¸æ¸²æ |
| | | |
| | | !> ç¹å»ä¿åæé®æ¶ï¼é¨åå¹³å° *tap* äºä»¶æ©äº *blur* äºä»¶è§¦åï¼ç´æ¥è·åå
容å¯è½å¯¼è´æ æ³è·åå½åç¼è¾çææ¬å
容ï¼å æ¤å»ºè®®è®¾ç½®ä¸ä¸ªå°çå»¶æ¶åè·åï¼å¯åè䏿¹ç¤ºä¾ï¼[详ç»](https://github.com/jin-yufeng/mp-html/issues/368)ï¼ |
| | | |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | Page({ |
| | | onLoad () { |
| | | // ctx 为ç»ä»¶å®ä¾ï¼è·åæ¹æ³è§ä¸ |
| | | /** |
| | | * @description 设置è·å龿¥çæ¹æ³ |
| | | * @param {String} type 龿¥çç±»åï¼img/video/audio/linkï¼ |
| | | * @param {String} value ä¿®æ¹é¾æ¥æ¶ï¼è¿éä¼ä¼ å
¥æ§å¼ |
| | | * @returns {Promise} è¿å线ä¸å°åï¼2.2.0 çæ¬èµ·è®¾ç½®äº domain 屿§æ¶ï¼å¯ä»¥ç¼ºç主ååï¼ |
| | | * type 为 audio/video æ¶ï¼å¯ä»¥è¿åä¸ä¸ªæºå°åæ°ç» |
| | | * 2.1.3 çæ¬èµ· type 为 audio æ¶ï¼å¯ä»¥è¿åä¸ä¸ª objectï¼å
å« srcãnameãauthorãposter çåæ®µ |
| | | * 2.2.0 çæ¬èµ· type 为 img æ¶ï¼å¯ä»¥è¿åä¸ä¸ªæºå°åæ°ç»ï¼è¡¨ç¤ºæå
¥å¤å¼ å¾çï¼ä¿®æ¹é¾æ¥æ¶ä»
éä¸å¼ ï¼ |
| | | */ |
| | | this.ctx.getSrc = (type, value) => { |
| | | return new Promise((resolve, reject) => { |
| | | // 以å¾çä¸ºä¾ |
| | | if (type == 'img') { |
| | | wx.chooseImage({ |
| | | count: value === undefined ? 9 : 1, // 2.2.0 çæ¬èµ·æå
¥å¾çæ¶æ¯æå¤å¼ ï¼ä¿®æ¹å¾ç龿¥æ¶ä»
éä¸å¼ ï¼ |
| | | success: res => { |
| | | wx.showLoading({ |
| | | title: 'ä¸ä¼ ä¸' |
| | | }); |
| | | (async ()=>{ |
| | | const arr = [] |
| | | for (let item of res.tempFilePaths) { |
| | | // 便¬¡ä¸ä¼ |
| | | const src = await upload(item) |
| | | arr.push(src) |
| | | } |
| | | return arr |
| | | })().then(res => { |
| | | wx.hideLoading() |
| | | resolve(res) |
| | | }) |
| | | }, |
| | | fail: reject |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | finishEdit () { |
| | | setTimeout(() => { |
| | | var html = ctx.getContent() // è·åç¼è¾å¥½ç html |
| | | // ä¸ä¼ html |
| | | wx.request({ |
| | | url: 'xxx', |
| | | data: { |
| | | html |
| | | }, |
| | | success: () => { |
| | | this.setData({ |
| | | editable: false // ç»æç¼è¾ |
| | | }) |
| | | } |
| | | }) |
| | | }, 50) |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | 注æäºé¡¹ï¼ |
| | | ä¸è¦å¨ *editable* 屿§è¢«è®¾ç½®ä¸º *true* åéè¿ [setContent](advanced/api#setContent) æ¹æ³ï¼ç¨ [content](basic/prop#content) 屿§ï¼è®¾ç½®å
容ï¼å¦åå¨åæ¢ä¸º *true* åä¼åæç©ºç½ |
| | | |
| | | ## emoji |
| | | åè½ï¼è§£æ *emoji* |
| | | 大å°ï¼*â3KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â | |
| | | |
| | | 说æï¼ |
| | | å°å½¢å¦ *[ç¬è¸]* çææ¬æ¿æ¢ä¸º *emoji* å符 ð |
| | | å¹é
模å¼å¯ä»¥éè¿ä¿®æ¹ *reg* åéå®ç° |
| | | é»è®¤é
ç½®äº *177* 个常ç¨ç *emoji* å°è¡¨æ
ï¼å¯ä»¥èªè¡æç
§éè¦ä¿®æ¹ *data* åé |
| | | |
| | | ?> ä¸ [editable](#editable) æä»¶å
±ç¨æ¶ï¼å¯¼åºç¼è¾å¥½ç *html* å
容ï¼ä¼å° *emoji* å符ç¼ç ä¸ºææ¬å½¢å¼ï¼ä¾¿äºåå¨ |
| | | |
| | | ## highlight |
| | | åè½ï¼ä»£ç åé«äº®æ¾ç¤º |
| | | 大å°ï¼*â16KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â | |
| | | |
| | | 说æï¼ |
| | | ç¼è¾ *plugins/highlight/config.js* ï¼å¯ä»¥éæ©æ¯å¦éè¦ä»¥ä¸åè½ï¼ |
| | | - *copyByLongPress* æ¯å¦éè¦é¿æä»£ç åæ¶æ¾ç¤ºå¤å¶ä»£ç å
容èåï¼*uni-app nvue* æä¸æ¯æï¼ |
| | | - *showLanguageName* æ¯å¦å¨ä»£ç åå³ä¸è§æ¾ç¤ºè¯è¨çåç§° |
| | | - *showLineNumber* æ¯å¦å¨å·¦ä¾§æ¾ç¤ºè¡å· |
| | | |
| | | !> ä¿®æ¹è¯¥é
ç½®åéè¦éæ° [çæç»ä»¶å
](advanced/develop#pack)ï¼å¨æå»ºåçç»ä»¶å
ä¸ä¿®æ¹é
ç½®æ æ³çæ |
| | | |
| | | å¼å
¥æ¬æä»¶åï¼*html* ä¸ç¬¦å以䏿 ¼å¼ç *pre* å°è¢«é«äº®å¤çï¼ |
| | | ```html |
| | | <!-- pre ä¸å
å«ä¸ä¸ª codeï¼å¹¶å¨ pre æ code ç class ä¸è®¾ç½® language- --> |
| | | <pre><code class="language-css">p { color: red }</code></pre> |
| | | ``` |
| | | |
| | | ?> ä¸ [editable](#editable) æä»¶å
±ç¨æ¶ï¼ç¼è¾ç¶æä¸ï¼ä¸ä¼è¿è¡é«äº®ï¼å¯ä»¥ç´æ¥ä¿®æ¹ä»£ç ææ¬ |
| | | |
| | | ?> æ¬æä»¶çé«äº®åè½ä¾èµäº [prismjs](https://prismjs.com/)ï¼é»è®¤é
ç½®ä¸ä»
æ¯æ *html*ã*css*ã*c-like*ã*javascript* è¯è¨å *Tomorrow Night* 主é¢ï¼å¦æéè¦æ´å¤è¯è¨ææ´æ¢ä¸»é¢è¯·åå¾ [å®ç½](https://prismjs.com/download.html) ä¸è½½å¯¹åºç *prism.min.js* å *prism.css* å¹¶æ¿æ¢ *plugins/highlight/* ç®å½ä¸çæä»¶ï¼*prismjs* çæä»¶å¤§å¤æ¶å *dom* æä½ï¼åºæ¬ä¸å¯ç¨ï¼è¯·å¿éæ©ï¼ |
| | | |
| | | ## markdown |
| | | åè½ï¼æ¸²æ *markdown* |
| | | 大å°ï¼*â37KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â | |
| | | |
| | | 说æï¼ |
| | | å¼å
¥æ¬æä»¶åï¼ä¼ç»ç»ä»¶æ·»å ä¸ä¸ª *markdown* 屿§ï¼å°è¯¥å±æ§è®¾ç½®ä¸º *true* åï¼å³å¯éè¿ [content](basic/prop#content) 屿§æ [setContent](advanced/api#setContent) æ¹æ³è®¾ç½® *markdown* å
容å³å¯ |
| | | |
| | | ?> è¥å¼å¯ [use-anchor](basic/prop#use-anchor) 屿§ï¼æææ é¢ `# xxx` é½ä¼è¢«è®¾ç½®ä¸ºéç¹ï¼éè¿é¾æ¥ `[xxx](#xxx)` å¯ä»¥ç´æ¥è·³è½¬ |
| | | |
| | | ?> æ¬æä»¶éè¿ [marked](https://github.com/markedjs/marked) è§£æ *markdown* ææ¬ï¼é¨å *css* æéèª [github-markdown-css](https://github.com/sindresorhus/github-markdown-css) |
| | | |
| | | ?> æ¬æä»¶å¯ä»¥å [highlight](#highlight) æä»¶å
±ç¨ï¼å®ç° *markdown* ä¸ä»£ç åçé«äº®ææ |
| | | |
| | | ## search |
| | | åè½ï¼å
³é®è¯æç´¢ |
| | | 大å°ï¼*â1.5KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â(nvue 䏿¯æ) | |
| | | |
| | | 说æï¼ |
| | | å¼å
¥åä¼å¨ [ç»ä»¶å®ä¾](advanced/api#getCompent) ä¸æè½½ä¸ä¸ª *search* æ¹æ³ï¼ç¨äºå
³é®è¯æç´¢ |
| | | |
| | | è¾å
¥å¼ |
| | | |
| | | | åæ°å | ç±»å | é»è®¤å¼ | 说æ | |
| | | |:---:|:---:|:---:|---| |
| | | | key | String æ RegExp | - | è¦æç´¢çå
³é®è¯ï¼æ¯æåç¬¦ä¸²åæ£å | |
| | | | anchor | Boolean | false | æ¯å¦å°æç´¢ç»æè®¾ç½®ä¸ºéç¹ | |
| | | | style | String | background-color:yellow | æ è®°æç´¢ç»æçæ ·å¼ | |
| | | |
| | | è¿åå¼ï¼*Promise* |
| | | |
| | | | 屿§ | ç±»å | 说æ | |
| | | |:---:|:---:|---| |
| | | | num | Number | æç´¢ç»ææ°é | |
| | | | highlight | Function(i, style='background-color:#FF9632') | é«äº®ç¬¬ iï¼1 ~ numï¼ä¸ªç»æï¼å°å
¶æ ·å¼è®¾ç½®ä¸º style | |
| | | | jump | Function(i, offset) | 跳转å°ç¬¬ iï¼1 ~ numï¼ä¸ªç»æï¼åç§»é为 offsetï¼anchor 为 true æå¯ç¨ | |
| | | |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | function search (key) { |
| | | // ctx 为ç»ä»¶å®ä¾ |
| | | ctx.search(key, true).then(res => { |
| | | res.highlight(1) |
| | | res.jump(1, -50) // é«äº®ç¬¬ 1 ä¸ªç»æå¹¶è·³è½¬å°è¯¥ä½ç½®ï¼åç§»é -50 |
| | | }) |
| | | } |
| | | ``` |
| | | |
| | | ?> å
·ä½ç¨æ³å¯ä»¥åè示ä¾å°ç¨åº [æºä»£ç ](https://github.com/jin-yufeng/mp-html-demo) |
| | | |
| | | éå 说æï¼ |
| | | 1. ä¸ä¼ å
¥ *key*ï¼æä¸ºç©ºï¼æ¶å³å¯åæ¶æç´¢ï¼åæ¶ææçé«äº®ï¼è¿åå°åæ¥çææ |
| | | 2. è¿è¡æ°çæç´¢æ¶æ§çæç´¢ç»æå°è¢«è¿åï¼æ§çç»æä¸ç *highlight* çæ¹æ³ä¸åå¯ç¨ |
| | | 3. è°ç¨ *highlight* æ¹æ³é«äº®ä¸ä¸ªç»ææ¶ï¼ä¹å被é«äº®çç»æä¼è¢«è¿åï¼å³å§ç»åªæä¸ä¸ªç»æè¢«é«äº® |
| | | 4. *key* ä¼ å
¥å符串æ¶å¤§å°åææï¼å¦æè¦å¿½ç¥å¤§å°åå¯ä»¥ç¨æ£åç *i*ï¼å符串æç´¢æçé«äºæ£åï¼ |
| | | 5. 设置 *anchor* 为 *true* ä¼ä¸å®ç¨åº¦ä¸é使çï¼éå¿
è¦ä¸è¦å¼å¯ |
| | | 6. æä¸æ¯æè·¨æ ç¾æç´¢ï¼å³åªæä¸ä¸ªææ¬èç¹å
å
嫿´ä¸ªå
³é®è¯æè½è¢«æç´¢å° |
| | | |
| | | ## style |
| | | åè½ï¼è§£æåå¹é
*style* æ ç¾ä¸çæ ·å¼ |
| | | |
| | | ?> è¿éç *style* æ ç¾æçæ¯ä¼ å
¥ [content](basic/prop#content) 屿§ä¸ç *html* éå
å«ç *style* æ ç¾ï¼ä¸ *style* æ ç¾è¦æ¾å¨å
¶ä»æ ç¾å颿è½çæ |
| | | |
| | | 大å°ï¼*â3.5KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â (nvue ç´æ¥æ¯æ) | |
| | | |
| | | 说æï¼ |
| | | æ¯æä»¥ä¸éæ©å¨ï¼ |
| | | |
| | | | åç§° | ç¤ºä¾ | |
| | | |:---:|---| |
| | | | æ ç¾åéæ©å¨ | p {} | |
| | | | class éæ©å¨ | .class {} | |
| | | | id éæ©å¨ | #id {} | |
| | | | å¤éæ©å¨äº¤é | p.class {} | |
| | | | å¤éæ©å¨å¹¶é | p, .class {} | |
| | | | åä»£éæ©å¨ | .class1 .class2 {} | |
| | | | åéæ©å¨ | .class1 > .class2 {} | |
| | | | 伪类 | .class::before {} | |
| | | |
| | | 伪类ä»
æ¯æ *before* å *after*ï¼æ¯æ *attr* æ¹æ³ |
| | | 䏿¯æçéæ©å¨ï¼å±æ§éæ©å¨çï¼å°è¢«å¿½ç¥ |
| | | |
| | | !> ç±äºå°ç¨åºä¸æ æ³å¨æåå
¥ *css*ï¼æ¬æä»¶çå®ç°åçæ¯éè¿è§£æï¼å°å¹é
çæ ·å¼æ·»å å°åæ ç¾çè¡å
*style* ä¸å»ï¼è¯·æ
ç¨å®½æ³çéæ©å¨ï¼ä»¥å
大大å¢å è§£æç»æå¤§å°ï¼åæ
¢æ¸²æé度 |
| | | |
| | | ## txv-video |
| | | åè½ï¼ä½¿ç¨è
¾è®¯è§é¢ |
| | | 大å°ï¼*â1KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | | | | â (h5 å app ç´æ¥æ¯æ) | |
| | | |
| | | 说æï¼ |
| | | å¼å
¥æ¬æä»¶åï¼*html* ä¸ç¬¦å䏿¹æ ¼å¼ç *iframe* æ ç¾ï¼*src* ä¸å«æ *vid*ï¼å°è¢«è½¬ä¸ºéè¿è
¾è®¯è§é¢ææ¾ï¼ |
| | | ```html |
| | | <iframe src="https://v.qq.com/txp/iframe/player.html?vid=xxxxxx" allowFullScreen="true"></iframe> |
| | | ``` |
| | | |
| | | åæ¶ï¼å
¶å¯ä»¥è¢« [pause-video](basic/prop#pause-video) 屿§æ§å¶ |
| | | |
| | | !> æ¬æä»¶ä»
ç¨äºå°å®æ¹ [è
¾è®¯è§é¢æä»¶](https://github.com/tvfe/txv-miniprogram-plugin) åºç¨äºæ¬ç»ä»¶ï¼ä½¿ç¨åè¯·ç¡®è®¤å·²ç»æåç³è¯·ä½¿ç¨è¯¥æä»¶å¹¶æè¦æ±å¨å°ç¨åº *app.json* ä¸é
ç½®å®æï¼*uni-app* ä¸çé
ç½®æ¹æ³å¯ä»¥åè [#103](https://github.com/jin-yufeng/mp-html/issues/103#issuecomment-654586246)ï¼ï¼å¦åå¯è½æ¥é **This application has not registered any plugins yet** 䏿 æ³çæ |
| | | |
| | | ?> è
¾è®¯è§é¢æä»¶ [v2](https://github.com/tvfe/txv-miniprogram-plugin) é»è®¤èªå¨ææ¾ï¼[v1](https://github.com/tvfe/txv-miniprogram-plugin/blob/master/archieve/readme.md) ä¸ä¼ï¼å¯æééæ© |
| | | |
| | | ## img-cache |
| | | åè½ï¼å¾çæ¬å°ç¼å |
| | | 大å°ï¼*â4KB* |
| | | ä½è
ï¼[@PentaTea](https://github.com/PentaTea) |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | | | | | | â(ä»
æ¯æ app ç vue 页é¢) | |
| | | |
| | | 说æï¼ |
| | | å¼å
¥æ¬æä»¶åï¼ä¼ç»ç»ä»¶æ·»å ä¸ä¸ª *img-cache* 屿§ï¼å°è¯¥å±æ§è®¾ç½®ä¸º *true* åï¼å°èªå¨ä¸è½½å¼ç¨çå¾çå¹¶å° *src* 屿§æ´æ¢ä¸ºæ¬å°å°å |
| | | åæ¶å¨ [ç»ä»¶å®ä¾](advanced/api#getCompent) ä¸æè½½äº *imgCache* å¯¹è±¡ï¼æ©å
ç¼åæ§å¶è½å |
| | | |
| | | *imgCache* å¯¹è±¡å±æ§åæ¹æ³ï¼ |
| | | |
| | | | 屿§ | åè½ | |
| | | |:---:|:---:| |
| | | | list | å½åç¼åç url å表 | |
| | | | get(url) | ä¼ å
¥ url è·å¾æ¬å°å°å | |
| | | | delete(url) | ä¼ å
¥ url å é¤ç¼åè®°å½ | |
| | | | add(url) | ä¼ å
¥ url å¹¶ä¸è½½ç®æ 为ç¼å | |
| | | | clear() | æ¸
空ææç¼å | |
| | | |
| | | !> 请尽éç¡®ä¿ *src* ä¸å«ææä»¶åç¼åï¼ä¸ä»¥åç¼ç»å°¾ä¹æ²¡å
³ç³»ï¼æä»¶ä¼ä»è·¯å¾ä¸æ¨æµåççå¾çåç¼ï¼å¦æå®å
¨ä¸å
å«åç¼ä¿¡æ¯å¯è½ä¼æ æ³ä¿åå°ç¸å |
| | | |
| | | ## latex |
| | | åè½ï¼æ¸²æ *latex* å
¬å¼ |
| | | 大å°ï¼**â300KB** |
| | | ä½è
ï¼[@Zeng-J](https://github.com/Zeng-J) |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â | |
| | | |
| | | 说æï¼ |
| | | å¼å
¥æ¬æä»¶åï¼ä¼å° *$xxx$* çææ¬å
容æç
§ *latex* è§åè¿è¡è§£æå渲æ |
| | | |
| | | ?> [2.5.0](changelog/changelog#v250) çæ¬èµ·æ¯æ *$$xxx$$* å½¢å¼çå级å
¬å¼ |
| | | |
| | | ?> ä¸ [editable](#editable) æä»¶å
±ç¨æ¶ï¼ç¼è¾ç¶æä¸ï¼å
¬å¼ä¸ä¼æ¸²æï¼å¯ä»¥ç´æ¥ä¿®æ¹å
¬å¼ææ¬ |
| | | |
| | | ?> å¨ *js* çå符串ä¸å *latex* å
¬å¼æ¶é注æ *\\* ä¼åæè½¬ä¹ç¬¦ï¼è¦ä½¿ç¨ *\\\\* æ *String.raw``* çæ¹å¼ |
| | | |
| | | ?> æ¬æä»¶éè¿ [katex-mini](https://github.com/rojer95/katex-mini) è§£æ *latex* ææ¬ï¼[å使件](https://github.com/KaTeX/KaTeX/tree/main/fonts) 建议èªè¡è½¬å |
| | | |
| | | ## card |
| | | åè½ï¼ååï¼èç»äººï¼ä¿¡æ¯å¡ |
| | | 大å°ï¼*â7KB* |
| | | ä½è
ï¼[@whoooami](https://github.com/whoooami) |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â(nvue 䏿¯æ) | |
| | | |
| | | ææå¾ï¼ |
| | |  |
| | | |
| | | åæ°åè¡¨ï¼ |
| | | |
| | | |åæ°å|æ¯å¦å¿
é¡»|ç±»å|说æ| |
| | | |:---- |:---|:----- |----- | |
| | | |src|æ¯|String|å¾çUrl| |
| | | |title|æ¯|String|æ é¢| |
| | | |desc|æ¯|String|æè¿°| |
| | | |url|æ¯|String|跳转url| |
| | | |color|æ¯|String|æåé¢è²| |
| | | |bgcolor|æ¯|String|å¡çèæ¯é¢è²| |
| | | |border|æ¯|String|å¡çè¾¹æ¡é¢è²| |
| | | |
| | | 说æï¼ |
| | | 1. å¯ä»¥æ¾ç¤ºååä¿¡æ¯å¡ç/èç»äººä¿¡æ¯å¡ç |
| | | |
| | | åºç¡åºè¦æ±ï¼ |
| | | 满足æä½è¦æ±å³å¯ |
| | | |
| | | ?> 妿叿页é¢ä¸ä½¿ç¨æ¬ç»ä»¶ï¼ç»ä»¶çè·¯å¾ä¸º *path/to/mp-html/card/card* |
| | | |
| | | ## å¼åæä»¶ :id=develop |
| | | ä¸ä¸ªæä»¶å¤§è´éè¦ä»¥ä¸æä»¶ï¼*plugin/template* 䏿ä¾äºä¸ä¸ªæ¨¡æ¿ï¼ |
| | | |
| | | - *build.js* |
| | | æå»ºæä»¶ï¼éè¦å¯¼åºä¸ä¸ª *object*ï¼å¯ä»¥å
å«ä»¥ä¸é¡¹ï¼ |
| | | |
| | | | åç§° | ç±»å | é»è®¤å¼ | åè½ | |
| | | |:---:|:---:|:---:|---| |
| | | | main | string | index.js | å
¥å£æä»¶è·¯å¾ | |
| | | | platform | string[] | ['mp-weixin', 'mp-qq', 'mp-baidu', 'mp-alipay', 'mp-toutiao', 'uni-app'] | æ¯æä½¿ç¨çå¹³å° | |
| | | | template | string | - | è¦è¢«æ·»å å°æ¨¡æ¿æä»¶ä¸çæ ç¾ (nvue ä¸å¯ç¨) | |
| | | | methods | object | {} | ç¨äºå¤ç模æ¿ä¸äºä»¶çæ¹æ³ (nvue ä¸å¯ç¨) | |
| | | | style | string | - | ç¨äºæ¨¡æ¿æä»¶ç css æ ·å¼ | |
| | | | import | string|string[] | - | ç¨äºæ¨¡æ¿æä»¶ç css æä»¶è·¯å¾ | |
| | | | usingComponents | object | {} | ç¨äºæ¨¡æ¿çç»ä»¶ææä»¶å表 (nvue ä¸å¯ç¨) | |
| | | | handler | function | - | èªå®ä¹æä»¶å¤çæ¹æ³ | |
| | | |
| | | |
| | | - *index.js* |
| | | å
¥å£æä»¶ï¼å¯¼åºä¸ä¸ª *function*ï¼æ¯ä¸ªç»ä»¶å¨è¢«å建æ¶ï¼ä¼ä¾æ¬¡å®ä¾åå个æä»¶ï¼å¹¶ä¼ å
¥ç»ä»¶å®ä¾å¯ä¾è°ç¨ |
| | | æä»¶å®ä¾ä¸å¯ä»¥æè½½ä»¥ä¸é©åæ¹æ³ï¼å°å¨å¯¹åºæ¶æºè¢«è°ç¨ |
| | | |
| | | | åç§° | è§¦åæ¶æº | åæ° | è¿åå¼ | |
| | | |:---:|:---:|:---:|:---:| |
| | | | onUpdate | æ´æ° html å
容æ¶è§¦å | æ´æ°ç html å
容åè§£æé
ç½® | 妿坹è¾å
¥å¼è¿è¡äºä¿®æ¹ï¼åè¿åä¿®æ¹åçå
容 | |
| | | | onParse | è§£æå°ä¸ä¸ªæ ç¾æ¶è§¦å | æ ç¾åè§£æå¨å®ä¾ | è¿å false å°ç§»é¤è¯¥æ ç¾ | |
| | | | onLoad | dom æ å è½½å®ææ¶è§¦å | - | - | |
| | | | onDetached | ç»ä»¶è¢«ç§»é¤æ¶è§¦å | - | - | |
| | | |
| | | - *README.md* |
| | | 使ç¨è¯´æ |
| | | |
| | | - *å
¶ä»ä¾èµæä»¶* |
| | | æä»¶ç®å½ä¸ï¼é¤äº *.md* çæä»¶ã*build.js* å *import* åæ®µä¸ç *css* æä»¶ï¼å
¶ä»çé½ä¼è¢«æ·è´å°çæçç»ä»¶å
ä¸ï¼å æ¤è¯·ä¸è¦æ¾ç½®æ å
³æä»¶ |
| | | |
| | | 对äºä»
å¨åçå¹³å°ä¸ä½¿ç¨çå
容坿¾å¨ *miniprogram* ç®å½ä¸ï¼ä»
å¨ *uni-app* ä¸ä½¿ç¨çå
容坿¾å¨ *uni-app* ç®å½ä¸ï¼ä¸¤ä¸ªç®å½ä¸å¯ä»¥å嫿¾ç½® *build.js* |
| | | |
| | | 妿卿件ä¸éè¦ç¨å°è§£æå¨ï¼å° *html* å符串解æä¸º *nodes* æ°ç»ï¼ï¼å¯ä»¥å¼å
¥ *src/parser.js* 使ç¨ï¼æ¹æ³å¦ä¸ï¼ |
| | | ```javascript |
| | | const Parser = require('../parser.js') |
| | | var instance = new Parser(vm) // å®ä¾åè§£æå¨ï¼ä¼ å
¥ç»ä»¶å®ä¾å°èªå¨è·åç¸å
³é
ç½® |
| | | var nodes = instance.parse(content) // è§£æå®æ |
| | | ``` |
| | | |
| | | !> 妿ç¼åäºæä»¶ï¼å¨å级ç»ä»¶å
æ¶è¯·æ³¨æå¤ä»½ï¼é¿å
丢失 |
| | | |
| | | ?> æ¬¢è¿æäº¤å®ç¨çæä»¶ [pull requests](https://github.com/jin-yufeng/mp-html/pulls) å° *plugins* æä»¶å¤¹ |
New file |
| | |
| | | # ð« äºä»¶ :id=event |
| | | |
| | | ## è·åæ¹å¼ :id=method |
| | | - *uni-app* |
| | | *@* + äºä»¶å æ *v-on:* + äºä»¶å |
| | | äºä»¶ä¿¡æ¯ä» *event* ä¸è·å |
| | | ```vue |
| | | <template> |
| | | <view> |
| | | <mp-html @ready="ready" /> |
| | | </view> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | methods: { |
| | | ready (e) { |
| | | console.log(e) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | ``` |
| | | |
| | | - æ¯ä»å®å°ç¨åº |
| | | *on* + äºä»¶åï¼é¦åæ¯å¤§åï¼ |
| | | äºä»¶ä¿¡æ¯ä» *event* ä¸è·å |
| | | ```axml |
| | | <mp-html onReady="ready"> |
| | | ``` |
| | | ```javascript |
| | | Page({ |
| | | ready (e) { |
| | | console.log(e) |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | - å
¶ä»å°ç¨åºå¹³å° |
| | | *bind* + äºä»¶å |
| | | äºä»¶ä¿¡æ¯ä» *event.detail* ä¸è·å |
| | | ```wxml |
| | | <mp-html bindready="ready" /> |
| | | ``` |
| | | ```javascript |
| | | Page({ |
| | | ready (e) { |
| | | console.log(e.detail) |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | ## load |
| | | è§¦åæ¶æºï¼*dom* æ å è½½å®æ¯æ¶ |
| | | è¿åå¼ï¼æ |
| | | ç¨éï¼å¯ä»¥è°ç¨ [api](advanced/api) 彿° |
| | | |
| | | ## ready |
| | | è§¦åæ¶æºï¼å¾çå è½½å®æ¯æ¶ï¼ä¸å
嫿å è½½çå¾çï¼ |
| | | |
| | | ?> 夿æ¹å¼æ¯ *350ms* æ»é«åº¦æ åå就认为å è½½å®æ¯ï¼é¨åæ
åµä¸å¯è½ä¸åç¡®ï¼[2.4.0](changelog/changelog#v240) çæ¬èµ· [lazy-load](basic/prop#lazy-load) 屿§ä¸º *false* æ¶æ ¹æ®å¾çç *load* äºä»¶å¤æï¼å¯ä»¥åºæ¬å确触å |
| | | |
| | | è¿åå¼ï¼å¯ææ¬åºåç *boundingClientRect* ç»æä½ï¼å
å«å¤§å°ä½ç½®ä¿¡æ¯ |
| | | ç¨éï¼æ¤æ¶è¿è¡ [éç¹è·³è½¬](advanced/api#navigateTo) å¯ä»¥åºæ¬ä¿è¯è·³è½¬ä½ç½®æ£ç¡® |
| | | |
| | | ?> å¦æè®¾ç½®äº [æå è½½](basic/prop#lazy-load)ï¼æ¤æ¶è¿åç大å°ä¸ä¸å®æ¯æç»å¤§å°ï¼å¦æéè¦å®æ¶ç大å°ï¼å¯ä»¥è°ç¨ [getRect](advanced/api#getRect) æ¹æ³ |
| | | |
| | | ## error |
| | | è§¦åæ¶æºï¼åçæ¸²æéè¯¯æ¶ |
| | | è¿åå¼ï¼ä¸ä¸ª *object*ï¼å
¶ä¸ *source* 为éè¯¯æ¥æºï¼å
æ¬ *img*ã*video*ã*audio*ï¼ï¼*attrs* 为该æ ç¾ç屿§å表ï¼å
å« *src* çä¿¡æ¯ï¼ï¼*errMsg* æ¯éè¯¯ä¿¡æ¯ |
| | | ç¨éï¼æ¶éé误信æ¯ï¼åå°ä½¿ç¨åºéçé«ç龿¥ |
| | | |
| | | ## imgtap |
| | | è§¦åæ¶æºï¼å¾ç被ç¹å»æ¶ |
| | | è¿åå¼ï¼è¯¥ *img* æ ç¾ç屿§å表 |
| | | ç¨éï¼ |
| | | é»è®¤æ
åµä¸å¾ç被ç¹å»æ¶å°èªå¨é¢è§ï¼å
·ä½å¤çå¯è§ [å¾çææ](overview/feature#img)ï¼ï¼å¦æä¸å¸æå¦æ¤ï¼å¯å° [preview-img](basic/prop#preview-img) 屿§è®¾ç½®ä¸º *false* å¹¶å¨è¿éèªå®ä¹å¤ç |
| | | 妿éè¦ç¨å°å¯ææ¬ä¸ææå¾ççæ°ç»ï¼å¯ä»¥éè¿ [imgList](advanced/api#imgList) ç *api* è·å |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | Page({ |
| | | imgtap (e) { |
| | | // 对åäºæç§æ è®°çå¾çè¿è¡é¢è§ |
| | | if (e.detail['data-flag']) { |
| | | wx.previewImage({ |
| | | urls: [e.detail.src] // ä»
é¢è§åå¼ å¾ç |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | ## linktap |
| | | è§¦åæ¶æºï¼é¾æ¥è¢«ç¹å»æ¶ |
| | | è¿åå¼ï¼è¯¥ *a* æ ç¾ç屿§å表 |
| | | |
| | | ?> [2.0.5](changelog/changelog#v205) çæ¬èµ·å¢å è¿å该æ ç¾å
é¨ææ¬ *innerText* |
| | | |
| | | ç¨éï¼ |
| | | é»è®¤æ
åµä¸é¾æ¥è¢«ç¹å»æ¶ï¼å¯¹äºå¤é¨é¾æ¥ï¼å°è¢«æ·è´å°åªè´´æ¿ï¼å¦æä¸å¸æå¦æ¤ï¼å¯ä»¥å° [copy-link](basic/prop#copy-link) 屿§çå¼è®¾ç½®ä¸º *false* åå¨è¿éèªå®ä¹å¤çï¼å¯åè以䏿¹æ¡ï¼ |
| | | |
| | | 1. 跳转 *web-view* |
| | | 跳转å°ä¸ä¸ªæ°ç页é¢ï¼è¯¥é¡µé¢æ¾ç½®ä¸ä¸ª [web-view](https://developers.weixin.qq.com/miniprogram/dev/component/web-view.html) ç¨äºæ¾ç¤ºå¤é¨ç½é¡µï¼éè¦æ³¨æ *web-view* ç使ç¨éå¶ï¼ |
| | | 2. 跳转å
¶ä»å°ç¨åº |
| | | 对äºå
¶ä»å°ç¨åºç龿¥ï¼å¯éè¿èªè¡è®¾ç½®ç *data-* 屿§å¤æï¼ï¼éè¿ [navigateToMiniProgram](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateToMiniProgram.html) æ¥å£è·³è½¬ï¼éè¦æ³¨æè·³è½¬éå¶ï¼ |
| | | 3. ä¸è½½ææ¡£ |
| | | å¯¹äºææ¡£ç±»ç龿¥ï¼å¯éè¿åç¼åæèªè¡è®¾ç½®ç *data-* 屿§å¤æï¼ï¼å¯ä»¥éè¿ [downloadFile](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/wx.downloadFile.html) æ¥å£ä¸è½½æä»¶åéè¿ [openDocument](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.openDocument.html) æ¥å£æå¼ææ¡£ï¼éè¦æ³¨æä¸è½½ååéå¶ï¼ |
| | | 4. ä¸è½½å缩å
|
| | | 对äºå缩å
ç±»ç龿¥ï¼å¯éè¿åç¼åæèªè¡è®¾ç½®ç *data-* 屿§å¤æï¼ï¼å¯ä»¥éè¿ [downloadFile](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/wx.downloadFile.html) æ¥å£ä¸è½½æä»¶åéè¿ [FileSystemManager.unzip](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unzip.html) æ¥å£è§£åï¼ç¶åè¿è¡æå¼ææ¡£çæä½ï¼éè¦æ³¨æä¸è½½ååéå¶ï¼ |
| | | 对äºå¤§æä»¶ï¼å¯éè¿ *data-* 屿§æ 注ï¼ï¼è¿å¯ä»¥å¨ä¸è½½åè¿è¡è¯¢é®ï¼ä¸è½½è¿ç¨ä¸éè¿ [DownloadTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.html) æç¤ºä¸è½½è¿åº¦ç |
| | | |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | Page({ |
| | | linktap (e) { |
| | | if (e.detail.href.includes('.doc')) { |
| | | // ä¸è½½ doc æä»¶ |
| | | wx.downloadFile({ |
| | | url: e.detail.href, |
| | | success (res) { |
| | | wx.hideLoading() |
| | | wx.openDocument({ |
| | | filePath: res.tempFilePath |
| | | }) |
| | | }, |
| | | fail (err) { |
| | | wx.hideLoading() |
| | | wx.showModal({ |
| | | title: '失败', |
| | | content: err.errMsg, |
| | | showCancel: false |
| | | }) |
| | | } |
| | | }) |
| | | } else if (e.detail.href.includes('xxx.com')) { |
| | | // è·³è½¬å° webview |
| | | wx.navigateTo({ |
| | | url: 'pages/webview/webview?url=' + e.detail.href, |
| | | }) |
| | | } else if (e.detail['data-appid']) { |
| | | // 跳转å
¶ä»å°ç¨åº |
| | | wx.navigateToMiniProgram({ |
| | | appId: e.detail['data-appid'] |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | ## play |
| | | |
| | | ?> [2.3.0](changelog/changelog#v230) çæ¬èµ·æ¯æ |
| | | |
| | | è§¦åæ¶æºï¼é³è§é¢ææ¾æ¶ |
| | | è¿åå¼ï¼æ |
| | | |
| | | ?> [2.5.0](changelog/changelog#v250) çæ¬èµ·è¿åå¼åæ´ä¸ºä¸ä¸ª *object*ï¼å
¶ä¸ *source* ä¸ºææ¾æ¥æºï¼å
æ¬ *video*ã*audio*ï¼ï¼*attrs* 为该æ ç¾ç屿§å表ï¼å
å« *src* çä¿¡æ¯ï¼ï¼å¯ä»¥ç»è®¡ææ¾éçä¿¡æ¯ |
| | | |
| | | ç¨éï¼å [pauseMedia](advanced/api#pauseMedia) ç `api` é
åå¯ä»¥å®ç°ä¸é¡µé¢ä¸å
¶ä»é³è§é¢è¿è¡äºæ¥ææ¾ |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | Page({ |
| | | // 页é¢ä¸çé³è§é¢ææ¾äºä»¶ |
| | | pagePlay() { |
| | | // ctx 为ç»ä»¶å®ä¾ |
| | | ctx.pauseMedia() // æåç»ä»¶å
çé³è§é¢ææ¾ |
| | | }, |
| | | // ç»ä»¶ç play äºä»¶ |
| | | componentPlay() { |
| | | // media 为页é¢ä¸çé³è§é¢å®ä¾ |
| | | media.pause() // æå页é¢ä¸çé³è§é¢ææ¾ |
| | | } |
| | | }) |
| | | ``` |
New file |
| | |
| | | # ð¨ 屿§ :id=prop |
| | | |
| | | !> éè¦å°æä¸ªå±æ§è®¾ç½®ä¸º *false* æ¶ï¼åºåä½ *attr="{{false}}"* |
| | | |
| | | ## container-style |
| | | |
| | | ?> [2.1.0](changelog/changelog#v210) çæ¬èµ·æ¯æ |
| | | |
| | | åè½ï¼è®¾ç½®å®¹å¨çæ ·å¼ |
| | | ç±»åï¼*String* |
| | | 示ä¾ï¼ |
| | | ```css |
| | | padding: 5px; /* 设置å
è¾¹è· */ |
| | | font-size: 18px; /* 设置é»è®¤çåä½å¤§å° */ |
| | | overflow: hidden; /* ç¦ç¨æ¨ªåæ»å¨ */ |
| | | display: inline; /* è¡å
æ¾ç¤º */ |
| | | white-space: pre-wrap; /* ä¿çç©ºæ ¼åæ¢è¡ç¬¦ */ |
| | | white-space: pre-line; /* ä¿çæ¢è¡ç¬¦ */ |
| | | ``` |
| | | |
| | | ## content |
| | | åè½ï¼ç¨äºæ¸²æç *html* å符串 |
| | | ç±»åï¼*String* |
| | | |
| | | ## copy-link |
| | | åè½ï¼æ¯å¦å
许å¤é¨é¾æ¥è¢«ç¹å»æ¶èªå¨å¤å¶ |
| | | ç±»åï¼*Boolean* |
| | | é»è®¤å¼ï¼*true* |
| | | |
| | | ?> å¯¹äº *uni-app* ç *h5* å *app* å¹³å°ï¼å¤é¾æ¯è½å¤ç´æ¥è·³è½¬çï¼è¿ç§æ
åµä¸å¦æè¯¥å±æ§ä¸º *true* åç´æ¥è·³è½¬å¤é¾ï¼è䏿¯å¤å¶é¾æ¥ï¼ï¼ä¸º *false* åä¸è·³è½¬ |
| | | |
| | | ## domain |
| | | åè½ï¼ä¸»ååï¼ç¨äºé¾æ¥æ¼æ¥ï¼ |
| | | ç±»åï¼*String* |
| | | 示ä¾ï¼ |
| | | ```html |
| | | <!-- å设 domain 屿§è¢«è®¾ç½®ä¸º https://example.com |
| | | 以ä¸é¾æ¥åä¼è¢«æ¼æ¥ä¸º https://example.com/path --> |
| | | <img src="//example.com/path" /> |
| | | <img src="/path" /> |
| | | <div style="background-image:url('path')"></div> |
| | | ``` |
| | | |
| | | ?> éè¿ *base* æ ç¾ä¹å¯ä»¥è®¾ç½®ä¸»ååï¼ä½ä¼å
级ä½äºæ¤å±æ§ |
| | | |
| | | !> è¯¥å±æ§å¿
须填å åè®®å://åå ç宿´é¾æ¥ |
| | | æä¸æ¯ææ¼æ¥å«æ *../* çç¸å¯¹è·¯å¾é¾æ¥ |
| | | *a* æ ç¾ç *href* 屿§å¯è½éè¦è·³è½¬å°å°ç¨åºå
è·¯å¾ï¼å æ¤ä¸è¿è¡ *domain* æ¼æ¥ |
| | | è®¾ç½®è¯¥å±æ§åå°æ æ³ä½¿ç¨æ¬å°å¾ç |
| | | |
| | | ## error-img |
| | | åè½ï¼å¾çåºéæ¶çå ä½å¾é¾æ¥ |
| | | ç±»åï¼*String* |
| | | |
| | | !> è¯¥å±æ§ä¸ä¼è¿è¡æ¼æ¥ [domain](#domain)ï¼éä¼ å
¥å®æ´è·¯å¾ï¼å¯ä»¥ä½¿ç¨æ¬å°è·¯å¾ï¼ |
| | | |
| | | ## lazy-load |
| | | åè½ï¼æ¯å¦å¼å¯å¾çæå è½½ |
| | | ç±»åï¼*Boolean* |
| | | é»è®¤å¼ï¼*false* |
| | | |
| | | ?> ä¸å平尿å è½½çæ¶æºä¸åï¼å
·ä½åèåå¹³å° *image* ç»ä»¶æå è½½çæ¶æº |
| | | |
| | | ## loading-img |
| | | åè½ï¼å¾çå è½½è¿ç¨ä¸çå ä½å¾é¾æ¥ |
| | | ç±»åï¼*String* |
| | | |
| | | !> è¯¥å±æ§ä¸ä¼è¿è¡æ¼æ¥ [domain](#domain)ï¼éä¼ å
¥å®æ´è·¯å¾ï¼å¯ä»¥ä½¿ç¨æ¬å°è·¯å¾ï¼ |
| | | |
| | | ## pause-video |
| | | åè½ï¼æ¯å¦å¨ææ¾ä¸ä¸ªè§é¢æ¶èªå¨æåå
¶ä»è§é¢ |
| | | ç±»åï¼*Boolean* |
| | | é»è®¤å¼ï¼*true* |
| | | |
| | | ?> 妿éè¦å¤ä¸ªè§é¢åæ¶ææ¾çï¼è¯·å°æ¤å±æ§è®¾ç½®ä¸º *false* |
| | | |
| | | ## preview-img |
| | | åè½ï¼æ¯å¦å
许å¾ç被ç¹å»æ¶èªå¨é¢è§ |
| | | ç±»åï¼*Boolean* |
| | | é»è®¤å¼ï¼*true* |
| | | |
| | | ?> èªå¨é¢è§å
è®¸å·¦å³æ»å¨æ¥çææå¾çï¼å¦æä¸å¸æå¦æ¤å¯ä»¥ç¦ç¨èªå¨é¢è§å¹¶å¨ [imgtap](basic/event#imgtap) äºä»¶ä¸èªè¡å¤ç |
| | | |
| | | !> é»è®¤æ
åµä¸ *base64* å¾çæ æ³ç¹å»é¢è§ï¼[2.5.0](changelog/changelog#v250) çæ¬èµ·æ¯æå°æ¬å±æ§è®¾ç½®ä¸º *"all"* å¼å¯ *base64* å¾ççé¢è§ï¼ä½éè¦æ³¨æåå¹³å° *previewImage* ç *api* 对 *base64* å¾çæ¯æåº¦ä¸é«ï¼éå
åæµè¯å使ç¨ï¼å¦ææ æ³é¢è§ï¼å¯åè [imgList](advanced/api#imgList) ä¸çæ¹æ³è¿è¡è½¬å |
| | | |
| | | ## scroll-table |
| | | åè½ï¼æ¯å¦ç»æ¯ä¸ªè¡¨æ ¼æ·»å ä¸ä¸ªæ»å¨å±ä½¿å
¶è½åç¬æ¨ªåæ»å¨ |
| | | ç±»åï¼*Boolean* |
| | | é»è®¤å¼ï¼*false* |
| | | |
| | | !> å¦æè¡¨æ ¼è®¾ç½®äº *inline* å¸å±ï¼è¯¥å±æ§å°ä¸ä¼çæä»¥å
ç ´åè¡å
å¸å± |
| | | |
| | | ## selectable |
| | | åè½ï¼æ¯å¦å¼å¯ææ¬é¿æå¤å¶ |
| | | ç±»åï¼*Boolean* / *String* |
| | | é»è®¤å¼ï¼*false* |
| | | |
| | | !> å°æ¬å±æ§çå¼è®¾ç½®ä¸º *true* å¨å¾®ä¿¡ *iOS* 端å¯è½å¤±æï¼[2.0.5](changelog/changelog#v205) çæ¬èµ·æ¯æå°æ¬å±æ§è®¾ç½®ä¸º "*force*" æ¥æ¯æï¼ä½ä¼å¸¦æ¥ä»¥ä¸å½±åï¼ |
| | | 1ãææææ¬å伿¾ç¤ºä¸º *inline-block*ï¼éè¿ [text](https://developers.weixin.qq.com/miniprogram/dev/component/text.html) æ ç¾ç *user-select* 屿§å®ç°ï¼ï¼éè¦èªè¡éé
|
| | | 2ãæåä¸å线ãå é¤çº¿çææå°å¤±æï¼[详ç»](https://github.com/jin-yufeng/mp-html/issues/382)ï¼ |
| | | 3ãææææ¬å齿 æ³è¢« *rich-text* å
å«ï¼ä¸å®ç¨åº¦ä¸å¢å æ ç¾æ°ï¼åæ
¢æ¸²æé度 |
| | | ä» [2.3.1](changelog/changelog#v231) çæ¬èµ·å¯¹æ¤é®é¢è¿è¡ä¼åï¼éè¿ [rich-text](https://developers.weixin.qq.com/miniprogram/dev/component/rich-text.html) æ ç¾ç *user-select* 屿§å®ç°ï¼åºç¡åº *2.24.0* å以ä¸çæï¼ï¼ç¬¬ *3* 个é®é¢å·²è§£å³ï¼ç¬¬ *1*ã*2* 个é®é¢é¨åæ
åµä¸è¿ä¼åå¨ |
| | | |
| | | ## set-title |
| | | åè½ï¼æ¯å¦å° *title* æ ç¾çå
容设置å°é¡µé¢æ é¢ |
| | | ç±»åï¼*Boolean* |
| | | é»è®¤å¼ï¼*true* |
| | | |
| | | ## show-img-menu |
| | | |
| | | ?> [2.3.0](changelog/changelog#v230) çæ¬èµ·æ¯ææ§å¶é¢è§æ¶æ¯å¦é¿ææ¾ç¤ºèåï¼ä»
微信ãç¾åº¦å°ç¨åºææï¼ |
| | | |
| | | åè½ï¼æ¯å¦å
许å¾çè¢«é¿ææ¶æ¾ç¤ºèå |
| | | ç±»åï¼*Boolean* |
| | | é»è®¤å¼ï¼*true* |
| | | |
| | | !> è¯¥å±æ§ç®åä»
微信ãç¾åº¦å *uni-app* ç *app* 平尿æ |
| | | |
| | | ## tag-style |
| | | åè½ï¼è®¾ç½®æ ç¾çé»è®¤æ ·å¼ |
| | | ç±»åï¼*Object* |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | // æ ¼å¼ä¸º æ ç¾å: æ ·å¼ |
| | | { |
| | | a: 'color:red' // a æ ç¾é»è®¤ä¸ºçº¢è² |
| | | } |
| | | ``` |
| | | |
| | | ?> è¯¥å±æ§éååºå¼ï¼éè¦å¨è®¾ç½® [content](#content) 屿§å设置æè½çæï¼å¨æä¿®æ¹ä¸è½å®æ¶çæ |
| | | |
| | | !> è¯¥å±æ§çåçæ¯è§£æå°åæ ç¾çå
è *style* 屿§ä¸å»ï¼å¦æå¯¹ç¹å«å¸¸ç¨çæ ç¾è®¾ç½®é»è®¤æ ·å¼ï¼å°å¤§å¤§å 大解æç»æå¤§å°ï¼åæ
¢æ¸²æé度ï¼è¿ç§æ
åµä¸å»ºè®®éè¿ [å¤é¨æ ·å¼](overview/quickstart#setting) å¼å
¥ |
| | | |
| | | ## use-anchor |
| | | åè½ï¼æ¯å¦ä½¿ç¨éç¹é¾æ¥ |
| | | ç±»åï¼*Boolean* / *Number* |
| | | é»è®¤å¼ï¼*false* |
| | | |
| | | ?> ä¼ å
¥ä¸ä¸ªæ°åæ¶è¡¨ç¤ºè·³è½¬éç¹çåç§»éï¼åä½ *px*ï¼ |
| | | |
| | | ?> å¼å¯è¯¥å±æ§ä¼å°ææè®¾ç½®äº *id* 屿§çæ ç¾é½æ´é²åºæ¥ï¼ä¸å®ç¨åº¦ä¸åæ
¢æ¸²æé度ï¼éå¿
è¦ä¸è¦å¼å¯ |
New file |
| | |
| | | # ð æ´æ°æ¥å¿ :id=changelog |
| | | |
| | | ## v2.5.1 |
| | | å叿¶é´ï¼*2025-04-20* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `U` `uni-app` å
éé
鸿è `APP` [详ç»](https://github.com/jin-yufeng/mp-html/issues/615) |
| | | 2. `U` 微信å°ç¨åºæ¿æ¢åºå¼ `api` `getSystemInfoSync` [详ç»](https://github.com/jin-yufeng/mp-html/issues/613) |
| | | 3. `F` ä¿®å¤äºå¾®ä¿¡å°ç¨åº `glass-easel` æ¡æ¶ä¸çæºæ¢è¡å¼å¸¸çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/pull/607) by [@PaperStrike](https://github.com/PaperStrike) |
| | | 4. `F` ä¿®å¤äº `uni-app` å
`app` ç«¯ææ¾è§é¢å¯è½æ¥éçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/617) |
| | | 5. `F` ä¿®å¤äº [latex](advanced/plugin#latex) æä»¶å¯è½åºç° `xxx can be used only in display mode` çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/632) |
| | | 6. `F` ä¿®å¤äº `uni-app` å
[latex](advanced/plugin#latex) å
¬å¼å¯è½ä¸æ¾ç¤ºçé®é¢ [#599](https://github.com/jin-yufeng/mp-html/issues/599)ã[#627](https://github.com/jin-yufeng/mp-html/issues/627) |
| | | |
| | | ## v2.5.0 |
| | | å叿¶é´ï¼*2024-04-22* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `U` [play](basic/event#play) äºä»¶å¢å è¿å `src` çä¿¡æ¯ [详ç»](https://github.com/jin-yufeng/mp-html/issues/526) |
| | | 2. `U` [preview-img](basic/prop#preview-img) 屿§æ¯æè®¾ç½®ä¸º `all` å¼å¯ `base64` å¾çé¢è§ [详ç»](https://github.com/jin-yufeng/mp-html/issues/536) |
| | | 3. `U` [editable](advanced/plugin#editable) æä»¶å¢å ç®ææ¨¡å¼ï¼ç¹å»æåç´æ¥ç¼è¾ï¼ |
| | | 4. `U` [latex](advanced/plugin#latex) æä»¶æ¯æå级å
¬å¼ [详ç»](https://github.com/jin-yufeng/mp-html/issues/582) |
| | | 5. `F` ä¿®å¤äºè¡¨æ ¼é¨åæ
åµä¸èæ¯ä¸¢å¤±çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/587) |
| | | 6. `F` ä¿®å¤äºé¨å `svg` æ æ³æ¾ç¤ºçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/591) |
| | | 7. `F` ä¿®å¤äº `uni-app` å
`h5` å `app` 端é¨åæ
åµä¸æ ·å¼æ æ³è¯å«çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/518) |
| | | 8. `F` ä¿®å¤äº [latex](advanced/plugin#latex) æä»¶é¨åæ
åµä¸æ¾ç¤ºä¸æ£ç¡®çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/580) |
| | | 9. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶è¡¨æ ¼æ æ³å é¤çé®é¢ |
| | | 10. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶ `uni-app` å
`vue3` `h5` 端ç¹å»å¾çæ¥éçé®é¢ |
| | | 11. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶ `uni-app` å
ç¹å»è¡¨æ ¼æ²¡æèåæ çé®é¢ |
| | | |
| | | ## v2.4.3 |
| | | å叿¶é´ï¼*2024-01-21* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` å¢å [card](advanced/plugin#card) æä»¶ [详ç»](https://github.com/jin-yufeng/mp-html/pull/533) by [@whoooami](https://github.com/whoooami) |
| | | 2. `F` ä¿®å¤äº `svg` ä¸å
å« `foreignobject` å¯è½ä¸æ¾ç¤ºçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/523) |
| | | 3. `F` ä¿®å¤äºåå¹¶åå
æ ¼çè¡¨æ ¼é¨åæ
åµä¸æ¾ç¤ºä¸æ£ç¡®çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/561) |
| | | 4. `F` ä¿®å¤äº `img` æ ç¾è®¾ç½® `object-fit` æ æçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/567) |
| | | 5. `F` ä¿®å¤äº [latex](advanced/plugin#latex) æä»¶å
¬å¼ä¼æ¢è¡çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/540) |
| | | 6. `F` ä¿®å¤äº `uni-app` å
[editable](advanced/plugin#editable) å [audio](advanced/plugin#audio) æä»¶å
±ç¨æ¶ç¹å» `audio` æ æ³ç¼è¾çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/529) by [@whoooami](https://github.com/whoooami) |
| | | 7. `F` ä¿®å¤äºæ¯ä»å®å°ç¨åºè®¾ç½®äºå®½é«çå¾çå¯è½æ¾ç¤ºä¸æ£å¸¸çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/544) |
| | | 8. `F` ä¿®å¤äº `uni-app` å
微信å°ç¨åºé¨åæ
åµä¸å¾ç伿¥é `replace of undefined` çé®é¢ |
| | | 9. `F` ä¿®å¤äº `uni-app` å
å¿«æå°ç¨åºå¾ç䏿¾ç¤ºçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/571) |
| | | |
| | | ## v2.4.2 |
| | | å叿¶é´ï¼*2023-05-14* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` [editable](advanced/plugin#editable) æä»¶æ¯æä¿®æ¹æåé¢è² [详ç»](https://github.com/jin-yufeng/mp-html/issues/254) |
| | | 2. `F` ä¿®å¤äº `svg` 䏿 `style` ä¸çæçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/505) |
| | | 3. `F` ä¿®å¤äº `uni-app` å
ä½¿ç¨æ§çç¼è¯å¨å¯è½æ¥é `Bad attr nodes` çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/472) |
| | | 4. `F` ä¿®å¤äº `uni-app` å
`app` 端å¯è½åºç°æ æ³è¯»å `lazyLoad` çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/513) |
| | | 5. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶å¨ç¹å»æ¢å¾æ¶æªæ¼æ¥ [domain](basic/prop#domain) çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/pull/497) by [@TwoKe945](https://github.com/TwoKe945) |
| | | 6. `F` ä¿®å¤äº [latex](advanced/plugin#latex) æä»¶é¨åæ
åµä¸ä¸æ¾ç¤ºçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/515) |
| | | 7. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶ç¹å»é³è§é¢æ¶å
¶ä»æ ç¾æ¡ä¸æ¶å¤±çé®é¢ |
| | | |
| | | ## v2.4.1 |
| | | å叿¶é´ï¼*2022-12-25* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `F` ä¿®å¤äºæ²¡æå¾çæ¶ [ready](basic/event#ready) äºä»¶å¯è½ä¸è§¦åçé®é¢ |
| | | 2. `F` ä¿®å¤äºå è½½è¿ç¨ä¸å¯è½åºç° `Root label not found` é误çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/470) |
| | | 3. `F` ä¿®å¤äº [audio](advanced/plugin#audio) æä»¶éåºé¡µé¢å¯è½ä¼æ¥éçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/457) |
| | | 4. `F` ä¿®å¤äº `uni-app` å
`vue3` è¿è¡å° `app` å¨ `HBuilder X 3.6.10` 以䏿¥éçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/480) |
| | | 5. `F` ä¿®å¤äºåçå
龿¥å
æå¾çæ¶å¯è½é误æ¢è¡çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/464) |
| | | 6. `F` ä¿®å¤äº `uni-app` å
`nvue` ç«¯é¾æ¥ä¸å
å« `%22` æ¶å¯è½æ æ³æ¾ç¤ºçé®é¢ |
| | | 7. `F` ä¿®å¤äº `uni-app` å
`vue3` ä½¿ç¨ [highlight](advanced/plugin#highlight) æä»¶å¯è½æ¥éçé®é¢ |
| | | 8. `F` ä¿®å¤äºå¤´æ¡å°ç¨åºä½¿ç¨ [editable](advanced/plugin#editable) æä»¶å
容为空æ¶ç¹å»ä¼æ¥éçé®é¢ |
| | | |
| | | ## v2.4.0 |
| | | å叿¶é´ï¼*2022-08-27* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` å¢å äº [setPlaybackRate](advanced/api#setPlaybackRate) ç `api`ï¼å¯ä»¥è®¾ç½®é³è§é¢çææ¾éç [详ç»](https://github.com/jin-yufeng/mp-html/issues/452) |
| | | 2. `A` 示ä¾å°ç¨åºä»£ç 弿º [详ç»](https://github.com/jin-yufeng/mp-html-demo) |
| | | 3. `U` ä¼å [ready](basic/event#ready) äºä»¶è§¦åæ¶æºï¼æªè®¾ç½®æå è½½çæ
åµä¸åºæ¬å¯ä»¥å确触å [详ç»](https://github.com/jin-yufeng/mp-html/issues/195) |
| | | 4. `U` [highlight](advanced/plugin#highlight) æä»¶å¨ç¼è¾ç¶æä¸ä¸è¿è¡é«äº®å¤çï¼ä¾¿äºç¼è¾ |
| | | 5. `F` ä¿®å¤äº `flex` å¸å±ä¸å¾ç大å°å¯è½ä¸æ£ç¡®çé®é¢ |
| | | 6. `F` ä¿®å¤äº [selectable](basic/prop#selectable) 屿§æ²¡æè®¾ç½® `force` ä¹å¯è½åºç°æ¸²æå¼å¸¸çé®é¢ |
| | | 7. `F` ä¿®å¤äºè¡¨æ ¼ä¸çå¾ç大å°å¯è½ä¸æ£ç¡®çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/448) |
| | | 8. `F` ä¿®å¤äºå«æåå¹¶åå
æ ¼çè¡¨æ ¼å¯è½æ æ³è®¾ç½®ç«ç´å¯¹é½çé®é¢ |
| | | 9. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶å¨ `scroll-view` ä¸ä½¿ç¨æ¶å·¥å
·æ¡ä½ç½®å¯è½ä¸æ£ç¡®çé®é¢ |
| | | 10. `F` ä¿®å¤äº `uni-app` å
`vue3` ä½¿ç¨ [search](advanced/plugin#search) æä»¶å¯è½å¯¼è´é误æ¢è¡çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/449) |
| | | |
| | | ## v2.3.2 |
| | | å叿¶é´ï¼*2022-08-13* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` å¢å [latex](advanced/plugin#latex) æä»¶ï¼å¯ä»¥æ¸²ææ°å¦å
¬å¼ [详ç»](https://github.com/jin-yufeng/mp-html/pull/447) by [@Zeng-J](https://github.com/Zeng-J) |
| | | 2. `U` ä¼åæ ¹èç¹ä¸æå¾å¤æ ç¾çé¿å
容渲æé度 |
| | | 3. `U` [highlight](advanced/plugin#highlight) æä»¶éé
`lang-xxx` æ ¼å¼ |
| | | 4. `F` ä¿®å¤äº `table` æ ç¾è®¾ç½® `border` 屿§åå¯è½æ æ³ä¿®æ¹è¾¹æ¡æ ·å¼çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/pull/439) by [@zouxingjie](https://github.com/zouxingjie) |
| | | 5. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶è¾å
¥è¿ç»ç©ºæ ¼æ æçé®é¢ |
| | | 6. `F` ä¿®å¤äº `uni-app` å
`vue3` å¾ç设置 `inline` 伿¥éçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/438) |
| | | 7. `F` ä¿®å¤äº `uni-app` å
`vue3` ä½¿ç¨ `table` å¯è½æ¥éçé®é¢ |
| | | |
| | | ## v2.3.1 |
| | | å叿¶é´ï¼*2022-05-20* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `U` `uni-app` å
`app` ç«¯æ¯æä½¿ç¨æ¬å°å¾ç |
| | | 2. `U` ä¼åäºå¾®ä¿¡å°ç¨åº [selectable](basic/prop#selectable) 屿§å¨ `ios` 端çå¤ç [详ç»](basic/prop#selectable) |
| | | 3. `U` åçå
åæ¶æ ·å¼é离ï¼é¨åå¹³å°å¯ä»¥ç´æ¥å¼å
¥é¡µé¢æ ·å¼ [#376](https://github.com/jin-yufeng/mp-html/issues/376)ã[详ç»](overview/quickstart#externStyle) |
| | | 4. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶ä¸å¨é¡¶é¨æ¶ `tooltip` ä½ç½®å¯è½é误çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/430) |
| | | 5. `F` ä¿®å¤äº `uni-app` å
`vue3` è¿è¡å°å¾®ä¿¡å°ç¨åºå¯è½æ¥é丢失å
容çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/414) |
| | | 6. `F` ä¿®å¤äº `uni-app` å
`vue3` é¨åæ ç¾å¯è½è¢«é误æ¢è¡çé®é¢ |
| | | 7. `F` ä¿®å¤äºåçå
ä¸ªå«æ
åµä¸å¯è½æ¥éçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/428) |
| | | 8. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶ `uni-app` å
ç `app` 端æå
¥è§é¢æ æ³é¢è§çé®é¢ |
| | | |
| | | ## v2.3.0 |
| | | å叿¶é´ï¼*2022-04-01* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` å¢å äº `play` äºä»¶ï¼é³è§é¢ææ¾æ¶è§¦åï¼å¯ç¨äºä¸é¡µé¢å
¶ä»é³è§é¢è¿è¡äºæ¥ææ¾ [详ç»](basic/event#play) |
| | | 2. `U` [show-img-menu](basic/prop#show-img-menu) 屿§æ¯ææ§å¶é¢è§æ¶æ¯å¦é¿æå¼¹åºèå |
| | | 3. `U` ä¼å `wxs` å¤çï¼æé«æ¸²ææ§è½ [详ç»](https://developers.weixin.qq.com/community/develop/article/doc/0006cc2b204740f601bd43fa25a413) |
| | | 4. `U` `video` æ ç¾æ¯æ `object-fit` 屿§ |
| | | 5. `U` å¢å æ¯æä¸äºå¸¸ç¨å®ä½ç¼ç [详ç»](https://github.com/jin-yufeng/mp-html/issues/418) |
| | | 6. `F` ä¿®å¤äºå¾çä»
设置é«åº¦å¯è½ä¸æ¾ç¤ºçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/410) |
| | | 7. `F` ä¿®å¤äº `video` æ ç¾é«åº¦è®¾ç½®ä¸º `auto` 䏿¾ç¤ºçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/411) |
| | | 8. `F` ä¿®å¤äºä½¿ç¨ `grid` å¸å±æ¶å¯è½æ ·å¼é误çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/413) |
| | | 9. `F` ä¿®å¤äºå«æåå¹¶åå
æ ¼çè¡¨æ ¼é¨åæ
åµä¸æ¾ç¤ºå¼å¸¸çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/417) |
| | | 10. `F` ä¿®å¤äºç¾åº¦å°ç¨åºä½¿ç¨ `br` æ ç¾å¯è½é¨å䏿¾ç¤ºçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/409) |
| | | 11. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶è¿ç»æå
¥å
容æ¶é¡ºåºä¸æ£ç¡®çé®é¢ |
| | | 12. `F` ä¿®å¤äº `uni-app` å
`vue3` ä½¿ç¨ [audio](advanced/plugin#audio) æä»¶æ¥éçé®é¢ |
| | | 13. `F` ä¿®å¤äº `uni-app` å
[highlight](advanced/plugin#highlight) æä»¶ä½¿ç¨èªå®ä¹ç `prism.min.js` æ¥éçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/416) |
| | | |
| | | ## v2.2.2 |
| | | å叿¶é´ï¼*2022-02-26* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` å¢å äº [pauseMedia](advanced/api#pauseMedia) ç `api`ï¼å¯ç¨äºæåææ¾é³è§é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/317) |
| | | 2. `U` ä¼åäºé¿å
容çå è½½é度 |
| | | 3. `U` `uni-app` å
éé
`vue3` [#389](https://github.com/jin-yufeng/mp-html/issues/389)ã[#398](https://github.com/jin-yufeng/mp-html/pull/398) by [@zhouhuafei](https://github.com/zhouhuafei)ã[#400](https://github.com/jin-yufeng/mp-html/issues/400) |
| | | 4. `F` ä¿®å¤äºå°ç¨åºç«¯å¾çé«åº¦è®¾ç½®ä¸ºç¾åæ¯æ¶å¯è½ä¸æ¾ç¤ºçé®é¢ |
| | | 5. `F` ä¿®å¤äº [highlight](advanced/plugin#highlight) æä»¶é¨åæ
åµä¸å¯è½æ¾ç¤ºä¸å®æ´çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/403) |
| | | |
| | | ## v2.2.1 |
| | | å叿¶é´ï¼*2021-12-24* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` [editable](advanced/plugin#editable) æä»¶å¢å ä¸ä¸ç§»å¨æ ç¾åè½ |
| | | 2. `U` [editable](advanced/plugin#editable) æä»¶æ¯æå¨ææ¬ä¸é´å
æ 夿å
¥å
容 |
| | | 3. `F` ä¿®å¤äº `uni-app` å
`nvue` 端设置 `margin` åå¯è½å¯¼è´é«åº¦ä¸æ£ç¡®çé®é¢ |
| | | 4. `F` ä¿®å¤äº [highlight](advanced/plugin#highlight) æä»¶ä½¿ç¨å缩çç `prism.css` å¯è½å¯¼è´èæ¯å¤±æçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/367) |
| | | 5. `F` ä¿®å¤äº `uni-app` å
ç¼è¾ç¶æä¸ä½¿ç¨ [emoji](advanced/plugin#emoji) æä»¶å
容为空æ¶å¯è½æ¥éçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/371) |
| | | 6. `F` ä¿®å¤äºä½¿ç¨ [editable](advanced/plugin#editable) æä»¶åå° [selectable](basic/prop#selectable) 屿§è®¾ç½®ä¸º `force` ä¸çæçé®é¢ |
| | | |
| | | ## v2.2.0 |
| | | å叿¶é´ï¼*2021-10-11* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` å¢å [customElements](overview/quickstart#customelements) é
置项ï¼ä¾¿äºæ·»å èªå®ä¹åè½æ§æ ç¾ [详ç»](https://github.com/jin-yufeng/mp-html/issues/350) |
| | | 2. `A` [editable](advanced/plugin#editable) æä»¶å¢å 忢é³è§é¢èªå¨ææ¾ç¶æçåè½ [详ç»](https://github.com/jin-yufeng/mp-html/pull/341) by [@leeseett](https://github.com/leeseett) |
| | | 3. `A` [editable](advanced/plugin#editable) æä»¶å é¤åªä½æ ç¾æ¶è§¦å `remove` äºä»¶ï¼ä¾¿äºå é¤å·²ä¸ä¼ çæä»¶ |
| | | 4. `U` [editable](advanced/plugin#editable) æä»¶ `insertImg` æ¹æ³æ¯æåæ¶æå
¥å¤å¼ å¾ç [详ç»](https://github.com/jin-yufeng/mp-html/issues/342) |
| | | 5. `U` [editable](advanced/plugin#editable) æå
¥å¾çåé³è§é¢æ¶æ¯ææ¼æ¥ [domian](basic/prop#domain) 主åå |
| | | 6. `F` ä¿®å¤äºå
é¨é¾æ¥åæ°ä¸å
å« `://` æ¶è¢«è®¤ä¸ºæ¯å¤é¨é¾æ¥çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/356) |
| | | 7. `F` ä¿®å¤äºé¨å `svg` æ ç¾åæå±æ§å大å°å䏿£ç¡®æ¶ä¸çæçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/351) |
| | | 8. `F` ä¿®å¤äº `uni-app` å
`nvue` 页é¢è¿è¡å°é `app` 平尿¶å¯è½æ ·å¼é误çé®é¢ |
| | | 9. `D` ç§»é¤äº `ad` é
置项ï¼ç± [customElements](overview/quickstart#customelements) 代æ¿ï¼ |
| | | |
| | | ## v2.1.5 |
| | | å叿¶é´ï¼*2021-08-13* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` å¢å æ¯ææ ç¾ç `dir` 屿§ |
| | | 2. `F` ä¿®å¤äº `ruby` æ ç¾æå䏿¼é³æ²¡æå±
ä¸å¯¹é½çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/325) |
| | | 3. `F` ä¿®å¤äºé³è§é¢æ ç¾å
æ `a` æ ç¾æ¶å¯è½æ æ³ææ¾çé®é¢ |
| | | 4. `F` ä¿®å¤äº [externStyle](overview/quickstart#setting) ä¸ç `class` åå
å«ä¸åçº¿ææ°åæ¶å¯è½å¤±æçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/326) |
| | | 5. `F` ä¿®å¤äº `uni-app` å
`h5` 端å¼å
¥ [externStyle](overview/quickstart#setting) å¯è½ä¸çæçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/326) |
| | | 6. `F` ä¿®å¤äºå¾®ä¿¡åçå
`a` æ ç¾ç `style` ä¸å
å« `inline` æ¶ä¸ååºäºä»¶çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/332) |
| | | |
| | | ## v2.1.4 |
| | | å叿¶é´ï¼*2021-07-14* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `F` ä¿®å¤äº `rt` æ ç¾æ æ³è®¾ç½®æ ·å¼çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/318) |
| | | 2. `F` ä¿®å¤äºè¡¨æ ¼ä¸æåå
æ ¼åæ¶åå¹¶è¡ååæ¶å¯è½æ¾ç¤ºä¸æ£ç¡®çé®é¢ |
| | | 3. `F` ä¿®å¤äº `uni-app` å
ç `app` ç«¯æ æ³å
³éå¾çé¿æèåçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/322) |
| | | 4. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶åªè½æ·»å å¾ç龿¥ä¸è½ä¿®æ¹çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/pull/312) by [@leeseett](https://github.com/leeseett) |
| | | |
| | | ## v2.1.3 |
| | | å叿¶é´ï¼*2021-06-12* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` [editable](advanced/plugin#editable) æä»¶å¢å `insertTable` æ¹æ³ |
| | | 2. `U` [editable](advanced/plugin#editable) æä»¶æ¯æç¼è¾è¡¨æ ¼ä¸ç空ç½åå
æ ¼ [详ç»](https://github.com/jin-yufeng/mp-html/issues/310) |
| | | 3. `F` ä¿®å¤äº [externStyle](overview/quickstart#setting) ä¸ä½¿ç¨ä¼ªç±»å¯è½å¤±æçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/298) |
| | | 4. `F` ä¿®å¤äºå¤ä¸ªç»ä»¶åæ¶ä½¿ç¨æ¶ [tag-style](basic/prop#tag-style) 屿§æ¶å¯è½äºç¸å½±åçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/pull/305) by [@woodguoyu](https://github.com/woodguoyu) |
| | | 5. `F` ä¿®å¤äºå
å« `linearGradient` ç `svg` å¯è½æ æ³æ¾ç¤ºçé®é¢ |
| | | 6. `F` ä¿®å¤äº `uni-app` å
ç¼è¯å°å¤´æ¡å°ç¨åºæ¶å¯è½æ¥éçé®é¢ |
| | | 7. `F` ä¿®å¤äº `uni-app` å
`nvue` 端ä¸è§¦å `click` äºä»¶çé®é¢ |
| | | 8. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶å°¾é¨æå
¥æ¶æ æ³æ¤éçé®é¢ |
| | | 9. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶ç `insertHtml` æ¹æ³åªè½å¨æ«å°¾æå
¥çé®é¢ |
| | | 10. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶æå
¥é³é¢ä¸æ¾ç¤ºçé®é¢ |
| | | |
| | | ## v2.1.2 |
| | | å叿¶é´ï¼*2021-04-24* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` å¢å äº [img-cache](advanced/plugin#img-cache) æä»¶ï¼å¯ä»¥å¨ `uni-app` ç `app` 端ç¼åå¾ç [详ç»](https://github.com/jin-yufeng/mp-html/issues/292) by [@PentaTea](https://github.com/PentaTea) |
| | | 2. `U` æ¯æéè¿ [container-style](basic/prop#container-style) 屿§è®¾ç½® `white-space` æ¥ä¿çè¿ç»ç©ºæ ¼åæ¢è¡ç¬¦ [详ç»](question/faq#space) |
| | | 3. `U` 代ç 飿 ¼ç¬¦å [standard](https://standardjs.com) æ å |
| | | 4. `U` `uni-app` å
ä½¿ç¨ [editable](advanced/plugin#editable) æä»¶ç¼è¾ç¶æä¸æ¯æé¢è§è§é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/286) |
| | | 5. `F` ä¿®å¤äº `svg` æ ç¾å
åµ `svg` æ¶æ æ³æ¾ç¤ºçé®é¢ |
| | | 6. `F` ä¿®å¤äºå¾®ä¿¡åçå
`img` æ ç¾ç `style` ä¸å
å« `inline` æ¶ä¸æ¾ç¤ºçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/287) |
| | | 7. `F` ä¿®å¤äºæ¯ä»å®å头æ¡å°ç¨åºé¨ååºåä¸å¯å¤å¶çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/291) |
| | | |
| | | ## v2.1.1 |
| | | å叿¶é´ï¼*2021-04-09* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `F` ä¿®å¤äºå¯¹ `p` æ ç¾è®¾ç½® [tag-style](basic/prop#tag-style) å¯è½ä¸çæçé®é¢ |
| | | 2. `F` ä¿®å¤äº `svg` æ ç¾ä¸çææ¬æ æ³æ¾ç¤ºçé®é¢ |
| | | 3. `F` ä¿®å¤äº `uni-app` å
ç `nvue` 端ä¸è®¾ç½® [container-style](basic/prop#container-style) å¯è½æ¥éçé®é¢ |
| | | 4. `F` ä¿®å¤äº `uni-app` å
ä½¿ç¨ [editable](advanced/plugin#editable) æä»¶ç¼è¾è¡¨æ ¼æ¶å¯è½æ¥éçé®é¢ |
| | | 5. `F` ä¿®å¤äº `uni-app` å
ä½¿ç¨ [highlight](advanced/plugin#highlight) æä»¶è¿è¡å°å¤´æ¡å°ç¨åºæ¶å¯è½æ²¡ææ ·å¼çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/280) |
| | | 6. `F` ä¿®å¤äº `uni-app` å
ä½¿ç¨ [editable](advanced/plugin#editable) æä»¶ `editable` 屿§ä¸º `false` æ¶ä¼æ¥éçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/284) |
| | | 7. `F` ä¿®å¤äº [style](advanced/plugin#style) æä»¶è¿ç»åéæ©å¨å¤±æçé®é¢ |
| | | 8. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶æ æ³ä¿®æ¹å¾çååä½å¤§å°çé®é¢ |
| | | |
| | | ## v2.1.0 |
| | | å叿¶é´ï¼*2021-03-20* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` å¢å äº [container-style](basic/prop#container-style) 屿§ [详ç»](https://gitee.com/jin-yufeng/mp-html/pulls/1) |
| | | 2. `A` å¢å æ¯æ `strike` æ ç¾ |
| | | 3. `A` `editable` æä»¶å¢å `placeholder` 屿§ [详ç»](advanced/plugin#editable) |
| | | 4. `A` `editable` æä»¶å¢å `insertHtml` æ¹æ³ [详ç»](advanced/plugin#editable) |
| | | 5. `U` å¤é¨æ ·å¼æ¯ææ ç¾åéæ©å¨ [详ç»](overview/quickstart#setting) |
| | | 6. `F` ä¿®å¤äº `uni-app` å
`nvue` 端é¨åæ
åµä¸å¯è½ä¸æ¾ç¤ºçé®é¢ |
| | | |
| | | ## v2.0.5 |
| | | å叿¶é´ï¼*2021-03-12* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `U` [linktap](basic/event#linktap) äºä»¶å¢å è¿åå
鍿æ¬å
容 `innerText` [详ç»](https://github.com/jin-yufeng/mp-html/issues/271) |
| | | 2. `U` [selectable](basic/prop#selectable) 屿§è®¾ç½®ä¸º `force` æ¶è½å¤å¨å¾®ä¿¡ `iOS` 端çæï¼ææ¬åä¼åæ `inline-block`ï¼ [详ç»](https://github.com/jin-yufeng/mp-html/issues/267) |
| | | 3. `F` ä¿®å¤äºé¨åæ
åµä¸ç«åæ æ³æ»å¨çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/182) |
| | | 4. `F` ä¿®å¤äº `uni-app` å
夿¬¡ä¿®æ¹å¯ææ¬æ°æ®æ¶é¨åå
容å¯è½ä¸æ¾ç¤ºçé®é¢ |
| | | 5. `F` ä¿®å¤äºç¾åº¦å°ç¨åºçæºé¨åå
容䏿¾ç¤ºçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/272) |
| | | 6. `F` ä¿®å¤äº [è
¾è®¯è§é¢](advanced/plugin#txv-video) æä»¶å¯è½æ æ³ææ¾çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/265) |
| | | 7. `F` ä¿®å¤äº [highlight](advanced/plugin#highlight) æä»¶æ²¡æè®¾ç½®é«äº®è¯è¨æ¶æ²¡æåºç¨é»è®¤æ ·å¼çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/276) by [@fuzui](https://github.com/fuzui) |
| | | |
| | | ## v2.0.4 |
| | | å叿¶é´ï¼*2021-01-31* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `A` [editable](advanced/plugin#editable) æä»¶å¢å ä¸å线åå¾çè¶
龿¥çåè½ [详ç»](https://github.com/jin-yufeng/mp-html/issues/254) |
| | | 2. `U` æ¯ä»å®å头æ¡å°ç¨åºåçå
ç´æ¥éè¿ `template` éå½å®ç°æ¸²æ |
| | | 3. `F` ä¿®å¤äº `img` æ ç¾è®¾ç½® `data-src` å¯è½å¯¼è´å¾ç䏿¾ç¤ºçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/257) |
| | | 4. `F` ä¿®å¤äº `script` æ ç¾ä¸ç `<` ä¼è¢«è§£æä¸ºæ ç¾çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/259) |
| | | 5. `F` ä¿®å¤äº `uni-app` å
ç `app` ç«¯ææ¾è§é¢æ¶å¯è½é«åº¦çªç¶åå°çé®é¢ |
| | | 6. `F` ä¿®å¤äº `uni-app` å
ç `app` ç«¯é¿æå¾ç伿¥éçé®é¢ |
| | | 7. `F` ä¿®å¤äº `uni-app` å
ç `nvue` ç«¯ä½¿ç¨ [editable](advanced/plugin#editable) æä»¶åæ æ³æ¾ç¤ºçé®é¢ |
| | | 8. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶å é¤å¾çå忢å
容æ¶å¯è½åºç°éè¯¯éæ©æ¡çé®é¢ |
| | | 9. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶æ æ³ç¼è¾é¾æ¥ææ¬å
容çé®é¢ |
| | | |
| | | ## v2.0.3 |
| | | å叿¶é´ï¼*2021-01-15* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `U` å¾ç被ç¹å»æ¶ä¸å泡ï¼å¯ä»¥ä¸æ´ä½çç¹å»åºåå¼ï¼ä¸å½±å龿¥ä¸çå¾çï¼ |
| | | 2. `F` ä¿®å¤äºå¾ç龿¥ç¼ºçåè®®åæ¶å¯è½æ æ³é¢è§çé®é¢ |
| | | 3. `F` ä¿®å¤äºåçå
`video` å `audio` æ ç¾å
æ¾ç½®ææ¬ä¼æ¥éçé®é¢ |
| | | 4. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶æ¸
空å
容æ¶å¼¹çªå¯è½ä¸æ¶å¤±çé®é¢ |
| | | 5. `F` ä¿®å¤äº [highlight](advanced/plugin#highlight) æä»¶é¨åæ
åµä¸æ ·å¼ä¸æ£ç¡®çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/231) |
| | | 6. `F` ä¿®å¤äºææ¡£é¦é¡µè·³è½¬å°å¿«éå¼å§é¡µæ¶ `404` çé®é¢ by [@AnsonZnl](https://github.com/AnsonZnl) |
| | | |
| | | ## v2.0.2 |
| | | å叿¶é´ï¼*2021-01-08* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `U` `uni-app` å
微信端å©ç¨ `virtualHost` å»é¤å¤¹å±ï¼å 快渲æ |
| | | 2. `F` ä¿®å¤äºé¨åæ
åµä¸ `flex` å¸å±æ¾ç¤ºä¸æ£ç¡®çé®é¢ |
| | | 3. `F` ä¿®å¤äºè®¾ç½® [loading-img](basic/prop#loading-img) ä¼å¯¼è´æå 载失æçé®é¢ |
| | | 4. `F` ä¿®å¤äºå¤´æ¡åçå
é¨åæ
åµä¸è¡¨æ ¼æ¾ç¤ºä¸æ£ç¡®çé®é¢ |
| | | 5. `F` ä¿®å¤äº `uni-app` ç `h5` å `app` 端é¨åæä»¶æ ·å¼æ æ³åºç¨çé®é¢ |
| | | 6. `F` ä¿®å¤äº `uni-app` å
没æèªå¨å° `data-src` 设置为 `src` çé®é¢ |
| | | 7. `F` ä¿®å¤äº `uni-app` å
ç `nvue` 端 [getRect](advanced/api#getRect) æ¹æ³æ æ³ä½¿ç¨çé®é¢ |
| | | 8. `F` ä¿®å¤äº `uni-app` å
è¿è¡å°å为快åºç¨å¯è½æ¥éçé®é¢ |
| | | 9. `F` ä¿®å¤äºå¨ä½çæ¬ taro ä¸ä½¿ç¨å¯è½æ æ³æ£ç¡®è§£æçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/248) |
| | | 10. `F` ä¿®å¤äº [highlight](advanced/plugin#highlight) æä»¶ `pre` å `code` ä¹é´æç©ºç½ç¬¦æ¶æ æ³é«äº®çé®é¢ |
| | | 11. `F` ä¿®å¤äº [editable](advanced/plugin#editable) æä»¶æ¸
空å
容åæå
¥å¯è½æ¥éçé®é¢ |
| | | |
| | | ## v2.0.1 |
| | | å叿¶é´ï¼*2021-01-01* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `F` ä¿®å¤äº `a` æ ç¾èªå¨è·³è½¬å°ä¸åå¨é¡µé¢æ¶å¯è½æ¥éçé®é¢ |
| | | 2. `F` ä¿®å¤äºå«åå¹¶åå
æ ¼çè¡¨æ ¼è®¾ç½®å宽å¯è½å¯¼è´æ¾ç¤ºä¸æ£ç¡®çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/239) |
| | | 3. `F` ä¿®å¤äºè¡¨æ ¼ä¸çå¾çå¯è½éä½çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/194) |
| | | 4. `F` ä¿®å¤äºåçå
ä½¿ç¨ [editable](advanced/plugin#editable) æä»¶ç¹å»æ ç¾æ¶å¯è½æ¥éçé®é¢ |
| | | 5. `F` ä¿®å¤äº `uni-app` ç `h5` å `app` 端å¯è½æ æ³ä½¿ç¨ `iframe` å `embed` æ ç¾çé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/245) |
| | | 6. `F` ä¿®å¤äº `uni-app` 使ç¨é¨åæä»¶ä¼æ¥éçé®é¢ [详ç»](https://github.com/jin-yufeng/mp-html/issues/246) |
| | | |
| | | ## v2.0.0 |
| | | å叿¶é´ï¼*2020-12-26* |
| | | ä¸»è¦æ´æ°ï¼ |
| | | 1. `U` éè¿ `gulp` è¿è¡æå»ºï¼èªå¨çæåå¹³å°å缩ç代ç ï¼åå°å¼å
¥å
å¤§å° [详ç»](advanced/develop#pack) |
| | | 2. `U` 没æè®¾ç½® `href` 屿§ç `a` æ ç¾ä¸åºç¨é¾æ¥çæ ·å¼ï¼å¯ä»¥ç¨ä½ä¸è¬æ ç¾çç¹å»å¤ç [详ç»](question/faq#tap) |
| | | 3. `U` æä¾äºç»ä¸çæä»¶æ¥å£ï¼æ©å±æ´å æ¹ä¾¿ï¼ä»£ç é«äº®ã`markdown` çé½å¯ä»¥ç´æ¥éè¿å¼å
¥æä»¶å®ç°ï¼[详ç»](advanced/plugin) |
| | | 4. `U` å®ç°äºç®åçç¼è¾åè½ [详ç»](advanced/plugin#editable) |
| | | 5. `U` æ¯æçæåå¹³å°ç示ä¾é¡¹ç®ï¼ä¾¿äºè°è¯ [详ç»](overview/quickstart#demo) |
| | | 6. `U` åçå
å
±ç¨ä¸ä»½æºä»£ç ï¼æå»ºæ¶è¿è¡èªå¨è½¬æ¢ï¼ï¼æ³¨éæ´å 详ç»ï¼ä¾¿äºäºè§£åç»´æ¤ |
| | | 7. `U` éè¿ `jest` è¿è¡åå
æµè¯ï¼è¿ä¸æ¥ä¿è¯ä»£ç è´¨é [详ç»](advanced/develop#test) |
| | | 8. `U` å»é¤äºä¸äºåä½åè½ï¼è¿ä¸æ¥åå°å
大å°ï¼çº¦ `24.5KB`ï¼ |
| | | 9. `U` åå°äºéå½èç¹æ ï¼å 快渲æé度 |
| | | 10. `U` `uni-app` ç `app` 端使ç¨éåçç `video` æ¾ç¤ºè§é¢ä»¥è§£å³æ æ³åå±å¸¦æ¥çç³»åé®é¢ |
| | | 11. `U` `uni-app` ç `nvue` ç«¯æ¯æéè¿ `bgColor` 屿§è®¾ç½®èæ¯è²ï¼é»è®¤ç½è²ï¼ä¸å¯è®¾ç½®ä¸ºéæï¼ |
| | | 12. `F` ä¿®å¤äº `uni-app` ç `nvue` 端ä»ä¸å¯è§åºåå°å¯è§æ¶å¯è½æ¾ç¤ºä¸æ£ç¡®çé®é¢ |
| | | |
| | | *v1.x* æ´æ°æåï¼ |
| | | - ç»ä»¶è·¯å¾ååç§° |
| | | *parser* -> *mp-html* |
| | | - *npm* å
å |
| | | *parser-wx* -> *mp-html* |
| | | - ç»ä»¶å±æ§ |
| | | æ´åï¼ |
| | | *html* -> [content](basic/prop#content) |
| | | *autopause* -> [pause-video](basic/prop#pause-video) |
| | | *autoscroll* -> [scroll-table](basic/prop#scroll-table) |
| | | *autosetTitle* -> [set-title](basic/prop#set-title) |
| | | ç§»é¤ï¼ |
| | | *compress*, *show-with-animation*, *use-cache* |
| | | æ°å¢ï¼ |
| | | [copy-link](basic/prop#copy-link), [error-img](basic/prop#error-img), [preview-img](basic/prop#preview-img), [show-img-menu](basic/prop#show-img-menu) |
| | | ä¿®æ¹ï¼ |
| | | [use-anchor](basic/prop#use-anchor) æ¯æä¼ å
¥æ°å表示跳转åç§»é |
| | | - ç»ä»¶äºä»¶ |
| | | æ´å *linkpress* -> [linktap](basic/event#linktap) |
| | | ç§»é¤ *parse* äºä»¶ |
| | | *imgtap* å *linktap* äºä»¶ä¸ä¸åè¿å *ignore* æ¹æ³ï¼å¯ä»¥ä½¿ç¨ [preview-img](basic/prop#preview-img) å [copy-link](basic/prop#copy-link) 屿§ç¦ç¨èªå¨é¢è§/æ·è´ |
| | | 龿¥è¢«ç¹å»æ¶ï¼ä¸åæ¯æèªå¨è·³è½¬å
¶ä»å°ç¨åºï¼å¯ä»¥èªè¡å¨ [linktap](basic/event#linktap) äºä»¶ä¸è¿è¡è·³è½¬ |
| | | - api |
| | | [navigateTo](advanced/api#navigateTo) è¿å *Promise*ï¼ä¸åéç¨ *success* å *fail* åè° |
| | | *rect* åæ´ä¸º [getRect](advanced/api#getRect) æ¹æ³ |
| | | ç§»é¤ *getVideoContext* æ¹æ³ |
| | | [imgList](advanced/api#imgList) ä¸åå
å« *setItem* å *each* æ¹æ³ |
| | | - å
¶ä» |
| | | é»è®¤ä¸åæ¯æå¹é
*style* æ ç¾ä¸çæ ·å¼ï¼å¦æéè¦è¯·ä½¿ç¨ [style](advanced/plugin#style) æä»¶ |
| | | ä¸åæ¯æ *base64* å¾çé¢è§ï¼é»è®¤ä¸ºä¸å¯é¢è§çå°å¾çï¼ |
| | | åæ¶äºé
置项ï¼ç¸å
³è§£æé
ç½®å¨ *parser.js* ä¸ï¼*filter* çæ¹æ³ç¨ [æä»¶](advanced/plugin) çæ¹å¼æ¿ä»£ï¼ |
| | | åæ¶äºè§é¢çæå è½½ï¼åºé¿å
å¨ä¸ä¸ªé¡µé¢ä¸ä½¿ç¨è¿å¤è§é¢ï¼ä»¥å
å¡é¡¿ï¼ |
| | | *ad* æ ç¾é»è®¤ä¸æ·»å å°æ¨¡æ¿ï¼è¯¦è§ [个æ§å](overview/quickstart#setting)ï¼ |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="zh"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>å°ç¨åºå¯ææ¬ç»ä»¶</title> |
| | | <link rel="icon" href="assets/logo/logo.ico" type="image/x-icon"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
| | | <meta name="description" content="å°ç¨åºå¯ææ¬ç»ä»¶"> |
| | | <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> |
| | | <link rel="stylesheet" href="lib/vue.css"> |
| | | <script> |
| | | var _hmt = _hmt || []; |
| | | (function () { |
| | | var hm = document.createElement("script") |
| | | hm.src = "https://hm.baidu.com/hm.js?69554d980eb5eb786919e3c3ad37b2ce" |
| | | var s = document.getElementsByTagName("script")[0] |
| | | s.parentNode.insertBefore(hm, s) |
| | | })() |
| | | </script> |
| | | </head> |
| | | <body> |
| | | <div id="app"></div> |
| | | <script> |
| | | window.$docsify = { |
| | | name: 'mp-html', |
| | | repo: 'https://github.com/jin-yufeng/mp-html', |
| | | coverpage: true, |
| | | loadSidebar: true, |
| | | subMaxLevel: 3, |
| | | auto2top: true, |
| | | search: { |
| | | placeholder: 'æç´¢', |
| | | noData: 'æ¾ä¸å°ç»æ' |
| | | } |
| | | } |
| | | // æ¸²ææµè¯å
容 |
| | | function render () { |
| | | document.getElementById("show").srcdoc='<meta name="viewport" content="width=device-width"><style>img{max-width:100%}</style>'+document.getElementById("input").value.replace(/<script[\s\S]+?<\/script>/g, '') |
| | | } |
| | | // æ¸
空æµè¯å
容 |
| | | function reset () { |
| | | document.getElementById("input").value = '' |
| | | document.getElementById("show").srcdoc = '' |
| | | } |
| | | </script> |
| | | <script src="lib/docsify.min.js"></script> |
| | | <script src="lib/search.min.js"></script> |
| | | <script src="lib/prism-bash.min.js"></script> |
| | | </body> |
| | | </html> |
New file |
| | |
| | | !function(){function s(n){var r=Object.create(null);return function(e){var t=c(e)?e:JSON.stringify(e);return r[t]||(r[t]=n(e))}}var o=s(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),l=Object.prototype.hasOwnProperty,y=Object.assign||function(e){for(var t=arguments,n=1;n<arguments.length;n++){var r,i=Object(t[n]);for(r in i)l.call(i,r)&&(e[r]=i[r])}return e};function c(e){return"string"==typeof e||"number"==typeof e}function u(){}function r(e){return"function"==typeof e}function p(e){e=e.match(/^([^:/?#]+:)?(?:\/{2,}([^/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);return"string"==typeof e[1]&&0<e[1].length&&e[1].toLowerCase()!==location.protocol||"string"==typeof e[2]&&0<e[2].length&&e[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host}var h=document.body.clientWidth<=600,i=window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/),n={};function d(e,t){if(void 0===t&&(t=!1),"string"==typeof e){if(void 0!==window.Vue)return b(e);e=t?b(e):n[e]||(n[e]=b(e))}return e}var f=document,g=f.body,m=f.head;function b(e,t){return t?e.querySelector(t):f.querySelector(e)}function k(e,t){return[].slice.call(t?e.querySelectorAll(t):f.querySelectorAll(e))}function v(e,t){return e=f.createElement(e),t&&(e.innerHTML=t),e}function a(e,t){return e.appendChild(t)}function w(e,t){return e.insertBefore(t,e.children[0])}function x(e,t,n){r(t)?window.addEventListener(e,t):e.addEventListener(t,n)}function _(e,t,n){r(t)?window.removeEventListener(e,t):e.removeEventListener(t,n)}function S(e,t,n){e&&e.classList[n?t:"toggle"](n||t)}function e(e,t){void 0===t&&(t=document);var n=t.readyState;if("complete"===n||"interactive"===n)return setTimeout(e,0);t.addEventListener("DOMContentLoaded",e)}var t=Object.freeze({__proto__:null,getNode:d,$:f,body:g,head:m,find:b,findAll:k,create:v,appendTo:a,before:w,on:x,off:_,toggleClass:S,style:function(e){a(m,v("style",e))},documentReady:e}),A=decodeURIComponent,T=encodeURIComponent;function E(e){var t={};return(e=e.trim().replace(/^(\?|#|&)/,""))&&e.split("&").forEach(function(e){e=e.replace(/\+/g," ").split("=");t[e[0]]=e[1]&&A(e[1])}),t}function R(e,t){void 0===t&&(t=[]);var n,r=[];for(n in e)-1<t.indexOf(n)||r.push(e[n]?(T(n)+"="+T(e[n])).toLowerCase():T(n));return r.length?"?"+r.join("&"):""}var O=s(function(e){return/(:|(\/{2}))/g.test(e)}),$=s(function(e){return e.split(/[?#]/)[0]}),F=s(function(e){if(/\/$/g.test(e))return e;e=e.match(/(\S*\/)[^/]+$/);return e?e[1]:""}),C=s(function(e){return e.replace(/^\/+/,"/").replace(/([^:])\/{2,}/g,"$1/")}),L=s(function(e){for(var t=e.replace(/^\//,"").split("/"),n=[],r=0,i=t.length;r<i;r++){var o=t[r];".."===o?n.pop():"."!==o&&n.push(o)}return"/"+n.join("/")});function z(e){return e.split("/").filter(function(e){return-1===e.indexOf("#")}).join("/")}function N(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return C(e.map(z).join("/"))}var M=s(function(e){return e.replace("#","?id=")});function D(e,t){return-1!==e.indexOf(t,e.length-t.length)}var P={};var I=function(e){this.config=e};function j(e){var t=location.href.indexOf("#");location.replace(location.href.slice(0,0<=t?t:0)+"#"+e)}I.prototype.getBasePath=function(){return this.config.basePath},I.prototype.getFile=function(e,t){void 0===e&&(e=this.getCurrentPath());var n,r,i=this.config,o=this.getBasePath(),a="string"==typeof i.ext?i.ext:".md";return e=i.alias?function e(t,n,r){var i=Object.keys(n).filter(function(e){return(P[e]||(P[e]=new RegExp("^"+e+"$"))).test(t)&&t!==r})[0];return i?e(t.replace(P[i],n[i]),n,t):t}(e,i.alias):e,n=e,r=a,e=(e=new RegExp("\\.("+r.replace(/^\./,"")+"|html)$","g").test(n)?n:/\/$/g.test(n)?n+"README"+r:""+n+r)==="/README"+a&&i.homepage||e,e=O(e)?e:N(o,e),t&&(e=e.replace(new RegExp("^"+o),"")),e},I.prototype.onchange=function(e){void 0===e&&(e=u),e()},I.prototype.getCurrentPath=function(){},I.prototype.normalize=function(){},I.prototype.parse=function(){},I.prototype.toURL=function(e,t,n){var r=n&&"#"===e[0],i=this.parse(M(e));if(i.query=y({},i.query,t),e=(e=i.path+R(i.query)).replace(/\.md(\?)|\.md$/,"$1"),r&&(e=(0<(r=n.indexOf("?"))?n.substring(0,r):n)+e),this.config.relativePath&&0!==e.indexOf("/")){n=n.substring(0,n.lastIndexOf("/")+1);return C(L(n+e))}return C("/"+e)};var H=function(r){function e(e){r.call(this,e),this.mode="hash"}return r&&(e.__proto__=r),((e.prototype=Object.create(r&&r.prototype)).constructor=e).prototype.getBasePath=function(){var e=window.location.pathname||"",t=this.config.basePath,e=D(e,".html")?e+"#/"+t:e+"/"+t;return/^(\/|https?:)/g.test(t)?t:C(e)},e.prototype.getCurrentPath=function(){var e=location.href,t=e.indexOf("#");return-1===t?"":e.slice(t+1)},e.prototype.onchange=function(n){void 0===n&&(n=u);var r=!1;x("click",function(e){e="A"===e.target.tagName?e.target:e.target.parentNode;e&&"A"===e.tagName&&!/_blank/.test(e.target)&&(r=!0)}),x("hashchange",function(e){var t=r?"navigate":"history";r=!1,n({event:e,source:t})})},e.prototype.normalize=function(){var e=this.getCurrentPath();if("/"===(e=M(e)).charAt(0))return j(e);j("/"+e)},e.prototype.parse=function(e){void 0===e&&(e=location.href);var t="",n=e.indexOf("#");0<=n&&(e=e.slice(n+1));n=e.indexOf("?");return 0<=n&&(t=e.slice(n+1),e=e.slice(0,n)),{path:e,file:this.getFile(e,!0),query:E(t)}},e.prototype.toURL=function(e,t,n){return"#"+r.prototype.toURL.call(this,e,t,n)},e}(I),q=function(t){function e(e){t.call(this,e),this.mode="history"}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.getCurrentPath=function(){var e=this.getBasePath(),t=window.location.pathname;return e&&0===t.indexOf(e)&&(t=t.slice(e.length)),(t||"/")+window.location.search+window.location.hash},e.prototype.onchange=function(n){var r=this;void 0===n&&(n=u),x("click",function(e){var t="A"===e.target.tagName?e.target:e.target.parentNode;t&&"A"===t.tagName&&!/_blank/.test(t.target)&&(e.preventDefault(),t=t.href,-1!==r.config.crossOriginLinks.indexOf(t)?window.open(t,"_self"):window.history.pushState({key:t},"",t),n({event:e,source:"navigate"}))}),x("popstate",function(e){n({event:e,source:"history"})})},e.prototype.parse=function(e){void 0===e&&(e=location.href);var t="",n=e.indexOf("?");0<=n&&(t=e.slice(n+1),e=e.slice(0,n));var r=N(location.origin),n=e.indexOf(r);return-1<n&&(e=e.slice(n+r.length)),{path:e,file:this.getFile(e),query:E(t)}},e}(I),U={};var B=/([^{]*?)\w(?=\})/g,Z={YYYY:"getFullYear",YY:"getYear",MM:function(e){return e.getMonth()+1},DD:"getDate",HH:"getHours",mm:"getMinutes",ss:"getSeconds",fff:"getMilliseconds"};var G,W=Object.hasOwnProperty,V=Object.setPrototypeOf,Y=Object.isFrozen,X=Object.getPrototypeOf,K=Object.getOwnPropertyDescriptor,Fe=Object.freeze,Q=Object.seal,J=Object.create,ee="undefined"!=typeof Reflect&&Reflect,te=(te=ee.apply)||function(e,t,n){return e.apply(t,n)},Fe=Fe||function(e){return e},Q=Q||function(e){return e},ne=(ne=ee.construct)||function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))},Ce=re(Array.prototype.forEach),Le=re(Array.prototype.pop),ze=re(Array.prototype.push),Ne=re(String.prototype.toLowerCase),Me=re(String.prototype.match),De=re(String.prototype.replace),Pe=re(String.prototype.indexOf),Ie=re(String.prototype.trim),je=re(RegExp.prototype.test),He=(G=TypeError,function(){for(var e=arguments,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=e[r];return ne(G,n)});function re(o){return function(e){for(var t=arguments,n=arguments.length,r=Array(1<n?n-1:0),i=1;i<n;i++)r[i-1]=t[i];return te(o,e,r)}}function qe(e,t){V&&V(e,null);for(var n=t.length;n--;){var r,i=t[n];"string"!=typeof i||(r=Ne(i))!==i&&(Y(t)||(t[n]=r),i=r),e[i]=!0}return e}function Ue(e){var t=J(null),n=void 0;for(n in e)te(W,e,[n])&&(t[n]=e[n]);return t}function Be(e,t){for(;null!==e;){var n=K(e,t);if(n){if(n.get)return re(n.get);if("function"==typeof n.value)return re(n.value)}e=X(e)}return function(e){return console.warn("fallback value for",e),null}}var Ze=Fe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ge=Fe(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),We=Fe(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ve=Fe(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ye=Fe(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),Xe=Fe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ke=Fe(["#text"]),Qe=Fe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),Je=Fe(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),et=Fe(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),tt=Fe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),nt=Q(/\{\{[\s\S]*|[\s\S]*\}\}/gm),rt=Q(/<%[\s\S]*|[\s\S]*%>/gm),it=Q(/^data-[\-\w.\u00B7-\uFFFF]/),ot=Q(/^aria-[\-\w]+$/),at=Q(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),st=Q(/^(?:\w+script|data):/i),lt=Q(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function ut(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var pt=function(){return"undefined"==typeof window?null:window},ht=function(e,t){if("object"!==(void 0===e?"undefined":ct(e))||"function"!=typeof e.createPolicy)return null;var n=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(n=t.currentScript.getAttribute(r));var i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}};var ie,oe,ae=function t(e){function c(e){return t(e)}var s=0<arguments.length&&void 0!==e?e:pt();if(c.version="2.3.1",c.removed=[],!s||!s.document||9!==s.document.nodeType)return c.isSupported=!1,c;var l=s.document,o=s.document,u=s.DocumentFragment,n=s.HTMLTemplateElement,p=s.Node,a=s.Element,r=s.NodeFilter,i=s.NamedNodeMap,h=void 0===i?s.NamedNodeMap||s.MozNamedAttrMap:i,d=s.Text,f=s.Comment,g=s.DOMParser,e=s.trustedTypes,i=a.prototype,m=Be(i,"cloneNode"),v=Be(i,"nextSibling"),y=Be(i,"childNodes"),b=Be(i,"parentNode");"function"!=typeof n||(n=o.createElement("template")).content&&n.content.ownerDocument&&(o=n.content.ownerDocument);var k=ht(e,l),w=k&&ee?k.createHTML(""):"",x=o.implementation,_=o.createNodeIterator,S=o.createDocumentFragment,A=o.getElementsByTagName,T=l.importNode,E={};try{E=Ue(o).documentMode?o.documentMode:{}}catch(e){}var R={};c.isSupported="function"==typeof b&&x&&void 0!==x.createHTMLDocument&&9!==E;function O(e){ge&&ge===e||(e&&"object"===(void 0===e?"undefined":ct(e))||(e={}),e=Ue(e),P="ALLOWED_TAGS"in e?qe({},e.ALLOWED_TAGS):I,j="ALLOWED_ATTR"in e?qe({},e.ALLOWED_ATTR):H,le="ADD_URI_SAFE_ATTR"in e?qe(Ue(ce),e.ADD_URI_SAFE_ATTR):ce,ae="ADD_DATA_URI_TAGS"in e?qe(Ue(se),e.ADD_DATA_URI_TAGS):se,ie="FORBID_CONTENTS"in e?qe({},e.FORBID_CONTENTS):oe,q="FORBID_TAGS"in e?qe({},e.FORBID_TAGS):{},U="FORBID_ATTR"in e?qe({},e.FORBID_ATTR):{},$="USE_PROFILES"in e&&e.USE_PROFILES,B=!1!==e.ALLOW_ARIA_ATTR,Z=!1!==e.ALLOW_DATA_ATTR,G=e.ALLOW_UNKNOWN_PROTOCOLS||!1,W=e.SAFE_FOR_TEMPLATES||!1,V=e.WHOLE_DOCUMENT||!1,K=e.RETURN_DOM||!1,Q=e.RETURN_DOM_FRAGMENT||!1,J=!1!==e.RETURN_DOM_IMPORT,ee=e.RETURN_TRUSTED_TYPE||!1,X=e.FORCE_BODY||!1,te=!1!==e.SANITIZE_DOM,ne=!1!==e.KEEP_CONTENT,re=e.IN_PLACE||!1,D=e.ALLOWED_URI_REGEXP||D,de=e.NAMESPACE||he,W&&(Z=!1),Q&&(K=!0),$&&(P=qe({},[].concat(ut(Ke))),j=[],!0===$.html&&(qe(P,Ze),qe(j,Qe)),!0===$.svg&&(qe(P,Ge),qe(j,Je),qe(j,tt)),!0===$.svgFilters&&(qe(P,We),qe(j,Je),qe(j,tt)),!0===$.mathMl&&(qe(P,Ye),qe(j,et),qe(j,tt))),e.ADD_TAGS&&(P===I&&(P=Ue(P)),qe(P,e.ADD_TAGS)),e.ADD_ATTR&&(j===H&&(j=Ue(j)),qe(j,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&qe(le,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(ie===oe&&(ie=Ue(ie)),qe(ie,e.FORBID_CONTENTS)),ne&&(P["#text"]=!0),V&&qe(P,["html","head","body"]),P.table&&(qe(P,["tbody"]),delete q.tbody),Fe&&Fe(e),ge=e)}var $,F=nt,C=rt,L=it,z=ot,N=st,M=lt,D=at,P=null,I=qe({},[].concat(ut(Ze),ut(Ge),ut(We),ut(Ye),ut(Ke))),j=null,H=qe({},[].concat(ut(Qe),ut(Je),ut(et),ut(tt))),q=null,U=null,B=!0,Z=!0,G=!1,W=!1,V=!1,Y=!1,X=!1,K=!1,Q=!1,J=!0,ee=!1,te=!0,ne=!0,re=!1,ie=null,oe=qe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ae=null,se=qe({},["audio","video","img","source","image","track"]),le=null,ce=qe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ue="http://www.w3.org/1998/Math/MathML",pe="http://www.w3.org/2000/svg",he="http://www.w3.org/1999/xhtml",de=he,fe=!1,ge=null,me=o.createElement("form"),ve=qe({},["mi","mo","mn","ms","mtext"]),ye=qe({},["foreignobject","desc","title","annotation-xml"]),be=qe({},Ge);qe(be,We),qe(be,Ve);var ke=qe({},Ye);qe(ke,Xe);function we(t){ze(c.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=w}catch(e){t.remove()}}}function xe(e,t){try{ze(c.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){ze(c.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!j[e])if(K||Q)try{we(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}}function _e(e){var t=void 0,n=void 0;X?e="<remove></remove>"+e:n=(i=Me(e,/^[\r\n\t ]+/))&&i[0];var r=k?k.createHTML(e):e;if(de===he)try{t=(new g).parseFromString(r,"text/html")}catch(e){}if(!t||!t.documentElement){t=x.createDocument(de,"template",null);try{t.documentElement.innerHTML=fe?"":r}catch(e){}}var i=t.body||t.documentElement;return e&&n&&i.insertBefore(o.createTextNode(n),i.childNodes[0]||null),de===he?A.call(t,V?"html":"body")[0]:V?t.documentElement:i}function Se(e){return _.call(e.ownerDocument||e,e,r.SHOW_ELEMENT|r.SHOW_COMMENT|r.SHOW_TEXT,null,!1)}function Ae(e){return"object"===(void 0===p?"undefined":ct(p))?e instanceof p:e&&"object"===(void 0===e?"undefined":ct(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName}function Te(e,t,n){R[e]&&Ce(R[e],function(e){e.call(c,t,n,ge)})}function Ee(e){var t;if(Te("beforeSanitizeElements",e,null),!((n=e)instanceof d||n instanceof f||"string"==typeof n.nodeName&&"string"==typeof n.textContent&&"function"==typeof n.removeChild&&n.attributes instanceof h&&"function"==typeof n.removeAttribute&&"function"==typeof n.setAttribute&&"string"==typeof n.namespaceURI&&"function"==typeof n.insertBefore))return we(e),1;if(Me(e.nodeName,/[\u0080-\uFFFF]/))return we(e),1;var n=Ne(e.nodeName);if(Te("uponSanitizeElement",e,{tagName:n,allowedTags:P}),!Ae(e.firstElementChild)&&(!Ae(e.content)||!Ae(e.content.firstElementChild))&&je(/<[/\w]/g,e.innerHTML)&&je(/<[/\w]/g,e.textContent))return we(e),1;if("select"===n&&je(/<template/i,e.innerHTML))return we(e),1;if(P[n]&&!q[n])return e instanceof a&&!function(e){var t=b(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});var n=Ne(e.tagName),r=Ne(t.tagName);return e.namespaceURI===pe?t.namespaceURI===he?"svg"===n:t.namespaceURI===ue?"svg"===n&&("annotation-xml"===r||ve[r]):Boolean(be[n]):e.namespaceURI===ue?t.namespaceURI===he?"math"===n:t.namespaceURI===pe?"math"===n&&ye[r]:Boolean(ke[n]):e.namespaceURI===he&&(t.namespaceURI!==pe||ye[r])&&(t.namespaceURI!==ue||ve[r])&&(r=qe({},["title","style","font","a","script"]),!ke[n]&&(r[n]||!be[n]))}(e)||("noscript"===n||"noembed"===n)&&je(/<\/no(script|embed)/i,e.innerHTML)?(we(e),1):(W&&3===e.nodeType&&(t=e.textContent,t=De(t,F," "),t=De(t,C," "),e.textContent!==t&&(ze(c.removed,{element:e.cloneNode()}),e.textContent=t)),Te("afterSanitizeElements",e,null),0);if(ne&&!ie[n]){var r=b(e)||e.parentNode,i=y(e)||e.childNodes;if(i&&r)for(var o=i.length-1;0<=o;--o)r.insertBefore(m(i[o],!0),v(e))}return we(e),1}function Re(e,t,n){if(te&&("id"===t||"name"===t)&&(n in o||n in me))return!1;if((!Z||U[t]||!je(L,t))&&(!B||!je(z,t))){if(!j[t]||U[t])return!1;if(!le[t]&&!je(D,De(n,M,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Pe(n,"data:")||!ae[e])&&(!G||je(N,De(n,M,"")))&&n)return!1}return!0}function Oe(e){var t=void 0,n=void 0;Te("beforeSanitizeAttributes",e,null);var r=e.attributes;if(r){for(var i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j},n=r.length;n--;){var o=(l=r[n]).name,a=l.namespaceURI,t=Ie(l.value),s=Ne(o);if(i.attrName=s,i.attrValue=t,i.keepAttr=!0,i.forceKeepAttr=void 0,Te("uponSanitizeAttribute",e,i),t=i.attrValue,!i.forceKeepAttr&&(xe(o,e),i.keepAttr))if(je(/\/>/i,t))xe(o,e);else{W&&(t=De(t,F," "),t=De(t,C," "));var l=e.nodeName.toLowerCase();if(Re(l,s,t))try{a?e.setAttributeNS(a,o,t):e.setAttribute(o,t),Le(c.removed)}catch(e){}}}Te("afterSanitizeAttributes",e,null)}}function $e(e){var t,n=Se(e);for(Te("beforeSanitizeShadowDOM",e,null);t=n.nextNode();)Te("uponSanitizeShadowNode",t,null),Ee(t)||(t.content instanceof u&&$e(t.content),Oe(t));Te("afterSanitizeShadowDOM",e,null)}return c.sanitize=function(e,t){var n,r=void 0,i=void 0,o=void 0;if((fe=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ae(e)){if("function"!=typeof e.toString)throw He("toString is not a function");if("string"!=typeof(e=e.toString()))throw He("dirty is not a string, aborting")}if(!c.isSupported){if("object"===ct(s.toStaticHTML)||"function"==typeof s.toStaticHTML){if("string"==typeof e)return s.toStaticHTML(e);if(Ae(e))return s.toStaticHTML(e.outerHTML)}return e}if(Y||O(t),c.removed=[],"string"==typeof e&&(re=!1),!re)if(e instanceof p)1===(t=(r=_e("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===t.nodeName||"HTML"===t.nodeName?r=t:r.appendChild(t);else{if(!K&&!W&&!V&&-1===e.indexOf("<"))return k&&ee?k.createHTML(e):e;if(!(r=_e(e)))return K?null:w}r&&X&&we(r.firstChild);for(var a=Se(re?e:r);n=a.nextNode();)3===n.nodeType&&n===i||Ee(n)||(n.content instanceof u&&$e(n.content),Oe(n),i=n);if(i=null,re)return e;if(K){if(Q)for(o=S.call(r.ownerDocument);r.firstChild;)o.appendChild(r.firstChild);else o=r;return J&&(o=T.call(l,o,!0)),o}return e=V?r.outerHTML:r.innerHTML,W&&(e=De(e,F," "),e=De(e,C," ")),k&&ee?k.createHTML(e):e},c.setConfig=function(e){O(e),Y=!0},c.clearConfig=function(){ge=null,Y=!1},c.isValidAttribute=function(e,t,n){return ge||O({}),e=Ne(e),t=Ne(t),Re(e,t,n)},c.addHook=function(e,t){"function"==typeof t&&(R[e]=R[e]||[],ze(R[e],t))},c.removeHook=function(e){R[e]&&Le(R[e])},c.removeHooks=function(e){R[e]&&(R[e]=[])},c.removeAllHooks=function(){R={}},c}();function se(e){var t,n=e.loaded,r=e.total,i=e.step;ie||((e=v("div")).classList.add("progress"),a(g,e),ie=e),t=i?80<(t=parseInt(ie.style.width||0,10)+i)?80:t:Math.floor(n/r*100),ie.style.opacity=1,ie.style.width=95<=t?"100%":t+"%",95<=t&&(clearTimeout(oe),oe=setTimeout(function(e){ie.style.opacity=0,ie.style.width="0%"},200))}var le={};function ce(i,e,t){void 0===e&&(e=!1),void 0===t&&(t={});function o(){a.addEventListener.apply(a,arguments)}var n,a=new XMLHttpRequest,r=le[i];if(r)return{then:function(e){return e(r.content,r.opt)},abort:u};for(n in a.open("GET",i),t)l.call(t,n)&&a.setRequestHeader(n,t[n]);return a.send(),{then:function(t,n){var r;void 0===n&&(n=u),e&&(r=setInterval(function(e){return se({step:Math.floor(5*Math.random()+1)})},500),o("progress",se),o("loadend",function(e){se(e),clearInterval(r)})),o("error",n),o("load",function(e){e=e.target;400<=e.status?n(e):(e=le[i]={content:e.response,opt:{updatedAt:a.getResponseHeader("last-modified")}},t(e.content,e.opt))})},abort:function(e){return 4!==a.readyState&&a.abort()}}}function ue(e,t){e.innerHTML=e.innerHTML.replace(/var\(\s*--theme-color.*?\)/g,t)}var pe=f.title;function he(){var e,t=d("section.cover");t&&(e=t.getBoundingClientRect().height,window.pageYOffset>=e||t.classList.contains("hidden")?S(g,"add","sticky"):S(g,"remove","sticky"))}function de(e,t,r,n){var i=[];null!=(t=d(t))&&(i=k(t,"a"));var o,a=decodeURI(e.toURL(e.getCurrentPath()));return i.sort(function(e,t){return t.href.length-e.href.length}).forEach(function(e){var t=decodeURI(e.getAttribute("href")),n=r?e.parentNode:e;e.title=e.title||e.innerText,0!==a.indexOf(t)||o?S(n,"remove","active"):(o=e,S(n,"add","active"))}),n&&(f.title=o?o.title||o.innerText+" - "+pe:pe),o}function fe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var ge=(function(e,t,n){return t&&fe(e.prototype,t),n&&fe(e,n),e}(me,[{key:"getIntermediateValue",value:function(e){return this.decimal?e:Math.round(e)}},{key:"getFinalValue",value:function(){return this.end}}]),me);function me(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,me),this.start=e.start,this.end=e.end,this.decimal=e.decimal}function ve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var ye=(function(e,t,n){return t&&ve(e.prototype,t),n&&ve(e,n),e}(be,[{key:"begin",value:function(){return this.isRunning||this.next===this.end||(this.frame=window.requestAnimationFrame(this._tick.bind(this))),this}},{key:"stop",value:function(){return window.cancelAnimationFrame(this.frame),this.isRunning=!1,this.frame=null,this.timeStart=null,this.next=null,this}},{key:"on",value:function(e,t){return this.events[e]=this.events[e]||[],this.events[e].push(t),this}},{key:"_emit",value:function(e,t){var n=this,e=this.events[e];e&&e.forEach(function(e){return e.call(n,t)})}},{key:"_tick",value:function(e){this.isRunning=!0;var t=this.next||this.start;this.timeStart||(this.timeStart=e),this.timeElapsed=e-this.timeStart,this.next=this.ease(this.timeElapsed,this.start,this.end-this.start,this.duration),this._shouldTick(t)?(this._emit("tick",this.tweener.getIntermediateValue(this.next)),this.frame=window.requestAnimationFrame(this._tick.bind(this))):(this._emit("tick",this.tweener.getFinalValue()),this._emit("done",null))}},{key:"_shouldTick",value:function(e){return{up:this.next<this.end&&e<=this.next,down:this.next>this.end&&e>=this.next}[this.direction]}},{key:"_defaultEase",value:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t}}]),be);function be(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,be),this.duration=e.duration||1e3,this.ease=e.easing||this._defaultEase,this.tweener=e.tweener||new ge(e),this.start=this.tweener.start,this.end=this.tweener.end,this.frame=null,this.next=null,this.isRunning=!1,this.events={},this.direction=this.start<this.end?"up":"down"}var ke=document.currentScript;function we(e){var t,n=y({el:"#app",repo:"",maxLevel:6,subMaxLevel:0,loadSidebar:null,loadNavbar:null,homepage:"README.md",coverpage:"",basePath:"",auto2top:!1,name:"",themeColor:"",nameLink:window.location.pathname,autoHeader:!1,executeScript:null,noEmoji:!1,ga:"",ext:".md",mergeNavbar:!1,formatUpdated:"",externalLinkTarget:"_blank",cornerExternalLinkTarget:"_blank",externalLinkRel:"noopener",routerMode:"hash",noCompileLinks:[],crossOriginLinks:[],relativePath:!1,topMargin:0},"function"==typeof window.$docsify?window.$docsify(e):window.$docsify),r=ke||[].slice.call(document.getElementsByTagName("script")).filter(function(e){return/docsify\./.test(e.src)})[0];if(r)for(var i in n){!l.call(n,i)||c(t=r.getAttribute("data-"+o(i)))&&(n[i]=""===t||t)}return!0===n.loadSidebar&&(n.loadSidebar="_sidebar"+n.ext),!0===n.loadNavbar&&(n.loadNavbar="_navbar"+n.ext),!0===n.coverpage&&(n.coverpage="_coverpage"+n.ext),!0===n.repo&&(n.repo=""),!0===n.name&&(n.name=""),window.$docsify=n}var xe={},_e=!1,Se=null,Ae=!0,Te=0;function Ee(e){if(Ae){for(var t,n,r=d(".sidebar"),i=k(".anchor"),o=b(r,".sidebar-nav"),a=b(r,"li.active"),s=document.documentElement,l=(s&&s.scrollTop||document.body.scrollTop)-Te,c=0,u=i.length;c<u;c+=1){var p=i[c];if(p.offsetTop>l){t=t||p;break}t=p}!t||(n=xe[Re(e,t.getAttribute("data-id"))])&&n!==a&&(a&&a.classList.remove("active"),n.classList.add("active"),a=n,!_e&&g.classList.contains("sticky")&&(s=r.clientHeight,e=a.offsetTop+a.clientHeight+40,n=a.offsetTop>=o.scrollTop&&e<=o.scrollTop+s,a=+e<s,r.scrollTop=n?o.scrollTop:a?0:e-s))}}function Re(e,t){return decodeURIComponent(e)+"?id="+decodeURIComponent(t)}function Oe(e,t){var n,r;t&&(r=we().topMargin,(n=b("#"+t))&&(n=n,void 0===(r=r)&&(r=0),Se&&Se.stop(),Ae=!1,Se=new ye({start:window.pageYOffset,end:Math.round(n.getBoundingClientRect().top)+window.pageYOffset-r,duration:500}).on("tick",function(e){return window.scrollTo(0,e)}).on("done",function(){Ae=!0,Se=null}).begin()),e=xe[Re(e,t)],(t=b(d(".sidebar"),"li.active"))&&t.classList.remove("active"),e&&e.classList.add("active"))}var $e=f.scrollingElement||f.documentElement;var dt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ft(e,t){return e(t={exports:{}},t.exports),t.exports}function gt(e){return wt[e]}var mt=ft(function(t){function e(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}t.exports={defaults:e(),getDefaults:e,changeDefaults:function(e){t.exports.defaults=e}}}),vt=(mt.defaults,mt.getDefaults,mt.changeDefaults,/[&<>"']/),yt=/[&<>"']/g,bt=/[<>"']|&(?!#?\w+;)/,kt=/[<>"']|&(?!#?\w+;)/g,wt={"&":"&","<":"<",">":">",'"':""","'":"'"};var xt=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function _t(e){return e.replace(xt,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}var St=/(^|[^\[])\^/g;var At=/[^\w:]/g,Tt=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;var Et={},Rt=/^[^:]+:\/*[^/]*$/,Ot=/^([^:]+:)[\s\S]*$/,$t=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Ft(e,t){Et[" "+e]||(Rt.test(e)?Et[" "+e]=e+"/":Et[" "+e]=Ct(e,"/",!0));var n=-1===(e=Et[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(Ot,"$1")+t:"/"===t.charAt(0)?n?t:e.replace($t,"$1")+t:e+t}function Ct(e,t,n){var r=e.length;if(0===r)return"";for(var i=0;i<r;){var o=e.charAt(r-i-1);if(o!==t||n){if(o===t||!n)break;i++}else i++}return e.substr(0,r-i)}var Lt=function(e,t){if(t){if(vt.test(e))return e.replace(yt,gt)}else if(bt.test(e))return e.replace(kt,gt);return e},zt=_t,Nt=function(n,e){n=n.source||n,e=e||"";var r={replace:function(e,t){return t=(t=t.source||t).replace(St,"$1"),n=n.replace(e,t),r},getRegex:function(){return new RegExp(n,e)}};return r},Mt=function(e,t,n){if(e){var r;try{r=decodeURIComponent(_t(n)).replace(At,"").toLowerCase()}catch(e){return null}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return null}t&&!Tt.test(n)&&(n=Ft(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n},Dt={exec:function(){}},Pt=function(e){for(var t,n,r=arguments,i=1;i<arguments.length;i++)for(n in t=r[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},It=function(e,t){var n=e.replace(/\|/g,function(e,t,n){for(var r=!1,i=t;0<=--i&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(/ \|/),r=0;if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n},I=function(e,t){if(-1===e.indexOf(t[1]))return-1;for(var n=e.length,r=0,i=0;i<n;i++)if("\\"===e[i])i++;else if(e[i]===t[0])r++;else if(e[i]===t[1]&&--r<0)return i;return-1},ee=function(e){e&&e.sanitize&&!e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")},Q=function(e,t){if(t<1)return"";for(var n="";1<t;)1&t&&(n+=e),t>>=1,e+=e;return n+e},jt=mt.defaults,Ht=Ct,qt=It,Ut=Lt,Bt=I;function Zt(e,t,n){var r=t.href,i=t.title?Ut(t.title):null,t=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?{type:"link",raw:n,href:r,title:i,text:t}:{type:"image",raw:n,href:r,title:i,text:Ut(t)}}var Gt=function(){function e(e){this.options=e||jt}return e.prototype.space=function(e){e=this.rules.block.newline.exec(e);if(e)return 1<e[0].length?{type:"space",raw:e[0]}:{raw:"\n"}},e.prototype.code=function(e,t){e=this.rules.block.code.exec(e);if(e){t=t[t.length-1];if(t&&"paragraph"===t.type)return{raw:e[0],text:e[0].trimRight()};t=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Ht(t,"\n")}}},e.prototype.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var n=t[0],e=function(e,t){if(null===(e=e.match(/^(\s+)(?:```)/)))return t;var n=e[1];return t.split("\n").map(function(e){var t=e.match(/^\s+/);return null!==t&&t[0].length>=n.length?e.slice(n.length):e}).join("\n")}(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim():t[2],text:e}}},e.prototype.heading=function(e){var t=this.rules.block.heading.exec(e);if(t){var n=t[2].trim();return/#$/.test(n)&&(e=Ht(n,"#"),!this.options.pedantic&&e&&!/ $/.test(e)||(n=e.trim())),{type:"heading",raw:t[0],depth:t[1].length,text:n}}},e.prototype.nptable=function(e){e=this.rules.block.nptable.exec(e);if(e){var t={type:"table",header:qt(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[],raw:e[0]};if(t.header.length===t.align.length){for(var n=t.align.length,r=0;r<n;r++)/^ *-+: *$/.test(t.align[r])?t.align[r]="right":/^ *:-+: *$/.test(t.align[r])?t.align[r]="center":/^ *:-+ *$/.test(t.align[r])?t.align[r]="left":t.align[r]=null;for(n=t.cells.length,r=0;r<n;r++)t.cells[r]=qt(t.cells[r],t.header.length);return t}}},e.prototype.hr=function(e){e=this.rules.block.hr.exec(e);if(e)return{type:"hr",raw:e[0]}},e.prototype.blockquote=function(e){var t=this.rules.block.blockquote.exec(e);if(t){e=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],text:e}}},e.prototype.list=function(e){e=this.rules.block.list.exec(e);if(e){for(var t,n,r,i,o,a=e[0],s=e[2],l=1<s.length,c={type:"list",raw:a,ordered:l,start:l?+s.slice(0,-1):"",loose:!1,items:[]},u=e[0].match(this.rules.block.item),p=!1,h=u.length,d=this.rules.block.listItemStart.exec(u[0]),f=0;f<h;f++){if(a=t=u[f],f!==h-1){if(r=this.rules.block.listItemStart.exec(u[f+1]),this.options.pedantic?r[1].length>d[1].length:r[1].length>d[0].length||3<r[1].length){u.splice(f,2,u[f]+"\n"+u[f+1]),f--,h--;continue}(!this.options.pedantic||this.options.smartLists?r[2][r[2].length-1]!==s[s.length-1]:l==(1===r[2].length))&&(n=u.slice(f+1).join("\n"),c.raw=c.raw.substring(0,c.raw.length-n.length),f=h-1),d=r}r=t.length,~(t=t.replace(/^ *([*+-]|\d+[.)]) ?/,"")).indexOf("\n ")&&(r-=t.length,t=this.options.pedantic?t.replace(/^ {1,4}/gm,""):t.replace(new RegExp("^ {1,"+r+"}","gm"),"")),r=p||/\n\n(?!\s*$)/.test(t),f!==h-1&&(p="\n"===t.charAt(t.length-1),r=r||p),r&&(c.loose=!0),this.options.gfm&&(o=void 0,(i=/^\[[ xX]\] /.test(t))&&(o=" "!==t[1],t=t.replace(/^\[[ xX]\] +/,""))),c.items.push({type:"list_item",raw:a,task:i,checked:o,loose:r,text:t})}return c}},e.prototype.html=function(e){e=this.rules.block.html.exec(e);if(e)return{type:this.options.sanitize?"paragraph":"html",raw:e[0],pre:!this.options.sanitizer&&("pre"===e[1]||"script"===e[1]||"style"===e[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):Ut(e[0]):e[0]}},e.prototype.def=function(e){e=this.rules.block.def.exec(e);if(e)return e[3]&&(e[3]=e[3].substring(1,e[3].length-1)),{tag:e[1].toLowerCase().replace(/\s+/g," "),raw:e[0],href:e[2],title:e[3]}},e.prototype.table=function(e){e=this.rules.block.table.exec(e);if(e){var t={type:"table",header:qt(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[]};if(t.header.length===t.align.length){t.raw=e[0];for(var n=t.align.length,r=0;r<n;r++)/^ *-+: *$/.test(t.align[r])?t.align[r]="right":/^ *:-+: *$/.test(t.align[r])?t.align[r]="center":/^ *:-+ *$/.test(t.align[r])?t.align[r]="left":t.align[r]=null;for(n=t.cells.length,r=0;r<n;r++)t.cells[r]=qt(t.cells[r].replace(/^ *\| *| *\| *$/g,""),t.header.length);return t}}},e.prototype.lheading=function(e){e=this.rules.block.lheading.exec(e);if(e)return{type:"heading",raw:e[0],depth:"="===e[2].charAt(0)?1:2,text:e[1]}},e.prototype.paragraph=function(e){e=this.rules.block.paragraph.exec(e);if(e)return{type:"paragraph",raw:e[0],text:"\n"===e[1].charAt(e[1].length-1)?e[1].slice(0,-1):e[1]}},e.prototype.text=function(e,t){e=this.rules.block.text.exec(e);if(e){t=t[t.length-1];return t&&"text"===t.type?{raw:e[0],text:e[0]}:{type:"text",raw:e[0],text:e[0]}}},e.prototype.escape=function(e){e=this.rules.inline.escape.exec(e);if(e)return{type:"escape",raw:e[0],text:Ut(e[1])}},e.prototype.tag=function(e,t,n){e=this.rules.inline.tag.exec(e);if(e)return!t&&/^<a /i.test(e[0])?t=!0:t&&/^<\/a>/i.test(e[0])&&(t=!1),!n&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?n=!0:n&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(n=!1),{type:this.options.sanitize?"text":"html",raw:e[0],inLink:t,inRawBlock:n,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):Ut(e[0]):e[0]}},e.prototype.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;e=Ht(n.slice(0,-1),"\\");if((n.length-e.length)%2==0)return}else{var r=Bt(t[2],"()");-1<r&&(o=(0===t[0].indexOf("!")?5:4)+t[1].length+r,t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,o).trim(),t[3]="")}var i,r=t[2],o="";return this.options.pedantic?(i=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r),i&&(r=i[1],o=i[3])):o=t[3]?t[3].slice(1,-1):"",r=r.trim(),/^</.test(r)&&(r=this.options.pedantic&&!/>$/.test(n)?r.slice(1):r.slice(1,-1)),Zt(t,{href:r?r.replace(this.rules.inline._escapes,"$1"):r,title:o?o.replace(this.rules.inline._escapes,"$1"):o},t[0])}},e.prototype.reflink=function(e,t){if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){e=(n[2]||n[1]).replace(/\s+/g," ");if((e=t[e.toLowerCase()])&&e.href)return Zt(n,e,n[0]);var n=n[0].charAt(0);return{type:"text",raw:n,text:n}}},e.prototype.strong=function(e,t,n){void 0===n&&(n="");var r=this.rules.inline.strong.start.exec(e);if(r&&(!r[1]||r[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){t=t.slice(-1*e.length);var i,o="**"===r[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(o.lastIndex=0;null!=(r=o.exec(t));)if(i=this.rules.inline.strong.middle.exec(t.slice(0,r.index+3)))return{type:"strong",raw:e.slice(0,i[0].length),text:e.slice(2,i[0].length-2)}}},e.prototype.em=function(e,t,n){void 0===n&&(n="");var r=this.rules.inline.em.start.exec(e);if(r&&(!r[1]||r[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){t=t.slice(-1*e.length);var i,o="*"===r[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(o.lastIndex=0;null!=(r=o.exec(t));)if(i=this.rules.inline.em.middle.exec(t.slice(0,r.index+2)))return{type:"em",raw:e.slice(0,i[0].length),text:e.slice(1,i[0].length-1)}}},e.prototype.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var n=t[2].replace(/\n/g," "),r=/[^ ]/.test(n),e=/^ /.test(n)&&/ $/.test(n);return r&&e&&(n=n.substring(1,n.length-1)),n=Ut(n,!0),{type:"codespan",raw:t[0],text:n}}},e.prototype.br=function(e){e=this.rules.inline.br.exec(e);if(e)return{type:"br",raw:e[0]}},e.prototype.del=function(e){e=this.rules.inline.del.exec(e);if(e)return{type:"del",raw:e[0],text:e[2]}},e.prototype.autolink=function(e,t){e=this.rules.inline.autolink.exec(e);if(e){var n,t="@"===e[2]?"mailto:"+(n=Ut(this.options.mangle?t(e[1]):e[1])):n=Ut(e[1]);return{type:"link",raw:e[0],text:n,href:t,tokens:[{type:"text",raw:n,text:n}]}}},e.prototype.url=function(e,t){var n,r,i,o;if(n=this.rules.inline.url.exec(e)){if("@"===n[2])i="mailto:"+(r=Ut(this.options.mangle?t(n[0]):n[0]));else{for(;o=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0],o!==n[0];);r=Ut(n[0]),i="www."===n[1]?"http://"+r:r}return{type:"link",raw:n[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}},e.prototype.inlineText=function(e,t,n){e=this.rules.inline.text.exec(e);if(e){n=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):Ut(e[0]):e[0]:Ut(this.options.smartypants?n(e[0]):e[0]);return{type:"text",raw:e[0],text:n}}},e}(),It=Dt,I=Nt,Dt=Pt,Nt={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:It,table:It,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};Nt.def=I(Nt.def).replace("label",Nt._label).replace("title",Nt._title).getRegex(),Nt.bullet=/(?:[*+-]|\d{1,9}[.)])/,Nt.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,Nt.item=I(Nt.item,"gm").replace(/bull/g,Nt.bullet).getRegex(),Nt.listItemStart=I(/^( *)(bull)/).replace("bull",Nt.bullet).getRegex(),Nt.list=I(Nt.list).replace(/bull/g,Nt.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Nt.def.source+")").getRegex(),Nt._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Nt._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Nt.html=I(Nt.html,"i").replace("comment",Nt._comment).replace("tag",Nt._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Nt.paragraph=I(Nt._paragraph).replace("hr",Nt.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Nt._tag).getRegex(),Nt.blockquote=I(Nt.blockquote).replace("paragraph",Nt.paragraph).getRegex(),Nt.normal=Dt({},Nt),Nt.gfm=Dt({},Nt.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Nt.gfm.nptable=I(Nt.gfm.nptable).replace("hr",Nt.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Nt._tag).getRegex(),Nt.gfm.table=I(Nt.gfm.table).replace("hr",Nt.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Nt._tag).getRegex(),Nt.pedantic=Dt({},Nt.normal,{html:I("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Nt._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:It,paragraph:I(Nt.normal._paragraph).replace("hr",Nt.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Nt.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});It={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:It,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation*\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation*\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:It,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\s*punctuation])/,_punctuation:"!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~"};It.punctuation=I(It.punctuation).replace(/punctuation/g,It._punctuation).getRegex(),It._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",It._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",It._comment=I(Nt._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),It.em.start=I(It.em.start).replace(/punctuation/g,It._punctuation).getRegex(),It.em.middle=I(It.em.middle).replace(/punctuation/g,It._punctuation).replace(/overlapSkip/g,It._overlapSkip).getRegex(),It.em.endAst=I(It.em.endAst,"g").replace(/punctuation/g,It._punctuation).getRegex(),It.em.endUnd=I(It.em.endUnd,"g").replace(/punctuation/g,It._punctuation).getRegex(),It.strong.start=I(It.strong.start).replace(/punctuation/g,It._punctuation).getRegex(),It.strong.middle=I(It.strong.middle).replace(/punctuation/g,It._punctuation).replace(/overlapSkip/g,It._overlapSkip).getRegex(),It.strong.endAst=I(It.strong.endAst,"g").replace(/punctuation/g,It._punctuation).getRegex(),It.strong.endUnd=I(It.strong.endUnd,"g").replace(/punctuation/g,It._punctuation).getRegex(),It.blockSkip=I(It._blockSkip,"g").getRegex(),It.overlapSkip=I(It._overlapSkip,"g").getRegex(),It._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,It._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,It._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,It.autolink=I(It.autolink).replace("scheme",It._scheme).replace("email",It._email).getRegex(),It._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,It.tag=I(It.tag).replace("comment",It._comment).replace("attribute",It._attribute).getRegex(),It._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,It._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,It._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,It.link=I(It.link).replace("label",It._label).replace("href",It._href).replace("title",It._title).getRegex(),It.reflink=I(It.reflink).replace("label",It._label).getRegex(),It.reflinkSearch=I(It.reflinkSearch,"g").replace("reflink",It.reflink).replace("nolink",It.nolink).getRegex(),It.normal=Dt({},It),It.pedantic=Dt({},It.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:I(/^!?\[(label)\]\((.*?)\)/).replace("label",It._label).getRegex(),reflink:I(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",It._label).getRegex()}),It.gfm=Dt({},It.normal,{escape:I(It.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),It.gfm.url=I(It.gfm.url,"i").replace("email",It.gfm._extended_email).getRegex(),It.breaks=Dt({},It.gfm,{br:I(It.br).replace("{2,}","*").getRegex(),text:I(It.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var It={block:Nt,inline:It},Wt=mt.defaults,Vt=It.block,Yt=It.inline,Xt=Q;function Kt(e){return e.replace(/---/g,"â").replace(/--/g,"â").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1â").replace(/'/g,"â").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1â").replace(/"/g,"â").replace(/\.{3}/g,"â¦")}function Qt(e){for(var t,n="",r=e.length,i=0;i<r;i++)t=e.charCodeAt(i),.5<Math.random()&&(t="x"+t.toString(16)),n+="&#"+t+";";return n}var Jt=function(){function n(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Wt,this.options.tokenizer=this.options.tokenizer||new Gt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;e={block:Vt.normal,inline:Yt.normal};this.options.pedantic?(e.block=Vt.pedantic,e.inline=Yt.pedantic):this.options.gfm&&(e.block=Vt.gfm,this.options.breaks?e.inline=Yt.breaks:e.inline=Yt.gfm),this.tokenizer.rules=e}var e={rules:{configurable:!0}};return e.rules.get=function(){return{block:Vt,inline:Yt}},n.lex=function(e,t){return new n(t).lex(e)},n.lexInline=function(e,t){return new n(t).inlineTokens(e)},n.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens,!0),this.inline(this.tokens),this.tokens},n.prototype.blockTokens=function(e,t,n){var r,i,o,a;for(void 0===t&&(t=[]),void 0===n&&(n=!0),this.options.pedantic&&(e=e.replace(/^ +$/gm,""));e;)if(r=this.tokenizer.space(e))e=e.substring(r.raw.length),r.type&&t.push(r);else if(r=this.tokenizer.code(e,t))e=e.substring(r.raw.length),r.type?t.push(r):((a=t[t.length-1]).raw+="\n"+r.raw,a.text+="\n"+r.text);else if(r=this.tokenizer.fences(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.heading(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.nptable(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.hr(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.blockquote(e))e=e.substring(r.raw.length),r.tokens=this.blockTokens(r.text,[],n),t.push(r);else if(r=this.tokenizer.list(e)){for(e=e.substring(r.raw.length),o=r.items.length,i=0;i<o;i++)r.items[i].tokens=this.blockTokens(r.items[i].text,[],!1);t.push(r)}else if(r=this.tokenizer.html(e))e=e.substring(r.raw.length),t.push(r);else if(n&&(r=this.tokenizer.def(e)))e=e.substring(r.raw.length),this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});else if(r=this.tokenizer.table(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.lheading(e))e=e.substring(r.raw.length),t.push(r);else if(n&&(r=this.tokenizer.paragraph(e)))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.text(e,t))e=e.substring(r.raw.length),r.type?t.push(r):((a=t[t.length-1]).raw+="\n"+r.raw,a.text+="\n"+r.text);else if(e){var s="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(s);break}throw new Error(s)}return t},n.prototype.inline=function(e){for(var t,n,r,i,o,a=e.length,s=0;s<a;s++)switch((o=e[s]).type){case"paragraph":case"text":case"heading":o.tokens=[],this.inlineTokens(o.text,o.tokens);break;case"table":for(o.tokens={header:[],cells:[]},r=o.header.length,t=0;t<r;t++)o.tokens.header[t]=[],this.inlineTokens(o.header[t],o.tokens.header[t]);for(r=o.cells.length,t=0;t<r;t++)for(i=o.cells[t],o.tokens.cells[t]=[],n=0;n<i.length;n++)o.tokens.cells[t][n]=[],this.inlineTokens(i[n],o.tokens.cells[t][n]);break;case"blockquote":this.inline(o.tokens);break;case"list":for(r=o.items.length,t=0;t<r;t++)this.inline(o.items[t].tokens)}return e},n.prototype.inlineTokens=function(e,t,n,r){var i;void 0===t&&(t=[]),void 0===n&&(n=!1),void 0===r&&(r=!1);var o,a,s,l=e;if(this.tokens.links){var c=Object.keys(this.tokens.links);if(0<c.length)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(l));)c.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,o.index)+"["+Xt("a",o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,o.index)+"["+Xt("a",o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;e;)if(a||(s=""),a=!1,i=this.tokenizer.escape(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.tag(e,n,r))e=e.substring(i.raw.length),n=i.inLink,r=i.inRawBlock,t.push(i);else if(i=this.tokenizer.link(e))e=e.substring(i.raw.length),"link"===i.type&&(i.tokens=this.inlineTokens(i.text,[],!0,r)),t.push(i);else if(i=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(i.raw.length),"link"===i.type&&(i.tokens=this.inlineTokens(i.text,[],!0,r)),t.push(i);else if(i=this.tokenizer.strong(e,l,s))e=e.substring(i.raw.length),i.tokens=this.inlineTokens(i.text,[],n,r),t.push(i);else if(i=this.tokenizer.em(e,l,s))e=e.substring(i.raw.length),i.tokens=this.inlineTokens(i.text,[],n,r),t.push(i);else if(i=this.tokenizer.codespan(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.br(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.del(e))e=e.substring(i.raw.length),i.tokens=this.inlineTokens(i.text,[],n,r),t.push(i);else if(i=this.tokenizer.autolink(e,Qt))e=e.substring(i.raw.length),t.push(i);else if(n||!(i=this.tokenizer.url(e,Qt))){if(i=this.tokenizer.inlineText(e,r,Kt))e=e.substring(i.raw.length),s=i.raw.slice(-1),a=!0,t.push(i);else if(e){var u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}throw new Error(u)}}else e=e.substring(i.raw.length),t.push(i);return t},Object.defineProperties(n,e),n}(),en=mt.defaults,tn=Mt,nn=Lt,rn=function(){function e(e){this.options=e||en}return e.prototype.code=function(e,t,n){var r=(t||"").match(/\S*/)[0];return!this.options.highlight||null!=(t=this.options.highlight(e,r))&&t!==e&&(n=!0,e=t),e=e.replace(/\n$/,"")+"\n",r?'<pre><code class="'+this.options.langPrefix+nn(r,!0)+'">'+(n?e:nn(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:nn(e,!0))+"</code></pre>\n"},e.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},e.prototype.html=function(e){return e},e.prototype.heading=function(e,t,n,r){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+r.slug(n)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"},e.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},e.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"},e.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},e.prototype.checkbox=function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},e.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},e.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n"+(t=t&&"<tbody>"+t+"</tbody>")+"</table>\n"},e.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},e.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"},e.prototype.strong=function(e){return"<strong>"+e+"</strong>"},e.prototype.em=function(e){return"<em>"+e+"</em>"},e.prototype.codespan=function(e){return"<code>"+e+"</code>"},e.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},e.prototype.del=function(e){return"<del>"+e+"</del>"},e.prototype.link=function(e,t,n){if(null===(e=tn(this.options.sanitize,this.options.baseUrl,e)))return n;e='<a href="'+nn(e)+'"';return t&&(e+=' title="'+t+'"'),e+=">"+n+"</a>"},e.prototype.image=function(e,t,n){if(null===(e=tn(this.options.sanitize,this.options.baseUrl,e)))return n;n='<img src="'+e+'" alt="'+n+'"';return t&&(n+=' title="'+t+'"'),n+=this.options.xhtml?"/>":">"},e.prototype.text=function(e){return e},e}(),on=function(){function e(){}return e.prototype.strong=function(e){return e},e.prototype.em=function(e){return e},e.prototype.codespan=function(e){return e},e.prototype.del=function(e){return e},e.prototype.html=function(e){return e},e.prototype.text=function(e){return e},e.prototype.link=function(e,t,n){return""+n},e.prototype.image=function(e,t,n){return""+n},e.prototype.br=function(){return""},e}(),an=function(){function e(){this.seen={}}return e.prototype.serialize=function(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},e.prototype.getNextSafeSlug=function(e,t){var n=e,r=0;if(this.seen.hasOwnProperty(n))for(r=this.seen[e];n=e+"-"+ ++r,this.seen.hasOwnProperty(n););return t||(this.seen[e]=r,this.seen[n]=0),n},e.prototype.slug=function(e,t){void 0===t&&(t={});var n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)},e}(),sn=mt.defaults,ln=zt,cn=function(){function n(e){this.options=e||sn,this.options.renderer=this.options.renderer||new rn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new on,this.slugger=new an}return n.parse=function(e,t){return new n(t).parse(e)},n.parseInline=function(e,t){return new n(t).parseInline(e)},n.prototype.parse=function(e,t){void 0===t&&(t=!0);for(var n,r,i,o,a,s,l,c,u,p,h,d,f,g,m,v="",y=e.length,b=0;b<y;b++)switch((c=e[b]).type){case"space":continue;case"hr":v+=this.renderer.hr();continue;case"heading":v+=this.renderer.heading(this.parseInline(c.tokens),c.depth,ln(this.parseInline(c.tokens,this.textRenderer)),this.slugger);continue;case"code":v+=this.renderer.code(c.text,c.lang,c.escaped);continue;case"table":for(s=u="",i=c.header.length,n=0;n<i;n++)s+=this.renderer.tablecell(this.parseInline(c.tokens.header[n]),{header:!0,align:c.align[n]});for(u+=this.renderer.tablerow(s),l="",i=c.cells.length,n=0;n<i;n++){for(s="",o=(a=c.tokens.cells[n]).length,r=0;r<o;r++)s+=this.renderer.tablecell(this.parseInline(a[r]),{header:!1,align:c.align[r]});l+=this.renderer.tablerow(s)}v+=this.renderer.table(u,l);continue;case"blockquote":l=this.parse(c.tokens),v+=this.renderer.blockquote(l);continue;case"list":for(u=c.ordered,k=c.start,p=c.loose,i=c.items.length,l="",n=0;n<i;n++)f=(d=c.items[n]).checked,g=d.task,h="",d.task&&(m=this.renderer.checkbox(f),p?0<d.tokens.length&&"text"===d.tokens[0].type?(d.tokens[0].text=m+" "+d.tokens[0].text,d.tokens[0].tokens&&0<d.tokens[0].tokens.length&&"text"===d.tokens[0].tokens[0].type&&(d.tokens[0].tokens[0].text=m+" "+d.tokens[0].tokens[0].text)):d.tokens.unshift({type:"text",text:m}):h+=m),h+=this.parse(d.tokens,p),l+=this.renderer.listitem(h,g,f);v+=this.renderer.list(l,u,k);continue;case"html":v+=this.renderer.html(c.text);continue;case"paragraph":v+=this.renderer.paragraph(this.parseInline(c.tokens));continue;case"text":for(l=c.tokens?this.parseInline(c.tokens):c.text;b+1<y&&"text"===e[b+1].type;)l+="\n"+((c=e[++b]).tokens?this.parseInline(c.tokens):c.text);v+=t?this.renderer.paragraph(l):l;continue;default:var k='Token with "'+c.type+'" type was not found.';if(this.options.silent)return void console.error(k);throw new Error(k)}return v},n.prototype.parseInline=function(e,t){t=t||this.renderer;for(var n="",r=e.length,i=0;i<r;i++)switch((o=e[i]).type){case"escape":n+=t.text(o.text);break;case"html":n+=t.html(o.text);break;case"link":n+=t.link(o.href,o.title,this.parseInline(o.tokens,t));break;case"image":n+=t.image(o.href,o.title,o.text);break;case"strong":n+=t.strong(this.parseInline(o.tokens,t));break;case"em":n+=t.em(this.parseInline(o.tokens,t));break;case"codespan":n+=t.codespan(o.text);break;case"br":n+=t.br();break;case"del":n+=t.del(this.parseInline(o.tokens,t));break;case"text":n+=t.text(o.text);break;default:var o='Token with "'+o.type+'" type was not found.';if(this.options.silent)return void console.error(o);throw new Error(o)}return n},n}(),un=Pt,pn=ee,hn=Lt,Lt=mt.getDefaults,dn=mt.changeDefaults,mt=mt.defaults;function fn(e,n,r){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if("function"==typeof n&&(r=n,n=null),n=un({},fn.defaults,n||{}),pn(n),r){var i,o=n.highlight;try{i=Jt.lex(e,n)}catch(e){return r(e)}function a(t){var e;if(!t)try{e=cn.parse(i,n)}catch(e){t=e}return n.highlight=o,t?r(t):r(null,e)}if(!o||o.length<3)return a();if(delete n.highlight,!i.length)return a();var s=0;return fn.walkTokens(i,function(n){"code"===n.type&&(s++,setTimeout(function(){o(n.text,n.lang,function(e,t){return e?a(e):(null!=t&&t!==n.text&&(n.text=t,n.escaped=!0),void(0===--s&&a()))})},0))}),void(0===s&&a())}try{var t=Jt.lex(e,n);return n.walkTokens&&fn.walkTokens(t,n.walkTokens),cn.parse(t,n)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",n.silent)return"<p>An error occurred:</p><pre>"+hn(e.message+"",!0)+"</pre>";throw e}}fn.options=fn.setOptions=function(e){return un(fn.defaults,e),dn(fn.defaults),fn},fn.getDefaults=Lt,fn.defaults=mt,fn.use=function(o){var t,e=un({},o);if(o.renderer){var n,a=fn.defaults.renderer||new rn;for(n in o.renderer)!function(r){var i=a[r];a[r]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=o.renderer[r].apply(a,e);return!1===n&&(n=i.apply(a,e)),n}}(n);e.renderer=a}if(o.tokenizer){var i,s=fn.defaults.tokenizer||new Gt;for(i in o.tokenizer)!function(){var r=s[i];s[i]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=o.tokenizer[i].apply(s,e);return!1===n&&(n=r.apply(s,e)),n}}();e.tokenizer=s}o.walkTokens&&(t=fn.defaults.walkTokens,e.walkTokens=function(e){o.walkTokens(e),t&&t(e)}),fn.setOptions(e)},fn.walkTokens=function(e,t){for(var n=0,r=e;n<r.length;n+=1){var i=r[n];switch(t(i),i.type){case"table":for(var o=0,a=i.tokens.header;o<a.length;o+=1){var s=a[o];fn.walkTokens(s,t)}for(var l=0,c=i.tokens.cells;l<c.length;l+=1)for(var u=0,p=c[l];u<p.length;u+=1){var h=p[u];fn.walkTokens(h,t)}break;case"list":fn.walkTokens(i.items,t);break;default:i.tokens&&fn.walkTokens(i.tokens,t)}}},fn.parseInline=function(e,t){if(null==e)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");t=un({},fn.defaults,t||{}),pn(t);try{var n=Jt.lexInline(e,t);return t.walkTokens&&fn.walkTokens(n,t.walkTokens),cn.parseInline(n,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+hn(e.message+"",!0)+"</pre>";throw e}},fn.Parser=cn,fn.parser=cn.parse,fn.Renderer=rn,fn.TextRenderer=on,fn.Lexer=Jt,fn.lexer=Jt.lex,fn.Tokenizer=Gt,fn.Slugger=an;var gn=fn.parse=fn;function mn(e,n){if(void 0===n&&(n='<ul class="app-sub-sidebar">{inner}</ul>'),!e||!e.length)return"";var r="";return e.forEach(function(e){var t=e.title.replace(/(<([^>]+)>)/g,"");r+='<li><a class="section-link" href="'+e.slug+'" title="'+t+'">'+e.title+"</a></li>",e.children&&(r+=mn(e.children,n))}),n.replace("{inner}",r)}function vn(e,t){return'<p class="'+e+'">'+t.slice(5).trim()+"</p>"}function yn(e,r){var i=[],o={};return e.forEach(function(e){var t=e.level||1,n=t-1;r<t||(o[n]?o[n].children=(o[n].children||[]).concat(e):i.push(e),o[t]=e)}),i}var bn={},kn=/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g;function wn(e){return e.toLowerCase()}function xn(e){if("string"!=typeof e)return"";var t=e.trim().replace(/[A-Z]+/g,wn).replace(/<[^>]+>/g,"").replace(kn,"").replace(/\s/g,"-").replace(/-+/g,"-").replace(/^(\d)/,"_$1"),e=bn[t],e=l.call(bn,t)?e+1:0;return(bn[t]=e)&&(t=t+"-"+e),t}function _n(e,t){return'<img class="emoji" src="https://github.githubassets.com/images/icons/emoji/'+t+'.png" alt="'+t+'" />'}function Sn(e){void 0===e&&(e="");var r={};return{str:e=e&&e.replace(/^('|")/,"").replace(/('|")$/,"").replace(/(?:^|\s):([\w-]+:?)=?([\w-%]+)?/g,function(e,t,n){return-1===t.indexOf(":")?(r[t]=n&&n.replace(/"/g,"")||!0,""):e}).trim(),config:r}}function An(e){return void 0===e&&(e=""),e.replace(/(<\/?a.*?>)/gi,"")}xn.clear=function(){bn={}};var Tn,En=ft(function(e){var a,s,l,c,u,r,t,i=function(l){var c=/\blang(?:uage)?-([\w-]+)\b/i,t=0,$={manual:l.Prism&&l.Prism.manual,disableWorkerMessageHandler:l.Prism&&l.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof F?new F(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function n(e,r){var i,t;switch(r=r||{},$.util.type(e)){case"Object":if(t=$.util.objId(e),r[t])return r[t];for(var o in i={},r[t]=i,e)e.hasOwnProperty(o)&&(i[o]=n(e[o],r));return i;case"Array":return(t=$.util.objId(e),r[t])?r[t]:(i=[],r[t]=i,e.forEach(function(e,t){i[t]=n(e,r)}),i);default:return e}},getLanguage:function(e){for(;e&&!c.test(e.className);)e=e.parentElement;return e?(e.className.match(c)||[,"none"])[1].toLowerCase():"none"},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(e){var t=(/at [^(\r\n]*\((.*):.+:.+\)$/i.exec(e.stack)||[])[1];if(t){var n,r=document.getElementsByTagName("script");for(n in r)if(r[n].src==t)return r[n]}return null}},isActive:function(e,t,n){for(var r="no-"+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(r))return!1;e=e.parentElement}return!!n}},languages:{extend:function(e,t){var n,r=$.util.clone($.languages[e]);for(n in t)r[n]=t[n];return r},insertBefore:function(n,e,t,r){var i,o=(r=r||$.languages)[n],a={};for(i in o)if(o.hasOwnProperty(i)){if(i==e)for(var s in t)t.hasOwnProperty(s)&&(a[s]=t[s]);t.hasOwnProperty(i)||(a[i]=o[i])}var l=r[n];return r[n]=a,$.languages.DFS($.languages,function(e,t){t===l&&e!=n&&(this[e]=a)}),a},DFS:function e(t,n,r,i){i=i||{};var o,a,s,l=$.util.objId;for(o in t){t.hasOwnProperty(o)&&(n.call(t,o,t[o],r||o),a=t[o],"Object"!==(s=$.util.type(a))||i[l(a)]?"Array"!==s||i[l(a)]||(i[l(a)]=!0,e(a,n,o,i)):(i[l(a)]=!0,e(a,n,null,i)))}}},plugins:{},highlightAll:function(e,t){$.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var r={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};$.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),$.hooks.run("before-all-elements-highlight",r);for(var i,o=0;i=r.elements[o++];)$.highlightElement(i,!0===t,r.callback)},highlightElement:function(e,t,n){var r=$.util.getLanguage(e),i=$.languages[r];e.className=e.className.replace(c,"").replace(/\s+/g," ")+" language-"+r;var o=e.parentElement;o&&"pre"===o.nodeName.toLowerCase()&&(o.className=o.className.replace(c,"").replace(/\s+/g," ")+" language-"+r);var a={element:e,language:r,grammar:i,code:e.textContent};function s(e){a.highlightedCode=e,$.hooks.run("before-insert",a),a.element.innerHTML=a.highlightedCode,$.hooks.run("after-highlight",a),$.hooks.run("complete",a),n&&n.call(a.element)}if($.hooks.run("before-sanity-check",a),!a.code)return $.hooks.run("complete",a),void(n&&n.call(a.element));$.hooks.run("before-highlight",a),a.grammar?t&&l.Worker?((t=new Worker($.filename)).onmessage=function(e){s(e.data)},t.postMessage(JSON.stringify({language:a.language,code:a.code,immediateClose:!0}))):s($.highlight(a.code,a.grammar,a.language)):s($.util.encode(a.code))},highlight:function(e,t,n){n={code:e,grammar:t,language:n};return $.hooks.run("before-tokenize",n),n.tokens=$.tokenize(n.code,n.grammar),$.hooks.run("after-tokenize",n),F.stringify($.util.encode(n.tokens),n.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new o;return L(i,i.head,e),function e(t,n,r,i,o,a){for(var s in r)if(r.hasOwnProperty(s)&&r[s]){var l=r[s];l=Array.isArray(l)?l:[l];for(var c=0;c<l.length;++c){if(a&&a.cause==s+","+c)return;var u,p=l[c],h=p.inside,d=!!p.lookbehind,f=!!p.greedy,g=p.alias;f&&!p.pattern.global&&(u=p.pattern.toString().match(/[imsuy]*$/)[0],p.pattern=RegExp(p.pattern.source,u+"g"));for(var m=p.pattern||p,v=i.next,y=o;v!==n.tail&&!(a&&y>=a.reach);y+=v.value.length,v=v.next){var b=v.value;if(n.length>t.length)return;if(!(b instanceof F)){var k,w=1;if(f){if(!(k=C(m,y,t,d)))break;var x=k.index,_=k.index+k[0].length,S=y;for(S+=v.value.length;S<=x;)v=v.next,S+=v.value.length;if(S-=v.value.length,y=S,v.value instanceof F)continue;for(var A=v;A!==n.tail&&(S<_||"string"==typeof A.value);A=A.next)w++,S+=A.value.length;w--,b=t.slice(y,S),k.index-=y}else if(!(k=C(m,0,b,d)))continue;var x=k.index,T=k[0],E=b.slice(0,x),R=b.slice(x+T.length),O=y+b.length;a&&O>a.reach&&(a.reach=O);var b=v.prev;E&&(b=L(n,b,E),y+=E.length),z(n,b,w);var T=new F(s,h?$.tokenize(T,h):T,g,T);v=L(n,b,T),R&&L(n,v,R),1<w&&e(t,n,r,v.prev,y,{cause:s+","+c,reach:O})}}}}}(e,i,t,i.head,0),function(e){var t=[],n=e.head.next;for(;n!==e.tail;)t.push(n.value),n=n.next;return t}(i)},hooks:{all:{},add:function(e,t){var n=$.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=$.hooks.all[e];if(n&&n.length)for(var r,i=0;r=n[i++];)r(t)}},Token:F};function F(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function C(e,t,n,r){e.lastIndex=t;n=e.exec(n);return n&&r&&n[1]&&(r=n[1].length,n.index+=r,n[0]=n[0].slice(r)),n}function o(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function L(e,t,n){var r=t.next,n={value:n,prev:t,next:r};return t.next=n,r.prev=n,e.length++,n}function z(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;(t.next=r).prev=t,e.length-=i}if(l.Prism=$,F.stringify=function t(e,n){if("string"==typeof e)return e;if(Array.isArray(e)){var r="";return e.forEach(function(e){r+=t(e,n)}),r}var i={type:e.type,content:t(e.content,n),tag:"span",classes:["token",e.type],attributes:{},language:n},e=e.alias;e&&(Array.isArray(e)?Array.prototype.push.apply(i.classes,e):i.classes.push(e)),$.hooks.run("wrap",i);var o,a="";for(o in i.attributes)a+=" "+o+'="'+(i.attributes[o]||"").replace(/"/g,""")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+a+">"+i.content+"</"+i.tag+">"},!l.document)return l.addEventListener&&($.disableWorkerMessageHandler||l.addEventListener("message",function(e){var t=JSON.parse(e.data),n=t.language,e=t.code,t=t.immediateClose;l.postMessage($.highlight(e,$.languages[n],n)),t&&l.close()},!1)),$;var e,n=$.util.currentScript();function r(){$.manual||$.highlightAll()}return n&&($.filename=n.src,n.hasAttribute("data-manual")&&($.manual=!0)),$.manual||("loading"===(e=document.readyState)||"interactive"===e&&n&&n.defer?document.addEventListener("DOMContentLoaded",r):window.requestAnimationFrame?window.requestAnimationFrame(r):window.setTimeout(r,16)),$}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});function p(e,t){var n=(n=e.className).replace(r," ")+" language-"+t;e.className=n.replace(/\s+/g," ").trim()}e.exports&&(e.exports=i),void 0!==dt&&(dt.Prism=i),i.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/,name:/[^\s<>'"]+/}},cdata:/<!\[CDATA\[[\s\S]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},i.languages.markup.tag.inside["attr-value"].inside.entity=i.languages.markup.entity,i.languages.markup.doctype.inside["internal-subset"].inside=i.languages.markup,i.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(i.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:i.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};n["language-"+t]={pattern:/[\s\S]+/,inside:i.languages[t]};t={};t[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:n},i.languages.insertBefore("markup","cdata",t)}}),i.languages.html=i.languages.markup,i.languages.mathml=i.languages.markup,i.languages.svg=i.languages.markup,i.languages.xml=i.languages.extend("markup",{}),i.languages.ssml=i.languages.xml,i.languages.atom=i.languages.xml,i.languages.rss=i.languages.xml,function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:RegExp("[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),string:{pattern:t,greedy:!0},property:/(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,important:/!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;t=e.languages.markup;t&&(t.tag.addInlined("style","css"),e.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/(^|["'\s])style\s*=\s*(?:"[^"]*"|'[^']*')/i,lookbehind:!0,inside:{"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{style:{pattern:/(["'])[\s\S]+(?=["']$)/,lookbehind:!0,alias:"language-css",inside:e.languages.css},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},"attr-name":/^style/i}}},t.tag))}(i),i.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},i.languages.javascript=i.languages.extend("clike",{"class-name":[i.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|(?:get|set)(?=\s*[\[$\w\xA0-\uFFFF])|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),i.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,i.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:i.languages.regex},"regex-flags":/[a-z]+$/,"regex-delimiter":/^\/|\/$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:i.languages.javascript},{pattern:/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,inside:i.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:i.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:i.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),i.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:i.languages.javascript}},string:/[\s\S]+/}}}),i.languages.markup&&i.languages.markup.tag.addInlined("script","javascript"),i.languages.js=i.languages.javascript,"undefined"!=typeof self&&self.Prism&&self.document&&(Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),a=window.Prism,s={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},u="pre[data-src]:not(["+(l="data-src-status")+'="loaded"]):not(['+l+'="'+(c="loading")+'"])',r=/\blang(?:uage)?-([\w-]+)\b/i,a.hooks.add("before-highlightall",function(e){e.selector+=", "+u}),a.hooks.add("before-sanity-check",function(e){var t,n,r,i,o=e.element;o.matches(u)&&(e.code="",o.setAttribute(l,c),(t=o.appendChild(document.createElement("CODE"))).textContent="Loadingâ¦",n=o.getAttribute("data-src"),"none"===(e=e.language)&&(r=(/\.(\w+)$/.exec(n)||[,"none"])[1],e=s[r]||r),p(t,e),p(o,e),(r=a.plugins.autoloader)&&r.loadLanguages(e),(i=new XMLHttpRequest).open("GET",n,!0),i.onreadystatechange=function(){4==i.readyState&&(i.status<400&&i.responseText?(o.setAttribute(l,"loaded"),t.textContent=i.responseText,a.highlightElement(t)):(o.setAttribute(l,"failed"),400<=i.status?t.textContent="â Error "+i.status+" while fetching file: "+i.statusText:t.textContent="â Error: File does not exist or is empty"))},i.send(null))}),t=!(a.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(u),r=0;t=n[r++];)a.highlightElement(t)}}),a.fileHighlight=function(){t||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),t=!0),a.plugins.fileHighlight.highlight.apply(this,arguments)})});function Rn(e,t){return"___"+e.toUpperCase()+t+"___"}Tn=Prism,Object.defineProperties(Tn.languages["markup-templating"]={},{buildPlaceholders:{value:function(r,i,e,o){var a;r.language===i&&(a=r.tokenStack=[],r.code=r.code.replace(e,function(e){if("function"==typeof o&&!o(e))return e;for(var t,n=a.length;-1!==r.code.indexOf(t=Rn(i,n));)++n;return a[n]=e,t}),r.grammar=Tn.languages.markup)}},tokenizePlaceholders:{value:function(c,u){var p,h;c.language===u&&c.tokenStack&&(c.grammar=Tn.languages[u],p=0,h=Object.keys(c.tokenStack),function e(t){for(var n=0;n<t.length&&!(p>=h.length);n++){var r,i,o,a,s,l=t[n];"string"==typeof l||l.content&&"string"==typeof l.content?(i=h[p],o=c.tokenStack[i],r="string"==typeof l?l:l.content,s=Rn(u,i),-1<(a=r.indexOf(s))&&(++p,i=r.substring(0,a),o=new Tn.Token(u,Tn.tokenize(o,c.grammar),"language-"+u,o),a=r.substring(a+s.length),s=[],i&&s.push.apply(s,e([i])),s.push(o),a&&s.push.apply(s,e([a])),"string"==typeof l?t.splice.apply(t,[n,1].concat(s)):l.content=s)):l.content&&e(l.content)}return t}(c.tokens))}}});function On(i,e){var o=this;this.config=i,this.router=e,this.cacheTree={},this.toc=[],this.cacheTOC={},this.linkTarget=i.externalLinkTarget||"_blank",this.linkRel="_blank"===this.linkTarget?i.externalLinkRel||"noopener":"",this.contentBase=e.getBasePath();var t=this._initRenderer();this.heading=t.heading;var a=r(e=i.markdown||{})?e(gn,t):(gn.setOptions(y(e,{renderer:y(t,e.renderer)})),gn);this._marked=a,this.compile=function(n){var r=!0,e=s(function(e){r=!1;var t="";return n?(t=c(n)?a(n):a.parser(n),t=i.noEmoji?t:t.replace(/:\+1:/g,":thumbsup:").replace(/:-1:/g,":thumbsdown:").replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g,function(e){return e.replace(/:/g,"__colon__")}).replace(/:(\w+?):/gi,window.emojify||_n).replace(/__colon__/g,":"),xn.clear(),t):n})(n),t=o.router.parse().file;return r?o.toc=o.cacheTOC[t]:o.cacheTOC[t]=[].concat(o.toc),e}}var $n={},Fn={markdown:function(e){return{url:e}},mermaid:function(e){return{url:e}},iframe:function(e,t){return{html:'<iframe src="'+e+'" '+(t||"width=100% height=400")+"></iframe>"}},video:function(e,t){return{html:'<video src="'+e+'" '+(t||"controls")+">Not Support</video>"}},audio:function(e,t){return{html:'<audio src="'+e+'" '+(t||"controls")+">Not Support</audio>"}},code:function(e,t){var n=e.match(/\.(\w+)$/);return"md"===(n=t||n&&n[1])&&(n="markdown"),{url:e,lang:n}}};On.prototype.compileEmbed=function(e,t){var n,r,i=Sn(t),o=i.str,i=i.config;if(t=o,i.include)return O(e)||(e=N(this.contentBase,F(this.router.getCurrentPath()),e)),i.type&&(r=Fn[i.type])?(n=r.call(this,e,t)).type=i.type:(r="code",/\.(md|markdown)/.test(e)?r="markdown":/\.mmd/.test(e)?r="mermaid":/\.html?/.test(e)?r="iframe":/\.(mp4|ogg)/.test(e)?r="video":/\.mp3/.test(e)&&(r="audio"),(n=Fn[r].call(this,e,t)).type=r),n.fragment=i.fragment,n},On.prototype._matchNotCompileLink=function(e){for(var t=this.config.noCompileLinks||[],n=0;n<t.length;n++){var r=t[n];if(($n[r]||($n[r]=new RegExp("^"+r+"$"))).test(e))return e}},On.prototype._initRenderer=function(){var a,s,l,c,u,p,e=new gn.Renderer,t=this.linkTarget,n=this.linkRel,o=this.router,r=this.contentBase,h=this,i={};return i.heading=e.heading=function(e,t){var n=Sn(e),r=n.str,i=n.config,e={level:t,title:An(r)};/<!-- {docsify-ignore} -->/g.test(r)&&(r=r.replace("\x3c!-- {docsify-ignore} --\x3e",""),e.title=An(r),e.ignoreSubHeading=!0),/{docsify-ignore}/g.test(r)&&(r=r.replace("{docsify-ignore}",""),e.title=An(r),e.ignoreSubHeading=!0),/<!-- {docsify-ignore-all} -->/g.test(r)&&(r=r.replace("\x3c!-- {docsify-ignore-all} --\x3e",""),e.title=An(r),e.ignoreAllSubs=!0),/{docsify-ignore-all}/g.test(r)&&(r=r.replace("{docsify-ignore-all}",""),e.title=An(r),e.ignoreAllSubs=!0);n=xn(i.id||r),i=o.toURL(o.getCurrentPath(),{id:n});return e.slug=i,h.toc.push(e),"<h"+t+' id="'+n+'"><a href="'+i+'" data-id="'+n+'" class="anchor"><span>'+r+"</span></a></h"+t+">"},i.code={renderer:e}.renderer.code=function(e,t){void 0===t&&(t="markup");var n=En.languages[t]||En.languages.markup;return'<pre v-pre data-lang="'+t+'"><code class="lang-'+t+'">'+En.highlight(e.replace(/@DOCSIFY_QM@/g,"`"),n,t)+"</code></pre>"},i.link=(n=(t={renderer:e,router:o,linkTarget:t,linkRel:n,compilerClass:h}).renderer,a=t.router,s=t.linkTarget,l=t.linkRel,c=t.compilerClass,n.link=function(e,t,n){void 0===t&&(t="");var r=[],i=Sn(t),o=i.str,i=i.config;return s=i.target||s,l="_blank"===s?c.config.externalLinkRel||"noopener":"",t=o,O(e)||c._matchNotCompileLink(e)||i.ignore?(O(e)||"./"!==e.slice(0,2)||(e=document.URL.replace(/\/(?!.*\/).*/,"/").replace("#/./","")+e),r.push(0===e.indexOf("mailto:")?"":'target="'+s+'"'),r.push(0!==e.indexOf("mailto:")&&""!==l?' rel="'+l+'"':"")):(e===c.config.homepage&&(e="README"),e=a.toURL(e,null,a.getCurrentPath())),i.crossorgin&&"_self"===s&&"history"===c.config.routerMode&&-1===c.config.crossOriginLinks.indexOf(e)&&c.config.crossOriginLinks.push(e),i.disabled&&(r.push("disabled"),e="javascript:void(0)"),i.class&&r.push('class="'+i.class+'"'),i.id&&r.push('id="'+i.id+'"'),t&&r.push('title="'+t+'"'),'<a href="'+e+'" '+r.join(" ")+">"+n+"</a>"}),i.paragraph={renderer:e}.renderer.paragraph=function(e){e=/^!>/.test(e)?vn("tip",e):/^\?>/.test(e)?vn("warn",e):"<p>"+e+"</p>";return e},i.image=(r=(n={renderer:e,contentBase:r,router:o}).renderer,u=n.contentBase,p=n.router,r.image=function(e,t,n){var r=e,i=[],o=Sn(t),a=o.str,o=o.config;return t=a,o["no-zoom"]&&i.push("data-no-zoom"),t&&i.push('title="'+t+'"'),o.size&&(t=(a=o.size.split("x"))[0],(a=a[1])?i.push('width="'+t+'" height="'+a+'"'):i.push('width="'+t+'"')),o.class&&i.push('class="'+o.class+'"'),o.id&&i.push('id="'+o.id+'"'),O(e)||(r=N(u,F(p.getCurrentPath()),e)),0<i.length?'<img src="'+r+'" data-origin="'+e+'" alt="'+n+'" '+i.join(" ")+" />":'<img src="'+r+'" data-origin="'+e+'" alt="'+n+'"'+i+">"}),i.list={renderer:e}.renderer.list=function(e,t,n){t=t?"ol":"ul";return"<"+t+" "+[/<li class="task-list-item">/.test(e.split('class="task-list"')[0])?'class="task-list"':"",n&&1<n?'start="'+n+'"':""].join(" ").trim()+">"+e+"</"+t+">"},i.listitem={renderer:e}.renderer.listitem=function(e){return/^(<input.*type="checkbox"[^>]*>)/.test(e)?'<li class="task-list-item"><label>'+e+"</label></li>":"<li>"+e+"</li>"},e.origin=i,e},On.prototype.sidebar=function(e,t){var n=this.toc,r=this.router.getCurrentPath(),i="";if(e)i=this.compile(e);else{for(var o=0;o<n.length;o++)if(n[o].ignoreSubHeading){var a=n[o].level;n.splice(o,1);for(var s=o;s<n.length&&a<n[s].level;s++)n.splice(s,1)&&s--&&o++;o--}t=this.cacheTree[r]||yn(n,t),i=mn(t,"<ul>{inner}</ul>");this.cacheTree[r]=t}return i},On.prototype.subSidebar=function(e){if(e){var t=this.router.getCurrentPath(),n=this.cacheTree,r=this.toc;r[0]&&r[0].ignoreAllSubs&&r.splice(0),r[0]&&1===r[0].level&&r.shift();for(var i=0;i<r.length;i++)r[i].ignoreSubHeading&&r.splice(i,1)&&i--;e=n[t]||yn(r,e);return n[t]=e,this.toc=[],mn(e)}this.toc=[]},On.prototype.header=function(e,t){return this.heading(e,t)},On.prototype.article=function(e){return this.compile(e)},On.prototype.cover=function(e){var t=this.toc.slice(),e=this.compile(e);return this.toc=t.slice(),e};var Cn,Ln=function(e){var t=function(e){e=e.match(/^[ \t]*(?=\S)/gm);return e?e.reduce(function(e,t){return Math.min(e,t.length)},1/0):0}(e);if(0===t)return e;t=new RegExp("^[ \\t]{"+t+"}","gm");return e.replace(t,"")},zn={};function Nn(e,r){var o=e.compiler,i=e.raw;void 0===i&&(i="");var t=e.fetch,e=zn[i];if(e){var n=e.slice();return n.links=e.links,r(n)}var n=o._marked,a=n.lexer(i),s=[],l=n.Lexer.rules.inline.link,c=a.links;a.forEach(function(e,i){"paragraph"===e.type&&(e.text=e.text.replace(new RegExp(l.source,"g"),function(e,t,n,r){r=o.compileEmbed(n,r);return r&&s.push({index:i,embed:r}),e}))});var u=[];!function(e,o){var t,n=e.embedTokens,a=e.compile,s=(e.fetch,0),l=1;if(!n.length)return o({});for(;t=n[s++];){var r=function(i){return function(e){var t,n,r;e&&("markdown"===i.embed.type?((n=i.embed.url.split("/")).pop(),n=n.join("/"),e=e.replace(/\[([^[\]]+)\]\(([^)]+)\)/g,function(e){var t=e.indexOf("(");return"(."===e.slice(t,t+2)?e.substring(0,t)+"("+window.location.protocol+"//"+window.location.host+n+"/"+e.substring(t+1,e.length-1)+")":e}),!0===(($docsify.frontMatter||{}).installed||!1)&&(e=$docsify.frontMatter.parseMarkdown(e)),t=a.lexer(e)):"code"===i.embed.type?(i.embed.fragment&&(r=i.embed.fragment,r=new RegExp("(?:###|\\/\\/\\/)\\s*\\["+r+"\\]([\\s\\S]*)(?:###|\\/\\/\\/)\\s*\\["+r+"\\]"),e=Ln((e.match(r)||[])[1]||"").trim()),t=a.lexer("```"+i.embed.lang+"\n"+e.replace(/`/g,"@DOCSIFY_QM@")+"\n```\n")):"mermaid"===i.embed.type?(t=[{type:"html",text:'<div class="mermaid">\n'+e+"\n</div>"}]).links={}:(t=[{type:"html",text:e}]).links={}),o({token:i,embedToken:t}),++l>=s&&o({})}}(t);t.embed.url?ce(t.embed.url).then(r):r(t.embed.html)}}({compile:n,embedTokens:s,fetch:t},function(e){var t,n=e.embedToken,e=e.token;e?(t=e.index,u.forEach(function(e){t>e.start&&(t+=e.length)}),y(c,n.links),a=a.slice(0,t).concat(n,a.slice(t+1)),u.push({start:t,length:n.length-1})):(zn[i]=a.concat(),a.links=zn[i].links=c,r(a))})}function Mn(e,t,n){var r,i,o,a;return t="function"==typeof n?n(t):"string"==typeof n?(o=[],a=0,(r=n).replace(B,function(t,e,n){o.push(r.substring(a,n-1)),a=n+=t.length+1,o.push(i&&i[t]||function(e){return("00"+("string"==typeof Z[t]?e[Z[t]]():Z[t](e))).slice(-t.length)})}),a!==r.length&&o.push(r.substring(a)),function(e){for(var t="",n=0,r=e||new Date;n<o.length;n++)t+="string"==typeof o[n]?o[n]:o[n](r);return t}(new Date(t))):t,e.replace(/{docsify-updated}/g,t)}function Dn(e){function t(e){var t=Boolean(e.__vue__&&e.__vue__._isVue),e=Boolean(e._vnode&&e._vnode.__v_skip);return t||e}var n=this.config,r=b(".markdown-section"),i="Vue"in window&&window.Vue.version&&Number(window.Vue.version.charAt(0));if(e=e||"<h1>404 - Not found</h1>","Vue"in window)for(var o=0,a=k(".markdown-section > *").filter(t);o<a.length;o+=1){var s=a[o];2===i?s.__vue__.$destroy():3===i&&s.__vue_app__.unmount()}if(this._renderTo(r,e),n.loadSidebar||this._renderSidebar(),(n.executeScript||"Vue"in window&&!1!==n.executeScript)&&(!(e=k(".markdown-section>script").filter(function(e){return!/template/.test(e.type)})[0])||(e=e.innerText.trim())&&new Function(e)()),"Vue"in window){var l,c,u=[],p=Object.keys(n.vueComponents||{});2===i&&p.length&&p.forEach(function(e){window.Vue.options.components[e]||window.Vue.component(e,n.vueComponents[e])}),!Cn&&n.vueGlobalOptions&&"function"==typeof n.vueGlobalOptions.data&&(Cn=n.vueGlobalOptions.data()),u.push.apply(u,Object.keys(n.vueMounts||{}).map(function(e){return[b(r,e),n.vueMounts[e]]}).filter(function(e){var t=e[0];e[1];return t})),(n.vueGlobalOptions||p.length)&&(l=/{{2}[^{}]*}{2}/,c=/<[^>/]+\s([@:]|v-)[\w-:.[\]]+[=>\s]/,u.push.apply(u,k(".markdown-section > *").filter(function(n){return!u.some(function(e){var t=e[0];e[1];return t===n})}).filter(function(e){return e.tagName.toLowerCase()in(n.vueComponents||{})||e.querySelector(p.join(",")||null)||l.test(e.outerHTML)||c.test(e.outerHTML)}).map(function(e){var t=y({},n.vueGlobalOptions||{});return Cn&&(t.data=function(){return Cn}),[e,t]})));for(var h=0,d=u;h<d.length;h+=1){var f,g=d[h],m=g[0],v=g[1],g="data-isvue";m.matches("pre, script")||t(m)||m.querySelector("["+g+"]")||(m.setAttribute(g,""),2===i?(v.el=void 0,new window.Vue(v).$mount(m)):3===i&&(f=window.Vue.createApp(v),p.forEach(function(e){var t=n.vueComponents[e];f.component(e,t)}),f.mount(m)))}}}function Pn(t,n,r,i,o,e){t=e?t:t.replace(/\/$/,""),(t=F(t))&&ce(o.router.getFile(t+r)+n,!1,o.config.requestHeaders).then(i,function(e){return Pn(t,n,r,i,o)})}var In=Object.freeze({__proto__:null,cached:s,hyphenate:o,hasOwn:l,merge:y,isPrimitive:c,noop:u,isFn:r,isExternal:p,inBrowser:!0,isMobile:h,supportsPushState:i,parseQuery:E,stringifyQuery:R,isAbsolutePath:O,removeParams:$,getParentPath:F,cleanPath:C,resolvePath:L,getPath:N,replaceSlug:M,endsWith:D});var jn,Hn,qn=function(e){function t(){e.call(this),this.config=we(this),this.initLifecycle(),this.initPlugin(),this.callHook("init"),this.initRouter(),this.initRender(),this.initEvent(),this.initFetch(),this.callHook("mounted")}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.initPlugin=function(){var t=this;[].concat(this.config.plugins).forEach(function(e){return r(e)&&e(t._lifecycle,t)})},t}((Hn=Object,function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype._loadSideAndNav=function(e,t,n,r){var i=this;return function(){if(!n)return r();Pn(e,t,n,function(e){i._renderSidebar(e),r()},i,!0)}},t.prototype._fetch=function(n){var r=this;void 0===n&&(n=u);var i,e,t,o,a,s=this.route.query,l=this.route.path;p(l)?(history.replaceState(null,"","#"),this.router.normalize()):(i=R(s,["id"]),t=(e=this.config).loadNavbar,s=e.requestHeaders,o=e.loadSidebar,a=this.router.getFile(l),s=Un(a+i,0,s),this.isRemoteUrl=p(a),this.isHTML=/\.html$/g.test(a),s.then(function(e,t){return r._renderMain(e,t,r._loadSideAndNav(l,i,o,n))},function(e){r._fetchFallbackPage(l,i,n)||r._fetch404(a,i,n)}),t&&Pn(l,i,t,function(e){return r._renderNav(e)},this,!0))},t.prototype._fetchCover=function(){var t=this,e=this.config,n=e.coverpage,r=e.requestHeaders,i=this.route.query,o=F(this.route.path);if(n){var a=null,e=this.route.path;"string"==typeof n?"/"===e&&(a=n):a=Array.isArray(n)?-1<n.indexOf(e)&&"_coverpage":!0===(e=n[e])?"_coverpage":e;var s=Boolean(a)&&this.config.onlyCover;return a?(a=this.router.getFile(o+a),this.coverIsHTML=/\.html$/g.test(a),ce(a+R(i,["id"]),!1,r).then(function(e){return t._renderCover(e,s)})):this._renderCover(null,s),s}},t.prototype.$fetch=function(e,t){var n=this;void 0===e&&(e=u),void 0===t&&(t=this.$resetEvents.bind(this));function r(){n.callHook("doneEach"),e()}this._fetchCover()?r():this._fetch(function(){t(),r()})},t.prototype._fetchFallbackPage=function(n,r,i){var o=this;void 0===i&&(i=u);var e=this.config,t=e.requestHeaders,a=e.fallbackLanguages,s=e.loadSidebar;if(!a)return!1;e=n.split("/")[1];if(-1===a.indexOf(e))return!1;e=this.router.getFile(n.replace(new RegExp("^/"+e),""));return Un(e+r,0,t).then(function(e,t){return o._renderMain(e,t,o._loadSideAndNav(n,r,s,i))},function(){return o._fetch404(n,r,i)}),!0},t.prototype._fetch404=function(e,t,n){var r=this;void 0===n&&(n=u);var i=this.config,o=i.loadSidebar,a=i.requestHeaders,i=i.notFoundPage,s=this._loadSideAndNav(e,t,o,n);if(i){e=function(t,e){var n,r=e.notFoundPage,i="_404"+(e.ext||".md");switch(typeof r){case"boolean":n=i;break;case"string":n=r;break;case"object":n=(e=Object.keys(r).sort(function(e,t){return t.length-e.length}).filter(function(e){return t.match(new RegExp("^"+e))})[0])&&r[e]||i}return n}(e,this.config);return Un(this.router.getFile(e),0,a).then(function(e,t){return r._renderMain(e,t,s)},function(){return r._renderMain(null,{},s)}),!0}return this._renderMain(null,{},s),!1},t.prototype.initFetch=function(){var e,t=this,n=this.config.loadSidebar;this.rendered?(e=de(this.router,".sidebar-nav",!0,!0),n&&e&&(e.parentNode.innerHTML+=window.__SUB_SIDEBAR__),this._bindEventOnRendered(e),this.$resetEvents(),this.callHook("doneEach"),this.callHook("ready")):this.$fetch(function(e){return t.callHook("ready")})},t}(function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.$resetEvents=function(e){var t=this,n=this.config.auto2top;"history"!==e&&(t.route.query.id&&Oe(t.route.path,t.route.query.id),"navigate"===e&&n&&(void 0===(n=n)&&(n=0),$e.scrollTop=!0===n?0:Number(n))),this.config.loadNavbar&&de(this.router,"nav")},t.prototype.initEvent=function(){function t(e){return g.classList.toggle("close")}var e;e="button.sidebar-toggle",this.router,null!=(e=d(e))&&(x(e,"click",function(e){e.stopPropagation(),t()}),h&&x(g,"click",function(e){return g.classList.contains("close")&&t()})),e=".sidebar",this.router,null!=(e=d(e))&&x(e,"click",function(e){e=e.target;"A"===e.nodeName&&e.nextSibling&&e.nextSibling.classList&&e.nextSibling.classList.contains("app-sub-sidebar")&&S(e.parentNode,"collapse")}),this.config.coverpage?h||x("scroll",he):g.classList.add("sticky")},t}(function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype._renderTo=function(e,t,n){e=d(e);e&&(e[n?"outerHTML":"innerHTML"]=t)},t.prototype._renderSidebar=function(e){var t=this.config,n=t.maxLevel,r=t.subMaxLevel,i=t.loadSidebar;if(t.hideSidebar)return[document.querySelector("aside.sidebar"),document.querySelector("button.sidebar-toggle")].forEach(function(e){return e.parentNode.removeChild(e)}),document.querySelector("section.content").style.right="unset",document.querySelector("section.content").style.left="unset",document.querySelector("section.content").style.position="relative",document.querySelector("section.content").style.width="100%",null;this._renderTo(".sidebar-nav",this.compiler.sidebar(e,n));n=de(this.router,".sidebar-nav",!0,!0);i&&n?n.parentNode.innerHTML+=this.compiler.subSidebar(r)||"":this.compiler.subSidebar(),this._bindEventOnRendered(n)},t.prototype._bindEventOnRendered=function(e){var t,n=this.config.autoHeader;!function(e){var t=b(".cover.show");Te=t?t.offsetHeight:0;var t=d(".sidebar"),n=[];null!=t&&(n=k(t,"li"));for(var r,i=0,o=n.length;i<o;i+=1){var a,s,l=n[i],c=l.querySelector("a");c&&("/"!==(a=c.getAttribute("href"))&&(c=(s=e.parse(a)).query.id,s=s.path,c&&(a=Re(s,c))),a&&(xe[decodeURIComponent(a)]=l))}h||(r=$(e.getCurrentPath()),_("scroll",function(){return Ee(r)}),x("scroll",function(){return Ee(r)}),x(t,"mouseover",function(){_e=!0}),x(t,"mouseleave",function(){_e=!1}))}(this.router),n&&e&&((n=(t=d("#main")).children[0])&&"H1"!==n.tagName&&w(t,v("div",this.compiler.header(e.innerText,1)).children[0]))},t.prototype._renderNav=function(e){e&&this._renderTo("nav",this.compiler.compile(e)),this.config.loadNavbar&&de(this.router,"nav")},t.prototype._renderMain=function(r,i,o){var a=this;if(void 0===i&&(i={}),!r)return Dn.call(this,r);this.callHook("beforeEach",r,function(e){function t(){i.updatedAt&&(n=Mn(n,i.updatedAt,a.config.formatUpdated)),a.callHook("afterEach",n,function(e){return Dn.call(a,e)})}var n;a.isHTML?(n=a.result=r,t(),o()):Nn({compiler:a.compiler,raw:e},function(e){n=a.compiler.compile(e),n=a.isRemoteUrl?ae.sanitize(n,{ADD_TAGS:["script"]}):n,t(),o()})})},t.prototype._renderCover=function(e,t){var n,r=d(".cover");S(d("main"),t?"add":"remove","hidden"),e?(S(r,"add","show"),(t=(n=this.coverIsHTML?e:this.compiler.cover(e)).trim().match('<p><img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)</p>$'))&&("color"===t[2]?r.style.background=t[1]+(t[3]||""):(e=t[1],S(r,"add","has-mask"),O(t[1])||(e=N(this.router.getBasePath(),t[1])),r.style.backgroundImage="url("+e+")",r.style.backgroundSize="cover",r.style.backgroundPosition="center center"),n=n.replace(t[0],"")),this._renderTo(".cover-main",n),he()):S(r,"remove","show")},t.prototype._updateRender=function(){var e,t,n,r;e=this,t=d(".app-name-link"),n=e.config.nameLink,r=e.route.path,t&&(c(e.config.nameLink)?t.setAttribute("href",n):"object"==typeof n&&(e=Object.keys(n).filter(function(e){return-1<r.indexOf(e)})[0],t.setAttribute("href",n[e])))},t.prototype.initRender=function(){var e=this.config;this.compiler=new On(e,this.router),window.__current_docsify_compiler__=this.compiler;var t,n,r,i,o,a=e.el||"#app",s=b("nav")||v("nav"),l=b(a),c="",u=g;l?(e.repo&&(c+=(i=e.repo,a=e.cornerExternalLinkTarge,i?(/\/\//.test(i)||(i="https://github.com/"+i),'<a href="'+(i=i.replace(/^git\+/,""))+'" target="'+(a=a||"_blank")+'" class="github-corner" aria-label="View source on Github"><svg viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>'):"")),e.coverpage&&(c+=(r=", 100%, 85%",'<section class="cover show" style="background: '+("linear-gradient(to left bottom, hsl("+Math.floor(255*Math.random())+r+") 0%,hsl("+Math.floor(255*Math.random())+r+") 100%)")+'"><div class="mask"></div><div class="cover-main">\x3c!--cover--\x3e</div></section>')),e.logo&&(r=/^data:image/.test(e.logo),t=/(?:http[s]?:)?\/\//.test(e.logo),n=/^\./.test(e.logo),r||t||n||(e.logo=N(this.router.getBasePath(),e.logo))),c+=(n=(t=e).name?t.name:"","<main>"+('<button class="sidebar-toggle" aria-label="Menu"><div class="sidebar-toggle-button"><span></span><span></span><span></span></div></button><aside class="sidebar">'+(t.name?'<h1 class="app-name"><a class="app-name-link" data-nosearch>'+(t.logo?'<img alt="'+n+'" src='+t.logo+">":n)+"</a></h1>":"")+'<div class="sidebar-nav">\x3c!--sidebar--\x3e</div></aside>')+'<section class="content"><article class="markdown-section" id="main">\x3c!--main--\x3e</article></section></main>'),this._renderTo(l,c,!0)):this.rendered=!0,e.mergeNavbar&&h?u=b(".sidebar"):(s.classList.add("app-nav"),e.repo||s.classList.add("no-badge")),e.loadNavbar&&w(u,s),e.themeColor&&(f.head.appendChild(v("div","<style>:root{--theme-color: "+e.themeColor+";}</style>").firstElementChild),o=e.themeColor,window.CSS&&window.CSS.supports&&window.CSS.supports("(--v:red)")||(e=k("style:not(.inserted),link"),[].forEach.call(e,function(e){if("STYLE"===e.nodeName)ue(e,o);else if("LINK"===e.nodeName){e=e.getAttribute("href");if(!/\.css$/.test(e))return;ce(e).then(function(e){e=v("style",e);m.appendChild(e),ue(e,o)})}}))),this._updateRender(),S(g,"ready")},t}(function(n){function e(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];n.apply(this,e),this.route={}}return n&&(e.__proto__=n),((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.updateRender=function(){this.router.normalize(),this.route=this.router.parse(),g.setAttribute("data-page",this.route.file)},e.prototype.initRouter=function(){var t=this,e=this.config,e=new("history"===(e.routerMode||"hash")&&i?q:H)(e);this.router=e,this.updateRender(),U=this.route,e.onchange(function(e){t.updateRender(),t._updateRender(),U.path!==t.route.path?(t.$fetch(u,t.$resetEvents.bind(t,e.source)),U=t.route):t.$resetEvents(e.source)})},e}(function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.initLifecycle=function(){var n=this;this._hooks={},this._lifecycle={},["init","mounted","beforeEach","afterEach","doneEach","ready"].forEach(function(e){var t=n._hooks[e]=[];n._lifecycle[e]=function(e){return t.push(e)}})},t.prototype.callHook=function(e,n,r){void 0===r&&(r=u);var i=this._hooks[e],o=function(t){var e=i[t];t>=i.length?r(n):"function"==typeof e?2===e.length?e(n,function(e){n=e,o(t+1)}):(e=e(n),n=void 0===e?n:e,o(t+1)):o(t+1)};o(0)},t}(Hn)))))));function Un(e,t,n){return jn&&jn.abort&&jn.abort(),jn=ce(e,!0,n)}window.Docsify={util:In,dom:t,get:ce,slugify:xn,version:"4.12.2"},window.DocsifyCompiler=On,window.marked=gn,window.Prism=En,e(function(e){return new qn})}(); |
New file |
| | |
| | | !function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var o=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],s=a.variable[1].inside,i=0;i<o.length;i++)s[o[i]]=e.languages.bash[o[i]];e.languages.shell=e.languages.bash}(Prism); |
New file |
| | |
| | | !function(){var u={},m={EXPIRE_KEY:"docsify.search.expires",INDEX_KEY:"docsify.search.index"};function p(e){var n={"&":"&","<":"<",">":">",'"':""","'":"'"};return String(e).replace(/[&<>"']/g,function(e){return n[e]})}function h(e){return e.text||"table"!==e.type||(e.cells.unshift(e.header),e.text=e.cells.map(function(e){return e.join(" | ")}).join(" |\n ")),e.text}function f(e){return e.text||"list"!==e.type||(e.text=e.raw),e.text}function g(i,e,r,o){void 0===e&&(e="");var s,e=window.marked.lexer(e),c=window.Docsify.slugify,d={},l="";return e.forEach(function(e,n){if("heading"===e.type&&e.depth<=o){var t=function(e){void 0===e&&(e="");var a={};return{str:e=e&&e.replace(/^('|")/,"").replace(/('|")$/,"").replace(/(?:^|\s):([\w-]+:?)=?([\w-%]+)?/g,function(e,n,t){return-1===n.indexOf(":")?(a[n]=t&&t.replace(/"/g,"")||!0,""):e}).trim(),config:a}}(e.text),a=t.str,t=t.config;s=t.id?r.toURL(i,{id:c(t.id)}):r.toURL(i,{id:c(p(e.text))}),a&&(l=a.replace(/<!-- {docsify-ignore} -->/,"").replace(/{docsify-ignore}/,"").replace(/<!-- {docsify-ignore-all} -->/,"").replace(/{docsify-ignore-all}/,"").trim()),d[s]={slug:s,title:l,body:""}}else{if(0===n&&(s=r.toURL(i),d[s]={slug:s,title:"/"!==i?i.slice(1):"Home Page",body:e.text||""}),!s)return;d[s]?d[s].body?(e.text=h(e),e.text=f(e),d[s].body+="\n"+(e.text||"")):(e.text=h(e),e.text=f(e),d[s].body=d[s].body?d[s].body+e.text:e.text):d[s]={slug:s,title:"",body:""}}}),c.clear(),d}function y(e){return e&&e.normalize?e.normalize("NFD").replace(/[\u0300-\u036f]/g,""):e}function r(i,r){var t,a,n,e,o="auto"===i.paths,s=o?(t=r.router,a=[],Docsify.dom.findAll(".sidebar-nav a:not(.section-link):not([data-nosearch])").forEach(function(e){var n=e.href,e=e.getAttribute("href"),n=t.parse(n).path;n&&-1===a.indexOf(n)&&!Docsify.util.isAbsolutePath(e)&&a.push(n)}),a):i.paths,c="";s.length&&o&&i.pathNamespaces?(n=s[0],Array.isArray(i.pathNamespaces)?c=i.pathNamespaces.filter(function(e){return n.slice(0,e.length)===e})[0]||c:i.pathNamespaces instanceof RegExp&&((d=n.match(i.pathNamespaces))&&(c=d[0])),e=-1===s.indexOf(c+"/"),d=-1===s.indexOf(c+"/README"),e&&d&&s.unshift(c+"/")):-1===s.indexOf("/")&&-1===s.indexOf("/README")&&s.unshift("/");var d,l=((d=i.namespace)?m.EXPIRE_KEY+"/"+d:m.EXPIRE_KEY)+c,p=((d=i.namespace)?m.INDEX_KEY+"/"+d:m.INDEX_KEY)+c,c=localStorage.getItem(l)<Date.now();if(u=JSON.parse(localStorage.getItem(p)),c)u={};else if(!o)return;var h=s.length,f=0;s.forEach(function(a){return u[a]?f++:void Docsify.get(r.router.getFile(a),!1,r.config.requestHeaders).then(function(e){var n,t;u[a]=g(a,e,r.router,i.depth),h===++f&&(n=i.maxAge,t=l,e=p,localStorage.setItem(t,Date.now()+n),localStorage.setItem(e,JSON.stringify(u)))})})}var o,s="";function c(e){var n=Docsify.dom.find("div.search"),t=Docsify.dom.find(n,".results-panel"),a=Docsify.dom.find(n,".clear-button"),i=Docsify.dom.find(".sidebar-nav"),n=Docsify.dom.find(".app-name");if(!e)return t.classList.remove("show"),a.classList.remove("show"),t.innerHTML="",void(o.hideOtherSidebarContent&&(i&&i.classList.remove("hide"),n&&n.classList.remove("hide")));var e=function(e){var n=[],t=[];Object.keys(u).forEach(function(n){t=t.concat(Object.keys(u[n]).map(function(e){return u[n][e]}))});var a=(e=e.trim()).split(/[\s\-ï¼\\/]+/);1!==a.length&&(a=[].concat(e,a));for(var i=0;i<t.length;i++)!function(e){var e=t[e],r=0,o="",s="",c="",d=e.title&&e.title.trim(),l=e.body&&e.body.trim(),e=e.slug||"";d&&(a.forEach(function(e){var n,t=new RegExp(p(y(e)).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&"),"gi"),a=-1,i=-1;s=d?p(y(d)):d,c=l?p(y(l)):l,a=d?s.search(t):-1,i=l?c.search(t):-1,(0<=a||0<=i)&&(r+=0<=a?3:0<=i?2:0,i<0&&(i=0),a=(a=n=0)==(n=i<11?0:i-10)?70:i+e.length+60,l&&a>l.length&&(a=l.length),t="..."+c.substring(n,a).replace(t,function(e){return'<em class="search-keyword">'+e+"</em>"})+"...",o+=t)}),0<r&&(e={title:s,content:l?o:"",url:e,score:r},n.push(e)))}(i);return n.sort(function(e,n){return n.score-e.score})}(e),r="";e.forEach(function(e){r+='<div class="matching-post">\n<a href="'+e.url+'">\n<h2>'+e.title+"</h2>\n<p>"+e.content+"</p>\n</a>\n</div>"}),t.classList.add("show"),a.classList.add("show"),t.innerHTML=r||'<p class="empty">'+s+"</p>",o.hideOtherSidebarContent&&(i&&i.classList.add("hide"),n&&n.classList.add("hide"))}function d(e){o=e}function l(e,n){var t,a,i=n.router.parse().query.s;d(e),Docsify.dom.style("\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .input-wrap {\n display: flex;\n align-items: center;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 0 7px;\n line-height: 36px;\n font-size: 14px;\n border: 1px solid transparent;\n}\n\n.search input:focus {\n box-shadow: 0 0 5px var(--theme-color, #42b983);\n border: 1px solid var(--theme-color, #42b983);\n}\n\n.search input::-webkit-search-decoration,\n.search input::-webkit-search-cancel-button,\n.search input {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n.search .clear-button {\n cursor: pointer;\n width: 36px;\n text-align: right;\n display: none;\n}\n\n.search .clear-button.show {\n display: block;\n}\n\n.search .clear-button svg {\n transform: scale(.5);\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}\n\n.app-name.hide, .sidebar-nav.hide {\n display: none;\n}"),function(e){void 0===e&&(e="");var n='<div class="input-wrap">\n <input type="search" value="'+e+'" aria-label="Search text" />\n <div class="clear-button">\n <svg width="26" height="24">\n <circle cx="12" cy="12" r="11" fill="#ccc" />\n <path stroke="white" stroke-width="2" d="M8.25,8.25,15.75,15.75" />\n <path stroke="white" stroke-width="2"d="M8.25,15.75,15.75,8.25" />\n </svg>\n </div>\n </div>\n <div class="results-panel"></div>\n </div>',e=Docsify.dom.create("div",n),n=Docsify.dom.find("aside");Docsify.dom.toggleClass(e,"search"),Docsify.dom.before(n,e)}(i),n=Docsify.dom.find("div.search"),a=Docsify.dom.find(n,"input"),e=Docsify.dom.find(n,".input-wrap"),Docsify.dom.on(n,"click",function(e){return-1===["A","H2","P","EM"].indexOf(e.target.tagName)&&e.stopPropagation()}),Docsify.dom.on(a,"input",function(n){clearTimeout(t),t=setTimeout(function(e){return c(n.target.value.trim())},100)}),Docsify.dom.on(e,"click",function(e){"INPUT"!==e.target.tagName&&(a.value="",c())}),i&&setTimeout(function(e){return c(i)},500)}function v(e,n){var t,a,i,r,o;d(e),t=e.placeholder,a=n.route.path,(r=Docsify.dom.getNode('.search input[type="search"]'))&&("string"==typeof t?r.placeholder=t:(i=Object.keys(t).filter(function(e){return-1<a.indexOf(e)})[0],r.placeholder=t[i])),e=e.noData,o=n.route.path,s="string"==typeof e?e:e[Object.keys(e).filter(function(e){return-1<o.indexOf(e)})[0]]}var b={placeholder:"Type to search",noData:"No Results!",paths:"auto",depth:2,maxAge:864e5,hideOtherSidebarContent:!1,namespace:void 0,pathNamespaces:void 0};$docsify.plugins=[].concat(function(e,n){var t=Docsify.util,a=n.config.search||b;Array.isArray(a)?b.paths=a:"object"==typeof a&&(b.paths=Array.isArray(a.paths)?a.paths:"auto",b.maxAge=(t.isPrimitive(a.maxAge)?a:b).maxAge,b.placeholder=a.placeholder||b.placeholder,b.noData=a.noData||b.noData,b.depth=a.depth||b.depth,b.hideOtherSidebarContent=a.hideOtherSidebarContent||b.hideOtherSidebarContent,b.namespace=a.namespace||b.namespace,b.pathNamespaces=a.pathNamespaces||b.pathNamespaces);var i="auto"===b.paths;e.mounted(function(e){l(b,n),i||r(b,n)}),e.doneEach(function(e){v(b,n),i&&r(b,n)})},$docsify.plugins)}(); |
New file |
| | |
| | | @import url("https://fonts.googleapis.com/css?family=Roboto+Mono|Source+Sans+Pro:300,400,600"); |
| | | * { |
| | | -webkit-font-smoothing: antialiased; |
| | | -webkit-overflow-scrolling: touch; |
| | | -webkit-tap-highlight-color: rgba(0,0,0,0); |
| | | -webkit-text-size-adjust: none; |
| | | -webkit-touch-callout: none; |
| | | box-sizing: border-box; |
| | | } |
| | | body:not(.ready) { |
| | | overflow: hidden; |
| | | } |
| | | body:not(.ready) [data-cloak], |
| | | body:not(.ready) .app-nav, |
| | | body:not(.ready) > nav { |
| | | display: none; |
| | | } |
| | | div#app { |
| | | font-size: 30px; |
| | | font-weight: lighter; |
| | | margin: 40vh auto; |
| | | text-align: center; |
| | | } |
| | | div#app:empty::before { |
| | | content: 'Loading...'; |
| | | } |
| | | .emoji { |
| | | height: 1.2rem; |
| | | vertical-align: middle; |
| | | } |
| | | .progress { |
| | | background-color: var(--theme-color, #42b983); |
| | | height: 2px; |
| | | left: 0px; |
| | | position: fixed; |
| | | right: 0px; |
| | | top: 0px; |
| | | transition: width 0.2s, opacity 0.4s; |
| | | width: 0%; |
| | | z-index: 999999; |
| | | } |
| | | .search a:hover { |
| | | color: var(--theme-color, #42b983); |
| | | } |
| | | .search .search-keyword { |
| | | color: var(--theme-color, #42b983); |
| | | font-style: normal; |
| | | font-weight: bold; |
| | | } |
| | | html, |
| | | body { |
| | | height: 100%; |
| | | } |
| | | body { |
| | | -moz-osx-font-smoothing: grayscale; |
| | | -webkit-font-smoothing: antialiased; |
| | | color: #34495e; |
| | | font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif; |
| | | font-size: 15px; |
| | | letter-spacing: 0; |
| | | margin: 0; |
| | | overflow-x: hidden; |
| | | } |
| | | img { |
| | | max-width: 100%; |
| | | } |
| | | a[disabled] { |
| | | cursor: not-allowed; |
| | | opacity: 0.6; |
| | | } |
| | | kbd { |
| | | border: solid 1px #ccc; |
| | | border-radius: 3px; |
| | | display: inline-block; |
| | | font-size: 12px !important; |
| | | line-height: 12px; |
| | | margin-bottom: 3px; |
| | | padding: 3px 5px; |
| | | vertical-align: middle; |
| | | } |
| | | li input[type='checkbox'] { |
| | | margin: 0 0.2em 0.25em 0; |
| | | vertical-align: middle; |
| | | } |
| | | .app-nav { |
| | | margin: 25px 60px 0 0; |
| | | position: absolute; |
| | | right: 0; |
| | | text-align: right; |
| | | z-index: 10; |
| | | /* navbar dropdown */ |
| | | } |
| | | .app-nav.no-badge { |
| | | margin-right: 25px; |
| | | } |
| | | .app-nav p { |
| | | margin: 0; |
| | | } |
| | | .app-nav > a { |
| | | margin: 0 1rem; |
| | | padding: 5px 0; |
| | | } |
| | | .app-nav ul, |
| | | .app-nav li { |
| | | display: inline-block; |
| | | list-style: none; |
| | | margin: 0; |
| | | } |
| | | .app-nav a { |
| | | color: inherit; |
| | | font-size: 16px; |
| | | text-decoration: none; |
| | | transition: color 0.3s; |
| | | } |
| | | .app-nav a:hover { |
| | | color: var(--theme-color, #42b983); |
| | | } |
| | | .app-nav a.active { |
| | | border-bottom: 2px solid var(--theme-color, #42b983); |
| | | color: var(--theme-color, #42b983); |
| | | } |
| | | .app-nav li { |
| | | display: inline-block; |
| | | margin: 0 1rem; |
| | | padding: 5px 0; |
| | | position: relative; |
| | | cursor: pointer; |
| | | } |
| | | .app-nav li ul { |
| | | background-color: #fff; |
| | | border: 1px solid #ddd; |
| | | border-bottom-color: #ccc; |
| | | border-radius: 4px; |
| | | box-sizing: border-box; |
| | | display: none; |
| | | max-height: calc(100vh - 61px); |
| | | overflow-y: auto; |
| | | padding: 10px 0; |
| | | position: absolute; |
| | | right: -15px; |
| | | text-align: left; |
| | | top: 100%; |
| | | white-space: nowrap; |
| | | } |
| | | .app-nav li ul li { |
| | | display: block; |
| | | font-size: 14px; |
| | | line-height: 1rem; |
| | | margin: 0; |
| | | margin: 8px 14px; |
| | | white-space: nowrap; |
| | | } |
| | | .app-nav li ul a { |
| | | display: block; |
| | | font-size: inherit; |
| | | margin: 0; |
| | | padding: 0; |
| | | } |
| | | .app-nav li ul a.active { |
| | | border-bottom: 0; |
| | | } |
| | | .app-nav li:hover ul { |
| | | display: block; |
| | | } |
| | | .github-corner { |
| | | border-bottom: 0; |
| | | position: fixed; |
| | | right: 0; |
| | | text-decoration: none; |
| | | top: 0; |
| | | z-index: 1; |
| | | } |
| | | .github-corner:hover .octo-arm { |
| | | -webkit-animation: octocat-wave 560ms ease-in-out; |
| | | animation: octocat-wave 560ms ease-in-out; |
| | | } |
| | | .github-corner svg { |
| | | color: #fff; |
| | | fill: var(--theme-color, #42b983); |
| | | height: 80px; |
| | | width: 80px; |
| | | } |
| | | main { |
| | | display: block; |
| | | position: relative; |
| | | width: 100vw; |
| | | height: 100%; |
| | | z-index: 0; |
| | | } |
| | | main.hidden { |
| | | display: none; |
| | | } |
| | | .anchor { |
| | | display: inline-block; |
| | | text-decoration: none; |
| | | transition: all 0.3s; |
| | | } |
| | | .anchor span { |
| | | color: #34495e; |
| | | } |
| | | .anchor:hover { |
| | | text-decoration: underline; |
| | | } |
| | | .sidebar { |
| | | border-right: 1px solid rgba(0,0,0,0.07); |
| | | overflow-y: auto; |
| | | padding: 40px 0 0; |
| | | position: absolute; |
| | | top: 0; |
| | | bottom: 0; |
| | | left: 0; |
| | | transition: transform 250ms ease-out; |
| | | width: 300px; |
| | | z-index: 20; |
| | | } |
| | | .sidebar > h1 { |
| | | margin: 0 auto 1rem; |
| | | font-size: 1.5rem; |
| | | font-weight: 300; |
| | | text-align: center; |
| | | } |
| | | .sidebar > h1 a { |
| | | color: inherit; |
| | | text-decoration: none; |
| | | } |
| | | .sidebar > h1 .app-nav { |
| | | display: block; |
| | | position: static; |
| | | } |
| | | .sidebar .sidebar-nav { |
| | | line-height: 2em; |
| | | padding-bottom: 40px; |
| | | } |
| | | .sidebar li.collapse .app-sub-sidebar { |
| | | display: none; |
| | | } |
| | | .sidebar ul { |
| | | margin: 0 0 0 15px; |
| | | padding: 0; |
| | | } |
| | | .sidebar li > p { |
| | | font-weight: 700; |
| | | margin: 0; |
| | | } |
| | | .sidebar ul, |
| | | .sidebar ul li { |
| | | list-style: none; |
| | | } |
| | | .sidebar ul li a { |
| | | border-bottom: none; |
| | | display: block; |
| | | } |
| | | .sidebar ul li ul { |
| | | padding-left: 20px; |
| | | } |
| | | .sidebar::-webkit-scrollbar { |
| | | width: 4px; |
| | | } |
| | | .sidebar::-webkit-scrollbar-thumb { |
| | | background: transparent; |
| | | border-radius: 4px; |
| | | } |
| | | .sidebar:hover::-webkit-scrollbar-thumb { |
| | | background: rgba(136,136,136,0.4); |
| | | } |
| | | .sidebar:hover::-webkit-scrollbar-track { |
| | | background: rgba(136,136,136,0.1); |
| | | } |
| | | .sidebar-toggle { |
| | | background-color: transparent; |
| | | background-color: rgba(255,255,255,0.8); |
| | | border: 0; |
| | | outline: none; |
| | | padding: 10px; |
| | | position: absolute; |
| | | bottom: 0; |
| | | left: 0; |
| | | text-align: center; |
| | | transition: opacity 0.3s; |
| | | width: 284px; |
| | | z-index: 30; |
| | | cursor: pointer; |
| | | } |
| | | .sidebar-toggle:hover .sidebar-toggle-button { |
| | | opacity: 0.4; |
| | | } |
| | | .sidebar-toggle span { |
| | | background-color: var(--theme-color, #42b983); |
| | | display: block; |
| | | margin-bottom: 4px; |
| | | width: 16px; |
| | | height: 2px; |
| | | } |
| | | body.sticky .sidebar, |
| | | body.sticky .sidebar-toggle { |
| | | position: fixed; |
| | | } |
| | | .content { |
| | | padding-top: 60px; |
| | | position: absolute; |
| | | top: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | left: 300px; |
| | | transition: left 250ms ease; |
| | | } |
| | | .markdown-section { |
| | | margin: 0 auto; |
| | | max-width: 80%; |
| | | padding: 30px 15px 40px 15px; |
| | | position: relative; |
| | | } |
| | | .markdown-section > * { |
| | | box-sizing: border-box; |
| | | font-size: inherit; |
| | | } |
| | | .markdown-section > :first-child { |
| | | margin-top: 0 !important; |
| | | } |
| | | .markdown-section hr { |
| | | border: none; |
| | | border-bottom: 1px solid #eee; |
| | | margin: 2em 0; |
| | | } |
| | | .markdown-section iframe { |
| | | border: 1px solid #eee; |
| | | /* fix horizontal overflow on iOS Safari */ |
| | | width: 1px; |
| | | min-width: 100%; |
| | | } |
| | | .markdown-section table { |
| | | border-collapse: collapse; |
| | | border-spacing: 0; |
| | | display: block; |
| | | margin-bottom: 1rem; |
| | | overflow: auto; |
| | | width: 100%; |
| | | } |
| | | .markdown-section th { |
| | | border: 1px solid #ddd; |
| | | font-weight: bold; |
| | | padding: 6px 13px; |
| | | } |
| | | .markdown-section td { |
| | | border: 1px solid #ddd; |
| | | padding: 6px 13px; |
| | | } |
| | | .markdown-section tr { |
| | | border-top: 1px solid #ccc; |
| | | } |
| | | .markdown-section tr:nth-child(2n) { |
| | | background-color: #f8f8f8; |
| | | } |
| | | .markdown-section p.tip { |
| | | background-color: #f8f8f8; |
| | | border-bottom-right-radius: 2px; |
| | | border-left: 4px solid #f66; |
| | | border-top-right-radius: 2px; |
| | | margin: 2em 0; |
| | | padding: 12px 24px 12px 30px; |
| | | position: relative; |
| | | } |
| | | .markdown-section p.tip:before { |
| | | background-color: #f66; |
| | | border-radius: 100%; |
| | | color: #fff; |
| | | content: '!'; |
| | | font-family: 'Dosis', 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif; |
| | | font-size: 14px; |
| | | font-weight: bold; |
| | | left: -12px; |
| | | line-height: 20px; |
| | | position: absolute; |
| | | height: 20px; |
| | | width: 20px; |
| | | text-align: center; |
| | | top: 14px; |
| | | } |
| | | .markdown-section p.tip code { |
| | | background-color: #efefef; |
| | | } |
| | | .markdown-section p.tip em { |
| | | color: #34495e; |
| | | } |
| | | .markdown-section p.warn { |
| | | background: rgba(66,185,131,0.1); |
| | | border-radius: 2px; |
| | | padding: 1rem; |
| | | } |
| | | .markdown-section ul.task-list > li { |
| | | list-style-type: none; |
| | | } |
| | | body.close .sidebar { |
| | | transform: translateX(-300px); |
| | | } |
| | | body.close .sidebar-toggle { |
| | | width: auto; |
| | | } |
| | | body.close .content { |
| | | left: 0; |
| | | } |
| | | @media print { |
| | | .github-corner, |
| | | .sidebar-toggle, |
| | | .sidebar, |
| | | .app-nav { |
| | | display: none; |
| | | } |
| | | } |
| | | @media screen and (max-width: 768px) { |
| | | .github-corner, |
| | | .sidebar-toggle, |
| | | .sidebar { |
| | | position: fixed; |
| | | } |
| | | .app-nav { |
| | | margin-top: 16px; |
| | | } |
| | | .app-nav li ul { |
| | | top: 30px; |
| | | } |
| | | main { |
| | | height: auto; |
| | | min-height: 100vh; |
| | | overflow-x: hidden; |
| | | } |
| | | .sidebar { |
| | | left: -300px; |
| | | transition: transform 250ms ease-out; |
| | | } |
| | | .content { |
| | | left: 0; |
| | | max-width: 100vw; |
| | | position: static; |
| | | padding-top: 20px; |
| | | transition: transform 250ms ease; |
| | | } |
| | | .app-nav, |
| | | .github-corner { |
| | | transition: transform 250ms ease-out; |
| | | } |
| | | .sidebar-toggle { |
| | | background-color: transparent; |
| | | width: auto; |
| | | padding: 30px 30px 10px 10px; |
| | | } |
| | | body.close .sidebar { |
| | | transform: translateX(300px); |
| | | } |
| | | body.close .sidebar-toggle { |
| | | background-color: rgba(255,255,255,0.8); |
| | | transition: 1s background-color; |
| | | width: 284px; |
| | | padding: 10px; |
| | | } |
| | | body.close .content { |
| | | transform: translateX(300px); |
| | | } |
| | | body.close .app-nav, |
| | | body.close .github-corner { |
| | | display: none; |
| | | } |
| | | .github-corner:hover .octo-arm { |
| | | -webkit-animation: none; |
| | | animation: none; |
| | | } |
| | | .github-corner .octo-arm { |
| | | -webkit-animation: octocat-wave 560ms ease-in-out; |
| | | animation: octocat-wave 560ms ease-in-out; |
| | | } |
| | | } |
| | | @-webkit-keyframes octocat-wave { |
| | | 0%, 100% { |
| | | transform: rotate(0); |
| | | } |
| | | 20%, 60% { |
| | | transform: rotate(-25deg); |
| | | } |
| | | 40%, 80% { |
| | | transform: rotate(10deg); |
| | | } |
| | | } |
| | | @keyframes octocat-wave { |
| | | 0%, 100% { |
| | | transform: rotate(0); |
| | | } |
| | | 20%, 60% { |
| | | transform: rotate(-25deg); |
| | | } |
| | | 40%, 80% { |
| | | transform: rotate(10deg); |
| | | } |
| | | } |
| | | section.cover { |
| | | align-items: center; |
| | | background-position: center center; |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | height: 100vh; |
| | | width: 100vw; |
| | | display: none; |
| | | } |
| | | section.cover.show { |
| | | display: flex; |
| | | } |
| | | section.cover.has-mask .mask { |
| | | background-color: #fff; |
| | | opacity: 0.8; |
| | | position: absolute; |
| | | top: 0; |
| | | height: 100%; |
| | | width: 100%; |
| | | } |
| | | section.cover .cover-main { |
| | | flex: 1; |
| | | margin: -20px 16px 0; |
| | | text-align: center; |
| | | position: relative; |
| | | } |
| | | section.cover a { |
| | | color: inherit; |
| | | text-decoration: none; |
| | | } |
| | | section.cover a:hover { |
| | | text-decoration: none; |
| | | } |
| | | section.cover p { |
| | | line-height: 1.5rem; |
| | | margin: 1em 0; |
| | | } |
| | | section.cover h1 { |
| | | color: inherit; |
| | | font-size: 2.5rem; |
| | | font-weight: 300; |
| | | margin: 0.625rem 0 2.5rem; |
| | | position: relative; |
| | | text-align: center; |
| | | } |
| | | section.cover h1 a { |
| | | display: block; |
| | | } |
| | | section.cover h1 small { |
| | | bottom: -0.4375rem; |
| | | font-size: 1rem; |
| | | position: absolute; |
| | | } |
| | | section.cover blockquote { |
| | | font-size: 1.5rem; |
| | | text-align: center; |
| | | } |
| | | section.cover ul { |
| | | line-height: 1.8; |
| | | list-style-type: none; |
| | | margin: 1em auto; |
| | | max-width: 500px; |
| | | padding: 0; |
| | | } |
| | | section.cover .cover-main > p:last-child a { |
| | | border-color: var(--theme-color, #42b983); |
| | | border-radius: 2rem; |
| | | border-style: solid; |
| | | border-width: 1px; |
| | | box-sizing: border-box; |
| | | color: var(--theme-color, #42b983); |
| | | display: inline-block; |
| | | font-size: 1.05rem; |
| | | letter-spacing: 0.1rem; |
| | | margin: 0.5rem 1rem; |
| | | padding: 0.75em 2rem; |
| | | text-decoration: none; |
| | | transition: all 0.15s ease; |
| | | } |
| | | section.cover .cover-main > p:last-child a:last-child { |
| | | background-color: var(--theme-color, #42b983); |
| | | color: #fff; |
| | | } |
| | | section.cover .cover-main > p:last-child a:last-child:hover { |
| | | color: inherit; |
| | | opacity: 0.8; |
| | | } |
| | | section.cover .cover-main > p:last-child a:hover { |
| | | color: inherit; |
| | | } |
| | | section.cover blockquote > p > a { |
| | | border-bottom: 2px solid var(--theme-color, #42b983); |
| | | transition: color 0.3s; |
| | | } |
| | | section.cover blockquote > p > a:hover { |
| | | color: var(--theme-color, #42b983); |
| | | } |
| | | body { |
| | | background-color: #fff; |
| | | } |
| | | /* sidebar */ |
| | | .sidebar { |
| | | background-color: #fff; |
| | | color: #364149; |
| | | } |
| | | .sidebar li { |
| | | margin: 6px 0 6px 0; |
| | | } |
| | | .sidebar ul li a { |
| | | color: #505d6b; |
| | | font-size: 14px; |
| | | font-weight: normal; |
| | | overflow: hidden; |
| | | text-decoration: none; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | .sidebar ul li a:hover { |
| | | text-decoration: underline; |
| | | } |
| | | .sidebar ul li ul { |
| | | padding: 0; |
| | | } |
| | | .sidebar ul li.active > a { |
| | | border-right: 2px solid; |
| | | color: var(--theme-color, #42b983); |
| | | font-weight: 600; |
| | | } |
| | | .app-sub-sidebar li::before { |
| | | content: '-'; |
| | | padding-right: 4px; |
| | | float: left; |
| | | } |
| | | /* markdown content found on pages */ |
| | | .markdown-section h1, |
| | | .markdown-section h2, |
| | | .markdown-section h3, |
| | | .markdown-section h4, |
| | | .markdown-section strong { |
| | | color: #2c3e50; |
| | | font-weight: 600; |
| | | } |
| | | .markdown-section a { |
| | | color: var(--theme-color, #42b983); |
| | | font-weight: 600; |
| | | } |
| | | .markdown-section h1 { |
| | | font-size: 2rem; |
| | | margin: 0 0 1rem; |
| | | } |
| | | .markdown-section h2 { |
| | | font-size: 1.75rem; |
| | | margin: 45px 0 0.8rem; |
| | | } |
| | | .markdown-section h3 { |
| | | font-size: 1.5rem; |
| | | margin: 40px 0 0.6rem; |
| | | } |
| | | .markdown-section h4 { |
| | | font-size: 1.25rem; |
| | | } |
| | | .markdown-section h5 { |
| | | font-size: 1rem; |
| | | } |
| | | .markdown-section h6 { |
| | | color: #777; |
| | | font-size: 1rem; |
| | | } |
| | | .markdown-section figure, |
| | | .markdown-section p { |
| | | margin: 1.2em 0; |
| | | } |
| | | .markdown-section p, |
| | | .markdown-section ul, |
| | | .markdown-section ol { |
| | | line-height: 1.6rem; |
| | | word-spacing: 0.05rem; |
| | | } |
| | | .markdown-section ul, |
| | | .markdown-section ol { |
| | | padding-left: 1.5rem; |
| | | } |
| | | .markdown-section blockquote { |
| | | border-left: 4px solid var(--theme-color, #42b983); |
| | | color: #858585; |
| | | margin: 2em 0; |
| | | padding-left: 20px; |
| | | } |
| | | .markdown-section blockquote p { |
| | | font-weight: 600; |
| | | margin-left: 0; |
| | | } |
| | | .markdown-section iframe { |
| | | margin: 1em 0; |
| | | } |
| | | .markdown-section em { |
| | | color: #7f8c8d; |
| | | } |
| | | .markdown-section code, |
| | | .markdown-section pre, |
| | | .markdown-section output::after { |
| | | font-family: 'Roboto Mono', Monaco, courier, monospace; |
| | | } |
| | | .markdown-section code, |
| | | .markdown-section pre { |
| | | background-color: #f8f8f8; |
| | | } |
| | | .markdown-section pre, |
| | | .markdown-section output { |
| | | margin: 1.2em 0; |
| | | position: relative; |
| | | } |
| | | .markdown-section pre > code, |
| | | .markdown-section output { |
| | | border-radius: 2px; |
| | | display: block; |
| | | } |
| | | .markdown-section pre > code, |
| | | .markdown-section output::after { |
| | | -moz-osx-font-smoothing: initial; |
| | | -webkit-font-smoothing: initial; |
| | | } |
| | | .markdown-section code { |
| | | border-radius: 2px; |
| | | color: #e96900; |
| | | margin: 0 2px; |
| | | padding: 3px 5px; |
| | | white-space: pre-wrap; |
| | | } |
| | | .markdown-section > :not(h1):not(h2):not(h3):not(h4):not(h5):not(h6) code { |
| | | font-size: 0.8rem; |
| | | } |
| | | .markdown-section pre { |
| | | padding: 0 1.4rem; |
| | | line-height: 1.5rem; |
| | | overflow: auto; |
| | | word-wrap: normal; |
| | | } |
| | | .markdown-section pre > code { |
| | | color: #525252; |
| | | font-size: 0.8rem; |
| | | padding: 2.2em 5px; |
| | | line-height: inherit; |
| | | margin: 0 2px; |
| | | max-width: inherit; |
| | | overflow: inherit; |
| | | white-space: inherit; |
| | | } |
| | | .markdown-section output { |
| | | padding: 1.7rem 1.4rem; |
| | | border: 1px dotted #ccc; |
| | | } |
| | | .markdown-section output > :first-child { |
| | | margin-top: 0; |
| | | } |
| | | .markdown-section output > :last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | .markdown-section code::after, |
| | | .markdown-section code::before, |
| | | .markdown-section output::after, |
| | | .markdown-section output::before { |
| | | letter-spacing: 0.05rem; |
| | | } |
| | | .markdown-section pre::after, |
| | | .markdown-section output::after { |
| | | color: #ccc; |
| | | font-size: 0.6rem; |
| | | font-weight: 600; |
| | | height: 15px; |
| | | line-height: 15px; |
| | | padding: 5px 10px 0; |
| | | position: absolute; |
| | | right: 0; |
| | | text-align: right; |
| | | top: 0; |
| | | } |
| | | .markdown-section pre::after, |
| | | .markdown-section output::after { |
| | | content: attr(data-lang); |
| | | } |
| | | /* code highlight */ |
| | | .token.comment, |
| | | .token.prolog, |
| | | .token.doctype, |
| | | .token.cdata { |
| | | color: #8e908c; |
| | | } |
| | | .token.namespace { |
| | | opacity: 0.7; |
| | | } |
| | | .token.boolean, |
| | | .token.number { |
| | | color: #c76b29; |
| | | } |
| | | .token.punctuation { |
| | | color: #525252; |
| | | } |
| | | .token.property { |
| | | color: #c08b30; |
| | | } |
| | | .token.tag { |
| | | color: #2973b7; |
| | | } |
| | | .token.string { |
| | | color: var(--theme-color, #42b983); |
| | | } |
| | | .token.selector { |
| | | color: #6679cc; |
| | | } |
| | | .token.attr-name { |
| | | color: #2973b7; |
| | | } |
| | | .token.entity, |
| | | .token.url, |
| | | .language-css .token.string, |
| | | .style .token.string { |
| | | color: #22a2c9; |
| | | } |
| | | .token.attr-value, |
| | | .token.control, |
| | | .token.directive, |
| | | .token.unit { |
| | | color: var(--theme-color, #42b983); |
| | | } |
| | | .token.keyword, |
| | | .token.function { |
| | | color: #e96900; |
| | | } |
| | | .token.statement, |
| | | .token.regex, |
| | | .token.atrule { |
| | | color: #22a2c9; |
| | | } |
| | | .token.placeholder, |
| | | .token.variable { |
| | | color: #3d8fd1; |
| | | } |
| | | .token.deleted { |
| | | text-decoration: line-through; |
| | | } |
| | | .token.inserted { |
| | | border-bottom: 1px dotted #202746; |
| | | text-decoration: none; |
| | | } |
| | | .token.italic { |
| | | font-style: italic; |
| | | } |
| | | .token.important, |
| | | .token.bold { |
| | | font-weight: bold; |
| | | } |
| | | .token.important { |
| | | color: #c94922; |
| | | } |
| | | .token.entity { |
| | | cursor: help; |
| | | } |
| | | code .token { |
| | | -moz-osx-font-smoothing: initial; |
| | | -webkit-font-smoothing: initial; |
| | | min-height: 1.5rem; |
| | | position: relative; |
| | | left: auto; |
| | | } |
New file |
| | |
| | | # åè½ä»ç» |
| | | |
| | | ## â³ æ¸²æææ :id=show |
| | | 1. *å è½½æç¤º* |
| | | æ¯æå¨ *mp-html* æ ç¾å
鍿¾ä¸èªå®ä¹çå è½½æç¤ºï¼å
容æªå è½½å®æï¼æä¸ºç©ºï¼æ¶å°æ¾ç¤ºï¼å è½½å®æåèªå¨éè |
| | | ```wxml |
| | | <mp-html>å è½½ä¸...</mp-html> |
| | | ``` |
| | | 2. *èªå¨è®¾ç½®æ é¢* |
| | | æ¯æèªå¨æ *title* æ ç¾çå
容设置å°é¡µé¢æ é¢ä¸ï¼å¦ä¸éè¦ï¼å¯éè¿ [set-title](basic/prop#set-title) 屿§å
³é |
| | | 3. *é¿æå¤å¶* |
| | | æ¯æé¿æå¤å¶ææ¬å
容ï¼å¯éè¿ [selectable](basic/prop#selectable) 屿§å¼å¯ |
| | | 4. *æ¯æ rpx* |
| | | æ¯æ *rpx* ä½ä¸ºåä½ï¼èªå¨æ ¹æ®å±å¹å®½åº¦è°æ´ |
| | | 5. *æ¯æ html å®ä½* |
| | | æ¯æææå½¢å¦ *&#123;* ç *html* å®ä½å大é¨å常ç¨çå½¢å¦ *&nbsp;* çå®ä½ |
| | | |
| | | |
| | | ## ð° å¾çææ :id=img |
| | | 1. *å ä½å¾* |
| | | æ¯æè®¾ç½®å¾çæªå è½½å®ææ¶çå ä½å¾ [loading-img](basic/prop#loading-img) åå è½½åºéæ¶çå ä½å¾ [error-img](basic/prop#error-img) |
| | | 2. *æå è½½* |
| | | å
容è¾é¿ãå¾çè¾å¤æ¶ï¼å¼å¯æå è½½æå©äºæ¹åæ§è½ï¼éè¦æ¶å¯éè¿ [lazy-load](basic/prop#lazy-load) 屿§å¼å¯ |
| | | 3. *èªå¨é¢è§* |
| | | å¾ç被ç¹å»æ¶ï¼å°èªå¨æ¾å¤§é¢è§ï¼å¦ä¸éè¦ï¼å¯éè¿ [preview-img](basic/prop#preview-img) 屿§å
³éãè¿å¯ä»¥å¨ [imgtap](basic/event#imgtap) äºä»¶ä¸è¿è¡èªå®ä¹å¤ç |
| | | èªå¨é¢è§éè¿ç¹å®çå¤çï¼å¯ä»¥å®ç°å·¦å³æ»å¨æ¥çææå¾çãé¢è§éå¤é¾æ¥ä¸éä½çææ |
| | | 4. *é¢è§é«æ¸
å¾* |
| | | åä¸å¼ å¾çï¼å¯ä»¥ç»æ¾ç¤ºæ¶åé¢è§æ¶è®¾ç½®ä¸åç龿¥å°åä»¥è¾¾å°æä½³ææ |
| | | 设置æ¹å¼ 1ï¼ç» *img* æ ç¾å¢å ä¸ä¸ª *original-src* å³å¯ |
| | | ```html |
| | | <!-- æ¾ç¤ºæ¶ä½¿ç¨ xxxï¼é¢è§æ¶ä½¿ç¨ yyy --> |
| | | <img src="xxx" original-src="yyy" /> |
| | | ``` |
| | | 设置æ¹å¼ 2ï¼éè¿ [imgList](advanced/api#imgList) ç *api* è¿è¡è®¾ç½® |
| | | 5. *é¿æå¼¹åºèå* |
| | | 微信åç¾åº¦å¹³å°æ¯æå¾çé¿ææ¶å¼¹åºèåï¼å¯ä»¥è¿è¡ä¿åãå享çæä½ï¼å¦ä¸éè¦ï¼å¯éè¿ [show-img-menu](basic/prop#show-img-menu) 屿§å
³é |
| | | 6. *è£
饰å¾çå¤ç* |
| | | ææ¶å¯¹äºä¸äºå°çè£
饰æ§å¾çï¼å¯è½ä¸å¸æäº§çä¸è¿°ææï¼æ¤æ¶å¯ä»¥ç» *img* æ ç¾è®¾ç½® *ignore* 屿§ï¼å°å±è½é¢è§ãå¼¹åºèåçæä½ï¼æåä½éª |
| | | ```html |
| | | <!-- 设置 ignore 屿§åè¿å¼ å¾çä¸å¯é¢è§ãä¸ä¼å¼¹åºèå --> |
| | | <img src="xxx" ignore /> |
| | | ``` |
| | | å¨é¾æ¥å
çã*src* 为 *data url* 䏿²¡æè®¾ç½® *original-src* çå¾çï¼é»è®¤ä¸ºä¸å¯é¢è§çå°å¾ç |
| | | 7. *æ¯æå大尿¾ç¤º* |
| | | æ¬ç»ä»¶éè¿åç转æ¢ï¼åºæ¬å®ç°äºå *html* ä¸ *img* çç¸åææï¼æ²¡æè®¾ç½®å®½åº¦æ¶æå大尿¾ç¤ºï¼è®¾ç½®äºå®½åº¦æ¶ææ¯ä¾ç¼©æ¾ï¼åæ¶è®¾ç½®å®½é«æ¶æè®¾ç½®ç弿¾ç¤ºãä¸å¿
å»èèå°ç¨åºä¸ç *mode* çé®é¢ |
| | | 8. *æ¯æ svg* |
| | | è½ç¶å°ç¨åºä¸ä¸æ¯æ *svg* ç³»åæ ç¾ï¼æ¬ç»ä»¶éè¿å¨è§£æè¿ç¨ä¸è½¬ä¸º *data url* å¾ççæ¹å¼å®ç°äº *svg* çæ¾ç¤º |
| | | |
| | | ## ð 龿¥ææ :id=link |
| | | 1. *æ¯æè®¾ç½®å¤ç§ç¶æä¸çæ ·å¼* |
| | | å
æ¬é»è®¤ç¶æãç¹å»æçæ ·å¼ï¼å¯ä»¥å¨ *src/node/node.wxss* ä¸è¿è¡ä¿®æ¹ |
| | | 2. *éç¹è·³è½¬* |
| | | æ¯æè·³è½¬å
é¨éç¹ï¼ä½¿ç¨éç¹éè¦å¼å¯ [use-anchor](basic/prop#use-anchor) 屿§ |
| | | 跳转æ¹å¼ 1ï¼ç» *a* æ ç¾ç *href* 屿§è®¾ç½®ä¸º *#id*ï¼ç¹å»æ¶å³å¯è·³è½¬å°å¯¹åº *id* çä½ç½®ï¼è®¾ç½®ä¸º *#* å跳转å°å¼å¤´ï¼ |
| | | 跳转æ¹å¼ 2ï¼éè¿ [navigateTo](advanced/api#navigateTo) ç *api* è¿è¡è·³è½¬ |
| | | é»è®¤æ
åµä¸éç¹è·³è½¬éè¿æ§å¶é¡µé¢æ»å¨çæ¹å¼è¿è¡ï¼å¦æè¦å¨ *scroll-view* å
使ç¨ï¼å¯ä»¥éè¿ [in](advanced/api#in) ç *api* è¿è¡é
ç½® |
| | | 3. *跳转å
é¨è·¯å¾* |
| | | 妿éè¦ç¹å» *a* æ ç¾è·³è½¬å°å°ç¨åºå
çä¸ä¸ªé¡µé¢ï¼ç´æ¥å°å
¶ *href* 屿§è®¾ç½®ä¸ºé¡µé¢è·¯å¾å³å¯ï¼å
æ¬ *tab* 页é¢ï¼éè¦ä½¿ç¨ç»å¯¹è·¯å¾ï¼ |
| | | ```html |
| | | <!-- è¯¥é¾æ¥è¢«ç¹å»åå°è·³è½¬å° /pages/test/test é¡µé¢ --> |
| | | <a href="/pages/test/test">龿¥</a> |
| | | ``` |
| | | 4. *å¤å¶å¤é¨é¾æ¥* |
| | | 对äºå¤é¨é¾æ¥ï¼ç±äºå°ç¨åºæ æ³ç´æ¥æå¼ï¼å°èªå¨å¤å¶å°åªè´´æ¿ï¼å¦ä¸éè¦ï¼å¯éè¿ [copy-link](basic/prop#copy-link) 屿§å
³é |
| | | |
| | | ?> 设置 *a* æ ç¾ç *href* 屿§æ¶ï¼å¦ææ¯å¤é¨é¾æ¥éå°åè®®å *http://* å宿´ï¼å¦åä¼è¢«è®¤ä¸ºæ¯å
é¨è·¯å¾å¹¶å°è¯è·³è½¬ |
| | | é¤è¿äºé»è®¤çå¤çå¤ï¼è¿å¯ä»¥å¨ [linktap](basic/event#linktap) äºä»¶ä¸è¿è¡èªå®ä¹å¤ç |
| | | |
| | | ## ð è¡¨æ ¼ææ :id=table |
| | | 1. *æ¯æç¬ç«æ¨ªåæ»å¨* |
| | | è¡¨æ ¼å®½åº¦é常è¾å¤§ï¼å®¹æè¶
åºå±å¹å®½åº¦ï¼å¯¼è´æ´ä½å
容ä¸èµ·æ»å¨ï¼å½±åä½éªï¼å¯ä»¥éè¿è®¾ç½® [scroll-table](basic/prop#scroll-table) 屿§ç»ææè¡¨æ ¼æ·»å ä¸ä¸ªæ»å¨å±ä½¿å
¶è½åç¬æ¨ªåæ»å¨ |
| | | 2. *æ¯æå¸¸ç¨è¡¨æ ¼å±æ§* |
| | | æ¯æ *border*, *cellspacing*, *cellpadding*, *align* ç常ç¨è¡¨æ ¼å±æ§ |
| | | 3. *æ¯æå«æåå¹¶åå
æ ¼çè¡¨æ ¼* |
| | | |
| | | 鿏²æåçï¼ |
| | | å°ç¨åºä¸æ²¡æ *table* æ ç¾ï¼ä½¿å¾æ¾ç¤ºè¡¨æ ¼ä¸ç´æ¯ä¸ä¸ªé¾é¢ï¼æ¬ç»ä»¶ä¸»è¦éè¿ä»¥ä¸ä¸ç§æ¹å¼æ¾ç¤ºè¡¨æ ¼ |
| | | |
| | | | æ¾ç¤ºæ¹å¼ | éç¨æ
åµ | 说æ | |
| | | |:---:|:---:|:---:| |
| | | | *rich-text* æ ç¾ | è¡¨æ ¼å
鍿²¡æé¾æ¥ãå¾ççç¹æ®æ ç¾ | æææä½³ï¼å ä¹ä¸éè¦è¿è¡è½¬æ¢ | |
| | | | *table* å¸å± | è¡¨æ ¼å
æç¹æ®æ ç¾ä½æ²¡æä½¿ç¨åå¹¶åå
æ ¼ | éè¦è¿è¡ä¸å®è½¬æ¢ï¼å° *table*, *tr*, *td* çæ ç¾è½¬ä¸ºå¯¹åºçå¸å± | |
| | | | *grid* å¸å± | è¡¨æ ¼å
æç¹æ®æ ç¾ä¸ä½¿ç¨äºåå¹¶åå
æ ¼ | éè¦è¿è¡å¤æç转æ¢å°åå¹¶åå
æ ¼ç¨ *grid* å¸å±è¡¨ç°åºæ¥ | |
| | | |
| | | ## ð åè¡¨ææ :id=list |
| | | 1. *æ¯æå¤å±åµå¥* |
| | | æ¯æåµå¥å¤å±å表ï¼å¯¹äºæ åºå表ï¼ä¸åçå±çº§ä¼æ¾ç¤ºä¸åçé»ç¹æ ¼å¼ |
| | | 2. *æ¯æå¤ç§æåºåè¡¨æ ¼å¼* |
| | | éè¿è®¾ç½® *ol* æ ç¾ç *type* 屿§ï¼å¯ä»¥æ¾ç¤ºæ°åã忝ãç½é©¬æ°åçå¤ç§å½¢å¼çæ å· |
| | | 3. *æ¯æä¸æ¾ç¤ºæ å·* |
| | | æ¯æéè¿è®¾ç½® *list-style:none* çæ¹å¼ä¸æ¾ç¤º *li* æ ç¾å¼å¤´çæ å· |
| | | |
| | | ## ð¬ é³è§é¢ææ :id=video |
| | | 1. *èªå¨æå* |
| | | å¨åå¨å¤ä¸ªè§é¢çæ
åµä¸ï¼åæ¶ææ¾å¯è½ä¼å½±åä½éªï¼æ¬ç»ä»¶æ¯æå¨ææ¾ä¸ä¸ªè§é¢çæ¶åèªå¨æåå
¶ä»ææè§é¢ï¼å¦ä¸éè¦ï¼å¯éè¿ [pause-video](basic/prop#pause-video) 屿§å
³é |
| | | é³é¢å¨å¼å
¥ [audio](advanced/plugin#audio) æä»¶åä¹å¯ä»¥å®ç°æ¤ææ |
| | | 2. *夿ºå è½½* |
| | | ä¸å平尿¯æææ¾çæ ¼å¼ä¸åï¼åªè®¾ç½®ä¸ä¸ª *src* å¯è½ä¼åºç°å
¼å®¹æ§é®é¢å¯¼è´æ æ³ææ¾ï¼å æ¤æ¬ç»ä»¶æ¯æå *html* ä¸ä¸æ ·ç» *video* å *audio* 设置å¤ä¸ª *source*ï¼å°æç
§é¡ºåºè¿è¡å è½½ï¼ç´å°å¯ä»¥ææ¾ï¼æå¤§ç¨åº¦ä¸é¿å
æ æ³ææ¾ |
| | | ```html |
| | | <!-- ç»ä»¶å°ä¾æ¬¡å è½½ xxx å yyy --> |
| | | <video controls> |
| | | <source src="xxx"> |
| | | <source src="yyy"> |
| | | </video> |
| | | ``` |
| | | 3. *èªå¨æ·»å æ§ä»¶* |
| | | å¯¹äºæ¢æ²¡æè®¾ç½® *controls* 乿²¡æè®¾ç½® *autoplay* çæ ç¾å°èªå¨æ *controls* 屿§è®¾ç½®ä¸º *true*ï¼é¿å
æ æ³ææ¾ï¼å½±åä½éª |
| | | |
| | | ## ð¡ æ ·å¼è®¾ç½® :id=style |
| | | æ ·å¼ï¼*css*ï¼æ¯å¯ææ¬ä¸æéè¦çå
容ä¹ä¸ï¼æ¬ç»ä»¶æä¾å¤ç§æ ·å¼è®¾ç½®çæ¹æ³ï¼å¯ä»¥è¿è¡çµæ´»ç设置 |
| | | |
| | | 1. *è¡å
æ ·å¼* |
| | | è¿æ¯æå¸¸ç¨çæ ·å¼è®¾ç½®æ¹æ³ï¼ç´æ¥å°éè¦çæ ·å¼æ¾å¨å¯¹åºæ ç¾ç *style* 屿§ä¸å³å¯ï¼è¿ç§æ¹å¼ä»
ä½ç¨äºå个æ ç¾ï¼ä¼å
级æé« |
| | | 2. *tag-style* |
| | | è¿æ¯æ¬ç»ä»¶ç¬æçä¸ç§æ ·å¼è®¾ç½®æ¹å¼ï¼å¯ä»¥ç»æä¸ç§æ ç¾å设置é»è®¤çæ ·å¼ |
| | | å¯ä»¥éè¿ [tag-style](basic/prop#tag-style) 屿§è®¾ç½®ï¼å
·ä½ç¨æ³è§å¯¹åºè¯´æ |
| | | 3. *å¤é¨æ ·å¼* |
| | | å¦æå¸æå°æäºæ ·å¼åºå®çç¨äºæ¸²æï¼å¯ä»¥æ·»å å° *tools/config.js* ç *externStyle* åæ®µä¸ï¼è¯¥æ¹æ³ä»
æ¯æ *class* éæ©å¨ï¼[2.1.0](changelog/changlog#v210) çæ¬èµ·æ¯ææ ç¾åéæ©å¨ï¼ï¼ä¼å
级æä½ï¼å
·ä½è§ [个æ§å](overview/quickstart#setting) |
| | | |
| | | éè¦è°æ´ä¼å
级æ¶ï¼å¯ä»¥éè¿è®¾ç½® *!important* å®ç° |
| | | |
| | | å¦å¤ï¼éè¿å¼å
¥ [style](advanced/plugin#style) æä»¶ï¼è¿å¯ä»¥å®ç°å¹é
*style* æ ç¾ä¸æ ·å¼çåè½ |
| | | |
| | | ## ð å
¨é¢çæ ç¾æ¯æ :id=tag |
| | | æ¬ç»ä»¶æ¯æä»¥ä¸æ ç¾å屿§ï¼ |
| | | |
| | | | æ ç¾ | 屿§ | |
| | | |:---:|:---:| |
| | | | a | href | |
| | | | abbr | | |
| | | | address | | |
| | | | article | | |
| | | | aside | | |
| | | | audio | author, controls, loop, name, poster, src | |
| | | | b | | |
| | | | base | href | |
| | | | big | | |
| | | | blockquote | | |
| | | | body | | |
| | | | br | | |
| | | | caption | | |
| | | | center | | |
| | | | cite | | |
| | | | code | | |
| | | | col | span | |
| | | | colgroup | span | |
| | | | dd | | |
| | | | del | | |
| | | | div | | |
| | | | dl | | |
| | | | dt | | |
| | | | em | | |
| | | | embed | autostart, loop, src, type | |
| | | | fieldset | | |
| | | | font | color, face, size | |
| | | | footer | | |
| | | | h1 | | |
| | | | h2 | | |
| | | | h3 | | |
| | | | h4 | | |
| | | | h5 | | |
| | | | h6 | | |
| | | | head | | |
| | | | header | | |
| | | | hr | | |
| | | | html | | |
| | | | i | | |
| | | | img | ignore, original-src, src | |
| | | | ins | | |
| | | | label | | |
| | | | legend | | |
| | | | li | | |
| | | | mark | | |
| | | | nav | | |
| | | | ol | start, type | |
| | | | p | | |
| | | | pre | | |
| | | | q | | |
| | | | rt | | |
| | | | ruby | | |
| | | | s | | |
| | | | section | | |
| | | | small | | |
| | | | source | src | |
| | | | span | | |
| | | | strike | | |
| | | | strong | | |
| | | | style | | |
| | | | sub | | |
| | | | sup | | |
| | | | table | border, cellpadding, cellspacing | |
| | | | tbody | | |
| | | | td | colspan, rowspan | |
| | | | tfoot | | |
| | | | th | colspan, rowspan | |
| | | | thead | | |
| | | | tr | | |
| | | | tt | | |
| | | | u | | |
| | | | ul | | |
| | | | video | autoplay, controls, loop, muted, object-fit, poster, src | |
| | | |
| | | 说æï¼ |
| | | 1. é¤ä¸é¢å举çå¤ï¼è¿æ¯æ *svg* ç³»åçæ ç¾å *id*ã*style*ã*class*ã*align*ã*height*ã*width*ã*dir* 屿§ |
| | | 2. 对äºä¸ä¿¡ä»»çæ ç¾ï¼é¤ä¸ªå«å°è¢«ç´æ¥ç§»é¤ï¼é½ä¼è¢«è½¬ä¸ºä¸ä¸ªè¡å
æ ç¾ï¼å æ¤å¯ä»¥ä½¿ç¨æ´å¤è¯ä¹åæ ç¾ |
| | | |
| | | ## ð ç¨³å®æ§ :id=stable |
| | | æ¬ç»ä»¶çè§£æèæ¬è½å¤æ¯æå¤ç§ *html* æ ¼å¼ï¼å
·æå¼ºå¤§çç¨³å®æ§ï¼ |
| | | 1. æ ç¾åä¸å¯ä»¥å«æ *:* çç¹æ®å符ï¼å¦ *o:p*ï¼ |
| | | 2. æ ç¾åå屿§å大å°å䏿æ |
| | | 3. 屿§å¼å¯ä»¥ä¸å å¼å·ãå åå¼å·ãå åå¼å·ï¼ä¹å¯ä»¥ç¼ºçï¼é»è®¤ *true*ï¼ |
| | | 4. 屿§ä¹é´å¯ä»¥æ²¡æç©ºæ ¼ï¼éè¿å¼å·ååï¼ãæç©ºæ ¼ï¼å¯ä»¥å¤ä¸ªï¼ãææ¢è¡ç¬¦ |
| | | 5. æ¯ææ£å¸¸æ ¼å¼ã*CDATA* çå¤ç§å½¢å¼ç注é |
| | | |
| | | åæ¶ï¼å¯¹äºä¸äºé误æ
åµï¼ç¨åºä¹è½å¤èªå¨å¤çï¼ |
| | | 1. æ ç¾é¦å°¾ä¸å¹é
|
| | | 2. 屿§å¼ä¸åå·ä¸å¹é
|
| | | 3. æ ç¾æªéå |
| | | |
| | | 以䏿
åµåè½æ£ç¡®è§£æï¼ |
| | | ```html |
| | | <!-- ä¸åç屿§æ ¼å¼ --> |
| | | <font face="å®ä½" color='green' size=7>Hello</font> |
| | | <!-- æ ç¾é¦å°¾ä¸å¹é
ææªéå --> |
| | | <div> World</section> |
| | | <!-- 大å°åæé
--> |
| | | <dIv StYle="color:green">!</DIv> |
| | | ``` |
New file |
| | |
| | | # å¿«éå¼å§ :id=quickstart |
| | | |
| | | ## ð¦ æºç è·å :id=source |
| | | |
| | | #### å°ç¨åºæ¹å¼ :id=mp |
| | | !> 该æ¹å¼æä¸å¯ç¨ |
| | | |
| | | æå¼å¾®ä¿¡å°ç¨åº *å¯ææ¬æä»¶*ï¼ç¹å» *è·åç»ä»¶å
* æé®ï¼éæ©ä½¿ç¨å¹³å°ã[æ©å±æä»¶](advanced/plugin) 以å [个æ§å设置](#setting) åå³å¯çæç»ä»¶å
|
| | |  |
| | | |
| | | #### npm æ¹å¼ :id=npm |
| | | ```bash |
| | | # éè¿ npm è·å |
| | | npm install mp-html |
| | | # æéè¿ yarn è·å |
| | | yarn add mp-html |
| | | ``` |
| | | éè¦å级æ¶ï¼ |
| | | ```bash |
| | | # éè¿ npm å级 |
| | | npm update mp-html |
| | | # æéè¿ yarn å级 |
| | | yarn upgrade mp-html |
| | | ``` |
| | | #### git æ¹å¼ :id=git |
| | | ```bash |
| | | # éè¿ github è·å |
| | | git clone https://github.com/jin-yufeng/mp-html.git |
| | | # æéè¿ gitee è·å |
| | | git clone https://gitee.com/jin-yufeng/mp-html.git |
| | | ``` |
| | | #### ä¸è½½ zip :id=zip |
| | | *github releases*ï¼[https://github.com/jin-yufeng/mp-html/releases](https://github.com/jin-yufeng/mp-html/releases) |
| | | *gitee releases*ï¼[https://gitee.com/jin-yufeng/mp-html/releases](https://gitee.com/jin-yufeng/mp-html/releases) |
| | | |
| | | #### QQ 群 :id=qqgroup |
| | | *QQ* 交æµç¾¤ç群æä»¶ä¸ä¹å¯ä»¥è·åç»ä»¶å
|
| | | 交æµç¾¤1: `699734691` |
| | | 交æµç¾¤2: `778239129` |
| | | 交æµç¾¤3: `960265313` |
| | | |
| | | ## ð å¼å
¥åä½¿ç¨ :id=use |
| | | |
| | | ### ð åçæ¡æ¶ :id=miniprogram |
| | | |
| | | #### å¼å
¥ :id=mp-import |
| | | - npm æ¹å¼ |
| | | |
| | | ?> æ¬æ¹æ³ä»
éç¨äºå¾®ä¿¡ã*QQ* å°ç¨åº |
| | | |
| | | 1. å¨å°ç¨åºé¡¹ç®æ ¹ç®å½ä¸éè¿ [npm](#npm) å®è£
ç»ä»¶å
|
| | | 2. å¼åè
å·¥å
·ä¸å¾é *ä½¿ç¨ npm 模å*ï¼è¥æ²¡ææ¤é项åä¸éè¦ï¼å¹¶ç¹å» *å·¥å
·* - *æå»º npm* |
| | | 3. å¨éè¦ä½¿ç¨é¡µé¢ç *json* æä»¶ä¸æ·»å |
| | | ```json |
| | | { |
| | | "usingComponents": { |
| | | "mp-html": "mp-html" |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | - æºç å¼å
¥ |
| | | |
| | | ?> æ¬æ¹æ³éç¨äºææå¹³å° |
| | | |
| | | 1. å° [æºç ](#source) ä¸å¯¹åºå¹³å°ç代ç å
ï¼*dist/platform*ï¼æ·è´å° *components* ç®å½ä¸ï¼æ´å为 *mp-html* |
| | | 2. å¨éè¦ä½¿ç¨é¡µé¢ç *json* æä»¶ä¸æ·»å |
| | | ```json |
| | | { |
| | | "usingComponents": { |
| | | "mp-html": "/components/mp-html/index" |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | #### ä½¿ç¨ :id=mp-use |
| | | |
| | | 1. å¨éè¦ä½¿ç¨é¡µé¢ç *wxml* æä»¶ä¸æ·»å |
| | | ```wxml |
| | | <mp-html content="{{html}}" /> |
| | | ``` |
| | | 2. å¨éè¦ä½¿ç¨é¡µé¢ç *js* æä»¶ä¸æ·»å |
| | | ```javascript |
| | | Page({ |
| | | onLoad () { |
| | | this.setData({ |
| | | html: '<div>Hello World!</div>' |
| | | }) |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | æ¯æç [屿§](basic/prop) å [äºä»¶](basic/event) è§å¯¹åºææ¡£ |
| | | |
| | | ### ð uni-app æ¡æ¶ :id=uni-app |
| | | |
| | | #### uni-modules æ¹å¼ :id=uni-modules |
| | | ?> æ¬æ¹æ³éè¦ä½¿ç¨ *3.1.0+* çæ¬ç *HBuilder X* å¼å |
| | | |
| | | 1. è¿å
¥ [æä»¶å¸åº](https://ext.dcloud.net.cn/plugin?id=805)ï¼ç¹å»å³ä¸è§ç *ä½¿ç¨ HBuilder X 导å
¥æä»¶* æé®å¯¼å
¥é¡¹ç®æç¹å» *ä¸è½½æä»¶ZIP* æé®ä¸è½½æä»¶å
å¹¶è§£åå°é¡¹ç®ç *uni_modules/mp-html* ç®å½ä¸ |
| | | 2. å¨éè¦ä½¿ç¨é¡µé¢ç *(n)vue* æä»¶ä¸æ·»å |
| | | ```vue |
| | | <template> |
| | | <view> |
| | | <!-- ä¸éè¦å¼å
¥ï¼å¯ç´æ¥ä½¿ç¨ --> |
| | | <mp-html :content="html" /> |
| | | </view> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | data () { |
| | | return { |
| | | html: '<div>Hello World!</div>' |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | ``` |
| | | 3. éè¦æ´æ°çæ¬æ¶å¨ *HBuilder X* ä¸å³é® *uni_modules/mp-html* ç®å½éæ© *仿件å¸åºæ´æ°* å³å¯ |
| | | |
| | | #### æºç æ¹å¼ :id=uni-app-source |
| | | 1. å° [æºç ](#source) ä¸ *dist/uni-app* å
çå
容æ·è´å° **é¡¹ç®æ ¹ç®å½** ä¸ |
| | | |
| | | !> [æä»¶å¸åº](https://ext.dcloud.net.cn/plugin?id=805) ç *é uni_modules* çæ¬æ æ³æ´æ°ï¼è¯·ä»å
¶ä»æ¹å¼è·å [æºç ](#source) |
| | | 2. å¨éè¦ä½¿ç¨é¡µé¢ç *(n)vue* æä»¶ä¸æ·»å |
| | | ```vue |
| | | <template> |
| | | <view> |
| | | <mp-html :content="html" /> |
| | | </view> |
| | | </template> |
| | | <script> |
| | | import mpHtml from '@/components/mp-html/mp-html' |
| | | export default { |
| | | // HBuilderX 2.5.5+ å¯ä»¥éè¿ easycom èªå¨å¼å
¥ |
| | | components: { |
| | | mpHtml |
| | | }, |
| | | data () { |
| | | return { |
| | | html: '<div>Hello World!</div>' |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | ``` |
| | | |
| | | #### npm æ¹å¼ :id=uni-app-npm |
| | | 1. å¨é¡¹ç®æ ¹ç®å½ä¸éè¿ [npm](#npm) å®è£
ç»ä»¶å
|
| | | 2. å¨éè¦ä½¿ç¨é¡µé¢ç *(n)vue* æä»¶ä¸æ·»å |
| | | ```vue |
| | | <template> |
| | | <view> |
| | | <mp-html :content="html" /> |
| | | </view> |
| | | </template> |
| | | <script> |
| | | import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html' |
| | | export default { |
| | | // ä¸å¯çç¥ |
| | | components: { |
| | | mpHtml |
| | | }, |
| | | data () { |
| | | return { |
| | | html: '<div>Hello World!</div>' |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | ``` |
| | | |
| | | !> ä½¿ç¨ *cli* æ¹å¼è¿è¡ç项ç®ï¼éè¿ *npm* æ¹å¼å¼å
¥æ¶ï¼éè¦å¨ *vue.config.js* ä¸é
ç½® *transpileDependencies*ï¼è¯¦æ
å¯è§ [#330](https://github.com/jin-yufeng/mp-html/issues/330#issuecomment-913617687) |
| | | |
| | | !> å¦æå¨ *nvue* ä¸ä½¿ç¨è¿è¦å° *dist/uni-app/static* ç®å½ä¸çå
容æ·è´å°é¡¹ç®ç *static* ç®å½ä¸ï¼å¦åæ æ³è¿è¡ |
| | | |
| | | æ¯æç [屿§](basic/prop) å [äºä»¶](basic/event) è§å¯¹åºææ¡£ |
| | | |
| | | ç±äº *uni-app* ç¼è¯è¿ç¨ä¸ä¼è¿è¡åç¼©ï¼æå»º *uni-app* å
æ¶åºæ¬ä¸è¿è¡å缩ï¼å
çä½ç§¯ä¸åçå
ç¸æ¯è¾å¤§ |
| | | |
| | | #### å
³äº nvue :id=nvue |
| | | *nvue* 使ç¨åçæ¸²æï¼ä¸æ¯æé¨å *css* æ ·å¼ï¼ä¸ºå®ç°å *html* ç¸åçææï¼ç»ä»¶å
é¨éè¿ *web-view* è¿è¡æ¸²æï¼æ§è½ä¸å·®äºåçï¼æ ¹æ® *weex* 宿¹å»ºè®®ï¼*web* æ ç¾ä»
åºç¨å¨é常è§çéçº§åºæ¯ãå æ¤ï¼å¦æéè¿åççæ¹å¼ï¼å¦ *richtext*ï¼è½å¤æ»¡è¶³éè¦ï¼åä¸å»ºè®®ä½¿ç¨æ¬ç»ä»¶ï¼å¦ææè¾å¤ç坿æ¬å
容ï¼åå¯ä»¥ç´æ¥ä½¿ç¨ *vue* é¡µé¢ |
| | | ç±äºæ¸²ææ¹å¼ä¸å
¶ä»ç«¯ä¸åï¼æä»¥ä¸éå¶ï¼ |
| | | 1. 䏿¯æ [lazy-load](basic/prop#lazy-load) 屿§ |
| | | 2. è§é¢ä¸æ¯æå
¨å±ææ¾ |
| | | 3. å¦æå¨ *flex-direction: row* ç容å¨ä¸ä½¿ç¨ï¼éè¦ç»ç»ä»¶è®¾ç½®å®½åº¦æè®¾ç½® *flex: 1* å æ»¡å©ä½å®½åº¦ |
| | | |
| | | ### ð å
¶ä»æ¡æ¶ :id=other |
| | | å
¶ä»æ¡æ¶æ²¡æä¸ç¨å
ï¼ä½ä¹å¯ä»¥å¼å
¥å¯¹åºå¹³å°çåçå
使ç¨ï¼å
·ä½æ¹æ³åèåæ¡æ¶å®æ¹ææ¡£ |
| | | |
| | | - taro |
| | | [https://taro-docs.jd.com/docs/hybrid#使ç¨åçç»ä»¶](https://taro-docs.jd.com/docs/hybrid#%E4%BD%BF%E7%94%A8%E5%8E%9F%E7%94%9F%E7%BB%84%E4%BB%B6) |
| | | |
| | | !> å¨ *taro2* ä¸ä½¿ç¨è¯·ä½¿ç¨ [示ä¾é¡¹ç®](#demo) ä¸çéå缩ç»ä»¶å
ï¼å¦åå¯è½åºç°å¼å¸¸ï¼è¯¦è§ [#301](https://github.com/jin-yufeng/mp-html/issues/301) |
| | | |
| | | !> å¨ *taro3* ç *vue3* ä¸ä½¿ç¨æ¶éè¦ä¿®æ¹ *content* 屿§ç屿§åæä½¿ç¨ [setContent](advanced/api#setContent) æ¹æ³è®¾ç½®å
容ï¼è¯¦è§ [taro#13146](https://github.com/NervJS/taro/issues/13146) |
| | | |
| | | ?> å¨ *taro* ä¸ä½¿ç¨æ¶å±æ§åéç¨é©¼å³°åæ³ï¼å¦ *copy-link* 屿§åºåä½ *copyLink* |
| | | |
| | | ?> éè¦ *taro* ä¸ç¨å
çå¼åè
欢è¿åä¸ [éæ±è°ç ](https://github.com/jin-yufeng/mp-html/issues/374) |
| | | - kbone |
| | | [https://wechat-miniprogram.github.io/kbone/docs/guide/advanced.html#使ç¨å°ç¨åºèªå®ä¹ç»ä»¶](https://wechat-miniprogram.github.io/kbone/docs/guide/advanced.html#%E4%BD%BF%E7%94%A8%E5%B0%8F%E7%A8%8B%E5%BA%8F%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BB%84%E4%BB%B6) |
| | | - chameleon |
| | | [https://cml.js.org/docs/io.html#æä¹å¼å
¥å¾®ä¿¡å°ç¨åºç»ä»¶](https://cml.js.org/docs/io.html#%E6%80%8E%E4%B9%88%E5%BC%95%E5%85%A5%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%BB%84%E4%BB%B6) |
| | | - remax |
| | | [https://remaxjs.org/guide/basic/custom-component](https://remaxjs.org/guide/basic/custom-component) |
| | | |
| | | ## ð¡ è¿è¡ç¤ºä¾ :id=demo |
| | | 1. å®è£
ä¾èµ |
| | | ```bash |
| | | # éè¿ npm å®è£
|
| | | npm install |
| | | # æéè¿ yarn å®è£
|
| | | yarn |
| | | ``` |
| | | 2. çæ *demo* é¡¹ç® |
| | | ```bash |
| | | # çæå¾®ä¿¡ç¤ºä¾é¡¹ç®å° dev/mp-weixin |
| | | npm run dev:weixin |
| | | # çæ qq 示ä¾é¡¹ç®å° dev/mp-qq |
| | | npm run dev:qq |
| | | # çæç¾åº¦ç¤ºä¾é¡¹ç®å° dev/mp-baidu |
| | | npm run dev:baidu |
| | | # çææ¯ä»å®ç¤ºä¾é¡¹ç®å° dev/mp-alipay |
| | | npm run dev:alipay |
| | | # çæå¤´æ¡ç¤ºä¾é¡¹ç®å° dev/mp-toutiao |
| | | npm run dev:toutiao |
| | | # çæ uni-app 示ä¾é¡¹ç®å° dev/uni-app |
| | | npm run dev:uni-app |
| | | ``` |
| | | 3. è¿è¡ |
| | | ç¨åå¹³å°çå¼åè
å·¥å
·æå¼ *dev/platform* æä»¶å¤¹å³å¯ |
| | | 4. çå¬ä¿®æ¹ |
| | | 妿è¦å¯¹ *demo* 项ç®è¿è¡ä¿®æ¹ï¼å¦æ¾å
¥èªå·±çæµè¯å
容ï¼å¯å¨ *tools/demo* ç®å½ä¸è¿è¡ä¿®æ¹ |
| | | 妿è¦å¯¹ç»ä»¶å
è¿è¡ä¿®æ¹å¯å¨ *src* ç®å½ä¸è¿è¡ä¿®æ¹ï¼åè [äºæ¬¡å¼å](advanced/develop) ï¼ |
| | | å¯ä»¥éè¿ *watch* å½ä»¤çå¬ä¿®æ¹å¹¶å®æ¶ç¼è¯å° *dev* ç®å½ä¸ |
| | | ```bash |
| | | # çå¬å¹¶å®æ¶çæå¾®ä¿¡ç¤ºä¾é¡¹ç®å° dev/mp-weixin |
| | | npm run watch:weixin |
| | | # çå¬å¹¶å®æ¶çæ qq 示ä¾é¡¹ç®å° dev/mp-qq |
| | | npm run watch:qq |
| | | # çå¬å¹¶å®æ¶çæç¾åº¦ç¤ºä¾é¡¹ç®å° dev/mp-baidu |
| | | npm run watch:baidu |
| | | # çå¬å¹¶å®æ¶çææ¯ä»å®ç¤ºä¾é¡¹ç®å° dev/mp-alipay |
| | | npm run watch:alipay |
| | | # çå¬å¹¶å®æ¶çæå¤´æ¡ç¤ºä¾é¡¹ç®å° dev/mp-toutiao |
| | | npm run watch:toutiao |
| | | ``` |
| | | |
| | | ## ð 个æ§å :id=setting |
| | | ?> æ¬ç»ä»¶æä¾äºä»¥ä¸é
置项å¯ä»¥çæä¸ªæ§åçç»ä»¶å
ï¼é
置项å¯ä»¥éè¿ [示ä¾å°ç¨åº](#mp) è¿è¡è®¾ç½®ï¼æåè [ä½¿ç¨æä»¶å
](advanced/plugin#use) ä¸ç *npm* æ¹å¼èªè¡è®¾ç½®é
ç½®æä»¶å¹¶è¿è¡æå
|
| | | |
| | | #### plugins |
| | | éè¦ä½¿ç¨çæä»¶åç§°å表ï¼å
³äºæä»¶ç详ç»ä¿¡æ¯è§ [æä»¶](advanced/plugin) |
| | | |
| | | #### externStyle |
| | | !> æä¸æ¯æå¯¹å¾ç设置宽é«ï¼è¯¦è§ [#426](https://github.com/jin-yufeng/mp-html/issues/426) |
| | | |
| | | å¤é¨æ ·å¼ï¼ä¸ä¸ª *css* å符串ï¼å°è¢«ç¨äº *html* çæ¸²æï¼ä½ä»
æ¯æ *class* éæ©å¨ |
| | | |
| | | ?> [2.1.0](changelog/changelog#v210) çæ¬èµ·å¢å æ¯æ **æ ç¾åéæ©å¨**ï¼éè¿è¿ç§æ¹å¼ç»æ ç¾è®¾ç½®çæ ·å¼å
¨å±ææï¼å¨æ ·å¼è¾é¿æä½ç¨æ ç¾æ°éè¾å¤§æ¶è¿ç§æ¹æ³çæ§è½è¦é«äº [tag-style](basic/prop#tag-style) 屿§ï¼ä¸åæ³æ´å çµæ´»ï¼å¯ä»¥ä¸ä¼ªç±»ã*class* é
åçï¼ |
| | | éè¦æ³¨æçæ¯ï¼ç±äº [ç»ä»¶](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#%E7%BB%84%E4%BB%B6%E6%A0%B7%E5%BC%8F) å
ä»
æ¯æ *class* éæ©å¨ï¼ç´æ¥å°æ ç¾åéæ©å¨ **åå¨ wxss 䏿¯æ æç**ï¼å¿
é¡»å卿¬å段ä¸ï¼æå»ºè¿ç¨ä¸ä¼èªå¨è½¬æ¢ä¸º *class* éæ©å¨ |
| | | |
| | | ?> [2.3.1](changelog/changelog#v231) çæ¬èµ·ï¼ç»ä»¶åæ¶æ ·å¼é离ï¼é¨åå¹³å°ï¼å¾®ä¿¡å°ç¨åº *2.11.0+* åºç¡åºå®å
¨æ¯æï¼*QQ*ãç¾åº¦å°ç¨åºé¨åæ
åµä¸æ¯æï¼æ¯æç´æ¥å¼å
¥é¡µé¢æ ·å¼ä¸ç *class* éæ©å¨ï¼æ éä½¿ç¨æ¬æ¹æ³å¼å
¥ï¼è¥éå°æ ·å¼æ æ³çææéè¦ä½¿ç¨æ ç¾åéæ©å¨ï¼åä»éè¦ä½¿ç¨æ¬æ¹æ³ |
| | | |
| | | #### customElements |
| | | èªå®ä¹æ ç¾å表ï¼[2.2.0](changelog/changelog#v220) çæ¬èµ·æ¯æï¼ï¼å¯ä»¥å¨è¿é注åéè¦ä½¿ç¨çå°ç¨åºåè½æ ç¾ï¼å¦ *ad*ã*ad-custom*ã*official-account*ã*map* çï¼ |
| | | æ¯ä¸ªæ ç¾ä¸ºä¸ä¸ª *object*ï¼éè¦å
å«ä»¥ä¸åæ®µï¼æ³¨å宿åå³å¯å¨ä¼ å
¥ç `html` ä¸ä½¿ç¨è¯¥ç»ä»¶ |
| | | |
| | | | åæ®µå | åè½ | ç±»å | å¿
å¡« | 夿³¨ | |
| | | |:---:|:---:|:---:|:---:|:---:| |
| | | | name | æ ç¾å | String | æ¯ | | |
| | | | attrs | éè¦ä½¿ç¨ç屿§å表 | String[] | å¦ | class å style é»è®¤æ·»å ï¼æ éå¡«å | |
| | | | platforms | éè¦ä½¿ç¨çå¹³å° | String[] | å¦ | é»è®¤æ·»å å°ææå¹³å°ï¼å¯ä»¥ä» h5ãmp-weixinãmp-qqãmp-baiduãmp-alipayãmp-toutiaoãapp-plus ä¸éæ©ï¼ä¸åºå大å°å | |
| | | |
| | | ?> ä»
è½æ·»å 没æåèç¹çæ ç¾ï¼ä¸ä¸ååºä»»ä½äºä»¶ï¼å¦æéè¦æ´å 夿çåè½ï¼å¯ä»¥éè¿ [æä»¶](advanced/plugin#develop) å®ç° |
| | | |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | // è®¾ç½®å®æå html 䏿·»å <ad unit-id="xxx" /> å³å¯ä½¿ç¨è¯¥æ ç¾ |
| | | customElements: [{ |
| | | name: 'ad', |
| | | attrs: ['unit-id'] |
| | | }] |
| | | ``` |
| | | |
| | | å©ä½çæ¯ä¸äºç¼è¯è¿ç¨ä¸å缩工å
·çé
ç½®ï¼å¯ä»¥æéè¦è®¾ç½® |
New file |
| | |
| | | # ð è´¡ç®æå :id=contribution |
| | | |
| | | æ¬ç»ä»¶æ¬¢è¿ææå¼åè
坹以䏿¹é¢æäº¤ [pr](https://github.com/jin-yufeng/mp-html/pulls)ï¼ä¸èµ·å®åæ¬ç»ä»¶ |
| | | |
| | | 1. é对 [issue](https://github.com/jin-yufeng/mp-html/issues) ä¸ *bug* çä¿®å¤ |
| | | 2. å®ç°æ°åè½ |
| | | - å¨ä¸»å
䏿·»å ï¼éç¡®ä¿è¯¥åè½éç¨é¢å¹¿ä¸ä½ç§¯ä¸å¤§ï¼ |
| | | - æ°å¢æ©å±æä»¶ï¼åè [å¼åæä»¶](advanced/plugin#develop)ï¼ |
| | | 3. ææ¡£éè¯¯ä¿®å¤ |
| | | |
| | | å¼åè¿ç¨ä¸è¯·æ³¨æï¼ |
| | | 1. ä¸è¦ä¿®æ¹ [dist](https://github.com/jin-yufeng/mp-html/tree/master/dist) ç®å½ä¸çæä»¶ï¼è¯¥æä»¶å¤¹å¨çæ¬æ´æ°æ¶ä¼è¿è¡æå»ºï¼åé
ç½®æä»¶ |
| | | 2. 代ç 飿 ¼åè [standard](https://standardjs.com) |
| | | 3. å¯åè [äºæ¬¡å¼å](advanced/develop) ä¸ç说æ |
| | | |
| | | æè°¢ææ [è´¡ç®è
](https://github.com/jin-yufeng/mp-html/graphs/contributors) 对æ¬ç»ä»¶çè´¡ç® |
New file |
| | |
| | | # ð 常è§é®é¢ :id=question |
| | | |
| | | ## æ æ³ä½¿ç¨æ©å±åè½ :id=plugin |
| | | ç±äºå°ç¨åºç©ºé´æéï¼é»è®¤ç»ä»¶å
ä¸ä»
å
å«åºæ¬åè½ï¼å
¶ä» [æ©å±](advanced/plugin) æéæ·»å ã |
| | | |
| | | !> ç¼è¾å¨ã*markdown*ã代ç é«äº®ãå
³é®è¯æç´¢ã*latex* å
¬å¼çå±äº [æ©å±](advanced/plugin) åè½ï¼ç´æ¥è·åçç»ä»¶å
ä¸ **ä¸å
å«** è¿äºåè½ |
| | | |
| | | éè¦ä½¿ç¨æ©å±åè½çï¼åè [ä½¿ç¨æä»¶](advanced/plugin#use) ç说æï¼éè¿ç¤ºä¾å°ç¨åºæ *npm* æå
çæ¹å¼è·åå
嫿©å±åè½çç»ä»¶å
æ¿æ¢åç»ä»¶å
ï¼ç¶åæç
§å个 [æ©å±](advanced/plugin) æä»¶ç说æå示ä¾è¿è¡ä½¿ç¨ |
| | | |
| | | ## å¾çåºé¨ç¼é :id=img |
| | | ç±äºå¾ççé»è®¤ *display* æ¯ *inline-block*ï¼å¤ä¸ªå¾çè¿æ¥æ¶åºé¨ä¼æä¸æ¡ç¼éï¼å¯ä»¥éè¿è®¾ç½® *vertical-align: bottom*, *display:block* æ *float:left* çæ¹æ³å»é¤ |
| | | è®¾ç½®ä»¥ä¸æ ·å¼å仿ä¸ä¸ªå°ç¼éçï¼å¯ä»¥è¿ä¸æ¥æ·»å *margin-top:-1px* |
| | | è®¾ç½®æ¹æ³åè [æ ·å¼è®¾ç½®](overview/feature#style) |
| | | |
| | | ## æ ç¾åæ ·æ¾ç¤º :id=entity |
| | | 妿åºç°æ¸²æå *html* æ ç¾è¿æ¯åæ ·æ¾ç¤ºï¼è¯·æ£æ¥ä¼ å
¥ç *html* æ¯å¦è¢«è½¬ä¹ï¼ |
| | | 1. *<* å *>* 被转ä¹ä¸º *&lt;* å *&gt;* |
| | | 2. *<img* 被转ä¹ä¸º *< img* |
| | | |
| | | 妿æ¯åéè¦è¿è¡æ¿æ¢ |
| | | ```javascript |
| | | // 第ä¸ç§ |
| | | html = html.replace(/</g, '<').replace(/>/g, '>') // 妿è¿è½¬ä¹äºå
¶ä»åç¬¦å¦ & çä¹è¦è¿è¡æ¿æ¢ |
| | | // 第äºç§ |
| | | html = html.replace(/< img/g, '<img') |
| | | ``` |
| | | |
| | | ## 空ç½ç¬¦å¤±æ :id=space |
| | | *html* ä¸ï¼é»è®¤ä¼å°å¤ä¸ªç©ºç½ç¬¦ï¼å
æ¬æ¢è¡ï¼å并为ä¸ä¸ªç©ºæ ¼ï¼è¥ä¸å¸æå¦æ¤ï¼å¯åè以䏿¹æ³ï¼ |
| | | 1. æ¿æ¢ä¸ºæå®æ ç¾æå®ä½ç¼ç |
| | | æ¢è¡å¯ä»¥ä½¿ç¨ *br* æ ç¾ |
| | | è¿ç»ç©ºæ ¼å¯ä»¥ä½¿ç¨ *&nbsp;* *&ensp;* *&emsp;* çå®ä½ç¼ç |
| | | ```javascript |
| | | html = html.replace(/\n/g, '<br>') // æ¿æ¢æ¢è¡ç¬¦ |
| | | ``` |
| | | 2. éè¿ *css* 设置 *white-space* |
| | | å° *css* ä¸ç *white-space* 设置为 *pre-line* å¯ä»¥ä¿çæ¢è¡ç¬¦ï¼è®¾ç½®ä¸º *pre-wrap* å¯ä»¥ä¿çç©ºæ ¼åæ¢è¡ç¬¦ |
| | | ç»ç¹å®æ ç¾è®¾ç½®çæ¹æ³è§ [æ ·å¼è®¾ç½®](overview/feature#style)ï¼éè¦æ³¨æçæ¯å¦æéè¿å¤é¨æ ·å¼è®¾ç½® *white-space* å°ä¸ä¼çæï¼å 为å¨è§£æè¿ç¨ä¸ä¸ºåå°è§£æç»æå¤§å°æåè¿è¡äºç©ºç½ç¬¦åå¹¶ï¼è§£æè¿ç¨ä¸æ æ³è·åå¤é¨æ ·å¼ï¼ |
| | | [2.1.2](changelog/changelog#v212) çæ¬èµ·å¯ä»¥éè¿ [container-style](basic/prop#container-style) 屿§å
¨å±è®¾ç½® *white-space* |
| | | ```html |
| | | <mp-html container-style="white-space:pre-wrap" /> |
| | | ``` |
| | | |
| | | ## è¡¨æ ¼æ²¡æè¾¹æ¡ :id=table |
| | | *html* ä¸ç *table* æ ç¾é»è®¤æ²¡æè¾¹æ¡ï¼ä¸äºç¼è¾å¨æèªå¸¦çè¡¨æ ¼æ ·å¼ï¼æ²¡æå¼å
¥å°±ä¼å¯¼è´è¡¨æ ¼è¾¹æ¡ç¼ºå¤±ï¼å¯éè¿ä»¥ä¸æ¹å¼è§£å³ï¼ |
| | | 1. ç» `table` æ ç¾è®¾ç½® `border` 屿§ |
| | | ```javascript |
| | | html = html.replace(/<table/g, '<table border="1"') |
| | | ``` |
| | | 2. éè¿ [tag-style](basic/prop#tag-style) 屿§æ [å¤é¨æ ·å¼](overview/quickstart#externStyle) ç»è¡¨æ ¼æ ç¾è®¾ç½®é»è®¤æ ·å¼ |
| | | ```javascript |
| | | tagStyle: { |
| | | table: 'border-top: 1px solid gray; border-left: 1px solid gray; border-collapse:collapse', |
| | | th: 'border-right: 1px solid gray; border-bottom: 1px solid gray;', |
| | | td: 'border-right: 1px solid gray; border-bottom: 1px solid gray;' |
| | | } |
| | | ``` |
| | | |
| | | ## å¤åªä½å
容䏿¾ç¤º :id=media |
| | | è¥åºç° å¾ç䏿¾ç¤º/æ æ³é¢è§ãé³é¢/è§é¢æ æ³ææ¾ çé®é¢ï¼å¯éè¿ä»¥ä¸æ¹å¼æ£æ¥ï¼ |
| | | - è¥è§é¢ä¸æ¾ç¤ºï¼è¯·æ£æ¥ *html* ä¸çè§é¢æ¯å¦ä¸º *video* æ ç¾ï¼*iframe* æ ç¾å¨å°ç¨åºç«¯ä»
微信å°ç¨åºå¯ä»¥éè¿ [è
¾è®¯è§é¢æä»¶](advanced/plugin#txv-video) ææ¾ï¼å
¶ä»ä¸æ¯æï¼ |
| | | - è¥å¾çæ æ³é¢è§ï¼è¯·æ£æ¥è¯¥å¾çæ¯å¦ä¸º *base64* æ ¼å¼ï¼ç®å䏿¯æ *base64* å¾çé¢è§ï¼åå åè [#249](https://github.com/jin-yufeng/mp-html/issues/249#issuecomment-755290540)ï¼å¦æç¡®é使ç¨ï¼å¯å° [parser.js#L425](https://github.com/jin-yufeng/mp-html/blob/master/src/miniprogram/parser.js#L425) 廿ï¼å¨é¨åå¹³å°å¯è½å¯ä»¥ä½¿ç¨ï¼ |
| | | - è¥æ¯ *svg* æ æ³æ¾ç¤ºï¼è¯·æ£æ¥æ¯å¦å
å«ååºå¼ *animate* çæ ç¾ï¼ç®å䏿¯æï¼åå åè [#569](https://github.com/jin-yufeng/mp-html/issues/569)ï¼ï¼é¤æ¤ä¹å¤å¯è½æ¯ *svg* æ ç¾åå屿§å大å°åé®é¢ï¼å¯ä»¥å¨ [svgDict](https://github.com/jin-yufeng/mp-html/blob/master/src/miniprogram/parser.js#L61) ä¸è¡¥å
|
| | | - è¥é以ä¸åå ä¾ç¶æ æ³æ¾ç¤ºï¼å°è¯¥ å¾ç/é³é¢/è§é¢ ç龿¥æ¾å¨åçæ ç¾ [image](https://developers.weixin.qq.com/miniprogram/dev/component/image.html)ã[audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html)ã[video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) æ api [wx.previewImage](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html) ä¸è¿è¡æµè¯ï¼å¦æä¹ä¸è½æ¾ç¤ºï¼å龿¥åå¨é®é¢ |
| | | è¥åºç°è¿ç§æ
åµï¼å¯æç
§ä»¥ä¸æ¹æ³è¿è¡æ£æ¥ |
| | | 1. æ£æ¥é¾æ¥æ¯å¦å®æ´ï¼ç¼ºå°ååå¯ä»¥è®¾ç½® [domain](basic/prop#domain) 屿§ï¼ãææï¼å¯ä»¥æ¾å¨æµè§å¨ä¸æµè¯ï¼ |
| | | 2. æ£æ¥é¾æ¥æ¯å¦åå¨é²çé¾ï¼å¯ä»¥åè [#387](https://github.com/jin-yufeng/mp-html/issues/387)ï¼ |
| | | 3. æ£æ¥ç¼ç åæ ¼å¼æ¯å¦æ¯æï¼åè [é³é¢æ ¼å¼](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html#%E6%94%AF%E6%8C%81%E6%A0%BC%E5%BC%8F)ã[è§é¢æ ¼å¼åç¼ç ](https://developers.weixin.qq.com/miniprogram/dev/component/video.html#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A0%BC%E5%BC%8F)ï¼ |
| | | 4. æ¥ç *error* äºä»¶ä¸çéè¯¯ä¿¡æ¯ |
| | | |
| | | ## é¿å
容å¤ç :id=long |
| | | 妿坿æ¬å
容ç¹å«é¿ï¼å¯ä»¥èè以䏿¹æ¡ï¼ |
| | | 1. 忬¡æ¸²æ |
| | | å°ç¨åºä¸å次 *setData* 大å°ä¸è½è¶
è¿ *1MB*ï¼å¦æå
容è¿é¿ï¼å¯ä»¥å
å°å
容æåæå 段ï¼é¦å
渲æç¬¬ä¸æ®µï¼åç»å
容å¨éå½çæ¶æºï¼è§¦åºçï¼éè¿ [setContent](/advanced/api#setContent) æ¹æ³è¿½å å°æ«å°¾ |
| | | 2. å页渲æ |
| | | 以䏿¹æ¡è½ç¶è½è§£å³ä¸æ¬¡æ§è®¾ç½®æ°æ®è¿å¤§é®é¢ï¼ä½è¿é¿çå
容ä»ä¼å¯¼è´æ»æ ç¾æ°éè¿å¤§ï¼é¡µé¢æ§è½ä¸éçé®é¢ï¼å æ¤ï¼å¯¹äºè¿é¿çå
容ï¼åºè¯¥å页è¿è¡æ¾ç¤ºï¼æ¯é¡µä»
æ¾ç¤ºä¸é¨å |
| | | |
| | | ## æå 载失æ :id=lazy-load |
| | | 妿坿æ¬å
容å
¨é¨ï¼æå¤§é¨åï¼æ¯å¾çï¼ç±äºå
¶å¾çæªå è½½æ¶å¤§å°ä¸ºé¶ï¼å³ä½¿æ°éå¾å¤ä¹ä¼å
¨é¨è¿å
¥è§å¾èå´ï¼å¯¼è´æå 载失æï¼è¥åºç°è¿ç§æ
åµï¼å¯éè¿ä»¥ä¸æ¹æ¡è§£å³ |
| | | 1. éè¿ [tag-style](basic/prop#tag-style) 屿§çæ¹æ³ç» *img* ç¶çº§æ ç¾çæ ·å¼é设置 *min-height*ï¼å¦æç´æ¥ç»å¾çæ¬èº«è®¾ç½® *min-height*ï¼å¯è½å¨å è½½è¿ç¨ä¸åºç°åå½¢çæ
åµï¼ |
| | | 2. éè¿ [loading-img](basic/prop#loading-img) 屿§è®¾ç½®å è½½è¿ç¨ä¸çå ä½å¾ |
| | | |
| | | ## ä¸è¬æ ç¾çç¹å»äºä»¶ :id=tap |
| | | é»è®¤æ
åµä¸ï¼ç»ä»¶ä»
æ¯æ *a* å *img* æ ç¾çç¹å»äºä»¶ï¼å¦æå¸æç»æ ç¾æ·»å ç¹å»äºä»¶ï¼åä¸å¸æåºç¨ *a* æ ç¾çé»è®¤æ ·å¼ï¼å¯ä»¥ä½¿ç¨æ²¡æ *href* 屿§ç *a* æ ç¾ï¼è¯¥æ ç¾ä¸ä¼åºç¨é¾æ¥çé»è®¤æ ·å¼ï¼ä½è¢«ç¹å»æ¶ä¼è§¦å *linktap* äºä»¶ï¼å¯ä»¥å¨ *data-* 屿§ä¸è®°å½éè¦çä¿¡æ¯ |
| | | |
| | | ## åºç¡åºè¦æ± :id=lib |
| | | æ¬ç»ä»¶å°½æå¤§å¯è½å
¼å®¹ä½çæ¬åºç¡åºï¼åå¹³å°åªè¦æ»¡è¶³ **æä½è¦æ±** å³å¯æ£å¸¸ä½¿ç¨ï¼ä¸æ¥éï¼ä½é«åºç¡åºæ¯æçåè½ä¸å¯ç¨ï¼ï¼å¯æç
§å®é
éè¦è®¾ç½®æä½åºç¡åºè¦æ± |
| | | |
| | | å¾®ä¿¡ï¼ |
| | | |
| | | | çæ¬ | åè½ | å æ¯ | |
| | | |:---:|:---:|:---:| |
| | | | 2.9.0+ | ios æ¯æ webp å¾ç | >99.74% | |
| | | | 2.7.0+ | æ¯æå¾çé¿æå¼¹åºèå | >99.87% | |
| | | | 2.4.0+ | æ¯æ video å屿¸²æ | >99.90% | |
| | | | 2.3.0+ | æ¯æä½¿ç¨äºæä»¶ ID | >99.98% | |
| | | | 2.2.1+ | æ¯æ npm å¼å
¥ | >99.99% | |
| | | | 1.9.94+ | æ¯æä½¿ç¨ ad | >99.99% | |
| | | | 1.6.6+ | å¯ä»¥ä½¿ç¨ | >99.99% | |
| | | |
| | | QQï¼ |
| | | |
| | | | çæ¬ | åè½ | |
| | | |:---:|:---:| |
| | | | å®å 1.10.2+ï¼ios 1.4.7+ | æ¯æ video å屿¸²æ | |
| | | | 1.1.7+ | å¯ä»¥ä½¿ç¨ | |
| | | |
| | | ç¾åº¦ï¼ |
| | | |
| | | | çæ¬ | åè½ | å æ¯ | |
| | | |:---:|:---:|:---:| |
| | | | 3.180.1+ | ios æ¯æ webp å¾ç | >99.04% | |
| | | | 3.170.1+ | æ¯æå¾çé¿æå¼¹åºèå | >99.19% | |
| | | | 3.90.25+ | å¯ä»¥ä½¿ç¨ | >99.99% | |
| | | |
| | | *3.240.10* - *3.260.25* åºç¡åºç±äº [æ¤é®é¢](https://smartprogram.baidu.com/forum/topic/show/125787)ï¼éè¦å°ä»¥ä¸æ ·å¼æ·è´å° *app.css* 以ä¿è¯æ£ç¡®æ¾ç¤º |
| | | ```css |
| | | /* a æ ç¾é»è®¤ææ */ |
| | | ._a { |
| | | padding: 1.5px 0 1.5px 0; |
| | | color: #366092; |
| | | word-break: break-all; |
| | | } |
| | | |
| | | /* a æ ç¾ç¹å»æææ */ |
| | | ._hover { |
| | | text-decoration: underline; |
| | | opacity: 0.7; |
| | | } |
| | | |
| | | /* å¾çé»è®¤ææ */ |
| | | ._img { |
| | | max-width: 100%; |
| | | -webkit-touch-callout: none; |
| | | } |
| | | ``` |
| | | |
| | | æ¯ä»å®ï¼ |
| | | |
| | | | çæ¬ | åè½ | å æ¯ | |
| | | |:---:|:---:|:---:| |
| | | | 1.11.0+ | å¯ä»¥ä½¿ç¨ | >97.95% | |
| | | |
| | | 头æ¡ï¼ |
| | | |
| | | | çæ¬ | åè½ | |
| | | |:---:|:---:| |
| | | | 1.59.0+ | æ¯æ video å屿¸²æ | |
| | | | 1.19.0+ | æ¯æä½¿ç¨ ad | |
| | | | 1.7.0+ | å¯ä»¥ä½¿ç¨ | |
| | | |
| | | !> 䏿¯æ *video* å屿¸²ææ¶ï¼éè¦æ³¨æåçç»ä»¶çéå¶ï¼è§é¢çå±çº§æé«ï¼ä¸ä¸è½å¨ *scroll-view* ä¸ä½¿ç¨ |
New file |
| | |
| | | # ð© åé¦ :id=feedback |
| | | |
| | | ## 注æäºé¡¹ :id=notice |
| | | åé¦é®é¢åï¼è¯·å
ç¡®è®¤ä»¥ä¸æ¹å¼æ æ³è§£å³ï¼ |
| | | 1. å¨ [常è§é®é¢](question/faq) 䏿¥çæ¯å¦å·²æè§£å³æ¹æ¡ |
| | | 2. å¨ [issue](https://github.com/jin-yufeng/mp-html/issues) 䏿¥æ¾æ¯å¦å·²æç¸åæç±»ä¼¼çé®é¢ |
| | | 3. 妿æ¯å¯¹äºæ¸²æææçé®é¢ï¼è¯·å
å¨ä¸æ¹ç模æå¨ä¸å°è¯ï¼å¦æå¨æµè§å¨ä¸æ¸²æä¹ä¸æ£å¸¸ï¼è¯·æ£æ¥æ ·å¼ |
| | | |
| | | <div style="display: flex;"> |
| | | <div style="flex: 1; margin: 0 40px; display: flex; flex-direction: column;"> |
| | | <textarea id="input" style="flex: 1; width: 100%; padding: 5px; resize: none;" placeholder="请è¾å
¥ html å
容"></textarea> |
| | | <div style="text-align: center; margin-top: 10px;"> |
| | | <button onclick="reset()">æ¸
空</button> |
| | | <button onclick="render()" style="margin-left: 20px;">渲æ</button> |
| | | </div> |
| | | </div> |
| | | <div style="flex: 0 0 320px; height: 568px; box-shadow: 0px 0px 10px #c0c0c0;"> |
| | | <iframe id="show" style="width: 100%; height: 100%; margin: 0;"></iframe> |
| | | </div> |
| | | </div> |
| | | |
| | | ## å馿¹å¼ :id=method |
| | | 1. *issue* æ¹å¼ |
| | | å¨ *github* ä¸æåº [issue](https://github.com/jin-yufeng/mp-html/issues/new/choose)ï¼æ¨èï¼è§£å³æ¹æ¡å¯ä»¥ç»å
¶ä»äººåèï¼ |
| | | 2. *QQ* 群æ¹å¼ |
| | | å å
¥ *QQ* 交æµç¾¤ *699734691* æ *778239129*ï¼å¹¶åéå交æµç¸å
³é®é¢ |
| | | 3. é®ç®±æ¹å¼ |
| | | 妿ä¸å¸æå
¬å¼é®é¢ï¼å¯ä»¥éè¿é®ç®±æ¹å¼èç³»ï¼åéé®ä»¶å° *mp_html@126.com*ï¼é®ä»¶æ ¼å¼å¯åè [issue 模æ¿](https://github.com/jin-yufeng/mp-html/issues/new/choose) |
| | | |
| | | !> 注æå¡å¿
æç
§æ¨¡æ¿è¦æ±å¡«åï¼æªæè¿°æ¸
æ¥ææ æ³å¤ç°çé®é¢å°ä¸äºå¤ç |
New file |
| | |
| | | /** |
| | | * @fileoverview èªå¨æå»ºç¨åº |
| | | * @author Jin Yufeng |
| | | */ |
| | | |
| | | // è½½å
¥ gulp æä»¶ |
| | | const gulp = require('gulp') |
| | | const htmlmin = require('gulp-htmlmin') |
| | | const babel = require('gulp-babel') |
| | | const uglify = require('gulp-uglify') |
| | | const cleanCss = require('gulp-clean-css') |
| | | const clean = require('gulp-clean') |
| | | const gulpif = require('gulp-if') |
| | | const plumber = require('gulp-plumber') |
| | | const size = require('gulp-size') |
| | | |
| | | // è½½å
¥æå»ºå·¥å
· |
| | | const config = require('./tools/config') |
| | | const converter = require('./tools/converter') |
| | | const ifdef = require('./tools/ifdef') |
| | | const minifier = require('./tools/minifier') |
| | | const plugin = require('./tools/plugin') |
| | | |
| | | // è½½å
¥ç¯å¢ä¿¡æ¯ |
| | | const isDev = process.argv.includes('--dev') |
| | | let platform = process.argv[3] |
| | | if (!platform) { |
| | | throw Error('缺å°å¹³å°ä¿¡æ¯') |
| | | } |
| | | platform = platform.substr(2) |
| | | |
| | | /** |
| | | * @description æ¸
çæä»¶å¤¹ |
| | | */ |
| | | gulp.task('clean', () => { |
| | | return gulp.src(`${isDev ? 'dev' : 'dist'}/${platform === 'all' ? '' : platform + '/'}*`, { |
| | | read: false, |
| | | allowEmpty: true |
| | | }) |
| | | .pipe(clean()) |
| | | }) |
| | | |
| | | /** |
| | | * @description çæåçç»ä»¶å
ï¼å«æä»¶ï¼ |
| | | * @returns {NodeJS.ReadWriteStream} |
| | | */ |
| | | function packComp () { |
| | | return gulp.src(['plugins/**/*', 'src/**/*'], { |
| | | nodir: true |
| | | }) |
| | | // å
Œ
±å¤ç |
| | | .pipe(plumber()) // é误å¤ç |
| | | .pipe(plugin.build(platform)) // æå»ºæä»¶ |
| | | .pipe(ifdef(platform)) // æ¡ä»¶ç¼è¯ |
| | | // wxml å¤ç |
| | | .pipe(gulpif(file => file.extname === '.wxml', minifier.wxs())) // å缩å
è wxs |
| | | .pipe(gulpif(file => file.extname === '.wxml', htmlmin(config.htmlmin))) // å缩 wxml |
| | | .pipe(gulpif(file => file.extname === '.html', htmlmin(Object.assign({}, config.htmlmin, { // å缩 html |
| | | minifyCSS: true |
| | | })))) |
| | | // js å¤ç |
| | | .pipe(gulpif(file => file.extname === '.js' && !file.stem.includes('.min') && (platform !== 'uni-app' || file.relative.includes('static')), babel(config.babel))) // es6 转 es5 |
| | | .pipe(gulpif(file => file.extname === '.js' && !file.stem.includes('.min') && !isDev && (platform !== 'uni-app' || file.relative.includes('static')), uglify(config.uglify))) // å缩 js |
| | | // wxssï¼cssï¼å¤ç |
| | | .pipe(gulpif(file => file.extname.includes('ss'), cleanCss(config.cleanCss))) // å缩 wxss |
| | | .pipe(plugin.importCss()) // å¼å
¥æä»¶ä¸ç css æä»¶ |
| | | // json å¤ç |
| | | .pipe(gulpif(file => file.extname === '.json', minifier.json())) // å缩 json |
| | | // å
Œ
±å¤ç |
| | | .pipe(converter(platform)) // å°å¾®ä¿¡ç«¯ç代ç 转æ¢å°åä¸ªå¹³å° |
| | | .pipe(gulpif(!isDev, size({ |
| | | title: `${platform} å
çæå®æ¯` |
| | | }))) |
| | | .pipe(gulp.dest(file => { |
| | | return `${isDev ? 'dev' : 'dist'}/${platform}/${(platform === 'uni-app' && !file.relative.includes('components') && !file.relative.includes('static')) || (platform !== 'uni-app' && isDev) ? 'components/mp-html/' : ''}` |
| | | })) |
| | | } |
| | | |
| | | gulp.task('build', gulp.series('clean', packComp)) |
| | | |
| | | /** |
| | | * @description çæåç示ä¾é¡¹ç® |
| | | * @returns {NodeJS.ReadWriteStream} |
| | | */ |
| | | function packDemo () { |
| | | return gulp.src(['tools/demo/**/*', 'test/content.js'], { |
| | | nodir: true |
| | | }) |
| | | .pipe(ifdef(platform)) |
| | | .pipe(gulpif(platform !== 'uni-app', converter(platform))) |
| | | .pipe(gulp.dest(`dev/${platform}/`)) |
| | | } |
| | | |
| | | gulp.task('dev', gulp.series('clean', gulp.parallel(packComp, packDemo))) |
| | | |
| | | /** |
| | | * @description ç嬿件åå |
| | | */ |
| | | gulp.task('watch-demo', () => { |
| | | gulp.watch(['tools/demo/**/*', 'test/content.js']).on('all', (type, file) => { |
| | | console.log(type + ':' + file) |
| | | packDemo() |
| | | }) |
| | | }) |
| | | |
| | | gulp.task('watch-comp', () => { |
| | | gulp.watch(['src/**/*', 'src/common/**/*', 'plugins/**/*']).on('all', (type, file) => { |
| | | console.log(type + ':' + file) |
| | | packComp() |
| | | }) |
| | | }) |
| | | |
| | | gulp.task('watch', gulp.parallel('watch-demo', 'watch-comp')) |
New file |
| | |
| | | const fs = require('fs') |
| | | const glob = require('glob') |
| | | const standard = require('standard') |
| | | |
| | | // è§£æåæ° |
| | | let fix = false |
| | | let mode = '**/*.@(js|vue)' |
| | | for (let i = 2; i < process.argv.length; i++) { |
| | | if (process.argv[i] === '--fix') { |
| | | fix = true |
| | | } else { |
| | | mode = process.argv[i] |
| | | } |
| | | } |
| | | |
| | | // æ£æ¥ js æä»¶ |
| | | function lintJs (filePath, content) { |
| | | const res = standard.lintTextSync(content, { |
| | | global: ['App', 'Page', 'Component', 'wx', 'requirePlugin', 'uni', 'test', 'expect', 'plus', 'Image'], |
| | | fix |
| | | }).results |
| | | // ååä¿®å¤çå
容 |
| | | if (fix && res[0].output) { |
| | | fs.writeFileSync(filePath, res[0].output) |
| | | } |
| | | // æå°éè¯¯ä¿¡æ¯ |
| | | for (let i = 0; i < res[0].messages.length; i++) { |
| | | const item = res[0].messages[i] |
| | | console.log(filePath + ':' + item.line + ':' + item.column + ': ' + item.message) |
| | | } |
| | | } |
| | | |
| | | // æ£æ¥ vue æä»¶ |
| | | function lintVue (filePath, content) { |
| | | // æå script é¨å |
| | | const script = content.match(/<script>([\s\S]+?)<\/script>/) |
| | | const line = content.substr(0, script.index).split('\n').length - 1 |
| | | const res = standard.lintTextSync(script[1], { |
| | | global: ['uni', 'plus', 'weex'], |
| | | fix |
| | | }).results |
| | | // ååä¿®å¤çå
容 |
| | | if (fix && res[0].output) { |
| | | fs.writeFileSync(filePath, content.replace(/<script>[\s\S]+?<\/script>/, '<script>' + res[0].output + '</script>')) |
| | | } |
| | | // æå°éè¯¯ä¿¡æ¯ |
| | | for (let i = 0; i < res[0].messages.length; i++) { |
| | | const item = res[0].messages[i] |
| | | console.log(filePath + ':' + (line + item.line) + ':' + item.column + ': ' + item.message) |
| | | } |
| | | } |
| | | |
| | | glob(mode, { |
| | | ignore: ['node_modules/**', 'coverage/**', 'dist/**', 'dev/**', '**/*.min.js'] |
| | | }, (_, files) => { |
| | | for (let i = 0; i < files.length; i++) { |
| | | if (files[i].includes('.js')) { |
| | | lintJs(files[i], fs.readFileSync(files[i], 'utf-8')) |
| | | } else if (files[i].includes('.vue')) { |
| | | lintVue(files[i], fs.readFileSync(files[i], 'utf-8')) |
| | | } |
| | | } |
| | | }) |
New file |
| | |
| | | { |
| | | "name": "mp-html", |
| | | "version": "2.5.1", |
| | | "description": "å°ç¨åºå¯ææ¬ç»ä»¶", |
| | | "miniprogram": "dist/mp-weixin", |
| | | "repository": "https://github.com/jin-yufeng/mp-html", |
| | | "author": "Jin Yufeng", |
| | | "license": "MIT", |
| | | "keywords": [ |
| | | "miniprogram", |
| | | "rich-text", |
| | | "html" |
| | | ], |
| | | "standard": { |
| | | "globals": ["App", "Page", "Component", "wx", "requirePlugin", "uni", "plus", "weex"], |
| | | "envs": ["jest", "browser"] |
| | | }, |
| | | "jest": { |
| | | "testEnvironment": "jsdom", |
| | | "collectCoverageFrom": [ |
| | | "dev/mp-weixin/components/mp-html/**/*.js" |
| | | ] |
| | | }, |
| | | "scripts": { |
| | | "lint": "node lint.js", |
| | | "lintcss": "npx stylelint src/**/*.wxss", |
| | | "build:weixin": "gulp build --mp-weixin", |
| | | "build:qq": "gulp build --mp-qq", |
| | | "build:baidu": "gulp build --mp-baidu", |
| | | "build:alipay": "gulp build --mp-alipay", |
| | | "build:toutiao": "gulp build --mp-toutiao", |
| | | "build:uni-app": "gulp build --uni-app", |
| | | "build": "gulp build --mp-weixin & gulp build --mp-qq & gulp build --mp-baidu & gulp build --mp-alipay & gulp build --mp-toutiao & gulp build --uni-app", |
| | | "watch:weixin": "gulp watch --mp-weixin --dev", |
| | | "watch:qq": "gulp watch --mp-qq --dev", |
| | | "watch:baidu": "gulp watch --mp-baidu --dev", |
| | | "watch:alipay": "gulp watch --mp-alipay --dev", |
| | | "watch:toutiao": "gulp watch --mp-toutiao --dev", |
| | | "watch:uni-app": "gulp watch --uni-app --dev", |
| | | "dev:weixin": "gulp dev --mp-weixin --dev", |
| | | "dev:qq": "gulp dev --mp-qq --dev", |
| | | "dev:baidu": "gulp dev --mp-baidu --dev", |
| | | "dev:alipay": "gulp dev --mp-alipay --dev", |
| | | "dev:toutiao": "gulp dev --mp-toutiao --dev", |
| | | "dev:uni-app": "gulp dev --uni-app --dev", |
| | | "test": "gulp dev --mp-weixin --dev && npx jest", |
| | | "coverage": "gulp dev --mp-weixin --dev && npx jest --coverage", |
| | | "coveralls": "npx coveralls < coverage/lcov.info", |
| | | "clean": "gulp clean --all", |
| | | "clean:dev": "gulp clean --all --dev" |
| | | }, |
| | | "devDependencies": { |
| | | "@babel/preset-env": "^7.12.1", |
| | | "coveralls": "^3.1.0", |
| | | "gulp": "^4.0.0", |
| | | "gulp-babel": "^8.0.0", |
| | | "gulp-clean": "^0.4.0", |
| | | "gulp-clean-css": "^4.3.0", |
| | | "gulp-htmlmin": "^5.0.1", |
| | | "gulp-if": "^3.0.0", |
| | | "gulp-plumber": "^1.2.1", |
| | | "gulp-size": "^3.0.0", |
| | | "gulp-uglify": "^2.1.2", |
| | | "jest": "^26.6.1", |
| | | "miniprogram-simulate": "^1.2.7", |
| | | "standard": "^16.0.3", |
| | | "stylelint": "^13.7.2", |
| | | "stylelint-config-recess-order": "^2.3.0", |
| | | "stylelint-config-standard": "^20.0.0", |
| | | "through2": "^4.0.2", |
| | | "uglify-js": "^2.8.29" |
| | | }, |
| | | "dependencies": {} |
| | | } |
New file |
| | |
| | | # æä»¶ |
| | | æ¬ç®å½ä¸æ¯ä¸äºæ©å±æä»¶ï¼å¯ä»¥æç
§éè¦éç¨ä»¥å®ç°æ´å 丰å¯çåè½ |
New file |
| | |
| | | # audio |
| | | åè½ï¼é³ä¹ææ¾å¨ |
| | | 大å°ï¼*â4KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â(nvue 䏿¯æ) | |
| | | |
| | | ç¾åº¦å°ç¨åºåçå
卿¤ [é®é¢](https://smartprogram.baidu.com/forum/topic/show/125787) æªè§£å³åæ æ³ä½¿ç¨ |
| | | |
| | | 说æï¼ |
| | | å¨å¤§å¤æ°å°ç¨åºå¹³å°ï¼*audio* æ ç¾å·²è¢«åºå¼ææ æ³ä½¿ç¨ï¼æ¬æä»¶å¯ä»¥ä»£æ¿ *audio* æ ç¾ææ¾é³ä¹ï¼å¹¶å®ç°ä»¥ä¸ä¼åï¼ |
| | | 1. *pause-video* 屿§ä¹å¯ä»¥åºç¨äºé³é¢ï¼å³ææ¾ä¸ä¸ªé³è§é¢æ¶å¯ä»¥èªå¨æåå
¶ä»æ£å¨ææ¾çé³è§é¢ |
| | | 2. å¢å äºä¸ä¸ªå¯ä»¥æå¨çè¿åº¦æ¡ |
| | | 3. ç»ä»¶å¤§å°å¯ä»¥æ ¹æ®é¡µé¢å®½åº¦èªå¨è°æ´ |
| | | 4. æ¯æ *autoplay* 屿§ |
| | | 5. ææ¾è¢«åå°æææ¶ï¼é¡µé¢æ¾ç¤ºåèªå¨ç»§ç»ææ¾ |
| | | |
| | | åºç¡åºè¦æ±ï¼ |
| | | æ¯ä»å® *1.23.4+* ï¼å
¶ä½å¹³å°æ»¡è¶³æä½è¦æ±å³å¯ |
| | | 第 *5* æ¡ä»
微信 *2.2.3+* ã*QQ*ãç¾åº¦æ¯æ |
| | | |
| | | ?> 妿叿页é¢ä¸ä½¿ç¨æ¬ç»ä»¶ï¼ç»ä»¶çè·¯å¾ä¸º *path/to/mp-html/audio/audio* |
| | | 屿§åäºä»¶åºæ¬å *audio* ç»ä»¶ï¼ç»ä»¶å®ä¾ä¸æä¾äº *setSrc*ã*play*ã*seek*ã*pause*ã*stop* æ¹æ³å¯ä¾æ§å¶ææ¾ç¶æ |
New file |
| | |
| | | module.exports = { |
| | | usingComponents: { |
| | | 'my-audio': '../audio/audio' |
| | | }, |
| | | handler (file) { |
| | | // å å»åæ¥ç audio æ ç¾ |
| | | if (file.basename === 'node.wxml' || file.basename === 'node.vue') { |
| | | file.contents = Buffer.from(file.contents.toString().replace(/<audio[\s\S]+?>/, '')) |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | const ctx = {} |
| | | |
| | | module.exports = { |
| | | get: id => ctx[id], |
| | | set: (id, vm) => { ctx[id] = vm }, |
| | | remove: id => { ctx[id] = undefined } |
| | | } |
New file |
| | |
| | | /** |
| | | * @fileoverview audio æä»¶ |
| | | */ |
| | | const context = require('./context') |
| | | let index = 0 |
| | | |
| | | function Audio (vm) { |
| | | this.vm = vm |
| | | } |
| | | |
| | | Audio.prototype.onUpdate = function () { |
| | | this.audios = [] |
| | | } |
| | | |
| | | Audio.prototype.onParse = function (node) { |
| | | if (node.name === 'audio') { |
| | | if (!node.attrs.id) { |
| | | node.attrs.id = 'a' + index++ |
| | | } |
| | | this.audios.push(node.attrs.id) |
| | | } |
| | | } |
| | | |
| | | Audio.prototype.onLoad = function () { |
| | | setTimeout(() => { |
| | | for (let i = 0; i < this.audios.length; i++) { |
| | | const ctx = context.get(this.audios[i]) |
| | | ctx.id = this.audios[i] |
| | | this.vm._videos.push(ctx) |
| | | } |
| | | }, 500) |
| | | } |
| | | |
| | | module.exports = Audio |
New file |
| | |
| | | /** |
| | | * @fileoverview audio ç»ä»¶ |
| | | */ |
| | | const context = require('./context') |
| | | |
| | | Component({ |
| | | data: { |
| | | time: '00:00' |
| | | }, |
| | | properties: { |
| | | name: String, // é³ä¹å |
| | | author: String, // ä½è
|
| | | poster: String, // æµ·æ¥å¾çå°å |
| | | autoplay: Boolean, // æ¯å¦èªå¨ææ¾ |
| | | controls: Boolean, // æ¯å¦æ¾ç¤ºæ§ä»¶ |
| | | loop: Boolean, // æ¯å¦å¾ªç¯ææ¾ |
| | | src: { // æºå°å |
| | | type: String, |
| | | observer (src) { |
| | | this.setSrc(src) |
| | | } |
| | | } |
| | | }, |
| | | created () { |
| | | // å建å
é¨ context |
| | | this._ctx = wx.createInnerAudioContext() |
| | | this._ctx.onError(err => { |
| | | this.setData({ |
| | | error: true |
| | | }) |
| | | this.triggerEvent('error', err) |
| | | }) |
| | | this._ctx.onTimeUpdate(() => { |
| | | const time = this._ctx.currentTime |
| | | const min = parseInt(time / 60) |
| | | const sec = Math.ceil(time % 60) |
| | | const data = {} |
| | | data.time = (min > 9 ? min : '0' + min) + ':' + (sec > 9 ? sec : '0' + sec) |
| | | // ä¸å¨æå¨ç¶æä¸éè¦æ´æ°è¿åº¦æ¡ |
| | | if (!this.lastTime) { |
| | | data.value = time / this._ctx.duration * 100 |
| | | } |
| | | this.setData(data) |
| | | }) |
| | | this._ctx.onEnded(() => { |
| | | if (!this.properties.loop) { |
| | | this.setData({ |
| | | playing: false |
| | | }) |
| | | } |
| | | }) |
| | | // #ifndef ALIPAY |
| | | }, |
| | | attached () { |
| | | context.set(this.id, this) |
| | | // #endif |
| | | // #ifdef MP-ALIPAY |
| | | context.set(this.properties.id, this) |
| | | this.setSrc(this.properties.src) |
| | | // #endif |
| | | }, |
| | | // #ifdef MP-ALIPAY |
| | | didUpdate (e) { |
| | | if (e.src !== this.properties.src) { |
| | | this.setSrc(this.properties.src) |
| | | } |
| | | }, |
| | | // #endif |
| | | detached () { |
| | | this._ctx.destroy() |
| | | // #ifndef MP-ALIPAY |
| | | context.remove(this.id) |
| | | // #endif |
| | | // #ifdef MP_ALIPAY |
| | | context.remove(this.properties.id) |
| | | // #endif |
| | | }, |
| | | // #ifndef ALIPAY | TOUTIAO |
| | | pageLifetimes: { |
| | | show () { |
| | | // ææ¾è¢«åå°æææ¶ï¼é¡µé¢æ¾ç¤ºåèªå¨ç»§ç»ææ¾ |
| | | if (this.data.playing && this._ctx.paused) { |
| | | this._ctx.play() |
| | | } |
| | | } |
| | | }, |
| | | // #endif |
| | | methods: { |
| | | /** |
| | | * @description è®¾ç½®æº |
| | | * @param {string} src æºå°å |
| | | */ |
| | | setSrc (src) { |
| | | this._ctx.autoplay = this.properties.autoplay |
| | | this._ctx.loop = this.properties.loop |
| | | this._ctx.src = src |
| | | if (this.properties.autoplay && !this.data.playing) { |
| | | this.setData({ |
| | | playing: true |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description ææ¾é³ä¹ |
| | | */ |
| | | play () { |
| | | this._ctx.play() |
| | | this.setData({ |
| | | playing: true |
| | | }) |
| | | this.triggerEvent('play' |
| | | // #ifdef MP-ALIPAY |
| | | , { |
| | | target: { |
| | | id: this.props.id |
| | | } |
| | | } |
| | | // #endif |
| | | ) |
| | | }, |
| | | |
| | | /** |
| | | * @description æåé³ä¹ |
| | | */ |
| | | pause () { |
| | | this._ctx.pause() |
| | | this.setData({ |
| | | playing: false |
| | | }) |
| | | this.triggerEvent('pause') |
| | | }, |
| | | |
| | | /** |
| | | * @description è®¾ç½®ææ¾éç |
| | | * @param {Number} rate ææ¾éç |
| | | */ |
| | | playbackRate (rate) { |
| | | this._ctx.playbackRate = rate |
| | | }, |
| | | |
| | | /** |
| | | * @description 忢é³ä¹ |
| | | */ |
| | | stop () { |
| | | this._ctx.stop() |
| | | this.setData({ |
| | | playing: false, |
| | | time: '00:00' |
| | | }) |
| | | this.triggerEvent('stop') |
| | | }, |
| | | |
| | | /** |
| | | * @description æ§å¶è¿åº¦ |
| | | * @param {number} sec ç§æ° |
| | | */ |
| | | seek (sec) { |
| | | this._ctx.seek(sec) |
| | | }, |
| | | |
| | | /** |
| | | * @description ç§»å¨è¿åº¦æ¡ |
| | | * @param {event} e |
| | | * @private |
| | | */ |
| | | _seeking (e) { |
| | | // é¿å
è¿äºé¢ç¹ setData |
| | | if (e.timeStamp - this.lastTime < 200) return |
| | | const time = Math.round(e.detail.value / 100 * this._ctx.duration) |
| | | const min = parseInt(time / 60) |
| | | const sec = time % 60 |
| | | this.setData({ |
| | | time: (min > 9 ? min : '0' + min) + ':' + (sec > 9 ? sec : '0' + sec) |
| | | }) |
| | | this.lastTime = e.timeStamp |
| | | }, |
| | | |
| | | /** |
| | | * @description è¿åº¦æ¡ç§»å¨å®æ¯ |
| | | * @param {event} e |
| | | * @private |
| | | */ |
| | | _seeked (e) { |
| | | this._ctx.seek(e.detail.value / 100 * this._ctx.duration) |
| | | this.lastTime = undefined |
| | | } |
| | | } |
| | | }) |
New file |
| | |
| | | { |
| | | "component": true |
| | | } |
New file |
| | |
| | | <view wx:if="{{controls}}" class="_contain"> |
| | | <!-- æµ·æ¥åæé® --> |
| | | <view class="_poster" style="background-image:url('{{poster}}')"> |
| | | <view class="_button" bindtap="{{playing?'pause':'play'}}"> |
| | | <view class="{{playing?'_pause':'_play'}}" /> |
| | | </view> |
| | | </view> |
| | | <!-- æ²ååä½è
--> |
| | | <view class="_title"> |
| | | <view class="_name">{{name||'æªç¥é³é¢'}}</view> |
| | | <view class="_author">{{author||'æªç¥ä½è
'}}</view> |
| | | </view> |
| | | <!-- è¿åº¦æ¡ --> |
| | | <slider class="_slider" activeColor="#585959" block-size="12" disabled="{{error}}" value="{{value}}" bindchanging="_seeking" bindchange="_seeked" /> |
| | | <!--ææ¾æ¶é´--> |
| | | <view class="_time">{{time}}</view> |
| | | </view> |
New file |
| | |
| | | /* é¡¶å±å®¹å¨ */ |
| | | ._contain { |
| | | position: relative; |
| | | display: inline-flex; |
| | | width: 290px; |
| | | background-color: #fcfcfc; |
| | | border: 1px solid #e0e0e0; |
| | | border-radius: 2px; |
| | | } |
| | | |
| | | /* ææ¾ãæåæé® */ |
| | | ._button { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 20px; |
| | | height: 20px; |
| | | overflow: hidden; |
| | | background-color: rgb(0, 0, 0, 0.2); |
| | | border: 1px solid white; |
| | | border-radius: 50%; |
| | | opacity: 0.9; |
| | | } |
| | | |
| | | ._play { |
| | | margin-left: 2px; |
| | | border-top: 4px solid transparent; |
| | | border-bottom: 4px solid transparent; |
| | | border-left: 8px solid white; |
| | | } |
| | | |
| | | ._pause { |
| | | width: 8px; |
| | | height: 8px; |
| | | background-color: white; |
| | | } |
| | | |
| | | /* æµ·æ¥ */ |
| | | ._poster { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 70px; |
| | | height: 70px; |
| | | background-color: #e6e6e6; |
| | | background-size: contain; |
| | | } |
| | | |
| | | /* æ 颿 */ |
| | | ._title { |
| | | flex: 1; |
| | | margin: 4px 0 0 14px; |
| | | text-align: left; |
| | | } |
| | | |
| | | ._author { |
| | | width: 45px; |
| | | font-size: 12px; |
| | | color: #888; |
| | | } |
| | | |
| | | ._name { |
| | | width: 140px; |
| | | font-size: 15px; |
| | | line-height: 39px; |
| | | } |
| | | |
| | | ._author, |
| | | ._name { |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | /* è¿åº¦æ¡ */ |
| | | ._slider { |
| | | position: absolute; |
| | | right: 16px; |
| | | bottom: 8px; |
| | | width: 140px; |
| | | margin: 0; |
| | | } |
| | | |
| | | /* ææ¾æ¶é´ */ |
| | | ._time { |
| | | margin: 7px 14px 0 0; |
| | | font-size: 12px; |
| | | color: #888; |
| | | } |
| | | |
| | | /* ååºå¼å¸å±ï¼å¤§å±å¹ç¨æ´å¤§ç尺寸 */ |
| | | @media (min-width: 400px) { |
| | | ._contain { |
| | | width: 380px; |
| | | } |
| | | |
| | | ._button { |
| | | width: 26px; |
| | | height: 26px; |
| | | } |
| | | |
| | | ._poster { |
| | | width: 90px; |
| | | height: 90px; |
| | | } |
| | | |
| | | ._author { |
| | | width: 60px; |
| | | font-size: 15px; |
| | | } |
| | | |
| | | ._name { |
| | | width: 180px; |
| | | font-size: 19px; |
| | | line-height: 55px; |
| | | } |
| | | |
| | | ._slider { |
| | | right: 20px; |
| | | bottom: 10px; |
| | | width: 180px; |
| | | } |
| | | |
| | | ._time { |
| | | font-size: 15px; |
| | | } |
| | | } |
New file |
| | |
| | | module.exports = { |
| | | template: '<my-audio wx:if="{{n.name==\'audio\'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" autoplay="{{n.attrs.autoplay}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" data-source="audio" bindplay="play" binderror="mediaError" />' |
| | | } |
New file |
| | |
| | | <template> |
| | | <view v-if="controls" @click="onClick" class="_contain"> |
| | | <!-- æµ·æ¥åæé® --> |
| | | <view class="_poster" :style="'background-image:url('+poster+')'"> |
| | | <view class="_button" @tap="_buttonTap"> |
| | | <view :class="playing?'_pause':'_play'" /> |
| | | </view> |
| | | </view> |
| | | <!-- æ²ååä½è
--> |
| | | <view class="_title"> |
| | | <view class="_name">{{name||'æªç¥é³é¢'}}</view> |
| | | <view class="_author">{{author||'æªç¥ä½è
'}}</view> |
| | | </view> |
| | | <!-- è¿åº¦æ¡ --> |
| | | <slider class="_slider" activeColor="#585959" block-size="12" handle-size="12" :disabled="error" :value="value" @changing="_seeking" @change="_seeked" /> |
| | | <!--ææ¾æ¶é´--> |
| | | <view class="_time">{{time||'00:00'}}</view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | /** |
| | | * @fileoverview audio ç»ä»¶ |
| | | */ |
| | | import context from './context' |
| | | export default { |
| | | data () { |
| | | return { |
| | | error: false, |
| | | playing: false, |
| | | time: '00:00', |
| | | value: 0 |
| | | } |
| | | }, |
| | | props: { |
| | | aid: String, |
| | | name: String, // é³ä¹å |
| | | author: String, // ä½è
|
| | | poster: String, // æµ·æ¥å¾çå°å |
| | | autoplay: [Boolean, String], // æ¯å¦èªå¨ææ¾ |
| | | controls: [Boolean, String], // æ¯å¦æ¾ç¤ºæ§ä»¶ |
| | | loop: [Boolean, String], // æ¯å¦å¾ªç¯ææ¾ |
| | | src: String // æºå°å |
| | | }, |
| | | watch: { |
| | | src (src) { |
| | | this.setSrc(src) |
| | | } |
| | | }, |
| | | mounted () { |
| | | this._ctx = uni.createInnerAudioContext() |
| | | this._ctx.onError((err) => { |
| | | this.error = true |
| | | this.$emit('error', err) |
| | | }) |
| | | this._ctx.onTimeUpdate(() => { |
| | | const time = this._ctx.currentTime |
| | | const min = parseInt(time / 60) |
| | | const sec = Math.ceil(time % 60) |
| | | this.time = (min > 9 ? min : '0' + min) + ':' + (sec > 9 ? sec : '0' + sec) |
| | | if (!this.lastTime) { |
| | | this.value = time / this._ctx.duration * 100 // ä¸å¨æå¨ç¶æä¸ |
| | | } |
| | | }) |
| | | this._ctx.onEnded(() => { |
| | | if (!this.loop) { |
| | | this.playing = false |
| | | } |
| | | }) |
| | | context.set(this.aid, this) |
| | | this.setSrc(this.src) |
| | | }, |
| | | beforeDestroy () { |
| | | this._ctx.destroy() |
| | | context.remove(this.aid) |
| | | }, |
| | | onPageShow () { |
| | | if (this.playing && this._ctx.paused) { |
| | | this._ctx.play() |
| | | } |
| | | }, |
| | | methods: { |
| | | // è®¾ç½®æº |
| | | setSrc (src) { |
| | | this._ctx.autoplay = this.autoplay |
| | | this._ctx.loop = this.loop |
| | | this._ctx.src = src |
| | | if (this.autoplay && !this.playing) { |
| | | this.playing = true |
| | | } |
| | | }, |
| | | // ææ¾ |
| | | play () { |
| | | this._ctx.play() |
| | | this.playing = true |
| | | this.$emit('play', { |
| | | target: { |
| | | id: this.aid |
| | | } |
| | | }) |
| | | }, |
| | | // æå |
| | | pause () { |
| | | this._ctx.pause() |
| | | this.playing = false |
| | | this.$emit('pause') |
| | | }, |
| | | // è®¾ç½®ææ¾éç |
| | | playbackRate (rate) { |
| | | this._ctx.playbackRate = rate |
| | | }, |
| | | // ç§»å¨è¿åº¦æ¡ |
| | | seek (sec) { |
| | | this._ctx.seek(sec) |
| | | }, |
| | | // å
鍿¹æ³ |
| | | _buttonTap () { |
| | | if (this.playing) this.pause() |
| | | else this.play() |
| | | }, |
| | | _seeking (e) { |
| | | // é¿å
è¿äºé¢ç¹ setData |
| | | if (e.timeStamp - this.lastTime < 200) return |
| | | const time = Math.round(e.detail.value / 100 * this._ctx.duration) |
| | | const min = parseInt(time / 60) |
| | | const sec = time % 60 |
| | | this.time = (min > 9 ? min : '0' + min) + ':' + (sec > 9 ? sec : '0' + sec) |
| | | this.lastTime = e.timeStamp |
| | | }, |
| | | _seeked (e) { |
| | | this.seek(e.detail.value / 100 * this._ctx.duration) |
| | | this.lastTime = undefined |
| | | }, |
| | | onClick(e) { |
| | | this.$emit('onClick', e) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | /* é¡¶å±å®¹å¨ */ |
| | | ._contain { |
| | | position: relative; |
| | | display: inline-flex; |
| | | width: 290px; |
| | | background-color: #fcfcfc; |
| | | border: 1px solid #e0e0e0; |
| | | border-radius: 2px; |
| | | } |
| | | |
| | | /* ææ¾ãæåæé® */ |
| | | ._button { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 20px; |
| | | height: 20px; |
| | | overflow: hidden; |
| | | background-color: rgb(0, 0, 0, 0.2); |
| | | border: 1px solid white; |
| | | border-radius: 50%; |
| | | opacity: 0.9; |
| | | } |
| | | |
| | | ._play { |
| | | margin-left: 2px; |
| | | border-top: 4px solid transparent; |
| | | border-bottom: 4px solid transparent; |
| | | border-left: 8px solid white; |
| | | } |
| | | |
| | | ._pause { |
| | | width: 8px; |
| | | height: 8px; |
| | | background-color: white; |
| | | } |
| | | |
| | | /* æµ·æ¥ */ |
| | | ._poster { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 70px; |
| | | height: 70px; |
| | | background-color: #e6e6e6; |
| | | background-size: contain; |
| | | } |
| | | |
| | | /* æ 颿 */ |
| | | ._title { |
| | | flex: 1; |
| | | margin: 4px 0 0 14px; |
| | | text-align: left; |
| | | } |
| | | |
| | | ._author { |
| | | width: 45px; |
| | | font-size: 12px; |
| | | color: #888; |
| | | } |
| | | |
| | | ._name { |
| | | width: 140px; |
| | | font-size: 15px; |
| | | line-height: 39px; |
| | | } |
| | | |
| | | ._author, |
| | | ._name { |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | /* è¿åº¦æ¡ */ |
| | | ._slider { |
| | | position: absolute; |
| | | right: 16px; |
| | | bottom: 8px; |
| | | width: 140px; |
| | | margin: 0; |
| | | } |
| | | |
| | | /* ææ¾æ¶é´ */ |
| | | ._time { |
| | | margin: 7px 14px 0 0; |
| | | font-size: 12px; |
| | | color: #888; |
| | | } |
| | | |
| | | /* ååºå¼å¸å±ï¼å¤§å±å¹ç¨æ´å¤§ç尺寸 */ |
| | | @media (min-width: 400px) { |
| | | ._contain { |
| | | width: 380px; |
| | | } |
| | | |
| | | ._button { |
| | | width: 26px; |
| | | height: 26px; |
| | | } |
| | | |
| | | ._poster { |
| | | width: 90px; |
| | | height: 90px; |
| | | } |
| | | |
| | | ._author { |
| | | width: 60px; |
| | | font-size: 15px; |
| | | } |
| | | |
| | | ._name { |
| | | width: 180px; |
| | | font-size: 19px; |
| | | line-height: 55px; |
| | | } |
| | | |
| | | ._slider { |
| | | right: 20px; |
| | | bottom: 10px; |
| | | width: 180px; |
| | | } |
| | | |
| | | ._time { |
| | | font-size: 15px; |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | module.exports = { |
| | | template: '<my-audio v-if="n.name==\'audio\'" :class="n.attrs.class" :style="n.attrs.style" :aid="n.attrs.id" :author="n.attrs.author" :controls="n.attrs.controls" :autoplay="n.attrs.autoplay" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" data-source="audio" @play="play" @error="mediaError" />' |
| | | } |
New file |
| | |
| | | # card |
| | | åè½ï¼ååï¼èç»äººï¼ä¿¡æ¯å¡ |
| | | 大å°ï¼*â7KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â(nvue 䏿¯æ) | |
| | | |
| | | ### ææå¾ |
| | |  |
| | | |
| | | ### åæ°å表 |
| | | |åæ°å|æ¯å¦å¿
é¡»|ç±»å|说æ| |
| | | |:---- |:---|:----- |----- | |
| | | |src|æ¯|String|å¾çUrl| |
| | | |title|æ¯|String|æ é¢| |
| | | |desc|æ¯|String|æè¿°| |
| | | |url|æ¯|String|跳转url| |
| | | |color|æ¯|String|æåé¢è²| |
| | | |bgcolor|æ¯|String|å¡çèæ¯é¢è²| |
| | | |border|æ¯|String|å¡çè¾¹æ¡é¢è²| |
| | | |
| | | ### 说æï¼ |
| | | 1. å¯ä»¥æ¾ç¤ºååä¿¡æ¯å¡ç/èç»äººä¿¡æ¯å¡ç |
| | | |
| | | ### åºç¡åºè¦æ±ï¼ |
| | | 满足æä½è¦æ±å³å¯ |
| | | |
| | | ?> 妿叿页é¢ä¸ä½¿ç¨æ¬ç»ä»¶ï¼ç»ä»¶çè·¯å¾ä¸º *path/to/mp-html/card/card* |
New file |
| | |
| | | module.exports = { |
| | | usingComponents: { |
| | | 'my-card': '../card/card' |
| | | }, |
| | | handler (file) { |
| | | if (file.isBuffer()) { |
| | | let content = file.contents.toString() |
| | | if (file.path.includes('parser.js')) { |
| | | content = content.replace(/trustTags\s*:\s*makeMap\('/, "trustTags: makeMap('card,").replace(/voidTags\s*:\s*makeMap\('/, "voidTags: makeMap('card,") |
| | | } |
| | | file.contents = Buffer.from(content) |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * @fileoverview Card æä»¶ |
| | | */ |
| | | function Card (vm) { |
| | | } |
| | | |
| | | module.exports = Card |
New file |
| | |
| | | module.exports = { |
| | | template: '<my-card wx:if="{{n.name==\'card\'}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" mode="{{opts[5]}}" src="{{n.attrs.src}}" title="{{n.attrs.title}}" desc="{{n.attrs.desc}}" url="{{n.attrs.url}}" color="{{n.attrs.color}}" bgcolor="{{n.attrs.bgcolor}}" border="{{n.attrs.border}}" name="{{n.attrs.name}}" data-i="{{i}}" data-source="card" />' |
| | | } |
New file |
| | |
| | | /** |
| | | * @fileoverview card ç»ä»¶ |
| | | */ |
| | | Component({ |
| | | properties: { |
| | | mode: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | src: String, |
| | | title: String, |
| | | desc: String, |
| | | url: String, |
| | | color: String, |
| | | bgcolor: String, |
| | | border: String |
| | | }, |
| | | data: {}, |
| | | methods: { |
| | | onClick (e) { |
| | | if (this.properties.url && this.properties.url.trim().length > 6 && !this.properties.mode) { |
| | | wx.navigateTo({ url: this.properties.url }) |
| | | } |
| | | } |
| | | } |
| | | }) |
New file |
| | |
| | | { |
| | | "component": true |
| | | } |
New file |
| | |
| | | <view class="card" bindtap="onClick" style="background-color:{{bgcolor||'#a4d0ff'}};border:{{border||'1px solid #FFF'}};color:{{color||'#000'}}"> |
| | | <image class="card-img" mode="aspectFill" src="{{src}}" /> |
| | | <view class="text-wrap text-wrap-width" wx:if="{{!!desc}}"> |
| | | <view class="title one-t">{{title}}</view> |
| | | <view class="desc one-t">{{desc}}</view> |
| | | </view> |
| | | <view wx:else class="text-wrap-width title more-t">{{title}}</view> |
| | | <image class="card-icon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABCFBMVEUAAAC/v7+qqqqZmZmLi6KJnZ2ImZmHlpaGlKGMjJmSkp6Li5eQkJuKlZ+Pj5mOjpeJkpuNjZ6IkJmHj5eLi5uKkpmGjZqJj5uLi5eIjpmIjZiKj5qKj5mJjpiHjJqJjZaGj5iKj5eIjJmKjpqHi5eGjZeIi5eHjZiIi5eHjJiIjpaHjJeIjZiGjJeIjZiGjJaGjJeIi5aGjJeHi5eHi5aHjJeHjJaHjJeGi5eHjJaHjJeGi5aGi5aHjJeHjJaGjJeGjJeHjJaHi5eGi5eHjJaHjJeGjJaGjJeHi5aHjJeHjJeHi5aGjJeHi5aGjJaHi5eGjJaHi5eHjJaGi5eGi5aHjJeGi5aGi5apAvjmAAAAV3RSTlMABAYKCw0PERMUFRYXGBkbHB0eICEjJiksLS8wMjQ1ODk7PD9ATFZXWFlaW1xdXl+Hi6msu7/Dx8vMzs/R0tTV19na3N3f4uTn6evs7e7v8PHy9PX7/P18cCTXAAABEklEQVRo3u2YWU5CQRQFn4qCM4LzhIoDAorzrIgCigiCimf/O/Gj3UIlmJxaQFXSea/T90aRMcYYY4zpG0ZPu9cZMnAi6SsLBjqS9LnJBcqSpC53Sjs/kqSPNaxwGAqtFbrQXKILjQW68DpPF17m6EI9TRdqM3TheZouVCbpQnkcK5RC4T5BF27jdOFqhC5cDtOFixhdOB+iC2cDdOEoggttLrDbk6QW5/+WJB1T/r1e+FAHWT/2q/35scsiF/w3cdZ/R13Y+8H/MMb6Hycgfz74n6ZYfzXJ+mspyF8I/vos68cep0X4eV2EB4SD4H9bZP3vy+yTtL3KjrGddXgQ34BXCVvwMmT7P69zjDHGGGP6gF83lHISOctsKQAAAABJRU5ErkJggg=="></image> |
| | | </view> |
New file |
| | |
| | | .one-t { |
| | | overflow: hidden; |
| | | white-space: nowrap; |
| | | text-overflow: ellipsis; |
| | | transition: all linear 0.2s; |
| | | } |
| | | .more-t { |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | word-break: break-all; |
| | | display: -webkit-box; |
| | | -webkit-line-clamp: 2; |
| | | -webkit-box-orient: vertical; |
| | | transition: all linear 0.2s; |
| | | } |
| | | .card { |
| | | width: 80%; |
| | | margin: 10rpx auto; |
| | | max-width: 700rpx; |
| | | max-height: 140rpx; |
| | | box-sizing: border-box; |
| | | overflow: hidden; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 20rpx 0 20rpx 10rpx; |
| | | border-radius: 12rpx; |
| | | } |
| | | .card-img { |
| | | width: 96rpx; |
| | | height: 96rpx; |
| | | border-radius: 12rpx; |
| | | flex: 0 0 96rpx; |
| | | } |
| | | .card-icon { |
| | | width: 30rpx; |
| | | height: 96rpx; |
| | | } |
| | | .card .text-wrap { |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | } |
| | | .card .text-wrap-width { |
| | | width: 72%; |
| | | } |
| | | .card .title { |
| | | font-weight: bold; |
| | | font-size: 34rpx; |
| | | line-height: 48rpx; |
| | | } |
| | | .card .desc { |
| | | font-size: 27rpx; |
| | | line-height: 37rpx; |
| | | } |
New file |
| | |
| | | module.exports = { |
| | | template: '<my-card v-if="n.name==\'card\'" :class="n.attrs.class" :style="n.attrs.style" :mode="opts[5]" :src="n.attrs.src" :title="n.attrs.title" :desc="n.attrs.desc" :url="n.attrs.url" :color="n.attrs.color" :bgcolor="n.attrs.bgcolor" :border="n.attrs.border" :name="n.attrs.name" :data-i="i" data-source="card" />' |
| | | } |
New file |
| | |
| | | <template> |
| | | <view class="card" @click="onClick" :style="[customStyle]" :data-i="$attrs['data-i']"> |
| | | <image class="card-img" mode="aspectFill" :src="src" /> |
| | | <view class="text-wrap text-wrap-width" v-if="!!desc"> |
| | | <view class="title one-t">{{title}}</view> |
| | | <view class="desc one-t">{{desc}}</view> |
| | | </view> |
| | | <view v-else class="text-wrap-width title more-t">{{title}}</view> |
| | | <image class="card-icon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAABCFBMVEUAAAC/v7+qqqqZmZmLi6KJnZ2ImZmHlpaGlKGMjJmSkp6Li5eQkJuKlZ+Pj5mOjpeJkpuNjZ6IkJmHj5eLi5uKkpmGjZqJj5uLi5eIjpmIjZiKj5qKj5mJjpiHjJqJjZaGj5iKj5eIjJmKjpqHi5eGjZeIi5eHjZiIi5eHjJiIjpaHjJeIjZiGjJeIjZiGjJaGjJeIi5aGjJeHi5eHi5aHjJeHjJaHjJeGi5eHjJaHjJeGi5aGi5aHjJeHjJaGjJeGjJeHjJaHi5eGi5eHjJaHjJeGjJaGjJeHi5aHjJeHjJeHi5aGjJeHi5aGjJaHi5eGjJaHi5eHjJaGi5eGi5aHjJeGi5aGi5apAvjmAAAAV3RSTlMABAYKCw0PERMUFRYXGBkbHB0eICEjJiksLS8wMjQ1ODk7PD9ATFZXWFlaW1xdXl+Hi6msu7/Dx8vMzs/R0tTV19na3N3f4uTn6evs7e7v8PHy9PX7/P18cCTXAAABEklEQVRo3u2YWU5CQRQFn4qCM4LzhIoDAorzrIgCigiCimf/O/Gj3UIlmJxaQFXSea/T90aRMcYYY4zpG0ZPu9cZMnAi6SsLBjqS9LnJBcqSpC53Sjs/kqSPNaxwGAqtFbrQXKILjQW68DpPF17m6EI9TRdqM3TheZouVCbpQnkcK5RC4T5BF27jdOFqhC5cDtOFixhdOB+iC2cDdOEoggttLrDbk6QW5/+WJB1T/r1e+FAHWT/2q/35scsiF/w3cdZ/R13Y+8H/MMb6Hycgfz74n6ZYfzXJ+mspyF8I/vos68cep0X4eV2EB4SD4H9bZP3vy+yTtL3KjrGddXgQ34BXCVvwMmT7P69zjDHGGGP6gF83lHISOctsKQAAAABJRU5ErkJggg=="></image> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | props: { |
| | | mode: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | src: String, |
| | | title: String, |
| | | desc: String, |
| | | url: String, |
| | | color: String, |
| | | bgcolor: String, |
| | | border: String |
| | | }, |
| | | data () { |
| | | return { |
| | | |
| | | } |
| | | }, |
| | | computed: { |
| | | customStyle () { |
| | | return { |
| | | 'background-color': this.bgColor || '#a4d0ff', |
| | | border: this.border || '1px solid #FFF', |
| | | color: this.color || '#000' |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | onClick (e) { |
| | | if (this.url && this.url.trim().length > 6 && !this.mode) { |
| | | uni.navigateTo({ url: this.url }) |
| | | } |
| | | this.$emit('click', e) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | .one-t { |
| | | overflow: hidden; |
| | | white-space: nowrap; |
| | | text-overflow: ellipsis; |
| | | transition: all linear 0.2s; |
| | | } |
| | | |
| | | .more-t { |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | word-break:break-all; |
| | | display: -webkit-box; |
| | | -webkit-line-clamp: 2; |
| | | -webkit-box-orient: vertical; |
| | | transition: all linear 0.2s; |
| | | } |
| | | |
| | | .card { |
| | | |
| | | width: 80%; |
| | | margin: 10rpx auto; |
| | | max-width: 700rpx; |
| | | max-height: 140rpx; |
| | | |
| | | box-sizing: border-box; |
| | | overflow: hidden; |
| | | |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | |
| | | padding: 20rpx 0 20rpx 10rpx; |
| | | border-radius: 12rpx; |
| | | |
| | | &-img { |
| | | width: 96rpx; |
| | | height: 96rpx; |
| | | border-radius: 12rpx; |
| | | flex: 0 0 96rpx; |
| | | } |
| | | |
| | | &-icon { |
| | | width: 30rpx; |
| | | height: 96rpx; |
| | | } |
| | | |
| | | .text-wrap { |
| | | |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | |
| | | &-width { |
| | | width: 72%; |
| | | } |
| | | } |
| | | |
| | | .title { |
| | | font-weight: bold; |
| | | font-size: 34rpx; |
| | | line-height: 48rpx; |
| | | } |
| | | |
| | | .desc { |
| | | font-size: 27rpx; |
| | | line-height: 37rpx; |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | # editable |
| | | åè½ï¼å¯ææ¬ç¼è¾ |
| | | ä¸è¡¨ååºäºæ¬æä»¶ä¸åç *editor* ç»ä»¶çåè½å·®å¼ï¼å¯æééç¨ |
| | | |
| | | | ç»ä»¶ | ä¼ç¹ | ç¼ºç¹ | |
| | | |:---:|:---:|:---:| |
| | | | åç *editor* | åºå±éè¿ *contenteditable* å®ç°ï¼ç¼è¾æµç
| æ¯ææ ç¾å°ï¼ä¸æ¯æé³è§é¢ãè¡¨æ ¼ä»¥å *section* çå¸¸ç¨æ ç¾ï¼ãé¨åå°ç¨åºå¹³å°ä¸æ¯ææä½çæ¬ä¸å
¼å®¹ | |
| | | | æ¬æä»¶ | æ¯ææ ç¾å
¨é¢ãæ¯æå¹³å°å
¨é¢ | ç¼è¾çµæ´»æ§ä¸å¤å¼º | |
| | | |
| | | 大å°ï¼*â17.5KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â(nvue 䏿¯æ) | |
| | | |
| | | 说æï¼ |
| | | å¼å
¥æ¬æä»¶åï¼ä¼ç»ç»ä»¶æ·»å 以ä¸å±æ§ï¼ |
| | | |
| | | | 屿§å | ç±»å | é»è®¤å¼ | 说æ | |
| | | |:---:|:---:|:---:|:---:| |
| | | | editable | Boolean | false | æ¯å¦å¼å¯å
容ç¼è¾ | |
| | | | placeholder | String | 请è¾å
¥ | è¾å
¥æ¡ä¸ºç©ºæ¶å ä½ç¬¦ï¼`2.1.0+`ï¼ | |
| | | |
| | | æ·»å 以ä¸äºä»¶ï¼ |
| | | |
| | | | äºä»¶å | è§¦åæ¶æº | ç¨é | |
| | | |:---:|:---:|:---:| |
| | | | removeï¼`2.2.0+`ï¼ | å é¤å¾ç/è§é¢/é³é¢æ ç¾æ¶ | å é¤å·²ä¸ä¼ ççº¿ä¸æä»¶ | |
| | | |
| | | æ¯æä»¥ä¸æä½ï¼ |
| | | |
| | | | ç±»å | æä½ | |
| | | |:---:|:---:| |
| | | | ææ¬ | ä¿®æ¹ | |
| | | | å¾ç | æ´æ¢é¾æ¥ãè°æ´å®½åº¦ã设置æè¶
龿¥ï¼`2.0.4+`ï¼ã设置é¢è§å¾é¾æ¥ãç¦ç¨é¢è§ãå é¤ | |
| | | | 龿¥ | æ´æ¢é¾æ¥ãå é¤ | |
| | | | é³è§é¢ | 设置å°é¢ãè®¾ç½®å¾ªç¯ææ¾ã设置èªå¨ææ¾ï¼`2.2.0+`ï¼ãå é¤ | |
| | | | æ®éæ ç¾ | 设置åä½å¤§å°ãæä½ãç²ä½ãä¸å线ï¼`2.0.4+`ï¼ãå±
ä¸ã缩è¿ãå é¤ | |
| | | |
| | | > `2.2.1` çæ¬èµ·æææ ç¾æ¯æä¸ä¸ç§»å¨æä½ï¼ä½ä»
éå级æ ç¾é´ç§»å¨ï¼å³å¨æå级æ ç¾ä¸é第ä¸ä¸ªï¼ææåä¸ä¸ªï¼æ¶å¯ä»¥ä¸ç§»ï¼æä¸ç§»ï¼ |
| | | |
| | | > 卿¯ä»å®å°ç¨åºä¸ä½¿ç¨æ¶éè¦å¨é¡µé¢æ ·å¼ä¸æ·»å *page { position: relative; }* é¿å
*tooltip* éä½ |
| | | |
| | | > èå项å¯ä»¥éè¿ç¼è¾ *plugins/editable/config.js* è¿è¡ä¿®æ¹ï¼ä»
å¯ä»¥å åæè°æ´é¡ºåºï¼æ·»å ææ´åæ æ |
| | | |
| | | ç»ä»¶å®ä¾ä¸æä¾äºä»¥ä¸æ¹æ³ï¼*editable* 屿§ä¸º *true* æ¶æå¯ä»¥è°ç¨ï¼ï¼ |
| | | |
| | | | åç§° | åè½ | |
| | | |:---:|:---:| |
| | | | undo | æ¤éä¸ä¸ªæä½ | |
| | | | redo | éåä¸ä¸ªæä½ | |
| | | | insertHtml | å¨å
æ 夿å
¥æå® html å
容ï¼`2.1.0+`ï¼ | |
| | | | insertImg | å¨å
æ 夿å
¥ä¸å¼ å¾ç | |
| | | | insertTable(rows, cols) | å¨å
æ 夿å
¥ä¸ä¸ª rows è¡ cols åçè¡¨æ ¼ï¼`2.1.3+`ï¼ | |
| | | | insertVideo | å¨å
æ 夿å
¥ä¸ä¸ªè§é¢ | |
| | | | insertAudio | å¨å
æ 夿å
¥ä¸ä¸ªé³é¢ | |
| | | | insertLink | å¨å
æ 夿å
¥ä¸ä¸ªé¾æ¥ | |
| | | | insertText | å¨å
æ 夿å
¥ä¸æ®µææ¬ | |
| | | | clear | æ¸
空å
容 | |
| | | | getContent | è·åç¼è¾åç html å
容 | |
| | | |
| | | > èèå°ä¸ååºæ¯ä¸å¸æè·å龿¥çæ¹æ³ä¸åï¼éè¦å¨åå§æ¶ç»ç»ä»¶è®¾ç½®ä¸ä¸ª *getSrc* æ¹æ³ï¼å¦åæå
¥å¾çãé³è§é¢ã龿¥æä¿®æ¹é¾æ¥çæä½æ æ³ä½¿ç¨ï¼ï¼æ¯æ¬¡ç»ä»¶å
éè¦é¾æ¥æ¶ä¼è°ç¨æ¤æ¹æ³ï¼å¼åè
å¯å¨æ¤æ¹æ³ä¸èªè¡å³å®å¦ä½è·å龿¥ï¼è¿å **线ä¸å°å** å³å¯ï¼å
·ä½ç¨æ³è§ä¸æ¹ç¤ºä¾ï¼ |
| | | |
| | | ç¼è¾å®æåï¼éè¿ *getContent* æ¹æ³è·åç¼è¾åç *html*ï¼æåå° *editable* 屿§è®¾ç½®ä¸º *false* å³å¯æ£å¸¸æ¸²æ |
| | | |
| | | > ç¹å»ä¿åæé®æ¶ï¼é¨åå¹³å° *tap* äºä»¶æ©äº *blur* äºä»¶è§¦åï¼ç´æ¥è·åå
容å¯è½å¯¼è´æ æ³è·åå½åç¼è¾çææ¬å
容ï¼å æ¤å»ºè®®è®¾ç½®ä¸ä¸ªå°çå»¶æ¶åè·åï¼å¯åè䏿¹ç¤ºä¾ï¼[详ç»](https://github.com/jin-yufeng/mp-html/issues/368)ï¼ |
| | | |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | Page({ |
| | | onLoad () { |
| | | // ctx 为ç»ä»¶å®ä¾ï¼è·åæ¹æ³è§ä¸ |
| | | /** |
| | | * @description 设置è·å龿¥çæ¹æ³ |
| | | * @param {String} type 龿¥çç±»åï¼img/video/audio/linkï¼ |
| | | * @param {String} value ä¿®æ¹é¾æ¥æ¶ï¼è¿éä¼ä¼ å
¥æ§å¼ |
| | | * @returns {Promise} è¿å线ä¸å°åï¼2.2.0 çæ¬èµ·è®¾ç½®äº domain 屿§æ¶ï¼å¯ä»¥ç¼ºç主ååï¼ |
| | | * type 为 audio/video æ¶ï¼å¯ä»¥è¿åä¸ä¸ªæºå°åæ°ç» |
| | | * 2.1.3 çæ¬èµ· type 为 audio æ¶ï¼å¯ä»¥è¿åä¸ä¸ª objectï¼å
å« srcãnameãauthorãposter çåæ®µ |
| | | * 2.2.0 çæ¬èµ· type 为 img æ¶ï¼å¯ä»¥è¿åä¸ä¸ªæºå°åæ°ç»ï¼è¡¨ç¤ºæå
¥å¤å¼ å¾çï¼ä¿®æ¹é¾æ¥æ¶ä»
éä¸å¼ ï¼ |
| | | */ |
| | | this.ctx.getSrc = (type, value) => { |
| | | return new Promise((resolve, reject) => { |
| | | // 以å¾çä¸ºä¾ |
| | | if (type == 'img') { |
| | | wx.chooseImage({ |
| | | count: value === undefined ? 9 : 1, // 2.2.0 çæ¬èµ·æå
¥å¾çæ¶æ¯æå¤å¼ ï¼ä¿®æ¹å¾ç龿¥æ¶ä»
éä¸å¼ ï¼ |
| | | success: res => { |
| | | wx.showLoading({ |
| | | title: 'ä¸ä¼ ä¸' |
| | | }); |
| | | (async ()=>{ |
| | | const arr = [] |
| | | for (let item of res.tempFilePaths) { |
| | | // 便¬¡ä¸ä¼ |
| | | const src = await upload(item) |
| | | arr.push(src) |
| | | } |
| | | return arr |
| | | })().then(res => { |
| | | wx.hideLoading() |
| | | resolve(res) |
| | | }) |
| | | }, |
| | | fail: reject |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | finishEdit () { |
| | | setTimeout(() => { |
| | | var html = ctx.getContent() // è·åç¼è¾å¥½ç html |
| | | // ä¸ä¼ html |
| | | wx.request({ |
| | | url: 'xxx', |
| | | data: { |
| | | html |
| | | }, |
| | | success: () => { |
| | | this.setData({ |
| | | editable: false // ç»æç¼è¾ |
| | | }) |
| | | } |
| | | }) |
| | | }, 50) |
| | | } |
| | | }) |
| | | ``` |
| | | |
| | | **示ä¾é¡¹ç®**ï¼ |
| | | 微信å°ç¨åºç¹å» [代ç çæ®µ](https://developers.weixin.qq.com/s/GFbJKum77eBy) å³å¯å¨å¾®ä¿¡å¼åè
å·¥å
·ä¸å¯¼å
¥ï¼*uni-app* ä¸è½½ [示ä¾é¡¹ç®](https://mp-html.oss-cn-hangzhou.aliyuncs.com/editable.zip) å¨ *HBuilder X* 䏿å¼å³å¯ä½éªï¼æ³¨æç¤ºä¾é¡¹ç®ä¸ä¸ä¸å®å
嫿æ°çæ¬ï¼ä»
ä¾åèä½¿ç¨æ¹æ³ |
| | | |
| | | 注æäºé¡¹ï¼ |
| | | 1. ä¸è¦å¨ *editable* 屿§è¢«è®¾ç½®ä¸º *true* åéè¿ *setContent* æ¹æ³ï¼ç¨ *content* 屿§ï¼è®¾ç½®å
容ï¼å¦åå¨åæ¢ä¸º *true* åä¼åæç©ºç½ |
| | | 2. *editable* 屿§ä¸º *true* æ¶ä¸æ¯æå¨ *scroll-view* ä¸ä½¿ç¨ï¼å¦åæç¤ºæ¡çä½ç½®å¯è½ä¸æ£ç¡® |
New file |
| | |
| | | // 以ä¸é¡¹ç®å¯ä»¥å åææ´æ¢é¡ºåºï¼ä½ä¸è½æ·»å ææ´æ¹åå |
| | | module.exports = { |
| | | // æ®éæ ç¾çèå项 |
| | | node: ['大å°', 'é¢è²', 'æä½', 'ç²ä½', 'ä¸å线', 'å±
ä¸', '缩è¿', 'ä¸ç§»', 'ä¸ç§»', 'å é¤'], |
| | | // å¯ä»¥è®¾ç½®çæåé¢è²ï¼æ¤é¡¹å¯ä»¥æ·»å css é¢è² |
| | | color: ['red', 'yellow', 'blue', 'green', 'gray', 'white', 'black'], |
| | | // å¾ççèå项 |
| | | img: ['æ¢å¾', '宽度', 'è¶
龿¥', 'é¢è§å¾', 'ç¦ç¨é¢è§', 'ä¸ç§»', 'ä¸ç§»', 'å é¤'], |
| | | // 龿¥çèå项 |
| | | link: ['æ´æ¢é¾æ¥', 'ä¸ç§»', 'ä¸ç§»', 'å é¤'], |
| | | // é³è§é¢çèå项 |
| | | media: ['å°é¢', '循ç¯', 'èªå¨ææ¾', 'ä¸ç§»', 'ä¸ç§»', 'å é¤'], |
| | | // å¡ççèå项 |
| | | card: ['ä¸ç§»', 'ä¸ç§»', 'å é¤'] |
| | | } |
New file |
| | |
| | | const path = require('path') |
| | | /* global getTop */ |
| | | module.exports = { |
| | | style: `/* #ifndef MP-ALIPAY */ |
| | | ._address, |
| | | ._article, |
| | | ._aside, |
| | | ._body, |
| | | ._caption, |
| | | ._center, |
| | | ._cite, |
| | | ._footer, |
| | | ._header, |
| | | ._html, |
| | | ._nav, |
| | | ._pre, |
| | | ._section { |
| | | display: block; |
| | | } |
| | | |
| | | /* #endif */`, |
| | | methods: { |
| | | /** |
| | | * @description å¼å§ç¼è¾ææ¬ |
| | | * @param {Event} e |
| | | */ |
| | | editStart (e) { |
| | | if (this.properties.opts[5]) { |
| | | const i = e.currentTarget.dataset.i |
| | | if (!this.data.ctrl['e' + i] && this.properties.opts[5] !== 'simple') { |
| | | // æ¾ç¤ºèçº¿æ¡ |
| | | this.setData({ |
| | | ['ctrl.e' + i]: 1 |
| | | }) |
| | | // ç¹å»å
¶ä»å°æ¹ååæ¶èçº¿æ¡ |
| | | setTimeout(() => { |
| | | this.root._mask.push(() => { |
| | | this.setData({ |
| | | ['ctrl.e' + i]: 0 |
| | | }) |
| | | }) |
| | | }, 50) |
| | | this.root._edit = this |
| | | this.i = i |
| | | this.cursor = this.getNode(i).text.length |
| | | } else { |
| | | if (this.properties.opts[5] === 'simple') { |
| | | this.root._edit = this |
| | | this.i = i |
| | | this.cursor = this.getNode(i).text.length |
| | | } |
| | | this.root._mask.pop() |
| | | this.root._maskTap() |
| | | // å° text 转为 textarea |
| | | this.setData({ |
| | | ['ctrl.e' + i]: 2 |
| | | }) |
| | | // å»¶æ¶å¯¹ç¦ï¼é¿å
é«åº¦é误 |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | ['ctrl.e' + i]: 3 |
| | | }) |
| | | }, 50) |
| | | } |
| | | } |
| | | }, |
| | | /** |
| | | * @description è¾å
¥ææ¬ |
| | | * @param {Event} e |
| | | */ |
| | | editInput (e) { |
| | | const i = e.target.dataset.i |
| | | // æ¿æ¢è¿ç»ç©ºæ ¼ |
| | | const value = e.detail.value.replace(/ {2,}/, $ => { |
| | | let res = '\xa0' |
| | | for (let i = 1; i < $.length; i++) { |
| | | res += '\xa0' |
| | | } |
| | | return res |
| | | }) |
| | | this.root._editVal('nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].text', this.getNode(i).text, value) // è®°å½ç¼è¾åå² |
| | | this.cursor = e.detail.cursor |
| | | }, |
| | | /** |
| | | * @description 宿ç¼è¾ææ¬ |
| | | * @param {Event} e |
| | | */ |
| | | editEnd (e) { |
| | | const i = e.target.dataset.i |
| | | // æ´æ°å°è§å¾ |
| | | this.setData({ |
| | | ['ctrl.e' + i]: 0 |
| | | }) |
| | | this.root.setData({ |
| | | ['nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].text']: e.detail.value.replace(/ {2}/g, '\xa0 ') |
| | | }) |
| | | if (e.detail.cursor !== undefined) { |
| | | this.cursor = e.detail.cursor |
| | | } |
| | | }, |
| | | /** |
| | | * @description æå
¥ä¸ä¸ªæ ç¾ |
| | | * @param {Object} node è¦æå
¥çæ ç¾ |
| | | */ |
| | | insert (node) { |
| | | setTimeout(() => { |
| | | const arr = this.i.split('_') |
| | | const i = parseInt(arr.pop()) |
| | | let path = arr.join('_') |
| | | const children = path ? this.getNode(path).children : this.properties.childs |
| | | const childs = children.slice(0) |
| | | if (!childs[i]) { |
| | | childs.push(node) |
| | | } else if (childs[i].text) { |
| | | // 卿æ¬ä¸æå
¥ |
| | | const text = childs[i].text |
| | | if (node.type === 'text') { |
| | | if (this.cursor) { |
| | | childs[i].text = text.substring(0, this.cursor) + node.text + text.substring(this.cursor) |
| | | } else { |
| | | childs[i].text += node.text |
| | | } |
| | | } else { |
| | | const list = [] |
| | | if (this.cursor) { |
| | | list.push({ |
| | | type: 'text', |
| | | text: text.substring(0, this.cursor) |
| | | }) |
| | | } |
| | | list.push(node) |
| | | if (this.cursor < text.length) { |
| | | list.push({ |
| | | type: 'text', |
| | | text: text.substring(this.cursor) |
| | | }) |
| | | } |
| | | childs.splice(i, 1, ...list) |
| | | } |
| | | } else { |
| | | childs.splice(i + 1, 0, node) |
| | | } |
| | | path = this.properties.opts[7] + path |
| | | if (path[path.length - 1] === '_') { |
| | | path = path.slice(0, -1) |
| | | } |
| | | this.root._editVal('nodes' + (path ? '[' + path.replace(/_/g, '].children[') + '].children' : ''), children, childs, true) |
| | | this.i = arr.join('_') + '_' + (i + 1) |
| | | }, 200) |
| | | }, |
| | | /** |
| | | * @description ç§»é¤ç¬¬ i 个æ ç¾ |
| | | * @param {Number} i |
| | | */ |
| | | remove (i) { |
| | | const arr = i.split('_') |
| | | const j = arr.pop() |
| | | let path = arr.join('_') |
| | | const children = path ? this.getNode(path).children : this.properties.childs |
| | | const childs = children.slice(0) |
| | | const delEle = childs.splice(j, 1)[0] |
| | | if (delEle.name === 'img' || delEle.name === 'video' || delEle.name === 'audio') { |
| | | let src = delEle.attrs.src |
| | | if (delEle.src) { |
| | | src = delEle.src.length === 1 ? delEle.src[0] : delEle.src |
| | | } |
| | | this.root.triggerEvent('remove', { |
| | | type: delEle.name, |
| | | src |
| | | }) |
| | | } |
| | | this.root._edit = undefined |
| | | this.root._maskTap() |
| | | path = this.properties.opts[7] + path |
| | | if (path[path.length - 1] === '_') { |
| | | path = path.slice(0, -1) |
| | | } |
| | | this.root._editVal('nodes' + (path ? '[' + path.replace(/_/g, '].children[') + '].children' : ''), children, childs, true) |
| | | }, |
| | | /** |
| | | * @description æ ç¾è¢«ç¹å» |
| | | * @param {Event} e |
| | | */ |
| | | nodeTap (e) { |
| | | if (this.properties.opts[5]) { |
| | | const i = e.currentTarget.dataset.i |
| | | if (this.root._table) { |
| | | const node = this.getNode(i) |
| | | if (node.name === 'table') { |
| | | this.root._table = undefined |
| | | this.root._remove_table = () => { |
| | | this.remove(i) |
| | | } |
| | | } |
| | | } |
| | | if (this.root._lock) return |
| | | // 黿¢ä¸å±åºç°ç¹å»æ |
| | | this.root._lock = true |
| | | setTimeout(() => { |
| | | this.root._lock = false |
| | | }, 50) |
| | | const node = this.getNode(i) |
| | | if (node.name === 'td' || node.name === 'th') { |
| | | this.root._table = true |
| | | } |
| | | if (this.data.ctrl['e' + this.i] === 3) return |
| | | this.root._maskTap() |
| | | this.root._edit = this |
| | | if (this.properties.opts[5] === 'simple') return |
| | | const arr = i.split('_') |
| | | const j = parseInt(arr.pop()) |
| | | let path = arr.join('_') |
| | | const siblings = path ? this.getNode(path).children : this.properties.childs |
| | | // æ¾ç¤ºå®çº¿æ¡ |
| | | this.setData({ |
| | | ['ctrl.e' + i]: 1 |
| | | }) |
| | | this.root._mask.push(() => { |
| | | this.setData({ |
| | | ['ctrl.e' + i]: 0 |
| | | }) |
| | | }) |
| | | if (node.children.length === 1 && node.children[0].type === 'text') { |
| | | const ii = i + '_0' |
| | | if (!this.data.ctrl['e' + ii]) { |
| | | this.setData({ |
| | | ['ctrl.e' + ii]: 1 |
| | | }) |
| | | this.root._mask.push(() => { |
| | | this.setData({ |
| | | ['ctrl.e' + ii]: 0 |
| | | }) |
| | | }) |
| | | this.cursor = node.children[0].text.length |
| | | } |
| | | this.i = ii |
| | | } else if (!(this.i || '').includes(i)) { |
| | | this.i = i + '_' |
| | | } |
| | | const items = this.root._getItem(node, j !== 0, j !== siblings.length - 1) |
| | | this.root._tooltip({ |
| | | top: getTop(e), |
| | | items, |
| | | success: tapIndex => { |
| | | if (items[tapIndex] === '大å°') { |
| | | // æ¹ååä½å¤§å° |
| | | const style = node.attrs.style || '' |
| | | let value = style.match(/;font-size:([0-9]+)px/) |
| | | if (value) { |
| | | value = parseInt(value[1]) |
| | | } else { |
| | | value = 16 |
| | | } |
| | | this.root._slider({ |
| | | min: 10, |
| | | max: 30, |
| | | value, |
| | | top: getTop(e), |
| | | changing: val => { |
| | | if (Math.abs(val - value) > 2) { |
| | | // åå·åæ¢è¶
è¿ 2 æ¶æ´æ°å°è§å¾ |
| | | this.changeStyle('font-size', i, val + 'px', value + 'px') |
| | | value = e.detail.value |
| | | } |
| | | }, |
| | | change: val => { |
| | | if (val !== value) { |
| | | this.changeStyle('font-size', i, val + 'px', value + 'px') |
| | | } |
| | | this.root._editVal('nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.style', style, this.getNode(i).attrs.style) |
| | | } |
| | | }) |
| | | } else if (items[tapIndex] === 'é¢è²') { |
| | | // æ¹åæåé¢è² |
| | | const items = this.root._getItem('color') |
| | | this.root._color({ |
| | | top: getTop(e), |
| | | items, |
| | | success: tapIndex => { |
| | | const style = node.attrs.style || '' |
| | | const value = style.match(/;color:([^;]+)/) |
| | | this.changeStyle('color', i, items[tapIndex], value ? value[1] : undefined) |
| | | this.root._editVal('nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.style', style, this.getNode(i).attrs.style) |
| | | } |
| | | }) |
| | | } else if (items[tapIndex] === 'ä¸ç§»' || items[tapIndex] === 'ä¸ç§»') { |
| | | const arr = siblings.slice(0) |
| | | const item = arr[j] |
| | | if (items[tapIndex] === 'ä¸ç§»') { |
| | | arr[j] = arr[j - 1] |
| | | arr[j - 1] = item |
| | | } else { |
| | | arr[j] = arr[j + 1] |
| | | arr[j + 1] = item |
| | | } |
| | | path = this.properties.opts[7] + path |
| | | if (path[path.length - 1] === '_') { |
| | | path = path.slice(0, -1) |
| | | } |
| | | this.root._editVal('nodes' + (path ? '[' + path.replace(/_/g, '].children[') + '].children' : ''), siblings, arr, true) |
| | | } else if (items[tapIndex] === 'å é¤') { |
| | | if ((node.name === 'td' || node.name === 'th') && this.root._remove_table) { |
| | | this.root._remove_table() |
| | | this.root._remove_table = undefined |
| | | } else { |
| | | this.remove(i) |
| | | } |
| | | } else { |
| | | const style = node.attrs.style || '' |
| | | let newStyle = '' |
| | | const item = items[tapIndex] |
| | | let name |
| | | let value |
| | | if (item === 'æä½') { |
| | | name = 'font-style' |
| | | value = 'italic' |
| | | } else if (item === 'ç²ä½') { |
| | | name = 'font-weight' |
| | | value = 'bold' |
| | | } else if (item === 'ä¸å线') { |
| | | name = 'text-decoration' |
| | | value = 'underline' |
| | | } else if (item === 'å±
ä¸') { |
| | | name = 'text-align' |
| | | value = 'center' |
| | | } else if (item === '缩è¿') { |
| | | name = 'text-indent' |
| | | value = '2em' |
| | | } |
| | | if (style.includes(name + ':')) { |
| | | // å·²æååæ¶ |
| | | newStyle = style.replace(new RegExp(name + ':[^;]+'), '') |
| | | } else { |
| | | // 没æåæ·»å |
| | | newStyle = style + ';' + name + ':' + value |
| | | } |
| | | this.root._editVal('nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.style', style, newStyle, true) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | /** |
| | | * @description é³è§é¢è¢«ç¹å» |
| | | * @param {Event} e |
| | | */ |
| | | mediaTap (e) { |
| | | if (this.properties.opts[5]) { |
| | | const i = e.target.dataset.i |
| | | const node = this.getNode(i) |
| | | const items = this.root._getItem(node) |
| | | this.root._maskTap() |
| | | this.root._edit = this |
| | | this.i = i |
| | | this.root._tooltip({ |
| | | top: e.target.offsetTop - 30, |
| | | items, |
| | | success: tapIndex => { |
| | | switch (items[tapIndex]) { |
| | | case 'å°é¢': |
| | | // 设置å°é¢ |
| | | this.root.getSrc('img', node.attrs.poster || '').then(url => { |
| | | this.root._editVal('nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.poster', node.attrs.poster, url instanceof Array ? url[0] : url, true) |
| | | }).catch(() => { }) |
| | | break |
| | | case 'å é¤': |
| | | this.remove(i) |
| | | break |
| | | case '循ç¯': |
| | | case 'ä¸å¾ªç¯': |
| | | // åæ¢å¾ªç¯ææ¾ |
| | | this.root.setData({ |
| | | ['nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.loop']: !node.attrs.loop |
| | | }) |
| | | wx.showToast({ |
| | | title: 'æå' |
| | | }) |
| | | break |
| | | case 'èªå¨ææ¾': |
| | | case 'ä¸èªå¨ææ¾': |
| | | // 忢èªå¨ææ¾ææ¾ |
| | | this.root.setData({ |
| | | ['nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.autoplay']: !node.attrs.autoplay |
| | | }) |
| | | wx.showToast({ |
| | | title: 'æå' |
| | | }) |
| | | break |
| | | } |
| | | } |
| | | }) |
| | | // é¿å
ä¸å±åºç°ç¹å»æ |
| | | this.root._lock = true |
| | | setTimeout(() => { |
| | | this.root._lock = false |
| | | }, 50) |
| | | } |
| | | }, |
| | | /** |
| | | * æ¹åæ ·å¼ |
| | | * @param {String} name 屿§å |
| | | * @param {Number} i 第å 个æ ç¾ |
| | | * @param {String} value æ°å¼ |
| | | * @param {String} oldVal æ§å¼ |
| | | */ |
| | | changeStyle (name, i, value, oldVal) { |
| | | let style = this.getNode(i).attrs.style || '' |
| | | if (style.includes(';' + name + ':' + oldVal)) { |
| | | // style ä¸å·²ç»æ |
| | | style = style.replace(';' + name + ':' + oldVal, ';' + name + ':' + value) |
| | | } else { |
| | | // 没æåæ°å¢ |
| | | style += ';' + name + ':' + value |
| | | } |
| | | this.root.setData({ |
| | | ['nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.style']: style |
| | | }) |
| | | } |
| | | }, |
| | | handler (file) { |
| | | if (file.isBuffer()) { |
| | | let content = file.contents.toString() |
| | | if (file.path.includes('miniprogram' + path.sep + 'index.wxml')) { |
| | | // ä¼ é editable 屿§åè·¯å¾ |
| | | content = content.replace(/opts\s*=\s*"{{\[([^\]]+)\]}}"/, 'opts="{{[$1,editable,placeholder,\'\']}}"') |
| | | .replace(/<view(.*?)style\s*=\s*"{{containerStyle}}"/, '<view$1style="{{editable?\'min-height:200px;\':\'\'}}{{containerStyle}}" bindtap="_containTap"') |
| | | // å·¥å
·å¼¹çª |
| | | .replace('</view>', ` <view wx:if="{{tooltip}}" class="_tooltip_contain" style="top:{{tooltip.top}}px"> |
| | | <view class="_tooltip"> |
| | | <view wx:for="{{tooltip.items}}" wx:key="index" class="_tooltip_item" data-i="{{index}}" bindtap="_tooltipTap">{{item}}</view> |
| | | </view> |
| | | </view> |
| | | <view wx:if="{{slider}}" class="_slider" style="top:{{slider.top}}px"> |
| | | <slider value="{{slider.value}}" min="{{slider.min}}" max="{{slider.max}}" block-size="14" show-value activeColor="white" mp-alipay:style="padding:10px" bindchanging="_sliderChanging" bindchange="_sliderChange" /> |
| | | </view> |
| | | <view wx:if="{{color}}" class="_tooltip_contain" style="top:{{color.top}}px"> |
| | | <view class="_tooltip" style="overflow-y: hidden;"> |
| | | <view wx:for="{{color.items}}" wx:key="index" class="_color_item" style="background-color:{{item}}" data-i="{{index}}" bindtap="_colorTap"></view> |
| | | </view> |
| | | </view> |
| | | </view>`) |
| | | } else if (file.path.includes('miniprogram' + path.sep + 'index.js')) { |
| | | // æ·»å editable 屿§ï¼åçååæ¶éæ°è§£æ |
| | | content = content.replace(/properties\s*:\s*{/, `properties: { |
| | | editable: { |
| | | type: null, |
| | | observer (val) { |
| | | if (this.properties.content) { |
| | | this.setContent(val ? this.properties.content : this.getContent()) |
| | | } else if (val) { |
| | | this.setData({ |
| | | nodes: [{ |
| | | name: 'p', |
| | | attrs: {}, |
| | | children: [{ |
| | | type: 'text', |
| | | text: '' |
| | | }] |
| | | }] |
| | | }) |
| | | // #ifdef MP-TOUTIAO |
| | | this.selectComponent('#_root', child => { |
| | | child.root = this |
| | | }) |
| | | // #endif |
| | | } |
| | | if (!val) { |
| | | this._maskTap() |
| | | } |
| | | } |
| | | }, |
| | | placeholder: String,`) |
| | | .replace(/didUpdate\s*\(e\)\s*{/, `didUpdate (e) { |
| | | if (e.editable !== this.properties.editable) { |
| | | const val = this.properties.editable |
| | | if (this.properties.content) { |
| | | this.setContent(val ? this.properties.content : this.getContent()) |
| | | } else if (val) { |
| | | this.setData({ |
| | | nodes: [{ |
| | | name: 'p', |
| | | attrs: {}, |
| | | children: [{ |
| | | type: 'text', |
| | | text: '' |
| | | }] |
| | | }] |
| | | }) |
| | | } |
| | | if (!val) { |
| | | this._maskTap() |
| | | } |
| | | }`) |
| | | // å¤çå类弹çªçäºä»¶ |
| | | .replace(/methods\s*:\s*{/, `methods: { |
| | | _containTap() { |
| | | if (!this._lock && !this.data.slider && !this.data.color) { |
| | | this._edit = undefined |
| | | this._maskTap() |
| | | } |
| | | }, |
| | | _tooltipTap(e) { |
| | | this._tooltipcb(e.currentTarget.dataset.i) |
| | | this.setData({ |
| | | tooltip: null |
| | | }) |
| | | }, |
| | | _sliderChanging(e) { |
| | | this._slideringcb(e.detail.value) |
| | | }, |
| | | _sliderChange(e) { |
| | | this._slidercb(e.detail.value) |
| | | }, |
| | | _colorTap(e) { |
| | | this._colorcb(e.currentTarget.dataset.i) |
| | | this.setData({ |
| | | color: null |
| | | }) |
| | | },`) |
| | | } else if (file.path.includes('miniprogram' + path.sep + 'index.wxss')) { |
| | | // å·¥å
·å¼¹çªçæ ·å¼ |
| | | content += `/* æç¤ºæ¡ */ |
| | | ._tooltip_contain { |
| | | position: absolute; |
| | | right: 20px; |
| | | left: 20px; |
| | | text-align: center; |
| | | } |
| | | |
| | | ._tooltip { |
| | | box-sizing: border-box; |
| | | display: inline-block; |
| | | width: auto; |
| | | max-width: 100%; |
| | | height: 30px; |
| | | padding: 0 3px; |
| | | overflow: scroll; |
| | | font-size: 14px; |
| | | line-height: 30px; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | ._tooltip_item { |
| | | display: inline-block; |
| | | width: auto; |
| | | padding: 0 2vw; |
| | | line-height: 30px; |
| | | background-color: black; |
| | | color: white; |
| | | } |
| | | |
| | | ._color_item { |
| | | display: inline-block; |
| | | width: 18px; |
| | | height: 18px; |
| | | margin: 5px 2vw; |
| | | border:1px solid #dfe2e5; |
| | | border-radius: 50%; |
| | | } |
| | | |
| | | /* å¾ç宽度æ»å¨æ¡ */ |
| | | ._slider { |
| | | position: absolute; |
| | | left: 20px; |
| | | width: 220px; |
| | | } |
| | | |
| | | ._tooltip, |
| | | ._slider { |
| | | background-color: black; |
| | | border-radius: 3px; |
| | | opacity: 0.75; |
| | | }` |
| | | } else if (file.path.includes('parser.js')) { |
| | | content = content.replace(/popNode\s*=\s*function\s*\(\)\s*{/, 'popNode = function () {\n const editable = this.options.editable') |
| | | // ä¸è½¬æ¢æ ç¾å |
| | | .replace(/if\s*\(config.blockTags\[node.name\]\)\s*{[\s\S]+?}/, `if (config.blockTags[node.name]) { |
| | | if (!editable) { |
| | | node.name = 'div' |
| | | } |
| | | }`) |
| | | // 转æ¢è¡¨æ ¼åå表 |
| | | .replace(/node.c(\)|\s*&&|\s*\n)/g, '(node.c || editable)$1') |
| | | .replace(/while\s*\(map\[row\s*\+\s*'.'\s*\+\s*col\]\)\s*{[\s\S]+?}/, `while (map[row + '.' + col]) { |
| | | col++ |
| | | } |
| | | if (editable) { |
| | | td.r = row |
| | | }`) |
| | | // ä¸å expose å¤ç |
| | | .replace(/parser.prototype.expose\s*=\s*function\s*\(\)\s*{/, `parser.prototype.expose = function () { |
| | | if (this.options.editable) return`) |
| | | } else if (file.path.includes('node.wxml')) { |
| | | content = content.replace(/opts\s*=\s*"{{opts}}"/, 'opts="{{[opts[0],opts[1],opts[2],opts[3],opts[4],opts[5],opts[6],opts[7]+i+\'_\']}}"') |
| | | .replace(/opts\s*=\s*"{{opts}}"/, 'opts="{{[opts[0],opts[1],opts[2],opts[3],opts[4],opts[5],opts[6],opts[7]+i1+\'_\'+i2+\'_\'+i3+\'_\'+i4+\'_\'+i5+\'_\']}}"') |
| | | .replace('!n.c', "opts[5]?(!n.children||n.name=='a'):!n.c") |
| | | .replace(/!(n.?)\.c(?![a-z])/g, '(opts[5]?true:!$1.c)') |
| | | .replace(/isInline\((.*?)\)/g, '(opts[5]?true:isInline($1))') |
| | | // ä¿®æ¹æ®éæ ç¾ |
| | | .replace(/<view\s*wx:else\s*id(.+?)style="/, '<view wx:else data-i="{{path+i}}" bindtap="nodeTap" id$1style="{{ctrl[\'e\'+path+i]&&opts[5]!==\'simple\'?\'border:1px solid black;padding:5px;display:block;\':\'\'}}') |
| | | .replace(/<view\s*wx:else\s*id(.+?)style="/, '<view wx:else data-i="{{\'\'+i1}}" bindtap="nodeTap" id$1style="{{ctrl[\'e\'+i1]&&opts[5]!==\'simple\'?\'border:1px solid black;padding:5px;display:block;\':\'\'}}') |
| | | .replace(/<view\s*wx:else\s*id(.+?)style="/, '<view wx:else data-i="{{i1+\'_\'+i2}}" bindtap="nodeTap" id$1style="{{ctrl[\'e\'+i1+\'_\'+i2]&&opts[5]!==\'simple\'?\'border:1px solid black;padding:5px;display:block;\':\'\'}}') |
| | | .replace(/<view\s*wx:else\s*id(.+?)style="/, '<view wx:else data-i="{{i1+\'_\'+i2+\'_\'+i3}}" bindtap="nodeTap" id$1style="{{ctrl[\'e\'+i1+\'_\'+i2+\'_\'+i3]&&opts[5]!==\'simple\'?\'border:1px solid black;padding:5px;display:block;\':\'\'}}') |
| | | .replace(/<view\s*wx:else\s*id(.+?)style="/, '<view wx:else data-i="{{i1+\'_\'+i2+\'_\'+i3+\'_\'+i4}}" bindtap="nodeTap" id$1style="{{ctrl[\'e\'+i1+\'_\'+i2+\'_\'+i3+\'_\'+i4]&&opts[5]!==\'simple\'?\'border:1px solid black;padding:5px;display:block;\':\'\'}}') |
| | | // ä¿®æ¹ææ¬å |
| | | .replace(/<!--\s*ææ¬\s*-->[\s\S]+?<!--\s*龿¥\s*-->/, |
| | | `<block wx:elif="{{n.type==='text'}}"> |
| | | <text wx:if="{{!ctrl['e'+i]}}" data-i="{{i}}" mp-weixin:user-select="{{opts[4]}}" decode="{{!opts[5]}}" bindtap="editStart">{{n.text}} |
| | | <text wx:if="{{!n.text}}" style="color:gray">{{opts[6]||'请è¾å
¥'}}</text> |
| | | </text> |
| | | <text wx:elif="{{ctrl['e'+i]===1}}" data-i="{{i}}" style="border:1px dashed black;min-width:50px;width:auto;padding:5px;display:block" catchtap="editStart">{{n.text}} |
| | | <text wx:if="{{!n.text}}" style="color:gray">{{opts[6]||'请è¾å
¥'}}</text> |
| | | </text> |
| | | <textarea wx:else style="{{opts[5]==='simple'?'':'border:1px dashed black;'}}min-width:50px;width:auto;padding:5px" auto-height maxlength="-1" focus="{{ctrl['e'+i]===3}}" value="{{n.text}}" data-i="{{i}}" bindinput="editInput" bindblur="editEnd" /> |
| | | </block> |
| | | <text wx:elif="{{n.name==='br'}}">\\n</text>`) |
| | | // ä¿®æ¹å¾ç |
| | | .replace(/<image(.+?)id="\{\{n.attrs.id/, '<image$1id="{{n.attrs.id||(\'n\'+i)') |
| | | .replace('height:1px', "height:{{ctrl['h'+i]||1}}px") |
| | | .replace('style="{{ctrl[i]', 'style="{{ctrl[\'e\'+i]&&opts[5]!==\'simple\'?\'border:1px dashed black;padding:3px;\':\'\'}}{{ctrl[i]') |
| | | .replace(/weixin:show-menu-by-longpress\s*=\s*"{{(\S+?)}}"\s*baidu:image-menu-prevent\s*=\s*"{{(\S+?)}}"/, 'weixin:show-menu-by-longpress="{{!opts[5]&&$1}}" baidu:image-menu-prevent="{{opts[5]||$2}}"') |
| | | // ä¿®æ¹é³è§é¢ |
| | | .replace('<video', '<video bindtap="mediaTap"') |
| | | .replace('audio ', 'audio bindtap="mediaTap" ') |
| | | .replace('card', 'card bindtap="mediaTap"') |
| | | } else if (file.path.includes('node.js') && file.extname === '.js') { |
| | | content = ` |
| | | const Parser = require('../parser') |
| | | function getTop(e) { |
| | | let top |
| | | // #ifndef MP-ALIPAY |
| | | top = e.detail.y |
| | | // #endif |
| | | // #ifdef MP-ALIPAY |
| | | top = top = e.detail.pageY |
| | | // #endif |
| | | if (top - e.currentTarget.offsetTop < 150 || top < 600) { |
| | | top = e.currentTarget.offsetTop |
| | | } |
| | | if (top < 30) { |
| | | top += 70 |
| | | } |
| | | return top - 30 |
| | | }` + content.replace('methods:', `detached () { |
| | | if (this.root && this.root._edit === this) { |
| | | this.root._edit = undefined |
| | | } |
| | | }, |
| | | methods:`) |
| | | // è®°å½å¾ç宽度 |
| | | .replace(/imgLoad\s*\(e\)\s*{/, `imgLoad (e) { |
| | | // #ifdef MP-WEIXIN || MP-QQ |
| | | if (this.properties.opts[5]) { |
| | | setTimeout(() => { |
| | | const id = this.getNode(i).attrs.id || ('n' + i) |
| | | wx.createSelectorQuery().in(this).select('#' + id).boundingClientRect().exec(res => { |
| | | this.setData({ |
| | | ['ctrl.h'+i]: res[0].height |
| | | }) |
| | | }) |
| | | }, 50) |
| | | } |
| | | // #endif`) |
| | | .replace(/if\s*\(!node.w\)\s*{[\s\S]+?}/, |
| | | `if (!node.w) { |
| | | val = e.detail.width |
| | | if (this.properties.opts[5]) { |
| | | const data = {} |
| | | const path = 'nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.' |
| | | if (val < 150) { |
| | | data[path + 'ignore'] = 'T' |
| | | } |
| | | data[path + 'width'] = val.toString() |
| | | this.root.setData(data) |
| | | } |
| | | }`) |
| | | // å¤çå¾çç¹å» |
| | | .replace(/imgTap\s*\(e\)\s*{([\s\S]+?)},\s*\/\*/, |
| | | `imgTap (e) { |
| | | if (!this.properties.opts[5]) {$1} else { |
| | | const i = e.target.dataset.i |
| | | const node = this.getNode(i) |
| | | const items = this.root._getItem(node) |
| | | this.root._edit = this |
| | | const parser = new Parser(this.root) |
| | | this.i = i |
| | | this.root._maskTap() |
| | | this.setData({ |
| | | ['ctrl.e' + i]: 1 |
| | | }) |
| | | this.root._mask.push(() => { |
| | | this.setData({ |
| | | ['ctrl.e' + i]: 0 |
| | | }) |
| | | }) |
| | | this.root._tooltip({ |
| | | top: getTop(e), |
| | | items, |
| | | success: tapIndex => { |
| | | if (items[tapIndex] === 'æ¢å¾') { |
| | | // æ¢å¾ |
| | | this.root.getSrc('img', node.attrs.src || '').then(url => { |
| | | this.root._editVal('nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.src', node.attrs.src, parser.getUrl(url instanceof Array ? url[0] : url), true) |
| | | }).catch(() => { }) |
| | | } else if (items[tapIndex] === '宽度') { |
| | | // æ´æ¹å®½åº¦ |
| | | const style = node.attrs.style || '' |
| | | let value = style.match(/max-width:([0-9]+)%/) |
| | | if (value) { |
| | | value = parseInt(value[1]) |
| | | } else { |
| | | value = 100 |
| | | } |
| | | this.root._slider({ |
| | | min: 0, |
| | | max: 100, |
| | | value, |
| | | top: getTop(e), |
| | | changing: val => { |
| | | // ååè¶
è¿ 5% æ´æ°æ¶è§å¾ |
| | | if (Math.abs(val - value) > 5) { |
| | | this.changeStyle('max-width', i, val + '%', value + '%') |
| | | value = val |
| | | } |
| | | }, |
| | | change: val => { |
| | | if (val !== value) { |
| | | this.changeStyle('max-width', i, val + '%', value + '%') |
| | | value = val |
| | | } |
| | | this.root._editVal('nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.style', style, this.getNode(i).attrs.style) |
| | | } |
| | | }) |
| | | } else if (items[tapIndex] === 'è¶
龿¥') { |
| | | // å°å¾çè®¾ç½®ä¸ºé¾æ¥ |
| | | this.root.getSrc('link', node.a ? node.a.href : '').then(url => { |
| | | // 妿æ a æ ç¾åæ¿æ¢ href |
| | | if (node.a) { |
| | | this.root._editVal('nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].a.href', node.a.href, parser.getUrl(url), true) |
| | | } else { |
| | | const link = { |
| | | name: 'a', |
| | | attrs: { |
| | | href: parser.getUrl(url) |
| | | }, |
| | | children: [node] |
| | | } |
| | | node.a = link.attrs |
| | | this.root._editVal('nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + ']', node, link, true) |
| | | } |
| | | wx.showToast({ |
| | | title: 'æå' |
| | | }) |
| | | }).catch(() => { }) |
| | | } else if (items[tapIndex] === 'é¢è§å¾') { |
| | | // 设置é¢è§å¾é¾æ¥ |
| | | this.root.getSrc('img', node.attrs['original-src'] || '').then(url => { |
| | | this.root._editVal('nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.original-src', node.attrs['original-src'], parser.getUrl(url instanceof Array ? url[0] : url), true) |
| | | wx.showToast({ |
| | | title: 'æå' |
| | | }) |
| | | }).catch(() => { }) |
| | | } else if (items[tapIndex] === 'å é¤') { |
| | | this.remove(i) |
| | | } else { |
| | | // ç¦ç¨ / å¯ç¨é¢è§ |
| | | this.root.setData({ |
| | | ['nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.ignore']: !node.attrs.ignore |
| | | }) |
| | | wx.showToast({ |
| | | title: 'æå' |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | this.root._lock = true |
| | | setTimeout(() => { |
| | | this.root._lock = false |
| | | }, 50) |
| | | } |
| | | }, |
| | | /*`) |
| | | // å¤ç龿¥ç¹å» |
| | | .replace(/linkTap\s*\(e\)\s*{([\s\S]+?)},\s*\/\*/, |
| | | `linkTap (e) { |
| | | if (!this.properties.opts[5]) {$1} else { |
| | | const i = e.currentTarget.dataset.i |
| | | const node = this.getNode(i) |
| | | const items = this.root._getItem(node) |
| | | this.root._tooltip({ |
| | | top: getTop(e), |
| | | items, |
| | | success: tapIndex => { |
| | | if (items[tapIndex] === 'æ´æ¢é¾æ¥') { |
| | | this.root.getSrc('link', node.attrs.href).then(url => { |
| | | this.root._editVal('nodes[' + (this.properties.opts[7] + i).replace(/_/g, '].children[') + '].attrs.href', node.attrs.href, url, true) |
| | | wx.showToast({ |
| | | title: 'æå' |
| | | }) |
| | | }).catch(() => { }) |
| | | } else { |
| | | this.remove(i) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | /*`) |
| | | } |
| | | file.contents = Buffer.from(content) |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * @fileoverview editable æä»¶ |
| | | */ |
| | | const config = require('./config') |
| | | const Parser = require('../parser') |
| | | |
| | | function Editable (vm) { |
| | | this.vm = vm |
| | | this.editHistory = [] // åå²è®°å½ |
| | | this.editI = -1 // åå²è®°å½æé |
| | | vm._mask = [] // èç被ç¹å»æ¶è¿è¡çæä½ |
| | | |
| | | /** |
| | | * @description ç§»å¨åå²è®°å½æé |
| | | * @param {Number} num ç§»å¨è·ç¦» |
| | | */ |
| | | const move = num => { |
| | | const item = this.editHistory[this.editI + num] |
| | | if (item) { |
| | | this.editI += num |
| | | vm.setData({ |
| | | [item.key]: item.value |
| | | }) |
| | | } |
| | | } |
| | | vm.undo = () => move(-1) // æ¤é |
| | | vm.redo = () => move(1) // éå |
| | | |
| | | /** |
| | | * @description æ´æ°è®°å½ |
| | | * @param {String} path è·¯å¾ |
| | | * @param {*} oldVal æ§å¼ |
| | | * @param {*} newVal æ°å¼ |
| | | * @param {Boolean} set æ¯å¦æ´æ°å°è§å¾ |
| | | * @private |
| | | */ |
| | | vm._editVal = (path, oldVal, newVal, set) => { |
| | | // å½åæéåçå
容å»é¤ |
| | | while (this.editI < this.editHistory.length - 1) { |
| | | this.editHistory.pop() |
| | | } |
| | | |
| | | // æå¤åå¨ 30 æ¡æä½è®°å½ |
| | | while (this.editHistory.length > 30) { |
| | | this.editHistory.pop() |
| | | this.editI-- |
| | | } |
| | | |
| | | const last = this.editHistory[this.editHistory.length - 1] |
| | | if (!last || last.key !== path) { |
| | | if (last) { |
| | | // 廿ä¸ä¸æ¬¡çæ°å¼ |
| | | this.editHistory.pop() |
| | | this.editI-- |
| | | } |
| | | // åå
¥è¿ä¸æ¬¡çæ§å¼ |
| | | this.editHistory.push({ |
| | | key: path, |
| | | value: oldVal |
| | | }) |
| | | this.editI++ |
| | | } |
| | | |
| | | // åå
¥æ¬æ¬¡çæ°å¼ |
| | | this.editHistory.push({ |
| | | key: path, |
| | | value: newVal |
| | | }) |
| | | this.editI++ |
| | | |
| | | // æ´æ°å°è§å¾ |
| | | if (set) { |
| | | vm.setData({ |
| | | [path]: newVal |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description è·åèå项 |
| | | * @private |
| | | */ |
| | | vm._getItem = function (node, up, down) { |
| | | let items |
| | | let i |
| | | if (node === 'color') { |
| | | return config.color |
| | | } |
| | | if (node.name === 'img') { |
| | | items = config.img.slice(0) |
| | | if (!vm.getSrc) { |
| | | i = items.indexOf('æ¢å¾') |
| | | if (i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | i = items.indexOf('è¶
龿¥') |
| | | if (i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | i = items.indexOf('é¢è§å¾') |
| | | if (i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | } |
| | | i = items.indexOf('ç¦ç¨é¢è§') |
| | | if (i !== -1 && node.attrs.ignore) { |
| | | items[i] = 'å¯ç¨é¢è§' |
| | | } |
| | | } else if (node.name === 'a') { |
| | | items = config.link.slice(0) |
| | | if (!vm.getSrc) { |
| | | i = items.indexOf('æ´æ¢é¾æ¥') |
| | | if (i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | } |
| | | } else if (node.name === 'video' || node.name === 'audio') { |
| | | items = config.media.slice(0) |
| | | i = items.indexOf('å°é¢') |
| | | if (!vm.getSrc && i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | i = items.indexOf('循ç¯') |
| | | if (node.attrs.loop && i !== -1) { |
| | | items[i] = 'ä¸å¾ªç¯' |
| | | } |
| | | i = items.indexOf('èªå¨ææ¾') |
| | | if (node.attrs.autoplay && i !== -1) { |
| | | items[i] = 'ä¸èªå¨ææ¾' |
| | | } |
| | | } else if (node.name === 'card') { |
| | | items = config.card.slice(0) |
| | | } else { |
| | | items = config.node.slice(0) |
| | | } |
| | | if (!up) { |
| | | i = items.indexOf('ä¸ç§»') |
| | | if (i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | } |
| | | if (!down) { |
| | | i = items.indexOf('ä¸ç§»') |
| | | if (i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | } |
| | | return items |
| | | } |
| | | |
| | | /** |
| | | * @description æ¾ç¤º tooltip |
| | | * @param {object} obj |
| | | * @private |
| | | */ |
| | | vm._tooltip = function (obj) { |
| | | vm.setData({ |
| | | tooltip: { |
| | | top: obj.top, |
| | | items: obj.items |
| | | } |
| | | }) |
| | | vm._tooltipcb = obj.success |
| | | } |
| | | |
| | | /** |
| | | * @description æ¾ç¤ºæ»å¨æ¡ |
| | | * @param {object} obj |
| | | * @private |
| | | */ |
| | | vm._slider = function (obj) { |
| | | vm.setData({ |
| | | slider: { |
| | | min: obj.min, |
| | | max: obj.max, |
| | | value: obj.value, |
| | | top: obj.top |
| | | } |
| | | }) |
| | | vm._slideringcb = obj.changing |
| | | vm._slidercb = obj.change |
| | | } |
| | | |
| | | /** |
| | | * @description æ¾ç¤ºé¢è²éæ© |
| | | * @param {object} obj |
| | | * @private |
| | | */ |
| | | vm._color = function (obj) { |
| | | vm.setData({ |
| | | color: { |
| | | items: obj.items, |
| | | top: obj.top |
| | | } |
| | | }) |
| | | vm._colorcb = obj.success |
| | | } |
| | | |
| | | /** |
| | | * @description ç¹å»èç |
| | | * @private |
| | | */ |
| | | vm._maskTap = function () { |
| | | // éèæææ¬æµ®çª |
| | | while (this._mask.length) { |
| | | (this._mask.pop())() |
| | | } |
| | | const data = {} |
| | | if (this.data.tooltip) { |
| | | data.tooltip = null |
| | | } |
| | | if (this.data.slider) { |
| | | data.slider = null |
| | | } |
| | | if (this.data.color) { |
| | | data.color = null |
| | | } |
| | | if (this.data.tooltip || this.data.slider || this.data.color) { |
| | | this.setData(data) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description æå
¥èç¹ |
| | | * @param {Object} node |
| | | */ |
| | | function insert (node) { |
| | | if (vm._edit) { |
| | | vm._edit.insert(node) |
| | | } else { |
| | | const nodes = vm.data.nodes.slice(0) |
| | | nodes.push(node) |
| | | vm._editVal('nodes', vm.data.nodes, nodes, true) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥æå® html å
容 |
| | | * @param {String} html å
容 |
| | | */ |
| | | vm.insertHtml = html => { |
| | | this.inserting = true |
| | | const arr = new Parser(vm).parse(html) |
| | | this.inserting = undefined |
| | | for (let i = 0; i < arr.length; i++) { |
| | | insert(arr[i]) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥å¾ç |
| | | */ |
| | | vm.insertImg = function () { |
| | | vm.getSrc && vm.getSrc('img').then(src => { |
| | | if (typeof src === 'string') { |
| | | src = [src] |
| | | } |
| | | const parser = new Parser(vm) |
| | | for (let i = 0; i < src.length; i++) { |
| | | insert({ |
| | | name: 'img', |
| | | attrs: { |
| | | src: parser.getUrl(src[i]) |
| | | } |
| | | }) |
| | | } |
| | | }).catch(() => { }) |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥ä¸ä¸ªé¾æ¥ |
| | | */ |
| | | vm.insertLink = function () { |
| | | vm.getSrc && vm.getSrc('link').then(url => { |
| | | insert({ |
| | | name: 'a', |
| | | attrs: { |
| | | href: url |
| | | }, |
| | | children: [{ |
| | | type: 'text', |
| | | text: url |
| | | }] |
| | | }) |
| | | }).catch(() => { }) |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥ä¸ä¸ªè¡¨æ ¼ |
| | | * @param {Number} rows è¡æ° |
| | | * @param {Number} cols åæ° |
| | | */ |
| | | vm.insertTable = function (rows, cols) { |
| | | const table = { |
| | | name: 'table', |
| | | attrs: { |
| | | style: 'display:table;width:100%;margin:10px 0;text-align:center;border-spacing:0;border-collapse:collapse;border:1px solid gray' |
| | | }, |
| | | children: [] |
| | | } |
| | | for (let i = 0; i < rows; i++) { |
| | | const tr = { |
| | | name: 'tr', |
| | | attrs: {}, |
| | | children: [] |
| | | } |
| | | for (let j = 0; j < cols; j++) { |
| | | tr.children.push({ |
| | | name: 'td', |
| | | attrs: { |
| | | style: 'padding:2px;border:1px solid gray' |
| | | }, |
| | | children: [{ |
| | | type: 'text', |
| | | text: '' |
| | | }] |
| | | }) |
| | | } |
| | | table.children.push(tr) |
| | | } |
| | | insert(table) |
| | | } |
| | | |
| | | /** |
| | | * @description æå
¥è§é¢/é³é¢ |
| | | * @param {Object} node |
| | | */ |
| | | function insertMedia (node) { |
| | | if (typeof node.src === 'string') { |
| | | node.src = [node.src] |
| | | } |
| | | const parser = new Parser(vm) |
| | | // æ¼æ¥ä¸»åå |
| | | for (let i = 0; i < node.src.length; i++) { |
| | | node.src[i] = parser.getUrl(node.src[i]) |
| | | } |
| | | insert({ |
| | | name: 'div', |
| | | attrs: { |
| | | style: 'text-align:center' |
| | | }, |
| | | children: [node] |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥ä¸ä¸ªè§é¢ |
| | | */ |
| | | vm.insertVideo = function () { |
| | | vm.getSrc && vm.getSrc('video').then(src => { |
| | | insertMedia({ |
| | | name: 'video', |
| | | attrs: { |
| | | controls: 'T' |
| | | }, |
| | | src |
| | | }) |
| | | }).catch(() => { }) |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥ä¸ä¸ªé³é¢ |
| | | */ |
| | | vm.insertAudio = function () { |
| | | vm.getSrc && vm.getSrc('audio').then(attrs => { |
| | | let src |
| | | if (attrs.src) { |
| | | src = attrs.src |
| | | attrs.src = undefined |
| | | } else { |
| | | src = attrs |
| | | attrs = {} |
| | | } |
| | | attrs.controls = 'T' |
| | | insertMedia({ |
| | | name: 'audio', |
| | | attrs, |
| | | src |
| | | }) |
| | | }).catch(() => { }) |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥ä¸æ®µææ¬ |
| | | */ |
| | | vm.insertText = function () { |
| | | insert({ |
| | | name: 'p', |
| | | attrs: {}, |
| | | children: [{ |
| | | type: 'text', |
| | | text: '' |
| | | }] |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description æ¸
空å
容 |
| | | */ |
| | | vm.clear = function () { |
| | | vm._maskTap() |
| | | vm._edit = undefined |
| | | vm.setData({ |
| | | nodes: [{ |
| | | name: 'p', |
| | | attrs: {}, |
| | | children: [{ |
| | | type: 'text', |
| | | text: '' |
| | | }] |
| | | }] |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description è·åç¼è¾åç html |
| | | */ |
| | | vm.getContent = function () { |
| | | let html = ''; |
| | | // éå½éåè·å |
| | | (function traversal (nodes, table) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | let item = nodes[i] |
| | | if (item.type === 'text') { |
| | | // ç¼ç å®ä½ |
| | | html += item.text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\n/g, '<br>').replace(/\xa0/g, ' ') |
| | | } else { |
| | | // è¿å被转æ¢ç svg |
| | | if (item.name === 'img' && (item.attrs.src || '').includes('data:image/svg+xml;utf8,')) { |
| | | html += item.attrs.src.substr(24).replace(/%23/g, '#').replace('<svg', '<svg style="' + (item.attrs.style || '') + '"') |
| | | continue |
| | | } else if (item.name === 'video' || item.name === 'audio') { |
| | | // è¿å video å audio ç source |
| | | if (item.src.length > 1) { |
| | | item.children = [] |
| | | for (let j = 0; j < item.src.length; j++) { |
| | | item.children.push({ |
| | | name: 'source', |
| | | attrs: { |
| | | src: item.src[j] |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | item.attrs.src = item.src[0] |
| | | } |
| | | } else if (item.name === 'div' && (item.attrs.style || '').includes('overflow:auto') && (item.children[0] || {}).name === 'table') { |
| | | // è¿åæ»å¨å± |
| | | item = item.children[0] |
| | | } |
| | | // è¿å table |
| | | if (item.name === 'table') { |
| | | table = item.attrs |
| | | if ((item.attrs.style || '').includes('display:grid')) { |
| | | item.attrs.style = item.attrs.style.split('display:grid')[0] |
| | | const children = [{ |
| | | name: 'tr', |
| | | attrs: {}, |
| | | children: [] |
| | | }] |
| | | for (let j = 0; j < item.children.length; j++) { |
| | | item.children[j].attrs.style = item.children[j].attrs.style.replace(/grid-[^;]+;*/g, '') |
| | | if (item.children[j].r !== children.length) { |
| | | children.push({ |
| | | name: 'tr', |
| | | attrs: {}, |
| | | children: [item.children[j]] |
| | | }) |
| | | } else { |
| | | children[children.length - 1].children.push(item.children[j]) |
| | | } |
| | | } |
| | | item.children = children |
| | | } |
| | | } |
| | | html += '<' + item.name |
| | | for (const attr in item.attrs) { |
| | | let val = item.attrs[attr] |
| | | if (!val) continue |
| | | // bool åçç¥å¼ |
| | | if (val === 'T' || val === true) { |
| | | html += ' ' + attr |
| | | continue |
| | | } else if (item.name[0] === 't' && attr === 'style' && table) { |
| | | // åæ¶ä¸ºäºæ¾ç¤º table æ·»å ç style |
| | | val = val.replace(/;*display:table[^;]*/, '') |
| | | if (table.border) { |
| | | val = val.replace(/border[^;]+;*/g, $ => $.includes('collapse') ? $ : '') |
| | | } |
| | | if (table.cellpadding) { |
| | | val = val.replace(/padding[^;]+;*/g, '') |
| | | } |
| | | if (!val) continue |
| | | } |
| | | html += ' ' + attr + '="' + val.replace(/"/g, '"') + '"' |
| | | } |
| | | html += '>' |
| | | if (item.children) { |
| | | traversal(item.children, table) |
| | | html += '</' + item.name + '>' |
| | | } |
| | | } |
| | | } |
| | | })(vm.data.nodes) |
| | | |
| | | // å
¶ä»æä»¶å¤ç |
| | | for (let i = vm.plugins.length; i--;) { |
| | | if (vm.plugins[i].onGetContent) { |
| | | html = vm.plugins[i].onGetContent(html) || html |
| | | } |
| | | } |
| | | |
| | | return html |
| | | } |
| | | } |
| | | |
| | | Editable.prototype.onUpdate = function (content, config) { |
| | | if (this.vm.properties.editable) { |
| | | this.vm._maskTap() |
| | | config.entities.amp = '&' |
| | | if (!this.inserting) { |
| | | this.vm._edit = undefined |
| | | if (!content) { |
| | | setTimeout(() => { |
| | | this.vm.setData({ |
| | | nodes: [{ |
| | | name: 'p', |
| | | attrs: {}, |
| | | children: [{ |
| | | type: 'text', |
| | | text: '' |
| | | }] |
| | | }] |
| | | }) |
| | | }, 0) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | Editable.prototype.onParse = function (node) { |
| | | // 空ç½åå
æ ¼å¯ç¼è¾ |
| | | if (this.vm.properties.editable && (node.name === 'td' || node.name === 'th') && !this.vm.getText(node.children)) { |
| | | node.children.push({ |
| | | type: 'text', |
| | | text: '' |
| | | }) |
| | | } |
| | | } |
| | | |
| | | module.exports = Editable |
New file |
| | |
| | | /* global getTop */ |
| | | module.exports = { |
| | | style: `/* #ifndef H5 || MP-ALIPAY || APP-PLUS */ |
| | | ._address, |
| | | ._article, |
| | | ._aside, |
| | | ._body, |
| | | ._caption, |
| | | ._center, |
| | | ._cite, |
| | | ._footer, |
| | | ._header, |
| | | ._html, |
| | | ._nav, |
| | | ._pre, |
| | | ._section { |
| | | display: block; |
| | | } |
| | | |
| | | /* #endif */ |
| | | ._video { |
| | | width: 300px; |
| | | height: 225px; |
| | | display: inline-block; |
| | | background-color: black; |
| | | }`, |
| | | methods: { |
| | | /** |
| | | * @description å¼å§ç¼è¾ææ¬ |
| | | * @param {Event} e |
| | | */ |
| | | editStart (e) { |
| | | if (this.opts[5]) { |
| | | const i = e.currentTarget.dataset.i |
| | | if (!this.ctrl['e' + i] && this.opts[5] !== 'simple') { |
| | | // æ¾ç¤ºèçº¿æ¡ |
| | | this.$set(this.ctrl, 'e' + i, 1) |
| | | setTimeout(() => { |
| | | this.root._mask.push(() => this.$set(this.ctrl, 'e' + i, 0)) |
| | | }, 50) |
| | | this.root._edit = this |
| | | this.i = i |
| | | this.cursor = this.childs[i].text.length |
| | | } else { |
| | | if (this.opts[5] === 'simple') { |
| | | this.root._edit = this |
| | | this.i = i |
| | | this.cursor = this.childs[i].text.length |
| | | } |
| | | this.root._mask.pop() |
| | | this.root._maskTap() |
| | | // å° text 转为 textarea |
| | | this.$set(this.ctrl, 'e' + i, 2) |
| | | // å»¶æ¶å¯¹ç¦ï¼é¿å
é«åº¦é误 |
| | | setTimeout(() => { |
| | | this.$set(this.ctrl, 'e' + i, 3) |
| | | }, 50) |
| | | } |
| | | } |
| | | }, |
| | | /** |
| | | * @description è¾å
¥ææ¬ |
| | | * @param {Event} e |
| | | */ |
| | | editInput (e) { |
| | | const i = e.target.dataset.i |
| | | // æ¿æ¢è¿ç»ç©ºæ ¼ |
| | | const value = e.detail.value.replace(/ {2,}/, $ => { |
| | | let res = '\xa0' |
| | | for (let i = 1; i < $.length; i++) { |
| | | res += '\xa0' |
| | | } |
| | | return res |
| | | }) |
| | | this.root._editVal(`${this.opts[7]}.${i}.text`, this.childs[i].text, value) // è®°å½ç¼è¾åå² |
| | | this.cursor = e.detail.cursor |
| | | }, |
| | | /** |
| | | * @description 宿ç¼è¾ææ¬ |
| | | * @param {Event} e |
| | | */ |
| | | editEnd (e) { |
| | | const i = e.target.dataset.i |
| | | this.$set(this.ctrl, 'e' + i, 0) |
| | | // æ´æ°å°è§å¾ |
| | | this.root._setData(`${this.opts[7]}.${i}.text`, e.detail.value.replace(/ {2}/g, '\xa0 ')) |
| | | if (e.detail.cursor !== undefined) { |
| | | this.cursor = e.detail.cursor |
| | | } |
| | | }, |
| | | /** |
| | | * @description æå
¥ä¸ä¸ªæ ç¾ |
| | | * @param {Object} node è¦æå
¥çæ ç¾ |
| | | */ |
| | | insert (node) { |
| | | setTimeout(() => { |
| | | const childs = this.childs.slice(0) |
| | | if (!childs[this.i]) { |
| | | childs.push(node) |
| | | } else if (childs[this.i].text) { |
| | | // 卿æ¬ä¸æå
¥ |
| | | const text = childs[this.i].text |
| | | if (node.type === 'text') { |
| | | if (this.cursor) { |
| | | childs[this.i].text = text.substring(0, this.cursor) + node.text + text.substring(this.cursor) |
| | | } else { |
| | | childs[this.i].text += node.text |
| | | } |
| | | } else { |
| | | const list = [] |
| | | if (this.cursor) { |
| | | list.push({ |
| | | type: 'text', |
| | | text: text.substring(0, this.cursor) |
| | | }) |
| | | } |
| | | list.push(node) |
| | | if (this.cursor < text.length) { |
| | | list.push({ |
| | | type: 'text', |
| | | text: text.substring(this.cursor) |
| | | }) |
| | | } |
| | | childs.splice(this.i, 1, ...list) |
| | | } |
| | | } else { |
| | | childs.splice(parseInt(this.i) + 1, 0, node) |
| | | } |
| | | this.root._editVal(this.opts[7], this.childs, childs, true) |
| | | this.i = parseInt(this.i) + 1 |
| | | }, 200) |
| | | }, |
| | | /** |
| | | * @description ç§»é¤ç¬¬ i 个æ ç¾ |
| | | * @param {Number} i |
| | | */ |
| | | remove (i) { |
| | | const arr = this.childs.slice(0) |
| | | const delEle = arr.splice(i, 1)[0] |
| | | if (delEle.name === 'img' || delEle.name === 'video' || delEle.name === 'audio') { |
| | | let src = delEle.attrs.src |
| | | if (delEle.src) { |
| | | src = delEle.src.length === 1 ? delEle.src[0] : delEle.src |
| | | } |
| | | this.root.$emit('remove', { |
| | | type: delEle.name, |
| | | src |
| | | }) |
| | | } |
| | | this.root._edit = undefined |
| | | this.root._maskTap() |
| | | this.root._editVal(this.opts[7], this.childs, arr, true) |
| | | }, |
| | | /** |
| | | * @description æ ç¾è¢«ç¹å» |
| | | * @param {Event} e |
| | | */ |
| | | nodeTap (e) { |
| | | if (this.opts[5]) { |
| | | if (this.root._lock) return |
| | | this.root._lock = true |
| | | setTimeout(() => { |
| | | this.root._lock = false |
| | | }, 50) |
| | | if (this.ctrl['e' + this.i] === 3) return |
| | | this.root._maskTap() |
| | | this.root._edit = this |
| | | if (this.opts[5] === 'simple') return |
| | | let start = this.opts[7].lastIndexOf('children.') |
| | | if (start !== -1) { |
| | | start += 9 |
| | | } else { |
| | | start = 6 |
| | | } |
| | | const i = parseInt(this.opts[7].substring(start, this.opts[7].lastIndexOf('.children'))) |
| | | let parent = this.$parent |
| | | while (parent && parent.$options.name !== 'node') { |
| | | parent = parent.$parent |
| | | } |
| | | let remove = () => { |
| | | parent.remove(i) |
| | | } |
| | | if (this.opts[7].length - parent.opts[7].length > 15) { |
| | | const parts = this.opts[7].split('.') |
| | | let childs = parent.childs |
| | | const i = parseInt(parts[parent.opts[7].split('.').length]) |
| | | const oldParent = parent |
| | | // å 餿´ä¸ªè¡¨æ ¼ |
| | | remove = () => { |
| | | oldParent.remove(i) |
| | | } |
| | | for (let i = parent.opts[7].split('.').length; i < parts.length - 2; i++) { |
| | | childs = childs[parts[i]] |
| | | } |
| | | const that = this |
| | | parent = { |
| | | childs, |
| | | opts: [undefined, undefined, undefined, undefined, undefined, undefined, undefined, parts.slice(0, parts.length - 2).join('.')], |
| | | changeStyle (name, i, value, oldVal) { |
| | | let style = this.childs[i].attrs.style || '' |
| | | if (style.includes(';' + name + ':' + oldVal)) { |
| | | style = style.replace(';' + name + ':' + oldVal, ';' + name + ':' + value) |
| | | } else { |
| | | style += ';' + name + ':' + value |
| | | } |
| | | that.root._setData(`${this.opts[7]}.${i}.attrs.style`, style) |
| | | } |
| | | } |
| | | } |
| | | if (!parent) return |
| | | // æ¾ç¤ºå®çº¿æ¡ |
| | | this.$set(this.ctrl, 'root', 1) |
| | | this.root._mask.push(() => this.$set(this.ctrl, 'root', 0)) |
| | | if (this.childs.length === 1 && this.childs[0].type === 'text' && !this.ctrl.e0) { |
| | | this.$set(this.ctrl, 'e0', 1) |
| | | this.root._mask.push(() => this.$set(this.ctrl, 'e0', 0)) |
| | | this.i = 0 |
| | | this.cursor = this.childs[0].text.length |
| | | } |
| | | const items = this.root._getItem(parent.childs[i], i !== 0, i !== parent.childs.length - 1) |
| | | this.root._tooltip({ |
| | | top: getTop(e), |
| | | items, |
| | | success: tapIndex => { |
| | | if (items[tapIndex] === '大å°') { |
| | | // æ¹ååä½å¤§å° |
| | | const style = parent.childs[i].attrs.style || '' |
| | | let value = style.match(/;font-size:([0-9]+)px/) |
| | | if (value) { |
| | | value = parseInt(value[1]) |
| | | } else { |
| | | value = 16 |
| | | } |
| | | this.root._slider({ |
| | | min: 10, |
| | | max: 30, |
| | | value, |
| | | top: getTop(e), |
| | | changing: val => { |
| | | if (Math.abs(val - value) > 2) { |
| | | // åå·åæ¢è¶
è¿ 2 æ¶æ´æ°å°è§å¾ |
| | | parent.changeStyle('font-size', i, val + 'px', value + 'px') |
| | | value = e.detail.value |
| | | } |
| | | }, |
| | | change: val => { |
| | | if (val !== value) { |
| | | parent.changeStyle('font-size', i, val + 'px', value + 'px') |
| | | } |
| | | this.root._editVal(`${parent.opts[7]}.${i}.attrs.style`, style, parent.childs[i].attrs.style) |
| | | } |
| | | }) |
| | | } else if (items[tapIndex] === 'é¢è²') { |
| | | // æ¹åæåé¢è² |
| | | const items = this.root._getItem('color') |
| | | this.root._color({ |
| | | top: getTop(e), |
| | | items, |
| | | success: tapIndex => { |
| | | const style = parent.childs[i].attrs.style || '' |
| | | const value = style.match(/;color:([^;]+)/) |
| | | parent.changeStyle('color', i, items[tapIndex], value ? value[1] : undefined) |
| | | this.root._editVal(`${parent.opts[7]}.${i}.attrs.style`, style, parent.childs[i].attrs.style) |
| | | } |
| | | }) |
| | | } else if (items[tapIndex] === 'ä¸ç§»' || items[tapIndex] === 'ä¸ç§»') { |
| | | const arr = parent.childs.slice(0) |
| | | const item = arr[i] |
| | | if (items[tapIndex] === 'ä¸ç§»') { |
| | | arr[i] = arr[i - 1] |
| | | arr[i - 1] = item |
| | | } else { |
| | | arr[i] = arr[i + 1] |
| | | arr[i + 1] = item |
| | | } |
| | | this.root._editVal(parent.opts[7], parent.childs, arr, true) |
| | | } else if (items[tapIndex] === 'å é¤') { |
| | | remove() |
| | | } else { |
| | | const style = parent.childs[i].attrs.style || '' |
| | | let newStyle = '' |
| | | const item = items[tapIndex] |
| | | let name |
| | | let value |
| | | if (item === 'æä½') { |
| | | name = 'font-style' |
| | | value = 'italic' |
| | | } else if (item === 'ç²ä½') { |
| | | name = 'font-weight' |
| | | value = 'bold' |
| | | } else if (item === 'ä¸å线') { |
| | | name = 'text-decoration' |
| | | value = 'underline' |
| | | } else if (item === 'å±
ä¸') { |
| | | name = 'text-align' |
| | | value = 'center' |
| | | } else if (item === '缩è¿') { |
| | | name = 'text-indent' |
| | | value = '2em' |
| | | } |
| | | if (style.includes(name + ':')) { |
| | | // å·²æååæ¶ |
| | | newStyle = style.replace(new RegExp(name + ':[^;]+'), '') |
| | | } else { |
| | | // 没æåæ·»å |
| | | newStyle = style + ';' + name + ':' + value |
| | | } |
| | | this.root._editVal(`${parent.opts[7]}.${i}.attrs.style`, style, newStyle, true) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | /** |
| | | * @description é³è§é¢è¢«ç¹å» |
| | | * @param {Event} e |
| | | */ |
| | | mediaTap (e, index) { |
| | | if (this.opts[5]) { |
| | | const i = e.target.dataset.i || index |
| | | const node = this.childs[i] |
| | | const items = this.root._getItem(node) |
| | | this.root._maskTap() |
| | | this.root._edit = this |
| | | this.i = i |
| | | this.root._tooltip({ |
| | | top: e.currentTarget.offsetTop - 30, |
| | | items, |
| | | success: tapIndex => { |
| | | switch (items[tapIndex]) { |
| | | case 'å°é¢': |
| | | // 设置å°é¢ |
| | | this.root.getSrc('img', node.attrs.poster || '').then(url => { |
| | | this.root._editVal(`${this.opts[7]}.${i}.attrs.poster`, node.attrs.poster, url instanceof Array ? url[0] : url, true) |
| | | }).catch(() => { }) |
| | | break |
| | | case 'å é¤': |
| | | this.remove(i) |
| | | break |
| | | case '循ç¯': |
| | | case 'ä¸å¾ªç¯': |
| | | // åæ¢å¾ªç¯ææ¾ |
| | | this.root._setData(`${this.opts[7]}.${i}.attrs.loop`, !node.attrs.loop) |
| | | uni.showToast({ |
| | | title: 'æå' |
| | | }) |
| | | break |
| | | case 'èªå¨ææ¾': |
| | | case 'ä¸èªå¨ææ¾': |
| | | // 忢èªå¨ææ¾ææ¾ |
| | | this.root._setData(`${this.opts[7]}.${i}.attrs.autoplay`, !node.attrs.autoplay) |
| | | uni.showToast({ |
| | | title: 'æå' |
| | | }) |
| | | break |
| | | } |
| | | } |
| | | }) |
| | | // é¿å
ä¸å±åºç°ç¹å»æ |
| | | this.root._lock = true |
| | | setTimeout(() => { |
| | | this.root._lock = false |
| | | }, 50) |
| | | } |
| | | }, |
| | | /** |
| | | * æ¹åæ ·å¼ |
| | | * @param {String} name 屿§å |
| | | * @param {Number} i 第å 个æ ç¾ |
| | | * @param {String} value æ°å¼ |
| | | * @param {String} oldVal æ§å¼ |
| | | */ |
| | | changeStyle (name, i, value, oldVal) { |
| | | let style = this.childs[i].attrs.style || '' |
| | | if (style.includes(';' + name + ':' + oldVal)) { |
| | | // style ä¸å·²ç»æ |
| | | style = style.replace(';' + name + ':' + oldVal, ';' + name + ':' + value) |
| | | } else { |
| | | // 没æåæ°å¢ |
| | | style += ';' + name + ':' + value |
| | | } |
| | | this.root._setData(`${this.opts[7]}.${i}.attrs.style`, style) |
| | | } |
| | | }, |
| | | handler (file) { |
| | | if (file.isBuffer()) { |
| | | let content = file.contents.toString() |
| | | if (file.path.includes('mp-html.vue')) { |
| | | // ä¼ é editable 屿§åè·¯å¾ |
| | | content = content.replace(/opts\s*=\s*"\[([^\]]+)\]"/, 'opts="[$1,editable,placeholder,\'nodes\']"') |
| | | .replace(/<view(.*?):style\s*=\s*"containerStyle"/, '<view$1:style="(editable?\'min-height:200px;\':\'\')+containerStyle" @tap="_containTap"') |
| | | // å·¥å
·å¼¹çª |
| | | .replace(/<\/view>\s*<\/template>/, ` <view v-if="tooltip" class="_tooltip_contain" :style="'top:'+tooltip.top+'px'"> |
| | | <view class="_tooltip"> |
| | | <view v-for="(item, index) in tooltip.items" v-bind:key="index" class="_tooltip_item" :data-i="index" @tap="_tooltipTap">{{item}}</view> |
| | | </view> |
| | | </view> |
| | | <view v-if="slider" class="_slider" :style="'top:'+slider.top+'px'"> |
| | | <slider :value="slider.value" :min="slider.min" :max="slider.max" handle-size="14" block-size="14" show-value activeColor="white" style="padding:3px" @changing="_sliderChanging" @change="_sliderChange" /> |
| | | </view> |
| | | <view v-if="color" class="_tooltip_contain" :style="'top:'+color.top+'px'"> |
| | | <view class="_tooltip" style="overflow-y: hidden;"> |
| | | <view v-for="(item, index) in color.items" v-bind:key="index" class="_color_item" :style="'background-color:'+item" :data-i="index" @tap="_colorTap"></view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template>`) |
| | | // æ·»å data |
| | | .replace(/data\s*\(\)\s*{\s*return\s*{/, `data() { |
| | | return { |
| | | tooltip: null, |
| | | slider: null, |
| | | color: null,`) |
| | | // æ·»å editable 屿§ |
| | | .replace(/props\s*:\s*{/, `props: { |
| | | editable: [Boolean, String], |
| | | placeholder: String,`) |
| | | // æ·»å watch |
| | | .replace(/watch\s*:\s*{/, `watch: { |
| | | editable(val) { |
| | | this.setContent(val ? this.content : this.getContent()) |
| | | if (!val) |
| | | this._maskTap() |
| | | },`) |
| | | .replace(/if\s*\(this.content/, 'if ((this.content || this.editable)') |
| | | // å¤çå类弹çªçäºä»¶ |
| | | .replace(/methods\s*:\s*{/, `methods: { |
| | | _containTap() { |
| | | if (!this._lock && !this.slider && !this.color) { |
| | | this._edit = undefined |
| | | this._maskTap() |
| | | } |
| | | }, |
| | | _tooltipTap(e) { |
| | | this._tooltipcb(e.currentTarget.dataset.i) |
| | | this.$set(this, 'tooltip', null) |
| | | }, |
| | | _sliderChanging(e) { |
| | | this._slideringcb(e.detail.value) |
| | | }, |
| | | _sliderChange(e) { |
| | | this._slidercb(e.detail.value) |
| | | }, |
| | | _colorTap(e) { |
| | | this._colorcb(e.currentTarget.dataset.i) |
| | | this.$set(this, 'color', null) |
| | | },`) |
| | | // å·¥å
·å¼¹çªçæ ·å¼ |
| | | .replace('</style>', ` |
| | | /* æç¤ºæ¡ */ |
| | | ._tooltip_contain { |
| | | position: absolute; |
| | | right: 20px; |
| | | left: 20px; |
| | | text-align: center; |
| | | } |
| | | |
| | | ._tooltip { |
| | | box-sizing: border-box; |
| | | display: inline-block; |
| | | width: auto; |
| | | max-width: 100%; |
| | | height: 30px; |
| | | padding: 0 3px; |
| | | overflow: scroll; |
| | | font-size: 14px; |
| | | line-height: 30px; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | ._tooltip_item { |
| | | display: inline-block; |
| | | width: auto; |
| | | padding: 0 2vw; |
| | | line-height: 30px; |
| | | background-color: black; |
| | | color: white; |
| | | } |
| | | |
| | | ._color_item { |
| | | display: inline-block; |
| | | width: 18px; |
| | | height: 18px; |
| | | margin: 5px 2vw; |
| | | border:1px solid #dfe2e5; |
| | | border-radius: 50%; |
| | | } |
| | | |
| | | /* å¾ç宽度æ»å¨æ¡ */ |
| | | ._slider { |
| | | position: absolute; |
| | | left: 20px; |
| | | width: 220px; |
| | | } |
| | | |
| | | ._tooltip, |
| | | ._slider { |
| | | background-color: black; |
| | | border-radius: 3px; |
| | | opacity: 0.75; |
| | | } |
| | | </style>`) |
| | | } else if (file.path.includes('parser.js')) { |
| | | // ä¸å expose å¤ç |
| | | content = content.replace(/parser.prototype.expose\s*=\s*function\s*\(\)\s*{/, `parser.prototype.expose = function () { |
| | | if (this.options.editable) return`) |
| | | .replace(/popNode\s*=\s*function\s*\(\)\s*{/, 'popNode = function () {\n const editable = this.options.editable') |
| | | // ä¸è½¬æ¢æ ç¾å |
| | | .replace(/if\s*\(config.blockTags\[node.name\]\)\s*{[\s\S]+?}/, `if (config.blockTags[node.name]) { |
| | | if (!editable) { |
| | | node.name = 'div' |
| | | } |
| | | }`) |
| | | // 转æ¢è¡¨æ ¼åå表 |
| | | .replace(/else\s*if\s*\(node.c\)/, 'else if (!editable && node.c )') |
| | | .replace(/node.c(\)|\s*&&|\s*\n)/g, '(node.c || editable)$1') |
| | | .replace(/while\s*\(map\[row\s*\+\s*'.'\s*\+\s*col\]\)\s*{[\s\S]+?}/, `while (map[row + '.' + col]) { |
| | | col++ |
| | | } |
| | | if (editable) { |
| | | td.r = row |
| | | }`) |
| | | .replace(/let\s+str\s*=\s*'<video style="width:100%;height:100%"'/, `let str = '<video style="width:100%;height:100%"' |
| | | if (editable) { |
| | | attrs.controls = '' |
| | | }`) |
| | | } else if (file.path.includes('node.vue')) { |
| | | content = |
| | | // ä¼ é opts |
| | | content.replace(/:childs\s*=\s*"tbody.children"\s*:opts="opts"/, ':childs="tbody.children" :opts="[opts[0],opts[1],opts[2],opts[3],opts[4],opts[5],opts[6],opts[7]+\'.\'+i+\'.children.\'+x+\'.children\']"') |
| | | .replace(/:childs\s*=\s*"n2.children"\s*:opts="opts"/, ':childs="n2.children" :opts="[opts[0],opts[1],opts[2],opts[3],opts[4],opts[5],opts[6],opts[7]+\'.\'+i+\'.children.\'+j+\'.children\']"') |
| | | .replace(/:childs\s*=\s*"tr.children"\s*:opts="opts"/, ':childs="tr.children" :opts="[opts[0],opts[1],opts[2],opts[3],opts[4],opts[5],opts[6],opts[7]+\'.\'+i+\'.children.\'+x+\'.children.\'+y+\'.children\']"') |
| | | .replace(/:childs\s*=\s*"td.children"\s*:opts="opts"/, ':childs="td.children" :opts="[opts[0],opts[1],opts[2],opts[3],opts[4],opts[5],opts[6],opts[7]+\'.\'+i+\'.children.\'+x+\'.children.\'+y+\'.children.\'+z+\'.children\']"') |
| | | .replace(/opts\s*=\s*"opts"/g, 'opts="[opts[0],opts[1],opts[2],opts[3],opts[4],opts[5],opts[6],opts[7]+\'.\'+i+\'.children\']"') |
| | | // ä¸ä½¿ç¨ rich-text |
| | | .replace(/!n.c/g, '!opts[5]&&!n.c').replace('&&n.c', '&&(n.c||opts[5])') |
| | | // ä¿®æ¹æ®éæ ç¾ |
| | | .replace(/<view\s+:id(.+?)style="/, '<view @tap="nodeTap" :id$1style="(ctrl.root&&opts[5]!==\'simple\'?\'border:1px solid black;padding:5px;display:block;\':\'\')+') |
| | | // ä¿®æ¹ææ¬å |
| | | .replace(/<!--\s*ææ¬\s*-->[\s\S]+?<!--\s*龿¥\s*-->/, |
| | | `<!-- ææ¬ --> |
| | | <text v-else-if="n.type==='text'&&!ctrl['e'+i]" :data-i="i" :user-select="opts[4]" :decode="!opts[5]" @tap="editStart">{{n.text}} |
| | | <text v-if="!n.text" style="color:gray">{{opts[6]||'请è¾å
¥'}}</text> |
| | | </text> |
| | | <text v-else-if="n.type==='text'&&ctrl['e'+i]===1" :data-i="i" style="border:1px dashed black;min-width:50px;width:auto;padding:5px;display:block" @tap.stop="editStart">{{n.text}} |
| | | <text v-if="!n.text" style="color:gray">{{opts[6]||'请è¾å
¥'}}</text> |
| | | </text> |
| | | <textarea v-else-if="n.type==='text'" :style="opts[5]==='simple'?'':'border:1px dashed black;'+'min-width:50px;width:auto;padding:5px'" auto-height maxlength="-1" :focus="ctrl['e'+i]===3" :value="n.text" :data-i="i" @input="editInput" @blur="editEnd" /> |
| | | <text v-else-if="n.name==='br'">\\n</text> |
| | | <!-- 龿¥ -->`) |
| | | // ä¿®æ¹å¾ç |
| | | .replace(/<image(.+?)id="n.attrs.id/, '<image$1id="n.attrs.id||(\'n\'+i)') |
| | | .replace('height:1px', "height:'+(ctrl['h'+i]||1)+'px") |
| | | .replace(/:style\s*=\s*"\(ctrl\[i\]/g, ':style="(ctrl[\'e\'+i]&&opts[5]!==\'simple\'?\'border:1px dashed black;padding:3px;\':\'\')+(ctrl[i]') |
| | | .replace(/show-menu-by-longpress\s*=\s*"(\S+?)"\s*:image-menu-prevent\s*=\s*"(\S+?)"/, 'show-menu-by-longpress="!opts[5]&&$1" :image-menu-prevent="opts[5]||$2"') |
| | | // ä¿®æ¹é³è§é¢ |
| | | .replace('v-else-if="n.html"', 'v-else-if="n.html" :data-i="i" @tap="mediaTap"') |
| | | .replace('<video', '<video :show-center-play-btn="!opts[5]" @tap="mediaTap"') |
| | | .replace('<audio ', '<audio @tap="mediaTap" ') |
| | | .replace('<my-audio ', '<my-audio @onClick="mediaTap($event, i)" ') |
| | | .replace('card ', 'card @click="mediaTap($event, i)" ') |
| | | .replace('<script>', |
| | | `<script> |
| | | import Parser from '../parser' |
| | | function getTop(e) { |
| | | let top |
| | | // #ifdef H5 && VUE3 |
| | | top = e.pageY |
| | | // #endif |
| | | // #ifdef (H5 && VUE2) || APP-PLUS |
| | | top = e.touches[0].pageY |
| | | // #endif |
| | | // #ifdef MP-ALIPAY |
| | | top = e.detail.pageY |
| | | // #endif |
| | | // #ifndef H5 || MP-ALIPAY || APP-PLUS |
| | | top = e.detail.y |
| | | // #endif |
| | | if (top - e.currentTarget.offsetTop < 150 || top < 600) { |
| | | top = e.currentTarget.offsetTop |
| | | } |
| | | if (top < 30) { |
| | | top += 70 |
| | | } |
| | | return top - 30 |
| | | }`) |
| | | // 卿å¤ç |
| | | .replace(/beforeDestroy\s*\(\)\s*{/, `beforeDestroy () { |
| | | if (this.root && this.root._edit === this) { |
| | | this.root._edit = undefined |
| | | }`) |
| | | // è®°å½å¾ç宽度 |
| | | .replace(/imgLoad\s*\(e\)\s*{/, `imgLoad(e) { |
| | | // #ifdef MP-WEIXIN || MP-QQ |
| | | if (this.opts[5]) |
| | | this.$nextTick(() => { |
| | | const id = this.childs[i].attrs.id || ('n' + i) |
| | | uni.createSelectorQuery().in(this).select('#' + id).boundingClientRect().exec(res => { |
| | | this.$set(this.ctrl, 'h'+i, res[0].height) |
| | | }) |
| | | }) |
| | | // #endif`) |
| | | .replace(/if\s*\(!this.childs\[i\].w\)\s*{[\s\S]+?}/, |
| | | `if (!this.childs[i].w) { |
| | | this.$set(this.ctrl, i, e.detail.width) |
| | | if (this.opts[5]) { |
| | | const path = this.opts[7] + '.' + i + '.attrs.' |
| | | if (e.detail.width < 150) |
| | | this.root._setData(path + 'ignore', 'T') |
| | | this.root._setData(path + 'width', e.detail.width.toString()) |
| | | } |
| | | }`) |
| | | // å¤çå¾çé¿æ |
| | | .replace(/imgLongTap\s*\(\)\s*{/, `imgLongTap() { |
| | | if (this.opts[5]) return`) |
| | | // å¤çå¾çç¹å» |
| | | .replace(/imgTap\s*\(e\)\s*{([\s\S]+?)},\s*\/\*/, |
| | | `imgTap (e) { |
| | | if (!this.opts[5]) {$1} else { |
| | | const i = e.currentTarget.dataset.i |
| | | const node = this.childs[i] |
| | | const items = this.root._getItem(node) |
| | | const parser = new Parser(this.root) |
| | | this.root._edit = this |
| | | this.i = i |
| | | this.root._maskTap() |
| | | this.$set(this.ctrl, 'e' + i, 1) |
| | | this.root._mask.push(() => this.$set(this.ctrl, 'e' + i, 0)) |
| | | this.root._tooltip({ |
| | | top: getTop(e), |
| | | items, |
| | | success: tapIndex => { |
| | | if (items[tapIndex] === 'æ¢å¾') { |
| | | // æ¢å¾ |
| | | this.root.getSrc('img', node.attrs.src || '').then(url => { |
| | | this.root._editVal(this.opts[7] + '.' + i + '.attrs.src', node.attrs.src, parser.getUrl(url instanceof Array ? url[0] : url), true) |
| | | }).catch(() => { }) |
| | | } else if (items[tapIndex] === '宽度') { |
| | | // æ´æ¹å®½åº¦ |
| | | const style = node.attrs.style || '' |
| | | let value = style.match(/max-width:([0-9]+)%/) |
| | | if (value) { |
| | | value = parseInt(value[1]) |
| | | } else { |
| | | value = 100 |
| | | } |
| | | this.root._slider({ |
| | | min: 0, |
| | | max: 100, |
| | | value, |
| | | top: getTop(e), |
| | | changing: val => { |
| | | // ååè¶
è¿ 5% æ´æ°æ¶è§å¾ |
| | | if (Math.abs(val - value) > 5) { |
| | | this.changeStyle('max-width', i, val + '%', value + '%') |
| | | value = val |
| | | } |
| | | }, |
| | | change: val => { |
| | | if (val !== value) { |
| | | this.changeStyle('max-width', i, val + '%', value + '%') |
| | | value = val |
| | | } |
| | | this.root._editVal(this.opts[7] + '.' + i + '.attrs.style', style, this.childs[i].attrs.style) |
| | | } |
| | | }) |
| | | } else if (items[tapIndex] === 'è¶
龿¥') { |
| | | // å°å¾çè®¾ç½®ä¸ºé¾æ¥ |
| | | this.root.getSrc('link', node.a ? node.a.href : '').then(url => { |
| | | // 妿æ a æ ç¾åæ¿æ¢ href |
| | | if (node.a) { |
| | | this.root._editVal(this.opts[7] + '.' + i + '.a.href', node.a.href, parser.getUrl(url), true) |
| | | } else { |
| | | const link = { |
| | | name: 'a', |
| | | attrs: { |
| | | href: parser.getUrl(url) |
| | | }, |
| | | children: [node] |
| | | } |
| | | node.a = link.attrs |
| | | this.root._editVal(this.opts[7] + '.' + i, node, link, true) |
| | | } |
| | | wx.showToast({ |
| | | title: 'æå' |
| | | }) |
| | | }).catch(() => { }) |
| | | } else if (items[tapIndex] === 'é¢è§å¾') { |
| | | // 设置é¢è§å¾é¾æ¥ |
| | | this.root.getSrc('img', node.attrs['original-src'] || '').then(url => { |
| | | this.root._editVal(this.opts[7] + '.' + i + '.attrs.original-src', node.attrs['original-src'], parser.getUrl(url instanceof Array ? url[0] : url), true) |
| | | uni.showToast({ |
| | | title: 'æå' |
| | | }) |
| | | }).catch(() => { }) |
| | | } else if (items[tapIndex] === 'å é¤') { |
| | | this.remove(i) |
| | | } else { |
| | | // ç¦ç¨ / å¯ç¨é¢è§ |
| | | this.root._setData(this.opts[7] + '.' + i + '.attrs.ignore', !node.attrs.ignore) |
| | | uni.showToast({ |
| | | title: 'æå' |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | this.root._lock = true |
| | | setTimeout(() => { |
| | | this.root._lock = false |
| | | }, 50) |
| | | } |
| | | }, |
| | | /*`) |
| | | // å¤ç龿¥ç¹å» |
| | | .replace(/linkTap\s*\(e\)\s*{([\s\S]+?)},\s*\/\*/, |
| | | `linkTap (e) { |
| | | if (!this.opts[5]) {$1} else { |
| | | const i = e.currentTarget.dataset.i |
| | | const node = this.childs[i] |
| | | const items = this.root._getItem(node) |
| | | this.root._tooltip({ |
| | | top: getTop(e), |
| | | items, |
| | | success: tapIndex => { |
| | | if (items[tapIndex] === 'æ´æ¢é¾æ¥') { |
| | | this.root.getSrc('link', node.attrs.href).then(url => { |
| | | this.root._editVal(this.opts[7] + '.' + i + '.attrs.href', node.attrs.href, url, true) |
| | | uni.showToast({ |
| | | title: 'æå' |
| | | }) |
| | | }).catch(() => { }) |
| | | } else { |
| | | this.remove(i) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | /*`) |
| | | } |
| | | file.contents = Buffer.from(content) |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * @fileoverview editable æä»¶ |
| | | */ |
| | | const config = require('./config') |
| | | const Parser = require('../parser') |
| | | |
| | | function Editable (vm) { |
| | | this.vm = vm |
| | | this.editHistory = [] // åå²è®°å½ |
| | | this.editI = -1 // åå²è®°å½æé |
| | | vm._mask = [] // èç被ç¹å»æ¶è¿è¡çæä½ |
| | | |
| | | vm._setData = function (path, val) { |
| | | const paths = path.split('.') |
| | | let target = vm |
| | | for (let i = 0; i < paths.length - 1; i++) { |
| | | target = target[paths[i]] |
| | | } |
| | | vm.$set(target, paths.pop(), val) |
| | | } |
| | | |
| | | /** |
| | | * @description ç§»å¨åå²è®°å½æé |
| | | * @param {Number} num ç§»å¨è·ç¦» |
| | | */ |
| | | const move = num => { |
| | | setTimeout(() => { |
| | | const item = this.editHistory[this.editI + num] |
| | | if (item) { |
| | | this.editI += num |
| | | vm._setData(item.key, item.value) |
| | | } |
| | | }, 200) |
| | | } |
| | | vm.undo = () => move(-1) // æ¤é |
| | | vm.redo = () => move(1) // éå |
| | | |
| | | /** |
| | | * @description æ´æ°è®°å½ |
| | | * @param {String} path æ´æ°å
å®¹è·¯å¾ |
| | | * @param {*} oldVal æ§å¼ |
| | | * @param {*} newVal æ°å¼ |
| | | * @param {Boolean} set æ¯å¦æ´æ°å°è§å¾ |
| | | * @private |
| | | */ |
| | | vm._editVal = (path, oldVal, newVal, set) => { |
| | | // å½åæéåçå
容å»é¤ |
| | | while (this.editI < this.editHistory.length - 1) { |
| | | this.editHistory.pop() |
| | | } |
| | | |
| | | // æå¤åå¨ 30 æ¡æä½è®°å½ |
| | | while (this.editHistory.length > 30) { |
| | | this.editHistory.pop() |
| | | this.editI-- |
| | | } |
| | | |
| | | const last = this.editHistory[this.editHistory.length - 1] |
| | | if (!last || last.key !== path) { |
| | | if (last) { |
| | | // 廿ä¸ä¸æ¬¡çæ°å¼ |
| | | this.editHistory.pop() |
| | | this.editI-- |
| | | } |
| | | // åå
¥è¿ä¸æ¬¡çæ§å¼ |
| | | this.editHistory.push({ |
| | | key: path, |
| | | value: oldVal |
| | | }) |
| | | this.editI++ |
| | | } |
| | | |
| | | // åå
¥æ¬æ¬¡çæ°å¼ |
| | | this.editHistory.push({ |
| | | key: path, |
| | | value: newVal |
| | | }) |
| | | this.editI++ |
| | | |
| | | // æ´æ°å°è§å¾ |
| | | if (set) { |
| | | vm._setData(path, newVal) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description è·åèå项 |
| | | * @private |
| | | */ |
| | | vm._getItem = function (node, up, down) { |
| | | let items |
| | | let i |
| | | if (node === 'color') { |
| | | return config.color |
| | | } |
| | | if (node.name === 'img') { |
| | | items = config.img.slice(0) |
| | | if (!vm.getSrc) { |
| | | i = items.indexOf('æ¢å¾') |
| | | if (i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | i = items.indexOf('è¶
龿¥') |
| | | if (i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | i = items.indexOf('é¢è§å¾') |
| | | if (i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | } |
| | | i = items.indexOf('ç¦ç¨é¢è§') |
| | | if (i !== -1 && node.attrs.ignore) { |
| | | items[i] = 'å¯ç¨é¢è§' |
| | | } |
| | | } else if (node.name === 'a') { |
| | | items = config.link.slice(0) |
| | | if (!vm.getSrc) { |
| | | i = items.indexOf('æ´æ¢é¾æ¥') |
| | | if (i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | } |
| | | } else if (node.name === 'video' || node.name === 'audio') { |
| | | items = config.media.slice(0) |
| | | i = items.indexOf('å°é¢') |
| | | if (!vm.getSrc && i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | i = items.indexOf('循ç¯') |
| | | if (node.attrs.loop && i !== -1) { |
| | | items[i] = 'ä¸å¾ªç¯' |
| | | } |
| | | i = items.indexOf('èªå¨ææ¾') |
| | | if (node.attrs.autoplay && i !== -1) { |
| | | items[i] = 'ä¸èªå¨ææ¾' |
| | | } |
| | | } else if (node.name === 'card') { |
| | | items = config.card.slice(0) |
| | | } else { |
| | | items = config.node.slice(0) |
| | | } |
| | | if (!up) { |
| | | i = items.indexOf('ä¸ç§»') |
| | | if (i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | } |
| | | if (!down) { |
| | | i = items.indexOf('ä¸ç§»') |
| | | if (i !== -1) { |
| | | items.splice(i, 1) |
| | | } |
| | | } |
| | | return items |
| | | } |
| | | |
| | | /** |
| | | * @description æ¾ç¤º tooltip |
| | | * @param {object} obj |
| | | * @private |
| | | */ |
| | | vm._tooltip = function (obj) { |
| | | vm.$set(vm, 'tooltip', { |
| | | top: obj.top, |
| | | items: obj.items |
| | | }) |
| | | vm._tooltipcb = obj.success |
| | | } |
| | | |
| | | /** |
| | | * @description æ¾ç¤ºæ»å¨æ¡ |
| | | * @param {object} obj |
| | | * @private |
| | | */ |
| | | vm._slider = function (obj) { |
| | | vm.$set(vm, 'slider', { |
| | | min: obj.min, |
| | | max: obj.max, |
| | | value: obj.value, |
| | | top: obj.top |
| | | }) |
| | | vm._slideringcb = obj.changing |
| | | vm._slidercb = obj.change |
| | | } |
| | | |
| | | /** |
| | | * @description æ¾ç¤ºé¢è²éæ© |
| | | * @param {object} obj |
| | | * @private |
| | | */ |
| | | vm._color = function (obj) { |
| | | vm.$set(vm, 'color', { |
| | | items: obj.items, |
| | | top: obj.top |
| | | }) |
| | | vm._colorcb = obj.success |
| | | } |
| | | |
| | | /** |
| | | * @description ç¹å»èç |
| | | * @private |
| | | */ |
| | | vm._maskTap = function () { |
| | | // éèæææ¬æµ®çª |
| | | while (vm._mask.length) { |
| | | (vm._mask.pop())() |
| | | } |
| | | if (vm.tooltip) { |
| | | vm.$set(vm, 'tooltip', null) |
| | | } |
| | | if (vm.slider) { |
| | | vm.$set(vm, 'slider', null) |
| | | } |
| | | if (vm.color) { |
| | | vm.$set(vm, 'color', null) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description æå
¥èç¹ |
| | | * @param {Object} node |
| | | */ |
| | | function insert (node) { |
| | | if (vm._edit) { |
| | | vm._edit.insert(node) |
| | | } else { |
| | | const nodes = vm.nodes.slice(0) |
| | | nodes.push(node) |
| | | vm._editVal('nodes', vm.nodes, nodes, true) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥æå® html å
容 |
| | | * @param {String} html å
容 |
| | | */ |
| | | vm.insertHtml = html => { |
| | | this.inserting = true |
| | | const arr = new Parser(vm).parse(html) |
| | | this.inserting = undefined |
| | | for (let i = 0; i < arr.length; i++) { |
| | | insert(arr[i]) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥å¾ç |
| | | */ |
| | | vm.insertImg = function () { |
| | | vm.getSrc && vm.getSrc('img').then(src => { |
| | | if (typeof src === 'string') { |
| | | src = [src] |
| | | } |
| | | const parser = new Parser(vm) |
| | | for (let i = 0; i < src.length; i++) { |
| | | insert({ |
| | | name: 'img', |
| | | attrs: { |
| | | src: parser.getUrl(src[i]) |
| | | } |
| | | }) |
| | | } |
| | | }).catch(() => { }) |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥ä¸ä¸ªé¾æ¥ |
| | | */ |
| | | vm.insertLink = function () { |
| | | vm.getSrc && vm.getSrc('link').then(url => { |
| | | insert({ |
| | | name: 'a', |
| | | attrs: { |
| | | href: url |
| | | }, |
| | | children: [{ |
| | | type: 'text', |
| | | text: url |
| | | }] |
| | | }) |
| | | }).catch(() => { }) |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥ä¸ä¸ªè¡¨æ ¼ |
| | | * @param {Number} rows è¡æ° |
| | | * @param {Number} cols åæ° |
| | | */ |
| | | vm.insertTable = function (rows, cols) { |
| | | const table = { |
| | | name: 'table', |
| | | attrs: { |
| | | style: 'display:table;width:100%;margin:10px 0;text-align:center;border-spacing:0;border-collapse:collapse;border:1px solid gray' |
| | | }, |
| | | children: [] |
| | | } |
| | | for (let i = 0; i < rows; i++) { |
| | | const tr = { |
| | | name: 'tr', |
| | | attrs: {}, |
| | | children: [] |
| | | } |
| | | for (let j = 0; j < cols; j++) { |
| | | tr.children.push({ |
| | | name: 'td', |
| | | attrs: { |
| | | style: 'padding:2px;border:1px solid gray' |
| | | }, |
| | | children: [{ |
| | | type: 'text', |
| | | text: '' |
| | | }] |
| | | }) |
| | | } |
| | | table.children.push(tr) |
| | | } |
| | | insert(table) |
| | | } |
| | | |
| | | /** |
| | | * @description æå
¥è§é¢/é³é¢ |
| | | * @param {Object} node |
| | | */ |
| | | function insertMedia (node) { |
| | | if (typeof node.src === 'string') { |
| | | node.src = [node.src] |
| | | } |
| | | const parser = new Parser(vm) |
| | | // æ¼æ¥ä¸»åå |
| | | for (let i = 0; i < node.src.length; i++) { |
| | | node.src[i] = parser.getUrl(node.src[i]) |
| | | } |
| | | insert({ |
| | | name: 'div', |
| | | attrs: { |
| | | style: 'text-align:center' |
| | | }, |
| | | children: [node] |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥ä¸ä¸ªè§é¢ |
| | | */ |
| | | vm.insertVideo = function () { |
| | | vm.getSrc && vm.getSrc('video').then(src => { |
| | | insertMedia({ |
| | | name: 'video', |
| | | attrs: { |
| | | controls: 'T' |
| | | }, |
| | | children: [], |
| | | src, |
| | | // #ifdef APP-PLUS |
| | | html: `<video src="${src}" style="width:100%;height:100%"></video>` |
| | | // #endif |
| | | }) |
| | | }).catch(() => { }) |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥ä¸ä¸ªé³é¢ |
| | | */ |
| | | vm.insertAudio = function () { |
| | | vm.getSrc && vm.getSrc('audio').then(attrs => { |
| | | let src |
| | | if (attrs.src) { |
| | | src = attrs.src |
| | | attrs.src = undefined |
| | | } else { |
| | | src = attrs |
| | | attrs = {} |
| | | } |
| | | attrs.controls = 'T' |
| | | insertMedia({ |
| | | name: 'audio', |
| | | attrs, |
| | | children: [], |
| | | src |
| | | }) |
| | | }).catch(() => { }) |
| | | } |
| | | |
| | | /** |
| | | * @description å¨å
æ 夿å
¥ä¸æ®µææ¬ |
| | | */ |
| | | vm.insertText = function () { |
| | | insert({ |
| | | name: 'p', |
| | | attrs: {}, |
| | | children: [{ |
| | | type: 'text', |
| | | text: '' |
| | | }] |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description æ¸
空å
容 |
| | | */ |
| | | vm.clear = function () { |
| | | vm._maskTap() |
| | | vm._edit = undefined |
| | | vm.$set(vm, 'nodes', [{ |
| | | name: 'p', |
| | | attrs: {}, |
| | | children: [{ |
| | | type: 'text', |
| | | text: '' |
| | | }] |
| | | }]) |
| | | } |
| | | |
| | | /** |
| | | * @description è·åç¼è¾åç html |
| | | */ |
| | | vm.getContent = function () { |
| | | let html = ''; |
| | | // éå½éåè·å |
| | | (function traversal (nodes, table) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | let item = nodes[i] |
| | | if (item.type === 'text') { |
| | | html += item.text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\n/g, '<br>').replace(/\xa0/g, ' ') // ç¼ç å®ä½ |
| | | } else { |
| | | if (item.name === 'img') { |
| | | item.attrs.i = '' |
| | | // è¿å被转æ¢ç svg |
| | | if ((item.attrs.src || '').includes('data:image/svg+xml;utf8,')) { |
| | | html += item.attrs.src.substr(24).replace(/%23/g, '#').replace('<svg', '<svg style="' + (item.attrs.style || '') + '"') |
| | | continue |
| | | } |
| | | } else if (item.name === 'video' || item.name === 'audio') { |
| | | // è¿å video å audio ç source |
| | | item = JSON.parse(JSON.stringify(item)) |
| | | if (item.src.length > 1) { |
| | | item.children = [] |
| | | for (let j = 0; j < item.src.length; j++) { |
| | | item.children.push({ |
| | | name: 'source', |
| | | attrs: { |
| | | src: item.src[j] |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | item.attrs.src = item.src[0] |
| | | } |
| | | } else if (item.name === 'div' && (item.attrs.style || '').includes('overflow:auto') && (item.children[0] || {}).name === 'table') { |
| | | // è¿åæ»å¨å± |
| | | item = item.children[0] |
| | | } |
| | | // è¿å table |
| | | if (item.name === 'table') { |
| | | item = JSON.parse(JSON.stringify(item)) |
| | | table = item.attrs |
| | | if ((item.attrs.style || '').includes('display:grid')) { |
| | | item.attrs.style = item.attrs.style.split('display:grid')[0] |
| | | const children = [{ |
| | | name: 'tr', |
| | | attrs: {}, |
| | | children: [] |
| | | }] |
| | | for (let j = 0; j < item.children.length; j++) { |
| | | item.children[j].attrs.style = item.children[j].attrs.style.replace(/grid-[^;]+;*/g, '') |
| | | if (item.children[j].r !== children.length) { |
| | | children.push({ |
| | | name: 'tr', |
| | | attrs: {}, |
| | | children: [item.children[j]] |
| | | }) |
| | | } else { |
| | | children[children.length - 1].children.push(item.children[j]) |
| | | } |
| | | } |
| | | item.children = children |
| | | } |
| | | } |
| | | html += '<' + item.name |
| | | for (const attr in item.attrs) { |
| | | let val = item.attrs[attr] |
| | | if (!val) continue |
| | | if (val === 'T' || val === true) { |
| | | // bool åçç¥å¼ |
| | | html += ' ' + attr |
| | | continue |
| | | } else if (item.name[0] === 't' && attr === 'style' && table) { |
| | | // åæ¶ä¸ºäºæ¾ç¤º table æ·»å ç style |
| | | val = val.replace(/;*display:table[^;]*/, '') |
| | | if (table.border) { |
| | | val = val.replace(/border[^;]+;*/g, $ => $.includes('collapse') ? $ : '') |
| | | } |
| | | if (table.cellpadding) { |
| | | val = val.replace(/padding[^;]+;*/g, '') |
| | | } |
| | | if (!val) continue |
| | | } |
| | | html += ' ' + attr + '="' + val.replace(/"/g, '"') + '"' |
| | | } |
| | | html += '>' |
| | | if (item.children) { |
| | | traversal(item.children, table) |
| | | html += '</' + item.name + '>' |
| | | } |
| | | } |
| | | } |
| | | })(vm.nodes) |
| | | |
| | | // å
¶ä»æä»¶å¤ç |
| | | for (let i = vm.plugins.length; i--;) { |
| | | if (vm.plugins[i].onGetContent) { |
| | | html = vm.plugins[i].onGetContent(html) || html |
| | | } |
| | | } |
| | | |
| | | return html |
| | | } |
| | | } |
| | | |
| | | Editable.prototype.onUpdate = function (content, config) { |
| | | if (this.vm.editable) { |
| | | this.vm._maskTap() |
| | | config.entities.amp = '&' |
| | | if (!this.inserting) { |
| | | this.vm._edit = undefined |
| | | if (!content) { |
| | | setTimeout(() => { |
| | | this.vm.$set(this.vm, 'nodes', [{ |
| | | name: 'p', |
| | | attrs: {}, |
| | | children: [{ |
| | | type: 'text', |
| | | text: '' |
| | | }] |
| | | }]) |
| | | }, 0) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | Editable.prototype.onParse = function (node) { |
| | | // 空ç½åå
æ ¼å¯ç¼è¾ |
| | | if (this.vm.editable && (node.name === 'td' || node.name === 'th') && !this.vm.getText(node.children)) { |
| | | node.children.push({ |
| | | type: 'text', |
| | | text: '' |
| | | }) |
| | | } |
| | | } |
| | | |
| | | module.exports = Editable |
New file |
| | |
| | | # emoji |
| | | åè½ï¼è§£æ *emoji* |
| | | 大å°ï¼*â3KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â | |
| | | |
| | | 说æï¼ |
| | | å°å½¢å¦ *[ç¬è¸]* çææ¬æ¿æ¢ä¸º *emoji* å符 ð |
| | | å¹é
模å¼å¯ä»¥éè¿ä¿®æ¹ *reg* åéå®ç° |
| | | é»è®¤é
ç½®äº *177* 个常ç¨ç *emoji* å°è¡¨æ
ï¼å¯ä»¥èªè¡æç
§éè¦ä¿®æ¹ *data* åé |
| | | |
| | | ?> ä¸ *editable* æä»¶å
±ç¨æ¶ï¼å¯¼åºç¼è¾å¥½ç *html* å
容ï¼ä¼å° *emoji* å符ç¼ç ä¸ºææ¬å½¢å¼ï¼ä¾¿äºåå¨ |
New file |
| | |
| | | /** |
| | | * @fileoverview emoji æä»¶ |
| | | */ |
| | | const reg = /\[(\S+?)\]/g |
| | | const data = { |
| | | ç¬è¸: 'ð', |
| | | çç
: 'ð·', |
| | | ç ´æ¶ä¸ºç¬: 'ð', |
| | | åè: 'ð', |
| | | è¸çº¢: 'ð³', |
| | | ææ§: 'ð±', |
| | | 失æ: 'ð', |
| | | æ è¯: 'ð', |
| | | ç¨ç¼: 'ð', |
| | | é
·: 'ð', |
| | | å: 'ð', |
| | | ç´è¿·: 'ð', |
| | | å»: 'ð', |
| | | æè: 'ð¤', |
| | | å°æ: 'ð', |
| | | é¢ å: 'ð', |
| | | é±: 'ð¤', |
| | | æè®¶: 'ð²', |
| | | ç½ç¼: 'ð', |
| | | 广°: 'ð¤', |
| | | ç¡è§: 'ð´', |
| | | 书åå: 'ð¤', |
| | | æ¤æ: 'ð¡', |
| | | 颿 表æ
: 'ð', |
| | | å¼ å´: 'ð®', |
| | | é使¸©: 'ð¤', |
| | | åå: 'ð¤®', |
| | | å
ç¯: 'ð', |
| | | å¹½çµ: 'ð»', |
| | | å¤æäºº: 'ð½', |
| | | æºå¨äºº: 'ð¤', |
| | | æç¼é: 'ð', |
| | | æè³æµ: 'ð', |
| | | æå´: 'ð', |
| | | å©´å¿: 'ð¶', |
| | | ç·å©: 'ð¦', |
| | | 女å©: 'ð§', |
| | | ç·äºº: 'ð¨', |
| | | 女人: 'ð©', |
| | | è人: 'ð´', |
| | | èå¦äºº: 'ðµ', |
| | | è¦å¯: 'ð®', |
| | | çå: 'ð¤´', |
| | | å
¬ä¸»: 'ð¤´', |
| | | 举æ: 'ð', |
| | | è·æ¥: 'ð', |
| | | å®¶åº: 'ðª', |
| | | ç¼ç: 'ð', |
| | | é¼»å: 'ð', |
| | | è³æµ: 'ð', |
| | | è头: 'ð
', |
| | | å´: 'ð', |
| | | å¿: 'â¤ï¸', |
| | | å¿ç¢: 'ð', |
| | | éªäºº: 'âï¸', |
| | | æ
书: 'ð', |
| | | 大便: 'ð©', |
| | | é¹é: 'â°', |
| | | ç¼é: 'ð', |
| | | é¨ä¼: 'âï¸', |
| | | é³ä¹: 'ðµ', |
| | | è¯ç: 'ð¤', |
| | | æ¸¸ææº: 'ð®', |
| | | åå: 'ð¢', |
| | | è³æº: 'ð§', |
| | | 礼ç©: 'ð', |
| | | çµè¯: 'ð', |
| | | çµè: 'ð»', |
| | | æå°æº: 'ð¨ï¸', |
| | | æçµç: 'ð¦', |
| | | ç¯æ³¡: 'ð¡', |
| | | 书æ¬: 'ð', |
| | | ä¿¡å°: 'âï¸', |
| | | è¯ä¸¸: 'ð', |
| | | å£çº¢: 'ð', |
| | | ææº: 'ð±', |
| | | ç¸æº: 'ð·', |
| | | çµè§: 'ðº', |
| | | ä¸: 'ð', |
| | | å徿¡¶: 'ð®', |
| | | åæ: 'ð¾', |
| | | æå¹å·: 'â', |
| | | ç¦: 'ð²', |
| | | å¯: 'ð', |
| | | 彩è¹: 'ð', |
| | | æé£: 'ð', |
| | | é·çµ: 'â¡', |
| | | éªè±: 'âï¸', |
| | | ææ: 'â', |
| | | æ°´æ»´: 'ð§', |
| | | ç«ç°: 'ð¹', |
| | | å æ²¹: 'ðª', |
| | | å·¦: 'ð', |
| | | å³: 'ð', |
| | | ä¸: 'ð', |
| | | ä¸: 'ð', |
| | | ææ: 'ðï¸', |
| | | 好ç: 'ð', |
| | | 好: 'ð', |
| | | å·®: 'ð', |
| | | èå©: 'â', |
| | | æ³å¤´: 'ð', |
| | | æ¥æ: 'ð', |
| | | 鼿: 'ð', |
| | | ç´å: 'ð', |
| | | ç: 'ð¶', |
| | | ç¼: 'ðº', |
| | | ç«: 'ð±', |
| | | èè: 'ð¯', |
| | | 马: 'ð', |
| | | ç¬è§å
½: 'ð¦', |
| | | æé©¬: 'ð¦', |
| | | 鹿: 'ð¦', |
| | | ç: 'ð®', |
| | | çª: 'ð·', |
| | | ç¾: 'ð', |
| | | é¿é¢é¹¿: 'ð¦', |
| | | 大象: 'ð', |
| | | èé¼ : 'ð', |
| | | èè : 'ð¦', |
| | | åºç¬: 'ð¦', |
| | | çç«: 'ð¼', |
| | | 鸽å: 'ðï¸', |
| | | é¸å: 'ð¦', |
| | | å
å: 'ð', |
| | | èé¹°: 'ð¦
', |
| | | éè: 'ð¸', |
| | | è: 'ð', |
| | | é¾: 'ð', |
| | | 鲸鱼: 'ð³', |
| | | æµ·è±: 'ð¬', |
| | | è¶³ç: 'â½', |
| | | æ£ç: 'â¾', |
| | | 篮ç: 'ð', |
| | | æç: 'ð', |
| | | æ©æ¦ç: 'ð', |
| | | ç½ç: 'ð¾', |
| | | 骰å: 'ð²', |
| | | 鸡è
¿: 'ð', |
| | | èç³: 'ð', |
| | | å¤é
: 'ðº', |
| | | 饺å: 'ð¥', |
| | | æ±å ¡: 'ð', |
| | | è¯æ¡: 'ð', |
| | | æå¤§å©é¢: 'ð', |
| | | å¹²æ¯: 'ð¥', |
| | | ç·å: 'ð¥¢', |
| | | ç³æ: 'ð¬', |
| | | 奶ç¶: 'ð¼', |
| | | çç±³è±: 'ð¿', |
| | | é®å±: 'ð¤', |
| | | å»é¢: 'ð¥', |
| | | é¶è¡: 'ð¦', |
| | | é
åº: 'ð¨', |
| | | 妿 ¡: 'ð«', |
| | | åå ¡: 'ð°', |
| | | ç«è½¦: 'ð', |
| | | é«é: 'ð', |
| | | å°é: 'ð', |
| | | å
¬äº¤: 'ð', |
| | | ææ¤è½¦: 'ð', |
| | | æ¶é²è½¦: 'ð', |
| | | è¦è½¦: 'ð', |
| | | åºç§è½¦: 'ð', |
| | | 汽车: 'ð', |
| | | 货车: 'ð', |
| | | èªè¡è½¦: 'ð²', |
| | | æ©æ: 'ðµ', |
| | | 红绿ç¯: 'ð¥', |
| | | å¸è¹: 'âµ', |
| | | 游轮: 'ð³ï¸', |
| | | è½®è¹: 'â´ï¸', |
| | | 飿º: 'âï¸', |
| | | ç´åæº: 'ð', |
| | | ç¼è½¦: 'ð ', |
| | | è¦å: 'â ï¸', |
| | | ç¦æ¢: 'â' |
| | | } |
| | | |
| | | function Emoji () { |
| | | |
| | | } |
| | | |
| | | Emoji.prototype.onUpdate = function (content) { |
| | | return content.replace(reg, ($, $1) => { |
| | | if (data[$1]) return data[$1] |
| | | return $ |
| | | }) |
| | | } |
| | | |
| | | Emoji.prototype.onGetContent = function (content) { |
| | | for (const item in data) { |
| | | content = content.replace(new RegExp(data[item], 'g'), '[' + item + ']') |
| | | } |
| | | return content |
| | | } |
| | | |
| | | module.exports = Emoji |
New file |
| | |
| | | # highlight |
| | | åè½ï¼ä»£ç åé«äº®æ¾ç¤º |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â | |
| | | |
| | | 说æï¼ |
| | | 大å°ï¼*â16KB* |
| | | ç¼è¾ *plugins/highlight/config.js* é¡¶é¨çé项ï¼å¯ä»¥éæ©æ¯å¦éè¦ä»¥ä¸åè½ï¼ |
| | | - *copyByLongPress* æ¯å¦éè¦é¿æä»£ç åæ¶æ¾ç¤ºå¤å¶ä»£ç å
容èåï¼*uni-app nvue* æä¸æ¯æï¼ |
| | | - *showLanguageName* æ¯å¦å¨ä»£ç åå³ä¸è§æ¾ç¤ºè¯è¨çåç§° |
| | | - *showLineNumber* æ¯å¦å¨å·¦ä¾§æ¾ç¤ºè¡å· |
| | | |
| | | > ä¿®æ¹è¯¥é
ç½®åéè¦éæ°çæç»ä»¶å
ï¼å¨æå»ºåçç»ä»¶å
ä¸ä¿®æ¹é
ç½®æ æ³çæ |
| | | |
| | | å¼å
¥æ¬æä»¶åï¼*html* ä¸ç¬¦å以䏿 ¼å¼ç *pre* å°è¢«é«äº®å¤çï¼ |
| | | ```html |
| | | <!-- pre ä¸å
å«ä¸ä¸ª codeï¼å¹¶å¨ pre æ code ç class ä¸è®¾ç½® language- --> |
| | | <pre><code class="language-css">p { color: red }</code></pre> |
| | | ``` |
| | | |
| | | > ä¸ *editable* æä»¶å
±ç¨æ¶ï¼ç¼è¾ç¶æä¸ï¼ä¸ä¼è¿è¡é«äº®ï¼å¯ä»¥ç´æ¥ä¿®æ¹ä»£ç ææ¬ |
| | | |
| | | > æ¬æä»¶çé«äº®åè½ä¾èµäº [prismjs](https://prismjs.com/)ï¼é»è®¤é
ç½®ä¸ä»
æ¯æ *html*ã*css*ã*c-like*ã*javascript* è¯è¨å *Tomorrow Night* 主é¢ï¼å¦æéè¦æ´å¤è¯è¨ææ´æ¢ä¸»é¢è¯·åå¾ [å®ç½](https://prismjs.com/download.html) ä¸è½½å¯¹åºç *prism.min.js* å *prism.css* å¹¶æ¿æ¢ *plugins/highlight/* ç®å½ä¸çæä»¶ |
New file |
| | |
| | | module.exports = { |
| | | copyByLongPress: false, // æ¯å¦éè¦é¿æä»£ç åæ¶æ¾ç¤ºå¤å¶ä»£ç å
容èå |
| | | showLanguageName: false, // æ¯å¦å¨ä»£ç åå³ä¸è§æ¾ç¤ºè¯è¨çåç§° |
| | | showLineNumber: false // æ¯å¦æ¾ç¤ºè¡å· |
| | | } |
New file |
| | |
| | | /** |
| | | * @fileoverview highlight æä»¶ |
| | | * Include prismjs (https://prismjs.com) |
| | | */ |
| | | const prism = require('./prism.min') |
| | | const config = require('./config') |
| | | const Parser = require('../parser') |
| | | |
| | | function Highlight (vm) { |
| | | this.vm = vm |
| | | } |
| | | |
| | | Highlight.prototype.onParse = function (node, vm) { |
| | | if (node.name === 'pre') { |
| | | if (vm.options.editable) { |
| | | node.attrs.class = (node.attrs.class || '') + ' hl-pre' |
| | | return |
| | | } |
| | | let i |
| | | for (i = node.children.length; i--;) { |
| | | if (node.children[i].name === 'code') break |
| | | } |
| | | if (i === -1) return |
| | | const code = node.children[i] |
| | | let className = code.attrs.class + ' ' + node.attrs.class |
| | | i = className.indexOf('language-') |
| | | if (i === -1) { |
| | | i = className.indexOf('lang-') |
| | | if (i === -1) { |
| | | className = 'language-text' |
| | | i = 9 |
| | | } else { |
| | | i += 5 |
| | | } |
| | | } else { |
| | | i += 9 |
| | | } |
| | | let j |
| | | for (j = i; j < className.length; j++) { |
| | | if (className[j] === ' ') break |
| | | } |
| | | const lang = className.substring(i, j) |
| | | if (code.children.length) { |
| | | const text = this.vm.getText(code.children).replace(/&/g, '&') |
| | | if (!text) return |
| | | if (node.c) { |
| | | node.c = undefined |
| | | } |
| | | if (prism.languages[lang]) { |
| | | code.children = (new Parser(this.vm).parse( |
| | | // å ä¸å± pre ä¿ç空ç½ç¬¦ |
| | | '<pre>' + prism.highlight(text, prism.languages[lang], lang).replace(/token /g, 'hl-') + '</pre>'))[0].children |
| | | } |
| | | node.attrs.class = 'hl-pre' |
| | | code.attrs.class = 'hl-code' |
| | | if (config.showLanguageName) { |
| | | node.children.push({ |
| | | name: 'div', |
| | | attrs: { |
| | | class: 'hl-language', |
| | | style: 'user-select:none' |
| | | }, |
| | | children: [{ |
| | | type: 'text', |
| | | text: lang |
| | | }] |
| | | }) |
| | | } |
| | | if (config.copyByLongPress) { |
| | | node.attrs.style += (node.attrs.style || '') + ';user-select:none' |
| | | node.attrs['data-content'] = text |
| | | vm.expose() |
| | | } |
| | | if (config.showLineNumber) { |
| | | const line = text.split('\n').length; const children = [] |
| | | for (let k = line; k--;) { |
| | | children.push({ |
| | | name: 'span', |
| | | attrs: { |
| | | class: 'span' |
| | | } |
| | | }) |
| | | } |
| | | node.children.push({ |
| | | name: 'span', |
| | | attrs: { |
| | | class: 'line-numbers-rows' |
| | | }, |
| | | children |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | module.exports = Highlight |
New file |
| | |
| | | const config = require('../config') |
| | | |
| | | const build = { |
| | | import: 'prism.css', |
| | | handler (file) { |
| | | if (file.path.includes('prism.css')) { |
| | | // å°æ ç¾åéæ©å¨å屿§éæ©å¨è½¬ä¸º class éæ©å¨ï¼ç»ä»¶å
ä»
æ¯æ class éæ©å¨ï¼ |
| | | file.contents = Buffer.from(file.contents.toString().replace(/pre([[)])/g, '.hl-pre$1').replace(/code/g, '.hl-code').replace(/\[class\*="?language-"?\]/g, '').replace(/:not[^,}]+[,}]*/g, '').replace(/\.token\./g, '.hl-')) |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (config.showLanguageName || config.showLineNumber) { |
| | | // pre å
é¨ç code è¿è¡æ»å¨ï¼é¿å
è¡å·åè¯è¨åç§°è·éæ»å¨ |
| | | build.style = `.hl-pre { |
| | | position: relative; |
| | | } |
| | | .hl-code { |
| | | overflow: auto; |
| | | display: block; |
| | | }` |
| | | } |
| | | |
| | | if (config.copyByLongPress) { |
| | | build.template = '<rich-text wx:if="{{n.attrs[\'data-content\']}}" nodes="{{[n]}}" data-content="{{n.attrs[\'data-content\']}}" data-lang="{{n.attrs[\'data-lang\']}}" bindlongpress="copyCode" />' |
| | | build.methods = { |
| | | copyCode (e) { |
| | | wx.showActionSheet({ |
| | | itemList: ['å¤å¶ä»£ç '], |
| | | success: () => |
| | | wx.setClipboardData({ |
| | | data: e.currentTarget.dataset.content |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (config.showLanguageName) { |
| | | build.style = (build.style || '') + |
| | | `.hl-language { |
| | | font-size: 12px; |
| | | font-weight: 600; |
| | | position: absolute; |
| | | right: 8px; |
| | | text-align: right; |
| | | top: 3px; |
| | | } |
| | | .hl-pre { |
| | | padding-top: 1.5em; |
| | | }` |
| | | } |
| | | |
| | | if (config.showLineNumber) { |
| | | build.style = (build.style || '') + |
| | | `.hl-pre { |
| | | font-size: 14px; |
| | | padding-left: 3.8em; |
| | | counter-reset: linenumber; |
| | | } |
| | | .line-numbers-rows { |
| | | position: absolute; |
| | | pointer-events: none; |
| | | top: ${config.showLanguageName ? 1.5 : 1}em; |
| | | font-size: 100%; |
| | | left: 0; |
| | | width: 3em; /* works for line-numbers below 1000 lines */ |
| | | letter-spacing: -1px; |
| | | border-right: 1px solid #999; |
| | | -webkit-user-select: none; |
| | | -moz-user-select: none; |
| | | -ms-user-select: none; |
| | | user-select: none; |
| | | } |
| | | .line-numbers-rows .span { |
| | | display: block; |
| | | counter-increment: linenumber; |
| | | } |
| | | .line-numbers-rows .span:before { |
| | | content: counter(linenumber); |
| | | color: #999; |
| | | display: block; |
| | | padding-right: 0.8em; |
| | | text-align: right; |
| | | }` |
| | | } |
| | | |
| | | module.exports = build |
New file |
| | |
| | | /* PrismJS 1.22.0 |
| | | https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript */ |
| | | /** |
| | | * prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML |
| | | * Based on https://github.com/chriskempson/tomorrow-theme |
| | | * @author Rose Pritchard |
| | | */ |
| | | |
| | | code[class*="language-"], |
| | | pre[class*="language-"] { |
| | | color: #ccc; |
| | | background: none; |
| | | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; |
| | | font-size: 1em; |
| | | text-align: left; |
| | | white-space: pre; |
| | | word-spacing: normal; |
| | | word-break: normal; |
| | | word-wrap: normal; |
| | | line-height: 1.5; |
| | | |
| | | -moz-tab-size: 4; |
| | | -o-tab-size: 4; |
| | | tab-size: 4; |
| | | |
| | | -webkit-hyphens: none; |
| | | -moz-hyphens: none; |
| | | -ms-hyphens: none; |
| | | hyphens: none; |
| | | |
| | | } |
| | | |
| | | /* Code blocks */ |
| | | pre[class*="language-"] { |
| | | padding: 1em; |
| | | margin: .5em 0; |
| | | overflow: auto; |
| | | } |
| | | |
| | | :not(pre) > code[class*="language-"], |
| | | pre[class*="language-"] { |
| | | background: #2d2d2d; |
| | | } |
| | | |
| | | /* Inline code */ |
| | | :not(pre) > code[class*="language-"] { |
| | | padding: .1em; |
| | | border-radius: .3em; |
| | | white-space: normal; |
| | | } |
| | | |
| | | .token.comment, |
| | | .token.block-comment, |
| | | .token.prolog, |
| | | .token.doctype, |
| | | .token.cdata { |
| | | color: #999; |
| | | } |
| | | |
| | | .token.punctuation { |
| | | color: #ccc; |
| | | } |
| | | |
| | | .token.tag, |
| | | .token.attr-name, |
| | | .token.namespace, |
| | | .token.deleted { |
| | | color: #e2777a; |
| | | } |
| | | |
| | | .token.function-name { |
| | | color: #6196cc; |
| | | } |
| | | |
| | | .token.boolean, |
| | | .token.number, |
| | | .token.function { |
| | | color: #f08d49; |
| | | } |
| | | |
| | | .token.property, |
| | | .token.class-name, |
| | | .token.constant, |
| | | .token.symbol { |
| | | color: #f8c555; |
| | | } |
| | | |
| | | .token.selector, |
| | | .token.important, |
| | | .token.atrule, |
| | | .token.keyword, |
| | | .token.builtin { |
| | | color: #cc99cd; |
| | | } |
| | | |
| | | .token.string, |
| | | .token.char, |
| | | .token.attr-value, |
| | | .token.regex, |
| | | .token.variable { |
| | | color: #7ec699; |
| | | } |
| | | |
| | | .token.operator, |
| | | .token.entity, |
| | | .token.url { |
| | | color: #67cdcc; |
| | | } |
| | | |
| | | .token.important, |
| | | .token.bold { |
| | | font-weight: bold; |
| | | } |
| | | .token.italic { |
| | | font-style: italic; |
| | | } |
| | | |
| | | .token.entity { |
| | | cursor: help; |
| | | } |
| | | |
| | | .token.inserted { |
| | | color: green; |
| | | } |
| | | |
New file |
| | |
| | | /*! PrismJS 1.22.0 |
| | | https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript */ |
| | | var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(u){var c=/\blang(?:uage)?-([\w-]+)\b/i,n=0,M={manual:u.Prism&&u.Prism.manual,disableWorkerMessageHandler:u.Prism&&u.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof W?new W(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function t(e,r){var a,n;switch(r=r||{},M.util.type(e)){case"Object":if(n=M.util.objId(e),r[n])return r[n];for(var i in a={},r[n]=a,e)e.hasOwnProperty(i)&&(a[i]=t(e[i],r));return a;case"Array":return n=M.util.objId(e),r[n]?r[n]:(a=[],r[n]=a,e.forEach(function(e,n){a[n]=t(e,r)}),a);default:return e}},getLanguage:function(e){for(;e&&!c.test(e.className);)e=e.parentElement;return e?(e.className.match(c)||[,"none"])[1].toLowerCase():"none"},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(e){var n=(/at [^(\r\n]*\((.*):.+:.+\)$/i.exec(e.stack)||[])[1];if(n){var t=document.getElementsByTagName("script");for(var r in t)if(t[r].src==n)return t[r]}return null}},isActive:function(e,n,t){for(var r="no-"+n;e;){var a=e.classList;if(a.contains(n))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!t}},languages:{extend:function(e,n){var t=M.util.clone(M.languages[e]);for(var r in n)t[r]=n[r];return t},insertBefore:function(t,e,n,r){var a=(r=r||M.languages)[t],i={};for(var l in a)if(a.hasOwnProperty(l)){if(l==e)for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o]);n.hasOwnProperty(l)||(i[l]=a[l])}var s=r[t];return r[t]=i,M.languages.DFS(M.languages,function(e,n){n===s&&e!=t&&(this[e]=i)}),i},DFS:function e(n,t,r,a){a=a||{};var i=M.util.objId;for(var l in n)if(n.hasOwnProperty(l)){t.call(n,l,n[l],r||l);var o=n[l],s=M.util.type(o);"Object"!==s||a[i(o)]?"Array"!==s||a[i(o)]||(a[i(o)]=!0,e(o,t,l,a)):(a[i(o)]=!0,e(o,t,null,a))}}},plugins:{},highlightAll:function(e,n){M.highlightAllUnder(document,e,n)},highlightAllUnder:function(e,n,t){var r={callback:t,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};M.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),M.hooks.run("before-all-elements-highlight",r);for(var a,i=0;a=r.elements[i++];)M.highlightElement(a,!0===n,r.callback)},highlightElement:function(e,n,t){var r=M.util.getLanguage(e),a=M.languages[r];e.className=e.className.replace(c,"").replace(/\s+/g," ")+" language-"+r;var i=e.parentElement;i&&"pre"===i.nodeName.toLowerCase()&&(i.className=i.className.replace(c,"").replace(/\s+/g," ")+" language-"+r);var l={element:e,language:r,grammar:a,code:e.textContent};function o(e){l.highlightedCode=e,M.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,M.hooks.run("after-highlight",l),M.hooks.run("complete",l),t&&t.call(l.element)}if(M.hooks.run("before-sanity-check",l),!l.code)return M.hooks.run("complete",l),void(t&&t.call(l.element));if(M.hooks.run("before-highlight",l),l.grammar)if(n&&u.Worker){var s=new Worker(M.filename);s.onmessage=function(e){o(e.data)},s.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else o(M.highlight(l.code,l.grammar,l.language));else o(M.util.encode(l.code))},highlight:function(e,n,t){var r={code:e,grammar:n,language:t};return M.hooks.run("before-tokenize",r),r.tokens=M.tokenize(r.code,r.grammar),M.hooks.run("after-tokenize",r),W.stringify(M.util.encode(r.tokens),r.language)},tokenize:function(e,n){var t=n.rest;if(t){for(var r in t)n[r]=t[r];delete n.rest}var a=new i;return I(a,a.head,e),function e(n,t,r,a,i,l){for(var o in r)if(r.hasOwnProperty(o)&&r[o]){var s=r[o];s=Array.isArray(s)?s:[s];for(var u=0;u<s.length;++u){if(l&&l.cause==o+","+u)return;var c=s[u],g=c.inside,f=!!c.lookbehind,h=!!c.greedy,d=0,v=c.alias;if(h&&!c.pattern.global){var p=c.pattern.toString().match(/[imsuy]*$/)[0];c.pattern=RegExp(c.pattern.source,p+"g")}for(var m=c.pattern||c,y=a.next,k=i;y!==t.tail&&!(l&&k>=l.reach);k+=y.value.length,y=y.next){var b=y.value;if(t.length>n.length)return;if(!(b instanceof W)){var x=1;if(h&&y!=t.tail.prev){m.lastIndex=k;var w=m.exec(n);if(!w)break;var A=w.index+(f&&w[1]?w[1].length:0),P=w.index+w[0].length,S=k;for(S+=y.value.length;S<=A;)y=y.next,S+=y.value.length;if(S-=y.value.length,k=S,y.value instanceof W)continue;for(var E=y;E!==t.tail&&(S<P||"string"==typeof E.value);E=E.next)x++,S+=E.value.length;x--,b=n.slice(k,S),w.index-=k}else{m.lastIndex=0;var w=m.exec(b)}if(w){f&&(d=w[1]?w[1].length:0);var A=w.index+d,O=w[0].slice(d),P=A+O.length,L=b.slice(0,A),N=b.slice(P),j=k+b.length;l&&j>l.reach&&(l.reach=j);var C=y.prev;L&&(C=I(t,C,L),k+=L.length),z(t,C,x);var _=new W(o,g?M.tokenize(O,g):O,v,O);y=I(t,C,_),N&&I(t,y,N),1<x&&e(n,t,r,y.prev,k,{cause:o+","+u,reach:j})}}}}}}(e,a,n,a.head,0),function(e){var n=[],t=e.head.next;for(;t!==e.tail;)n.push(t.value),t=t.next;return n}(a)},hooks:{all:{},add:function(e,n){var t=M.hooks.all;t[e]=t[e]||[],t[e].push(n)},run:function(e,n){var t=M.hooks.all[e];if(t&&t.length)for(var r,a=0;r=t[a++];)r(n)}},Token:W};function W(e,n,t,r){this.type=e,this.content=n,this.alias=t,this.length=0|(r||"").length}function i(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function I(e,n,t){var r=n.next,a={value:t,prev:n,next:r};return n.next=a,r.prev=a,e.length++,a}function z(e,n,t){for(var r=n.next,a=0;a<t&&r!==e.tail;a++)r=r.next;(n.next=r).prev=n,e.length-=a}if(u.Prism=M,W.stringify=function n(e,t){if("string"==typeof e)return e;if(Array.isArray(e)){var r="";return e.forEach(function(e){r+=n(e,t)}),r}var a={type:e.type,content:n(e.content,t),tag:"span",classes:["token",e.type],attributes:{},language:t},i=e.alias;i&&(Array.isArray(i)?Array.prototype.push.apply(a.classes,i):a.classes.push(i)),M.hooks.run("wrap",a);var l="";for(var o in a.attributes)l+=" "+o+'="'+(a.attributes[o]||"").replace(/"/g,""")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+l+">"+a.content+"</"+a.tag+">"},!u.document)return u.addEventListener&&(M.disableWorkerMessageHandler||u.addEventListener("message",function(e){var n=JSON.parse(e.data),t=n.language,r=n.code,a=n.immediateClose;u.postMessage(M.highlight(r,M.languages[t],t)),a&&u.close()},!1)),M;var e=M.util.currentScript();function t(){M.manual||M.highlightAll()}if(e&&(M.filename=e.src,e.hasAttribute("data-manual")&&(M.manual=!0)),!M.manual){var r=document.readyState;"loading"===r||"interactive"===r&&e&&e.defer?document.addEventListener("DOMContentLoaded",t):window.requestAnimationFrame?window.requestAnimationFrame(t):window.setTimeout(t,16)}return M}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); |
| | | Prism.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/,name:/[^\s<>'"]+/}},cdata:/<!\[CDATA\[[\s\S]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(a,e){var s={};s["language-"+e]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[e]},s.cdata=/^<!\[CDATA\[|\]\]>$/i;var n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:s}};n["language-"+e]={pattern:/[\s\S]+/,inside:Prism.languages[e]};var t={};t[a]={pattern:RegExp("(<__[^]*?>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])*?(?=</__>)".replace(/__/g,function(){return a}),"i"),lookbehind:!0,greedy:!0,inside:n},Prism.languages.insertBefore("markup","cdata",t)}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml; |
| | | !function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+[\s\S]*?(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\((?!\s*\))\s*)(?:[^()]|\((?:[^()]|\([^()]*\))*\))+?(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|(?:[^\\\\\r\n()\"']|\\\\[^])*)\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:RegExp("[^{}\\s](?:[^{};\"']|"+t.source+")*?(?=\\s*\\{)"),string:{pattern:t,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var s=e.languages.markup;s&&(s.tag.addInlined("style","css"),e.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/(^|["'\s])style\s*=\s*(?:"[^"]*"|'[^']*')/i,lookbehind:!0,inside:{"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{style:{pattern:/(["'])[\s\S]+(?=["']$)/,lookbehind:!0,alias:"language-css",inside:e.languages.css},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},"attr-name":/^style/i}}},s.tag))}(Prism); |
| | | Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}; |
| | | Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|(?:get|set)(?=\s*[\[$\w\xA0-\uFFFF])|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,function:/#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-flags":/[a-z]+$/,"regex-delimiter":/^\/|\/$/}},"function-variable":{pattern:/#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.js=Prism.languages.javascript; |
New file |
| | |
| | | const config = require('../config') |
| | | |
| | | const build = { |
| | | import: 'prism.css', |
| | | handler (file) { |
| | | if (file.path.includes('prism.css')) { |
| | | // å°æ ç¾åéæ©å¨å屿§éæ©å¨è½¬ä¸º class éæ©å¨ï¼ç»ä»¶å
ä»
æ¯æ class éæ©å¨ï¼ |
| | | file.contents = Buffer.from(file.contents.toString().replace(/pre([[)])/g, '.hl-pre$1').replace(/code/g, '.hl-code').replace(/\[class\*="?language-"?\]/g, '').replace(/:not[^,}]+[,}]*/g, '').replace(/\.token\./g, '.hl-')) |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (config.showLanguageName || config.showLineNumber) { |
| | | // pre å
é¨ç code è¿è¡æ»å¨ï¼é¿å
è¡å·åè¯è¨åç§°è·éæ»å¨ |
| | | build.style = `.hl-pre { |
| | | position: relative; |
| | | } |
| | | .hl-code { |
| | | overflow: auto; |
| | | display: block; |
| | | }` |
| | | } |
| | | |
| | | if (config.copyByLongPress) { |
| | | build.template = '<rich-text v-if="n.attrs&&n.attrs[\'data-content\']" :nodes="[n]" :data-content="n.attrs[\'data-content\']" :data-lang="n.attrs[\'data-lang\']" @longpress="copyCode" />' |
| | | build.methods = { |
| | | copyCode (e) { |
| | | uni.showActionSheet({ |
| | | itemList: ['å¤å¶ä»£ç '], |
| | | success: () => |
| | | uni.setClipboardData({ |
| | | data: e.currentTarget.dataset.content |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (config.showLanguageName) { |
| | | build.style = (build.style || '') + |
| | | `.hl-language { |
| | | font-size: 12px; |
| | | font-weight: 600; |
| | | position: absolute; |
| | | right: 8px; |
| | | text-align: right; |
| | | top: 3px; |
| | | } |
| | | .hl-pre { |
| | | padding-top: 1.5em; |
| | | }` |
| | | } |
| | | |
| | | if (config.showLineNumber) { |
| | | build.style = (build.style || '') + |
| | | `.hl-pre { |
| | | font-size: 14px; |
| | | padding-left: 3.8em; |
| | | counter-reset: linenumber; |
| | | } |
| | | .line-numbers-rows { |
| | | position: absolute; |
| | | pointer-events: none; |
| | | top: ${config.showLanguageName ? 1.5 : 1}em; |
| | | font-size: 100%; |
| | | left: 0; |
| | | width: 3em; /* works for line-numbers below 1000 lines */ |
| | | letter-spacing: -1px; |
| | | border-right: 1px solid #999; |
| | | -webkit-user-select: none; |
| | | -moz-user-select: none; |
| | | -ms-user-select: none; |
| | | user-select: none; |
| | | } |
| | | .line-numbers-rows .span { |
| | | display: block; |
| | | counter-increment: linenumber; |
| | | } |
| | | .line-numbers-rows .span:before { |
| | | content: counter(linenumber); |
| | | color: #999; |
| | | display: block; |
| | | padding-right: 0.8em; |
| | | text-align: right; |
| | | }` |
| | | } |
| | | |
| | | module.exports = build |
New file |
| | |
| | | åè½ï¼å¾çæ¬å°ç¼å |
| | | 大å°ï¼*â4KB* |
| | | ä½è
ï¼[@PentaTea](https://github.com/PentaTea) |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | | | | | | â(ä»
æ¯æ app ç vue 页é¢) | |
| | | |
| | | 说æï¼ |
| | | å¼å
¥æ¬æä»¶åï¼ä¼ç»ç»ä»¶æ·»å ä¸ä¸ª *img-cache* 屿§ï¼å°è¯¥å±æ§è®¾ç½®ä¸º *true* åï¼å°èªå¨ä¸è½½å¼ç¨çå¾çå¹¶å° *src* 屿§æ´æ¢ä¸ºæ¬å°å°å |
| | | åæ¶å¨ç»ä»¶å®ä¾ä¸æè½½äº *imgCache* å¯¹è±¡ï¼æ©å
ç¼åæ§å¶è½å |
| | | |
| | | *imgCache* å¯¹è±¡å±æ§åæ¹æ³ï¼ |
| | | |
| | | | 屿§ | åè½ | |
| | | |:---:|:---:| |
| | | | list | å½åç¼åç url å表 | |
| | | | get(url) | ä¼ å
¥ url è·å¾æ¬å°å°å | |
| | | | delete(url) | ä¼ å
¥ url å é¤ç¼åè®°å½ | |
| | | | add(url) | ä¼ å
¥ url å¹¶ä¸è½½ç®æ 为ç¼å | |
| | | | clear() | æ¸
空ææç¼å | |
| | | |
| | | !> 请尽éç¡®ä¿ *src* ä¸å«ææä»¶åç¼åï¼ä¸ä»¥åç¼ç»å°¾ä¹æ²¡å
³ç³»ï¼æä»¶ä¼ä»è·¯å¾ä¸æ¨æµåççå¾çåç¼ï¼å¦æå®å
¨ä¸å
å«åç¼ä¿¡æ¯å¯è½ä¼æ æ³ä¿åå°ç¸å |
New file |
| | |
| | | module.exports = { |
| | | main: 'index.js', |
| | | platform: ['uni-app'], |
| | | handler (file, platform) { |
| | | if (platform === 'uni-app') { |
| | | // æ·»å img-cache 屿§ |
| | | if (file.path.includes('mp-html.vue')) { |
| | | file.contents = Buffer.from( |
| | | file.contents |
| | | .toString() |
| | | .replace(/props\s*:\s*{/, 'props: {\n ImgCache: Boolean,') |
| | | ) |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | const data = { |
| | | name: 'imgcache', |
| | | prefix: 'imgcache_' |
| | | } |
| | | function ImgCache (vm) { |
| | | this.vm = vm // ä¿åå®ä¾å¨å
¶ä»å¨æä½¿ç¨ |
| | | this.i = 0 // ç¨äºæ 记第å å¼ å¾ |
| | | vm.imgCache = { |
| | | get list () { |
| | | return uni |
| | | .getStorageInfoSync() |
| | | .keys.filter((key) => key.startsWith(data.prefix)) |
| | | .map((key) => key.split(data.prefix)[1]) |
| | | }, |
| | | get (url) { |
| | | return uni.getStorageSync(data.prefix + url) |
| | | }, |
| | | delete (url) { |
| | | const path = uni.getStorageSync(data.prefix + url) |
| | | if (!path) return false |
| | | plus.io.resolveLocalFileSystemURL(path, (entry) => { |
| | | entry.remove() |
| | | }) |
| | | uni.removeStorageSync(data.prefix + url) |
| | | return true |
| | | }, |
| | | async add (url) { |
| | | const filename = await download(url) |
| | | if (filename) { |
| | | uni.setStorageSync(data.prefix + url, filename) |
| | | return 'file://' + plus.io.convertLocalFileSystemURL(filename) |
| | | } |
| | | return null |
| | | }, |
| | | clear () { |
| | | uni |
| | | .getStorageInfoSync() |
| | | .keys.filter((key) => key.startsWith(data.prefix)) |
| | | .forEach((key) => { |
| | | uni.removeStorageSync(key) |
| | | }) |
| | | |
| | | plus.io.resolveLocalFileSystemURL(`_doc/${data.name}/`, (entry) => { |
| | | entry.removeRecursively( |
| | | (entry) => { |
| | | console.log(`${data.name}ç¼åå 餿å`, entry) |
| | | }, |
| | | (e) => { |
| | | console.log(`${data.name}ç¼åå é¤å¤±è´¥`, e) |
| | | } |
| | | ) |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | // #ifdef APP-PLUS |
| | | ImgCache.prototype.onParse = function (node, parser) { |
| | | // å¯ç¨æ¬æä»¶ && è§£æå¾çæ ç¾ && æ¥æsrc屿§ && æ¯ç½ç»å¾ç |
| | | if ( |
| | | this.vm.ImgCache && |
| | | node.name === 'img' && |
| | | node.attrs.src && |
| | | /^https?:\/\//.test(node.attrs.src) |
| | | ) { |
| | | const src = node.attrs.src |
| | | node.attrs.src = '' |
| | | node.attrs.i = this.vm.imgList.length + this.i++ |
| | | parser.expose() |
| | | |
| | | async function getUrl (path) { |
| | | if (await resolveFile(path)) return path |
| | | const filename = await download(src) |
| | | filename && uni.setStorageSync(data.prefix + src, filename) |
| | | return filename |
| | | } |
| | | |
| | | uni.getStorage({ |
| | | key: data.prefix + src, |
| | | success: async (res) => { |
| | | const path = await getUrl(res.data) |
| | | const url = path |
| | | ? 'file://' + plus.io.convertLocalFileSystemURL(path) |
| | | : src |
| | | node.attrs.src = url |
| | | this.vm.imgList[node.attrs.i] = path || src |
| | | }, |
| | | fail: async () => { |
| | | const path = await getUrl() |
| | | const url = path |
| | | ? 'file://' + plus.io.convertLocalFileSystemURL(path) |
| | | : src |
| | | node.attrs.src = url |
| | | this.vm.imgList[node.attrs.i] = path || src |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | const taskQueue = new Set() |
| | | |
| | | function download (url) { |
| | | return new Promise((resolve) => { |
| | | if (taskQueue.has(url)) return |
| | | taskQueue.add(url) |
| | | const suffix = /.+\.(jpg|jpeg|png|bmp|gif|webp)/.exec(url) |
| | | const name = `${makeid(8)}_${Date.now()}${suffix ? '.' + suffix[1] : ''}` |
| | | const task = plus.downloader.createDownload( |
| | | url, |
| | | { filename: `_doc/${data.name}/${name}` }, |
| | | (download, status) => { |
| | | taskQueue.delete(url) |
| | | resolve(status === 200 ? download.filename : null) |
| | | } |
| | | ) |
| | | task.start() |
| | | }) |
| | | } |
| | | |
| | | // 夿æä»¶åå¨ |
| | | function resolveFile (url) { |
| | | return new Promise((resolve) => { |
| | | plus.io.resolveLocalFileSystemURL(url, resolve, () => resolve(null)) |
| | | }) |
| | | } |
| | | |
| | | // çæuuid |
| | | function makeid (length) { |
| | | let result = '' |
| | | const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' |
| | | for (let i = 0; i < length; i++) { |
| | | result += characters.charAt(Math.floor(Math.random() * characters.length)) |
| | | } |
| | | return result |
| | | } |
| | | // #endif |
| | | |
| | | module.exports = ImgCache |
New file |
| | |
| | | # latex |
| | | åè½ï¼æ¸²æ *latex* å
¬å¼ |
| | | 大å°ï¼**â300KB** |
| | | ä½è
ï¼[@Zeng-J](https://github.com/Zeng-J) |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â | |
| | | |
| | | 说æï¼ |
| | | å¼å
¥æ¬æä»¶åï¼ä¼å° *$xxx$* çææ¬å
容æç
§ *latex* è§åè¿è¡è§£æå渲æ |
| | | |
| | | > ä¸ *editable* æä»¶å
±ç¨æ¶ï¼ç¼è¾ç¶æä¸ï¼å
¬å¼ä¸ä¼æ¸²æï¼å¯ä»¥ç´æ¥ä¿®æ¹å
¬å¼ææ¬ |
| | | |
| | | > æ¬æä»¶éè¿ [katex-mini](https://github.com/rojer95/katex-mini) è§£æ *latex* ææ¬ï¼[å使件](https://github.com/KaTeX/KaTeX/tree/main/fonts) 建议èªè¡è½¬å |
New file |
| | |
| | | module.exports = { |
| | | import: 'katex.css', |
| | | handler (file) { |
| | | if (file.isBuffer()) { |
| | | let content = file.contents.toString() |
| | | if (file.basename === 'node.wxml') { |
| | | content = content.replace(/(n.?)\.name==='a'\|\|/g, "$1.name==='a'||$1.l||") |
| | | } else if (file.basename === 'node.vue') { |
| | | content = content.replace(/!handler.isInline\((.*?)\)/, '(n.l||!handler.isInline($1))') |
| | | } |
| | | file.contents = Buffer.from(content) |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * @fileoverview latex æä»¶ |
| | | * katex.min.jsæ¥æº https://github.com/rojer95/katex-mini |
| | | */ |
| | | const parse = require('./katex.min') |
| | | |
| | | function Latex () { |
| | | |
| | | } |
| | | |
| | | Latex.prototype.onParse = function (node, vm) { |
| | | // $...$å
裹çå
容为latexå
¬å¼ |
| | | if (!vm.options.editable && node.type === 'text' && node.text.includes('$')) { |
| | | const part = node.text.split(/(\${1,2})/) |
| | | const children = [] |
| | | let status = 0 |
| | | for (let i = 0; i < part.length; i++) { |
| | | if (i % 2 === 0) { |
| | | // ææ¬å
容 |
| | | if (part[i]) { |
| | | if (status === 0) { |
| | | children.push({ |
| | | type: 'text', |
| | | text: part[i] |
| | | }) |
| | | } else { |
| | | if (status === 1) { |
| | | // è¡å
å
¬å¼ |
| | | const nodes = parse.default(part[i]) |
| | | children.push({ |
| | | name: 'span', |
| | | attrs: {}, |
| | | l: 'T', |
| | | f: 'display:inline-block', |
| | | children: nodes |
| | | }) |
| | | } else { |
| | | // åå
¬å¼ |
| | | const nodes = parse.default(part[i], { |
| | | displayMode: true |
| | | }) |
| | | children.push({ |
| | | name: 'div', |
| | | attrs: { |
| | | style: 'text-align:center' |
| | | }, |
| | | children: nodes |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | // åé符 |
| | | if (part[i] === '$' && part[i + 2] === '$') { |
| | | // è¡å
å
¬å¼ |
| | | status = 1 |
| | | part[i + 2] = '' |
| | | } else if (part[i] === '$$' && part[i + 2] === '$$') { |
| | | // åå
¬å¼ |
| | | status = 2 |
| | | part[i + 2] = '' |
| | | } else { |
| | | if (part[i] && part[i] !== '$$') { |
| | | // æ®é$ç¬¦å· |
| | | part[i + 1] = part[i] + part[i + 1] |
| | | } |
| | | // éç½®ç¶æ |
| | | status = 0 |
| | | } |
| | | } |
| | | } |
| | | delete node.type |
| | | delete node.text |
| | | node.name = 'span' |
| | | node.attrs = {} |
| | | node.children = children |
| | | } |
| | | } |
| | | |
| | | module.exports = Latex |
New file |
| | |
| | | /* fontsåä½åºå¯èªè¡åå¾ https://github.com/KaTeX/KaTeX/tree/main/fonts ä¸è½½ï¼æ¾å
¥èªå®¶çcdnæå¡ä¸ */ |
| | | @font-face { |
| | | font-family: "KaTeX_AMS"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_AMS-Regular.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_AMS-Regular.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_AMS-Regular.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Caligraphic"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Caligraphic-Bold.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Caligraphic-Bold.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Caligraphic-Bold.ttf") format("truetype"); |
| | | font-weight: bold; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Caligraphic"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Caligraphic-Regular.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Caligraphic-Regular.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Caligraphic-Regular.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Fraktur"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Fraktur-Bold.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Fraktur-Bold.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Fraktur-Bold.ttf") format("truetype"); |
| | | font-weight: bold; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Fraktur"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Fraktur-Regular.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Fraktur-Regular.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Fraktur-Regular.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Main"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Main-Bold.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Main-Bold.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Main-Bold.ttf") format("truetype"); |
| | | font-weight: bold; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Main"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Main-BoldItalic.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Main-BoldItalic.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Main-BoldItalic.ttf") format("truetype"); |
| | | font-weight: bold; |
| | | font-style: italic; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Main"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Main-Italic.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Main-Italic.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Main-Italic.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: italic; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Main"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Main-Regular.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Main-Regular.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Main-Regular.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Math"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Math-BoldItalic.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Math-BoldItalic.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Math-BoldItalic.ttf") format("truetype"); |
| | | font-weight: bold; |
| | | font-style: italic; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Math"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Math-Italic.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Math-Italic.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Math-Italic.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: italic; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_SansSerif"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_SansSerif-Bold.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_SansSerif-Bold.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_SansSerif-Bold.ttf") format("truetype"); |
| | | font-weight: bold; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_SansSerif"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_SansSerif-Italic.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_SansSerif-Italic.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_SansSerif-Italic.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: italic; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_SansSerif"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_SansSerif-Regular.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_SansSerif-Regular.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_SansSerif-Regular.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Script"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Script-Regular.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Script-Regular.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Script-Regular.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Size1"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Size1-Regular.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Size1-Regular.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Size1-Regular.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Size2"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Size2-Regular.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Size2-Regular.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Size2-Regular.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Size3"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Size3-Regular.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Size3-Regular.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Size3-Regular.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Size4"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Size4-Regular.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Size4-Regular.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Size4-Regular.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: normal; |
| | | } |
| | | @font-face { |
| | | font-family: "KaTeX_Typewriter"; |
| | | src: url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Typewriter-Regular.woff2") format("woff2"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Typewriter-Regular.woff") format("woff"), url("https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.13.16/fonts/KaTeX_Typewriter-Regular.ttf") format("truetype"); |
| | | font-weight: normal; |
| | | font-style: normal; |
| | | } |
| | | .katex { |
| | | counter-reset: katexEqnNo mmlEqnNo; |
| | | font: normal 1.21em KaTeX_Main, Times New Roman, serif; |
| | | line-height: 1.2; |
| | | text-indent: 0; |
| | | text-rendering: auto; |
| | | } |
| | | .katex view, |
| | | .katex text { |
| | | -ms-high-contrast-adjust: none !important; |
| | | border-color: currentColor; |
| | | } |
| | | .katex .katex-mathml { |
| | | /* Accessibility hack to only show to screen readers |
| | | Found at: http://a11yproject.com/posts/how-to-hide-content/ */ |
| | | position: absolute; |
| | | clip: rect(1px, 1px, 1px, 1px); |
| | | padding: 0; |
| | | border: 0; |
| | | height: 1px; |
| | | width: 1px; |
| | | overflow: hidden; |
| | | } |
| | | .katex .katex-html { |
| | | /* \newline is an empty block at top level, between .base elements */ |
| | | } |
| | | .katex .katex-html > .newline { |
| | | display: block; |
| | | } |
| | | .katex .base { |
| | | position: relative; |
| | | display: inline-block; |
| | | white-space: nowrap; |
| | | width: min-content; |
| | | } |
| | | .katex .strut { |
| | | display: inline-block; |
| | | } |
| | | .katex .textbf { |
| | | font-weight: bold; |
| | | } |
| | | .katex .textit { |
| | | font-style: italic; |
| | | } |
| | | .katex .textrm { |
| | | font-family: KaTeX_Main; |
| | | } |
| | | .katex .textsf { |
| | | font-family: KaTeX_SansSerif; |
| | | } |
| | | .katex .texttt { |
| | | font-family: KaTeX_Typewriter; |
| | | } |
| | | .katex .mathnormal { |
| | | font-family: KaTeX_Math; |
| | | font-style: italic; |
| | | } |
| | | .katex .mathit { |
| | | font-family: KaTeX_Main; |
| | | font-style: italic; |
| | | } |
| | | .katex .mathrm { |
| | | font-style: normal; |
| | | } |
| | | .katex .mathbf { |
| | | font-family: KaTeX_Main; |
| | | font-weight: bold; |
| | | } |
| | | .katex .boldsymbol { |
| | | font-family: KaTeX_Math; |
| | | font-weight: bold; |
| | | font-style: italic; |
| | | } |
| | | .katex .amsrm { |
| | | font-family: KaTeX_AMS; |
| | | } |
| | | .katex .mathbb, |
| | | .katex .textbb { |
| | | font-family: KaTeX_AMS; |
| | | } |
| | | .katex .mathcal { |
| | | font-family: KaTeX_Caligraphic; |
| | | } |
| | | .katex .mathfrak, |
| | | .katex .textfrak { |
| | | font-family: KaTeX_Fraktur; |
| | | } |
| | | .katex .mathtt { |
| | | font-family: KaTeX_Typewriter; |
| | | } |
| | | .katex .mathscr, |
| | | .katex .textscr { |
| | | font-family: KaTeX_Script; |
| | | } |
| | | .katex .mathsf, |
| | | .katex .textsf { |
| | | font-family: KaTeX_SansSerif; |
| | | } |
| | | .katex .mathboldsf, |
| | | .katex .textboldsf { |
| | | font-family: KaTeX_SansSerif; |
| | | font-weight: bold; |
| | | } |
| | | .katex .mathitsf, |
| | | .katex .textitsf { |
| | | font-family: KaTeX_SansSerif; |
| | | font-style: italic; |
| | | } |
| | | .katex .mainrm { |
| | | font-family: KaTeX_Main; |
| | | font-style: normal; |
| | | } |
| | | .katex .vlist-t { |
| | | display: inline-table; |
| | | table-layout: fixed; |
| | | border-collapse: collapse; |
| | | } |
| | | .katex .vlist-r { |
| | | display: table-row; |
| | | } |
| | | .katex .vlist { |
| | | display: table-cell; |
| | | vertical-align: bottom; |
| | | position: relative; |
| | | } |
| | | .katex .vlist > .katex-span { |
| | | display: block; |
| | | height: 0; |
| | | position: relative; |
| | | } |
| | | .katex .vlist > .katex-span > .katex-span { |
| | | display: inline-block; |
| | | } |
| | | .katex .vlist > .katex-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; |
| | | min-width: 2px; |
| | | } |
| | | .katex .vbox { |
| | | display: inline-flex; |
| | | flex-direction: column; |
| | | align-items: baseline; |
| | | } |
| | | .katex .hbox { |
| | | display: inline-flex; |
| | | flex-direction: row; |
| | | width: 100%; |
| | | } |
| | | .katex .thinbox { |
| | | display: inline-flex; |
| | | flex-direction: row; |
| | | width: 0; |
| | | max-width: 0; |
| | | } |
| | | .katex .msupsub { |
| | | text-align: left; |
| | | } |
| | | .katex .mfrac > .katex-span > .katex-span { |
| | | text-align: center; |
| | | } |
| | | .katex .mfrac .frac-line { |
| | | display: inline-block; |
| | | width: 100%; |
| | | border-bottom-style: solid; |
| | | } |
| | | .katex .mfrac .frac-line, |
| | | .katex .overline .overline-line, |
| | | .katex .underline .underline-line, |
| | | .katex .hline, |
| | | .katex .hdashline, |
| | | .katex .rule { |
| | | min-height: 1px; |
| | | } |
| | | .katex .mspace { |
| | | display: inline-block; |
| | | } |
| | | .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 > .katex-span { |
| | | margin-left: -50%; |
| | | margin-right: 50%; |
| | | } |
| | | .katex .rule { |
| | | display: inline-block; |
| | | border: solid 0; |
| | | position: relative; |
| | | } |
| | | .katex .overline .overline-line, |
| | | .katex .underline .underline-line, |
| | | .katex .hline { |
| | | display: inline-block; |
| | | width: 100%; |
| | | border-bottom-style: solid; |
| | | } |
| | | .katex .hdashline { |
| | | display: inline-block; |
| | | width: 100%; |
| | | border-bottom-style: dashed; |
| | | } |
| | | .katex .sqrt > .root { |
| | | margin-left: 0.27777778em; |
| | | margin-right: -0.55555556em; |
| | | } |
| | | .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 > .katex-span { |
| | | font-family: KaTeX_Size1; |
| | | } |
| | | .katex .delimsizing.mult .delim-size4 > .katex-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 { |
| | | position: relative; |
| | | } |
| | | .katex .accent .accent-body:not(.accent-full) { |
| | | width: 0; |
| | | } |
| | | .katex .overlay { |
| | | display: block; |
| | | } |
| | | .katex .mtable .vertical-separator { |
| | | display: inline-block; |
| | | min-width: 1px; |
| | | } |
| | | .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 .katex-svg { |
| | | display: block; |
| | | position: absolute; |
| | | width: 100%; |
| | | height: inherit; |
| | | fill: currentColor; |
| | | stroke: currentColor; |
| | | fill-rule: nonzero; |
| | | fill-opacity: 1; |
| | | stroke-width: 1; |
| | | stroke-linecap: butt; |
| | | stroke-linejoin: miter; |
| | | stroke-miterlimit: 4; |
| | | stroke-dasharray: none; |
| | | stroke-dashoffset: 0; |
| | | stroke-opacity: 1; |
| | | } |
| | | .katex .katex-svg path { |
| | | stroke: none; |
| | | } |
| | | .katex img { |
| | | border-style: none; |
| | | min-width: 0; |
| | | min-height: 0; |
| | | max-width: none; |
| | | max-height: none; |
| | | } |
| | | .katex .stretchy { |
| | | width: 100%; |
| | | display: block; |
| | | position: relative; |
| | | overflow: hidden; |
| | | } |
| | | .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.2%; |
| | | overflow: hidden; |
| | | } |
| | | .katex .halfarrow-right { |
| | | position: absolute; |
| | | right: 0; |
| | | width: 50.2%; |
| | | 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 .cd-arrow-pad { |
| | | padding: 0 0.55556em 0 0.27778em; |
| | | } |
| | | .katex .x-arrow, |
| | | .katex .mover, |
| | | .katex .munder { |
| | | text-align: center; |
| | | } |
| | | .katex .boxpad { |
| | | padding: 0 0.3em; |
| | | } |
| | | .katex .fbox, |
| | | .katex .fcolorbox { |
| | | box-sizing: border-box; |
| | | border: 0.04em solid; |
| | | } |
| | | .katex .cancel-pad { |
| | | padding: 0 0.2em; |
| | | } |
| | | .katex .cancel-lap { |
| | | margin-left: -0.2em; |
| | | margin-right: -0.2em; |
| | | } |
| | | .katex .sout { |
| | | border-bottom-style: solid; |
| | | border-bottom-width: 0.08em; |
| | | } |
| | | .katex .angl { |
| | | box-sizing: border-box; |
| | | border-top: 0.049em solid; |
| | | border-right: 0.049em solid; |
| | | margin-right: 0.03889em; |
| | | } |
| | | .katex .anglpad { |
| | | padding: 0 0.03889em; |
| | | } |
| | | .katex .eqn-num::before { |
| | | counter-increment: katexEqnNo; |
| | | content: "(" counter(katexEqnNo) ")"; |
| | | } |
| | | .katex .mml-eqn-num::before { |
| | | counter-increment: mmlEqnNo; |
| | | content: "(" counter(mmlEqnNo) ")"; |
| | | } |
| | | .katex .mtr-glue { |
| | | width: 50%; |
| | | } |
| | | .katex .cd-vert-arrow { |
| | | display: inline-block; |
| | | position: relative; |
| | | } |
| | | .katex .cd-label-left { |
| | | display: inline-block; |
| | | position: absolute; |
| | | right: calc(50% + 0.3em); |
| | | text-align: left; |
| | | } |
| | | .katex .cd-label-right { |
| | | display: inline-block; |
| | | position: absolute; |
| | | left: calc(50% + 0.3em); |
| | | text-align: right; |
| | | } |
| | | .katex-display { |
| | | display: block; |
| | | margin: 1em 0; |
| | | text-align: center; |
| | | } |
| | | .katex-display > .katex { |
| | | display: block; |
| | | text-align: center; |
| | | white-space: nowrap; |
| | | } |
| | | .katex-display > .katex > .katex-html { |
| | | display: block; |
| | | position: relative; |
| | | } |
| | | .katex-display > .katex > .katex-html > .tag { |
| | | position: absolute; |
| | | right: 0; |
| | | } |
| | | .katex-display.leqno > .katex > .katex-html > .tag { |
| | | left: 0; |
| | | right: auto; |
| | | } |
| | | .katex-display.fleqn > .katex { |
| | | text-align: left; |
| | | padding-left: 2em; |
| | | } |
New file |
| | |
| | | function t(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createClass=void 0;var i=a(r(1));r(2);var o=/([A-Z])/g,s={"&":"&",">":">","<":"<",'"':""","'":"'"},l=/[&><"']/g;function h(e){return String(e).replace(l,(function(e){return s[e]}))}var c=function(e){return"data:image/svg+xml,"+encodeURIComponent(e.replace(/\s+/g," "))};t.createClass=function(e){var t;return null!==(t=null==e?void 0:e.filter((function(e){return e})).join(" "))&&void 0!==t?t:""};var m=function(e,r){return e.map((function(e){var n,a=r;(null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.color)&&(a=e.style.color);var s=void 0;e instanceof i.default.__domTree.Span&&(s="span"),e instanceof i.default.__domTree.Anchor&&(s="anchor"),e instanceof i.default.__domTree.LineNode&&(s="line"),e instanceof i.default.__domTree.PathNode&&(s="path"),e instanceof i.default.__domTree.SvgNode&&(s="svg",a&&(e.attributes.fill=a)),e instanceof i.default.__domTree.SymbolNode&&(s="text");var l=e.children&&e.children.length>0?m(e.children,a):[];return s?function(e,r,n){var a=!1;r.classes&&r.classes.length>0&&(a=!0);var i,s=h((0,t.createClass)(r.classes)),l="";for(var m in"text"===e&&r.italic>0&&(l+="margin-right:"+r.italic+"em;"),r.style)r.style.hasOwnProperty(m)&&(l+="".concat((i=m,i.replace(o,"-$1").toLowerCase()),":").concat(r.style[m],";"));l&&(a=!0);var u={};for(var p in r.attributes)r.attributes.hasOwnProperty(p)&&(u[p]=h(r.attributes[p]));if("span"===e)return{name:"span",attrs:{class:s+" katex-span",style:l},children:n};if("text"===e){var d=h(r.text);return a?{name:"span",attrs:{class:s,style:l},children:[{type:"text",text:d}]}:{type:"text",text:d}}if("svg"===e){var f=r.toMarkup();return{name:"img",attrs:{src:c(f),class:"katex-svg"}}}return null}(s,e,l):l})).reduce((function(e,t){return Array.isArray(t)?e.push.apply(e,t):e.push(t),e}),[]).filter((function(e){return!!e}))};t.default=function(e,t){void 0===t&&(t={});try{var r=i.default.__renderToDomTree(e,n(n({},t),{output:"html"}));return m([r])}catch(e){return[{name:"span",attrs:{style:"color:red;"},children:[{type:"text",text:e.message}]}]}}},function(e,t,r){var n;"undefined"!=typeof self&&self,n=function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{default:function(){return Fn}});var r=function e(t,r){this.position=void 0;var n,a="KaTeX parse error: "+t,i=r&&r.loc;if(i&&i.start<=i.end){var o=i.lexer.input;n=i.start;var s=i.end;n===o.length?a+=" at end of input: ":a+=" at position "+(n+1)+": ";var l=o.slice(n,s).replace(/[^]/g,"$&̲");a+=(n>15?"â¦"+o.slice(n-15,n):o.slice(0,n))+l+(s+15<o.length?o.slice(s,s+15)+"â¦":o.slice(s))}var h=new Error(a);return h.name="ParseError",h.__proto__=e.prototype,h.position=n,h};r.prototype.__proto__=Error.prototype;var n=r,a=/([A-Z])/g,i={"&":"&",">":">","<":"<",'"':""","'":"'"},o=/[&><"']/g,s=function e(t){return"ordgroup"===t.type||"color"===t.type?1===t.body.length?e(t.body[0]):t:"font"===t.type?e(t.body):t},l={contains:function(e,t){return-1!==e.indexOf(t)},deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(o,(function(e){return i[e]}))},hyphenate:function(e){return e.replace(a,"-$1").toLowerCase()},getBaseElem:s,isCharacterBox:function(e){var t=s(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){var t=/^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(e);return null!=t?t[1]:"_relative"}},h={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:function(e){return"#"+e}},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:function(e,t){return t.push(e),t}},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:function(e){return Math.max(0,e)},cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:function(e){return Math.max(0,e)},cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:function(e){return Math.max(0,e)},cli:"-e, --max-expand <n>",cliProcessor:function(e){return"Infinity"===e?1/0:parseInt(e)}},globalGroup:{type:"boolean",cli:!1}};function c(e){if(e.default)return e.default;var t=e.type,r=Array.isArray(t)?t[0]:t;if("string"!=typeof r)return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}var m=function(){function e(e){for(var t in this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{},h)if(h.hasOwnProperty(t)){var r=h[t];this[t]=void 0!==e[t]?r.processor?r.processor(e[t]):e[t]:c(r)}}var t=e.prototype;return t.reportNonstrict=function(e,t,r){var a=this.strict;if("function"==typeof a&&(a=a(e,t,r)),a&&"ignore"!==a){if(!0===a||"error"===a)throw new n("LaTeX-incompatible input and strict mode is set to 'error': "+t+" ["+e+"]",r);"warn"===a?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+a+"': "+t+" ["+e+"]")}},t.useStrictBehavior=function(e,t,r){var n=this.strict;if("function"==typeof n)try{n=n(e,t,r)}catch(e){n="error"}return!(!n||"ignore"===n||!0!==n&&"error"!==n&&("warn"===n?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"),1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+n+"': "+t+" ["+e+"]"),1)))},t.isTrusted=function(e){e.url&&!e.protocol&&(e.protocol=l.protocolFromUrl(e.url));var t="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(t)},e}(),u=function(){function e(e,t,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=r}var t=e.prototype;return t.sup=function(){return p[d[this.id]]},t.sub=function(){return p[f[this.id]]},t.fracNum=function(){return p[g[this.id]]},t.fracDen=function(){return p[v[this.id]]},t.cramp=function(){return p[y[this.id]]},t.text=function(){return p[b[this.id]]},t.isTight=function(){return this.size>=2},e}(),p=[new u(0,0,!1),new u(1,0,!0),new u(2,1,!1),new u(3,1,!0),new u(4,2,!1),new u(5,2,!0),new u(6,3,!1),new u(7,3,!0)],d=[4,5,4,5,6,7,6,7],f=[5,5,5,5,7,7,7,7],g=[2,3,4,5,6,7,6,7],v=[3,3,5,5,7,7,7,7],y=[1,1,3,3,5,5,7,7],b=[0,1,2,3,2,3,2,3],x={DISPLAY:p[0],TEXT:p[2],SCRIPT:p[4],SCRIPTSCRIPT:p[6]},w=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}],k=[];function S(e){for(var t=0;t<k.length;t+=2)if(e>=k[t]&&e<=k[t+1])return!0;return!1}w.forEach((function(e){return e.blocks.forEach((function(e){return k.push.apply(k,e)}))}));var M={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:"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:"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",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",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",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",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",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",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",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:"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:"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",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",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",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",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",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-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 11 8 0\n13.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 39\n-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-40.5\n-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\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"},z=function(){function e(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}var t=e.prototype;return t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e},t.toMarkup=function(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e},t.toText=function(){var e=function(e){return e.toText()};return this.children.map(e).join("")},e}(),A={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},T={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},B={"Ã
":"A","Ã":"D","Ã":"o","Ã¥":"a","ð":"d","þ":"o","Ð":"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"};function C(e,t,r){if(!A[t])throw new Error("Font metrics not found for font: "+t+".");var n=e.charCodeAt(0),a=A[t][n];if(!a&&e[0]in B&&(n=B[e[0]].charCodeAt(0),a=A[t][n]),a||"text"!==r||S(n)&&(a=A[t][77]),a)return{depth:a[0],height:a[1],italic:a[2],skew:a[3],width:a[4]}}var N={},q=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],I=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],O=function(e,t){return t.size<2?e:q[e-1][t.size-1]},R=function(){function e(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||e.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=I[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}var t=e.prototype;return t.extend=function(t){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return new e(r)},t.havingStyle=function(e){return this.style===e?this:this.extend({style:e,size:O(this.textSize,e)})},t.havingCrampedStyle=function(){return this.havingStyle(this.style.cramp())},t.havingSize=function(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:I[e-1]})},t.havingBaseStyle=function(t){t=t||this.style.text();var r=O(e.BASESIZE,t);return this.size===r&&this.textSize===e.BASESIZE&&this.style===t?this:this.extend({style:t,size:r})},t.havingBaseSizing=function(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})},t.withColor=function(e){return this.extend({color:e})},t.withPhantom=function(){return this.extend({phantom:!0})},t.withFont=function(e){return this.extend({font:e})},t.withTextFontFamily=function(e){return this.extend({fontFamily:e,font:""})},t.withTextFontWeight=function(e){return this.extend({fontWeight:e,font:""})},t.withTextFontShape=function(e){return this.extend({fontShape:e,font:""})},t.sizingClasses=function(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]},t.baseSizingClasses=function(){return this.size!==e.BASESIZE?["sizing","reset-size"+this.size,"size"+e.BASESIZE]:[]},t.fontMetrics=function(){return this._fontMetrics||(this._fontMetrics=function(e){var t;if(!N[t=e>=5?0:e>=3?1:2]){var r=N[t]={cssEmPerMu:T.quad[t]/18};for(var n in T)T.hasOwnProperty(n)&&(r[n]=T[n][t])}return N[t]}(this.size)),this._fontMetrics},t.getColor=function(){return this.phantom?"transparent":this.color},e}();R.BASESIZE=6;var H=R,E={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},L={ex:!0,em:!0,mu:!0},D=function(e){return"string"!=typeof e&&(e=e.unit),e in E||e in L||"ex"===e},P=function(e,t){var r;if(e.unit in E)r=E[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if("mu"===e.unit)r=t.fontMetrics().cssEmPerMu;else{var a;if(a=t.style.isTight()?t.havingStyle(t.style.text()):t,"ex"===e.unit)r=a.fontMetrics().xHeight;else{if("em"!==e.unit)throw new n("Invalid unit: '"+e.unit+"'");r=a.fontMetrics().quad}a!==t&&(r*=a.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*r,t.maxSize)},F=function(e){return+e.toFixed(4)+"em"},V=function(e){return e.filter((function(e){return e})).join(" ")},G=function(e,t,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},t){t.style.isTight()&&this.classes.push("mtight");var n=t.getColor();n&&(this.style.color=n)}},U=function(e){var t=document.createElement(e);for(var r in t.className=V(this.classes),this.style)this.style.hasOwnProperty(r)&&(t.style[r]=this.style[r]);for(var n in this.attributes)this.attributes.hasOwnProperty(n)&&t.setAttribute(n,this.attributes[n]);for(var a=0;a<this.children.length;a++)t.appendChild(this.children[a].toNode());return t},_=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+l.escape(V(this.classes))+'"');var r="";for(var n in this.style)this.style.hasOwnProperty(n)&&(r+=l.hyphenate(n)+":"+this.style[n]+";");for(var a in r&&(t+=' style="'+l.escape(r)+'"'),this.attributes)this.attributes.hasOwnProperty(a)&&(t+=" "+a+'="'+l.escape(this.attributes[a])+'"');t+=">";for(var i=0;i<this.children.length;i++)t+=this.children[i].toMarkup();return t+="</"+e+">"},Y=function(){function e(e,t,r,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,G.call(this,e,r,n),this.children=t||[]}var t=e.prototype;return t.setAttribute=function(e,t){this.attributes[e]=t},t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){return U.call(this,"span")},t.toMarkup=function(){return _.call(this,"span")},e}(),X=function(){function e(e,t,r,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,G.call(this,t,n),this.children=r||[],this.setAttribute("href",e)}var t=e.prototype;return t.setAttribute=function(e,t){this.attributes[e]=t},t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){return U.call(this,"a")},t.toMarkup=function(){return _.call(this,"a")},e}(),W=function(){function e(e,t,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=r}var t=e.prototype;return t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){var e=document.createElement("img");for(var t in e.src=this.src,e.alt=this.alt,e.className="mord",this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e},t.toMarkup=function(){var e="<img src='"+this.src+" 'alt='"+this.alt+"' ",t="";for(var r in this.style)this.style.hasOwnProperty(r)&&(t+=l.hyphenate(r)+":"+this.style[r]+";");return t&&(e+=' style="'+l.escape(t)+'"'),e+="'/>"},e}(),j={"î":"ıÌ","ï":"ıÌ","Ã":"ıÌ","ì":"ıÌ"},$=function(){function e(e,t,r,n,a,i,o,s){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=r||0,this.italic=n||0,this.skew=a||0,this.width=i||0,this.classes=o||[],this.style=s||{},this.maxFontSize=0;var l=function(e){for(var t=0;t<w.length;t++)for(var r=w[t],n=0;n<r.blocks.length;n++){var a=r.blocks[n];if(e>=a[0]&&e<=a[1])return r.name}return null}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),/[îïÃì]/.test(this.text)&&(this.text=j[this.text])}var t=e.prototype;return t.hasClass=function(e){return l.contains(this.classes,e)},t.toNode=function(){var e=document.createTextNode(this.text),t=null;for(var r in this.italic>0&&((t=document.createElement("span")).style.marginRight=F(this.italic)),this.classes.length>0&&((t=t||document.createElement("span")).className=V(this.classes)),this.style)this.style.hasOwnProperty(r)&&((t=t||document.createElement("span")).style[r]=this.style[r]);return t?(t.appendChild(e),t):e},t.toMarkup=function(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=l.escape(V(this.classes)),t+='"');var r="";for(var n in this.italic>0&&(r+="margin-right:"+this.italic+"em;"),this.style)this.style.hasOwnProperty(n)&&(r+=l.hyphenate(n)+":"+this.style[n]+";");r&&(e=!0,t+=' style="'+l.escape(r)+'"');var a=l.escape(this.text);return e?(t+=">",t+=a,t+="</span>"):a},e}(),Z=function(){function e(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}var t=e.prototype;return t.toNode=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);for(var r=0;r<this.children.length;r++)e.appendChild(this.children[r].toNode());return e},t.toMarkup=function(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+"='"+this.attributes[t]+"'");e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>"},e}(),K=function(){function e(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}var t=e.prototype;return t.toNode=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","path");return this.alternate?e.setAttribute("d",this.alternate):e.setAttribute("d",M[this.pathName]),e},t.toMarkup=function(){return this.alternate?"<path d='"+this.alternate+"'/>":"<path d='"+M[this.pathName]+"'/>"},e}(),J=function(){function e(e){this.attributes=void 0,this.attributes=e||{}}var t=e.prototype;return t.toNode=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);return e},t.toMarkup=function(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+"='"+this.attributes[t]+"'");return e+="/>"},e}();function Q(e){if(e instanceof $)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}var ee={bin:1,close:1,inner:1,open:1,punct:1,rel:1},te={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},re={math:{},text:{}},ne=re;function ae(e,t,r,n,a,i){re[e][a]={font:t,group:r,replace:n},i&&n&&(re[e][n]=re[e][a])}var ie="math",oe="main",se="ams",le="accent-token",he="bin",ce="mathord",me="op-token",ue="rel",pe="textord";ae(ie,oe,ue,"â¡","\\equiv",!0),ae(ie,oe,ue,"âº","\\prec",!0),ae(ie,oe,ue,"â»","\\succ",!0),ae(ie,oe,ue,"â¼","\\sim",!0),ae(ie,oe,ue,"â¥","\\perp"),ae(ie,oe,ue,"⪯","\\preceq",!0),ae(ie,oe,ue,"⪰","\\succeq",!0),ae(ie,oe,ue,"â","\\simeq",!0),ae(ie,oe,ue,"â£","\\mid",!0),ae(ie,oe,ue,"âª","\\ll",!0),ae(ie,oe,ue,"â«","\\gg",!0),ae(ie,oe,ue,"â","\\asymp",!0),ae(ie,oe,ue,"â¥","\\parallel"),ae(ie,oe,ue,"â","\\bowtie",!0),ae(ie,oe,ue,"â£","\\smile",!0),ae(ie,oe,ue,"â","\\sqsubseteq",!0),ae(ie,oe,ue,"â","\\sqsupseteq",!0),ae(ie,oe,ue,"â","\\doteq",!0),ae(ie,oe,ue,"â¢","\\frown",!0),ae(ie,oe,ue,"â","\\ni",!0),ae(ie,oe,ue,"â","\\propto",!0),ae(ie,oe,ue,"â¢","\\vdash",!0),ae(ie,oe,ue,"â£","\\dashv",!0),ae(ie,oe,ue,"â","\\owns"),ae(ie,oe,"punct",".","\\ldotp"),ae(ie,oe,"punct","â
","\\cdotp"),ae(ie,oe,pe,"#","\\#"),ae("text",oe,pe,"#","\\#"),ae(ie,oe,pe,"&","\\&"),ae("text",oe,pe,"&","\\&"),ae(ie,oe,pe,"âµ","\\aleph",!0),ae(ie,oe,pe,"â","\\forall",!0),ae(ie,oe,pe,"â","\\hbar",!0),ae(ie,oe,pe,"â","\\exists",!0),ae(ie,oe,pe,"â","\\nabla",!0),ae(ie,oe,pe,"â","\\flat",!0),ae(ie,oe,pe,"â","\\ell",!0),ae(ie,oe,pe,"â®","\\natural",!0),ae(ie,oe,pe,"â£","\\clubsuit",!0),ae(ie,oe,pe,"â","\\wp",!0),ae(ie,oe,pe,"â¯","\\sharp",!0),ae(ie,oe,pe,"â¢","\\diamondsuit",!0),ae(ie,oe,pe,"â","\\Re",!0),ae(ie,oe,pe,"â¡","\\heartsuit",!0),ae(ie,oe,pe,"â","\\Im",!0),ae(ie,oe,pe,"â ","\\spadesuit",!0),ae(ie,oe,pe,"§","\\S",!0),ae("text",oe,pe,"§","\\S"),ae(ie,oe,pe,"¶","\\P",!0),ae("text",oe,pe,"¶","\\P"),ae(ie,oe,pe,"â ","\\dag"),ae("text",oe,pe,"â ","\\dag"),ae("text",oe,pe,"â ","\\textdagger"),ae(ie,oe,pe,"â¡","\\ddag"),ae("text",oe,pe,"â¡","\\ddag"),ae("text",oe,pe,"â¡","\\textdaggerdbl"),ae(ie,oe,"close","â±","\\rmoustache",!0),ae(ie,oe,"open","â°","\\lmoustache",!0),ae(ie,oe,"close","â¯","\\rgroup",!0),ae(ie,oe,"open","â®","\\lgroup",!0),ae(ie,oe,he,"â","\\mp",!0),ae(ie,oe,he,"â","\\ominus",!0),ae(ie,oe,he,"â","\\uplus",!0),ae(ie,oe,he,"â","\\sqcap",!0),ae(ie,oe,he,"â","\\ast"),ae(ie,oe,he,"â","\\sqcup",!0),ae(ie,oe,he,"â¯","\\bigcirc",!0),ae(ie,oe,he,"â","\\bullet",!0),ae(ie,oe,he,"â¡","\\ddagger"),ae(ie,oe,he,"â","\\wr",!0),ae(ie,oe,he,"⨿","\\amalg"),ae(ie,oe,he,"&","\\And"),ae(ie,oe,ue,"âµ","\\longleftarrow",!0),ae(ie,oe,ue,"â","\\Leftarrow",!0),ae(ie,oe,ue,"â¸","\\Longleftarrow",!0),ae(ie,oe,ue,"â¶","\\longrightarrow",!0),ae(ie,oe,ue,"â","\\Rightarrow",!0),ae(ie,oe,ue,"â¹","\\Longrightarrow",!0),ae(ie,oe,ue,"â","\\leftrightarrow",!0),ae(ie,oe,ue,"â·","\\longleftrightarrow",!0),ae(ie,oe,ue,"â","\\Leftrightarrow",!0),ae(ie,oe,ue,"âº","\\Longleftrightarrow",!0),ae(ie,oe,ue,"â¦","\\mapsto",!0),ae(ie,oe,ue,"â¼","\\longmapsto",!0),ae(ie,oe,ue,"â","\\nearrow",!0),ae(ie,oe,ue,"â©","\\hookleftarrow",!0),ae(ie,oe,ue,"âª","\\hookrightarrow",!0),ae(ie,oe,ue,"â","\\searrow",!0),ae(ie,oe,ue,"â¼","\\leftharpoonup",!0),ae(ie,oe,ue,"â","\\rightharpoonup",!0),ae(ie,oe,ue,"â","\\swarrow",!0),ae(ie,oe,ue,"â½","\\leftharpoondown",!0),ae(ie,oe,ue,"â","\\rightharpoondown",!0),ae(ie,oe,ue,"â","\\nwarrow",!0),ae(ie,oe,ue,"â","\\rightleftharpoons",!0),ae(ie,se,ue,"â®","\\nless",!0),ae(ie,se,ue,"î","\\@nleqslant"),ae(ie,se,ue,"î","\\@nleqq"),ae(ie,se,ue,"âª","\\lneq",!0),ae(ie,se,ue,"â¨","\\lneqq",!0),ae(ie,se,ue,"î","\\@lvertneqq"),ae(ie,se,ue,"â¦","\\lnsim",!0),ae(ie,se,ue,"âª","\\lnapprox",!0),ae(ie,se,ue,"â","\\nprec",!0),ae(ie,se,ue,"â ","\\npreceq",!0),ae(ie,se,ue,"â¨","\\precnsim",!0),ae(ie,se,ue,"⪹","\\precnapprox",!0),ae(ie,se,ue,"â","\\nsim",!0),ae(ie,se,ue,"î","\\@nshortmid"),ae(ie,se,ue,"â¤","\\nmid",!0),ae(ie,se,ue,"â¬","\\nvdash",!0),ae(ie,se,ue,"â","\\nvDash",!0),ae(ie,se,ue,"âª","\\ntriangleleft"),ae(ie,se,ue,"â¬","\\ntrianglelefteq",!0),ae(ie,se,ue,"â","\\subsetneq",!0),ae(ie,se,ue,"î","\\@varsubsetneq"),ae(ie,se,ue,"â«","\\subsetneqq",!0),ae(ie,se,ue,"î","\\@varsubsetneqq"),ae(ie,se,ue,"â¯","\\ngtr",!0),ae(ie,se,ue,"î","\\@ngeqslant"),ae(ie,se,ue,"î","\\@ngeqq"),ae(ie,se,ue,"âª","\\gneq",!0),ae(ie,se,ue,"â©","\\gneqq",!0),ae(ie,se,ue,"î","\\@gvertneqq"),ae(ie,se,ue,"â§","\\gnsim",!0),ae(ie,se,ue,"âª","\\gnapprox",!0),ae(ie,se,ue,"â","\\nsucc",!0),ae(ie,se,ue,"â¡","\\nsucceq",!0),ae(ie,se,ue,"â©","\\succnsim",!0),ae(ie,se,ue,"⪺","\\succnapprox",!0),ae(ie,se,ue,"â","\\ncong",!0),ae(ie,se,ue,"î","\\@nshortparallel"),ae(ie,se,ue,"â¦","\\nparallel",!0),ae(ie,se,ue,"â¯","\\nVDash",!0),ae(ie,se,ue,"â«","\\ntriangleright"),ae(ie,se,ue,"â","\\ntrianglerighteq",!0),ae(ie,se,ue,"î","\\@nsupseteqq"),ae(ie,se,ue,"â","\\supsetneq",!0),ae(ie,se,ue,"î","\\@varsupsetneq"),ae(ie,se,ue,"â«","\\supsetneqq",!0),ae(ie,se,ue,"î","\\@varsupsetneqq"),ae(ie,se,ue,"â®","\\nVdash",!0),ae(ie,se,ue,"⪵","\\precneqq",!0),ae(ie,se,ue,"⪶","\\succneqq",!0),ae(ie,se,ue,"î","\\@nsubseteqq"),ae(ie,se,he,"â´","\\unlhd"),ae(ie,se,he,"âµ","\\unrhd"),ae(ie,se,ue,"â","\\nleftarrow",!0),ae(ie,se,ue,"â","\\nrightarrow",!0),ae(ie,se,ue,"â","\\nLeftarrow",!0),ae(ie,se,ue,"â","\\nRightarrow",!0),ae(ie,se,ue,"â®","\\nleftrightarrow",!0),ae(ie,se,ue,"â","\\nLeftrightarrow",!0),ae(ie,se,ue,"â³","\\vartriangle"),ae(ie,se,pe,"â","\\hslash"),ae(ie,se,pe,"â½","\\triangledown"),ae(ie,se,pe,"â","\\lozenge"),ae(ie,se,pe,"â","\\circledS"),ae(ie,se,pe,"®","\\circledR"),ae("text",se,pe,"®","\\circledR"),ae(ie,se,pe,"â¡","\\measuredangle",!0),ae(ie,se,pe,"â","\\nexists"),ae(ie,se,pe,"â§","\\mho"),ae(ie,se,pe,"â²","\\Finv",!0),ae(ie,se,pe,"â
","\\Game",!0),ae(ie,se,pe,"âµ","\\backprime"),ae(ie,se,pe,"â²","\\blacktriangle"),ae(ie,se,pe,"â¼","\\blacktriangledown"),ae(ie,se,pe,"â ","\\blacksquare"),ae(ie,se,pe,"â§«","\\blacklozenge"),ae(ie,se,pe,"â
","\\bigstar"),ae(ie,se,pe,"â¢","\\sphericalangle",!0),ae(ie,se,pe,"â","\\complement",!0),ae(ie,se,pe,"ð","\\eth",!0),ae("text",oe,pe,"ð","ð"),ae(ie,se,pe,"â±","\\diagup"),ae(ie,se,pe,"â²","\\diagdown"),ae(ie,se,pe,"â¡","\\square"),ae(ie,se,pe,"â¡","\\Box"),ae(ie,se,pe,"â","\\Diamond"),ae(ie,se,pe,"Â¥","\\yen",!0),ae("text",se,pe,"Â¥","\\yen",!0),ae(ie,se,pe,"â","\\checkmark",!0),ae("text",se,pe,"â","\\checkmark"),ae(ie,se,pe,"â¶","\\beth",!0),ae(ie,se,pe,"â¸","\\daleth",!0),ae(ie,se,pe,"â·","\\gimel",!0),ae(ie,se,pe,"Ï","\\digamma",!0),ae(ie,se,pe,"ϰ","\\varkappa"),ae(ie,se,"open","â","\\@ulcorner",!0),ae(ie,se,"close","â","\\@urcorner",!0),ae(ie,se,"open","â","\\@llcorner",!0),ae(ie,se,"close","â","\\@lrcorner",!0),ae(ie,se,ue,"â¦","\\leqq",!0),ae(ie,se,ue,"⩽","\\leqslant",!0),ae(ie,se,ue,"âª","\\eqslantless",!0),ae(ie,se,ue,"â²","\\lesssim",!0),ae(ie,se,ue,"âª
","\\lessapprox",!0),ae(ie,se,ue,"â","\\approxeq",!0),ae(ie,se,he,"â","\\lessdot"),ae(ie,se,ue,"â","\\lll",!0),ae(ie,se,ue,"â¶","\\lessgtr",!0),ae(ie,se,ue,"â","\\lesseqgtr",!0),ae(ie,se,ue,"âª","\\lesseqqgtr",!0),ae(ie,se,ue,"â","\\doteqdot"),ae(ie,se,ue,"â","\\risingdotseq",!0),ae(ie,se,ue,"â","\\fallingdotseq",!0),ae(ie,se,ue,"â½","\\backsim",!0),ae(ie,se,ue,"â","\\backsimeq",!0),ae(ie,se,ue,"â«
","\\subseteqq",!0),ae(ie,se,ue,"â","\\Subset",!0),ae(ie,se,ue,"â","\\sqsubset",!0),ae(ie,se,ue,"â¼","\\preccurlyeq",!0),ae(ie,se,ue,"â","\\curlyeqprec",!0),ae(ie,se,ue,"â¾","\\precsim",!0),ae(ie,se,ue,"⪷","\\precapprox",!0),ae(ie,se,ue,"â²","\\vartriangleleft"),ae(ie,se,ue,"â´","\\trianglelefteq"),ae(ie,se,ue,"â¨","\\vDash",!0),ae(ie,se,ue,"âª","\\Vvdash",!0),ae(ie,se,ue,"â£","\\smallsmile"),ae(ie,se,ue,"â¢","\\smallfrown"),ae(ie,se,ue,"â","\\bumpeq",!0),ae(ie,se,ue,"â","\\Bumpeq",!0),ae(ie,se,ue,"â§","\\geqq",!0),ae(ie,se,ue,"⩾","\\geqslant",!0),ae(ie,se,ue,"âª","\\eqslantgtr",!0),ae(ie,se,ue,"â³","\\gtrsim",!0),ae(ie,se,ue,"âª","\\gtrapprox",!0),ae(ie,se,he,"â","\\gtrdot"),ae(ie,se,ue,"â","\\ggg",!0),ae(ie,se,ue,"â·","\\gtrless",!0),ae(ie,se,ue,"â","\\gtreqless",!0),ae(ie,se,ue,"âª","\\gtreqqless",!0),ae(ie,se,ue,"â","\\eqcirc",!0),ae(ie,se,ue,"â","\\circeq",!0),ae(ie,se,ue,"â","\\triangleq",!0),ae(ie,se,ue,"â¼","\\thicksim"),ae(ie,se,ue,"â","\\thickapprox"),ae(ie,se,ue,"â«","\\supseteqq",!0),ae(ie,se,ue,"â","\\Supset",!0),ae(ie,se,ue,"â","\\sqsupset",!0),ae(ie,se,ue,"â½","\\succcurlyeq",!0),ae(ie,se,ue,"â","\\curlyeqsucc",!0),ae(ie,se,ue,"â¿","\\succsim",!0),ae(ie,se,ue,"⪸","\\succapprox",!0),ae(ie,se,ue,"â³","\\vartriangleright"),ae(ie,se,ue,"âµ","\\trianglerighteq"),ae(ie,se,ue,"â©","\\Vdash",!0),ae(ie,se,ue,"â£","\\shortmid"),ae(ie,se,ue,"â¥","\\shortparallel"),ae(ie,se,ue,"â¬","\\between",!0),ae(ie,se,ue,"â","\\pitchfork",!0),ae(ie,se,ue,"â","\\varpropto"),ae(ie,se,ue,"â","\\blacktriangleleft"),ae(ie,se,ue,"â´","\\therefore",!0),ae(ie,se,ue,"â","\\backepsilon"),ae(ie,se,ue,"â¶","\\blacktriangleright"),ae(ie,se,ue,"âµ","\\because",!0),ae(ie,se,ue,"â","\\llless"),ae(ie,se,ue,"â","\\gggtr"),ae(ie,se,he,"â²","\\lhd"),ae(ie,se,he,"â³","\\rhd"),ae(ie,se,ue,"â","\\eqsim",!0),ae(ie,oe,ue,"â","\\Join"),ae(ie,se,ue,"â","\\Doteq",!0),ae(ie,se,he,"â","\\dotplus",!0),ae(ie,se,he,"â","\\smallsetminus"),ae(ie,se,he,"â","\\Cap",!0),ae(ie,se,he,"â","\\Cup",!0),ae(ie,se,he,"â©","\\doublebarwedge",!0),ae(ie,se,he,"â","\\boxminus",!0),ae(ie,se,he,"â","\\boxplus",!0),ae(ie,se,he,"â","\\divideontimes",!0),ae(ie,se,he,"â","\\ltimes",!0),ae(ie,se,he,"â","\\rtimes",!0),ae(ie,se,he,"â","\\leftthreetimes",!0),ae(ie,se,he,"â","\\rightthreetimes",!0),ae(ie,se,he,"â","\\curlywedge",!0),ae(ie,se,he,"â","\\curlyvee",!0),ae(ie,se,he,"â","\\circleddash",!0),ae(ie,se,he,"â","\\circledast",!0),ae(ie,se,he,"â
","\\centerdot"),ae(ie,se,he,"âº","\\intercal",!0),ae(ie,se,he,"â","\\doublecap"),ae(ie,se,he,"â","\\doublecup"),ae(ie,se,he,"â ","\\boxtimes",!0),ae(ie,se,ue,"â¢","\\dashrightarrow",!0),ae(ie,se,ue,"â ","\\dashleftarrow",!0),ae(ie,se,ue,"â","\\leftleftarrows",!0),ae(ie,se,ue,"â","\\leftrightarrows",!0),ae(ie,se,ue,"â","\\Lleftarrow",!0),ae(ie,se,ue,"â","\\twoheadleftarrow",!0),ae(ie,se,ue,"â¢","\\leftarrowtail",!0),ae(ie,se,ue,"â«","\\looparrowleft",!0),ae(ie,se,ue,"â","\\leftrightharpoons",!0),ae(ie,se,ue,"â¶","\\curvearrowleft",!0),ae(ie,se,ue,"âº","\\circlearrowleft",!0),ae(ie,se,ue,"â°","\\Lsh",!0),ae(ie,se,ue,"â","\\upuparrows",!0),ae(ie,se,ue,"â¿","\\upharpoonleft",!0),ae(ie,se,ue,"â","\\downharpoonleft",!0),ae(ie,oe,ue,"â¶","\\origof",!0),ae(ie,oe,ue,"â·","\\imageof",!0),ae(ie,se,ue,"â¸","\\multimap",!0),ae(ie,se,ue,"â","\\leftrightsquigarrow",!0),ae(ie,se,ue,"â","\\rightrightarrows",!0),ae(ie,se,ue,"â","\\rightleftarrows",!0),ae(ie,se,ue,"â ","\\twoheadrightarrow",!0),ae(ie,se,ue,"â£","\\rightarrowtail",!0),ae(ie,se,ue,"â¬","\\looparrowright",!0),ae(ie,se,ue,"â·","\\curvearrowright",!0),ae(ie,se,ue,"â»","\\circlearrowright",!0),ae(ie,se,ue,"â±","\\Rsh",!0),ae(ie,se,ue,"â","\\downdownarrows",!0),ae(ie,se,ue,"â¾","\\upharpoonright",!0),ae(ie,se,ue,"â","\\downharpoonright",!0),ae(ie,se,ue,"â","\\rightsquigarrow",!0),ae(ie,se,ue,"â","\\leadsto"),ae(ie,se,ue,"â","\\Rrightarrow",!0),ae(ie,se,ue,"â¾","\\restriction"),ae(ie,oe,pe,"â","`"),ae(ie,oe,pe,"$","\\$"),ae("text",oe,pe,"$","\\$"),ae("text",oe,pe,"$","\\textdollar"),ae(ie,oe,pe,"%","\\%"),ae("text",oe,pe,"%","\\%"),ae(ie,oe,pe,"_","\\_"),ae("text",oe,pe,"_","\\_"),ae("text",oe,pe,"_","\\textunderscore"),ae(ie,oe,pe,"â ","\\angle",!0),ae(ie,oe,pe,"â","\\infty",!0),ae(ie,oe,pe,"â²","\\prime"),ae(ie,oe,pe,"â³","\\triangle"),ae(ie,oe,pe,"Î","\\Gamma",!0),ae(ie,oe,pe,"Î","\\Delta",!0),ae(ie,oe,pe,"Î","\\Theta",!0),ae(ie,oe,pe,"Î","\\Lambda",!0),ae(ie,oe,pe,"Î","\\Xi",!0),ae(ie,oe,pe,"Î ","\\Pi",!0),ae(ie,oe,pe,"Σ","\\Sigma",!0),ae(ie,oe,pe,"Î¥","\\Upsilon",!0),ae(ie,oe,pe,"Φ","\\Phi",!0),ae(ie,oe,pe,"Ψ","\\Psi",!0),ae(ie,oe,pe,"Ω","\\Omega",!0),ae(ie,oe,pe,"A","Î"),ae(ie,oe,pe,"B","Î"),ae(ie,oe,pe,"E","Î"),ae(ie,oe,pe,"Z","Î"),ae(ie,oe,pe,"H","Î"),ae(ie,oe,pe,"I","Î"),ae(ie,oe,pe,"K","Î"),ae(ie,oe,pe,"M","Î"),ae(ie,oe,pe,"N","Î"),ae(ie,oe,pe,"O","Î"),ae(ie,oe,pe,"P","Ρ"),ae(ie,oe,pe,"T","Τ"),ae(ie,oe,pe,"X","Χ"),ae(ie,oe,pe,"¬","\\neg",!0),ae(ie,oe,pe,"¬","\\lnot"),ae(ie,oe,pe,"â¤","\\top"),ae(ie,oe,pe,"â¥","\\bot"),ae(ie,oe,pe,"â
","\\emptyset"),ae(ie,se,pe,"â
","\\varnothing"),ae(ie,oe,ce,"α","\\alpha",!0),ae(ie,oe,ce,"β","\\beta",!0),ae(ie,oe,ce,"γ","\\gamma",!0),ae(ie,oe,ce,"δ","\\delta",!0),ae(ie,oe,ce,"ϵ","\\epsilon",!0),ae(ie,oe,ce,"ζ","\\zeta",!0),ae(ie,oe,ce,"η","\\eta",!0),ae(ie,oe,ce,"θ","\\theta",!0),ae(ie,oe,ce,"ι","\\iota",!0),ae(ie,oe,ce,"κ","\\kappa",!0),ae(ie,oe,ce,"λ","\\lambda",!0),ae(ie,oe,ce,"μ","\\mu",!0),ae(ie,oe,ce,"ν","\\nu",!0),ae(ie,oe,ce,"ξ","\\xi",!0),ae(ie,oe,ce,"ο","\\omicron",!0),ae(ie,oe,ce,"Ï","\\pi",!0),ae(ie,oe,ce,"Ï","\\rho",!0),ae(ie,oe,ce,"Ï","\\sigma",!0),ae(ie,oe,ce,"Ï","\\tau",!0),ae(ie,oe,ce,"Ï
","\\upsilon",!0),ae(ie,oe,ce,"Ï","\\phi",!0),ae(ie,oe,ce,"Ï","\\chi",!0),ae(ie,oe,ce,"Ï","\\psi",!0),ae(ie,oe,ce,"Ï","\\omega",!0),ae(ie,oe,ce,"ε","\\varepsilon",!0),ae(ie,oe,ce,"Ï","\\vartheta",!0),ae(ie,oe,ce,"Ï","\\varpi",!0),ae(ie,oe,ce,"ϱ","\\varrho",!0),ae(ie,oe,ce,"Ï","\\varsigma",!0),ae(ie,oe,ce,"Ï","\\varphi",!0),ae(ie,oe,he,"â","*",!0),ae(ie,oe,he,"+","+"),ae(ie,oe,he,"â","-",!0),ae(ie,oe,he,"â
","\\cdot",!0),ae(ie,oe,he,"â","\\circ",!0),ae(ie,oe,he,"÷","\\div",!0),ae(ie,oe,he,"±","\\pm",!0),ae(ie,oe,he,"Ã","\\times",!0),ae(ie,oe,he,"â©","\\cap",!0),ae(ie,oe,he,"âª","\\cup",!0),ae(ie,oe,he,"â","\\setminus",!0),ae(ie,oe,he,"â§","\\land"),ae(ie,oe,he,"â¨","\\lor"),ae(ie,oe,he,"â§","\\wedge",!0),ae(ie,oe,he,"â¨","\\vee",!0),ae(ie,oe,pe,"â","\\surd"),ae(ie,oe,"open","â¨","\\langle",!0),ae(ie,oe,"open","â£","\\lvert"),ae(ie,oe,"open","â¥","\\lVert"),ae(ie,oe,"close","?","?"),ae(ie,oe,"close","!","!"),ae(ie,oe,"close","â©","\\rangle",!0),ae(ie,oe,"close","â£","\\rvert"),ae(ie,oe,"close","â¥","\\rVert"),ae(ie,oe,ue,"=","="),ae(ie,oe,ue,":",":"),ae(ie,oe,ue,"â","\\approx",!0),ae(ie,oe,ue,"â
","\\cong",!0),ae(ie,oe,ue,"â¥","\\ge"),ae(ie,oe,ue,"â¥","\\geq",!0),ae(ie,oe,ue,"â","\\gets"),ae(ie,oe,ue,">","\\gt",!0),ae(ie,oe,ue,"â","\\in",!0),ae(ie,oe,ue,"î ","\\@not"),ae(ie,oe,ue,"â","\\subset",!0),ae(ie,oe,ue,"â","\\supset",!0),ae(ie,oe,ue,"â","\\subseteq",!0),ae(ie,oe,ue,"â","\\supseteq",!0),ae(ie,se,ue,"â","\\nsubseteq",!0),ae(ie,se,ue,"â","\\nsupseteq",!0),ae(ie,oe,ue,"â¨","\\models"),ae(ie,oe,ue,"â","\\leftarrow",!0),ae(ie,oe,ue,"â¤","\\le"),ae(ie,oe,ue,"â¤","\\leq",!0),ae(ie,oe,ue,"<","\\lt",!0),ae(ie,oe,ue,"â","\\rightarrow",!0),ae(ie,oe,ue,"â","\\to"),ae(ie,se,ue,"â±","\\ngeq",!0),ae(ie,se,ue,"â°","\\nleq",!0),ae(ie,oe,"spacing"," ","\\ "),ae(ie,oe,"spacing"," ","\\space"),ae(ie,oe,"spacing"," ","\\nobreakspace"),ae("text",oe,"spacing"," ","\\ "),ae("text",oe,"spacing"," "," "),ae("text",oe,"spacing"," ","\\space"),ae("text",oe,"spacing"," ","\\nobreakspace"),ae(ie,oe,"spacing",null,"\\nobreak"),ae(ie,oe,"spacing",null,"\\allowbreak"),ae(ie,oe,"punct",",",","),ae(ie,oe,"punct",";",";"),ae(ie,se,he,"â¼","\\barwedge",!0),ae(ie,se,he,"â»","\\veebar",!0),ae(ie,oe,he,"â","\\odot",!0),ae(ie,oe,he,"â","\\oplus",!0),ae(ie,oe,he,"â","\\otimes",!0),ae(ie,oe,pe,"â","\\partial",!0),ae(ie,oe,he,"â","\\oslash",!0),ae(ie,se,he,"â","\\circledcirc",!0),ae(ie,se,he,"â¡","\\boxdot",!0),ae(ie,oe,he,"â³","\\bigtriangleup"),ae(ie,oe,he,"â½","\\bigtriangledown"),ae(ie,oe,he,"â ","\\dagger"),ae(ie,oe,he,"â","\\diamond"),ae(ie,oe,he,"â","\\star"),ae(ie,oe,he,"â","\\triangleleft"),ae(ie,oe,he,"â¹","\\triangleright"),ae(ie,oe,"open","{","\\{"),ae("text",oe,pe,"{","\\{"),ae("text",oe,pe,"{","\\textbraceleft"),ae(ie,oe,"close","}","\\}"),ae("text",oe,pe,"}","\\}"),ae("text",oe,pe,"}","\\textbraceright"),ae(ie,oe,"open","{","\\lbrace"),ae(ie,oe,"close","}","\\rbrace"),ae(ie,oe,"open","[","\\lbrack",!0),ae("text",oe,pe,"[","\\lbrack",!0),ae(ie,oe,"close","]","\\rbrack",!0),ae("text",oe,pe,"]","\\rbrack",!0),ae(ie,oe,"open","(","\\lparen",!0),ae(ie,oe,"close",")","\\rparen",!0),ae("text",oe,pe,"<","\\textless",!0),ae("text",oe,pe,">","\\textgreater",!0),ae(ie,oe,"open","â","\\lfloor",!0),ae(ie,oe,"close","â","\\rfloor",!0),ae(ie,oe,"open","â","\\lceil",!0),ae(ie,oe,"close","â","\\rceil",!0),ae(ie,oe,pe,"\\","\\backslash"),ae(ie,oe,pe,"â£","|"),ae(ie,oe,pe,"â£","\\vert"),ae("text",oe,pe,"|","\\textbar",!0),ae(ie,oe,pe,"â¥","\\|"),ae(ie,oe,pe,"â¥","\\Vert"),ae("text",oe,pe,"â¥","\\textbardbl"),ae("text",oe,pe,"~","\\textasciitilde"),ae("text",oe,pe,"\\","\\textbackslash"),ae("text",oe,pe,"^","\\textasciicircum"),ae(ie,oe,ue,"â","\\uparrow",!0),ae(ie,oe,ue,"â","\\Uparrow",!0),ae(ie,oe,ue,"â","\\downarrow",!0),ae(ie,oe,ue,"â","\\Downarrow",!0),ae(ie,oe,ue,"â","\\updownarrow",!0),ae(ie,oe,ue,"â","\\Updownarrow",!0),ae(ie,oe,me,"â","\\coprod"),ae(ie,oe,me,"â","\\bigvee"),ae(ie,oe,me,"â","\\bigwedge"),ae(ie,oe,me,"â¨","\\biguplus"),ae(ie,oe,me,"â","\\bigcap"),ae(ie,oe,me,"â","\\bigcup"),ae(ie,oe,me,"â«","\\int"),ae(ie,oe,me,"â«","\\intop"),ae(ie,oe,me,"â¬","\\iint"),ae(ie,oe,me,"â","\\iiint"),ae(ie,oe,me,"â","\\prod"),ae(ie,oe,me,"â","\\sum"),ae(ie,oe,me,"â¨","\\bigotimes"),ae(ie,oe,me,"â¨","\\bigoplus"),ae(ie,oe,me,"â¨","\\bigodot"),ae(ie,oe,me,"â®","\\oint"),ae(ie,oe,me,"â¯","\\oiint"),ae(ie,oe,me,"â°","\\oiiint"),ae(ie,oe,me,"â¨","\\bigsqcup"),ae(ie,oe,me,"â«","\\smallint"),ae("text",oe,"inner","â¦","\\textellipsis"),ae(ie,oe,"inner","â¦","\\mathellipsis"),ae("text",oe,"inner","â¦","\\ldots",!0),ae(ie,oe,"inner","â¦","\\ldots",!0),ae(ie,oe,"inner","â¯","\\@cdots",!0),ae(ie,oe,"inner","â±","\\ddots",!0),ae(ie,oe,pe,"â®","\\varvdots"),ae(ie,oe,le,"Ë","\\acute"),ae(ie,oe,le,"Ë","\\grave"),ae(ie,oe,le,"¨","\\ddot"),ae(ie,oe,le,"~","\\tilde"),ae(ie,oe,le,"Ë","\\bar"),ae(ie,oe,le,"Ë","\\breve"),ae(ie,oe,le,"Ë","\\check"),ae(ie,oe,le,"^","\\hat"),ae(ie,oe,le,"â","\\vec"),ae(ie,oe,le,"Ë","\\dot"),ae(ie,oe,le,"Ë","\\mathring"),ae(ie,oe,ce,"î±","\\@imath"),ae(ie,oe,ce,"î·","\\@jmath"),ae(ie,oe,pe,"ı","ı"),ae(ie,oe,pe,"È·","È·"),ae("text",oe,pe,"ı","\\i",!0),ae("text",oe,pe,"È·","\\j",!0),ae("text",oe,pe,"Ã","\\ss",!0),ae("text",oe,pe,"æ","\\ae",!0),ae("text",oe,pe,"Å","\\oe",!0),ae("text",oe,pe,"ø","\\o",!0),ae("text",oe,pe,"Ã","\\AE",!0),ae("text",oe,pe,"Å","\\OE",!0),ae("text",oe,pe,"Ã","\\O",!0),ae("text",oe,le,"Ë","\\'"),ae("text",oe,le,"Ë","\\`"),ae("text",oe,le,"Ë","\\^"),ae("text",oe,le,"Ë","\\~"),ae("text",oe,le,"Ë","\\="),ae("text",oe,le,"Ë","\\u"),ae("text",oe,le,"Ë","\\."),ae("text",oe,le,"¸","\\c"),ae("text",oe,le,"Ë","\\r"),ae("text",oe,le,"Ë","\\v"),ae("text",oe,le,"¨",'\\"'),ae("text",oe,le,"Ë","\\H"),ae("text",oe,le,"â¯","\\textcircled");var de={"--":!0,"---":!0,"``":!0,"''":!0};ae("text",oe,pe,"â","--",!0),ae("text",oe,pe,"â","\\textendash"),ae("text",oe,pe,"â","---",!0),ae("text",oe,pe,"â","\\textemdash"),ae("text",oe,pe,"â","`",!0),ae("text",oe,pe,"â","\\textquoteleft"),ae("text",oe,pe,"â","'",!0),ae("text",oe,pe,"â","\\textquoteright"),ae("text",oe,pe,"â","``",!0),ae("text",oe,pe,"â","\\textquotedblleft"),ae("text",oe,pe,"â","''",!0),ae("text",oe,pe,"â","\\textquotedblright"),ae(ie,oe,pe,"°","\\degree",!0),ae("text",oe,pe,"°","\\degree"),ae("text",oe,pe,"°","\\textdegree",!0),ae(ie,oe,pe,"£","\\pounds"),ae(ie,oe,pe,"£","\\mathsterling",!0),ae("text",oe,pe,"£","\\pounds"),ae("text",oe,pe,"£","\\textsterling",!0),ae(ie,se,pe,"â ","\\maltese"),ae("text",se,pe,"â ","\\maltese");for(var fe=0;fe<'0123456789/@."'.length;fe++){var ge='0123456789/@."'.charAt(fe);ae(ie,oe,pe,ge,ge)}for(var ve=0;ve<'0123456789!@*()-=+";:?/.,'.length;ve++){var ye='0123456789!@*()-=+";:?/.,'.charAt(ve);ae("text",oe,pe,ye,ye)}for(var be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",xe=0;xe<be.length;xe++){var we=be.charAt(xe);ae(ie,oe,ce,we,we),ae("text",oe,pe,we,we)}ae(ie,se,pe,"C","â"),ae("text",se,pe,"C","â"),ae(ie,se,pe,"H","â"),ae("text",se,pe,"H","â"),ae(ie,se,pe,"N","â"),ae("text",se,pe,"N","â"),ae(ie,se,pe,"P","â"),ae("text",se,pe,"P","â"),ae(ie,se,pe,"Q","â"),ae("text",se,pe,"Q","â"),ae(ie,se,pe,"R","â"),ae("text",se,pe,"R","â"),ae(ie,se,pe,"Z","â¤"),ae("text",se,pe,"Z","â¤"),ae(ie,oe,ce,"h","â"),ae("text",oe,ce,"h","â");for(var ke="",Se=0;Se<be.length;Se++){var Me=be.charAt(Se);ae(ie,oe,ce,Me,ke=String.fromCharCode(55349,56320+Se)),ae("text",oe,pe,Me,ke),ae(ie,oe,ce,Me,ke=String.fromCharCode(55349,56372+Se)),ae("text",oe,pe,Me,ke),ae(ie,oe,ce,Me,ke=String.fromCharCode(55349,56424+Se)),ae("text",oe,pe,Me,ke),ae(ie,oe,ce,Me,ke=String.fromCharCode(55349,56580+Se)),ae("text",oe,pe,Me,ke),ae(ie,oe,ce,Me,ke=String.fromCharCode(55349,56736+Se)),ae("text",oe,pe,Me,ke),ae(ie,oe,ce,Me,ke=String.fromCharCode(55349,56788+Se)),ae("text",oe,pe,Me,ke),ae(ie,oe,ce,Me,ke=String.fromCharCode(55349,56840+Se)),ae("text",oe,pe,Me,ke),ae(ie,oe,ce,Me,ke=String.fromCharCode(55349,56944+Se)),ae("text",oe,pe,Me,ke),Se<26&&(ae(ie,oe,ce,Me,ke=String.fromCharCode(55349,56632+Se)),ae("text",oe,pe,Me,ke),ae(ie,oe,ce,Me,ke=String.fromCharCode(55349,56476+Se)),ae("text",oe,pe,Me,ke))}ae(ie,oe,ce,"k",ke=String.fromCharCode(55349,56668)),ae("text",oe,pe,"k",ke);for(var ze=0;ze<10;ze++){var Ae=ze.toString();ae(ie,oe,ce,Ae,ke=String.fromCharCode(55349,57294+ze)),ae("text",oe,pe,Ae,ke),ae(ie,oe,ce,Ae,ke=String.fromCharCode(55349,57314+ze)),ae("text",oe,pe,Ae,ke),ae(ie,oe,ce,Ae,ke=String.fromCharCode(55349,57324+ze)),ae("text",oe,pe,Ae,ke),ae(ie,oe,ce,Ae,ke=String.fromCharCode(55349,57334+ze)),ae("text",oe,pe,Ae,ke)}for(var Te=0;Te<"ÃÃþ".length;Te++){var Be="ÃÃþ".charAt(Te);ae(ie,oe,ce,Be,Be),ae("text",oe,pe,Be,Be)}var Ce=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["","",""],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],Ne=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],qe=function(e,t,r){return ne[r][e]&&ne[r][e].replace&&(e=ne[r][e].replace),{value:e,metrics:C(e,t,r)}},Ie=function(e,t,r,n,a){var i,o=qe(e,t,r),s=o.metrics;if(e=o.value,s){var l=s.italic;("text"===r||n&&"mathit"===n.font)&&(l=0),i=new $(e,s.height,s.depth,l,s.skew,s.width,a)}else"undefined"!=typeof console&&console.warn("No character metrics for '"+e+"' in style '"+t+"' and mode '"+r+"'"),i=new $(e,0,0,0,0,0,a);if(n){i.maxFontSize=n.sizeMultiplier,n.style.isTight()&&i.classes.push("mtight");var h=n.getColor();h&&(i.style.color=h)}return i},Oe=function(e,t){if(V(e.classes)!==V(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(1===e.classes.length){var r=e.classes[0];if("mbin"===r||"mord"===r)return!1}for(var n in e.style)if(e.style.hasOwnProperty(n)&&e.style[n]!==t.style[n])return!1;for(var a in t.style)if(t.style.hasOwnProperty(a)&&e.style[a]!==t.style[a])return!1;return!0},Re=function(e){for(var t=0,r=0,n=0,a=0;a<e.children.length;a++){var i=e.children[a];i.height>t&&(t=i.height),i.depth>r&&(r=i.depth),i.maxFontSize>n&&(n=i.maxFontSize)}e.height=t,e.depth=r,e.maxFontSize=n},He=function(e,t,r,n){var a=new Y(e,t,r,n);return Re(a),a},Ee=function(e,t,r,n){return new Y(e,t,r,n)},Le=function(e){var t=new z(e);return Re(t),t},De=function(e,t,r){var n="";switch(e){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=e}return n+"-"+("textbf"===t&&"textit"===r?"BoldItalic":"textbf"===t?"Bold":"textit"===t?"Italic":"Regular")},Pe={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},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"}},Fe={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Ve={fontMap:Pe,makeSymbol:Ie,mathsym:function(e,t,r,n){return void 0===n&&(n=[]),"boldsymbol"===r.font&&qe(e,"Main-Bold",t).metrics?Ie(e,"Main-Bold",t,r,n.concat(["mathbf"])):"\\"===e||"main"===ne[t][e].font?Ie(e,"Main-Regular",t,r,n):Ie(e,"AMS-Regular",t,r,n.concat(["amsrm"]))},makeSpan:He,makeSvgSpan:Ee,makeLineSpan:function(e,t,r){var n=He([e],[],t);return n.height=Math.max(r||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),n.style.borderBottomWidth=F(n.height),n.maxFontSize=1,n},makeAnchor:function(e,t,r,n){var a=new X(e,t,r,n);return Re(a),a},makeFragment:Le,wrapFragment:function(e,t){return e instanceof z?He([],[e],t):e},makeVList:function(e,t){for(var r=function(e){if("individualShift"===e.positionType){for(var t=e.children,r=[t[0]],n=-t[0].shift-t[0].elem.depth,a=n,i=1;i<t.length;i++){var o=-t[i].shift-a-t[i].elem.depth,s=o-(t[i-1].elem.height+t[i-1].elem.depth);a+=o,r.push({type:"kern",size:s}),r.push(t[i])}return{children:r,depth:n}}var l;if("top"===e.positionType){for(var h=e.positionData,c=0;c<e.children.length;c++){var m=e.children[c];h-="kern"===m.type?m.size:m.elem.height+m.elem.depth}l=h}else if("bottom"===e.positionType)l=-e.positionData;else{var u=e.children[0];if("elem"!==u.type)throw new Error('First child must have type "elem".');if("shift"===e.positionType)l=-u.elem.depth-e.positionData;else{if("firstBaseline"!==e.positionType)throw new Error("Invalid positionType "+e.positionType+".");l=-u.elem.depth}}return{children:e.children,depth:l}}(e),n=r.children,a=r.depth,i=0,o=0;o<n.length;o++){var s=n[o];if("elem"===s.type){var l=s.elem;i=Math.max(i,l.maxFontSize,l.height)}}i+=2;var h=He(["pstrut"],[]);h.style.height=F(i);for(var c=[],m=a,u=a,p=a,d=0;d<n.length;d++){var f=n[d];if("kern"===f.type)p+=f.size;else{var g=f.elem,v=f.wrapperClasses||[],y=f.wrapperStyle||{},b=He(v,[h,g],void 0,y);b.style.top=F(-i-p-g.depth),f.marginLeft&&(b.style.marginLeft=f.marginLeft),f.marginRight&&(b.style.marginRight=f.marginRight),c.push(b),p+=g.height+g.depth}m=Math.min(m,p),u=Math.max(u,p)}var x,w=He(["vlist"],c);if(w.style.height=F(u),m<0){var k=He([],[]),S=He(["vlist"],[k]);S.style.height=F(-m);var M=He(["vlist-s"],[new $("â")]);x=[He(["vlist-r"],[w,M]),He(["vlist-r"],[S])]}else x=[He(["vlist-r"],[w])];var z=He(["vlist-t"],x);return 2===x.length&&z.classes.push("vlist-t2"),z.height=u,z.depth=-m,z},makeOrd:function(e,t,r){var a=e.mode,i=e.text,o=["mord"],s="math"===a||"text"===a&&t.font,l=s?t.font:t.fontFamily;if(55349===i.charCodeAt(0)){var h=function(e,t){var r=1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536,a="math"===t?0:1;if(119808<=r&&r<120484){var i=Math.floor((r-119808)/26);return[Ce[i][2],Ce[i][a]]}if(120782<=r&&r<=120831){var o=Math.floor((r-120782)/10);return[Ne[o][2],Ne[o][a]]}if(120485===r||120486===r)return[Ce[0][2],Ce[0][a]];if(120486<r&&r<120782)return["",""];throw new n("Unsupported character: "+e)}(i,a),c=h[0],m=h[1];return Ie(i,c,a,t,o.concat(m))}if(l){var u,p;if("boldsymbol"===l){var d=function(e,t,r,n,a){return"textord"!==a&&qe(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}}(i,a,0,0,r);u=d.fontName,p=[d.fontClass]}else s?(u=Pe[l].fontName,p=[l]):(u=De(l,t.fontWeight,t.fontShape),p=[l,t.fontWeight,t.fontShape]);if(qe(i,u,a).metrics)return Ie(i,u,a,t,o.concat(p));if(de.hasOwnProperty(i)&&"Typewriter"===u.substr(0,10)){for(var f=[],g=0;g<i.length;g++)f.push(Ie(i[g],u,a,t,o.concat(p)));return Le(f)}}if("mathord"===r)return Ie(i,"Math-Italic",a,t,o.concat(["mathnormal"]));if("textord"===r){var v=ne[a][i]&&ne[a][i].font;if("ams"===v){var y=De("amsrm",t.fontWeight,t.fontShape);return Ie(i,y,a,t,o.concat("amsrm",t.fontWeight,t.fontShape))}if("main"!==v&&v){var b=De(v,t.fontWeight,t.fontShape);return Ie(i,b,a,t,o.concat(b,t.fontWeight,t.fontShape))}var x=De("textrm",t.fontWeight,t.fontShape);return Ie(i,x,a,t,o.concat(t.fontWeight,t.fontShape))}throw new Error("unexpected type: "+r+" in makeOrd")},makeGlue:function(e,t){var r=He(["mspace"],[],t),n=P(e,t);return r.style.marginRight=F(n),r},staticSvg:function(e,t){var r=Fe[e],n=r[0],a=r[1],i=r[2],o=new K(n),s=new Z([o],{width:F(a),height:F(i),style:"width:"+F(a),viewBox:"0 0 "+1e3*a+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=Ee(["overlay"],[s],t);return l.height=i,l.style.height=F(i),l.style.width=F(a),l},svgData:Fe,tryCombineChars:function(e){for(var t=0;t<e.length-1;t++){var r=e[t],n=e[t+1];r instanceof $&&n instanceof $&&Oe(r,n)&&(r.text+=n.text,r.height=Math.max(r.height,n.height),r.depth=Math.max(r.depth,n.depth),r.italic=n.italic,e.splice(t+1,1),t--)}return e}},Ge={number:3,unit:"mu"},Ue={number:4,unit:"mu"},_e={number:5,unit:"mu"},Ye={mord:{mop:Ge,mbin:Ue,mrel:_e,minner:Ge},mop:{mord:Ge,mop:Ge,mrel:_e,minner:Ge},mbin:{mord:Ue,mop:Ue,mopen:Ue,minner:Ue},mrel:{mord:_e,mop:_e,mopen:_e,minner:_e},mopen:{},mclose:{mop:Ge,mbin:Ue,mrel:_e,minner:Ge},mpunct:{mord:Ge,mop:Ge,mrel:_e,mopen:Ge,mclose:Ge,mpunct:Ge,minner:Ge},minner:{mord:Ge,mop:Ge,mbin:Ue,mrel:_e,mopen:Ge,mpunct:Ge,minner:Ge}},Xe={mord:{mop:Ge},mop:{mord:Ge,mop:Ge},mbin:{},mrel:{},mopen:{},mclose:{mop:Ge},mpunct:{},minner:{mop:Ge}},We={},je={},$e={};function Ze(e){for(var t=e.type,r=e.names,n=e.props,a=e.handler,i=e.htmlBuilder,o=e.mathmlBuilder,s={type:t,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:void 0===n.allowedInMath||n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:a},l=0;l<r.length;++l)We[r[l]]=s;t&&(i&&(je[t]=i),o&&($e[t]=o))}function Ke(e){Ze({type:e.type,names:[],props:{numArgs:0},handler:function(){throw new Error("Should never be called.")},htmlBuilder:e.htmlBuilder,mathmlBuilder:e.mathmlBuilder})}var Je=function(e){return"ordgroup"===e.type&&1===e.body.length?e.body[0]:e},Qe=function(e){return"ordgroup"===e.type?e.body:[e]},et=Ve.makeSpan,tt=["leftmost","mbin","mopen","mrel","mop","mpunct"],rt=["rightmost","mrel","mclose","mpunct"],nt={display:x.DISPLAY,text:x.TEXT,script:x.SCRIPT,scriptscript:x.SCRIPTSCRIPT},at={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},it=function(e,t,r,n){void 0===n&&(n=[null,null]);for(var a=[],i=0;i<e.length;i++){var o=ct(e[i],t);if(o instanceof z){var s=o.children;a.push.apply(a,s)}else a.push(o)}if(Ve.tryCombineChars(a),!r)return a;var h=t;if(1===e.length){var c=e[0];"sizing"===c.type?h=t.havingSize(c.size):"styling"===c.type&&(h=t.havingStyle(nt[c.style]))}var m=et([n[0]||"leftmost"],[],t),u=et([n[1]||"rightmost"],[],t),p="root"===r;return ot(a,(function(e,t){var r=t.classes[0],n=e.classes[0];"mbin"===r&&l.contains(rt,n)?t.classes[0]="mord":"mbin"===n&&l.contains(tt,r)&&(e.classes[0]="mord")}),{node:m},u,p),ot(a,(function(e,t){var r=lt(t),n=lt(e),a=r&&n?e.hasClass("mtight")?Xe[r][n]:Ye[r][n]:null;if(a)return Ve.makeGlue(a,h)}),{node:m},u,p),a},ot=function e(t,r,n,a,i){a&&t.push(a);for(var o=0;o<t.length;o++){var s=t[o],l=st(s);if(l)e(l.children,r,n,null,i);else{var h=!s.hasClass("mspace");if(h){var c=r(s,n.node);c&&(n.insertAfter?n.insertAfter(c):(t.unshift(c),o++))}h?n.node=s:i&&s.hasClass("newline")&&(n.node=et(["leftmost"])),n.insertAfter=function(e){return function(r){t.splice(e+1,0,r),o++}}(o)}}a&&t.pop()},st=function(e){return e instanceof z||e instanceof X||e instanceof Y&&e.hasClass("enclosing")?e:null},lt=function(e,t){return e?(t&&(e=function e(t,r){var n=st(t);if(n){var a=n.children;if(a.length){if("right"===r)return e(a[a.length-1],"right");if("left"===r)return e(a[0],"left")}}return t}(e,t)),at[e.classes[0]]||null):null},ht=function(e,t){var r=["nulldelimiter"].concat(e.baseSizingClasses());return et(t.concat(r))},ct=function(e,t,r){if(!e)return et();if(je[e.type]){var a=je[e.type](e,t);if(r&&t.size!==r.size){a=et(t.sizingClasses(r),[a],t);var i=t.sizeMultiplier/r.sizeMultiplier;a.height*=i,a.depth*=i}return a}throw new n("Got group of unknown type: '"+e.type+"'")};function mt(e,t){var r=et(["base"],e,t),n=et(["strut"]);return n.style.height=F(r.height+r.depth),r.depth&&(n.style.verticalAlign=F(-r.depth)),r.children.unshift(n),r}function ut(e,t){var r=null;1===e.length&&"tag"===e[0].type&&(r=e[0].tag,e=e[0].body);var n,a=it(e,t,"root");2===a.length&&a[1].hasClass("tag")&&(n=a.pop());for(var i,o=[],s=[],l=0;l<a.length;l++)if(s.push(a[l]),a[l].hasClass("mbin")||a[l].hasClass("mrel")||a[l].hasClass("allowbreak")){for(var h=!1;l<a.length-1&&a[l+1].hasClass("mspace")&&!a[l+1].hasClass("newline");)l++,s.push(a[l]),a[l].hasClass("nobreak")&&(h=!0);h||(o.push(mt(s,t)),s=[])}else a[l].hasClass("newline")&&(s.pop(),s.length>0&&(o.push(mt(s,t)),s=[]),o.push(a[l]));s.length>0&&o.push(mt(s,t)),r?((i=mt(it(r,t,!0))).classes=["tag"],o.push(i)):n&&o.push(n);var c=et(["katex-html"],o);if(c.setAttribute("aria-hidden","true"),i){var m=i.children[0];m.style.height=F(c.height+c.depth),c.depth&&(m.style.verticalAlign=F(-c.depth))}return c}function pt(e){return new z(e)}var dt=function(){function e(e,t,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=r||[]}var t=e.prototype;return t.setAttribute=function(e,t){this.attributes[e]=t},t.getAttribute=function(e){return this.attributes[e]},t.toNode=function(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=V(this.classes));for(var r=0;r<this.children.length;r++)e.appendChild(this.children[r].toNode());return e},t.toMarkup=function(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=l.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+l.escape(V(this.classes))+'"'),e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</"+this.type+">"},t.toText=function(){return this.children.map((function(e){return e.toText()})).join("")},e}(),ft=function(){function e(e){this.text=void 0,this.text=e}var t=e.prototype;return t.toNode=function(){return document.createTextNode(this.text)},t.toMarkup=function(){return l.escape(this.toText())},t.toText=function(){return this.text},e}(),gt={MathNode:dt,TextNode:ft,SpaceNode:function(){function e(e){this.width=void 0,this.character=void 0,this.width=e,this.character=e>=.05555&&e<=.05556?"â":e>=.1666&&e<=.1667?"â":e>=.2222&&e<=.2223?"â
":e>=.2777&&e<=.2778?"â
â":e>=-.05556&&e<=-.05555?"ââ£":e>=-.1667&&e<=-.1666?"ââ£":e>=-.2223&&e<=-.2222?"ââ£":e>=-.2778&&e<=-.2777?"â
â£":null}var t=e.prototype;return t.toNode=function(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",F(this.width)),e},t.toMarkup=function(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+F(this.width)+'"/>'},t.toText=function(){return this.character?this.character:" "},e}(),newDocumentFragment:pt},vt=function(e,t,r){return!ne[t][e]||!ne[t][e].replace||55349===e.charCodeAt(0)||de.hasOwnProperty(e)&&r&&(r.fontFamily&&"tt"===r.fontFamily.substr(4,2)||r.font&&"tt"===r.font.substr(4,2))||(e=ne[t][e].replace),new gt.TextNode(e)},yt=function(e){return 1===e.length?e[0]:new gt.MathNode("mrow",e)},bt=function(e,t){if("texttt"===t.fontFamily)return"monospace";if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold";var r=t.font;if(!r||"mathnormal"===r)return null;var n=e.mode;if("mathit"===r)return"italic";if("boldsymbol"===r)return"textord"===e.type?"bold":"bold-italic";if("mathbf"===r)return"bold";if("mathbb"===r)return"double-struck";if("mathfrak"===r)return"fraktur";if("mathscr"===r||"mathcal"===r)return"script";if("mathsf"===r)return"sans-serif";if("mathtt"===r)return"monospace";var a=e.text;return l.contains(["\\imath","\\jmath"],a)?null:(ne[n][a]&&ne[n][a].replace&&(a=ne[n][a].replace),C(a,Ve.fontMap[r].fontName,n)?Ve.fontMap[r].variant:null)},xt=function(e,t,r){if(1===e.length){var n=kt(e[0],t);return r&&n instanceof dt&&"mo"===n.type&&(n.setAttribute("lspace","0em"),n.setAttribute("rspace","0em")),[n]}for(var a,i=[],o=0;o<e.length;o++){var s=kt(e[o],t);if(s instanceof dt&&a instanceof dt){if("mtext"===s.type&&"mtext"===a.type&&s.getAttribute("mathvariant")===a.getAttribute("mathvariant")){var l;(l=a.children).push.apply(l,s.children);continue}if("mn"===s.type&&"mn"===a.type){var h;(h=a.children).push.apply(h,s.children);continue}if("mi"===s.type&&1===s.children.length&&"mn"===a.type){var c=s.children[0];if(c instanceof ft&&"."===c.text){var m;(m=a.children).push.apply(m,s.children);continue}}else if("mi"===a.type&&1===a.children.length){var u=a.children[0];if(u instanceof ft&&"̸"===u.text&&("mo"===s.type||"mi"===s.type||"mn"===s.type)){var p=s.children[0];p instanceof ft&&p.text.length>0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),i.pop())}}}i.push(s),a=s}return i},wt=function(e,t,r){return yt(xt(e,t,r))},kt=function(e,t){if(!e)return new gt.MathNode("mrow");if($e[e.type])return $e[e.type](e,t);throw new n("Got group of unknown type: '"+e.type+"'")};function St(e,t,r,n,a){var i,o=xt(e,r);i=1===o.length&&o[0]instanceof dt&&l.contains(["mrow","mtable"],o[0].type)?o[0]:new gt.MathNode("mrow",o);var s=new gt.MathNode("annotation",[new gt.TextNode(t)]);s.setAttribute("encoding","application/x-tex");var h=new gt.MathNode("semantics",[i,s]),c=new gt.MathNode("math",[h]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&c.setAttribute("display","block");var m=a?"katex":"katex-mathml";return Ve.makeSpan([m],[c])}var Mt=function(e){return new H({style:e.displayMode?x.DISPLAY:x.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},zt=function(e,t){if(t.displayMode){var r=["katex-display"];t.leqno&&r.push("leqno"),t.fleqn&&r.push("fleqn"),e=Ve.makeSpan(r,[e])}return e},At={widehat:"^",widecheck:"Ë",widetilde:"~",utilde:"~",overleftarrow:"â",underleftarrow:"â",xleftarrow:"â",overrightarrow:"â",underrightarrow:"â",xrightarrow:"â",underbrace:"â",overbrace:"â",overgroup:"â ",undergroup:"â¡",overleftrightarrow:"â",underleftrightarrow:"â",xleftrightarrow:"â",Overrightarrow:"â",xRightarrow:"â",overleftharpoon:"â¼",xleftharpoonup:"â¼",overrightharpoon:"â",xrightharpoonup:"â",xLeftarrow:"â",xLeftrightarrow:"â",xhookleftarrow:"â©",xhookrightarrow:"âª",xmapsto:"â¦",xrightharpoondown:"â",xleftharpoondown:"â½",xrightleftharpoons:"â",xleftrightharpoons:"â",xtwoheadleftarrow:"â",xtwoheadrightarrow:"â ",xlongequal:"=",xtofrom:"â",xrightleftarrows:"â",xrightequilibrium:"â",xleftequilibrium:"â","\\cdrightarrow":"â","\\cdleftarrow":"â","\\cdlongequal":"="},Tt={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.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"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Bt=function(e,t,r,n,a){var i,o=e.height+e.depth+r+n;if(/fbox|color|angl/.test(t)){if(i=Ve.makeSpan(["stretchy",t],[],a),"fbox"===t){var s=a.color&&a.getColor();s&&(i.style.borderColor=s)}}else{var l=[];/^[bx]cancel$/.test(t)&&l.push(new J({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&l.push(new J({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new Z(l,{width:"100%",height:F(o)});i=Ve.makeSvgSpan([],[h],a)}return i.height=o,i.style.height=F(o),i},Ct=function(e){var t=new gt.MathNode("mo",[new gt.TextNode(At[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},Nt=function(e,t){var r=function(){var r=4e5,n=e.label.substr(1);if(l.contains(["widehat","widecheck","widetilde","utilde"],n)){var a,i,o,s="ordgroup"===(d=e.base).type?d.body.length:1;if(s>5)"widehat"===n||"widecheck"===n?(a=420,r=2364,o=.42,i=n+"4"):(a=312,r=2340,o=.34,i="tilde4");else{var h=[1,1,2,2,3,3][s];"widehat"===n||"widecheck"===n?(r=[0,1062,2364,2364,2364][h],a=[0,239,300,360,420][h],o=[0,.24,.3,.3,.36,.42][h],i=n+h):(r=[0,600,1033,2339,2340][h],a=[0,260,286,306,312][h],o=[0,.26,.286,.3,.306,.34][h],i="tilde"+h)}var c=new K(i),m=new Z([c],{width:"100%",height:F(o),viewBox:"0 0 "+r+" "+a,preserveAspectRatio:"none"});return{span:Ve.makeSvgSpan([],[m],t),minWidth:0,height:o}}var u,p,d,f=[],g=Tt[n],v=g[0],y=g[1],b=g[2],x=b/1e3,w=v.length;if(1===w)u=["hide-tail"],p=[g[3]];else if(2===w)u=["halfarrow-left","halfarrow-right"],p=["xMinYMin","xMaxYMin"];else{if(3!==w)throw new Error("Correct katexImagesData or update code here to support\n "+w+" children.");u=["brace-left","brace-center","brace-right"],p=["xMinYMin","xMidYMin","xMaxYMin"]}for(var k=0;k<w;k++){var S=new K(v[k]),M=new Z([S],{width:"400em",height:F(x),viewBox:"0 0 "+r+" "+b,preserveAspectRatio:p[k]+" slice"}),z=Ve.makeSvgSpan([u[k]],[M],t);if(1===w)return{span:z,minWidth:y,height:x};z.style.height=F(x),f.push(z)}return{span:Ve.makeSpan(["stretchy"],f,t),minWidth:y,height:x}}(),n=r.span,a=r.minWidth,i=r.height;return n.height=i,n.style.height=F(i),a>0&&(n.style.minWidth=F(a)),n};function qt(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function It(e){var t=Ot(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function Ot(e){return e&&("atom"===e.type||te.hasOwnProperty(e.type))?e:null}var Rt=function(e,t){var r,n,a;e&&"supsub"===e.type?(r=(n=qt(e.base,"accent")).base,e.base=r,a=function(e){if(e instanceof Y)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}(ct(e,t)),e.base=n):r=(n=qt(e,"accent")).base;var i=ct(r,t.havingCrampedStyle()),o=0;if(n.isShifty&&l.isCharacterBox(r)){var s=l.getBaseElem(r);o=Q(ct(s,t.havingCrampedStyle())).skew}var h,c="\\c"===n.label,m=c?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight);if(n.isStretchy)h=Nt(n,t),h=Ve.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:h,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+F(2*o)+")",marginLeft:F(2*o)}:void 0}]},t);else{var u,p;"\\vec"===n.label?(u=Ve.staticSvg("vec",t),p=Ve.svgData.vec[1]):((u=Q(u=Ve.makeOrd({mode:n.mode,text:n.label},t,"textord"))).italic=0,p=u.width,c&&(m+=u.depth)),h=Ve.makeSpan(["accent-body"],[u]);var d="\\textcircled"===n.label;d&&(h.classes.push("accent-full"),m=i.height);var f=o;d||(f-=p/2),h.style.left=F(f),"\\textcircled"===n.label&&(h.style.top=".2em"),h=Ve.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:h}]},t)}var g=Ve.makeSpan(["mord","accent"],[h],t);return a?(a.children[0]=g,a.height=Math.max(g.height,a.height),a.classes[0]="mord",a):g},Ht=function(e,t){var r=e.isStretchy?Ct(e.label):new gt.MathNode("mo",[vt(e.label,e.mode)]),n=new gt.MathNode("mover",[kt(e.base,t),r]);return n.setAttribute("accent","true"),n},Et=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map((function(e){return"\\"+e})).join("|"));Ze({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:function(e,t){var r=Je(t[0]),n=!Et.test(e.funcName),a=!n||"\\widehat"===e.funcName||"\\widetilde"===e.funcName||"\\widecheck"===e.funcName;return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,isShifty:a,base:r}},htmlBuilder:Rt,mathmlBuilder:Ht}),Ze({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:function(e,t){var r=t[0],n=e.parser.mode;return"math"===n&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:Rt,mathmlBuilder:Ht}),Ze({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"accentUnder",mode:r.mode,label:n,base:a}},htmlBuilder:function(e,t){var r=ct(e.base,t),n=Nt(e,t),a="\\utilde"===e.label?.12:0,i=Ve.makeVList({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:a},{type:"elem",elem:r}]},t);return Ve.makeSpan(["mord","accentunder"],[i],t)},mathmlBuilder:function(e,t){var r=Ct(e.label),n=new gt.MathNode("munder",[kt(e.base,t),r]);return n.setAttribute("accentunder","true"),n}});var Lt=function(e){var t=new gt.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};Ze({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler:function(e,t,r){var n=e.parser,a=e.funcName;return{type:"xArrow",mode:n.mode,label:a,body:t[0],below:r[0]}},htmlBuilder:function(e,t){var r,n=t.style,a=t.havingStyle(n.sup()),i=Ve.wrapFragment(ct(e.body,a,t),t),o="\\x"===e.label.slice(0,2)?"x":"cd";i.classes.push(o+"-arrow-pad"),e.below&&(a=t.havingStyle(n.sub()),(r=Ve.wrapFragment(ct(e.below,a,t),t)).classes.push(o+"-arrow-pad"));var s,l=Nt(e,t),h=-t.fontMetrics().axisHeight+.5*l.height,c=-t.fontMetrics().axisHeight-.5*l.height-.111;if((i.depth>.25||"\\xleftequilibrium"===e.label)&&(c-=i.depth),r){var m=-t.fontMetrics().axisHeight+r.height+.5*l.height+.111;s=Ve.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:l,shift:h},{type:"elem",elem:r,shift:m}]},t)}else s=Ve.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:l,shift:h}]},t);return s.children[0].children[0].children[1].classes.push("svg-align"),Ve.makeSpan(["mrel","x-arrow"],[s],t)},mathmlBuilder:function(e,t){var r,n=Ct(e.label);if(n.setAttribute("minsize","x"===e.label.charAt(0)?"1.75em":"3.0em"),e.body){var a=Lt(kt(e.body,t));if(e.below){var i=Lt(kt(e.below,t));r=new gt.MathNode("munderover",[n,i,a])}else r=new gt.MathNode("mover",[n,a])}else if(e.below){var o=Lt(kt(e.below,t));r=new gt.MathNode("munder",[n,o])}else r=Lt(),r=new gt.MathNode("mover",[n,r]);return r}});var Dt={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Pt=function(e){return"textord"===e.type&&"@"===e.text};function Ft(e,t,r){var n=Dt[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":var a={type:"atom",text:n,mode:"math",family:"rel"},i={type:"ordgroup",mode:"math",body:[r.callFunction("\\\\cdleft",[t[0]],[]),r.callFunction("\\Big",[a],[]),r.callFunction("\\\\cdright",[t[1]],[])]};return r.callFunction("\\\\cdparent",[i],[]);case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":return r.callFunction("\\Big",[{type:"textord",text:"\\Vert",mode:"math"}],[]);default:return{type:"textord",text:" ",mode:"math"}}}Ze({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:t[0]}},htmlBuilder:function(e,t){var r=t.havingStyle(t.style.sup()),n=Ve.wrapFragment(ct(e.label,r,t),t);return n.classes.push("cd-label-"+e.side),n.style.bottom=F(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder:function(e,t){var r=new gt.MathNode("mrow",[kt(e.label,t)]);return(r=new gt.MathNode("mpadded",[r])).setAttribute("width","0"),"left"===e.side&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),(r=new gt.MathNode("mstyle",[r])).setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}}),Ze({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler:function(e,t){return{type:"cdlabelparent",mode:e.parser.mode,fragment:t[0]}},htmlBuilder:function(e,t){var r=Ve.wrapFragment(ct(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder:function(e,t){return new gt.MathNode("mrow",[kt(e.fragment,t)])}}),Ze({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler:function(e,t){for(var r=e.parser,a=qt(t[0],"ordgroup").body,i="",o=0;o<a.length;o++)i+=qt(a[o],"textord").text;var s,l=parseInt(i);if(isNaN(l))throw new n("\\@char has non-numeric argument "+i);if(l<0||l>=1114111)throw new n("\\@char with invalid code point "+i);return l<=65535?s=String.fromCharCode(l):(l-=65536,s=String.fromCharCode(55296+(l>>10),56320+(1023&l))),{type:"textord",mode:r.mode,text:s}}});var Vt=function(e,t){var r=it(e.body,t.withColor(e.color),!1);return Ve.makeFragment(r)},Gt=function(e,t){var r=xt(e.body,t.withColor(e.color)),n=new gt.MathNode("mstyle",r);return n.setAttribute("mathcolor",e.color),n};Ze({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler:function(e,t){var r=e.parser,n=qt(t[0],"color-token").color,a=t[1];return{type:"color",mode:r.mode,color:n,body:Qe(a)}},htmlBuilder:Vt,mathmlBuilder:Gt}),Ze({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler:function(e,t){var r=e.parser,n=e.breakOnTokenText,a=qt(t[0],"color-token").color;r.gullet.macros.set("\\current@color",a);var i=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:a,body:i}},htmlBuilder:Vt,mathmlBuilder:Gt}),Ze({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:1,argTypes:["size"],allowedInText:!0},handler:function(e,t,r){var n=e.parser,a=r[0],i=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:i,size:a&&qt(a,"size").value}},htmlBuilder:function(e,t){var r=Ve.makeSpan(["mspace"],[],t);return e.newLine&&(r.classes.push("newline"),e.size&&(r.style.marginTop=F(P(e.size,t)))),r},mathmlBuilder:function(e,t){var r=new gt.MathNode("mspace");return e.newLine&&(r.setAttribute("linebreak","newline"),e.size&&r.setAttribute("height",F(P(e.size,t)))),r}});var Ut={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},_t=function(e){var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new n("Expected a control sequence",e);return t},Yt=function(e,t,r,n){var a=e.gullet.macros.get(r.text);null==a&&(r.noexpand=!0,a={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,a,n)};Ze({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler:function(e){var t=e.parser,r=e.funcName;t.consumeSpaces();var a=t.fetch();if(Ut[a.text])return"\\global"!==r&&"\\\\globallong"!==r||(a.text=Ut[a.text]),qt(t.parseFunction(),"internal");throw new n("Invalid token after macro prefix",a)}}),Ze({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler:function(e){var t=e.parser,r=e.funcName,a=t.gullet.popToken(),i=a.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new n("Expected a control sequence",a);for(var o,s=0,l=[[]];"{"!==t.gullet.future().text;)if("#"===(a=t.gullet.popToken()).text){if("{"===t.gullet.future().text){o=t.gullet.future(),l[s].push("{");break}if(a=t.gullet.popToken(),!/^[1-9]$/.test(a.text))throw new n('Invalid argument number "'+a.text+'"');if(parseInt(a.text)!==s+1)throw new n('Argument number "'+a.text+'" out of order');s++,l.push([])}else{if("EOF"===a.text)throw new n("Expected a macro definition");l[s].push(a.text)}var h=t.gullet.consumeArg().tokens;return o&&h.unshift(o),"\\edef"!==r&&"\\xdef"!==r||(h=t.gullet.expandTokens(h)).reverse(),t.gullet.macros.set(i,{tokens:h,numArgs:s,delimiters:l},r===Ut[r]),{type:"internal",mode:t.mode}}}),Ze({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler:function(e){var t=e.parser,r=e.funcName,n=_t(t.gullet.popToken());t.gullet.consumeSpaces();var a=function(e){var t=e.gullet.popToken();return"="===t.text&&" "===(t=e.gullet.popToken()).text&&(t=e.gullet.popToken()),t}(t);return Yt(t,n,a,"\\\\globallet"===r),{type:"internal",mode:t.mode}}}),Ze({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler:function(e){var t=e.parser,r=e.funcName,n=_t(t.gullet.popToken()),a=t.gullet.popToken(),i=t.gullet.popToken();return Yt(t,n,i,"\\\\globalfuture"===r),t.gullet.pushToken(i),t.gullet.pushToken(a),{type:"internal",mode:t.mode}}});var Xt=function(e,t,r){var n=C(ne.math[e]&&ne.math[e].replace||e,t,r);if(!n)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return n},Wt=function(e,t,r,n){var a=r.havingBaseStyle(t),i=Ve.makeSpan(n.concat(a.sizingClasses(r)),[e],r),o=a.sizeMultiplier/r.sizeMultiplier;return i.height*=o,i.depth*=o,i.maxFontSize=a.sizeMultiplier,i},jt=function(e,t,r){var n=t.havingBaseStyle(r),a=(1-t.sizeMultiplier/n.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=F(a),e.height-=a,e.depth+=a},$t=function(e,t,r,n,a,i){var o=function(e,t,r,n){return Ve.makeSymbol(e,"Size"+t+"-Regular",r,n)}(e,t,a,n),s=Wt(Ve.makeSpan(["delimsizing","size"+t],[o],n),x.TEXT,n,i);return r&&jt(s,n,x.TEXT),s},Zt=function(e,t,r){var n;return n="Size1-Regular"===t?"delim-size1":"delim-size4",{type:"elem",elem:Ve.makeSpan(["delimsizinginner",n],[Ve.makeSpan([],[Ve.makeSymbol(e,t,r)])])}},Kt=function(e,t,r){var n=A["Size4-Regular"][e.charCodeAt(0)]?A["Size4-Regular"][e.charCodeAt(0)][4]:A["Size1-Regular"][e.charCodeAt(0)][4],a=new K("inner",function(e,t){switch(e){case"â":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"â£":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"â¥":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145zM367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z";case"â":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"â¢":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"â¥":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"âª":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"â":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"â":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257zM478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z";default:return""}}(e,Math.round(1e3*t))),i=new Z([a],{width:F(n),height:F(t),style:"width:"+F(n),viewBox:"0 0 "+1e3*n+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),o=Ve.makeSvgSpan([],[i],r);return o.height=t,o.style.height=F(t),o.style.width=F(n),{type:"elem",elem:o}},Jt={type:"kern",size:-.008},Qt=["|","\\lvert","\\rvert","\\vert"],er=["\\|","\\lVert","\\rVert","\\Vert"],tr=function(e,t,r,n,a,i){var o,s,h,c;o=h=c=e,s=null;var m="Size1-Regular";"\\uparrow"===e?h=c="â":"\\Uparrow"===e?h=c="â":"\\downarrow"===e?o=h="â":"\\Downarrow"===e?o=h="â":"\\updownarrow"===e?(o="\\uparrow",h="â",c="\\downarrow"):"\\Updownarrow"===e?(o="\\Uparrow",h="â",c="\\Downarrow"):l.contains(Qt,e)?h="â£":l.contains(er,e)?h="â¥":"["===e||"\\lbrack"===e?(o="â¡",h="â¢",c="â£",m="Size4-Regular"):"]"===e||"\\rbrack"===e?(o="â¤",h="â¥",c="â¦",m="Size4-Regular"):"\\lfloor"===e||"â"===e?(h=o="â¢",c="â£",m="Size4-Regular"):"\\lceil"===e||"â"===e?(o="â¡",h=c="â¢",m="Size4-Regular"):"\\rfloor"===e||"â"===e?(h=o="â¥",c="â¦",m="Size4-Regular"):"\\rceil"===e||"â"===e?(o="â¤",h=c="â¥",m="Size4-Regular"):"("===e||"\\lparen"===e?(o="â",h="â",c="â",m="Size4-Regular"):")"===e||"\\rparen"===e?(o="â",h="â",c="â ",m="Size4-Regular"):"\\{"===e||"\\lbrace"===e?(o="â§",s="â¨",c="â©",h="âª",m="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(o="â«",s="â¬",c="â",h="âª",m="Size4-Regular"):"\\lgroup"===e||"â®"===e?(o="â§",c="â©",h="âª",m="Size4-Regular"):"\\rgroup"===e||"â¯"===e?(o="â«",c="â",h="âª",m="Size4-Regular"):"\\lmoustache"===e||"â°"===e?(o="â§",c="â",h="âª",m="Size4-Regular"):"\\rmoustache"!==e&&"â±"!==e||(o="â«",c="â©",h="âª",m="Size4-Regular");var u=Xt(o,m,a),p=u.height+u.depth,d=Xt(h,m,a),f=d.height+d.depth,g=Xt(c,m,a),v=g.height+g.depth,y=0,b=1;if(null!==s){var w=Xt(s,m,a);y=w.height+w.depth,b=2}var k=p+v+y,S=k+Math.max(0,Math.ceil((t-k)/(b*f)))*b*f,M=n.fontMetrics().axisHeight;r&&(M*=n.sizeMultiplier);var z=S/2-M,A=[];if(A.push(Zt(c,m,a)),A.push(Jt),null===s){var T=S-p-v+.016;A.push(Kt(h,T,n))}else{var B=(S-p-v-y)/2+.016;A.push(Kt(h,B,n)),A.push(Jt),A.push(Zt(s,m,a)),A.push(Jt),A.push(Kt(h,B,n))}A.push(Jt),A.push(Zt(o,m,a));var C=n.havingBaseStyle(x.TEXT),N=Ve.makeVList({positionType:"bottom",positionData:z,children:A},C);return Wt(Ve.makeSpan(["delimsizing","mult"],[N],C),x.TEXT,n,i)},rr=function(e,t,r,n,a){var i=function(e,t,r){t*=1e3;var n="";switch(e){case"sqrtMain":n=function(e,t){return"M95,"+(622+e+t)+"\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl"+e/2.075+" -"+e+"\nc5.3,-9.3,12,-14,20,-14\nH400000v"+(40+e)+"H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM"+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,80);break;case"sqrtSize1":n=function(e,t){return"M263,"+(601+e+t)+"c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl"+e/2.084+" -"+e+"\nc4.7,-7.3,11,-11,19,-11\nH40000v"+(40+e)+"H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,80);break;case"sqrtSize2":n=function(e,t){return"M983 "+(10+e+t)+"\nl"+e/3.13+" -"+e+"\nc4,-6.7,10,-10,18,-10 H400000v"+(40+e)+"\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,80);break;case"sqrtSize3":n=function(e,t){return"M424,"+(2398+e+t)+"\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl"+e/4.223+" -"+e+"c4,-6.7,10,-10,18,-10 H400000\nv"+(40+e)+"H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M"+(1001+e)+" "+t+"\nh400000v"+(40+e)+"h-400000z"}(t,80);break;case"sqrtSize4":n=function(e,t){return"M473,"+(2713+e+t)+"\nc339.3,-1799.3,509.3,-2700,510,-2702 l"+e/5.298+" -"+e+"\nc3.3,-7.3,9.3,-11,18,-11 H400000v"+(40+e)+"H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM"+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"}(t,80);break;case"sqrtTall":n=function(e,t,r){return"M702 "+(e+t)+"H400000"+(40+e)+"\nH742v"+(r-54-t-e)+"l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 "+t+"H400000v"+(40+e)+"H742z"}(t,80,r)}return n}(e,n,r),o=new K(e,i),s=new Z([o],{width:"400em",height:F(t),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return Ve.makeSvgSpan(["hide-tail"],[s],a)},nr=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","â","â","\\lceil","\\rceil","â","â","\\surd"],ar=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","â®","â¯","\\lmoustache","\\rmoustache","â°","â±"],ir=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],or=[0,1.2,1.8,2.4,3],sr=[{type:"small",style:x.SCRIPTSCRIPT},{type:"small",style:x.SCRIPT},{type:"small",style:x.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],lr=[{type:"small",style:x.SCRIPTSCRIPT},{type:"small",style:x.SCRIPT},{type:"small",style:x.TEXT},{type:"stack"}],hr=[{type:"small",style:x.SCRIPTSCRIPT},{type:"small",style:x.SCRIPT},{type:"small",style:x.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],cr=function(e){if("small"===e.type)return"Main-Regular";if("large"===e.type)return"Size"+e.size+"-Regular";if("stack"===e.type)return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},mr=function(e,t,r,n){for(var a=Math.min(2,3-n.style.size);a<r.length&&"stack"!==r[a].type;a++){var i=Xt(e,cr(r[a]),"math"),o=i.height+i.depth;if("small"===r[a].type&&(o*=n.havingBaseStyle(r[a].style).sizeMultiplier),o>t)return r[a]}return r[r.length-1]},ur=function(e,t,r,n,a,i){var o;"<"===e||"\\lt"===e||"â¨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"â©"!==e||(e="\\rangle"),o=l.contains(ir,e)?sr:l.contains(nr,e)?hr:lr;var s=mr(e,t,o,n);return"small"===s.type?function(e,t,r,n,a,i){var o=Ve.makeSymbol(e,"Main-Regular",a,n),s=Wt(o,t,n,i);return r&&jt(s,n,t),s}(e,s.style,r,n,a,i):"large"===s.type?$t(e,s.size,r,n,a,i):tr(e,t,r,n,a,i)},pr={sqrtImage:function(e,t){var r,n,a=t.havingBaseSizing(),i=mr("\\surd",e*a.sizeMultiplier,hr,a),o=a.sizeMultiplier,s=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),l=0,h=0,c=0;return"small"===i.type?(e<1?o=1:e<1.4&&(o=.7),h=(1+s)/o,(r=rr("sqrtMain",l=(1+s+.08)/o,c=1e3+1e3*s+80,s,t)).style.minWidth="0.853em",n=.833/o):"large"===i.type?(c=1080*or[i.size],h=(or[i.size]+s)/o,l=(or[i.size]+s+.08)/o,(r=rr("sqrtSize"+i.size,l,c,s,t)).style.minWidth="1.02em",n=1/o):(l=e+s+.08,h=e+s,c=Math.floor(1e3*e+s)+80,(r=rr("sqrtTall",l,c,s,t)).style.minWidth="0.742em",n=1.056),r.height=h,r.style.height=F(l),{span:r,advanceWidth:n,ruleWidth:(t.fontMetrics().sqrtRuleThickness+s)*o}},sizedDelim:function(e,t,r,a,i){if("<"===e||"\\lt"===e||"â¨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"â©"!==e||(e="\\rangle"),l.contains(nr,e)||l.contains(ir,e))return $t(e,t,!1,r,a,i);if(l.contains(ar,e))return tr(e,or[t],!1,r,a,i);throw new n("Illegal delimiter: '"+e+"'")},sizeToMaxHeight:or,customSizedDelim:ur,leftRightDelim:function(e,t,r,n,a,i){var o=n.fontMetrics().axisHeight*n.sizeMultiplier,s=5/n.fontMetrics().ptPerEm,l=Math.max(t-o,r+o),h=Math.max(l/500*901,2*l-s);return ur(e,h,!0,n,a,i)}},dr={"\\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}},fr=["(","\\lparen",")","\\rparen","[","\\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","."];function gr(e,t){var r=Ot(e);if(r&&l.contains(fr,r.text))return r;throw new n(r?"Invalid delimiter '"+r.text+"' after '"+t.funcName+"'":"Invalid delimiter type '"+e.type+"'",e)}function vr(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Ze({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:function(e,t){var r=gr(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:dr[e.funcName].size,mclass:dr[e.funcName].mclass,delim:r.text}},htmlBuilder:function(e,t){return"."===e.delim?Ve.makeSpan([e.mclass]):pr.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass])},mathmlBuilder:function(e){var t=[];"."!==e.delim&&t.push(vt(e.delim,e.mode));var r=new gt.MathNode("mo",t);"mopen"===e.mclass||"mclose"===e.mclass?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=F(pr.sizeToMaxHeight[e.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}}),Ze({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:function(e,t){var r=e.parser.gullet.macros.get("\\current@color");if(r&&"string"!=typeof r)throw new n("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:gr(t[0],e).text,color:r}}}),Ze({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:function(e,t){var r=gr(t[0],e),n=e.parser;++n.leftrightDepth;var a=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var i=qt(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:a,left:r.text,right:i.delim,rightColor:i.color}},htmlBuilder:function(e,t){vr(e);for(var r,n,a=it(e.body,t,!0,["mopen","mclose"]),i=0,o=0,s=!1,l=0;l<a.length;l++)a[l].isMiddle?s=!0:(i=Math.max(a[l].height,i),o=Math.max(a[l].depth,o));if(i*=t.sizeMultiplier,o*=t.sizeMultiplier,r="."===e.left?ht(t,["mopen"]):pr.leftRightDelim(e.left,i,o,t,e.mode,["mopen"]),a.unshift(r),s)for(var h=1;h<a.length;h++){var c=a[h].isMiddle;c&&(a[h]=pr.leftRightDelim(c.delim,i,o,c.options,e.mode,[]))}if("."===e.right)n=ht(t,["mclose"]);else{var m=e.rightColor?t.withColor(e.rightColor):t;n=pr.leftRightDelim(e.right,i,o,m,e.mode,["mclose"])}return a.push(n),Ve.makeSpan(["minner"],a,t)},mathmlBuilder:function(e,t){vr(e);var r=xt(e.body,t);if("."!==e.left){var n=new gt.MathNode("mo",[vt(e.left,e.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if("."!==e.right){var a=new gt.MathNode("mo",[vt(e.right,e.mode)]);a.setAttribute("fence","true"),e.rightColor&&a.setAttribute("mathcolor",e.rightColor),r.push(a)}return yt(r)}}),Ze({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:function(e,t){var r=gr(t[0],e);if(!e.parser.leftrightDepth)throw new n("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},htmlBuilder:function(e,t){var r;if("."===e.delim)r=ht(t,[]);else{r=pr.sizedDelim(e.delim,1,t,e.mode,[]);var n={delim:e.delim,options:t};r.isMiddle=n}return r},mathmlBuilder:function(e,t){var r="\\vert"===e.delim||"|"===e.delim?vt("|","text"):vt(e.delim,e.mode),n=new gt.MathNode("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var yr=function(e,t){var r,n,a,i=Ve.wrapFragment(ct(e.body,t),t),o=e.label.substr(1),s=t.sizeMultiplier,h=0,c=l.isCharacterBox(e.body);if("sout"===o)(r=Ve.makeSpan(["stretchy","sout"])).height=t.fontMetrics().defaultRuleThickness/s,h=-.5*t.fontMetrics().xHeight;else if("phase"===o){var m=P({number:.6,unit:"pt"},t),u=P({number:.35,unit:"ex"},t);s/=t.havingBaseSizing().sizeMultiplier;var p=i.height+i.depth+m+u;i.style.paddingLeft=F(p/2+m);var d=Math.floor(1e3*p*s),f="M400000 "+(n=d)+" H0 L"+n/2+" 0 l65 45 L145 "+(n-80)+" H400000z",g=new Z([new K("phase",f)],{width:"400em",height:F(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});(r=Ve.makeSvgSpan(["hide-tail"],[g],t)).style.height=F(p),h=i.depth+m+u}else{/cancel/.test(o)?c||i.classes.push("cancel-pad"):"angl"===o?i.classes.push("anglpad"):i.classes.push("boxpad");var v=0,y=0,b=0;/box/.test(o)?(b=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),y=v=t.fontMetrics().fboxsep+("colorbox"===o?0:b)):"angl"===o?(v=4*(b=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness)),y=Math.max(0,.25-i.depth)):y=v=c?.2:0,r=Bt(i,o,v,y,t),/fbox|boxed|fcolorbox/.test(o)?(r.style.borderStyle="solid",r.style.borderWidth=F(b)):"angl"===o&&.049!==b&&(r.style.borderTopWidth=F(b),r.style.borderRightWidth=F(b)),h=i.depth+y,e.backgroundColor&&(r.style.backgroundColor=e.backgroundColor,e.borderColor&&(r.style.borderColor=e.borderColor))}if(e.backgroundColor)a=Ve.makeVList({positionType:"individualShift",children:[{type:"elem",elem:r,shift:h},{type:"elem",elem:i,shift:0}]},t);else{var x=/cancel|phase/.test(o)?["svg-align"]:[];a=Ve.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:0},{type:"elem",elem:r,shift:h,wrapperClasses:x}]},t)}return/cancel/.test(o)&&(a.height=i.height,a.depth=i.depth),/cancel/.test(o)&&!c?Ve.makeSpan(["mord","cancel-lap"],[a],t):Ve.makeSpan(["mord"],[a],t)},br=function(e,t){var r=0,n=new gt.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[kt(e.body,t)]);switch(e.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),"\\fcolorbox"===e.label){var a=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);n.setAttribute("style","border: "+a+"em solid "+String(e.borderColor))}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return e.backgroundColor&&n.setAttribute("mathbackground",e.backgroundColor),n};Ze({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler:function(e,t,r){var n=e.parser,a=e.funcName,i=qt(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:n.mode,label:a,backgroundColor:i,body:o}},htmlBuilder:yr,mathmlBuilder:br}),Ze({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler:function(e,t,r){var n=e.parser,a=e.funcName,i=qt(t[0],"color-token").color,o=qt(t[1],"color-token").color,s=t[2];return{type:"enclose",mode:n.mode,label:a,backgroundColor:o,borderColor:i,body:s}},htmlBuilder:yr,mathmlBuilder:br}),Ze({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:function(e,t){return{type:"enclose",mode:e.parser.mode,label:"\\fbox",body:t[0]}}}),Ze({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"enclose",mode:r.mode,label:n,body:a}},htmlBuilder:yr,mathmlBuilder:br}),Ze({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler:function(e,t){return{type:"enclose",mode:e.parser.mode,label:"\\angl",body:t[0]}}});var xr={};function wr(e){for(var t=e.type,r=e.names,n=e.props,a=e.handler,i=e.htmlBuilder,o=e.mathmlBuilder,s={type:t,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:a},l=0;l<r.length;++l)xr[r[l]]=s;i&&(je[t]=i),o&&($e[t]=o)}var kr={};function Sr(e,t){kr[e]=t}var Mr=function(){function e(e,t,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=r}return e.range=function(t,r){return r?t&&t.loc&&r.loc&&t.loc.lexer===r.loc.lexer?new e(t.loc.lexer,t.loc.start,r.loc.end):null:t&&t.loc},e}(),zr=function(){function e(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}return e.prototype.range=function(t,r){return new e(r,Mr.range(this,t))},e}();function Ar(e){var t=[];e.consumeSpaces();for(var r=e.fetch().text;"\\hline"===r||"\\hdashline"===r;)e.consume(),t.push("\\hdashline"===r),e.consumeSpaces(),r=e.fetch().text;return t}var Tr=function(e){if(!e.parser.settings.displayMode)throw new n("{"+e.envName+"} can be used only in display mode.")};function Br(e){if(-1===e.indexOf("ed"))return-1===e.indexOf("*")}function Cr(e,t,r){var a=t.hskipBeforeAndAfter,i=t.addJot,o=t.cols,s=t.arraystretch,l=t.colSeparationType,h=t.autoTag,c=t.singleRow,m=t.emptySingleRow,u=t.maxNumCols,p=t.leqno;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!s){var d=e.gullet.expandMacroAsText("\\arraystretch");if(null==d)s=1;else if(!(s=parseFloat(d))||s<0)throw new n("Invalid \\arraystretch: "+d)}e.gullet.beginGroup();var f=[],g=[f],v=[],y=[],b=null!=h?[]:void 0;function x(){h&&e.gullet.macros.set("\\@eqnsw","1",!0)}function w(){b&&(e.gullet.macros.get("\\df@tag")?(b.push(e.subparse([new zr("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):b.push(Boolean(h)&&"1"===e.gullet.macros.get("\\@eqnsw")))}for(x(),y.push(Ar(e));;){var k=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),k={type:"ordgroup",mode:e.mode,body:k},r&&(k={type:"styling",mode:e.mode,style:r,body:[k]}),f.push(k);var S=e.fetch().text;if("&"===S){if(u&&f.length===u){if(c||l)throw new n("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else{if("\\end"===S){w(),1===f.length&&"styling"===k.type&&0===k.body[0].body.length&&(g.length>1||!m)&&g.pop(),y.length<g.length+1&&y.push([]);break}if("\\\\"!==S)throw new n("Expected & or \\\\ or \\cr or \\end",e.nextToken);e.consume();var M=void 0;" "!==e.gullet.future().text&&(M=e.parseSizeGroup(!0)),v.push(M?M.value:null),w(),y.push(Ar(e)),f=[],g.push(f),x()}}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:i,arraystretch:s,body:g,cols:o,rowGaps:v,hskipBeforeAndAfter:a,hLinesBeforeRow:y,colSeparationType:l,tags:b,leqno:p}}function Nr(e){return"d"===e.substr(0,1)?"display":"text"}var qr=function(e,t){var r,a,i=e.body.length,o=e.hLinesBeforeRow,s=0,h=new Array(i),c=[],m=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),u=1/t.fontMetrics().ptPerEm,p=5*u;e.colSeparationType&&"small"===e.colSeparationType&&(p=t.havingStyle(x.SCRIPT).sizeMultiplier/t.sizeMultiplier*.2778);var d="CD"===e.colSeparationType?P({number:3,unit:"ex"},t):12*u,f=3*u,g=e.arraystretch*d,v=.7*g,y=.3*g,b=0;function w(e){for(var t=0;t<e.length;++t)t>0&&(b+=.25),c.push({pos:b,isDashed:e[t]})}for(w(o[0]),r=0;r<e.body.length;++r){var k=e.body[r],S=v,M=y;s<k.length&&(s=k.length);var z=new Array(k.length);for(a=0;a<k.length;++a){var A=ct(k[a],t);M<A.depth&&(M=A.depth),S<A.height&&(S=A.height),z[a]=A}var T=e.rowGaps[r],B=0;T&&(B=P(T,t))>0&&(M<(B+=y)&&(M=B),B=0),e.addJot&&(M+=f),z.height=S,z.depth=M,b+=S,z.pos=b,b+=M+B,h[r]=z,w(o[r+1])}var C,N,q=b/2+t.fontMetrics().axisHeight,I=e.cols||[],O=[],R=[];if(e.tags&&e.tags.some((function(e){return e})))for(r=0;r<i;++r){var H=h[r],E=H.pos-q,L=e.tags[r],D=void 0;(D=!0===L?Ve.makeSpan(["eqn-num"],[],t):!1===L?Ve.makeSpan([],[],t):Ve.makeSpan([],it(L,t,!0),t)).depth=H.depth,D.height=H.height,R.push({type:"elem",elem:D,shift:E})}for(a=0,N=0;a<s||N<I.length;++a,++N){for(var V=I[N]||{},G=!0;"separator"===V.type;){if(G||((C=Ve.makeSpan(["arraycolsep"],[])).style.width=F(t.fontMetrics().doubleRuleSep),O.push(C)),"|"!==V.separator&&":"!==V.separator)throw new n("Invalid separator type: "+V.separator);var U="|"===V.separator?"solid":"dashed",_=Ve.makeSpan(["vertical-separator"],[],t);_.style.height=F(b),_.style.borderRightWidth=F(m),_.style.borderRightStyle=U,_.style.margin="0 "+F(-m/2);var Y=b-q;Y&&(_.style.verticalAlign=F(-Y)),O.push(_),V=I[++N]||{},G=!1}if(!(a>=s)){var X=void 0;(a>0||e.hskipBeforeAndAfter)&&0!==(X=l.deflt(V.pregap,p))&&((C=Ve.makeSpan(["arraycolsep"],[])).style.width=F(X),O.push(C));var W=[];for(r=0;r<i;++r){var j=h[r],$=j[a];if($){var Z=j.pos-q;$.depth=j.depth,$.height=j.height,W.push({type:"elem",elem:$,shift:Z})}}W=Ve.makeVList({positionType:"individualShift",children:W},t),W=Ve.makeSpan(["col-align-"+(V.align||"c")],[W]),O.push(W),(a<s-1||e.hskipBeforeAndAfter)&&0!==(X=l.deflt(V.postgap,p))&&((C=Ve.makeSpan(["arraycolsep"],[])).style.width=F(X),O.push(C))}}if(h=Ve.makeSpan(["mtable"],O),c.length>0){for(var K=Ve.makeLineSpan("hline",t,m),J=Ve.makeLineSpan("hdashline",t,m),Q=[{type:"elem",elem:h,shift:0}];c.length>0;){var ee=c.pop(),te=ee.pos-q;ee.isDashed?Q.push({type:"elem",elem:J,shift:te}):Q.push({type:"elem",elem:K,shift:te})}h=Ve.makeVList({positionType:"individualShift",children:Q},t)}if(0===R.length)return Ve.makeSpan(["mord"],[h],t);var re=Ve.makeVList({positionType:"individualShift",children:R},t);return re=Ve.makeSpan(["tag"],[re],t),Ve.makeFragment([h,re])},Ir={c:"center ",l:"left ",r:"right "},Or=function(e,t){for(var r=[],n=new gt.MathNode("mtd",[],["mtr-glue"]),a=new gt.MathNode("mtd",[],["mml-eqn-num"]),i=0;i<e.body.length;i++){for(var o=e.body[i],s=[],l=0;l<o.length;l++)s.push(new gt.MathNode("mtd",[kt(o[l],t)]));e.tags&&e.tags[i]&&(s.unshift(n),s.push(n),e.leqno?s.unshift(a):s.push(a)),r.push(new gt.MathNode("mtr",s))}var h=new gt.MathNode("mtable",r),c=.5===e.arraystretch?.1:.16+e.arraystretch-1+(e.addJot?.09:0);h.setAttribute("rowspacing",F(c));var m="",u="";if(e.cols&&e.cols.length>0){var p=e.cols,d="",f=!1,g=0,v=p.length;"separator"===p[0].type&&(m+="top ",g=1),"separator"===p[p.length-1].type&&(m+="bottom ",v-=1);for(var y=g;y<v;y++)"align"===p[y].type?(u+=Ir[p[y].align],f&&(d+="none "),f=!0):"separator"===p[y].type&&f&&(d+="|"===p[y].separator?"solid ":"dashed ",f=!1);h.setAttribute("columnalign",u.trim()),/[sd]/.test(d)&&h.setAttribute("columnlines",d.trim())}if("align"===e.colSeparationType){for(var b=e.cols||[],x="",w=1;w<b.length;w++)x+=w%2?"0em ":"1em ";h.setAttribute("columnspacing",x.trim())}else"alignat"===e.colSeparationType||"gather"===e.colSeparationType?h.setAttribute("columnspacing","0em"):"small"===e.colSeparationType?h.setAttribute("columnspacing","0.2778em"):"CD"===e.colSeparationType?h.setAttribute("columnspacing","0.5em"):h.setAttribute("columnspacing","1em");var k="",S=e.hLinesBeforeRow;m+=S[0].length>0?"left ":"",m+=S[S.length-1].length>0?"right ":"";for(var M=1;M<S.length-1;M++)k+=0===S[M].length?"none ":S[M][0]?"dashed ":"solid ";return/[sd]/.test(k)&&h.setAttribute("rowlines",k.trim()),""!==m&&(h=new gt.MathNode("menclose",[h])).setAttribute("notation",m.trim()),e.arraystretch&&e.arraystretch<1&&(h=new gt.MathNode("mstyle",[h])).setAttribute("scriptlevel","1"),h},Rr=function(e,t){-1===e.envName.indexOf("ed")&&Tr(e);var r,a=[],i=e.envName.indexOf("at")>-1?"alignat":"align",o="split"===e.envName,s=Cr(e.parser,{cols:a,addJot:!0,autoTag:o?void 0:Br(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:o?2:void 0,leqno:e.parser.settings.leqno},"display"),l=0,h={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&"ordgroup"===t[0].type){for(var c="",m=0;m<t[0].body.length;m++)c+=qt(t[0].body[m],"textord").text;r=Number(c),l=2*r}var u=!l;s.body.forEach((function(e){for(var t=1;t<e.length;t+=2){var a=qt(e[t],"styling");qt(a.body[0],"ordgroup").body.unshift(h)}if(u)l<e.length&&(l=e.length);else{var i=e.length/2;if(r<i)throw new n("Too many math in a row: expected "+r+", but got "+i,e[0])}}));for(var p=0;p<l;++p){var d="r",f=0;p%2==1?d="l":p>0&&u&&(f=1),a[p]={type:"align",align:d,pregap:f,postgap:0}}return s.colSeparationType=u?"align":"alignat",s};wr({type:"array",names:["array","darray"],props:{numArgs:1},handler:function(e,t){var r=(Ot(t[0])?[t[0]]:qt(t[0],"ordgroup").body).map((function(e){var t=It(e).text;if(-1!=="lcr".indexOf(t))return{type:"align",align:t};if("|"===t)return{type:"separator",separator:"|"};if(":"===t)return{type:"separator",separator:":"};throw new n("Unknown column alignment: "+t,e)})),a={cols:r,hskipBeforeAndAfter:!0,maxNumCols:r.length};return Cr(e.parser,a,Nr(e.envName))},htmlBuilder:qr,mathmlBuilder:Or}),wr({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler:function(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",a={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if("*"===e.envName.charAt(e.envName.length-1)){var i=e.parser;if(i.consumeSpaces(),"["===i.fetch().text){if(i.consume(),i.consumeSpaces(),r=i.fetch().text,-1==="lcr".indexOf(r))throw new n("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),a.cols=[{type:"align",align:r}]}}var o=Cr(e.parser,a,Nr(e.envName)),s=Math.max.apply(Math,[0].concat(o.body.map((function(e){return e.length}))));return o.cols=new Array(s).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[o],left:t[0],right:t[1],rightColor:void 0}:o},htmlBuilder:qr,mathmlBuilder:Or}),wr({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:function(e){var t=Cr(e.parser,{arraystretch:.5},"script");return t.colSeparationType="small",t},htmlBuilder:qr,mathmlBuilder:Or}),wr({type:"array",names:["subarray"],props:{numArgs:1},handler:function(e,t){var r=(Ot(t[0])?[t[0]]:qt(t[0],"ordgroup").body).map((function(e){var t=It(e).text;if(-1!=="lc".indexOf(t))return{type:"align",align:t};throw new n("Unknown column alignment: "+t,e)}));if(r.length>1)throw new n("{subarray} can contain only one column");var a={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5};if((a=Cr(e.parser,a,"script")).body.length>0&&a.body[0].length>1)throw new n("{subarray} can contain only one column");return a},htmlBuilder:qr,mathmlBuilder:Or}),wr({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler:function(e){var t=Cr(e.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},Nr(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:qr,mathmlBuilder:Or}),wr({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Rr,htmlBuilder:qr,mathmlBuilder:Or}),wr({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler:function(e){l.contains(["gather","gather*"],e.envName)&&Tr(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Br(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Cr(e.parser,t,"display")},htmlBuilder:qr,mathmlBuilder:Or}),wr({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Rr,htmlBuilder:qr,mathmlBuilder:Or}),wr({type:"array",names:["equation","equation*"],props:{numArgs:0},handler:function(e){Tr(e);var t={autoTag:Br(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Cr(e.parser,t,"display")},htmlBuilder:qr,mathmlBuilder:Or}),wr({type:"array",names:["CD"],props:{numArgs:0},handler:function(e){return Tr(e),function(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if("&"!==r&&"\\\\"!==r){if("\\end"===r){0===t[t.length-1].length&&t.pop();break}throw new n("Expected \\\\ or \\cr or \\end",e.nextToken)}e.consume()}for(var a,i,o=[],s=[o],l=0;l<t.length;l++){for(var h=t[l],c={type:"styling",body:[],mode:"math",style:"display"},m=0;m<h.length;m++)if(Pt(h[m])){o.push(c);var u=It(h[m+=1]).text,p=new Array(2);if(p[0]={type:"ordgroup",mode:"math",body:[]},p[1]={type:"ordgroup",mode:"math",body:[]},"=|.".indexOf(u)>-1);else{if(!("<>AV".indexOf(u)>-1))throw new n('Expected one of "<>AV=|." after @',h[m]);for(var d=0;d<2;d++){for(var f=!0,g=m+1;g<h.length;g++){if(a=h[g],i=u,("mathord"===a.type||"atom"===a.type)&&a.text===i){f=!1,m=g;break}if(Pt(h[g]))throw new n("Missing a "+u+" character to complete a CD arrow.",h[g]);p[d].body.push(h[g])}if(f)throw new n("Missing a "+u+" character to complete a CD arrow.",h[m])}}var v={type:"styling",body:[Ft(u,p,e)],mode:"math",style:"display"};o.push(v),c={type:"styling",body:[],mode:"math",style:"display"}}else c.body.push(h[m]);l%2==0?o.push(c):o.shift(),o=[],s.push(o)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25}),colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}(e.parser)},htmlBuilder:qr,mathmlBuilder:Or}),Sr("\\nonumber","\\gdef\\@eqnsw{0}"),Sr("\\notag","\\nonumber"),Ze({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler:function(e,t){throw new n(e.funcName+" valid only within array environment")}});var Hr=xr;Ze({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler:function(e,t){var r=e.parser,a=e.funcName,i=t[0];if("ordgroup"!==i.type)throw new n("Invalid environment name",i);for(var o="",s=0;s<i.body.length;++s)o+=qt(i.body[s],"textord").text;if("\\begin"===a){if(!Hr.hasOwnProperty(o))throw new n("No such environment: "+o,i);var l=Hr[o],h=r.parseArguments("\\begin{"+o+"}",l),c=h.args,m=h.optArgs,u={mode:r.mode,envName:o,parser:r},p=l.handler(u,c,m);r.expect("\\end",!1);var d=r.nextToken,f=qt(r.parseFunction(),"environment");if(f.name!==o)throw new n("Mismatch: \\begin{"+o+"} matched by \\end{"+f.name+"}",d);return p}return{type:"environment",mode:r.mode,name:o,nameGroup:i}}});var Er=Ve.makeSpan;function Lr(e,t){var r=it(e.body,t,!0);return Er([e.mclass],r,t)}function Dr(e,t){var r,n=xt(e.body,t);return"minner"===e.mclass?r=new gt.MathNode("mpadded",n):"mord"===e.mclass?e.isCharacterBox?(r=n[0]).type="mi":r=new gt.MathNode("mi",n):(e.isCharacterBox?(r=n[0]).type="mo":r=new gt.MathNode("mo",n),"mbin"===e.mclass?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):"mpunct"===e.mclass?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):"mopen"===e.mclass||"mclose"===e.mclass?(r.attributes.lspace="0em",r.attributes.rspace="0em"):"minner"===e.mclass&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em")),r}Ze({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.substr(5),body:Qe(a),isCharacterBox:l.isCharacterBox(a)}},htmlBuilder:Lr,mathmlBuilder:Dr});var Pr=function(e){var t="ordgroup"===e.type&&e.body.length?e.body[0]:e;return"atom"!==t.type||"bin"!==t.family&&"rel"!==t.family?"mord":"m"+t.family};Ze({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler:function(e,t){return{type:"mclass",mode:e.parser.mode,mclass:Pr(t[0]),body:Qe(t[1]),isCharacterBox:l.isCharacterBox(t[1])}}}),Ze({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler:function(e,t){var r,n=e.parser,a=e.funcName,i=t[1],o=t[0];r="\\stackrel"!==a?Pr(i):"mrel";var s={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:"\\stackrel"!==a,body:Qe(i)},h={type:"supsub",mode:o.mode,base:s,sup:"\\underset"===a?null:o,sub:"\\underset"===a?o:null};return{type:"mclass",mode:n.mode,mclass:r,body:[h],isCharacterBox:l.isCharacterBox(h)}},htmlBuilder:Lr,mathmlBuilder:Dr});var Fr=function(e,t){var r=e.font,n=t.withFont(r);return ct(e.body,n)},Vr=function(e,t){var r=e.font,n=t.withFont(r);return kt(e.body,n)},Gr={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Ze({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:function(e,t){var r=e.parser,n=e.funcName,a=Je(t[0]),i=n;return i in Gr&&(i=Gr[i]),{type:"font",mode:r.mode,font:i.slice(1),body:a}},htmlBuilder:Fr,mathmlBuilder:Vr}),Ze({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=t[0],a=l.isCharacterBox(n);return{type:"mclass",mode:r.mode,mclass:Pr(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:a}}}),Ze({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:function(e,t){var r=e.parser,n=e.funcName,a=e.breakOnTokenText,i=r.mode,o=r.parseExpression(!0,a);return{type:"font",mode:i,font:"math"+n.slice(1),body:{type:"ordgroup",mode:r.mode,body:o}}},htmlBuilder:Fr,mathmlBuilder:Vr});var Ur=function(e,t){var r=t;return"display"===e?r=r.id>=x.SCRIPT.id?r.text():x.DISPLAY:"text"===e&&r.size===x.DISPLAY.size?r=x.TEXT:"script"===e?r=x.SCRIPT:"scriptscript"===e&&(r=x.SCRIPTSCRIPT),r},_r=function(e,t){var r,n=Ur(e.size,t.style),a=n.fracNum(),i=n.fracDen();r=t.havingStyle(a);var o=ct(e.numer,r,t);if(e.continued){var s=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;o.height=o.height<s?s:o.height,o.depth=o.depth<l?l:o.depth}r=t.havingStyle(i);var h,c,m,u,p,d,f,g,v,y,b=ct(e.denom,r,t);if(e.hasBarLine?(e.barSize?(c=P(e.barSize,t),h=Ve.makeLineSpan("frac-line",t,c)):h=Ve.makeLineSpan("frac-line",t),c=h.height,m=h.height):(h=null,c=0,m=t.fontMetrics().defaultRuleThickness),n.size===x.DISPLAY.size||"display"===e.size?(u=t.fontMetrics().num1,p=c>0?3*m:7*m,d=t.fontMetrics().denom1):(c>0?(u=t.fontMetrics().num2,p=m):(u=t.fontMetrics().num3,p=3*m),d=t.fontMetrics().denom2),h){var w=t.fontMetrics().axisHeight;u-o.depth-(w+.5*c)<p&&(u+=p-(u-o.depth-(w+.5*c))),w-.5*c-(b.height-d)<p&&(d+=p-(w-.5*c-(b.height-d)));var k=-(w-.5*c);f=Ve.makeVList({positionType:"individualShift",children:[{type:"elem",elem:b,shift:d},{type:"elem",elem:h,shift:k},{type:"elem",elem:o,shift:-u}]},t)}else{var S=u-o.depth-(b.height-d);S<p&&(u+=.5*(p-S),d+=.5*(p-S)),f=Ve.makeVList({positionType:"individualShift",children:[{type:"elem",elem:b,shift:d},{type:"elem",elem:o,shift:-u}]},t)}return r=t.havingStyle(n),f.height*=r.sizeMultiplier/t.sizeMultiplier,f.depth*=r.sizeMultiplier/t.sizeMultiplier,g=n.size===x.DISPLAY.size?t.fontMetrics().delim1:n.size===x.SCRIPTSCRIPT.size?t.havingStyle(x.SCRIPT).fontMetrics().delim2:t.fontMetrics().delim2,v=null==e.leftDelim?ht(t,["mopen"]):pr.customSizedDelim(e.leftDelim,g,!0,t.havingStyle(n),e.mode,["mopen"]),y=e.continued?Ve.makeSpan([]):null==e.rightDelim?ht(t,["mclose"]):pr.customSizedDelim(e.rightDelim,g,!0,t.havingStyle(n),e.mode,["mclose"]),Ve.makeSpan(["mord"].concat(r.sizingClasses(t)),[v,Ve.makeSpan(["mfrac"],[f]),y],t)},Yr=function(e,t){var r=new gt.MathNode("mfrac",[kt(e.numer,t),kt(e.denom,t)]);if(e.hasBarLine){if(e.barSize){var n=P(e.barSize,t);r.setAttribute("linethickness",F(n))}}else r.setAttribute("linethickness","0px");var a=Ur(e.size,t.style);if(a.size!==t.style.size){r=new gt.MathNode("mstyle",[r]);var i=a.size===x.DISPLAY.size?"true":"false";r.setAttribute("displaystyle",i),r.setAttribute("scriptlevel","0")}if(null!=e.leftDelim||null!=e.rightDelim){var o=[];if(null!=e.leftDelim){var s=new gt.MathNode("mo",[new gt.TextNode(e.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),o.push(s)}if(o.push(r),null!=e.rightDelim){var l=new gt.MathNode("mo",[new gt.TextNode(e.rightDelim.replace("\\",""))]);l.setAttribute("fence","true"),o.push(l)}return yt(o)}return r};Ze({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:function(e,t){var r,n=e.parser,a=e.funcName,i=t[0],o=t[1],s=null,l=null,h="auto";switch(a){case"\\dfrac":case"\\frac":case"\\tfrac":r=!0;break;case"\\\\atopfrac":r=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":r=!1,s="(",l=")";break;case"\\\\bracefrac":r=!1,s="\\{",l="\\}";break;case"\\\\brackfrac":r=!1,s="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}switch(a){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text"}return{type:"genfrac",mode:n.mode,continued:!1,numer:i,denom:o,hasBarLine:r,leftDelim:s,rightDelim:l,size:h,barSize:null}},htmlBuilder:_r,mathmlBuilder:Yr}),Ze({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:function(e,t){var r=e.parser,n=(e.funcName,t[0]),a=t[1];return{type:"genfrac",mode:r.mode,continued:!0,numer:n,denom:a,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}}),Ze({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler:function(e){var t,r=e.parser,n=e.funcName,a=e.token;switch(n){case"\\over":t="\\frac";break;case"\\choose":t="\\binom";break;case"\\atop":t="\\\\atopfrac";break;case"\\brace":t="\\\\bracefrac";break;case"\\brack":t="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:r.mode,replaceWith:t,token:a}}});var Xr=["display","text","script","scriptscript"],Wr=function(e){var t=null;return e.length>0&&(t="."===(t=e)?null:t),t};Ze({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler:function(e,t){var r,n=e.parser,a=t[4],i=t[5],o=Je(t[0]),s="atom"===o.type&&"open"===o.family?Wr(o.text):null,l=Je(t[1]),h="atom"===l.type&&"close"===l.family?Wr(l.text):null,c=qt(t[2],"size"),m=null;r=!!c.isBlank||(m=c.value).number>0;var u="auto",p=t[3];if("ordgroup"===p.type){if(p.body.length>0){var d=qt(p.body[0],"textord");u=Xr[Number(d.text)]}}else p=qt(p,"textord"),u=Xr[Number(p.text)];return{type:"genfrac",mode:n.mode,numer:a,denom:i,continued:!1,hasBarLine:r,barSize:m,leftDelim:s,rightDelim:h,size:u}},htmlBuilder:_r,mathmlBuilder:Yr}),Ze({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:function(e,t){var r=e.parser,n=(e.funcName,e.token);return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:qt(t[0],"size").value,token:n}}}),Ze({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:function(e,t){var r=e.parser,n=(e.funcName,t[0]),a=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e}(qt(t[1],"infix").size),i=t[2],o=a.number>0;return{type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:o,barSize:a,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:_r,mathmlBuilder:Yr});var jr=function(e,t){var r,n,a=t.style;"supsub"===e.type?(r=e.sup?ct(e.sup,t.havingStyle(a.sup()),t):ct(e.sub,t.havingStyle(a.sub()),t),n=qt(e.base,"horizBrace")):n=qt(e,"horizBrace");var i,o=ct(n.base,t.havingBaseStyle(x.DISPLAY)),s=Nt(n,t);if(n.isOver?(i=Ve.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:s}]},t)).children[0].children[0].children[1].classes.push("svg-align"):(i=Ve.makeVList({positionType:"bottom",positionData:o.depth+.1+s.height,children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o}]},t)).children[0].children[0].children[0].classes.push("svg-align"),r){var l=Ve.makeSpan(["mord",n.isOver?"mover":"munder"],[i],t);i=n.isOver?Ve.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]},t):Ve.makeVList({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]},t)}return Ve.makeSpan(["mord",n.isOver?"mover":"munder"],[i],t)};Ze({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName;return{type:"horizBrace",mode:r.mode,label:n,isOver:/^\\over/.test(n),base:t[0]}},htmlBuilder:jr,mathmlBuilder:function(e,t){var r=Ct(e.label);return new gt.MathNode(e.isOver?"mover":"munder",[kt(e.base,t),r])}}),Ze({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:function(e,t){var r=e.parser,n=t[1],a=qt(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:a})?{type:"href",mode:r.mode,href:a,body:Qe(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:function(e,t){var r=it(e.body,t,!1);return Ve.makeAnchor(e.href,[],r,t)},mathmlBuilder:function(e,t){var r=wt(e.body,t);return r instanceof dt||(r=new dt("mrow",[r])),r.setAttribute("href",e.href),r}}),Ze({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:function(e,t){var r=e.parser,n=qt(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var a=[],i=0;i<n.length;i++){var o=n[i];"~"===o&&(o="\\textasciitilde"),a.push({type:"textord",mode:"text",text:o})}var s={type:"text",mode:r.mode,font:"\\texttt",body:a};return{type:"href",mode:r.mode,href:n,body:Qe(s)}}}),Ze({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler:function(e,t){return{type:"hbox",mode:e.parser.mode,body:Qe(t[0])}},htmlBuilder:function(e,t){var r=it(e.body,t,!1);return Ve.makeFragment(r)},mathmlBuilder:function(e,t){return new gt.MathNode("mrow",xt(e.body,t))}}),Ze({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:function(e,t){var r,a=e.parser,i=e.funcName,o=(e.token,qt(t[0],"raw").string),s=t[1];a.settings.strict&&a.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l={};switch(i){case"\\htmlClass":l.class=o,r={command:"\\htmlClass",class:o};break;case"\\htmlId":l.id=o,r={command:"\\htmlId",id:o};break;case"\\htmlStyle":l.style=o,r={command:"\\htmlStyle",style:o};break;case"\\htmlData":for(var h=o.split(","),c=0;c<h.length;c++){var m=h[c].split("=");if(2!==m.length)throw new n("Error parsing key-value for \\htmlData");l["data-"+m[0].trim()]=m[1].trim()}r={command:"\\htmlData",attributes:l};break;default:throw new Error("Unrecognized html command")}return a.settings.isTrusted(r)?{type:"html",mode:a.mode,attributes:l,body:Qe(s)}:a.formatUnsupportedCmd(i)},htmlBuilder:function(e,t){var r=it(e.body,t,!1),n=["enclosing"];e.attributes.class&&n.push.apply(n,e.attributes.class.trim().split(/\s+/));var a=Ve.makeSpan(n,r,t);for(var i in e.attributes)"class"!==i&&e.attributes.hasOwnProperty(i)&&a.setAttribute(i,e.attributes[i]);return a},mathmlBuilder:function(e,t){return wt(e.body,t)}}),Ze({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:function(e,t){return{type:"htmlmathml",mode:e.parser.mode,html:Qe(t[0]),mathml:Qe(t[1])}},htmlBuilder:function(e,t){var r=it(e.html,t,!1);return Ve.makeFragment(r)},mathmlBuilder:function(e,t){return wt(e.mathml,t)}});var $r=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new n("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(t[1]+t[2]),unit:t[3]};if(!D(r))throw new n("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Ze({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:function(e,t,r){var a=e.parser,i={number:0,unit:"em"},o={number:.9,unit:"em"},s={number:0,unit:"em"},l="";if(r[0])for(var h=qt(r[0],"raw").string.split(","),c=0;c<h.length;c++){var m=h[c].split("=");if(2===m.length){var u=m[1].trim();switch(m[0].trim()){case"alt":l=u;break;case"width":i=$r(u);break;case"height":o=$r(u);break;case"totalheight":s=$r(u);break;default:throw new n("Invalid key: '"+m[0]+"' in \\includegraphics.")}}}var p=qt(t[0],"url").url;return""===l&&(l=(l=(l=p).replace(/^.*[\\/]/,"")).substring(0,l.lastIndexOf("."))),a.settings.isTrusted({command:"\\includegraphics",url:p})?{type:"includegraphics",mode:a.mode,alt:l,width:i,height:o,totalheight:s,src:p}:a.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:function(e,t){var r=P(e.height,t),n=0;e.totalheight.number>0&&(n=P(e.totalheight,t)-r);var a=0;e.width.number>0&&(a=P(e.width,t));var i={height:F(r+n)};a>0&&(i.width=F(a)),n>0&&(i.verticalAlign=F(-n));var o=new W(e.src,e.alt,i);return o.height=r,o.depth=n,o},mathmlBuilder:function(e,t){var r=new gt.MathNode("mglyph",[]);r.setAttribute("alt",e.alt);var n=P(e.height,t),a=0;if(e.totalheight.number>0&&(a=P(e.totalheight,t)-n,r.setAttribute("valign",F(-a))),r.setAttribute("height",F(n+a)),e.width.number>0){var i=P(e.width,t);r.setAttribute("width",F(i))}return r.setAttribute("src",e.src),r}}),Ze({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler:function(e,t){var r=e.parser,n=e.funcName,a=qt(t[0],"size");if(r.settings.strict){var i="m"===n[1],o="mu"===a.value.unit;i?(o||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, not "+a.value.unit+" units"),"math"!==r.mode&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):o&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:a.value}},htmlBuilder:function(e,t){return Ve.makeGlue(e.dimension,t)},mathmlBuilder:function(e,t){var r=P(e.dimension,t);return new gt.SpaceNode(r)}}),Ze({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:a}},htmlBuilder:function(e,t){var r;"clap"===e.alignment?(r=Ve.makeSpan([],[ct(e.body,t)]),r=Ve.makeSpan(["inner"],[r],t)):r=Ve.makeSpan(["inner"],[ct(e.body,t)]);var n=Ve.makeSpan(["fix"],[]),a=Ve.makeSpan([e.alignment],[r,n],t),i=Ve.makeSpan(["strut"]);return i.style.height=F(a.height+a.depth),a.depth&&(i.style.verticalAlign=F(-a.depth)),a.children.unshift(i),a=Ve.makeSpan(["thinbox"],[a],t),Ve.makeSpan(["mord","vbox"],[a],t)},mathmlBuilder:function(e,t){var r=new gt.MathNode("mpadded",[kt(e.body,t)]);if("rlap"!==e.alignment){var n="llap"===e.alignment?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}}),Ze({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(e,t){var r=e.funcName,n=e.parser,a=n.mode;n.switchMode("math");var i="\\("===r?"\\)":"$",o=n.parseExpression(!1,i);return n.expect(i),n.switchMode(a),{type:"styling",mode:n.mode,style:"text",body:o}}}),Ze({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(e,t){throw new n("Mismatched "+e.funcName)}});var Zr=function(e,t){switch(t.style.size){case x.DISPLAY.size:return e.display;case x.TEXT.size:return e.text;case x.SCRIPT.size:return e.script;case x.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Ze({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:function(e,t){return{type:"mathchoice",mode:e.parser.mode,display:Qe(t[0]),text:Qe(t[1]),script:Qe(t[2]),scriptscript:Qe(t[3])}},htmlBuilder:function(e,t){var r=Zr(e,t),n=it(r,t,!1);return Ve.makeFragment(n)},mathmlBuilder:function(e,t){var r=Zr(e,t);return wt(r,t)}});var Kr=function(e,t,r,n,a,i,o){e=Ve.makeSpan([],[e]);var s,h,c,m=r&&l.isCharacterBox(r);if(t){var u=ct(t,n.havingStyle(a.sup()),n);h={elem:u,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-u.depth)}}if(r){var p=ct(r,n.havingStyle(a.sub()),n);s={elem:p,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-p.height)}}if(h&&s){var d=n.fontMetrics().bigOpSpacing5+s.elem.height+s.elem.depth+s.kern+e.depth+o;c=Ve.makeVList({positionType:"bottom",positionData:d,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:F(-i)},{type:"kern",size:s.kern},{type:"elem",elem:e},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:F(i)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else if(s){var f=e.height-o;c=Ve.makeVList({positionType:"top",positionData:f,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:F(-i)},{type:"kern",size:s.kern},{type:"elem",elem:e}]},n)}else{if(!h)return e;var g=e.depth+o;c=Ve.makeVList({positionType:"bottom",positionData:g,children:[{type:"elem",elem:e},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:F(i)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}var v=[c];if(s&&0!==i&&!m){var y=Ve.makeSpan(["mspace"],[],n);y.style.marginRight=F(i),v.unshift(y)}return Ve.makeSpan(["mop","op-limits"],v,n)},Jr=["\\smallint"],Qr=function(e,t){var r,n,a,i=!1;"supsub"===e.type?(r=e.sup,n=e.sub,a=qt(e.base,"op"),i=!0):a=qt(e,"op");var o,s=t.style,h=!1;if(s.size===x.DISPLAY.size&&a.symbol&&!l.contains(Jr,a.name)&&(h=!0),a.symbol){var c=h?"Size2-Regular":"Size1-Regular",m="";if("\\oiint"!==a.name&&"\\oiiint"!==a.name||(m=a.name.substr(1),a.name="oiint"===m?"\\iint":"\\iiint"),o=Ve.makeSymbol(a.name,c,"math",t,["mop","op-symbol",h?"large-op":"small-op"]),m.length>0){var u=o.italic,p=Ve.staticSvg(m+"Size"+(h?"2":"1"),t);o=Ve.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:p,shift:h?.08:0}]},t),a.name="\\"+m,o.classes.unshift("mop"),o.italic=u}}else if(a.body){var d=it(a.body,t,!0);1===d.length&&d[0]instanceof $?(o=d[0]).classes[0]="mop":o=Ve.makeSpan(["mop"],d,t)}else{for(var f=[],g=1;g<a.name.length;g++)f.push(Ve.mathsym(a.name[g],a.mode,t));o=Ve.makeSpan(["mop"],f,t)}var v=0,y=0;return(o instanceof $||"\\oiint"===a.name||"\\oiiint"===a.name)&&!a.suppressBaseShift&&(v=(o.height-o.depth)/2-t.fontMetrics().axisHeight,y=o.italic),i?Kr(o,r,n,t,s,y,v):(v&&(o.style.position="relative",o.style.top=F(v)),o)},en=function(e,t){var r;if(e.symbol)r=new dt("mo",[vt(e.name,e.mode)]),l.contains(Jr,e.name)&&r.setAttribute("largeop","false");else if(e.body)r=new dt("mo",xt(e.body,t));else{r=new dt("mi",[new ft(e.name.slice(1))]);var n=new dt("mo",[vt("â¡","text")]);r=e.parentIsSupSub?new dt("mrow",[r,n]):pt([r,n])}return r},tn={"â":"\\prod","â":"\\coprod","â":"\\sum","â":"\\bigwedge","â":"\\bigvee","â":"\\bigcap","â":"\\bigcup","â¨":"\\bigodot","â¨":"\\bigoplus","â¨":"\\bigotimes","â¨":"\\biguplus","â¨":"\\bigsqcup"};Ze({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","â","â","â","â","â","â","â","â¨","â¨","â¨","â¨","â¨"],props:{numArgs:0},handler:function(e,t){var r=e.parser,n=e.funcName;return 1===n.length&&(n=tn[n]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:Qr,mathmlBuilder:en}),Ze({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:function(e,t){var r=e.parser,n=t[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Qe(n)}},htmlBuilder:Qr,mathmlBuilder:en});var rn={"â«":"\\int","â¬":"\\iint","â":"\\iiint","â®":"\\oint","â¯":"\\oiint","â°":"\\oiiint"};Ze({type:"op",names:["\\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"],props:{numArgs:0},handler:function(e){var t=e.parser,r=e.funcName;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:Qr,mathmlBuilder:en}),Ze({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler:function(e){var t=e.parser,r=e.funcName;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:Qr,mathmlBuilder:en}),Ze({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","â«","â¬","â","â®","â¯","â°"],props:{numArgs:0},handler:function(e){var t=e.parser,r=e.funcName;return 1===r.length&&(r=rn[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Qr,mathmlBuilder:en});var nn=function(e,t){var r,n,a,i,o=!1;if("supsub"===e.type?(r=e.sup,n=e.sub,a=qt(e.base,"operatorname"),o=!0):a=qt(e,"operatorname"),a.body.length>0){for(var s=a.body.map((function(e){var t=e.text;return"string"==typeof t?{type:"textord",mode:e.mode,text:t}:e})),l=it(s,t.withFont("mathrm"),!0),h=0;h<l.length;h++){var c=l[h];c instanceof $&&(c.text=c.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}i=Ve.makeSpan(["mop"],l,t)}else i=Ve.makeSpan(["mop"],[],t);return o?Kr(i,r,n,t,t.style,0,0):i};function an(e,t,r){for(var n=it(e,t,!1),a=t.sizeMultiplier/r.sizeMultiplier,i=0;i<n.length;i++){var o=n[i].classes.indexOf("sizing");o<0?Array.prototype.push.apply(n[i].classes,t.sizingClasses(r)):n[i].classes[o+1]==="reset-size"+t.size&&(n[i].classes[o+1]="reset-size"+r.size),n[i].height*=a,n[i].depth*=a}return Ve.makeFragment(n)}Ze({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"operatorname",mode:r.mode,body:Qe(a),alwaysHandleSupSub:"\\operatornamewithlimits"===n,limits:!1,parentIsSupSub:!1}},htmlBuilder:nn,mathmlBuilder:function(e,t){for(var r=xt(e.body,t.withFont("mathrm")),n=!0,a=0;a<r.length;a++){var i=r[a];if(i instanceof gt.SpaceNode);else if(i instanceof gt.MathNode)switch(i.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":var o=i.children[0];1===i.children.length&&o instanceof gt.TextNode?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break;default:n=!1}else n=!1}if(n){var s=r.map((function(e){return e.toText()})).join("");r=[new gt.TextNode(s)]}var l=new gt.MathNode("mi",r);l.setAttribute("mathvariant","normal");var h=new gt.MathNode("mo",[vt("â¡","text")]);return e.parentIsSupSub?new gt.MathNode("mrow",[l,h]):gt.newDocumentFragment([l,h])}}),Sr("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),Ke({type:"ordgroup",htmlBuilder:function(e,t){return e.semisimple?Ve.makeFragment(it(e.body,t,!1)):Ve.makeSpan(["mord"],it(e.body,t,!0),t)},mathmlBuilder:function(e,t){return wt(e.body,t,!0)}}),Ze({type:"overline",names:["\\overline"],props:{numArgs:1},handler:function(e,t){var r=e.parser,n=t[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder:function(e,t){var r=ct(e.body,t.havingCrampedStyle()),n=Ve.makeLineSpan("overline-line",t),a=t.fontMetrics().defaultRuleThickness,i=Ve.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*a},{type:"elem",elem:n},{type:"kern",size:a}]},t);return Ve.makeSpan(["mord","overline"],[i],t)},mathmlBuilder:function(e,t){var r=new gt.MathNode("mo",[new gt.TextNode("â¾")]);r.setAttribute("stretchy","true");var n=new gt.MathNode("mover",[kt(e.body,t),r]);return n.setAttribute("accent","true"),n}}),Ze({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:function(e,t){var r=e.parser,n=t[0];return{type:"phantom",mode:r.mode,body:Qe(n)}},htmlBuilder:function(e,t){var r=it(e.body,t.withPhantom(),!1);return Ve.makeFragment(r)},mathmlBuilder:function(e,t){var r=xt(e.body,t);return new gt.MathNode("mphantom",r)}}),Ze({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:function(e,t){var r=e.parser,n=t[0];return{type:"hphantom",mode:r.mode,body:n}},htmlBuilder:function(e,t){var r=Ve.makeSpan([],[ct(e.body,t.withPhantom())]);if(r.height=0,r.depth=0,r.children)for(var n=0;n<r.children.length;n++)r.children[n].height=0,r.children[n].depth=0;return r=Ve.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r}]},t),Ve.makeSpan(["mord"],[r],t)},mathmlBuilder:function(e,t){var r=xt(Qe(e.body),t),n=new gt.MathNode("mphantom",r),a=new gt.MathNode("mpadded",[n]);return a.setAttribute("height","0px"),a.setAttribute("depth","0px"),a}}),Ze({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:function(e,t){var r=e.parser,n=t[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:function(e,t){var r=Ve.makeSpan(["inner"],[ct(e.body,t.withPhantom())]),n=Ve.makeSpan(["fix"],[]);return Ve.makeSpan(["mord","rlap"],[r,n],t)},mathmlBuilder:function(e,t){var r=xt(Qe(e.body),t),n=new gt.MathNode("mphantom",r),a=new gt.MathNode("mpadded",[n]);return a.setAttribute("width","0px"),a}}),Ze({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler:function(e,t){var r=e.parser,n=qt(t[0],"size").value,a=t[1];return{type:"raisebox",mode:r.mode,dy:n,body:a}},htmlBuilder:function(e,t){var r=ct(e.body,t),n=P(e.dy,t);return Ve.makeVList({positionType:"shift",positionData:-n,children:[{type:"elem",elem:r}]},t)},mathmlBuilder:function(e,t){var r=new gt.MathNode("mpadded",[kt(e.body,t)]),n=e.dy.number+e.dy.unit;return r.setAttribute("voffset",n),r}}),Ze({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0},handler:function(e){return{type:"internal",mode:e.parser.mode}}}),Ze({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,argTypes:["size","size","size"]},handler:function(e,t,r){var n=e.parser,a=r[0],i=qt(t[0],"size"),o=qt(t[1],"size");return{type:"rule",mode:n.mode,shift:a&&qt(a,"size").value,width:i.value,height:o.value}},htmlBuilder:function(e,t){var r=Ve.makeSpan(["mord","rule"],[],t),n=P(e.width,t),a=P(e.height,t),i=e.shift?P(e.shift,t):0;return r.style.borderRightWidth=F(n),r.style.borderTopWidth=F(a),r.style.bottom=F(i),r.width=n,r.height=a+i,r.depth=-i,r.maxFontSize=1.125*a*t.sizeMultiplier,r},mathmlBuilder:function(e,t){var r=P(e.width,t),n=P(e.height,t),a=e.shift?P(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new gt.MathNode("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",F(r)),o.setAttribute("height",F(n));var s=new gt.MathNode("mpadded",[o]);return a>=0?s.setAttribute("height",F(a)):(s.setAttribute("height",F(a)),s.setAttribute("depth",F(-a))),s.setAttribute("voffset",F(a)),s}});var on=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];Ze({type:"sizing",names:on,props:{numArgs:0,allowedInText:!0},handler:function(e,t){var r=e.breakOnTokenText,n=e.funcName,a=e.parser,i=a.parseExpression(!1,r);return{type:"sizing",mode:a.mode,size:on.indexOf(n)+1,body:i}},htmlBuilder:function(e,t){var r=t.havingSize(e.size);return an(e.body,r,t)},mathmlBuilder:function(e,t){var r=t.havingSize(e.size),n=xt(e.body,r),a=new gt.MathNode("mstyle",n);return a.setAttribute("mathsize",F(r.sizeMultiplier)),a}}),Ze({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:function(e,t,r){var n=e.parser,a=!1,i=!1,o=r[0]&&qt(r[0],"ordgroup");if(o)for(var s="",l=0;l<o.body.length;++l)if("t"===(s=o.body[l].text))a=!0;else{if("b"!==s){a=!1,i=!1;break}i=!0}else a=!0,i=!0;var h=t[0];return{type:"smash",mode:n.mode,body:h,smashHeight:a,smashDepth:i}},htmlBuilder:function(e,t){var r=Ve.makeSpan([],[ct(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return r;if(e.smashHeight&&(r.height=0,r.children))for(var n=0;n<r.children.length;n++)r.children[n].height=0;if(e.smashDepth&&(r.depth=0,r.children))for(var a=0;a<r.children.length;a++)r.children[a].depth=0;var i=Ve.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r}]},t);return Ve.makeSpan(["mord"],[i],t)},mathmlBuilder:function(e,t){var r=new gt.MathNode("mpadded",[kt(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}}),Ze({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler:function(e,t,r){var n=e.parser,a=r[0],i=t[0];return{type:"sqrt",mode:n.mode,body:i,index:a}},htmlBuilder:function(e,t){var r=ct(e.body,t.havingCrampedStyle());0===r.height&&(r.height=t.fontMetrics().xHeight),r=Ve.wrapFragment(r,t);var n=t.fontMetrics().defaultRuleThickness,a=n;t.style.id<x.TEXT.id&&(a=t.fontMetrics().xHeight);var i=n+a/4,o=r.height+r.depth+i+n,s=pr.sqrtImage(o,t),l=s.span,h=s.ruleWidth,c=s.advanceWidth,m=l.height-h;m>r.height+r.depth+i&&(i=(i+m-r.height-r.depth)/2);var u=l.height-r.height-i-h;r.style.paddingLeft=F(c);var p=Ve.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+u)},{type:"elem",elem:l},{type:"kern",size:h}]},t);if(e.index){var d=t.havingStyle(x.SCRIPTSCRIPT),f=ct(e.index,d,t),g=.6*(p.height-p.depth),v=Ve.makeVList({positionType:"shift",positionData:-g,children:[{type:"elem",elem:f}]},t),y=Ve.makeSpan(["root"],[v]);return Ve.makeSpan(["mord","sqrt"],[y,p],t)}return Ve.makeSpan(["mord","sqrt"],[p],t)},mathmlBuilder:function(e,t){var r=e.body,n=e.index;return n?new gt.MathNode("mroot",[kt(r,t),kt(n,t)]):new gt.MathNode("msqrt",[kt(r,t)])}});var sn={display:x.DISPLAY,text:x.TEXT,script:x.SCRIPT,scriptscript:x.SCRIPTSCRIPT};Ze({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler:function(e,t){var r=e.breakOnTokenText,n=e.funcName,a=e.parser,i=a.parseExpression(!0,r),o=n.slice(1,n.length-5);return{type:"styling",mode:a.mode,style:o,body:i}},htmlBuilder:function(e,t){var r=sn[e.style],n=t.havingStyle(r).withFont("");return an(e.body,n,t)},mathmlBuilder:function(e,t){var r=sn[e.style],n=t.havingStyle(r),a=xt(e.body,n),i=new gt.MathNode("mstyle",a),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return i.setAttribute("scriptlevel",o[0]),i.setAttribute("displaystyle",o[1]),i}});var ln=function(e,t){var r=e.base;return r?"op"===r.type?r.limits&&(t.style.size===x.DISPLAY.size||r.alwaysHandleSupSub)?Qr:null:"operatorname"===r.type?r.alwaysHandleSupSub&&(t.style.size===x.DISPLAY.size||r.limits)?nn:null:"accent"===r.type?l.isCharacterBox(r.base)?Rt:null:"horizBrace"===r.type&&!e.sub===r.isOver?jr:null:null};Ke({type:"supsub",htmlBuilder:function(e,t){var r=ln(e,t);if(r)return r(e,t);var n,a,i,o=e.base,s=e.sup,h=e.sub,c=ct(o,t),m=t.fontMetrics(),u=0,p=0,d=o&&l.isCharacterBox(o);if(s){var f=t.havingStyle(t.style.sup());n=ct(s,f,t),d||(u=c.height-f.fontMetrics().supDrop*f.sizeMultiplier/t.sizeMultiplier)}if(h){var g=t.havingStyle(t.style.sub());a=ct(h,g,t),d||(p=c.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}i=t.style===x.DISPLAY?m.sup1:t.style.cramped?m.sup3:m.sup2;var v,y=t.sizeMultiplier,b=F(.5/m.ptPerEm/y),w=null;if(a){var k=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);(c instanceof $||k)&&(w=F(-c.italic))}if(n&&a){u=Math.max(u,i,n.depth+.25*m.xHeight),p=Math.max(p,m.sub2);var S=4*m.defaultRuleThickness;if(u-n.depth-(a.height-p)<S){p=S-(u-n.depth)+a.height;var M=.8*m.xHeight-(u-n.depth);M>0&&(u+=M,p-=M)}var z=[{type:"elem",elem:a,shift:p,marginRight:b,marginLeft:w},{type:"elem",elem:n,shift:-u,marginRight:b}];v=Ve.makeVList({positionType:"individualShift",children:z},t)}else if(a){p=Math.max(p,m.sub1,a.height-.8*m.xHeight);var A=[{type:"elem",elem:a,marginLeft:w,marginRight:b}];v=Ve.makeVList({positionType:"shift",positionData:p,children:A},t)}else{if(!n)throw new Error("supsub must have either sup or sub.");u=Math.max(u,i,n.depth+.25*m.xHeight),v=Ve.makeVList({positionType:"shift",positionData:-u,children:[{type:"elem",elem:n,marginRight:b}]},t)}var T=lt(c,"right")||"mord";return Ve.makeSpan([T],[c,Ve.makeSpan(["msupsub"],[v])],t)},mathmlBuilder:function(e,t){var r,n=!1;e.base&&"horizBrace"===e.base.type&&!!e.sup===e.base.isOver&&(n=!0,r=e.base.isOver),!e.base||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0);var a,i=[kt(e.base,t)];if(e.sub&&i.push(kt(e.sub,t)),e.sup&&i.push(kt(e.sup,t)),n)a=r?"mover":"munder";else if(e.sub)if(e.sup){var o=e.base;a=o&&"op"===o.type&&o.limits&&t.style===x.DISPLAY||o&&"operatorname"===o.type&&o.alwaysHandleSupSub&&(t.style===x.DISPLAY||o.limits)?"munderover":"msubsup"}else{var s=e.base;a=s&&"op"===s.type&&s.limits&&(t.style===x.DISPLAY||s.alwaysHandleSupSub)||s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(s.limits||t.style===x.DISPLAY)?"munder":"msub"}else{var l=e.base;a=l&&"op"===l.type&&l.limits&&(t.style===x.DISPLAY||l.alwaysHandleSupSub)||l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||t.style===x.DISPLAY)?"mover":"msup"}return new gt.MathNode(a,i)}}),Ke({type:"atom",htmlBuilder:function(e,t){return Ve.mathsym(e.text,e.mode,t,["m"+e.family])},mathmlBuilder:function(e,t){var r=new gt.MathNode("mo",[vt(e.text,e.mode)]);if("bin"===e.family){var n=bt(e,t);"bold-italic"===n&&r.setAttribute("mathvariant",n)}else"punct"===e.family?r.setAttribute("separator","true"):"open"!==e.family&&"close"!==e.family||r.setAttribute("stretchy","false");return r}});var hn={mi:"italic",mn:"normal",mtext:"normal"};Ke({type:"mathord",htmlBuilder:function(e,t){return Ve.makeOrd(e,t,"mathord")},mathmlBuilder:function(e,t){var r=new gt.MathNode("mi",[vt(e.text,e.mode,t)]),n=bt(e,t)||"italic";return n!==hn[r.type]&&r.setAttribute("mathvariant",n),r}}),Ke({type:"textord",htmlBuilder:function(e,t){return Ve.makeOrd(e,t,"textord")},mathmlBuilder:function(e,t){var r,n=vt(e.text,e.mode,t),a=bt(e,t)||"normal";return r="text"===e.mode?new gt.MathNode("mtext",[n]):/[0-9]/.test(e.text)?new gt.MathNode("mn",[n]):"\\prime"===e.text?new gt.MathNode("mo",[n]):new gt.MathNode("mi",[n]),a!==hn[r.type]&&r.setAttribute("mathvariant",a),r}});var cn={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},mn={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Ke({type:"spacing",htmlBuilder:function(e,t){if(mn.hasOwnProperty(e.text)){var r=mn[e.text].className||"";if("text"===e.mode){var a=Ve.makeOrd(e,t,"textord");return a.classes.push(r),a}return Ve.makeSpan(["mspace",r],[Ve.mathsym(e.text,e.mode,t)],t)}if(cn.hasOwnProperty(e.text))return Ve.makeSpan(["mspace",cn[e.text]],[],t);throw new n('Unknown type of space "'+e.text+'"')},mathmlBuilder:function(e,t){if(!mn.hasOwnProperty(e.text)){if(cn.hasOwnProperty(e.text))return new gt.MathNode("mspace");throw new n('Unknown type of space "'+e.text+'"')}return new gt.MathNode("mtext",[new gt.TextNode(" ")])}});var un=function(){var e=new gt.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};Ke({type:"tag",mathmlBuilder:function(e,t){var r=new gt.MathNode("mtable",[new gt.MathNode("mtr",[un(),new gt.MathNode("mtd",[wt(e.body,t)]),un(),new gt.MathNode("mtd",[wt(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});var pn={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},dn={"\\textbf":"textbf","\\textmd":"textmd"},fn={"\\textit":"textit","\\textup":"textup"},gn=function(e,t){var r=e.font;return r?pn[r]?t.withTextFontFamily(pn[r]):dn[r]?t.withTextFontWeight(dn[r]):t.withTextFontShape(fn[r]):t};Ze({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler:function(e,t){var r=e.parser,n=e.funcName,a=t[0];return{type:"text",mode:r.mode,body:Qe(a),font:n}},htmlBuilder:function(e,t){var r=gn(e,t),n=it(e.body,r,!0);return Ve.makeSpan(["mord","text"],n,r)},mathmlBuilder:function(e,t){var r=gn(e,t);return wt(e.body,r)}}),Ze({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler:function(e,t){return{type:"underline",mode:e.parser.mode,body:t[0]}},htmlBuilder:function(e,t){var r=ct(e.body,t),n=Ve.makeLineSpan("underline-line",t),a=t.fontMetrics().defaultRuleThickness,i=Ve.makeVList({positionType:"top",positionData:r.height,children:[{type:"kern",size:a},{type:"elem",elem:n},{type:"kern",size:3*a},{type:"elem",elem:r}]},t);return Ve.makeSpan(["mord","underline"],[i],t)},mathmlBuilder:function(e,t){var r=new gt.MathNode("mo",[new gt.TextNode("â¾")]);r.setAttribute("stretchy","true");var n=new gt.MathNode("munder",[kt(e.body,t),r]);return n.setAttribute("accentunder","true"),n}}),Ze({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler:function(e,t){return{type:"vcenter",mode:e.parser.mode,body:t[0]}},htmlBuilder:function(e,t){var r=ct(e.body,t),n=t.fontMetrics().axisHeight,a=.5*(r.height-n-(r.depth+n));return Ve.makeVList({positionType:"shift",positionData:a,children:[{type:"elem",elem:r}]},t)},mathmlBuilder:function(e,t){return new gt.MathNode("mpadded",[kt(e.body,t)],["vcenter"])}}),Ze({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler:function(e,t,r){throw new n("\\verb ended by end of line instead of matching delimiter")},htmlBuilder:function(e,t){for(var r=vn(e),n=[],a=t.havingStyle(t.style.text()),i=0;i<r.length;i++){var o=r[i];"~"===o&&(o="\\textasciitilde"),n.push(Ve.makeSymbol(o,"Typewriter-Regular",e.mode,a,["mord","texttt"]))}return Ve.makeSpan(["mord","text"].concat(a.sizingClasses(t)),Ve.tryCombineChars(n),a)},mathmlBuilder:function(e,t){var r=new gt.TextNode(vn(e)),n=new gt.MathNode("mtext",[r]);return n.setAttribute("mathvariant","monospace"),n}});var vn=function(e){return e.body.replace(/ /g,e.star?"â£":" ")},yn=We,bn=new RegExp("[Ì-ͯ]+$"),xn=function(){function e(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp("([ \r\n\t]+)|\\\\(\n|[ \r\t]+\n?)[ \r\t]*|([!-\\[\\]-â§âª-í¿ï¤-ï¿¿][Ì-ͯ]*|[\ud800-\udbff][\udc00-\udfff][Ì-ͯ]*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|(\\\\[a-zA-Z@]+)[ \r\n\t]*|\\\\[^\ud800-\udfff])","g"),this.catcodes={"%":14,"~":13}}var t=e.prototype;return t.setCatcode=function(e,t){this.catcodes[e]=t},t.lex=function(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new zr("EOF",new Mr(this,t,t));var r=this.tokenRegex.exec(e);if(null===r||r.index!==t)throw new n("Unexpected character: '"+e[t]+"'",new zr(e[t],new Mr(this,t,t+1)));var a=r[6]||r[3]||(r[2]?"\\ ":" ");if(14===this.catcodes[a]){var i=e.indexOf("\n",this.tokenRegex.lastIndex);return-1===i?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new zr(a,new Mr(this,t,this.tokenRegex.lastIndex))},e}(),wn=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}var t=e.prototype;return t.beginGroup=function(){this.undefStack.push({})},t.endGroup=function(){if(0===this.undefStack.length)throw new n("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(null==e[t]?delete this.current[t]:this.current[t]=e[t])},t.endGroups=function(){for(;this.undefStack.length>0;)this.endGroup()},t.has=function(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)},t.get=function(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]},t.set=function(e,t,r){if(void 0===r&&(r=!1),r){for(var n=0;n<this.undefStack.length;n++)delete this.undefStack[n][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(e)&&(a[e]=this.current[e])}null==t?delete this.current[e]:this.current[e]=t},e}(),kn=kr;Sr("\\noexpand",(function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}})),Sr("\\expandafter",(function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}})),Sr("\\@firstoftwo",(function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}})),Sr("\\@secondoftwo",(function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}})),Sr("\\@ifnextchar",(function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return 1===t[0].length&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}})),Sr("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),Sr("\\TextOrMath",(function(e){var t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}}));var Sn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Sr("\\char",(function(e){var t,r=e.popToken(),a="";if("'"===r.text)t=8,r=e.popToken();else if('"'===r.text)t=16,r=e.popToken();else if("`"===r.text)if("\\"===(r=e.popToken()).text[0])a=r.text.charCodeAt(1);else{if("EOF"===r.text)throw new n("\\char` missing argument");a=r.text.charCodeAt(0)}else t=10;if(t){if(null==(a=Sn[r.text])||a>=t)throw new n("Invalid base-"+t+" digit "+r.text);for(var i;null!=(i=Sn[e.future().text])&&i<t;)a*=t,a+=i,e.popToken()}return"\\@char{"+a+"}"}));var Mn=function(e,t,r){var a=e.consumeArg().tokens;if(1!==a.length)throw new n("\\newcommand's first argument must be a macro name");var i=a[0].text,o=e.isDefined(i);if(o&&!t)throw new n("\\newcommand{"+i+"} attempting to redefine "+i+"; use \\renewcommand");if(!o&&!r)throw new n("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var s=0;if(1===(a=e.consumeArg().tokens).length&&"["===a[0].text){for(var l="",h=e.expandNextToken();"]"!==h.text&&"EOF"!==h.text;)l+=h.text,h=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new n("Invalid number of arguments: "+l);s=parseInt(l),a=e.consumeArg().tokens}return e.macros.set(i,{tokens:a,numArgs:s}),""};Sr("\\newcommand",(function(e){return Mn(e,!1,!0)})),Sr("\\renewcommand",(function(e){return Mn(e,!0,!1)})),Sr("\\providecommand",(function(e){return Mn(e,!0,!0)})),Sr("\\message",(function(e){var t=e.consumeArgs(1)[0];return console.log(t.reverse().map((function(e){return e.text})).join("")),""})),Sr("\\errmessage",(function(e){var t=e.consumeArgs(1)[0];return console.error(t.reverse().map((function(e){return e.text})).join("")),""})),Sr("\\show",(function(e){var t=e.popToken(),r=t.text;return console.log(t,e.macros.get(r),yn[r],ne.math[r],ne.text[r]),""})),Sr("\\bgroup","{"),Sr("\\egroup","}"),Sr("~","\\nobreakspace"),Sr("\\lq","`"),Sr("\\rq","'"),Sr("\\aa","\\r a"),Sr("\\AA","\\r A"),Sr("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}"),Sr("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"),Sr("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),Sr("â¬","\\mathscr{B}"),Sr("â°","\\mathscr{E}"),Sr("â±","\\mathscr{F}"),Sr("â","\\mathscr{H}"),Sr("â","\\mathscr{I}"),Sr("â","\\mathscr{L}"),Sr("â³","\\mathscr{M}"),Sr("â","\\mathscr{R}"),Sr("â","\\mathfrak{C}"),Sr("â","\\mathfrak{H}"),Sr("â¨","\\mathfrak{Z}"),Sr("\\Bbbk","\\Bbb{k}"),Sr("·","\\cdotp"),Sr("\\llap","\\mathllap{\\textrm{#1}}"),Sr("\\rlap","\\mathrlap{\\textrm{#1}}"),Sr("\\clap","\\mathclap{\\textrm{#1}}"),Sr("\\mathstrut","\\vphantom{(}"),Sr("\\underbar","\\underline{\\text{#1}}"),Sr("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'),Sr("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`â }}"),Sr("\\ne","\\neq"),Sr("â ","\\neq"),Sr("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`â}}"),Sr("â","\\notin"),Sr("â","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`â}}"),Sr("â","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`â}}"),Sr("â","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`â}}"),Sr("â","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`â}}"),Sr("â","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`â}}"),Sr("â","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`â}}"),Sr("â","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`â}}"),Sr("â","\\perp"),Sr("â¼","\\mathclose{!\\mkern-0.8mu!}"),Sr("â","\\notni"),Sr("â","\\ulcorner"),Sr("â","\\urcorner"),Sr("â","\\llcorner"),Sr("â","\\lrcorner"),Sr("©","\\copyright"),Sr("®","\\textregistered"),Sr("ï¸","\\textregistered"),Sr("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'),Sr("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'),Sr("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'),Sr("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'),Sr("\\vdots","\\mathord{\\varvdots\\rule{0pt}{15pt}}"),Sr("â®","\\vdots"),Sr("\\varGamma","\\mathit{\\Gamma}"),Sr("\\varDelta","\\mathit{\\Delta}"),Sr("\\varTheta","\\mathit{\\Theta}"),Sr("\\varLambda","\\mathit{\\Lambda}"),Sr("\\varXi","\\mathit{\\Xi}"),Sr("\\varPi","\\mathit{\\Pi}"),Sr("\\varSigma","\\mathit{\\Sigma}"),Sr("\\varUpsilon","\\mathit{\\Upsilon}"),Sr("\\varPhi","\\mathit{\\Phi}"),Sr("\\varPsi","\\mathit{\\Psi}"),Sr("\\varOmega","\\mathit{\\Omega}"),Sr("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),Sr("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"),Sr("\\boxed","\\fbox{$\\displaystyle{#1}$}"),Sr("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),Sr("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),Sr("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");var zn={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\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","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};Sr("\\dots",(function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in zn?t=zn[r]:("\\not"===r.substr(0,4)||r in ne.math&&l.contains(["bin","rel"],ne.math[r].group))&&(t="\\dotsb"),t}));var An={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Sr("\\dotso",(function(e){return e.future().text in An?"\\ldots\\,":"\\ldots"})),Sr("\\dotsc",(function(e){var t=e.future().text;return t in An&&","!==t?"\\ldots\\,":"\\ldots"})),Sr("\\cdots",(function(e){return e.future().text in An?"\\@cdots\\,":"\\@cdots"})),Sr("\\dotsb","\\cdots"),Sr("\\dotsm","\\cdots"),Sr("\\dotsi","\\!\\cdots"),Sr("\\dotsx","\\ldots\\,"),Sr("\\DOTSI","\\relax"),Sr("\\DOTSB","\\relax"),Sr("\\DOTSX","\\relax"),Sr("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),Sr("\\,","\\tmspace+{3mu}{.1667em}"),Sr("\\thinspace","\\,"),Sr("\\>","\\mskip{4mu}"),Sr("\\:","\\tmspace+{4mu}{.2222em}"),Sr("\\medspace","\\:"),Sr("\\;","\\tmspace+{5mu}{.2777em}"),Sr("\\thickspace","\\;"),Sr("\\!","\\tmspace-{3mu}{.1667em}"),Sr("\\negthinspace","\\!"),Sr("\\negmedspace","\\tmspace-{4mu}{.2222em}"),Sr("\\negthickspace","\\tmspace-{5mu}{.277em}"),Sr("\\enspace","\\kern.5em "),Sr("\\enskip","\\hskip.5em\\relax"),Sr("\\quad","\\hskip1em\\relax"),Sr("\\qquad","\\hskip2em\\relax"),Sr("\\tag","\\@ifstar\\tag@literal\\tag@paren"),Sr("\\tag@paren","\\tag@literal{({#1})}"),Sr("\\tag@literal",(function(e){if(e.macros.get("\\df@tag"))throw new n("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"})),Sr("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),Sr("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),Sr("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),Sr("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),Sr("\\pmb","\\html@mathml{\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}{\\mathbf{#1}}"),Sr("\\newline","\\\\\\relax"),Sr("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Tn=F(A["Main-Regular"]["T".charCodeAt(0)][1]-.7*A["Main-Regular"]["A".charCodeAt(0)][1]);Sr("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+Tn+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),Sr("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+Tn+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),Sr("\\hspace","\\@ifstar\\@hspacer\\@hspace"),Sr("\\@hspace","\\hskip #1\\relax"),Sr("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),Sr("\\ordinarycolon",":"),Sr("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),Sr("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),Sr("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),Sr("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),Sr("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),Sr("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),Sr("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),Sr("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),Sr("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),Sr("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),Sr("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),Sr("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),Sr("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),Sr("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),Sr("â·","\\dblcolon"),Sr("â¹","\\eqcolon"),Sr("â","\\coloneqq"),Sr("â","\\eqqcolon"),Sr("â©´","\\Coloneqq"),Sr("\\ratio","\\vcentcolon"),Sr("\\coloncolon","\\dblcolon"),Sr("\\colonequals","\\coloneqq"),Sr("\\coloncolonequals","\\Coloneqq"),Sr("\\equalscolon","\\eqqcolon"),Sr("\\equalscoloncolon","\\Eqqcolon"),Sr("\\colonminus","\\coloneq"),Sr("\\coloncolonminus","\\Coloneq"),Sr("\\minuscolon","\\eqcolon"),Sr("\\minuscoloncolon","\\Eqcolon"),Sr("\\coloncolonapprox","\\Colonapprox"),Sr("\\coloncolonsim","\\Colonsim"),Sr("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Sr("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Sr("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Sr("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Sr("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`â}}"),Sr("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),Sr("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),Sr("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),Sr("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),Sr("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),Sr("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),Sr("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),Sr("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),Sr("\\gvertneqq","\\html@mathml{\\@gvertneqq}{â©}"),Sr("\\lvertneqq","\\html@mathml{\\@lvertneqq}{â¨}"),Sr("\\ngeqq","\\html@mathml{\\@ngeqq}{â±}"),Sr("\\ngeqslant","\\html@mathml{\\@ngeqslant}{â±}"),Sr("\\nleqq","\\html@mathml{\\@nleqq}{â°}"),Sr("\\nleqslant","\\html@mathml{\\@nleqslant}{â°}"),Sr("\\nshortmid","\\html@mathml{\\@nshortmid}{â¤}"),Sr("\\nshortparallel","\\html@mathml{\\@nshortparallel}{â¦}"),Sr("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{â}"),Sr("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{â}"),Sr("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{â}"),Sr("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{â«}"),Sr("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{â}"),Sr("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{â«}"),Sr("\\imath","\\html@mathml{\\@imath}{ı}"),Sr("\\jmath","\\html@mathml{\\@jmath}{È·}"),Sr("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`â¦}}"),Sr("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`â§}}"),Sr("â¦","\\llbracket"),Sr("â§","\\rrbracket"),Sr("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`â¦}}"),Sr("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`â¦}}"),Sr("â¦","\\lBrace"),Sr("â¦","\\rBrace"),Sr("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),Sr("⦵","\\minuso"),Sr("\\darr","\\downarrow"),Sr("\\dArr","\\Downarrow"),Sr("\\Darr","\\Downarrow"),Sr("\\lang","\\langle"),Sr("\\rang","\\rangle"),Sr("\\uarr","\\uparrow"),Sr("\\uArr","\\Uparrow"),Sr("\\Uarr","\\Uparrow"),Sr("\\N","\\mathbb{N}"),Sr("\\R","\\mathbb{R}"),Sr("\\Z","\\mathbb{Z}"),Sr("\\alef","\\aleph"),Sr("\\alefsym","\\aleph"),Sr("\\Alpha","\\mathrm{A}"),Sr("\\Beta","\\mathrm{B}"),Sr("\\bull","\\bullet"),Sr("\\Chi","\\mathrm{X}"),Sr("\\clubs","\\clubsuit"),Sr("\\cnums","\\mathbb{C}"),Sr("\\Complex","\\mathbb{C}"),Sr("\\Dagger","\\ddagger"),Sr("\\diamonds","\\diamondsuit"),Sr("\\empty","\\emptyset"),Sr("\\Epsilon","\\mathrm{E}"),Sr("\\Eta","\\mathrm{H}"),Sr("\\exist","\\exists"),Sr("\\harr","\\leftrightarrow"),Sr("\\hArr","\\Leftrightarrow"),Sr("\\Harr","\\Leftrightarrow"),Sr("\\hearts","\\heartsuit"),Sr("\\image","\\Im"),Sr("\\infin","\\infty"),Sr("\\Iota","\\mathrm{I}"),Sr("\\isin","\\in"),Sr("\\Kappa","\\mathrm{K}"),Sr("\\larr","\\leftarrow"),Sr("\\lArr","\\Leftarrow"),Sr("\\Larr","\\Leftarrow"),Sr("\\lrarr","\\leftrightarrow"),Sr("\\lrArr","\\Leftrightarrow"),Sr("\\Lrarr","\\Leftrightarrow"),Sr("\\Mu","\\mathrm{M}"),Sr("\\natnums","\\mathbb{N}"),Sr("\\Nu","\\mathrm{N}"),Sr("\\Omicron","\\mathrm{O}"),Sr("\\plusmn","\\pm"),Sr("\\rarr","\\rightarrow"),Sr("\\rArr","\\Rightarrow"),Sr("\\Rarr","\\Rightarrow"),Sr("\\real","\\Re"),Sr("\\reals","\\mathbb{R}"),Sr("\\Reals","\\mathbb{R}"),Sr("\\Rho","\\mathrm{P}"),Sr("\\sdot","\\cdot"),Sr("\\sect","\\S"),Sr("\\spades","\\spadesuit"),Sr("\\sub","\\subset"),Sr("\\sube","\\subseteq"),Sr("\\supe","\\supseteq"),Sr("\\Tau","\\mathrm{T}"),Sr("\\thetasym","\\vartheta"),Sr("\\weierp","\\wp"),Sr("\\Zeta","\\mathrm{Z}"),Sr("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),Sr("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),Sr("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),Sr("\\bra","\\mathinner{\\langle{#1}|}"),Sr("\\ket","\\mathinner{|{#1}\\rangle}"),Sr("\\braket","\\mathinner{\\langle{#1}\\rangle}"),Sr("\\Bra","\\left\\langle#1\\right|"),Sr("\\Ket","\\left|#1\\right\\rangle");var Bn=function(e){return function(t){var r=t.consumeArg().tokens,n=t.consumeArg().tokens,a=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.macros.get("|"),s=t.macros.get("\\|");t.macros.beginGroup();var l=function(t){return function(r){e&&(r.macros.set("|",o),a.length&&r.macros.set("\\|",s));var i=t;return!t&&a.length&&"|"===r.future().text&&(r.popToken(),i=!0),{tokens:i?a:n,numArgs:0}}};t.macros.set("|",l(!1)),a.length&&t.macros.set("\\|",l(!0));var h=t.consumeArg().tokens,c=t.expandTokens([].concat(i,h,r));return t.macros.endGroup(),{tokens:c.reverse(),numArgs:0}}};Sr("\\bra@ket",Bn(!1)),Sr("\\bra@set",Bn(!0)),Sr("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"),Sr("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"),Sr("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"),Sr("\\angln","{\\angl n}"),Sr("\\blue","\\textcolor{##6495ed}{#1}"),Sr("\\orange","\\textcolor{##ffa500}{#1}"),Sr("\\pink","\\textcolor{##ff00af}{#1}"),Sr("\\red","\\textcolor{##df0030}{#1}"),Sr("\\green","\\textcolor{##28ae7b}{#1}"),Sr("\\gray","\\textcolor{gray}{#1}"),Sr("\\purple","\\textcolor{##9d38bd}{#1}"),Sr("\\blueA","\\textcolor{##ccfaff}{#1}"),Sr("\\blueB","\\textcolor{##80f6ff}{#1}"),Sr("\\blueC","\\textcolor{##63d9ea}{#1}"),Sr("\\blueD","\\textcolor{##11accd}{#1}"),Sr("\\blueE","\\textcolor{##0c7f99}{#1}"),Sr("\\tealA","\\textcolor{##94fff5}{#1}"),Sr("\\tealB","\\textcolor{##26edd5}{#1}"),Sr("\\tealC","\\textcolor{##01d1c1}{#1}"),Sr("\\tealD","\\textcolor{##01a995}{#1}"),Sr("\\tealE","\\textcolor{##208170}{#1}"),Sr("\\greenA","\\textcolor{##b6ffb0}{#1}"),Sr("\\greenB","\\textcolor{##8af281}{#1}"),Sr("\\greenC","\\textcolor{##74cf70}{#1}"),Sr("\\greenD","\\textcolor{##1fab54}{#1}"),Sr("\\greenE","\\textcolor{##0d923f}{#1}"),Sr("\\goldA","\\textcolor{##ffd0a9}{#1}"),Sr("\\goldB","\\textcolor{##ffbb71}{#1}"),Sr("\\goldC","\\textcolor{##ff9c39}{#1}"),Sr("\\goldD","\\textcolor{##e07d10}{#1}"),Sr("\\goldE","\\textcolor{##a75a05}{#1}"),Sr("\\redA","\\textcolor{##fca9a9}{#1}"),Sr("\\redB","\\textcolor{##ff8482}{#1}"),Sr("\\redC","\\textcolor{##f9685d}{#1}"),Sr("\\redD","\\textcolor{##e84d39}{#1}"),Sr("\\redE","\\textcolor{##bc2612}{#1}"),Sr("\\maroonA","\\textcolor{##ffbde0}{#1}"),Sr("\\maroonB","\\textcolor{##ff92c6}{#1}"),Sr("\\maroonC","\\textcolor{##ed5fa6}{#1}"),Sr("\\maroonD","\\textcolor{##ca337c}{#1}"),Sr("\\maroonE","\\textcolor{##9e034e}{#1}"),Sr("\\purpleA","\\textcolor{##ddd7ff}{#1}"),Sr("\\purpleB","\\textcolor{##c6b9fc}{#1}"),Sr("\\purpleC","\\textcolor{##aa87ff}{#1}"),Sr("\\purpleD","\\textcolor{##7854ab}{#1}"),Sr("\\purpleE","\\textcolor{##543b78}{#1}"),Sr("\\mintA","\\textcolor{##f5f9e8}{#1}"),Sr("\\mintB","\\textcolor{##edf2df}{#1}"),Sr("\\mintC","\\textcolor{##e0e5cc}{#1}"),Sr("\\grayA","\\textcolor{##f6f7f7}{#1}"),Sr("\\grayB","\\textcolor{##f0f1f2}{#1}"),Sr("\\grayC","\\textcolor{##e3e5e6}{#1}"),Sr("\\grayD","\\textcolor{##d6d8da}{#1}"),Sr("\\grayE","\\textcolor{##babec2}{#1}"),Sr("\\grayF","\\textcolor{##888d93}{#1}"),Sr("\\grayG","\\textcolor{##626569}{#1}"),Sr("\\grayH","\\textcolor{##3b3e40}{#1}"),Sr("\\grayI","\\textcolor{##21242c}{#1}"),Sr("\\kaBlue","\\textcolor{##314453}{#1}"),Sr("\\kaGreen","\\textcolor{##71B307}{#1}");var Cn={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},Nn=function(){function e(e,t,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new wn(kn,t.macros),this.mode=r,this.stack=[]}var t=e.prototype;return t.feed=function(e){this.lexer=new xn(e,this.settings)},t.switchMode=function(e){this.mode=e},t.beginGroup=function(){this.macros.beginGroup()},t.endGroup=function(){this.macros.endGroup()},t.endGroups=function(){this.macros.endGroups()},t.future=function(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]},t.popToken=function(){return this.future(),this.stack.pop()},t.pushToken=function(e){this.stack.push(e)},t.pushTokens=function(e){var t;(t=this.stack).push.apply(t,e)},t.scanArgument=function(e){var t,r,n;if(e){if(this.consumeSpaces(),"["!==this.future().text)return null;t=this.popToken();var a=this.consumeArg(["]"]);n=a.tokens,r=a.end}else{var i=this.consumeArg();n=i.tokens,t=i.start,r=i.end}return this.pushToken(new zr("EOF",r.loc)),this.pushTokens(n),t.range(r,"")},t.consumeSpaces=function(){for(;" "===this.future().text;)this.stack.pop()},t.consumeArg=function(e){var t=[],r=e&&e.length>0;r||this.consumeSpaces();var a,i=this.future(),o=0,s=0;do{if(a=this.popToken(),t.push(a),"{"===a.text)++o;else if("}"===a.text){if(-1==--o)throw new n("Extra }",a)}else if("EOF"===a.text)throw new n("Unexpected end of input in a macro argument, expected '"+(e&&r?e[s]:"}")+"'",a);if(e&&r)if((0===o||1===o&&"{"===e[s])&&a.text===e[s]){if(++s===e.length){t.splice(-s,s);break}}else s=0}while(0!==o||r);return"{"===i.text&&"}"===t[t.length-1].text&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:i,end:a}},t.consumeArgs=function(e,t){if(t){if(t.length!==e+1)throw new n("The length of delimiters doesn't match the number of args!");for(var r=t[0],a=0;a<r.length;a++){var i=this.popToken();if(r[a]!==i.text)throw new n("Use of the macro doesn't match its definition",i)}}for(var o=[],s=0;s<e;s++)o.push(this.consumeArg(t&&t[s+1]).tokens);return o},t.expandOnce=function(e){var t=this.popToken(),r=t.text,a=t.noexpand?null:this._getExpansion(r);if(null==a||e&&a.unexpandable){if(e&&null==a&&"\\"===r[0]&&!this.isDefined(r))throw new n("Undefined control sequence: "+r);return this.pushToken(t),t}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new n("Too many expansions: infinite loop or need to increase maxExpand setting");var i=a.tokens,o=this.consumeArgs(a.numArgs,a.delimiters);if(a.numArgs)for(var s=(i=i.slice()).length-1;s>=0;--s){var l=i[s];if("#"===l.text){if(0===s)throw new n("Incomplete placeholder at end of macro body",l);if("#"===(l=i[--s]).text)i.splice(s+1,1);else{if(!/^[1-9]$/.test(l.text))throw new n("Not a valid argument number",l);var h;(h=i).splice.apply(h,[s,2].concat(o[+l.text-1]))}}}return this.pushTokens(i),i},t.expandAfterFuture=function(){return this.expandOnce(),this.future()},t.expandNextToken=function(){for(;;){var e=this.expandOnce();if(e instanceof zr)return e.treatAsRelax&&(e.text="\\relax"),this.stack.pop()}throw new Error},t.expandMacro=function(e){return this.macros.has(e)?this.expandTokens([new zr(e)]):void 0},t.expandTokens=function(e){var t=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;){var n=this.expandOnce(!0);n instanceof zr&&(n.treatAsRelax&&(n.noexpand=!1,n.treatAsRelax=!1),t.push(this.stack.pop()))}return t},t.expandMacroAsText=function(e){var t=this.expandMacro(e);return t?t.map((function(e){return e.text})).join(""):t},t._getExpansion=function(e){var t=this.macros.get(e);if(null==t)return t;if(1===e.length){var r=this.lexer.catcodes[e];if(null!=r&&13!==r)return}var n="function"==typeof t?t(this):t;if("string"==typeof n){var a=0;if(-1!==n.indexOf("#"))for(var i=n.replace(/##/g,"");-1!==i.indexOf("#"+(a+1));)++a;for(var o=new xn(n,this.settings),s=[],l=o.lex();"EOF"!==l.text;)s.push(l),l=o.lex();return s.reverse(),{tokens:s,numArgs:a}}return n},t.isDefined=function(e){return this.macros.has(e)||yn.hasOwnProperty(e)||ne.math.hasOwnProperty(e)||ne.text.hasOwnProperty(e)||Cn.hasOwnProperty(e)},t.isExpandable=function(e){var t=this.macros.get(e);return null!=t?"string"==typeof t||"function"==typeof t||!t.unexpandable:yn.hasOwnProperty(e)&&!yn[e].primitive},e}(),qn=/^[âââââââââââ
âââââââᵢⱼââââââáµ£ââᵤᵥâᵦᵧᵨᵩᵪ]/,In=Object.freeze({"â":"+","â":"-","â":"=","â":"(","â":")","â":"0","â":"1","â":"2","â":"3","â":"4","â
":"5","â":"6","â":"7","â":"8","â":"9","â":"a","â":"e","â":"h","áµ¢":"i","â±¼":"j","â":"k","â":"l","â":"m","â":"n","â":"o","â":"p","áµ£":"r","â":"s","â":"t","ᵤ":"u","áµ¥":"v","â":"x","ᵦ":"β","áµ§":"γ","ᵨ":"Ï","ᵩ":"Ï","ᵪ":"Ï","âº":"+","â»":"-","â¼":"=","â½":"(","â¾":")","â°":"0","¹":"1","²":"2","³":"3","â´":"4","âµ":"5","â¶":"6","â·":"7","â¸":"8","â¹":"9","á´¬":"A","á´®":"B","á´°":"D","á´±":"E","á´³":"G","á´´":"H","á´µ":"I","á´¶":"J","á´·":"K","á´¸":"L","á´¹":"M","á´º":"N","á´¼":"O","á´¾":"P","á´¿":"R","áµ":"T","áµ":"U","â±½":"V","áµ":"W","áµ":"a","áµ":"b","á¶":"c","áµ":"d","áµ":"e","á¶ ":"f","áµ":"g","ʰ":"h","â±":"i","ʲ":"j","áµ":"k","Ë¡":"l","áµ":"m","â¿":"n","áµ":"o","áµ":"p","ʳ":"r","Ë¢":"s","áµ":"t","áµ":"u","áµ":"v","Ê·":"w","Ë£":"x","ʸ":"y","á¶»":"z","áµ":"β","áµ":"γ","áµ":"δ","áµ ":"Ï","ᵡ":"Ï","á¶¿":"θ"}),On={"Ì":{text:"\\'",math:"\\acute"},"Ì":{text:"\\`",math:"\\grave"},"Ì":{text:'\\"',math:"\\ddot"},"Ì":{text:"\\~",math:"\\tilde"},"Ì":{text:"\\=",math:"\\bar"},"Ì":{text:"\\u",math:"\\breve"},"Ì":{text:"\\v",math:"\\check"},"Ì":{text:"\\^",math:"\\hat"},"Ì":{text:"\\.",math:"\\dot"},"Ì":{text:"\\r",math:"\\mathring"},"Ì":{text:"\\H"},"̧":{text:"\\c"}},Rn={"á":"aÌ","à ":"aÌ","ä":"aÌ","Ç":"aÌÌ","ã":"aÌ","Ä":"aÌ","Ä":"aÌ","ắ":"aÌÌ","ằ":"aÌÌ","ẵ":"aÌÌ","Ç":"aÌ","â":"aÌ","ấ":"aÌÌ","ầ":"aÌÌ","ẫ":"aÌÌ","ȧ":"aÌ","Ç¡":"aÌÌ","Ã¥":"aÌ","Ç»":"aÌÌ","á¸":"bÌ","Ä":"cÌ","á¸":"çÌ","Ä":"cÌ","Ä":"cÌ","Ä":"cÌ","ç":"ç","Ä":"dÌ","á¸":"dÌ","á¸":"ḑ","é":"eÌ","è":"eÌ","ë":"eÌ","ẽ":"eÌ","Ä":"eÌ","á¸":"eÌÌ","á¸":"eÌÌ","Ä":"eÌ","á¸":"ȩÌ","Ä":"eÌ","ê":"eÌ","ế":"eÌÌ","á»":"eÌÌ","á»
":"eÌÌ","Ä":"eÌ","È©":"ȩ","á¸":"fÌ","ǵ":"gÌ","ḡ":"gÌ","Ä":"gÌ","ǧ":"gÌ","Ä":"gÌ","Ä¡":"gÌ","Ä£":"ģ","ḧ":"hÌ","È":"hÌ","Ä¥":"hÌ","ḣ":"hÌ","ḩ":"ḩ","Ã":"iÌ","ì":"iÌ","ï":"iÌ","ḯ":"iÌÌ","Ä©":"iÌ","Ä«":"iÌ","Ä":"iÌ","Ç":"iÌ","î":"iÌ","ǰ":"jÌ","ĵ":"jÌ","ḱ":"kÌ","Ç©":"kÌ","Ä·":"ķ","ĺ":"lÌ","ľ":"lÌ","ļ":"ļ","ḿ":"mÌ","á¹":"mÌ","Å":"nÌ","ǹ":"nÌ","ñ":"nÌ","Å":"nÌ","á¹
":"nÌ","Å":"ņ","ó":"oÌ","ò":"oÌ","ö":"oÌ","È«":"oÌÌ","õ":"oÌ","á¹":"oÌÌ","á¹":"oÌÌ","È":"oÌÌ","Å":"oÌ","á¹":"oÌÌ","á¹":"oÌÌ","Å":"oÌ","Ç":"oÌ","ô":"oÌ","á»":"oÌÌ","á»":"oÌÌ","á»":"oÌÌ","ȯ":"oÌ","ȱ":"oÌÌ","Å":"oÌ","á¹":"pÌ","á¹":"pÌ","Å":"rÌ","Å":"rÌ","á¹":"rÌ","Å":"ŗ","Å":"sÌ","á¹¥":"sÌÌ","Å¡":"sÌ","á¹§":"sÌÌ","Å":"sÌ","ṡ":"sÌ","Å":"ş","áº":"tÌ","Å¥":"tÌ","ṫ":"tÌ","Å£":"ţ","ú":"uÌ","ù":"uÌ","ü":"uÌ","Ç":"uÌÌ","Ç":"uÌÌ","Ç":"uÌÌ","Ç":"uÌÌ","Å©":"uÌ","á¹¹":"uÌÌ","Å«":"uÌ","á¹»":"uÌÌ","Å":"uÌ","Ç":"uÌ","û":"uÌ","ů":"uÌ","ű":"uÌ","á¹½":"vÌ","áº":"wÌ","áº":"wÌ","áº
":"wÌ","ŵ":"wÌ","áº":"wÌ","áº":"wÌ","áº":"xÌ","áº":"xÌ","ý":"yÌ","ỳ":"yÌ","ÿ":"yÌ","ỹ":"yÌ","ȳ":"yÌ","Å·":"yÌ","áº":"yÌ","áº":"yÌ","ź":"zÌ","ž":"zÌ","áº":"zÌ","ż":"zÌ","Ã":"AÌ","Ã":"AÌ","Ã":"AÌ","Ç":"AÌÌ","Ã":"AÌ","Ä":"AÌ","Ä":"AÌ","Ắ":"AÌÌ","Ằ":"AÌÌ","Ẵ":"AÌÌ","Ç":"AÌ","Ã":"AÌ","Ấ":"AÌÌ","Ầ":"AÌÌ","Ẫ":"AÌÌ","Ȧ":"AÌ","Ç ":"AÌÌ","Ã
":"AÌ","Ǻ":"AÌÌ","á¸":"BÌ","Ä":"CÌ","á¸":"ÇÌ","Ä":"CÌ","Ä":"CÌ","Ä":"CÌ","Ã":"Ç","Ä":"DÌ","á¸":"DÌ","á¸":"Ḑ","Ã":"EÌ","Ã":"EÌ","Ã":"EÌ","Ẽ":"EÌ","Ä":"EÌ","á¸":"EÌÌ","á¸":"EÌÌ","Ä":"EÌ","á¸":"ȨÌ","Ä":"EÌ","Ã":"EÌ","Ế":"EÌÌ","á»":"EÌÌ","á»":"EÌÌ","Ä":"EÌ","Ȩ":"Ȩ","á¸":"FÌ","Ç´":"GÌ","Ḡ":"GÌ","Ä":"GÌ","Ǧ":"GÌ","Ä":"GÌ","Ä ":"GÌ","Ä¢":"Ģ","Ḧ":"HÌ","È":"HÌ","Ĥ":"HÌ","Ḣ":"HÌ","Ḩ":"Ḩ","Ã":"IÌ","Ã":"IÌ","Ã":"IÌ","Ḯ":"IÌÌ","Ĩ":"IÌ","Ī":"IÌ","Ĭ":"IÌ","Ç":"IÌ","Ã":"IÌ","İ":"IÌ","Ä´":"JÌ","Ḱ":"KÌ","Ǩ":"KÌ","Ķ":"Ķ","Ĺ":"LÌ","Ľ":"LÌ","Ä»":"Ļ","Ḿ":"MÌ","á¹":"MÌ","Å":"NÌ","Ǹ":"NÌ","Ã":"NÌ","Å":"NÌ","á¹":"NÌ","Å
":"Ņ","Ã":"OÌ","Ã":"OÌ","Ã":"OÌ","Ȫ":"OÌÌ","Ã":"OÌ","á¹":"OÌÌ","á¹":"OÌÌ","Ȭ":"OÌÌ","Å":"OÌ","á¹":"OÌÌ","á¹":"OÌÌ","Å":"OÌ","Ç":"OÌ","Ã":"OÌ","á»":"OÌÌ","á»":"OÌÌ","á»":"OÌÌ","È®":"OÌ","Ȱ":"OÌÌ","Å":"OÌ","á¹":"PÌ","á¹":"PÌ","Å":"RÌ","Å":"RÌ","á¹":"RÌ","Å":"Ŗ","Å":"SÌ","Ṥ":"SÌÌ","Å ":"SÌ","Ṧ":"SÌÌ","Å":"SÌ","á¹ ":"SÌ","Å":"Ş","Ť":"TÌ","Ṫ":"TÌ","Å¢":"Ţ","Ã":"UÌ","Ã":"UÌ","Ã":"UÌ","Ç":"UÌÌ","Ç":"UÌÌ","Ç":"UÌÌ","Ç":"UÌÌ","Ũ":"UÌ","Ṹ":"UÌÌ","Ū":"UÌ","Ṻ":"UÌÌ","Ŭ":"UÌ","Ç":"UÌ","Ã":"UÌ","Å®":"UÌ","Ű":"UÌ","á¹¼":"VÌ","áº":"WÌ","áº":"WÌ","áº":"WÌ","Å´":"WÌ","áº":"WÌ","áº":"XÌ","áº":"XÌ","Ã":"YÌ","Ỳ":"YÌ","Ÿ":"YÌ","Ỹ":"YÌ","Ȳ":"YÌ","Ŷ":"YÌ","áº":"YÌ","Ź":"ZÌ","Ž":"ZÌ","áº":"ZÌ","Å»":"ZÌ","ά":"αÌ","á½°":"αÌ","á¾±":"αÌ","á¾°":"αÌ","Î":"εÌ","á½²":"εÌ","ή":"ηÌ","á½´":"ηÌ","ί":"ιÌ","á½¶":"ιÌ","Ï":"ιÌ","Î":"ιÌÌ","á¿":"ιÌÌ","á¿":"ιÌ","á¿":"ιÌ","Ï":"οÌ","ὸ":"οÌ","Ï":"Ï
Ì","ὺ":"Ï
Ì","Ï":"Ï
Ì","ΰ":"Ï
ÌÌ","á¿¢":"Ï
ÌÌ","á¿¡":"Ï
Ì","á¿ ":"Ï
Ì","Ï":"ÏÌ","á½¼":"ÏÌ","Î":"Î¥Ì","Ὺ":"Î¥Ì","Ϋ":"Î¥Ì","á¿©":"Î¥Ì","Ῠ":"Î¥Ì","Î":"ΩÌ","Ὼ":"ΩÌ"},Hn=function(){function e(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Nn(e,t,this.mode),this.settings=t,this.leftrightDepth=0}var t=e.prototype;return t.expect=function(e,t){if(void 0===t&&(t=!0),this.fetch().text!==e)throw new n("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()},t.consume=function(){this.nextToken=null},t.fetch=function(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken},t.switchMode=function(e){this.mode=e,this.gullet.switchMode(e)},t.parse=function(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}},t.subparse=function(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new zr("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,r},t.parseExpression=function(t,r){for(var n=[];;){"math"===this.mode&&this.consumeSpaces();var a=this.fetch();if(-1!==e.endOfExpression.indexOf(a.text))break;if(r&&a.text===r)break;if(t&&yn[a.text]&&yn[a.text].infix)break;var i=this.parseAtom(r);if(!i)break;"internal"!==i.type&&n.push(i)}return"text"===this.mode&&this.formLigatures(n),this.handleInfixNodes(n)},t.handleInfixNodes=function(e){for(var t,r=-1,a=0;a<e.length;a++)if("infix"===e[a].type){if(-1!==r)throw new n("only one infix operator per group",e[a].token);r=a,t=e[a].replaceWith}if(-1!==r&&t){var i,o,s=e.slice(0,r),l=e.slice(r+1);return i=1===s.length&&"ordgroup"===s[0].type?s[0]:{type:"ordgroup",mode:this.mode,body:s},o=1===l.length&&"ordgroup"===l[0].type?l[0]:{type:"ordgroup",mode:this.mode,body:l},["\\\\abovefrac"===t?this.callFunction(t,[i,e[r],o],[]):this.callFunction(t,[i,o],[])]}return e},t.handleSupSubscript=function(e){var t=this.fetch(),r=t.text;this.consume(),this.consumeSpaces();var a=this.parseGroup(e);if(!a)throw new n("Expected group after '"+r+"'",t);return a},t.formatUnsupportedCmd=function(e){for(var t=[],r=0;r<e.length;r++)t.push({type:"textord",mode:"text",text:e[r]});var n={type:"text",mode:this.mode,body:t};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[n]}},t.parseAtom=function(t){var r,a,i=this.parseGroup("atom",t);if("text"===this.mode)return i;for(;;){this.consumeSpaces();var o=this.fetch();if("\\limits"===o.text||"\\nolimits"===o.text){if(i&&"op"===i.type){var s="\\limits"===o.text;i.limits=s,i.alwaysHandleSupSub=!0}else{if(!i||"operatorname"!==i.type)throw new n("Limit controls must follow a math operator",o);i.alwaysHandleSupSub&&(i.limits="\\limits"===o.text)}this.consume()}else if("^"===o.text){if(r)throw new n("Double superscript",o);r=this.handleSupSubscript("superscript")}else if("_"===o.text){if(a)throw new n("Double subscript",o);a=this.handleSupSubscript("subscript")}else if("'"===o.text){if(r)throw new n("Double superscript",o);var l={type:"textord",mode:this.mode,text:"\\prime"},h=[l];for(this.consume();"'"===this.fetch().text;)h.push(l),this.consume();"^"===this.fetch().text&&h.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:h}}else{if(!In[o.text])break;var c=In[o.text],m=qn.test(o.text);for(this.consume();;){var u=this.fetch().text;if(!In[u])break;if(qn.test(u)!==m)break;this.consume(),c+=In[u]}var p=new e(c,this.settings).parse();m?a={type:"ordgroup",mode:"math",body:p}:r={type:"ordgroup",mode:"math",body:p}}}return r||a?{type:"supsub",mode:this.mode,base:i,sup:r,sub:a}:i},t.parseFunction=function(e,t){var r=this.fetch(),a=r.text,i=yn[a];if(!i)return null;if(this.consume(),t&&"atom"!==t&&!i.allowedInArgument)throw new n("Got function '"+a+"' with no arguments"+(t?" as "+t:""),r);if("text"===this.mode&&!i.allowedInText)throw new n("Can't use function '"+a+"' in text mode",r);if("math"===this.mode&&!1===i.allowedInMath)throw new n("Can't use function '"+a+"' in math mode",r);var o=this.parseArguments(a,i),s=o.args,l=o.optArgs;return this.callFunction(a,s,l,r,e)},t.callFunction=function(e,t,r,a,i){var o={funcName:e,parser:this,token:a,breakOnTokenText:i},s=yn[e];if(s&&s.handler)return s.handler(o,t,r);throw new n("No function handler for "+e)},t.parseArguments=function(e,t){var r=t.numArgs+t.numOptionalArgs;if(0===r)return{args:[],optArgs:[]};for(var a=[],i=[],o=0;o<r;o++){var s=t.argTypes&&t.argTypes[o],l=o<t.numOptionalArgs;(t.primitive&&null==s||"sqrt"===t.type&&1===o&&null==i[0])&&(s="primitive");var h=this.parseGroupOfType("argument to '"+e+"'",s,l);if(l)i.push(h);else{if(null==h)throw new n("Null argument, please report this as a bug");a.push(h)}}return{args:a,optArgs:i}},t.parseGroupOfType=function(e,t,r){switch(t){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,t);case"hbox":var a=this.parseArgumentGroup(r,"text");return null!=a?{type:"styling",mode:a.mode,body:[a],style:"text"}:null;case"raw":var i=this.parseStringGroup("raw",r);return null!=i?{type:"raw",mode:"text",string:i.text}:null;case"primitive":if(r)throw new n("A primitive argument cannot be optional");var o=this.parseGroup(e);if(null==o)throw new n("Expected group as "+e,this.fetch());return o;case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new n("Unknown group type as "+e,this.fetch())}},t.consumeSpaces=function(){for(;" "===this.fetch().text;)this.consume()},t.parseStringGroup=function(e,t){var r=this.gullet.scanArgument(t);if(null==r)return null;for(var n,a="";"EOF"!==(n=this.fetch()).text;)a+=n.text,this.consume();return this.consume(),r.text=a,r},t.parseRegexGroup=function(e,t){for(var r,a=this.fetch(),i=a,o="";"EOF"!==(r=this.fetch()).text&&e.test(o+r.text);)o+=(i=r).text,this.consume();if(""===o)throw new n("Invalid "+t+": '"+a.text+"'",a);return a.range(i,o)},t.parseColorGroup=function(e){var t=this.parseStringGroup("color",e);if(null==t)return null;var r=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!r)throw new n("Invalid color: '"+t.text+"'",t);var a=r[0];return/^[0-9a-f]{6}$/i.test(a)&&(a="#"+a),{type:"color-token",mode:this.mode,color:a}},t.parseSizeGroup=function(e){var t,r=!1;if(this.gullet.consumeSpaces(),!(t=e||"{"===this.gullet.future().text?this.parseStringGroup("size",e):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size")))return null;e||0!==t.text.length||(t.text="0pt",r=!0);var a=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!a)throw new n("Invalid size: '"+t.text+"'",t);var i={number:+(a[1]+a[2]),unit:a[3]};if(!D(i))throw new n("Invalid unit: '"+i.unit+"'",t);return{type:"size",mode:this.mode,value:i,isBlank:r}},t.parseUrlGroup=function(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),null==t)return null;var r=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}},t.parseArgumentGroup=function(e,t){var r=this.gullet.scanArgument(e);if(null==r)return null;var n=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var a=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var i={type:"ordgroup",mode:this.mode,loc:r.loc,body:a};return t&&this.switchMode(n),i},t.parseGroup=function(e,t){var r,a=this.fetch(),i=a.text;if("{"===i||"\\begingroup"===i){this.consume();var o="{"===i?"}":"\\endgroup";this.gullet.beginGroup();var s=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),r={type:"ordgroup",mode:this.mode,loc:Mr.range(a,l),body:s,semisimple:"\\begingroup"===i||void 0}}else if(null==(r=this.parseFunction(t,e)||this.parseSymbol())&&"\\"===i[0]&&!Cn.hasOwnProperty(i)){if(this.settings.throwOnError)throw new n("Undefined control sequence: "+i,a);r=this.formatUnsupportedCmd(i),this.consume()}return r},t.formLigatures=function(e){for(var t=e.length-1,r=0;r<t;++r){var n=e[r],a=n.text;"-"===a&&"-"===e[r+1].text&&(r+1<t&&"-"===e[r+2].text?(e.splice(r,3,{type:"textord",mode:"text",loc:Mr.range(n,e[r+2]),text:"---"}),t-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:Mr.range(n,e[r+1]),text:"--"}),t-=1)),"'"!==a&&"`"!==a||e[r+1].text!==a||(e.splice(r,2,{type:"textord",mode:"text",loc:Mr.range(n,e[r+1]),text:a+a}),t-=1)}},t.parseSymbol=function(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var r=t.slice(5),a="*"===r.charAt(0);if(a&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new n("\\verb assertion failed --\n please report what input caused this bug");return{type:"verb",mode:"text",body:r=r.slice(1,-1),star:a}}Rn.hasOwnProperty(t[0])&&!ne[this.mode][t[0]]&&(this.settings.strict&&"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=Rn[t[0]]+t.substr(1));var i,o=bn.exec(t);if(o&&("i"===(t=t.substring(0,o.index))?t="ı":"j"===t&&(t="È·")),ne[this.mode][t]){this.settings.strict&&"math"===this.mode&&"ÃÃþ".indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var s,l=ne[this.mode][t].group,h=Mr.range(e);if(ee.hasOwnProperty(l)){var c=l;s={type:"atom",mode:this.mode,family:c,loc:h,text:t}}else s={type:l,mode:this.mode,loc:h,text:t};i=s}else{if(!(t.charCodeAt(0)>=128))return null;this.settings.strict&&(S(t.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'" ('+t.charCodeAt(0)+")",e)),i={type:"textord",mode:"text",loc:Mr.range(e),text:t}}if(this.consume(),o)for(var m=0;m<o[0].length;m++){var u=o[0][m];if(!On[u])throw new n("Unknown accent ' "+u+"'",e);var p=On[u][this.mode]||On[u].text;if(!p)throw new n("Accent "+u+" unsupported in "+this.mode+" mode",e);i={type:"accent",mode:this.mode,loc:Mr.range(e),label:p,isStretchy:!1,isShifty:!0,base:i}}return i},e}();Hn.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var En=function(e,t){if(!("string"==typeof e||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new Hn(e,t);delete r.gullet.macros.current["\\df@tag"];var a=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new n("\\tag works only in display equations");a=[{type:"tag",mode:"text",body:a,tag:r.subparse([new zr("\\df@tag")])}]}return a},Ln=function(e,t,r){t.textContent="";var n=Pn(e,r).toNode();t.appendChild(n)};"undefined"!=typeof document&&"CSS1Compat"!==document.compatMode&&("undefined"!=typeof console&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),Ln=function(){throw new n("KaTeX doesn't work in quirks mode.")});var Dn=function(e,t,r){if(r.throwOnError||!(e instanceof n))throw e;var a=Ve.makeSpan(["katex-error"],[new $(t)]);return a.setAttribute("title",e.toString()),a.setAttribute("style","color:"+r.errorColor),a},Pn=function(e,t){var r=new m(t);try{return function(e,t,r){var n,a=Mt(r);if("mathml"===r.output)return St(e,t,a,r.displayMode,!0);if("html"===r.output){var i=ut(e,a);n=Ve.makeSpan(["katex"],[i])}else{var o=St(e,t,a,r.displayMode,!1),s=ut(e,a);n=Ve.makeSpan(["katex"],[o,s])}return zt(n,r)}(En(e,r),e,r)}catch(t){return Dn(t,e,r)}},Fn={version:"0.16.0",render:Ln,renderToString:function(e,t){return Pn(e,t).toMarkup()},ParseError:n,SETTINGS_SCHEMA:h,__parse:function(e,t){var r=new m(t);return En(e,r)},__renderToDomTree:Pn,__renderToHTMLTree:function(e,t){var r=new m(t);try{return function(e,t,r){var n=ut(e,Mt(r)),a=Ve.makeSpan(["katex"],[n]);return zt(a,r)}(En(e,r),0,r)}catch(t){return Dn(t,e,r)}},__setFontMetrics:function(e,t){A[e]=t},__defineSymbol:ae,__defineMacro:Sr,__domTree:{Span:Y,Anchor:X,SymbolNode:$,SvgNode:Z,PathNode:K,LineNode:J}};return t=t.default}()},e.exports=n()},function(e,t,r){}])};module.exports=t(); |
New file |
| | |
| | | # markdown |
| | | åè½ï¼æ¸²æ *markdown* |
| | | 大å°ï¼*â37KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â | |
| | | |
| | | 说æï¼ |
| | | å¼å
¥æ¬æä»¶åï¼ä¼ç»ç»ä»¶æ·»å ä¸ä¸ª *markdown* 屿§ï¼å°è¯¥å±æ§è®¾ç½®ä¸º *true* åï¼å³å¯éè¿ *content* 屿§æ *setContent* æ¹æ³è®¾ç½® *markdown* å
容å³å¯ |
| | | |
| | | è¥å¼å¯ *use-anchor* 屿§ï¼æææ é¢ `*# xxx*` é½ä¼è¢«è®¾ç½®ä¸ºéç¹ï¼éè¿é¾æ¥ `[xxx](#xxx)` å¯ä»¥ç´æ¥è·³è½¬ |
| | | |
| | | > æ¬æä»¶éè¿ [marked](https://github.com/markedjs/marked) è§£æ *markdown* ææ¬ï¼é¨å *css* æéèª [github-markdown-css](https://github.com/sindresorhus/github-markdown-css) |
| | | |
| | | > æ¬æä»¶å¯ä»¥å *highlight* æä»¶å
±ç¨ï¼å®ç° *markdown* ä¸ä»£ç åçé«äº®ææ |
New file |
| | |
| | | /** |
| | | * @fileoverview markdown æä»¶ |
| | | * Include marked (https://github.com/markedjs/marked) |
| | | * Include github-markdown-css (https://github.com/sindresorhus/github-markdown-css) |
| | | */ |
| | | const marked = require('./marked.min') |
| | | let index = 0 |
| | | |
| | | function Markdown (vm) { |
| | | this.vm = vm |
| | | vm._ids = {} |
| | | } |
| | | |
| | | Markdown.prototype.onUpdate = function (content) { |
| | | if (this.vm.properties.markdown) { |
| | | return marked(content) |
| | | } |
| | | } |
| | | |
| | | Markdown.prototype.onParse = function (node, vm) { |
| | | if (vm.options.markdown) { |
| | | // 䏿 id éè¦è½¬æ¢ï¼å¦åæ æ³è·³è½¬ |
| | | if (vm.options.useAnchor && node.attrs && /[\u4e00-\u9fa5]/.test(node.attrs.id)) { |
| | | const id = 't' + index++ |
| | | this.vm._ids[node.attrs.id] = id |
| | | node.attrs.id = id |
| | | } |
| | | if (node.name === 'p' || node.name === 'table' || node.name === 'tr' || node.name === 'th' || node.name === 'td' || node.name === 'blockquote' || node.name === 'pre' || node.name === 'code') { |
| | | node.attrs.class = `md-${node.name} ${node.attrs.class || ''}` |
| | | } |
| | | } |
| | | } |
| | | |
| | | module.exports = Markdown |
New file |
| | |
| | | /*! |
| | | * marked - a markdown parser |
| | | * Copyright (c) 2011-2020, Christopher Jeffrey. (MIT Licensed) |
| | | * https://github.com/markedjs/marked |
| | | */ |
| | | function t(){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t){var n;if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator])return(n=e[Symbol.iterator]()).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(e){return c[e]}var e,t=(function(t){function e(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}t.exports={defaults:e(),getDefaults:e,changeDefaults:function(e){t.exports.defaults=e}}}(e={exports:{}}),e.exports),r=(t.defaults,t.getDefaults,t.changeDefaults,/[&<>"']/),l=/[&<>"']/g,a=/[<>"']|&(?!#?\w+;)/,o=/[<>"']|&(?!#?\w+;)/g,c={"&":"&","<":"<",">":">",'"':""","'":"'"};var u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function h(e){return e.replace(u,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}var g=/(^|[^\[])\^/g;var f=/[^\w:]/g,d=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;var k={},b=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,x=/^([^:]+:\/*[^/]*)[\s\S]*$/;function w(e,t){k[" "+e]||(b.test(e)?k[" "+e]=e+"/":k[" "+e]=v(e,"/",!0));var n=-1===(e=k[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(m,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(x,"$1")+t:e+t}function v(e,t,n){var r=e.length;if(0===r)return"";for(var i=0;i<r;){var s=e.charAt(r-i-1);if(s!==t||n){if(s===t||!n)break;i++}else i++}return e.substr(0,r-i)}var _=function(e,t){if(t){if(r.test(e))return e.replace(l,n)}else if(a.test(e))return e.replace(o,n);return e},y=h,z=function(n,e){n=n.source||n,e=e||"";var r={replace:function(e,t){return t=(t=t.source||t).replace(g,"$1"),n=n.replace(e,t),r},getRegex:function(){return new RegExp(n,e)}};return r},S=function(e,t,n){if(e){var r;try{r=decodeURIComponent(h(n)).replace(f,"").toLowerCase()}catch(e){return null}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return null}t&&!d.test(n)&&(n=w(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n},$={exec:function(){}},A=function(e){for(var t,n,r=1;r<arguments.length;r++)for(n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},R=function(e,t){var n=e.replace(/\|/g,function(e,t,n){for(var r=!1,i=t;0<=--i&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(/ \|/),r=0;if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n},T=function(e,t){if(-1===e.indexOf(t[1]))return-1;for(var n=e.length,r=0,i=0;i<n;i++)if("\\"===e[i])i++;else if(e[i]===t[0])r++;else if(e[i]===t[1]&&--r<0)return i;return-1},I=function(e){e&&e.sanitize&&!e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")},Z=function(e,t){if(t<1)return"";for(var n="";1<t;)1&t&&(n+=e),t>>=1,e+=e;return n+e},q=t.defaults,O=v,C=R,U=_,j=T;function E(e,t,n){var r=t.href,i=t.title?U(t.title):null,t=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?{type:"link",raw:n,href:r,title:i,text:t}:{type:"image",raw:n,href:r,title:i,text:U(t)}}var D=function(){function e(e){this.options=e||q}var t=e.prototype;return t.space=function(e){e=this.rules.block.newline.exec(e);if(e)return 1<e[0].length?{type:"space",raw:e[0]}:{raw:"\n"}},t.code=function(e,t){e=this.rules.block.code.exec(e);if(e){t=t[t.length-1];if(t&&"paragraph"===t.type)return{raw:e[0],text:e[0].trimRight()};t=e[0].replace(/^ {4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:O(t,"\n")}}},t.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var n=t[0],e=function(e,t){if(null===(e=e.match(/^(\s+)(?:```)/)))return t;var n=e[1];return t.split("\n").map(function(e){var t=e.match(/^\s+/);return null!==t&&t[0].length>=n.length?e.slice(n.length):e}).join("\n")}(n,t[3]||"");return{type:"code",raw:n,lang:t[2]&&t[2].trim(),text:e}}},t.heading=function(e){e=this.rules.block.heading.exec(e);if(e)return{type:"heading",raw:e[0],depth:e[1].length,text:e[2]}},t.nptable=function(e){e=this.rules.block.nptable.exec(e);if(e){var t={type:"table",header:C(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[],raw:e[0]};if(t.header.length===t.align.length){for(var n=t.align.length,r=0;r<n;r++)/^ *-+: *$/.test(t.align[r])?t.align[r]="right":/^ *:-+: *$/.test(t.align[r])?t.align[r]="center":/^ *:-+ *$/.test(t.align[r])?t.align[r]="left":t.align[r]=null;for(n=t.cells.length,r=0;r<n;r++)t.cells[r]=C(t.cells[r],t.header.length);return t}}},t.hr=function(e){e=this.rules.block.hr.exec(e);if(e)return{type:"hr",raw:e[0]}},t.blockquote=function(e){var t=this.rules.block.blockquote.exec(e);if(t){e=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],text:e}}},t.list=function(e){e=this.rules.block.list.exec(e);if(e){for(var t,n,r,i,s,l=e[0],a=e[2],o=1<a.length,c={type:"list",raw:l,ordered:o,start:o?+a.slice(0,-1):"",loose:!1,items:[]},u=e[0].match(this.rules.block.item),p=!1,h=u.length,g=this.rules.block.listItemStart.exec(u[0]),f=0;f<h;f++){if(l=t=u[f],f!==h-1){if((r=this.rules.block.listItemStart.exec(u[f+1]))[1].length>g[0].length||3<r[1].length){u.splice(f,2,u[f]+"\n"+u[f+1]),f--,h--;continue}(!this.options.pedantic||this.options.smartLists?r[2][r[2].length-1]!==a[a.length-1]:o==(1===r[2].length))&&(n=u.slice(f+1).join("\n"),c.raw=c.raw.substring(0,c.raw.length-n.length),f=h-1),g=r}r=t.length,~(t=t.replace(/^ *([*+-]|\d+[.)]) ?/,"")).indexOf("\n ")&&(r-=t.length,t=this.options.pedantic?t.replace(/^ {1,4}/gm,""):t.replace(new RegExp("^ {1,"+r+"}","gm"),"")),r=p||/\n\n(?!\s*$)/.test(t),f!==h-1&&(p="\n"===t.charAt(t.length-1),r=r||p),r&&(c.loose=!0),this.options.gfm&&(s=void 0,(i=/^\[[ xX]\] /.test(t))&&(s=" "!==t[1],t=t.replace(/^\[[ xX]\] +/,""))),c.items.push({type:"list_item",raw:l,task:i,checked:s,loose:r,text:t})}return c}},t.html=function(e){e=this.rules.block.html.exec(e);if(e)return{type:this.options.sanitize?"paragraph":"html",raw:e[0],pre:!this.options.sanitizer&&("pre"===e[1]||"script"===e[1]||"style"===e[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):U(e[0]):e[0]}},t.def=function(e){e=this.rules.block.def.exec(e);if(e)return e[3]&&(e[3]=e[3].substring(1,e[3].length-1)),{tag:e[1].toLowerCase().replace(/\s+/g," "),raw:e[0],href:e[2],title:e[3]}},t.table=function(e){e=this.rules.block.table.exec(e);if(e){var t={type:"table",header:C(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[]};if(t.header.length===t.align.length){t.raw=e[0];for(var n=t.align.length,r=0;r<n;r++)/^ *-+: *$/.test(t.align[r])?t.align[r]="right":/^ *:-+: *$/.test(t.align[r])?t.align[r]="center":/^ *:-+ *$/.test(t.align[r])?t.align[r]="left":t.align[r]=null;for(n=t.cells.length,r=0;r<n;r++)t.cells[r]=C(t.cells[r].replace(/^ *\| *| *\| *$/g,""),t.header.length);return t}}},t.lheading=function(e){e=this.rules.block.lheading.exec(e);if(e)return{type:"heading",raw:e[0],depth:"="===e[2].charAt(0)?1:2,text:e[1]}},t.paragraph=function(e){e=this.rules.block.paragraph.exec(e);if(e)return{type:"paragraph",raw:e[0],text:"\n"===e[1].charAt(e[1].length-1)?e[1].slice(0,-1):e[1]}},t.text=function(e,t){e=this.rules.block.text.exec(e);if(e){t=t[t.length-1];return t&&"text"===t.type?{raw:e[0],text:e[0]}:{type:"text",raw:e[0],text:e[0]}}},t.escape=function(e){e=this.rules.inline.escape.exec(e);if(e)return{type:"escape",raw:e[0],text:U(e[1])}},t.tag=function(e,t,n){e=this.rules.inline.tag.exec(e);if(e)return!t&&/^<a /i.test(e[0])?t=!0:t&&/^<\/a>/i.test(e[0])&&(t=!1),!n&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?n=!0:n&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(n=!1),{type:this.options.sanitize?"text":"html",raw:e[0],inLink:t,inRawBlock:n,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):U(e[0]):e[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){e=j(t[2],"()");-1<e&&(r=(0===t[0].indexOf("!")?5:4)+t[1].length+e,t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,r).trim(),t[3]="");var n,e=t[2],r="";return r=this.options.pedantic?(n=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(e),n?(e=n[1],n[3]):""):t[3]?t[3].slice(1,-1):"",E(t,{href:(e=e.trim().replace(/^<([\s\S]*)>$/,"$1"))&&e.replace(this.rules.inline._escapes,"$1"),title:r&&r.replace(this.rules.inline._escapes,"$1")},t[0])}},t.reflink=function(e,t){if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){e=(n[2]||n[1]).replace(/\s+/g," ");if((e=t[e.toLowerCase()])&&e.href)return E(n,e,n[0]);var n=n[0].charAt(0);return{type:"text",raw:n,text:n}}},t.strong=function(e,t,n){void 0===n&&(n="");var r=this.rules.inline.strong.start.exec(e);if(r&&(!r[1]||r[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){t=t.slice(-1*e.length);var i,s="**"===r[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(s.lastIndex=0;null!=(r=s.exec(t));)if(i=this.rules.inline.strong.middle.exec(t.slice(0,r.index+3)))return{type:"strong",raw:e.slice(0,i[0].length),text:e.slice(2,i[0].length-2)}}},t.em=function(e,t,n){void 0===n&&(n="");var r=this.rules.inline.em.start.exec(e);if(r&&(!r[1]||r[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){t=t.slice(-1*e.length);var i,s="*"===r[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(s.lastIndex=0;null!=(r=s.exec(t));)if(i=this.rules.inline.em.middle.exec(t.slice(0,r.index+2)))return{type:"em",raw:e.slice(0,i[0].length),text:e.slice(1,i[0].length-1)}}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var n=t[2].replace(/\n/g," "),r=/[^ ]/.test(n),e=n.startsWith(" ")&&n.endsWith(" ");return r&&e&&(n=n.substring(1,n.length-1)),n=U(n,!0),{type:"codespan",raw:t[0],text:n}}},t.br=function(e){e=this.rules.inline.br.exec(e);if(e)return{type:"br",raw:e[0]}},t.del=function(e){e=this.rules.inline.del.exec(e);if(e)return{type:"del",raw:e[0],text:e[2]}},t.autolink=function(e,t){e=this.rules.inline.autolink.exec(e);if(e){var n,t="@"===e[2]?"mailto:"+(n=U(this.options.mangle?t(e[1]):e[1])):n=U(e[1]);return{type:"link",raw:e[0],text:n,href:t,tokens:[{type:"text",raw:n,text:n}]}}},t.url=function(e,t){var n,r,i,s;if(n=this.rules.inline.url.exec(e)){if("@"===n[2])i="mailto:"+(r=U(this.options.mangle?t(n[0]):n[0]));else{for(;s=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0],s!==n[0];);r=U(n[0]),i="www."===n[1]?"http://"+r:r}return{type:"link",raw:n[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}},t.inlineText=function(e,t,n){e=this.rules.inline.text.exec(e);if(e){n=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):U(e[0]):e[0]:U(this.options.smartypants?n(e[0]):e[0]);return{type:"text",raw:e[0],text:n}}},e}(),R=$,T=z,$=A,z={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:R,table:R,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};z.def=T(z.def).replace("label",z._label).replace("title",z._title).getRegex(),z.bullet=/(?:[*+-]|\d{1,9}[.)])/,z.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,z.item=T(z.item,"gm").replace(/bull/g,z.bullet).getRegex(),z.listItemStart=T(/^( *)(bull)/).replace("bull",z.bullet).getRegex(),z.list=T(z.list).replace(/bull/g,z.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+z.def.source+")").getRegex(),z._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",z._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,z.html=T(z.html,"i").replace("comment",z._comment).replace("tag",z._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),z.paragraph=T(z._paragraph).replace("hr",z.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",z._tag).getRegex(),z.blockquote=T(z.blockquote).replace("paragraph",z.paragraph).getRegex(),z.normal=$({},z),z.gfm=$({},z.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),z.gfm.nptable=T(z.gfm.nptable).replace("hr",z.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",z._tag).getRegex(),z.gfm.table=T(z.gfm.table).replace("hr",z.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",z._tag).getRegex(),z.pedantic=$({},z.normal,{html:T("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",z._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:R,paragraph:T(z.normal._paragraph).replace("hr",z.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",z.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});R={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:R,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation*\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation*\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:R,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\s*punctuation])/,_punctuation:"!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~"};R.punctuation=T(R.punctuation).replace(/punctuation/g,R._punctuation).getRegex(),R._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",R._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",R._comment=T(z._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),R.em.start=T(R.em.start).replace(/punctuation/g,R._punctuation).getRegex(),R.em.middle=T(R.em.middle).replace(/punctuation/g,R._punctuation).replace(/overlapSkip/g,R._overlapSkip).getRegex(),R.em.endAst=T(R.em.endAst,"g").replace(/punctuation/g,R._punctuation).getRegex(),R.em.endUnd=T(R.em.endUnd,"g").replace(/punctuation/g,R._punctuation).getRegex(),R.strong.start=T(R.strong.start).replace(/punctuation/g,R._punctuation).getRegex(),R.strong.middle=T(R.strong.middle).replace(/punctuation/g,R._punctuation).replace(/overlapSkip/g,R._overlapSkip).getRegex(),R.strong.endAst=T(R.strong.endAst,"g").replace(/punctuation/g,R._punctuation).getRegex(),R.strong.endUnd=T(R.strong.endUnd,"g").replace(/punctuation/g,R._punctuation).getRegex(),R.blockSkip=T(R._blockSkip,"g").getRegex(),R.overlapSkip=T(R._overlapSkip,"g").getRegex(),R._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,R._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,R._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,R.autolink=T(R.autolink).replace("scheme",R._scheme).replace("email",R._email).getRegex(),R._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,R.tag=T(R.tag).replace("comment",R._comment).replace("attribute",R._attribute).getRegex(),R._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,R._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,R._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,R.link=T(R.link).replace("label",R._label).replace("href",R._href).replace("title",R._title).getRegex(),R.reflink=T(R.reflink).replace("label",R._label).getRegex(),R.reflinkSearch=T(R.reflinkSearch,"g").replace("reflink",R.reflink).replace("nolink",R.nolink).getRegex(),R.normal=$({},R),R.pedantic=$({},R.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:T(/^!?\[(label)\]\((.*?)\)/).replace("label",R._label).getRegex(),reflink:T(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",R._label).getRegex()}),R.gfm=$({},R.normal,{escape:T(R.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),R.gfm.url=T(R.gfm.url,"i").replace("email",R.gfm._extended_email).getRegex(),R.breaks=$({},R.gfm,{br:T(R.br).replace("{2,}","*").getRegex(),text:T(R.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var R={block:z,inline:R},P=t.defaults,L=R.block,N=R.inline,B=Z;function F(e){return e.replace(/---/g,"â").replace(/--/g,"â").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1â").replace(/'/g,"â").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1â").replace(/"/g,"â").replace(/\.{3}/g,"â¦")}function M(e){for(var t,n="",r=e.length,i=0;i<r;i++)t=e.charCodeAt(i),.5<Math.random()&&(t="x"+t.toString(16)),n+="&#"+t+";";return n}var W=function(){function n(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||P,this.options.tokenizer=this.options.tokenizer||new D,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;e={block:L.normal,inline:N.normal};this.options.pedantic?(e.block=L.pedantic,e.inline=N.pedantic):this.options.gfm&&(e.block=L.gfm,this.options.breaks?e.inline=N.breaks:e.inline=N.gfm),this.tokenizer.rules=e}n.lex=function(e,t){return new n(t).lex(e)},n.lexInline=function(e,t){return new n(t).inlineTokens(e)};var e,t,r=n.prototype;return r.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens,!0),this.inline(this.tokens),this.tokens},r.blockTokens=function(e,t,n){var r,i,s,l;for(void 0===t&&(t=[]),void 0===n&&(n=!0),e=e.replace(/^ +$/gm,"");e;)if(r=this.tokenizer.space(e))e=e.substring(r.raw.length),r.type&&t.push(r);else if(r=this.tokenizer.code(e,t))e=e.substring(r.raw.length),r.type?t.push(r):((l=t[t.length-1]).raw+="\n"+r.raw,l.text+="\n"+r.text);else if(r=this.tokenizer.fences(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.heading(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.nptable(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.hr(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.blockquote(e))e=e.substring(r.raw.length),r.tokens=this.blockTokens(r.text,[],n),t.push(r);else if(r=this.tokenizer.list(e)){for(e=e.substring(r.raw.length),s=r.items.length,i=0;i<s;i++)r.items[i].tokens=this.blockTokens(r.items[i].text,[],!1);t.push(r)}else if(r=this.tokenizer.html(e))e=e.substring(r.raw.length),t.push(r);else if(n&&(r=this.tokenizer.def(e)))e=e.substring(r.raw.length),this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});else if(r=this.tokenizer.table(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.lheading(e))e=e.substring(r.raw.length),t.push(r);else if(n&&(r=this.tokenizer.paragraph(e)))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.text(e,t))e=e.substring(r.raw.length),r.type?t.push(r):((l=t[t.length-1]).raw+="\n"+r.raw,l.text+="\n"+r.text);else if(e){var a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}throw new Error(a)}return t},r.inline=function(e){for(var t,n,r,i,s,l=e.length,a=0;a<l;a++)switch((s=e[a]).type){case"paragraph":case"text":case"heading":s.tokens=[],this.inlineTokens(s.text,s.tokens);break;case"table":for(s.tokens={header:[],cells:[]},r=s.header.length,t=0;t<r;t++)s.tokens.header[t]=[],this.inlineTokens(s.header[t],s.tokens.header[t]);for(r=s.cells.length,t=0;t<r;t++)for(i=s.cells[t],s.tokens.cells[t]=[],n=0;n<i.length;n++)s.tokens.cells[t][n]=[],this.inlineTokens(i[n],s.tokens.cells[t][n]);break;case"blockquote":this.inline(s.tokens);break;case"list":for(r=s.items.length,t=0;t<r;t++)this.inline(s.items[t].tokens)}return e},r.inlineTokens=function(e,t,n,r){var i;void 0===t&&(t=[]),void 0===n&&(n=!1),void 0===r&&(r=!1);var s,l,a,o=e;if(this.tokens.links){var c=Object.keys(this.tokens.links);if(0<c.length)for(;null!=(s=this.tokenizer.rules.inline.reflinkSearch.exec(o));)c.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,s.index)+"["+B("a",s[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(s=this.tokenizer.rules.inline.blockSkip.exec(o));)o=o.slice(0,s.index)+"["+B("a",s[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;e;)if(l||(a=""),l=!1,i=this.tokenizer.escape(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.tag(e,n,r))e=e.substring(i.raw.length),n=i.inLink,r=i.inRawBlock,t.push(i);else if(i=this.tokenizer.link(e))e=e.substring(i.raw.length),"link"===i.type&&(i.tokens=this.inlineTokens(i.text,[],!0,r)),t.push(i);else if(i=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(i.raw.length),"link"===i.type&&(i.tokens=this.inlineTokens(i.text,[],!0,r)),t.push(i);else if(i=this.tokenizer.strong(e,o,a))e=e.substring(i.raw.length),i.tokens=this.inlineTokens(i.text,[],n,r),t.push(i);else if(i=this.tokenizer.em(e,o,a))e=e.substring(i.raw.length),i.tokens=this.inlineTokens(i.text,[],n,r),t.push(i);else if(i=this.tokenizer.codespan(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.br(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.del(e))e=e.substring(i.raw.length),i.tokens=this.inlineTokens(i.text,[],n,r),t.push(i);else if(i=this.tokenizer.autolink(e,M))e=e.substring(i.raw.length),t.push(i);else if(n||!(i=this.tokenizer.url(e,M))){if(i=this.tokenizer.inlineText(e,r,F))e=e.substring(i.raw.length),a=i.raw.slice(-1),l=!0,t.push(i);else if(e){var u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}throw new Error(u)}}else e=e.substring(i.raw.length),t.push(i);return t},e=n,t=[{key:"rules",get:function(){return{block:L,inline:N}}}],(r=null)&&i(e.prototype,r),t&&i(e,t),n}(),X=t.defaults,G=S,V=_,H=function(){function e(e){this.options=e||X}var t=e.prototype;return t.code=function(e,t,n){var r=(t||"").match(/\S*/)[0];return!this.options.highlight||null!=(t=this.options.highlight(e,r))&&t!==e&&(n=!0,e=t),r?'<pre><code class="'+this.options.langPrefix+V(r,!0)+'">'+(n?e:V(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:V(e,!0))+"</code></pre>\n"},t.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},t.html=function(e){return e},t.heading=function(e,t,n,r){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+r.slug(n)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"},t.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},t.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"},t.listitem=function(e){return"<li>"+e+"</li>\n"},t.checkbox=function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},t.paragraph=function(e){return"<p>"+e+"</p>\n"},t.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n"+(t=t&&"<tbody>"+t+"</tbody>")+"</table>\n"},t.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},t.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"},t.strong=function(e){return"<strong>"+e+"</strong>"},t.em=function(e){return"<em>"+e+"</em>"},t.codespan=function(e){return"<code>"+e+"</code>"},t.br=function(){return this.options.xhtml?"<br/>":"<br>"},t.del=function(e){return"<del>"+e+"</del>"},t.link=function(e,t,n){if(null===(e=G(this.options.sanitize,this.options.baseUrl,e)))return n;e='<a href="'+V(e)+'"';return t&&(e+=' title="'+t+'"'),e+=">"+n+"</a>"},t.image=function(e,t,n){if(null===(e=G(this.options.sanitize,this.options.baseUrl,e)))return n;n='<img src="'+e+'" alt="'+n+'"';return t&&(n+=' title="'+t+'"'),n+=this.options.xhtml?"/>":">"},t.text=function(e){return e},e}(),J=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,n){return""+n},t.image=function(e,t,n){return""+n},t.br=function(){return""},e}(),K=function(){function e(){this.seen={}}var t=e.prototype;return t.serialize=function(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},t.getNextSafeSlug=function(e,t){var n=e,r=0;if(this.seen.hasOwnProperty(n))for(r=this.seen[e];n=e+"-"+ ++r,this.seen.hasOwnProperty(n););return t||(this.seen[e]=r,this.seen[n]=0),n},t.slug=function(e,t){void 0===t&&(t={});var n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)},e}(),Q=t.defaults,Y=y,ee=function(){function n(e){this.options=e||Q,this.options.renderer=this.options.renderer||new H,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new J,this.slugger=new K}n.parse=function(e,t){return new n(t).parse(e)},n.parseInline=function(e,t){return new n(t).parseInline(e)};var e=n.prototype;return e.parse=function(e,t){void 0===t&&(t=!0);for(var n,r,i,s,l,a,o,c,u,p,h,g,f,d,k,b="",m=e.length,x=0;x<m;x++)switch((c=e[x]).type){case"space":continue;case"hr":b+=this.renderer.hr();continue;case"heading":b+=this.renderer.heading(this.parseInline(c.tokens),c.depth,Y(this.parseInline(c.tokens,this.textRenderer)),this.slugger);continue;case"code":b+=this.renderer.code(c.text,c.lang,c.escaped);continue;case"table":for(a=u="",i=c.header.length,n=0;n<i;n++)a+=this.renderer.tablecell(this.parseInline(c.tokens.header[n]),{header:!0,align:c.align[n]});for(u+=this.renderer.tablerow(a),o="",i=c.cells.length,n=0;n<i;n++){for(a="",s=(l=c.tokens.cells[n]).length,r=0;r<s;r++)a+=this.renderer.tablecell(this.parseInline(l[r]),{header:!1,align:c.align[r]});o+=this.renderer.tablerow(a)}b+=this.renderer.table(u,o);continue;case"blockquote":o=this.parse(c.tokens),b+=this.renderer.blockquote(o);continue;case"list":for(u=c.ordered,w=c.start,p=c.loose,i=c.items.length,o="",n=0;n<i;n++)f=(g=c.items[n]).checked,d=g.task,h="",g.task&&(k=this.renderer.checkbox(f),p?0<g.tokens.length&&"text"===g.tokens[0].type?(g.tokens[0].text=k+" "+g.tokens[0].text,g.tokens[0].tokens&&0<g.tokens[0].tokens.length&&"text"===g.tokens[0].tokens[0].type&&(g.tokens[0].tokens[0].text=k+" "+g.tokens[0].tokens[0].text)):g.tokens.unshift({type:"text",text:k}):h+=k),h+=this.parse(g.tokens,p),o+=this.renderer.listitem(h,d,f);b+=this.renderer.list(o,u,w);continue;case"html":b+=this.renderer.html(c.text);continue;case"paragraph":b+=this.renderer.paragraph(this.parseInline(c.tokens));continue;case"text":for(o=c.tokens?this.parseInline(c.tokens):c.text;x+1<m&&"text"===e[x+1].type;)o+="\n"+((c=e[++x]).tokens?this.parseInline(c.tokens):c.text);b+=t?this.renderer.paragraph(o):o;continue;default:var w='Token with "'+c.type+'" type was not found.';if(this.options.silent)return void console.error(w);throw new Error(w)}return b},e.parseInline=function(e,t){t=t||this.renderer;for(var n,r="",i=e.length,s=0;s<i;s++)switch((n=e[s]).type){case"escape":r+=t.text(n.text);break;case"html":r+=t.html(n.text);break;case"link":r+=t.link(n.href,n.title,this.parseInline(n.tokens,t));break;case"image":r+=t.image(n.href,n.title,n.text);break;case"strong":r+=t.strong(this.parseInline(n.tokens,t));break;case"em":r+=t.em(this.parseInline(n.tokens,t));break;case"codespan":r+=t.codespan(n.text);break;case"br":r+=t.br();break;case"del":r+=t.del(this.parseInline(n.tokens,t));break;case"text":r+=t.text(n.text);break;default:var l='Token with "'+n.type+'" type was not found.';if(this.options.silent)return void console.error(l);throw new Error(l)}return r},n}(),te=A,ne=I,re=_,_=t.getDefaults,ie=t.changeDefaults,t=t.defaults;function se(e,n,r){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if("function"==typeof n&&(r=n,n=null),n=te({},se.defaults,n||{}),ne(n),r){var i,s=n.highlight;try{i=W.lex(e,n)}catch(e){return r(e)}var l=function(t){var e;if(!t)try{e=ee.parse(i,n)}catch(e){t=e}return n.highlight=s,t?r(t):r(null,e)};if(!s||s.length<3)return l();if(delete n.highlight,!i.length)return l();var a=0;return se.walkTokens(i,function(n){"code"===n.type&&(a++,setTimeout(function(){s(n.text,n.lang,function(e,t){return e?l(e):(null!=t&&t!==n.text&&(n.text=t,n.escaped=!0),void(0===--a&&l()))})},0))}),void(0===a&&l())}try{var t=W.lex(e,n);return n.walkTokens&&se.walkTokens(t,n.walkTokens),ee.parse(t,n)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",n.silent)return"<p>An error occurred:</p><pre>"+re(e.message+"",!0)+"</pre>";throw e}}return se.options=se.setOptions=function(e){return te(se.defaults,e),ie(se.defaults),se},se.getDefaults=_,se.defaults=t,se.use=function(a){var t,n=te({},a);a.renderer&&function(){var e,l=se.defaults.renderer||new H;for(e in a.renderer)!function(i){var s=l[i];l[i]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=a.renderer[i].apply(l,t);return!1===r&&(r=s.apply(l,t)),r}}(e);n.renderer=l}(),a.tokenizer&&function(){var e,l=se.defaults.tokenizer||new D;for(e in a.tokenizer)!function(i){var s=l[i];l[i]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=a.tokenizer[i].apply(l,t);return!1===r&&(r=s.apply(l,t)),r}}(e);n.tokenizer=l}(),a.walkTokens&&(t=se.defaults.walkTokens,n.walkTokens=function(e){a.walkTokens(e),t&&t(e)}),se.setOptions(n)},se.walkTokens=function(e,t){for(var n,r=p(e);!(n=r()).done;){var i=n.value;switch(t(i),i.type){case"table":for(var s=p(i.tokens.header);!(l=s()).done;){var l=l.value;se.walkTokens(l,t)}for(var a,o=p(i.tokens.cells);!(a=o()).done;)for(var c=p(a.value);!(u=c()).done;){var u=u.value;se.walkTokens(u,t)}break;case"list":se.walkTokens(i.items,t);break;default:i.tokens&&se.walkTokens(i.tokens,t)}}},se.parseInline=function(e,t){if(null==e)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");t=te({},se.defaults,t||{}),ne(t);try{var n=W.lexInline(e,t);return t.walkTokens&&se.walkTokens(n,t.walkTokens),ee.parseInline(n,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+re(e.message+"",!0)+"</pre>";throw e}},se.Parser=ee,se.parser=ee.parse,se.Renderer=H,se.TextRenderer=J,se.Lexer=W,se.lexer=W.lex,se.Tokenizer=D,se.Slugger=K,se.parse=se};module.exports=t(); |
New file |
| | |
| | | const path = require('path') |
| | | |
| | | module.exports = { |
| | | style: |
| | | `.md-p { |
| | | margin-block-start: 1em; |
| | | margin-block-end: 1em; |
| | | } |
| | | |
| | | .md-table, |
| | | .md-blockquote { |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | .md-table { |
| | | box-sizing: border-box; |
| | | width: 100%; |
| | | overflow: auto; |
| | | border-spacing: 0; |
| | | border-collapse: collapse; |
| | | } |
| | | |
| | | .md-tr { |
| | | background-color: #fff; |
| | | border-top: 1px solid #c6cbd1; |
| | | } |
| | | |
| | | .md-table .md-tr:nth-child(2n) { |
| | | background-color: #f6f8fa; |
| | | } |
| | | |
| | | .md-th, |
| | | .md-td { |
| | | padding: 6px 13px !important; |
| | | border: 1px solid #dfe2e5; |
| | | } |
| | | |
| | | .md-th { |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .md-blockquote { |
| | | padding: 0 1em; |
| | | color: #6a737d; |
| | | border-left: 0.25em solid #dfe2e5; |
| | | } |
| | | |
| | | .md-code { |
| | | padding: 0.2em 0.4em; |
| | | font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace; |
| | | font-size: 85%; |
| | | background-color: rgba(27, 31, 35, 0.05); |
| | | border-radius: 3px; |
| | | } |
| | | |
| | | .md-pre .md-code { |
| | | padding: 0; |
| | | font-size: 100%; |
| | | background: transparent; |
| | | border: 0; |
| | | }`, |
| | | handler (file) { |
| | | // æ·»å markdown 屿§ |
| | | if (file.path.includes('miniprogram' + path.sep + 'index.js')) { |
| | | file.contents = Buffer.from(file.contents.toString().replace(/properties\s*:\s*{/, 'properties: {\n markdown: Boolean,') |
| | | // å¤ç䏿 id |
| | | .replace(/navigateTo\s*\(id,\s*offset\)\s*{/, 'navigateTo (id, offset) {\n id = this._ids[decodeURI(id)] || id')) |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | module.exports = { |
| | | style: |
| | | `.md-p { |
| | | margin-block-start: 1em; |
| | | margin-block-end: 1em; |
| | | } |
| | | |
| | | .md-table, |
| | | .md-blockquote { |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | .md-table { |
| | | box-sizing: border-box; |
| | | width: 100%; |
| | | overflow: auto; |
| | | border-spacing: 0; |
| | | border-collapse: collapse; |
| | | } |
| | | |
| | | .md-tr { |
| | | background-color: #fff; |
| | | border-top: 1px solid #c6cbd1; |
| | | } |
| | | |
| | | .md-table .md-tr:nth-child(2n) { |
| | | background-color: #f6f8fa; |
| | | } |
| | | |
| | | .md-th, |
| | | .md-td { |
| | | padding: 6px 13px !important; |
| | | border: 1px solid #dfe2e5; |
| | | } |
| | | |
| | | .md-th { |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .md-blockquote { |
| | | padding: 0 1em; |
| | | color: #6a737d; |
| | | border-left: 0.25em solid #dfe2e5; |
| | | } |
| | | |
| | | .md-code { |
| | | padding: 0.2em 0.4em; |
| | | font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace; |
| | | font-size: 85%; |
| | | background-color: rgba(27, 31, 35, 0.05); |
| | | border-radius: 3px; |
| | | } |
| | | |
| | | .md-pre .md-code { |
| | | padding: 0; |
| | | font-size: 100%; |
| | | background: transparent; |
| | | border: 0; |
| | | }`, |
| | | handler (file) { |
| | | // æ·»å markdown 屿§ |
| | | if (file.path.includes('mp-html.vue')) { |
| | | file.contents = Buffer.from(file.contents.toString().replace(/props\s*:\s*{/, 'props: {\n markdown: Boolean,') |
| | | // å¤ç䏿 id |
| | | .replace(/navigateTo\s*\(id,\s*offset\)\s*{/, 'navigateTo (id, offset) {\n id = this._ids[decodeURI(id)] || id')) |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | # search |
| | | åè½ï¼å
³é®è¯æç´¢ |
| | | 大å°ï¼*â1.5KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â(nvue 䏿¯æ) | |
| | | |
| | | 说æï¼ |
| | | å¼å
¥åä¼å¨ç»ä»¶å®ä¾ä¸æè½½ä¸ä¸ª *search* æ¹æ³ï¼ç¨äºå
³é®è¯æç´¢ |
| | | |
| | | è¾å
¥å¼ |
| | | |
| | | | åæ°å | ç±»å | é»è®¤å¼ | 说æ | |
| | | |:---:|:---:|:---:|---| |
| | | | key | String æ RegExp | - | è¦æç´¢çå
³é®è¯ï¼æ¯æåç¬¦ä¸²åæ£å | |
| | | | anchor | Boolean | false | æ¯å¦å°æç´¢ç»æè®¾ç½®ä¸ºéç¹ | |
| | | | style | String | background-color:yellow | æ è®°æç´¢ç»æçæ ·å¼ | |
| | | |
| | | è¿åå¼ï¼*Promise* |
| | | |
| | | | 屿§ | ç±»å | 说æ | |
| | | |:---:|:---:|---| |
| | | | num | Number | æç´¢ç»ææ°é | |
| | | | highlight | Function(i, style='background-color:#FF9632') | é«äº®ç¬¬ iï¼1 ~ numï¼ä¸ªç»æï¼å°å
¶æ ·å¼è®¾ç½®ä¸º style | |
| | | | jump | Function(i, offset) | 跳转å°ç¬¬ iï¼1 ~ numï¼ä¸ªç»æï¼åç§»é为 offsetï¼anchor 为 true æå¯ç¨ | |
| | | |
| | | 示ä¾ï¼ |
| | | ```javascript |
| | | function search (key) { |
| | | // ctx 为ç»ä»¶å®ä¾ |
| | | ctx.search(key, true).then(res => { |
| | | res.highlight(1) |
| | | res.jump(1, -50) // é«äº®ç¬¬ 1 ä¸ªç»æå¹¶è·³è½¬å°è¯¥ä½ç½®ï¼åç§»é -50 |
| | | }) |
| | | } |
| | | ``` |
| | | |
| | | éå 说æï¼ |
| | | 1. ä¸ä¼ å
¥ *key*ï¼æä¸ºç©ºï¼æ¶å³å¯åæ¶æç´¢ï¼åæ¶ææçé«äº®ï¼è¿åå°åæ¥çææ |
| | | 2. è¿è¡æ°çæç´¢æ¶æ§çæç´¢ç»æå°è¢«è¿åï¼æ§çç»æä¸ç *highlight* çæ¹æ³ä¸åå¯ç¨ |
| | | 3. è°ç¨ *highlight* æ¹æ³é«äº®ä¸ä¸ªç»ææ¶ï¼ä¹å被é«äº®çç»æä¼è¢«è¿åï¼å³å§ç»åªæä¸ä¸ªç»æè¢«é«äº® |
| | | 4. *key* ä¼ å
¥å符串æ¶å¤§å°åææï¼å¦æè¦å¿½ç¥å¤§å°åå¯ä»¥ç¨æ£åç *i*ï¼å符串æç´¢æçé«äºæ£åï¼ |
| | | 5. 设置 *anchor* 为 *true* ä¼ä¸å®ç¨åº¦ä¸é使çï¼éå¿
è¦ä¸è¦å¼å¯ |
| | | 6. æä¸æ¯æè·¨æ ç¾æç´¢ï¼å³åªæä¸ä¸ªææ¬èç¹å
å
嫿´ä¸ªå
³é®è¯æè½è¢«æç´¢å° |
New file |
| | |
| | | /** |
| | | * @fileoverview search æä»¶ |
| | | */ |
| | | |
| | | function Search (vm) { |
| | | /** |
| | | * @description å
³é®è¯æç´¢ |
| | | * @param {regexp|string} key è¦æç´¢çå
³é®è¯ |
| | | * @param {boolean} anchor æ¯å¦å°æç´¢ç»æè®¾ç½®ä¸ºéç¹ |
| | | * @param {string} style æç´¢ç»æçæ ·å¼ |
| | | */ |
| | | vm.search = function (key, anchor, style = 'background-color:yellow') { |
| | | const obj = {} |
| | | const stack = [] |
| | | const res = []; |
| | | |
| | | // éåæç´¢ |
| | | (function traversal (nodes, path) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | const node = nodes[i] |
| | | if (node.type === 'text' && key) { |
| | | const arr = node.text.split(key) |
| | | const children = [] |
| | | if (arr.length > 1) { |
| | | // æ¾å°å
³é®è¯ |
| | | for (let j = 0; j < arr.length; j++) { |
| | | if (arr[j]) { |
| | | children.push({ |
| | | type: 'text', |
| | | text: arr[j] |
| | | }) |
| | | } |
| | | if (j !== arr.length - 1) { |
| | | // å
³é®è¯è½¬ä¸ºä¸ä¸ª span |
| | | res.push(`${path}[${i}].children[${children.length}].attrs.style`) |
| | | children.push({ |
| | | name: 'span', |
| | | attrs: { |
| | | id: anchor ? 'search' + res.length : undefined, // ç¨äºéç¹ç id |
| | | style |
| | | }, |
| | | children: [{ |
| | | type: 'text', |
| | | text: key instanceof RegExp ? key.exec(node.text)[0] : key |
| | | }] |
| | | }) |
| | | } |
| | | } |
| | | if (key instanceof RegExp) { |
| | | key.exec(node.text) |
| | | } |
| | | if (anchor) { |
| | | for (let l = stack.length; l--;) { |
| | | // ç»ç¶ç»ä»¶åæ è®°ï¼å°è¯¥æ ç¾æ´é²åºæ¥ |
| | | if (stack[l].c) { |
| | | break |
| | | } else { |
| | | obj[stack[l].path] = 1 |
| | | } |
| | | } |
| | | } |
| | | obj[`${path}[${i}]`] = { |
| | | name: 'span', |
| | | c: anchor ? 1 : undefined, |
| | | s: 1, |
| | | children |
| | | } |
| | | } |
| | | } else if (node.s) { |
| | | let text = '' |
| | | // å¤åä¸ä¸æ¬¡çç»æ |
| | | for (let k = 0; k < node.children.length; k++) { |
| | | const child = node.children[k] |
| | | if (child.text) { |
| | | text += child.text |
| | | } else { |
| | | text += child.children[0].text |
| | | } |
| | | } |
| | | nodes[i] = { |
| | | type: 'text', |
| | | text |
| | | } |
| | | if (key && (key instanceof RegExp ? key.test(text) : text.includes(key))) { |
| | | i-- |
| | | } else { |
| | | obj[`${path}[${i}]`] = nodes[i] |
| | | } |
| | | } else if (node.children) { |
| | | stack.push({ |
| | | path: `${path}[${i}].c`, |
| | | c: node.c || node.name === 'table' |
| | | }) |
| | | traversal(node.children, `${path}[${i}].children`) |
| | | stack.pop() |
| | | } |
| | | } |
| | | })(vm.data.nodes, 'nodes') |
| | | |
| | | return new Promise(function (resolve) { |
| | | vm.setData(obj, () => { |
| | | resolve({ |
| | | num: res.length, // ç»ææ°é |
| | | /** |
| | | * @description é«äº®æä¸ä¸ªç»æ |
| | | * @param {number} i 第å 个 |
| | | * @param {string} hlstyle é«äº®çæ ·å¼ |
| | | */ |
| | | highlight (i, hlstyle = 'background-color:#FF9632') { |
| | | if (i < 1 || i > res.length) return |
| | | const obj = {} |
| | | if (this.last) { |
| | | obj[res[this.last - 1]] = style |
| | | } |
| | | this.last = i |
| | | obj[res[i - 1]] = hlstyle |
| | | vm.setData(obj) |
| | | }, |
| | | /** |
| | | * @description è·³è½¬å°æç´¢ç»æ |
| | | * @param {number} i 第å 个 |
| | | * @param {number} offset åç§»é |
| | | */ |
| | | jump: anchor |
| | | ? (i, offset) => { |
| | | if (i > 0 && i <= res.length) { |
| | | vm.navigateTo('search' + i, offset) |
| | | } |
| | | } |
| | | : undefined |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | module.exports = Search |
New file |
| | |
| | | /** |
| | | * @fileoverview search æä»¶ |
| | | */ |
| | | function Search (vm) { |
| | | /** |
| | | * @description å
³é®è¯æç´¢ |
| | | * @param {regexp|string} key è¦æç´¢çå
³é®è¯ |
| | | * @param {boolean} anchor æ¯å¦å°æç´¢ç»æè®¾ç½®ä¸ºéç¹ |
| | | * @param {string} style æç´¢ç»æçæ ·å¼ |
| | | */ |
| | | vm.search = function (key, anchor, style = 'background-color:yellow') { |
| | | const res = [] |
| | | const stack = []; |
| | | |
| | | // éåæç´¢ |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | let node = nodes[i] |
| | | if (node.type === 'text' && key) { |
| | | const text = node.text |
| | | const arr = text.split(key) |
| | | if (arr.length > 1) { |
| | | node = { |
| | | name: 'span', |
| | | attrs: {}, |
| | | type: 'node', |
| | | c: 1, |
| | | s: 1, |
| | | children: [] |
| | | } |
| | | vm.$set(nodes, i, node) |
| | | for (let j = 0; j < arr.length; j++) { |
| | | if (arr[j]) { |
| | | node.children.push({ |
| | | type: 'text', |
| | | text: arr[j] |
| | | }) |
| | | } |
| | | if (j !== arr.length - 1) { |
| | | // å
³é®è¯è½¬ä¸ºä¸ä¸ª span |
| | | node.children.push({ |
| | | name: 'span', |
| | | attrs: { |
| | | id: anchor ? 'search' + (res.length + 1) : undefined, // ç¨äºéç¹ç id |
| | | style: style |
| | | }, |
| | | // #ifdef VUE3 |
| | | c: 1, |
| | | // #endif |
| | | children: [{ |
| | | type: 'text', |
| | | text: key instanceof RegExp ? key.exec(text)[0] : key |
| | | }] |
| | | }) |
| | | res.push(node.children[node.children.length - 1].attrs) |
| | | } |
| | | } |
| | | if (key instanceof RegExp) { |
| | | key.exec(text) |
| | | } |
| | | if (anchor) { |
| | | for (let l = stack.length; l--;) { |
| | | if (stack[l].c) { |
| | | break |
| | | } else { |
| | | vm.$set(stack[l], 'c', 1) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else if (node.s) { |
| | | let text = '' |
| | | // å¤åä¸ä¸æ¬¡çç»æ |
| | | for (let k = 0; k < node.children.length; k++) { |
| | | const child = node.children[k] |
| | | if (child.text) { |
| | | text += child.text |
| | | } else { |
| | | text += child.children[0].text |
| | | } |
| | | } |
| | | vm.$set(nodes, i, { |
| | | type: 'text', |
| | | text |
| | | }) |
| | | if (key && (key instanceof RegExp ? key.test(text) : text.includes(key))) { |
| | | i-- |
| | | } |
| | | } else if (node.children) { |
| | | stack.push(node) |
| | | traversal(node.children) |
| | | stack.pop() |
| | | } |
| | | } |
| | | })(vm.nodes) |
| | | |
| | | return new Promise(function (resolve) { |
| | | setTimeout(() => { |
| | | resolve({ |
| | | num: res.length, // ç»ææ°é |
| | | /** |
| | | * @description é«äº®æä¸ä¸ªç»æ |
| | | * @param {number} i 第å 个 |
| | | * @param {string} hlstyle é«äº®çæ ·å¼ |
| | | */ |
| | | highlight (i, hlstyle = 'background-color:#FF9632') { |
| | | if (i < 1 || i > res.length) return |
| | | if (this.last) { |
| | | res[this.last - 1].style = style |
| | | } |
| | | this.last = i |
| | | res[i - 1].style = hlstyle |
| | | }, |
| | | /** |
| | | * @description è·³è½¬å°æç´¢ç»æ |
| | | * @param {number} i 第å 个 |
| | | * @param {number} offset åç§»é |
| | | */ |
| | | jump: anchor |
| | | ? (i, offset) => { |
| | | if (i > 0 && i <= res.length) { |
| | | vm.navigateTo('search' + i, offset) |
| | | } |
| | | } |
| | | : undefined |
| | | }) |
| | | }, 200) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | module.exports = Search |
New file |
| | |
| | | # style |
| | | åè½ï¼è§£æåå¹é
*style* æ ç¾ä¸çæ ·å¼ |
| | | |
| | | > è¿éç *style* æ ç¾æçæ¯ä¼ å
¥ *content* 屿§ä¸ç *html* éå
å«ç *style* æ ç¾ï¼ä¸ *style* æ ç¾è¦æ¾å¨å
¶ä»æ ç¾å颿è½çæ |
| | | |
| | | 大å°ï¼*â3.5KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | â | â | â | â (nvue ç´æ¥æ¯æ) | |
| | | |
| | | 说æï¼ |
| | | æ¯æä»¥ä¸éæ©å¨ï¼ |
| | | |
| | | | åç§° | ç¤ºä¾ | |
| | | |:---:|---| |
| | | | æ ç¾åéæ©å¨ | p {} | |
| | | | class éæ©å¨ | .class {} | |
| | | | id éæ©å¨ | #id {} | |
| | | | å¤éæ©å¨äº¤é | p.class {} | |
| | | | å¤éæ©å¨å¹¶é | p, .class {} | |
| | | | åä»£éæ©å¨ | .class1 .class2 {} | |
| | | | åéæ©å¨ | .class1 > .class2 {} | |
| | | | 伪类 | .class::before {} | |
| | | |
| | | 伪类ä»
æ¯æ *before* å *after*ï¼æ¯æ *attr* æ¹æ³ |
| | | 䏿¯æçéæ©å¨ï¼å±æ§éæ©å¨çï¼å°è¢«å¿½ç¥ |
| | | |
| | | > ç±äºå°ç¨åºä¸æ æ³å¨æåå
¥ *css*ï¼æ¬æä»¶çå®ç°åçæ¯éè¿è§£æï¼å°å¹é
çæ ·å¼æ·»å å°åæ ç¾çè¡å
*style* ä¸å»ï¼è¯·æ
ç¨å®½æ³çéæ©å¨ï¼ä»¥å
大大å¢å è§£æç»æå¤§å°ï¼åæ
¢æ¸²æé度 |
New file |
| | |
| | | /** |
| | | * @fileoverview style æä»¶ |
| | | */ |
| | | // #ifndef APP-PLUS-NVUE |
| | | const Parser = require('./parser') |
| | | // #endif |
| | | |
| | | function Style () { |
| | | this.styles = [] |
| | | } |
| | | |
| | | // #ifndef APP-PLUS-NVUE |
| | | Style.prototype.onParse = function (node, vm) { |
| | | // è·åæ ·å¼ |
| | | if (node.name === 'style' && node.children.length && node.children[0].type === 'text') { |
| | | this.styles = this.styles.concat(new Parser().parse(node.children[0].text)) |
| | | } else if (node.name) { |
| | | // å¹é
æ ·å¼ï¼å¯¹éææ¬æ ç¾ï¼ |
| | | // åå¨ä¸åä¼å
çº§çæ ·å¼ name < class < id < å代 |
| | | let matched = ['', '', '', ''] |
| | | for (let i = 0, len = this.styles.length; i < len; i++) { |
| | | const item = this.styles[i] |
| | | let res = match(node, item.key || item.list[item.list.length - 1]) |
| | | let j |
| | | if (res) { |
| | | // åä»£éæ©å¨ |
| | | if (!item.key) { |
| | | j = item.list.length - 2 |
| | | for (let k = vm.stack.length; j >= 0 && k--;) { |
| | | // åéæ©å¨ |
| | | if (item.list[j] === '>') { |
| | | // é误æ
åµ |
| | | if (j < 1 || j > item.list.length - 2) break |
| | | if (match(vm.stack[k], item.list[j - 1])) { |
| | | j -= 2 |
| | | } else { |
| | | j++ |
| | | } |
| | | } else if (match(vm.stack[k], item.list[j])) { |
| | | j-- |
| | | } |
| | | } |
| | | res = 4 |
| | | } |
| | | if (item.key || j < 0) { |
| | | // æ·»å 伪类 |
| | | if (item.pseudo && node.children) { |
| | | let text |
| | | item.style = item.style.replace(/content:([^;]+)/, (_, $1) => { |
| | | text = $1.replace(/['"]/g, '') |
| | | // å¤ç attr 彿° |
| | | .replace(/attr\((.+?)\)/, (_, $1) => node.attrs[$1.trim()] || '') |
| | | // ç¼ç \xxx |
| | | .replace(/\\(\w{4})/, (_, $1) => String.fromCharCode(parseInt($1, 16))) |
| | | return '' |
| | | }) |
| | | const pseudo = { |
| | | name: 'span', |
| | | attrs: { |
| | | style: item.style |
| | | }, |
| | | children: [{ |
| | | type: 'text', |
| | | text |
| | | }] |
| | | } |
| | | if (item.pseudo === 'before') { |
| | | node.children.unshift(pseudo) |
| | | } else { |
| | | node.children.push(pseudo) |
| | | } |
| | | } else { |
| | | matched[res - 1] += item.style + (item.style[item.style.length - 1] === ';' ? '' : ';') |
| | | } |
| | | } |
| | | } |
| | | } |
| | | matched = matched.join('') |
| | | if (matched.length > 2) { |
| | | node.attrs.style = matched + (node.attrs.style || '') |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description å¹é
æ ·å¼ |
| | | * @param {object} node è¦å¹é
çæ ç¾ |
| | | * @param {string|string[]} keys éæ©å¨ |
| | | * @returns {number} 0ï¼ä¸å¹é
ï¼1ï¼name å¹é
ï¼2ï¼class å¹é
ï¼3ï¼id å¹é
|
| | | */ |
| | | function match (node, keys) { |
| | | function matchItem (key) { |
| | | if (key[0] === '#') { |
| | | // å¹é
id |
| | | if (node.attrs.id && node.attrs.id.trim() === key.substr(1)) return 3 |
| | | } else if (key[0] === '.') { |
| | | // å¹é
class |
| | | key = key.substr(1) |
| | | const selectors = (node.attrs.class || '').split(' ') |
| | | for (let i = 0; i < selectors.length; i++) { |
| | | if (selectors[i].trim() === key) return 2 |
| | | } |
| | | } else if (node.name === key) { |
| | | // å¹é
name |
| | | return 1 |
| | | } |
| | | return 0 |
| | | } |
| | | |
| | | // å¤éæ©å¨äº¤é |
| | | if (keys instanceof Array) { |
| | | let res = 0 |
| | | for (let j = 0; j < keys.length; j++) { |
| | | const tmp = matchItem(keys[j]) |
| | | // ä»»æä¸ä¸ªä¸å¹é
就失败 |
| | | if (!tmp) return 0 |
| | | // ä¼å
级æå¤§çä¸ä¸ªä½ä¸ºæç»ä¼å
级 |
| | | if (tmp > res) { |
| | | res = tmp |
| | | } |
| | | } |
| | | return res |
| | | } |
| | | |
| | | return matchItem(keys) |
| | | } |
| | | // #endif |
| | | |
| | | module.exports = Style |
New file |
| | |
| | | const blank = { |
| | | ' ': true, |
| | | '\n': true, |
| | | '\t': true, |
| | | '\r': true, |
| | | '\f': true |
| | | } |
| | | |
| | | function Parser () { |
| | | this.styles = [] |
| | | this.selectors = [] |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æ css å符串 |
| | | * @param {string} content css å
容 |
| | | */ |
| | | Parser.prototype.parse = function (content) { |
| | | new Lexer(this).parse(content) |
| | | return this.styles |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°ä¸ä¸ªéæ©å¨ |
| | | * @param {string} name åç§° |
| | | */ |
| | | Parser.prototype.onSelector = function (name) { |
| | | // 䏿¯æçéæ©å¨ |
| | | if (name.includes('[') || name.includes('*') || name.includes('@')) return |
| | | const selector = {} |
| | | // 伪类 |
| | | if (name.includes(':')) { |
| | | const info = name.split(':') |
| | | const pseudo = info.pop() |
| | | if (pseudo === 'before' || pseudo === 'after') { |
| | | selector.pseudo = pseudo |
| | | name = info[0] |
| | | } else return |
| | | } |
| | | |
| | | // åå²äº¤ééæ©å¨ |
| | | function splitItem (str) { |
| | | const arr = [] |
| | | let i, start |
| | | for (i = 1, start = 0; i < str.length; i++) { |
| | | if (str[i] === '.' || str[i] === '#') { |
| | | arr.push(str.substring(start, i)) |
| | | start = i |
| | | } |
| | | } |
| | | if (!arr.length) { |
| | | return str |
| | | } else { |
| | | arr.push(str.substring(start, i)) |
| | | return arr |
| | | } |
| | | } |
| | | |
| | | // åä»£éæ©å¨ |
| | | if (name.includes(' ')) { |
| | | selector.list = [] |
| | | const list = name.split(' ') |
| | | for (let i = 0; i < list.length; i++) { |
| | | if (list[i].length) { |
| | | // æååéæ©å¨ |
| | | const arr = list[i].split('>') |
| | | for (let j = 0; j < arr.length; j++) { |
| | | selector.list.push(splitItem(arr[j])) |
| | | if (j < arr.length - 1) { |
| | | selector.list.push('>') |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | selector.key = splitItem(name) |
| | | } |
| | | |
| | | this.selectors.push(selector) |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°éæ©å¨å
容 |
| | | * @param {string} content å
容 |
| | | */ |
| | | Parser.prototype.onContent = function (content) { |
| | | // å¹¶ééæ©å¨ |
| | | for (let i = 0; i < this.selectors.length; i++) { |
| | | this.selectors[i].style = content |
| | | } |
| | | this.styles = this.styles.concat(this.selectors) |
| | | this.selectors = [] |
| | | } |
| | | |
| | | /** |
| | | * @description css è¯æ³åæå¨ |
| | | * @param {object} handler é«å±å¤çå¨ |
| | | */ |
| | | function Lexer (handler) { |
| | | this.selector = '' |
| | | this.style = '' |
| | | this.handler = handler |
| | | } |
| | | |
| | | Lexer.prototype.parse = function (content) { |
| | | this.i = 0 |
| | | this.content = content |
| | | this.state = this.blank |
| | | for (let len = content.length; this.i < len; this.i++) { |
| | | this.state(content[this.i]) |
| | | } |
| | | } |
| | | |
| | | Lexer.prototype.comment = function () { |
| | | this.i = this.content.indexOf('*/', this.i) + 1 |
| | | if (!this.i) { |
| | | this.i = this.content.length |
| | | } |
| | | } |
| | | |
| | | Lexer.prototype.blank = function (c) { |
| | | if (!blank[c]) { |
| | | if (c === '/' && this.content[this.i + 1] === '*') { |
| | | this.comment() |
| | | return |
| | | } |
| | | this.selector += c |
| | | this.state = this.name |
| | | } |
| | | } |
| | | |
| | | Lexer.prototype.name = function (c) { |
| | | if (c === '/' && this.content[this.i + 1] === '*') { |
| | | this.comment() |
| | | return |
| | | } |
| | | if (c === '{' || c === ',' || c === ';') { |
| | | this.handler.onSelector(this.selector.trimEnd()) |
| | | this.selector = '' |
| | | if (c !== '{') { |
| | | while (blank[this.content[++this.i]]); |
| | | } |
| | | if (this.content[this.i] === '{') { |
| | | this.floor = 1 |
| | | this.state = this.val |
| | | } else { |
| | | this.selector += this.content[this.i] |
| | | } |
| | | } else if (blank[c]) { |
| | | this.selector += ' ' |
| | | } else { |
| | | this.selector += c |
| | | } |
| | | } |
| | | |
| | | Lexer.prototype.val = function (c) { |
| | | if (c === '/' && this.content[this.i + 1] === '*') { |
| | | this.comment() |
| | | return |
| | | } |
| | | if (c === '{') { |
| | | this.floor++ |
| | | } else if (c === '}') { |
| | | this.floor-- |
| | | if (!this.floor) { |
| | | this.handler.onContent(this.style) |
| | | this.style = '' |
| | | this.state = this.blank |
| | | return |
| | | } |
| | | } |
| | | this.style += c |
| | | } |
| | | |
| | | module.exports = Parser |
New file |
| | |
| | | # æ¨¡æ¿ |
| | | è¿æ¯ä¸ä¸ªæä»¶æ¨¡æ¿ï¼éè¦å¼åæä»¶æ¶ï¼å¯ä»¥ä»è¿ä¸ªæ¨¡æ¿å¼å§ |
New file |
| | |
| | | /** |
| | | * @description æä»¶æå»ºæä»¶æ¨¡æ¿ |
| | | */ |
| | | |
| | | module.exports = { |
| | | /** |
| | | * @description å
¥å£æä»¶ |
| | | * @type {String} |
| | | * @default 'index.js' |
| | | */ |
| | | main: 'index.js', |
| | | /** |
| | | * @description æ¯æçå¹³å° |
| | | * @type {String[]} |
| | | * @default ['mp-weixin','mp-qq','mp-baidu','mp-alipay','mp-toutiao','uni-app'] |
| | | */ |
| | | platform: ['mp-weixin', 'mp-qq', 'mp-baidu', 'mp-alipay', 'mp-toutiao', 'uni-app'], |
| | | /** |
| | | * @description è¦è¢«æ·»å å°æ¨¡æ¿æä»¶ä¸çæ ç¾ï¼å°è¢«æ·»å å° src/node/node.wxmlï¼ |
| | | * å¿
é¡»è¦æ wx:if 表æä»ä¹æ
åµä¸ä½¿ç¨è¯¥æ ç¾ |
| | | * n 表示æ ç¾ç»æä½ï¼<node> æ ç¾ç¨äºé彿¾ç¤ºåèç¹ï¼å¯åèæºæä»¶ä¸çåæ³ï¼ |
| | | * @type {String} |
| | | */ |
| | | template: '', |
| | | /** |
| | | * @description ç¨äºå¤ç模æ¿ä¸äºä»¶çæ¹æ³ï¼å°è¢«æ·»å å° src/node/node.jsï¼ |
| | | * éè¦è§¦åé¡¶å±ç»ä»¶çäºä»¶è¯·ä½¿ç¨ this.root.triggerEvent |
| | | * @type {Object} |
| | | */ |
| | | methods: { |
| | | |
| | | }, |
| | | /** |
| | | * @description ç¨äºæ¨¡æ¿æä»¶ç css æ ·å¼ï¼å°è¢«æ·»å å° src/node/node.wxssï¼ |
| | | * @type {String} |
| | | */ |
| | | style: '', |
| | | /** |
| | | * @description è¦è¢«å¼å
¥å°æ¨¡æ¿æä»¶ç css æä»¶è·¯å¾ï¼å°è¢«æ·»å å° src/node/node.wxssï¼ |
| | | * @type {String|String[]} |
| | | */ |
| | | import: [], |
| | | /** |
| | | * @description 卿¨¡æ¿ä¸éè¦ä½¿ç¨çç»ä»¶ææä»¶å表ï¼å°è¢«æ·»å å° src/node/node.jsonï¼ |
| | | * @type {Object} |
| | | */ |
| | | usingComponents: { |
| | | |
| | | }, |
| | | /** |
| | | * @description èªå®ä¹æä»¶å¤çå¨ |
| | | * 妿ä¸è¿°å¤çè¿æ æ³æ»¡è¶³è¦æ±ï¼å¯ä»¥å¨æ¤æ¹æ³ä¸è¿è¡å¤ç |
| | | * ææ src ç®å½ä¸çæä»¶åæ¬æä»¶ç®å½ä¸çæä»¶é½ä¼ç»è¿æ¤æ¹æ³çå¤ç |
| | | * @param {Vinyl} file å
³äºè¯¥æä»¶å¯¹è±¡çæ ¼å¼å¯åè https://github.com/gulpjs/vinyl#instance-methods |
| | | * @param {String} platform å¹³å° |
| | | */ |
| | | handler (file, platform) { |
| | | let content = file.contents.toString() |
| | | // è¿è¡å¤ç |
| | | if (platform === 'xxx') { |
| | | content = content.replace('aaa', 'bbb') |
| | | } |
| | | file.contents = Buffer.from(content) |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * @fileoverview æä»¶å
¥å£æä»¶æ¨¡æ¿ |
| | | */ |
| | | |
| | | const data = {} // å
¨å±æ°æ® |
| | | |
| | | /** |
| | | * @description ç»ä»¶è¢«å建æ¶å°å®ä¾åæä»¶ |
| | | * @param {Component} vm ç»ä»¶å®ä¾ |
| | | */ |
| | | function Plugin (vm) { |
| | | this.vm = vm // ä¿åå®ä¾å¨å
¶ä»å¨æä½¿ç¨ |
| | | this.compData = {} // ä»
å¨å个ç»ä»¶ä¸ä½¿ç¨çæ°æ® |
| | | data.xxx = 'xxx' // è®°å½å
¨å±æ°æ® |
| | | } |
| | | |
| | | /** |
| | | * @description html æ°æ®æ´æ°æ¶è§¦å |
| | | * @param {string} content è¦æ´æ°ç html å符串 |
| | | * @param {object} config è§£æé
ç½® |
| | | * @returns {string|void} 妿è¦å¯¹ html å符串è¿è¡ä¸äºé¢å¤çï¼åè¿åå¤çåçå符串 |
| | | */ |
| | | Plugin.prototype.onUpdate = function (content, config) { |
| | | config.ignoreTags.xxx = true // ç§»é¤ xxx æ ç¾ |
| | | // 对 html å
容è¿è¡é¢å¤çå¹¶è¿åä¿®æ¹ï¼æ²¡æä¿®æ¹åä¸éè¦è¿å |
| | | return content |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°ä¸ä¸ªæ ç¾æ¶è§¦å |
| | | * @param {object} node æ ç¾ |
| | | * @param {object} parser è§£æå¨å®ä¾ |
| | | * @returns {boolean|void} 妿è¿å false å°ç§»é¤è¯¥æ ç¾ |
| | | */ |
| | | Plugin.prototype.onParse = function (node, parser) { |
| | | // å¤çææ¬æ ç¾ |
| | | if (node.type === 'text') { |
| | | // node.text ææ¬å
容 |
| | | } else { |
| | | // å¤çå
ç´ æ ç¾ |
| | | // node.name æ ç¾å |
| | | // node.attrs 屿§å表 |
| | | // node.children åèç¹ï¼éèªéåæ ç¾æï¼ |
| | | |
| | | if (node.name === 'xxx') { |
| | | parser.expose() // å¦æè¯¥æ ç¾ä¸è½è¢« rich-text å
å«ï¼éè¦è°ç¨æ¤æ¹æ³æ´é²åºæ¥ |
| | | // parser.options ç»ä»¶ä¼ å
¥çä¸äºè§£æå±æ§ |
| | | // parser.stack å¯ä»¥ä»æ ä¸è·åç¥å
èç¹ |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description dom æ å è½½å®æ¯æ¶è§¦åï¼load äºä»¶ï¼ |
| | | */ |
| | | Plugin.prototype.onLoad = function () { |
| | | // å¯ä»¥è·ååªä½ context 对象ç |
| | | } |
| | | |
| | | /** |
| | | * @description ç»ä»¶è¢«ç§»é¤æ¶è§¦å |
| | | */ |
| | | Plugin.prototype.onDetached = function () { |
| | | // å¯ä»¥éæ¾ä¸äºå¿
è¦çèµæºï¼è®¡æ¶å¨çï¼ |
| | | } |
| | | |
| | | module.exports = Plugin |
New file |
| | |
| | | # txv-video |
| | | åè½ï¼ä½¿ç¨è
¾è®¯è§é¢ |
| | | 大å°ï¼*â1KB* |
| | | æ¯æå¹³å°ï¼ |
| | | |
| | | | 微信å°ç¨åº | QQ å°ç¨åº | ç¾åº¦å°ç¨åº | æ¯ä»å®å°ç¨åº | 头æ¡å°ç¨åº | uni-app | |
| | | |:---:|:---:|:---:|:---:|:---:|:---:| |
| | | | â | â | | | | â (h5 å app ç´æ¥æ¯æ) | |
| | | |
| | | 说æï¼ |
| | | å¼å
¥æ¬æä»¶åï¼*html* ä¸ç¬¦å䏿¹æ ¼å¼ç *iframe* æ ç¾ï¼*src* ä¸å«æ *vid*ï¼å°è¢«è½¬ä¸ºéè¿è
¾è®¯è§é¢ææ¾ï¼ |
| | | ```html |
| | | <iframe src="https://v.qq.com/txp/iframe/player.html?vid=xxxxxx" allowFullScreen="true"></iframe> |
| | | ``` |
| | | |
| | | åæ¶ï¼å
¶å¯ä»¥è¢« *pause-video* 屿§æ§å¶ |
| | | |
| | | !> æ¬æä»¶ä»
ç¨äºå°å®æ¹ [è
¾è®¯è§é¢æä»¶](https://github.com/tvfe/txv-miniprogram-plugin) åºç¨äºæ¬ç»ä»¶ï¼ä»
å¨å¾®ä¿¡å *qq* 平尿æï¼ä½¿ç¨åè¯·ç¡®è®¤å·²ç»æåç³è¯·ä½¿ç¨è¯¥æä»¶å¹¶æè¦æ±å¨å°ç¨åº *app.json* ä¸é
ç½®å®æï¼å¦åå¯è½æ¥é **This application has not registered any plugins yet** 䏿 æ³çæ |
New file |
| | |
| | | module.exports = { |
| | | platform: ['mp-weixin', 'mp-qq', 'uni-app'] |
| | | } |
New file |
| | |
| | | /** |
| | | * @fileoverview txv-video æä»¶ |
| | | * Include txv-video (https://github.com/tvfe/txv-miniprogram-plugin) |
| | | */ |
| | | const TxvVideo = function (vm) { |
| | | this.vm = vm |
| | | } |
| | | |
| | | // #ifdef MP-WEIXIN || MP-QQ |
| | | try { |
| | | const TxvContext = requirePlugin('tencentvideo') |
| | | |
| | | TxvVideo.prototype.onLoad = function () { |
| | | setTimeout(() => { |
| | | for (let i = 0; i < this.videos.length; i++) { |
| | | const ctx = TxvContext.getTxvContext(this.videos[i]) |
| | | ctx.id = this.videos[i] |
| | | this.vm._videos.push(ctx) |
| | | } |
| | | }, 50) |
| | | } |
| | | } catch (e) { |
| | | console.error('使ç¨txv-videoæ©å±é注åè
¾è®¯è§é¢æä»¶') |
| | | } |
| | | |
| | | TxvVideo.prototype.onUpdate = function (_, config) { |
| | | config.trustTags['txv-video'] = true |
| | | this.videos = [] |
| | | } |
| | | |
| | | TxvVideo.prototype.onParse = function (node, parser) { |
| | | if (node.name === 'iframe' && (node.attrs.src || '').includes('vid')) { |
| | | const vid = node.attrs.src.match(/vid=([^&\s]+)/) |
| | | if (vid) { |
| | | node.name = 'txv-video' |
| | | node.attrs.vid = vid[1] |
| | | this.videos.push(vid[1]) |
| | | node.attrs.src = undefined |
| | | parser.expose() |
| | | } |
| | | } |
| | | } |
| | | |
| | | // #endif |
| | | |
| | | module.exports = TxvVideo |
New file |
| | |
| | | module.exports = { |
| | | template: '<txv-video wx:if="{{n.name==\'txv-video\'}}" vid="{{n.attrs.vid}}" playerid="{{n.attrs.vid}}" id="{{n.attrs.vid}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" controls data-i="{{i}}" bindplay="play" binderror="mediaError" />', |
| | | usingComponents: { |
| | | 'txv-video': 'plugin://tencentvideo/video' |
| | | } |
| | | } |
New file |
| | |
| | | module.exports = { |
| | | template: '<txv-video v-if="n.name==\'txv-video\'" :vid="n.attrs.vid" :playerid="n.attrs.vid" :id="n.attrs.vid" :class="n.attrs.class" :style="n.attrs.style" controls :data-i="i" @play="play" @error="mediaError" />' |
| | | } |
New file |
| | |
| | | /*! |
| | | * mp-html v2.5.1 |
| | | * https://github.com/jin-yufeng/mp-html |
| | | * |
| | | * Released under the MIT license |
| | | * Author: Jin Yufeng |
| | | */ |
| | | const Parser = require('./parser') |
| | | const plugins = [] |
| | | |
| | | Component({ |
| | | data: { |
| | | nodes: [] |
| | | }, |
| | | properties: { |
| | | /** |
| | | * @description 容å¨çæ ·å¼ |
| | | * @type {String} |
| | | */ |
| | | containerStyle: String, |
| | | |
| | | /** |
| | | * @description ç¨äºæ¸²æç html å符串 |
| | | * @type {String} |
| | | */ |
| | | content: { |
| | | type: String, |
| | | value: '', |
| | | observer (content) { |
| | | this.setContent(content) |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description æ¯å¦å
许å¤é¨é¾æ¥è¢«ç¹å»æ¶èªå¨å¤å¶ |
| | | * @type {Boolean} |
| | | * @default true |
| | | */ |
| | | copyLink: { |
| | | type: Boolean, |
| | | value: true |
| | | }, |
| | | |
| | | /** |
| | | * @description 主ååï¼ç¨äºæ¼æ¥é¾æ¥ |
| | | * @type {String} |
| | | */ |
| | | domain: String, |
| | | |
| | | /** |
| | | * @description å¾çåºéæ¶çå ä½å¾é¾æ¥ |
| | | * @type {String} |
| | | */ |
| | | errorImg: String, |
| | | |
| | | /** |
| | | * @description æ¯å¦å¼å¯å¾çæå è½½ |
| | | * @type {Boolean} |
| | | * @default false |
| | | */ |
| | | lazyLoad: Boolean, |
| | | |
| | | /** |
| | | * @description å¾çå è½½è¿ç¨ä¸çå ä½å¾é¾æ¥ |
| | | * @type {String} |
| | | */ |
| | | loadingImg: String, |
| | | |
| | | /** |
| | | * @description æ¯å¦å¨ææ¾ä¸ä¸ªè§é¢æ¶èªå¨æåå
¶ä»è§é¢ |
| | | * @type {Boolean} |
| | | * @default true |
| | | */ |
| | | pauseVideo: { |
| | | type: Boolean, |
| | | value: true |
| | | }, |
| | | |
| | | /** |
| | | * @description æ¯å¦å
许å¾ç被ç¹å»æ¶èªå¨é¢è§ |
| | | * @type {Boolean | String} |
| | | * @default true |
| | | */ |
| | | previewImg: { |
| | | type: null, |
| | | value: true |
| | | }, |
| | | |
| | | /** |
| | | * @description æ¯å¦ç»æ¯ä¸ªè¡¨æ ¼æ·»å ä¸ä¸ªæ»å¨å±ä½¿å
¶è½åç¬æ¨ªåæ»å¨ |
| | | * @type {Boolean} |
| | | * @default false |
| | | */ |
| | | scrollTable: Boolean, |
| | | |
| | | /** |
| | | * @description æ¯å¦å¼å¯é¿æå¤å¶ |
| | | * @type {Boolean | String} |
| | | * @default false |
| | | */ |
| | | selectable: null, |
| | | |
| | | /** |
| | | * @description æ¯å¦å° title æ ç¾çå
容设置å°é¡µé¢æ é¢ |
| | | * @type {Boolean} |
| | | * @default true |
| | | */ |
| | | setTitle: { |
| | | type: Boolean, |
| | | value: true |
| | | }, |
| | | |
| | | /** |
| | | * @description æ¯å¦å
许å¾çè¢«é¿ææ¶æ¾ç¤ºèå |
| | | * @type {Boolean} |
| | | * @default true |
| | | */ |
| | | showImgMenu: { |
| | | type: Boolean, |
| | | value: true |
| | | }, |
| | | |
| | | /** |
| | | * @description æ ç¾çé»è®¤æ ·å¼ |
| | | * @type {Object} |
| | | */ |
| | | tagStyle: Object, |
| | | |
| | | /** |
| | | * @description æ¯å¦ä½¿ç¨éç¹é¾æ¥ |
| | | * @type {Boolean | Number} |
| | | * @default false |
| | | */ |
| | | useAnchor: null |
| | | }, |
| | | |
| | | created () { |
| | | this.plugins = [] |
| | | for (let i = plugins.length; i--;) { |
| | | this.plugins.push(new plugins[i](this)) |
| | | } |
| | | |
| | | // #ifdef MP-ALIPAY |
| | | if (this.properties.content) { |
| | | this.setContent(this.properties.content) |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | // #ifdef MP-ALIPAY |
| | | didUpdate (e) { |
| | | if (e.content !== this.properties.content) { |
| | | this.setContent(this.properties.content) |
| | | } |
| | | }, |
| | | // #endif |
| | | |
| | | detached () { |
| | | // 注éæä»¶ |
| | | this._hook('onDetached') |
| | | }, |
| | | |
| | | methods: { |
| | | /** |
| | | * @description å°éç¹è·³è½¬çèå´éå®å¨ä¸ä¸ª scroll-view å
|
| | | * @param {Object} page scroll-view æå¨é¡µé¢çç¤ºä¾ |
| | | * @param {String} selector scroll-view çéæ©å¨ |
| | | * @param {String} scrollTop scroll-view scroll-top 屿§ç»å®çåéå |
| | | */ |
| | | in (page, selector, scrollTop) { |
| | | if (page && selector && scrollTop) { |
| | | this._in = { |
| | | page, |
| | | selector, |
| | | scrollTop |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description éç¹è·³è½¬ |
| | | * @param {String} id è¦è·³è½¬çéç¹ id |
| | | * @param {Number} offset 跳转ä½ç½®çåç§»é |
| | | * @returns {Promise} |
| | | */ |
| | | navigateTo (id, offset) { |
| | | return new Promise((resolve, reject) => { |
| | | if (!this.properties.useAnchor) { |
| | | reject(Error('Anchor is disabled')) |
| | | return |
| | | } |
| | | // è·¨ç»ä»¶éæ©å¨ |
| | | const deep = |
| | | // #ifdef MP-WEIXIN || MP-QQ || MP-TOUTIAO |
| | | '>>>' |
| | | // #endif |
| | | // #ifdef MP-BAIDU || MP-ALIPAY |
| | | ' ' // eslint-disable-line |
| | | // #endif |
| | | const selector = wx.createSelectorQuery() |
| | | // #ifndef MP-ALIPAY |
| | | .in(this._in ? this._in.page : this) |
| | | // #endif |
| | | .select((this._in ? this._in.selector : '._root') + (id ? `${deep}#${id}` : '')).boundingClientRect() |
| | | if (this._in) { |
| | | selector.select(this._in.selector).scrollOffset() |
| | | .select(this._in.selector).boundingClientRect() |
| | | } else { |
| | | // è·å scroll-view çä½ç½®åæ»å¨è·ç¦» |
| | | selector.selectViewport().scrollOffset() // è·åçªå£çæ»å¨è·ç¦» |
| | | } |
| | | selector.exec(res => { |
| | | if (!res[0]) { |
| | | reject(Error('Label not found')) |
| | | return |
| | | } |
| | | const scrollTop = res[1].scrollTop + res[0].top - (res[2] ? res[2].top : 0) + (offset || parseInt(this.properties.useAnchor) || 0) |
| | | if (this._in) { |
| | | // scroll-view 跳转 |
| | | this._in.page.setData({ |
| | | [this._in.scrollTop]: scrollTop |
| | | }) |
| | | } else { |
| | | // 页é¢è·³è½¬ |
| | | wx.pageScrollTo({ |
| | | scrollTop, |
| | | duration: 300 |
| | | }) |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * @description è·åææ¬å
容 |
| | | * @returns {String} |
| | | */ |
| | | getText (nodes) { |
| | | let text = ''; |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | const node = nodes[i] |
| | | if (node.type === 'text') { |
| | | text += node.text.replace(/&/g, '&') |
| | | } else if (node.name === 'br') { |
| | | text += '\n' |
| | | } else { |
| | | // å级æ ç¾ååå æ¢è¡ |
| | | const isBlock = node.name === 'p' || node.name === 'div' || node.name === 'tr' || node.name === 'li' || (node.name[0] === 'h' && node.name[1] > '0' && node.name[1] < '7') |
| | | if (isBlock && text && text[text.length - 1] !== '\n') { |
| | | text += '\n' |
| | | } |
| | | // éå½è·ååèç¹çææ¬ |
| | | if (node.children) { |
| | | traversal(node.children) |
| | | } |
| | | if (isBlock && text[text.length - 1] !== '\n') { |
| | | text += '\n' |
| | | } else if (node.name === 'td' || node.name === 'th') { |
| | | text += '\t' |
| | | } |
| | | } |
| | | } |
| | | })(nodes || this.data.nodes) |
| | | return text |
| | | }, |
| | | |
| | | /** |
| | | * @description è·åå
å®¹å¤§å° |
| | | * @returns {Promise} |
| | | */ |
| | | getRect () { |
| | | return new Promise((resolve, reject) => { |
| | | wx.createSelectorQuery() |
| | | // #ifndef MP-ALIPAY |
| | | .in(this) |
| | | // #endif |
| | | .select('._root').boundingClientRect().exec(res => res[0] ? resolve(res[0]) : reject(Error('Root label not found'))) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * @description æåææ¾åªä½ |
| | | */ |
| | | pauseMedia () { |
| | | for (let i = (this._videos || []).length; i--;) { |
| | | this._videos[i].pause() |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description 设置åªä½ææ¾éç |
| | | * @param {Number} rate ææ¾éç |
| | | */ |
| | | setPlaybackRate (rate) { |
| | | this.playbackRate = rate |
| | | for (let i = (this._videos || []).length; i--;) { |
| | | this._videos[i].playbackRate(rate) |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description è®¾ç½®å¯ææ¬å
容 |
| | | * @param {string} content è¦æ¸²æç html å符串 |
| | | * @param {boolean} append æ¯å¦å¨å°¾é¨è¿½å |
| | | */ |
| | | setContent (content, append) { |
| | | if (!this.imgList || !append) { |
| | | this.imgList = [] |
| | | } |
| | | this._videos = [] |
| | | |
| | | const data = {} |
| | | const nodes = new Parser(this).parse(content) |
| | | // å°¾é¨è¿½å å
容 |
| | | if (append) { |
| | | for (let i = this.data.nodes.length, j = nodes.length; j--;) { |
| | | data[`nodes[${i + j}]`] = nodes[j] |
| | | } |
| | | } else { |
| | | data.nodes = nodes |
| | | } |
| | | |
| | | this.setData(data, |
| | | // #ifndef MP-TOUTIAO |
| | | () => { |
| | | this._hook('onLoad') |
| | | this.triggerEvent('load') |
| | | } |
| | | // #endif |
| | | ) |
| | | |
| | | // #ifdef MP-TOUTIAO |
| | | this.selectComponent('#_root', child => { |
| | | child.root = this |
| | | this._hook('onLoad') |
| | | this.triggerEvent('load') |
| | | }) |
| | | // #endif |
| | | |
| | | if (this.properties.lazyLoad || this.imgList._unloadimgs < this.imgList.length / 2) { |
| | | // 设置æå è½½ï¼æ¯ 350ms è·åé«åº¦ï¼ä¸åå认为å è½½å®æ¯ |
| | | let height = 0 |
| | | const callback = rect => { |
| | | if (!rect || !rect.height) rect = {} |
| | | // 350ms æ»é«åº¦æ åå就触å ready äºä»¶ |
| | | if (rect.height === height) { |
| | | this.triggerEvent('ready', rect) |
| | | } else { |
| | | height = rect.height |
| | | setTimeout(() => { |
| | | this.getRect().then(callback).catch(callback) |
| | | }, 350) |
| | | } |
| | | } |
| | | this.getRect().then(callback).catch(callback) |
| | | } else { |
| | | // æªè®¾ç½®æå è½½ï¼çå¾
ææå¾çå è½½å®æ¯ |
| | | if (!this.imgList._unloadimgs) { |
| | | this.getRect().then(rect => { |
| | | this.triggerEvent('ready', rect) |
| | | }).catch(() => { |
| | | this.triggerEvent('ready', {}) |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description è°ç¨æä»¶çé©å彿° |
| | | * @private |
| | | */ |
| | | _hook (name) { |
| | | for (let i = plugins.length; i--;) { |
| | | if (this.plugins[i][name]) { |
| | | this.plugins[i][name]() |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // #ifndef MP-TOUTIAO |
| | | /** |
| | | * @description æ·»å åç»ä»¶ |
| | | * @private |
| | | */ |
| | | _add (e) { |
| | | e |
| | | // #ifndef MP-ALIPAY |
| | | .detail |
| | | // #endif |
| | | .root = this |
| | | } |
| | | // #endif |
| | | } |
| | | }) |
New file |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "node": "./node/node" |
| | | } |
| | | } |
New file |
| | |
| | | <!-- 主ç»ä»¶ --> |
| | | <view class="_root {{selectable?'_select':''}}" style="{{containerStyle}}"> |
| | | <!-- å è½½å®æåæ¾ç¤ºèªå®ä¹ loading --> |
| | | <slot wx:if="{{!nodes[0]}}" /> |
| | | <!-- èç¹æ --> |
| | | <node id="_root" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]}}" mp-weixin:mp-qq:mp-baidu:catchadd="_add" mp-alipay:onAdd="_add" /> |
| | | </view> |
New file |
| | |
| | | /* æ ¹èç¹æ ·å¼ */ |
| | | ._root { |
| | | padding: 1px 0; |
| | | overflow-x: auto; |
| | | overflow-y: hidden; |
| | | -webkit-overflow-scrolling: touch; |
| | | } |
| | | |
| | | /* é¿æå¤å¶ */ |
| | | ._select { |
| | | -webkit-user-select: text; |
| | | user-select: text; |
| | | } |
New file |
| | |
| | | /** |
| | | * @fileoverview éå½åç»ä»¶ï¼ç¨äºæ¾ç¤ºèç¹æ |
| | | */ |
| | | Component({ |
| | | data: { |
| | | ctrl: {}, // æ§å¶ä¿¡å· |
| | | // #ifdef MP-WEIXIN |
| | | isiOS: wx.getSystemInfoSync().system.includes('iOS') |
| | | // #endif |
| | | }, |
| | | properties: { |
| | | childs: Array, // åèç¹å表 |
| | | opts: Array // 设置 [æ¯å¦å¼å¯æå è½½, å è½½ä¸å ä½å¾, é误å ä½å¾, æ¯å¦ä½¿ç¨é¿æèå] |
| | | }, |
| | | options: { |
| | | addGlobalClass: true |
| | | }, |
| | | // #ifndef MP-TOUTIAO |
| | | attached () { |
| | | // #ifndef MP-ALIPAY |
| | | this.triggerEvent('add', this, { |
| | | bubbles: true, |
| | | composed: true |
| | | }) |
| | | // #endif |
| | | // #ifdef MP-ALIPAY |
| | | this.props.onAdd(this) |
| | | // #endif |
| | | }, |
| | | // #endif |
| | | methods: { |
| | | noop () { }, |
| | | /** |
| | | * @description è·åæ ç¾ |
| | | * @param {String} path è·¯å¾ |
| | | */ |
| | | getNode (path) { |
| | | try { |
| | | const nums = path.split('_') |
| | | let node = this.properties.childs[nums[0]] |
| | | for (let i = 1; i < nums.length; i++) { |
| | | node = node.children[nums[i]] |
| | | } |
| | | return node |
| | | } catch { |
| | | return { |
| | | text: '', |
| | | attrs: {}, |
| | | children: [] |
| | | } |
| | | } |
| | | }, |
| | | /** |
| | | * @description ææ¾è§é¢äºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | play (e) { |
| | | const i = e.target.dataset.i |
| | | const node = this.getNode(i) |
| | | this.root.triggerEvent('play', { |
| | | source: node.name, |
| | | attrs: { |
| | | ...node.attrs, |
| | | src: node.src[this.data.ctrl[i] || 0] |
| | | } |
| | | }) |
| | | if (this.root.properties.pauseVideo) { |
| | | let flag = false |
| | | const id = e.target.id |
| | | for (let i = this.root._videos.length; i--;) { |
| | | if (this.root._videos[i].id === id) { |
| | | flag = true |
| | | } else { |
| | | this.root._videos[i].pause() // èªå¨æåå
¶ä»è§é¢ |
| | | } |
| | | } |
| | | // å°èªå·±å å
¥å表 |
| | | if (!flag) { |
| | | const ctx = wx.createVideoContext(id |
| | | // #ifndef MP-BAIDU |
| | | , this |
| | | // #endif |
| | | ) |
| | | ctx.id = id |
| | | if (this.root.playbackRate) { |
| | | ctx.playbackRate(this.root.playbackRate) |
| | | } |
| | | this.root._videos.push(ctx) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description å¾çç¹å»äºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | imgTap (e) { |
| | | const node = this.getNode(e.target.dataset.i) |
| | | // ç¶çº§ä¸æé¾æ¥ |
| | | if (node.a) return this.linkTap(node.a) |
| | | if (node.attrs.ignore) return |
| | | this.root.triggerEvent('imgtap', node.attrs) |
| | | if (this.root.properties.previewImg) { |
| | | const current = |
| | | // #ifndef MP-ALIPAY |
| | | this.root.imgList[node.i] |
| | | // #endif |
| | | // #ifdef MP-ALIPAY |
| | | node.i // eslint-disable-line |
| | | // #endif |
| | | // èªå¨é¢è§å¾ç |
| | | wx.previewImage({ |
| | | // #ifdef MP-WEIXIN |
| | | showmenu: this.root.properties.showImgMenu, |
| | | // #endif |
| | | // #ifdef MP-ALIPAY |
| | | enablesavephoto: this.root.properties.showImgMenu, |
| | | enableShowPhotoDownload: this.root.properties.showImgMenu, |
| | | // #endif |
| | | current, |
| | | urls: this.root.imgList |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description å¾çå è½½å®æäºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | imgLoad (e) { |
| | | const i = e.target.dataset.i |
| | | const node = this.getNode(i) |
| | | let val |
| | | if (!node.w) { |
| | | val = e.detail.width |
| | | } else if ((this.properties.opts[1] && !this.data.ctrl[i]) || this.data.ctrl[i] === -1) { |
| | | // å è½½å®æ¯ï¼åæ¶å è½½ä¸å ä½å¾ |
| | | val = 1 |
| | | } |
| | | if (val |
| | | // #ifdef MP-TOUTIAO |
| | | && val !== this.data.ctrl[i] // eslint-disable-line |
| | | // #endif |
| | | ) { |
| | | this.setData({ |
| | | ['ctrl.' + i]: val |
| | | }) |
| | | } |
| | | this.checkReady() |
| | | }, |
| | | |
| | | /** |
| | | * @description æ£æ¥æ¯å¦ææå¾çå è½½å®æ¯ |
| | | */ |
| | | checkReady () { |
| | | if (!this.root.properties.lazyLoad) { |
| | | this.root.imgList._unloadimgs -= 1 |
| | | if (!this.root.imgList._unloadimgs) { |
| | | setTimeout(() => { |
| | | this.root.getRect().then(rect => { |
| | | this.root.triggerEvent('ready', rect) |
| | | }).catch(() => { |
| | | this.root.triggerEvent('ready', {}) |
| | | }) |
| | | }, 350) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description 龿¥ç¹å»äºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | linkTap (e) { |
| | | const node = e.currentTarget ? this.getNode(e.currentTarget.dataset.i) : {} |
| | | const attrs = node.attrs || e |
| | | const href = attrs.href |
| | | this.root.triggerEvent('linktap', Object.assign({ |
| | | innerText: this.root.getText(node.children || []) // 龿¥å
çææ¬å
容 |
| | | }, attrs)) |
| | | if (href) { |
| | | if (href[0] === '#') { |
| | | // 跳转éç¹ |
| | | this.root.navigateTo(href.substring(1)).catch(() => { }) |
| | | } else if (href.split('?')[0].includes('://')) { |
| | | // å¤å¶å¤é¨é¾æ¥ |
| | | if (this.root.properties.copyLink) { |
| | | wx.setClipboardData({ |
| | | data: href, |
| | | success: () => |
| | | wx.showToast({ |
| | | title: '龿¥å·²å¤å¶' |
| | | }) |
| | | }) |
| | | } |
| | | } else { |
| | | // è·³è½¬é¡µé¢ |
| | | wx.navigateTo({ |
| | | url: href, |
| | | fail () { |
| | | wx.switchTab({ |
| | | url: href, |
| | | fail () { } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description é误äºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | mediaError (e) { |
| | | const i = e.target.dataset.i |
| | | const node = this.getNode(i) |
| | | if (node.name === 'video' || node.name === 'audio') { |
| | | // å è½½å
¶ä»æº |
| | | let index = (this.data.ctrl[i] || 0) + 1 |
| | | if (index > node.src.length) { |
| | | index = 0 |
| | | } |
| | | if (index < node.src.length) { |
| | | return this.setData({ |
| | | ['ctrl.' + i]: index |
| | | }) |
| | | } |
| | | } else if (node.name === 'img') { |
| | | // æ¾ç¤ºé误å ä½å¾ |
| | | if (this.properties.opts[2]) { |
| | | this.setData({ |
| | | ['ctrl.' + i]: -1 |
| | | }) |
| | | } |
| | | this.checkReady() |
| | | } |
| | | if (this.root) { |
| | | this.root.triggerEvent('error', { |
| | | source: node.name, |
| | | attrs: node.attrs, |
| | | errMsg: e.detail.errMsg |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | }) |
New file |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "node": "./node" |
| | | } |
| | | } |
New file |
| | |
| | | <!-- node éå½åç»ä»¶ --> |
| | | <!-- #ifdef MP-WEIXIN || MP-QQ --> |
| | | <wxs module="isInline"> |
| | | // è¡å
æ ç¾å表 |
| | | var inlineTags = { |
| | | abbr: true, |
| | | b: true, |
| | | big: true, |
| | | code: true, |
| | | del: true, |
| | | em: true, |
| | | i: true, |
| | | ins: true, |
| | | label: true, |
| | | q: true, |
| | | small: true, |
| | | span: true, |
| | | strong: true, |
| | | sub: true, |
| | | sup: true |
| | | } |
| | | /** |
| | | * @description 夿æ¯å¦ä¸ºè¡å
æ ç¾ |
| | | */ |
| | | module.exports = function (tagName, style) { |
| | | return inlineTags[tagName] || (style || '').indexOf('inline') !== -1 |
| | | } |
| | | </wxs> |
| | | <!-- #endif --> |
| | | <template name="el"> |
| | | <!-- å¾ç --> |
| | | <block wx:if="{{n.name==='img'}}"> |
| | | <!-- è¡¨æ ¼ä¸çå¾çï¼ä½¿ç¨ rich-text 鲿¢å¤§å°ä¸æ£ç¡® --> |
| | | <rich-text wx:if="{{n.t}}" style="display:{{n.t}}" nodes="<img class='_img' style='{{n.attrs.style}}' src='{{n.attrs.src}}'>" data-i="{{i}}" catchtap="imgTap" /> |
| | | <block wx:else> |
| | | <!-- å ä½å¾ --> |
| | | <image wx:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix" /> |
| | | <!-- æ¾ç¤ºå¾ç --> |
| | | <image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{ctrl[i]===-1?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))}}" lazy-load="{{opts[0]}}" mp-weixin:mp-baidu:webp="{{n.webp}}" mp-weixin:show-menu-by-longpress="{{opts[3]&&!n.attrs.ignore}}" mp-baidu:image-menu-prevent="{{!opts[3]||n.attrs.ignore}}" data-i="{{i}}" bindload="imgLoad" binderror="mediaError" catchtap="imgTap" bindlongpress="noop" /> |
| | | </block> |
| | | </block> |
| | | <!-- ææ¬ --> |
| | | <!-- #ifdef MP-WEIXIN || MP-QQ || MP-TOUTIAO --> |
| | | <text wx:elif="{{n.text}}" mp-weixin:user-select="{{opts[4]=='force'&&isiOS}}" decode>{{n.text}}</text> |
| | | <!-- #endif --> |
| | | <text wx:elif="{{n.name==='br'}}">{{'\n'}}</text> |
| | | <!-- 龿¥ --> |
| | | <view wx:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchtap="linkTap"> |
| | | <!-- #ifdef MP-WEIXIN || MP-QQ --> |
| | | <node childs="{{n.children}}" opts="{{opts}}" style="display:inherit" /> |
| | | <!-- #endif --> |
| | | <!-- #ifdef MP-BAIDU --> |
| | | <block wx:for="{{n.children}}" wx:key="index"> |
| | | <template is="el" data="{{n:item,i:i+'_'+index,opts:opts,ctrl:ctrl}}"></template> |
| | | </block> |
| | | <!-- #endif --> |
| | | <!-- #ifdef MP-ALIPAY || MP-TOUTIAO --> |
| | | <template is="node" data="{{childs:n.children,path:i+'_',opts:opts,ctrl:ctrl}}"></template> |
| | | <!-- #endif --> |
| | | </view> |
| | | <!-- è§é¢ --> |
| | | <video wx:elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" object-fit="{{n.attrs['object-fit']}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError" /> |
| | | <!-- #ifndef MP-TOUTIAO --> |
| | | <!-- é³é¢ --> |
| | | <audio wx:elif="{{n.name==='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError" /> |
| | | <!-- #endif --> |
| | | <!-- insert --> |
| | | <!-- å¯ææ¬ --> |
| | | <rich-text wx:else id="{{n.attrs.id}}" mp-weixin:mp-qq:mp-baidu:mp-toutiao:style="{{n.f}}" mp-alipay:style="display:inline;{{n.f}}" mp-baidu:selectable="{{opts[4]}}" mp-weixin:user-select="{{opts[4]}}" nodes="{{[n]}}" /> |
| | | </template> |
| | | <!-- #ifdef MP-ALIPAY || MP-TOUTIAO --> |
| | | <template name="node"> |
| | | <block wx:for="{{childs}}" wx:for-item="n" wx:for-index="i" wx:key="i"> |
| | | <template wx:if="{{!n.c}}" is="el" data="{{n:n,i:path+i,opts:opts,ctrl:ctrl}}" /> |
| | | <view wx:else id="{{n.attrs.id}}" class="_{{n.name}} {{n.attrs.class}}" style="{{n.attrs.style}}"> |
| | | <template is="node" data="{{childs:n.children,path:path+i+'_',opts:opts,ctrl:ctrl}}"></template> |
| | | </view> |
| | | </block> |
| | | </template> |
| | | <template is="node" data="{{childs:childs,path:'',opts:opts,ctrl:ctrl}}"></template> |
| | | <!-- #endif --> |
| | | <!-- #ifndef MP-ALIPAY || MP-TOUTIAO --> |
| | | <!-- 第 1 å± --> |
| | | <block wx:for="{{childs}}" wx:for-item="n1" wx:for-index="i1" wx:key="i1"> |
| | | <template mp-weixin:mp-qq:wx:if="{{!n1.c&&(!n1.children||n1.name==='a'||!isInline(n1.name,n1.attrs.style))}}" mp-baidu:wx:if="{{!n1.c}}" is="el" data="{{n:n1,i:''+i1,opts:opts,ctrl:ctrl}}" /> |
| | | <view wx:else id="{{n1.attrs.id}}" class="_{{n1.name}} {{n1.attrs.class}}" style="{{n1.attrs.style}}"> |
| | | <!-- 第 2 å± --> |
| | | <block wx:for="{{n1.children}}" wx:for-item="n2" wx:for-index="i2" wx:key="i2"> |
| | | <template mp-weixin:mp-qq:wx:if="{{!n2.c&&(!n2.children||n2.name==='a'||!isInline(n2.name,n2.attrs.style))}}" mp-baidu:wx:if="{{!n2.c}}" is="el" data="{{n:n2,i:i1+'_'+i2,opts:opts,ctrl:ctrl}}" /> |
| | | <view wx:else id="{{n2.attrs.id}}" class="_{{n2.name}} {{n2.attrs.class}}" style="{{n2.attrs.style}}"> |
| | | <!-- 第 3 å± --> |
| | | <block wx:for="{{n2.children}}" wx:for-item="n3" wx:for-index="i3" wx:key="i3"> |
| | | <template mp-weixin:mp-qq:wx:if="{{!n3.c&&(!n3.children||n3.name==='a'||!isInline(n3.name,n3.attrs.style))}}" mp-baidu:wx:if="{{!n3.c}}" is="el" data="{{n:n3,i:i1+'_'+i2+'_'+i3,opts:opts,ctrl:ctrl}}" /> |
| | | <view wx:else id="{{n3.attrs.id}}" class="_{{n3.name}} {{n3.attrs.class}}" style="{{n3.attrs.style}}"> |
| | | <!-- 第 4 å± --> |
| | | <block wx:for="{{n3.children}}" wx:for-item="n4" wx:for-index="i4" wx:key="i4"> |
| | | <template mp-weixin:mp-qq:wx:if="{{!n4.c&&(!n4.children||n4.name==='a'||!isInline(n4.name,n4.attrs.style))}}" mp-baidu:wx:if="{{!n4.c}}" is="el" data="{{n:n4,i:i1+'_'+i2+'_'+i3+'_'+i4,opts:opts,ctrl:ctrl}}" /> |
| | | <view wx:else id="{{n4.attrs.id}}" class="_{{n4.name}} {{n4.attrs.class}}" style="{{n4.attrs.style}}"> |
| | | <!-- 第 5 å± --> |
| | | <block wx:for="{{n4.children}}" wx:for-item="n5" wx:for-index="i5" wx:key="i5"> |
| | | <template mp-weixin:mp-qq:wx:if="{{!n5.c&&(!n5.children||n5.name==='a'||!isInline(n5.name,n5.attrs.style))}}" mp-baidu:wx:if="{{!n5.c}}" is="el" data="{{n:n5,i:i1+'_'+i2+'_'+i3+'_'+i4+'_'+i5,opts:opts,ctrl:ctrl}}" /> |
| | | <node wx:else id="{{n5.attrs.id}}" class="_{{n5.name}} {{n5.attrs.class}}" style="{{n5.attrs.style}}" childs="{{n5.children}}" opts="{{opts}}" /> |
| | | </block> |
| | | </view> |
| | | </block> |
| | | </view> |
| | | </block> |
| | | </view> |
| | | </block> |
| | | </view> |
| | | </block> |
| | | <!-- #endif --> |
New file |
| | |
| | | /* a æ ç¾é»è®¤ææ */ |
| | | ._a { |
| | | padding: 1.5px 0 1.5px 0; |
| | | color: #366092; |
| | | word-break: break-all; |
| | | } |
| | | |
| | | /* a æ ç¾ç¹å»æææ */ |
| | | ._hover { |
| | | text-decoration: underline; |
| | | opacity: 0.7; |
| | | } |
| | | |
| | | /* å¾çé»è®¤ææ */ |
| | | ._img { |
| | | max-width: 100%; |
| | | -webkit-touch-callout: none; |
| | | } |
| | | |
| | | /* å
鍿 ·å¼ */ |
| | | |
| | | ._b, |
| | | ._strong { |
| | | font-weight: bold; |
| | | } |
| | | |
| | | ._code { |
| | | font-family: monospace; |
| | | } |
| | | |
| | | ._del { |
| | | text-decoration: line-through; |
| | | } |
| | | |
| | | ._em, |
| | | ._i { |
| | | font-style: italic; |
| | | } |
| | | |
| | | ._h1 { |
| | | font-size: 2em; |
| | | } |
| | | |
| | | ._h2 { |
| | | font-size: 1.5em; |
| | | } |
| | | |
| | | ._h3 { |
| | | font-size: 1.17em; |
| | | } |
| | | |
| | | ._h5 { |
| | | font-size: 0.83em; |
| | | } |
| | | |
| | | ._h6 { |
| | | font-size: 0.67em; |
| | | } |
| | | |
| | | ._h1, |
| | | ._h2, |
| | | ._h3, |
| | | ._h4, |
| | | ._h5, |
| | | ._h6 { |
| | | display: block; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | ._ins { |
| | | text-decoration: underline; |
| | | } |
| | | |
| | | ._li { |
| | | display: list-item; |
| | | } |
| | | |
| | | ._ol { |
| | | list-style-type: decimal; |
| | | } |
| | | |
| | | ._ol, |
| | | ._ul { |
| | | display: block; |
| | | padding-left: 40px; |
| | | margin: 1em 0; |
| | | } |
| | | |
| | | ._q::before { |
| | | content: '"'; |
| | | } |
| | | |
| | | ._q::after { |
| | | content: '"'; |
| | | } |
| | | |
| | | ._sub { |
| | | font-size: smaller; |
| | | vertical-align: sub; |
| | | } |
| | | |
| | | ._sup { |
| | | font-size: smaller; |
| | | vertical-align: super; |
| | | } |
| | | |
| | | ._thead, |
| | | ._tbody, |
| | | ._tfoot { |
| | | display: table-row-group; |
| | | } |
| | | |
| | | ._tr { |
| | | display: table-row; |
| | | } |
| | | |
| | | ._td, |
| | | ._th { |
| | | display: table-cell; |
| | | vertical-align: middle; |
| | | } |
| | | |
| | | ._th { |
| | | font-weight: bold; |
| | | text-align: center; |
| | | } |
| | | |
| | | ._ul { |
| | | list-style-type: disc; |
| | | } |
| | | |
| | | ._ul ._ul { |
| | | margin: 0; |
| | | list-style-type: circle; |
| | | } |
| | | |
| | | ._ul ._ul ._ul { |
| | | list-style-type: square; |
| | | } |
| | | |
| | | ._abbr, |
| | | ._b, |
| | | ._code, |
| | | ._del, |
| | | ._em, |
| | | ._i, |
| | | ._ins, |
| | | ._label, |
| | | ._q, |
| | | ._span, |
| | | ._strong, |
| | | ._sub, |
| | | ._sup { |
| | | display: inline; |
| | | } |
| | | |
| | | /* #ifndef MP-ALIPAY || MP-TOUTIAO */ |
| | | ._blockquote, |
| | | ._div, |
| | | ._p { |
| | | display: block; |
| | | } |
| | | |
| | | /* #endif */ |
New file |
| | |
| | | /** |
| | | * @fileoverview html è§£æå¨ |
| | | */ |
| | | |
| | | // é
ç½® |
| | | const config = { |
| | | // ä¿¡ä»»çæ ç¾ï¼ä¿ææ ç¾åä¸åï¼ |
| | | trustTags: makeMap('a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'), |
| | | |
| | | // å级æ ç¾ï¼è½¬ä¸º divï¼å
¶ä»çéä¿¡ä»»æ ç¾è½¬ä¸º spanï¼ |
| | | blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'), |
| | | |
| | | // è¦ç§»é¤çæ ç¾ |
| | | ignoreTags: makeMap('area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr'), |
| | | |
| | | // èªéåæ ç¾ |
| | | voidTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'), |
| | | |
| | | // html å®ä½ |
| | | entities: { |
| | | lt: '<', |
| | | gt: '>', |
| | | quot: '"', |
| | | apos: "'", |
| | | ensp: '\u2002', |
| | | emsp: '\u2003', |
| | | nbsp: '\xA0', |
| | | semi: ';', |
| | | ndash: 'â', |
| | | mdash: 'â', |
| | | middot: '·', |
| | | lsquo: 'â', |
| | | rsquo: 'â', |
| | | ldquo: 'â', |
| | | rdquo: 'â', |
| | | bull: 'â¢', |
| | | hellip: 'â¦', |
| | | larr: 'â', |
| | | uarr: 'â', |
| | | rarr: 'â', |
| | | darr: 'â' |
| | | }, |
| | | |
| | | // é»è®¤çæ ç¾æ ·å¼ |
| | | tagStyle: { |
| | | address: 'font-style:italic', |
| | | big: 'display:inline;font-size:1.2em', |
| | | caption: 'display:table-caption;text-align:center', |
| | | center: 'text-align:center', |
| | | cite: 'font-style:italic', |
| | | dd: 'margin-left:40px', |
| | | mark: 'background-color:yellow', |
| | | pre: 'font-family:monospace;white-space:pre', |
| | | s: 'text-decoration:line-through', |
| | | small: 'display:inline;font-size:0.8em', |
| | | strike: 'text-decoration:line-through', |
| | | u: 'text-decoration:underline' |
| | | }, |
| | | |
| | | // svg 大å°å对ç
§è¡¨ |
| | | svgDict: { |
| | | animatetransform: 'animateTransform', |
| | | lineargradient: 'linearGradient', |
| | | viewbox: 'viewBox', |
| | | attributename: 'attributeName', |
| | | repeatcount: 'repeatCount', |
| | | repeatdur: 'repeatDur', |
| | | foreignobject: 'foreignObject' |
| | | } |
| | | } |
| | | const tagSelector = {} |
| | | let windowWidth, system |
| | | // #ifdef MP-WEIXIN |
| | | if (wx.canIUse('getWindowInfo')) { |
| | | windowWidth = wx.getWindowInfo().windowWidth |
| | | system = wx.getDeviceInfo().system |
| | | } else { |
| | | // #endif |
| | | const systemInfo = wx.getSystemInfoSync() |
| | | windowWidth = systemInfo.windowWidth |
| | | // #ifdef MP-WEIXIN |
| | | system = systemInfo.system |
| | | } |
| | | // #endif |
| | | const blankChar = makeMap(' ,\r,\n,\t,\f') |
| | | let idIndex = 0 |
| | | |
| | | /** |
| | | * @description å建 map |
| | | * @param {String} str éå·åé |
| | | */ |
| | | function makeMap (str) { |
| | | const map = Object.create(null) |
| | | const list = str.split(',') |
| | | for (let i = list.length; i--;) { |
| | | map[list[i]] = true |
| | | } |
| | | return map |
| | | } |
| | | |
| | | /** |
| | | * @description è§£ç html å®ä½ |
| | | * @param {String} str è¦è§£ç çå符串 |
| | | * @param {Boolean} amp è¦ä¸è¦è§£ç & |
| | | * @returns {String} è§£ç åçå符串 |
| | | */ |
| | | function decodeEntity (str, amp) { |
| | | let i = str.indexOf('&') |
| | | while (i !== -1) { |
| | | const j = str.indexOf(';', i + 3) |
| | | let code |
| | | if (j === -1) break |
| | | if (str[i + 1] === '#') { |
| | | // { å½¢å¼çå®ä½ |
| | | code = parseInt((str[i + 2] === 'x' ? '0' : '') + str.substring(i + 2, j)) |
| | | if (!isNaN(code)) { |
| | | str = str.substr(0, i) + String.fromCharCode(code) + str.substr(j + 1) |
| | | } |
| | | } else { |
| | | // å½¢å¼çå®ä½ |
| | | code = str.substring(i + 1, j) |
| | | if (config.entities[code] || (code === 'amp' && amp)) { |
| | | str = str.substr(0, i) + (config.entities[code] || '&') + str.substr(j + 1) |
| | | } |
| | | } |
| | | i = str.indexOf('&', i + 1) |
| | | } |
| | | return str |
| | | } |
| | | |
| | | /** |
| | | * @description åå¹¶å¤ä¸ªå级æ ç¾ï¼å å¿«é¿å
容渲æ |
| | | * @param {Array} nodes è¦åå¹¶çæ ç¾æ°ç» |
| | | */ |
| | | function mergeNodes (nodes) { |
| | | let i = nodes.length - 1 |
| | | for (let j = i; j >= -1; j--) { |
| | | if (j === -1 || nodes[j].c || !nodes[j].name || (nodes[j].name !== 'div' && nodes[j].name !== 'p' && nodes[j].name[0] !== 'h') || (nodes[j].attrs.style || '').includes('inline')) { |
| | | if (i - j >= 5) { |
| | | nodes.splice(j + 1, i - j, { |
| | | name: 'div', |
| | | attrs: {}, |
| | | children: nodes.slice(j + 1, i + 1) |
| | | }) |
| | | } |
| | | i = j - 1 |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description html è§£æå¨ |
| | | * @param {Object} vm ç»ä»¶å®ä¾ |
| | | */ |
| | | function Parser (vm) { |
| | | this.options = vm.properties || {} |
| | | this.tagStyle = Object.assign({}, config.tagStyle, this.options.tagStyle) |
| | | this.imgList = vm.imgList || [] |
| | | this.imgList._unloadimgs = 0 |
| | | this.plugins = vm.plugins || [] |
| | | this.attrs = Object.create(null) |
| | | this.stack = [] |
| | | this.nodes = [] |
| | | this.pre = (this.options.containerStyle || '').includes('white-space') && this.options.containerStyle.includes('pre') ? 2 : 0 |
| | | } |
| | | |
| | | /** |
| | | * @description æ§è¡è§£æ |
| | | * @param {String} content è¦è§£æçææ¬ |
| | | */ |
| | | Parser.prototype.parse = function (content) { |
| | | // æä»¶å¤ç |
| | | for (let i = this.plugins.length; i--;) { |
| | | if (this.plugins[i].onUpdate) { |
| | | content = this.plugins[i].onUpdate(content, config) || content |
| | | } |
| | | } |
| | | |
| | | new Lexer(this).parse(content) |
| | | // åºæ æªéåçæ ç¾ |
| | | while (this.stack.length) { |
| | | this.popNode() |
| | | } |
| | | if (this.nodes.length > 50) { |
| | | mergeNodes(this.nodes) |
| | | } |
| | | return this.nodes |
| | | } |
| | | |
| | | /** |
| | | * @description å°æ ç¾æ´é²åºæ¥ï¼ä¸è¢« rich-text å
å«ï¼ |
| | | */ |
| | | Parser.prototype.expose = function () { |
| | | for (let i = this.stack.length; i--;) { |
| | | const item = this.stack[i] |
| | | if (item.c || item.name === 'a' || item.name === 'video' || item.name === 'audio') return |
| | | item.c = 1 |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description å¤çæä»¶ |
| | | * @param {Object} node è¦å¤ççæ ç¾ |
| | | * @returns {Boolean} æ¯å¦è¦ç§»é¤æ¤æ ç¾ |
| | | */ |
| | | Parser.prototype.hook = function (node) { |
| | | for (let i = this.plugins.length; i--;) { |
| | | if (this.plugins[i].onParse && this.plugins[i].onParse(node, this) === false) return false |
| | | } |
| | | return true |
| | | } |
| | | |
| | | /** |
| | | * @description å°é¾æ¥æ¼æ¥ä¸ä¸»åå |
| | | * @param {String} url éè¦æ¼æ¥ç龿¥ |
| | | * @returns {String} æ¼æ¥åç龿¥ |
| | | */ |
| | | Parser.prototype.getUrl = function (url) { |
| | | const domain = this.options.domain |
| | | if (url[0] === '/') { |
| | | if (url[1] === '/') { |
| | | // // å¼å¤´çè¡¥å
åè®®å |
| | | url = (domain ? domain.split('://')[0] : 'http') + ':' + url |
| | | } else if (domain) { |
| | | // å¦åè¡¥å
æ´ä¸ªåå |
| | | url = domain + url |
| | | } |
| | | } else if (domain && !url.includes('data:') && !url.includes('://')) { |
| | | url = domain + '/' + url |
| | | } |
| | | return url |
| | | } |
| | | |
| | | /** |
| | | * @description è§£ææ ·å¼è¡¨ |
| | | * @param {Object} node æ ç¾ |
| | | * @returns {Object} |
| | | */ |
| | | Parser.prototype.parseStyle = function (node) { |
| | | const attrs = node.attrs |
| | | const list = (this.tagStyle[node.name] || '').split(';').concat((attrs.style || '').split(';')) |
| | | const styleObj = {} |
| | | let tmp = '' |
| | | |
| | | if (attrs.id && !this.xml) { |
| | | // æ´é²éç¹ |
| | | if (this.options.useAnchor) { |
| | | this.expose() |
| | | } else if (node.name !== 'img' && node.name !== 'a' && node.name !== 'video' && node.name !== 'audio') { |
| | | attrs.id = undefined |
| | | } |
| | | } |
| | | |
| | | // è½¬æ¢ width å height 屿§ |
| | | if (attrs.width) { |
| | | styleObj.width = parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px') |
| | | attrs.width = undefined |
| | | } |
| | | if (attrs.height) { |
| | | styleObj.height = parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px') |
| | | attrs.height = undefined |
| | | } |
| | | |
| | | for (let i = 0, len = list.length; i < len; i++) { |
| | | const info = list[i].split(':') |
| | | if (info.length < 2) continue |
| | | const key = info.shift().trim().toLowerCase() |
| | | let value = info.join(':').trim() |
| | | if ((value[0] === '-' && value.lastIndexOf('-') > 0) || value.includes('safe')) { |
| | | // å
¼å®¹æ§ç css ä¸å缩 |
| | | tmp += `;${key}:${value}` |
| | | } else if (!styleObj[key] || value.includes('import') || !styleObj[key].includes('import')) { |
| | | // éå¤çæ ·å¼è¿è¡è¦ç |
| | | if (value.includes('url')) { |
| | | // å¡«å
龿¥ |
| | | let j = value.indexOf('(') + 1 |
| | | if (j) { |
| | | while (value[j] === '"' || value[j] === "'" || blankChar[value[j]]) { |
| | | j++ |
| | | } |
| | | value = value.substr(0, j) + this.getUrl(value.substr(j)) |
| | | } |
| | | } else if (value.includes('rpx')) { |
| | | // è½¬æ¢ rpxï¼rich-text å
é¨ä¸æ¯æ rpxï¼ |
| | | value = value.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * windowWidth / 750 + 'px') |
| | | } |
| | | styleObj[key] = value |
| | | } |
| | | } |
| | | |
| | | node.attrs.style = tmp |
| | | return styleObj |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°æ ç¾å |
| | | * @param {String} name æ ç¾å |
| | | * @private |
| | | */ |
| | | Parser.prototype.onTagName = function (name) { |
| | | this.tagName = this.xml ? name : name.toLowerCase() |
| | | if (this.tagName === 'svg') { |
| | | this.xml = (this.xml || 0) + 1 // svg æ ç¾å
大å°åææ |
| | | config.ignoreTags.style = undefined // svg æ ç¾å
style å¯ç¨ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°å±æ§å |
| | | * @param {String} name 屿§å |
| | | * @private |
| | | */ |
| | | Parser.prototype.onAttrName = function (name) { |
| | | name = this.xml ? name : name.toLowerCase() |
| | | if (name.substr(0, 5) === 'data-') { |
| | | if (name === 'data-src' && !this.attrs.src) { |
| | | // data-src èªå¨è½¬ä¸º src |
| | | this.attrName = 'src' |
| | | } else if (this.tagName === 'img' || this.tagName === 'a') { |
| | | // a å img æ ç¾ä¿ç data- ç屿§ï¼å¯ä»¥å¨ imgtap å linktap äºä»¶ä¸ä½¿ç¨ |
| | | this.attrName = name |
| | | } else { |
| | | // å©ä½çç§»é¤ä»¥åå°å¤§å° |
| | | this.attrName = undefined |
| | | } |
| | | } else { |
| | | this.attrName = name |
| | | this.attrs[name] = 'T' // boolean å屿§ç¼ºç设置 |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°å±æ§å¼ |
| | | * @param {String} val 屿§å¼ |
| | | * @private |
| | | */ |
| | | Parser.prototype.onAttrVal = function (val) { |
| | | const name = this.attrName || '' |
| | | if (name === 'style' || name === 'href') { |
| | | // é¨å屿§è¿è¡å®ä½è§£ç |
| | | this.attrs[name] = decodeEntity(val, true) |
| | | } else if (name.includes('src')) { |
| | | // æ¼æ¥ä¸»åå |
| | | this.attrs[name] = this.getUrl(decodeEntity(val, true)) |
| | | } else if (name) { |
| | | this.attrs[name] = val |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°æ ç¾å¼å§ |
| | | * @param {Boolean} selfClose æ¯å¦æèªéåæ è¯ /> |
| | | * @private |
| | | */ |
| | | Parser.prototype.onOpenTag = function (selfClose) { |
| | | // æ¼è£
node |
| | | const node = Object.create(null) |
| | | node.name = this.tagName |
| | | node.attrs = this.attrs |
| | | this.attrs = Object.create(null) |
| | | |
| | | const attrs = node.attrs |
| | | const parent = this.stack[this.stack.length - 1] |
| | | const siblings = parent ? parent.children : this.nodes |
| | | const close = this.xml ? selfClose : config.voidTags[node.name] |
| | | |
| | | // æ¿æ¢æ ç¾åéæ©å¨ |
| | | if (tagSelector[node.name]) { |
| | | attrs.class = tagSelector[node.name] + (attrs.class ? ' ' + attrs.class : '') |
| | | } |
| | | |
| | | // è½¬æ¢ embed æ ç¾ |
| | | if (node.name === 'embed') { |
| | | const src = attrs.src || '' |
| | | // æç
§åç¼åå type å° embed 转为 video æ audio |
| | | if (src.includes('.mp4') || src.includes('.3gp') || src.includes('.m3u8') || (attrs.type || '').includes('video')) { |
| | | node.name = 'video' |
| | | } else if (src.includes('.mp3') || src.includes('.wav') || src.includes('.aac') || src.includes('.m4a') || (attrs.type || '').includes('audio')) { |
| | | node.name = 'audio' |
| | | } |
| | | if (attrs.autostart) { |
| | | attrs.autoplay = 'T' |
| | | } |
| | | attrs.controls = 'T' |
| | | } |
| | | |
| | | // å¤çé³è§é¢ |
| | | if (node.name === 'video' || node.name === 'audio') { |
| | | // 设置 idï¼ç¨äºè·å context |
| | | if (node.name === 'video' && !attrs.id) { |
| | | attrs.id = 'v' + idIndex++ |
| | | } |
| | | // 没æè®¾ç½® controls 乿²¡æè®¾ç½® autoplay çèªå¨è®¾ç½® controls |
| | | if (!attrs.controls && !attrs.autoplay) { |
| | | attrs.controls = 'T' |
| | | } |
| | | // ç¨æ°ç»å卿æå¯ç¨ç source |
| | | node.src = [] |
| | | if (attrs.src) { |
| | | node.src.push(attrs.src) |
| | | attrs.src = undefined |
| | | } |
| | | this.expose() |
| | | } |
| | | |
| | | // å¤çèªéåæ ç¾ |
| | | if (close) { |
| | | // è¦è¢«ç§»é¤çæ ç¾ |
| | | if (!this.hook(node) || config.ignoreTags[node.name]) { |
| | | if (node.name === 'base' && !this.options.domain) { |
| | | // éè¿ base æ ç¾è®¾ç½®ä¸»åå |
| | | this.options.domain = attrs.href |
| | | } else if (node.name === 'source' && parent && (parent.name === 'video' || parent.name === 'audio') && attrs.src) { |
| | | // 设置 source æ ç¾ï¼ä»
ç¶èç¹ä¸º video æ audio æ¶ææï¼ |
| | | parent.src.push(attrs.src) |
| | | } |
| | | return |
| | | } |
| | | |
| | | // è§£æ style |
| | | const styleObj = this.parseStyle(node) |
| | | |
| | | // å¤çå¾ç |
| | | if (node.name === 'img') { |
| | | if (attrs.src) { |
| | | // æ è®° webp |
| | | if (attrs.src.includes('webp')) { |
| | | node.webp = 'T' |
| | | } |
| | | // data url å¾çå¦ææ²¡æè®¾ç½® original-src é»è®¤ä¸ºä¸å¯é¢è§çå°å¾ç |
| | | if (attrs.src.includes('data:') && this.options.previewImg !== 'all' && !attrs['original-src']) { |
| | | attrs.ignore = 'T' |
| | | } |
| | | if (!attrs.ignore || node.webp || attrs.src.includes('cloud://')) { |
| | | for (let i = this.stack.length; i--;) { |
| | | const item = this.stack[i] |
| | | if (item.name === 'table' && !node.webp && !attrs.src.includes('cloud://')) { |
| | | if (!styleObj.display || styleObj.display.includes('inline')) { |
| | | node.t = 'inline-block' |
| | | } else { |
| | | node.t = styleObj.display |
| | | } |
| | | styleObj.display = undefined |
| | | } |
| | | const style = item.attrs.style || '' |
| | | if (style.includes('flex:') && !style.includes('flex:0') && !style.includes('flex: 0') && (!styleObj.width || parseInt(styleObj.width) > 100)) { |
| | | styleObj.width = '100% !important' |
| | | styleObj.height = '' |
| | | for (let j = i + 1; j < this.stack.length; j++) { |
| | | this.stack[j].attrs.style = (this.stack[j].attrs.style || '').replace('inline-', '') |
| | | } |
| | | } else if (style.includes('flex') && styleObj.width === '100%') { |
| | | for (let j = i + 1; j < this.stack.length; j++) { |
| | | const style = this.stack[j].attrs.style || '' |
| | | if (!style.includes(';width') && !style.includes(' width') && style.indexOf('width') !== 0) { |
| | | styleObj.width = '' |
| | | break |
| | | } |
| | | } |
| | | } else if (style.includes('inline-block')) { |
| | | if (styleObj.width && styleObj.width[styleObj.width.length - 1] === '%') { |
| | | item.attrs.style += ';max-width:' + styleObj.width |
| | | styleObj.width = '' |
| | | } else { |
| | | item.attrs.style += ';max-width:100%' |
| | | } |
| | | } |
| | | if (item.name === 'a') { |
| | | node.a = item.attrs |
| | | } else { |
| | | item.c = 1 |
| | | } |
| | | } |
| | | node.i = this.imgList.length |
| | | let src = attrs['original-src'] || attrs.src |
| | | // #ifndef MP-ALIPAY |
| | | if (this.imgList.includes(src)) { |
| | | // 妿æéå¤ç龿¥å对ååè¿è¡éæºå¤§å°å忢é¿å
é¢è§æ¶éä½ |
| | | let i = src.indexOf('://') |
| | | if (i !== -1) { |
| | | i += 3 |
| | | let newSrc = src.substr(0, i) |
| | | for (; i < src.length; i++) { |
| | | if (src[i] === '/') break |
| | | newSrc += Math.random() > 0.5 ? src[i].toUpperCase() : src[i] |
| | | } |
| | | newSrc += src.substr(i) |
| | | src = newSrc |
| | | } |
| | | } |
| | | // #endif |
| | | this.imgList.push(src) |
| | | if (!node.t) { |
| | | this.imgList._unloadimgs += 1 |
| | | } |
| | | } |
| | | } |
| | | if (styleObj.display === 'inline') { |
| | | styleObj.display = '' |
| | | } |
| | | if (attrs.ignore) { |
| | | styleObj['max-width'] = styleObj['max-width'] || '100%' |
| | | attrs.style += ';-webkit-touch-callout:none' |
| | | } |
| | | // 设置ç宽度è¶
åºå±å¹ï¼ä¸ºé¿å
åå½¢ï¼é«åº¦è½¬ä¸ºèªå¨ |
| | | if (parseInt(styleObj.width) > windowWidth) { |
| | | styleObj.height = undefined |
| | | } |
| | | // è®°å½æ¯å¦è®¾ç½®äºå®½é« |
| | | if (!isNaN(parseInt(styleObj.width))) { |
| | | node.w = 'T' |
| | | } |
| | | if (!isNaN(parseInt(styleObj.height)) && (!styleObj.height.includes('%') || (parent && (parent.attrs.style || '').includes('height')))) { |
| | | node.h = 'T' |
| | | } |
| | | if (node.w && node.h && styleObj['object-fit']) { |
| | | if (styleObj['object-fit'] === 'contain') { |
| | | node.m = 'aspectFit' |
| | | } else if (styleObj['object-fit'] === 'cover') { |
| | | node.m = 'aspectFill' |
| | | } |
| | | } |
| | | } else if (node.name === 'svg') { |
| | | siblings.push(node) |
| | | this.stack.push(node) |
| | | this.popNode() |
| | | return |
| | | } |
| | | for (const key in styleObj) { |
| | | if (styleObj[key]) { |
| | | attrs.style += `;${key}:${styleObj[key].replace(' !important', '')}` |
| | | } |
| | | } |
| | | attrs.style = attrs.style.substr(1) || undefined |
| | | // #ifdef MP-BAIDU |
| | | if (!attrs.style) { |
| | | delete attrs.style |
| | | } |
| | | // #endif |
| | | } else { |
| | | if ((node.name === 'pre' || ((attrs.style || '').includes('white-space') && attrs.style.includes('pre'))) && this.pre !== 2) { |
| | | this.pre = node.pre = 1 |
| | | } |
| | | node.children = [] |
| | | this.stack.push(node) |
| | | } |
| | | // å å
¥èç¹æ |
| | | siblings.push(node) |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°æ ç¾ç»æ |
| | | * @param {String} name æ ç¾å |
| | | * @private |
| | | */ |
| | | Parser.prototype.onCloseTag = function (name) { |
| | | // 便¬¡åºæ å°å¹é
ä¸ºæ¢ |
| | | name = this.xml ? name : name.toLowerCase() |
| | | let i |
| | | for (i = this.stack.length; i--;) { |
| | | if (this.stack[i].name === name) break |
| | | } |
| | | if (i !== -1) { |
| | | while (this.stack.length > i) { |
| | | this.popNode() |
| | | } |
| | | } else if (name === 'p' || name === 'br') { |
| | | const siblings = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes |
| | | siblings.push({ |
| | | name, |
| | | attrs: { |
| | | class: tagSelector[name], |
| | | style: this.tagStyle[name] |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description å¤çæ ç¾åºæ |
| | | * @private |
| | | */ |
| | | Parser.prototype.popNode = function () { |
| | | const node = this.stack.pop() |
| | | let attrs = node.attrs |
| | | const children = node.children |
| | | const parent = this.stack[this.stack.length - 1] |
| | | const siblings = parent ? parent.children : this.nodes |
| | | |
| | | if (!this.hook(node) || config.ignoreTags[node.name]) { |
| | | // è·åæ é¢ |
| | | if (node.name === 'title' && children.length && children[0].type === 'text' && this.options.setTitle) { |
| | | wx.setNavigationBarTitle({ |
| | | title: children[0].text |
| | | }) |
| | | } |
| | | |
| | | siblings.pop() |
| | | return |
| | | } |
| | | |
| | | if (node.pre && this.pre !== 2) { |
| | | // æ¯å¦å并空ç½ç¬¦æ è¯ |
| | | this.pre = node.pre = undefined |
| | | for (let i = this.stack.length; i--;) { |
| | | if (this.stack[i].pre) { |
| | | this.pre = 1 |
| | | } |
| | | } |
| | | } |
| | | |
| | | // è½¬æ¢ svg |
| | | if (node.name === 'svg') { |
| | | if (this.xml > 1) { |
| | | // å¤å± svg åµå¥ |
| | | this.xml-- |
| | | return |
| | | } |
| | | let src = '' |
| | | const style = attrs.style |
| | | attrs.style = '' |
| | | attrs.xmlns = 'http://www.w3.org/2000/svg'; |
| | | (function traversal (node) { |
| | | if (node.type === 'text') { |
| | | src += node.text |
| | | return |
| | | } |
| | | const name = config.svgDict[node.name] || node.name |
| | | if (name === 'foreignObject') { |
| | | for (const child of (node.children || [])) { |
| | | if (child.attrs && !child.attrs.xmlns) { |
| | | child.attrs.xmlns = 'http://www.w3.org/1999/xhtml' |
| | | break |
| | | } |
| | | } |
| | | } |
| | | src += '<' + name |
| | | for (const item in node.attrs) { |
| | | const val = node.attrs[item] |
| | | if (val) { |
| | | src += ` ${config.svgDict[item] || item}="${val.replace(/"/g, '')}"` |
| | | } |
| | | } |
| | | if (!node.children) { |
| | | src += '/>' |
| | | } else { |
| | | src += '>' |
| | | for (let i = 0; i < node.children.length; i++) { |
| | | traversal(node.children[i]) |
| | | } |
| | | src += '</' + name + '>' |
| | | } |
| | | })(node) |
| | | node.name = 'img' |
| | | node.attrs = { |
| | | src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'), |
| | | style, |
| | | ignore: 'T' |
| | | } |
| | | node.children = undefined |
| | | this.xml = false |
| | | config.ignoreTags.style = true |
| | | return |
| | | } |
| | | |
| | | const styleObj = {} |
| | | |
| | | // è½¬æ¢ align 屿§ |
| | | if (attrs.align) { |
| | | if (node.name === 'table') { |
| | | if (attrs.align === 'center') { |
| | | styleObj['margin-inline-start'] = styleObj['margin-inline-end'] = 'auto' |
| | | } else { |
| | | styleObj.float = attrs.align |
| | | } |
| | | } else { |
| | | styleObj['text-align'] = attrs.align |
| | | } |
| | | attrs.align = undefined |
| | | } |
| | | |
| | | // è½¬æ¢ dir 屿§ |
| | | if (attrs.dir) { |
| | | styleObj.direction = attrs.dir |
| | | attrs.dir = undefined |
| | | } |
| | | |
| | | // è½¬æ¢ font æ ç¾ç屿§ |
| | | if (node.name === 'font') { |
| | | if (attrs.color) { |
| | | styleObj.color = attrs.color |
| | | attrs.color = undefined |
| | | } |
| | | if (attrs.face) { |
| | | styleObj['font-family'] = attrs.face |
| | | attrs.face = undefined |
| | | } |
| | | if (attrs.size) { |
| | | let size = parseInt(attrs.size) |
| | | if (!isNaN(size)) { |
| | | if (size < 1) { |
| | | size = 1 |
| | | } else if (size > 7) { |
| | | size = 7 |
| | | } |
| | | styleObj['font-size'] = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', 'xxx-large'][size - 1] |
| | | } |
| | | attrs.size = undefined |
| | | } |
| | | } |
| | | |
| | | // ä¸äºç¼è¾å¨çèªå¸¦ class |
| | | if ((attrs.class || '').includes('align-center')) { |
| | | styleObj['text-align'] = 'center' |
| | | } |
| | | |
| | | Object.assign(styleObj, this.parseStyle(node)) |
| | | |
| | | if (node.name !== 'table' && parseInt(styleObj.width) > windowWidth) { |
| | | styleObj['max-width'] = '100%' |
| | | styleObj['box-sizing'] = 'border-box' |
| | | } |
| | | |
| | | if (config.blockTags[node.name]) { |
| | | node.name = 'div' |
| | | } else if (!config.trustTags[node.name] && !this.xml) { |
| | | // æªç¥æ ç¾è½¬ä¸º spanï¼é¿å
æ æ³æ¾ç¤º |
| | | node.name = 'span' |
| | | } else if (node.name === 'a' || node.name === 'ad') { |
| | | this.expose() |
| | | } else if (node.name === 'video' || node.name === 'audio') { |
| | | if ((styleObj.height || '').includes('auto')) { |
| | | styleObj.height = undefined |
| | | } |
| | | node.children = undefined |
| | | } else if ((node.name === 'ul' || node.name === 'ol') && node.c) { |
| | | // å表å¤ç |
| | | const types = { |
| | | a: 'lower-alpha', |
| | | A: 'upper-alpha', |
| | | i: 'lower-roman', |
| | | I: 'upper-roman' |
| | | } |
| | | if (types[attrs.type]) { |
| | | attrs.style += ';list-style-type:' + types[attrs.type] |
| | | attrs.type = undefined |
| | | } |
| | | node.c = 1 |
| | | for (let i = children.length; i--;) { |
| | | if (children[i].name === 'li') { |
| | | children[i].c = 1 |
| | | } |
| | | } |
| | | } else if (node.name === 'table') { |
| | | // è¡¨æ ¼å¤ç |
| | | // cellpaddingãcellspacingãborder è¿å 个常ç¨è¡¨æ ¼å±æ§éè¦éè¿è½¬æ¢å®ç° |
| | | let padding = parseFloat(attrs.cellpadding) |
| | | let spacing = parseFloat(attrs.cellspacing) |
| | | const border = parseFloat(attrs.border) |
| | | const bordercolor = styleObj['border-color'] |
| | | const borderstyle = styleObj['border-style'] |
| | | if (node.c) { |
| | | // padding å spacing é»è®¤ 2 |
| | | if (isNaN(padding)) { |
| | | padding = 2 |
| | | } |
| | | if (isNaN(spacing)) { |
| | | spacing = 2 |
| | | } |
| | | } |
| | | if (border) { |
| | | attrs.style += `;border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'}` |
| | | } |
| | | if (node.flag && node.c) { |
| | | node.flag = undefined |
| | | // æ colspan æ rowspan ä¸å«æé¾æ¥çè¡¨æ ¼éè¿ grid å¸å±å®ç° |
| | | styleObj.display = 'grid' |
| | | if (styleObj['border-collapse'] === 'collapse') { |
| | | styleObj['border-collapse'] = undefined |
| | | spacing = 0 |
| | | } |
| | | if (spacing) { |
| | | styleObj['grid-gap'] = spacing + 'px' |
| | | styleObj.padding = spacing + 'px' |
| | | } else if (border) { |
| | | // æ é´éçæ
åµä¸é¿å
è¾¹æ¡éå |
| | | attrs.style += ';border-left:0;border-top:0' |
| | | } |
| | | |
| | | const width = [] // è¡¨æ ¼çå宽 |
| | | const trList = [] // tr å表 |
| | | const cells = [] // ä¿åæ°çåå
æ ¼ |
| | | const map = {}; // 被åå¹¶åå
æ ¼å ç¨çæ ¼å |
| | | |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].name === 'tr') { |
| | | trList.push(nodes[i]) |
| | | } else if (nodes[i].name === 'colgroup') { |
| | | let colI = 1 |
| | | for (const col of (nodes[i].children || [])) { |
| | | if (col.name === 'col') { |
| | | const style = col.attrs.style || '' |
| | | const start = style.indexOf('width') ? style.indexOf(';width') : 0 |
| | | // æååºå®½åº¦ |
| | | if (start !== -1) { |
| | | let end = style.indexOf(';', start + 6) |
| | | if (end === -1) { |
| | | end = style.length |
| | | } |
| | | width[colI] = style.substring(start ? start + 7 : 6, end) |
| | | } |
| | | colI += 1 |
| | | } |
| | | } |
| | | } else { |
| | | traversal(nodes[i].children || []) |
| | | } |
| | | } |
| | | })(children) |
| | | |
| | | for (let row = 1; row <= trList.length; row++) { |
| | | let col = 1 |
| | | for (let j = 0; j < trList[row - 1].children.length; j++) { |
| | | const td = trList[row - 1].children[j] |
| | | if (td.name === 'td' || td.name === 'th') { |
| | | // è¿ä¸ªæ ¼å被ä¸é¢çåå
æ ¼å ç¨ï¼ååå·++ |
| | | while (map[row + '.' + col]) { |
| | | col++ |
| | | } |
| | | td.c = 1 |
| | | let style = td.attrs.style || '' |
| | | let start = style.indexOf('width') ? style.indexOf(';width') : 0 |
| | | // æååº td ç宽度 |
| | | if (start !== -1) { |
| | | let end = style.indexOf(';', start + 6) |
| | | if (end === -1) { |
| | | end = style.length |
| | | } |
| | | if (!td.attrs.colspan) { |
| | | width[col] = style.substring(start ? start + 7 : 6, end) |
| | | } |
| | | style = style.substr(0, start) + style.substr(end) |
| | | } |
| | | // 设置ç«ç´å¯¹é½ |
| | | style += ';display:flex;flex-direction:column' |
| | | start = style.indexOf('vertical-align') |
| | | if (start !== -1) { |
| | | const val = style.substr(start + 15, 10) |
| | | if (val.includes('middle')) { |
| | | style += ';justify-content:center' |
| | | } else if (val.includes('bottom')) { |
| | | style += ';justify-content:flex-end' |
| | | } |
| | | } else { |
| | | style += ';justify-content:center' |
| | | } |
| | | // è®¾ç½®æ°´å¹³å¯¹é½ |
| | | start = style.indexOf('text-align') |
| | | if (start !== -1) { |
| | | const val = style.substr(start + 11, 10) |
| | | if (val.includes('center')) { |
| | | style += ';justify-content: center' |
| | | } else if (val.includes('right')) { |
| | | style += ';justify-content: right' |
| | | } |
| | | } |
| | | style = (border ? `;border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'}` + (spacing ? '' : ';border-right:0;border-bottom:0') : '') + (padding ? `;padding:${padding}px` : '') + ';' + style |
| | | // å¤çååå¹¶ |
| | | if (td.attrs.colspan) { |
| | | style += `;grid-column-start:${col};grid-column-end:${col + parseInt(td.attrs.colspan)}` |
| | | if (!td.attrs.rowspan) { |
| | | style += `;grid-row-start:${row};grid-row-end:${row + 1}` |
| | | } |
| | | col += parseInt(td.attrs.colspan) - 1 |
| | | } |
| | | // å¤çè¡åå¹¶ |
| | | if (td.attrs.rowspan) { |
| | | style += `;grid-row-start:${row};grid-row-end:${row + parseInt(td.attrs.rowspan)}` |
| | | if (!td.attrs.colspan) { |
| | | style += `;grid-column-start:${col};grid-column-end:${col + 1}` |
| | | } |
| | | // è®°å½ä¸æ¹åå
æ ¼è¢«å ç¨ |
| | | for (let rowspan = 1; rowspan < td.attrs.rowspan; rowspan++) { |
| | | for (let colspan = 0; colspan < (td.attrs.colspan || 1); colspan++) { |
| | | map[(row + rowspan) + '.' + (col - colspan)] = 1 |
| | | } |
| | | } |
| | | } |
| | | if (style) { |
| | | td.attrs.style = style |
| | | } |
| | | cells.push(td) |
| | | col++ |
| | | } |
| | | } |
| | | if (row === 1) { |
| | | let temp = '' |
| | | for (let i = 1; i < col; i++) { |
| | | temp += (width[i] ? width[i] : 'auto') + ' ' |
| | | } |
| | | styleObj['grid-template-columns'] = temp |
| | | } |
| | | } |
| | | node.children = cells |
| | | } else { |
| | | // 没æä½¿ç¨åå¹¶åå
æ ¼çè¡¨æ ¼éè¿ table å¸å±å®ç° |
| | | if (node.c) { |
| | | styleObj.display = 'table' |
| | | } |
| | | if (!isNaN(spacing)) { |
| | | styleObj['border-spacing'] = spacing + 'px' |
| | | } |
| | | if (border || padding || node.c) { |
| | | // éå |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | const td = nodes[i] |
| | | if (node.c) { |
| | | td.c = 1 |
| | | } |
| | | if (td.name === 'th' || td.name === 'td') { |
| | | if (border) { |
| | | td.attrs.style = `border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'};${td.attrs.style || ''}` |
| | | } |
| | | if (padding) { |
| | | td.attrs.style = `padding:${padding}px;${td.attrs.style || ''}` |
| | | } |
| | | } else if (td.children) { |
| | | traversal(td.children) |
| | | } |
| | | } |
| | | })(children) |
| | | } |
| | | } |
| | | // ç»è¡¨æ ¼æ·»å ä¸ä¸ªåç¬çæ¨ªåæ»å¨å± |
| | | if (this.options.scrollTable && !(attrs.style || '').includes('inline')) { |
| | | const table = Object.assign({}, node) |
| | | node.name = 'div' |
| | | node.attrs = { |
| | | style: 'overflow-x:auto;padding:1px' |
| | | } |
| | | node.children = [table] |
| | | attrs = table.attrs |
| | | } |
| | | } else if ((node.name === 'tbody' || node.name === 'tr') && node.flag && node.c) { |
| | | node.flag = undefined; |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].name === 'td') { |
| | | // é¢è²æ ·å¼è®¾ç½®ç»åå
æ ¼é¿å
丢失 |
| | | for (const style of ['color', 'background', 'background-color']) { |
| | | if (styleObj[style]) { |
| | | nodes[i].attrs.style = style + ':' + styleObj[style] + ';' + (nodes[i].attrs.style || '') |
| | | } |
| | | } |
| | | } else { |
| | | traversal(nodes[i].children || []) |
| | | } |
| | | } |
| | | })(children) |
| | | } else if ((node.name === 'td' || node.name === 'th') && (attrs.colspan || attrs.rowspan)) { |
| | | for (let i = this.stack.length; i--;) { |
| | | if (this.stack[i].name === 'table' || this.stack[i].name === 'tbody' || this.stack[i].name === 'tr') { |
| | | this.stack[i].flag = 1 // æç¤ºå«æåå¹¶åå
æ ¼ |
| | | } |
| | | } |
| | | } else if (node.name === 'ruby') { |
| | | // è½¬æ¢ ruby |
| | | node.name = 'span' |
| | | for (let i = 0; i < children.length - 1; i++) { |
| | | if (children[i].type === 'text' && children[i + 1].name === 'rt') { |
| | | children[i] = { |
| | | name: 'span', |
| | | attrs: { |
| | | style: 'display:inline-block;text-align:center' |
| | | }, |
| | | children: [{ |
| | | name: 'div', |
| | | attrs: { |
| | | style: 'font-size:50%;' + (children[i + 1].attrs.style || '') |
| | | }, |
| | | children: children[i + 1].children |
| | | }, children[i]] |
| | | } |
| | | children.splice(i + 1, 1) |
| | | } |
| | | } |
| | | } |
| | | |
| | | if ((styleObj.display || '').includes('flex') && !node.c) { |
| | | for (let i = children.length; i--;) { |
| | | const item = children[i] |
| | | if (item.f) { |
| | | item.attrs.style = (item.attrs.style || '') + item.f |
| | | item.f = undefined |
| | | } |
| | | } |
| | | } |
| | | |
| | | // flex å¸å±æ¶é¨åæ ·å¼éè¦æåå° rich-text å¤å± |
| | | const flex = parent && ((parent.attrs.style || '').includes('flex') || (parent.attrs.style || '').includes('grid')) && !node.c |
| | | // #ifdef MP-WEIXIN || MP-QQ |
| | | && !(styleObj.display || '').includes('inline') // eslint-disable-line |
| | | // #endif |
| | | if (flex) { |
| | | node.f = ';max-width:100%' |
| | | } |
| | | |
| | | if (children.length >= 50 && node.c && !(styleObj.display || '').includes('flex')) { |
| | | mergeNodes(children) |
| | | } |
| | | |
| | | for (const key in styleObj) { |
| | | if (styleObj[key]) { |
| | | const val = `;${key}:${styleObj[key].replace(' !important', '')}` |
| | | if (flex && ((key.includes('flex') && key !== 'flex-direction') || key === 'align-self' || key.includes('grid') || styleObj[key][0] === '-' || (key.includes('width') && val.includes('%')))) { |
| | | node.f += val |
| | | if (key === 'width') { |
| | | attrs.style += ';width:100%' |
| | | } |
| | | } else { |
| | | attrs.style += val |
| | | } |
| | | } |
| | | } |
| | | attrs.style = attrs.style.substr(1) || undefined |
| | | // #ifdef MP-BAIDU |
| | | if (!attrs.style) { |
| | | delete attrs.style |
| | | } |
| | | // #endif |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°ææ¬ |
| | | * @param {String} text ææ¬å
容 |
| | | */ |
| | | Parser.prototype.onText = function (text) { |
| | | if (!this.pre) { |
| | | // å并空ç½ç¬¦ |
| | | let trim = '' |
| | | let flag |
| | | for (let i = 0, len = text.length; i < len; i++) { |
| | | if (!blankChar[text[i]]) { |
| | | trim += text[i] |
| | | } else { |
| | | if (trim[trim.length - 1] !== ' ') { |
| | | trim += ' ' |
| | | } |
| | | if (text[i] === '\n' && !flag) { |
| | | flag = true |
| | | } |
| | | } |
| | | } |
| | | // å»é¤å«ææ¢è¡ç¬¦ç空串 |
| | | if (trim === ' ' && flag) return |
| | | text = trim |
| | | } |
| | | const node = Object.create(null) |
| | | node.type = 'text' |
| | | node.text = decodeEntity(text) |
| | | if (this.hook(node)) { |
| | | // #ifdef MP-WEIXIN |
| | | if (this.options.selectable === 'force' && system.includes('iOS') && !wx.canIUse('rich-text.user-select')) { |
| | | this.expose() |
| | | } |
| | | // #endif |
| | | const siblings = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes |
| | | siblings.push(node) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description html è¯æ³åæå¨ |
| | | * @param {Object} handler é«å±å¤çå¨ |
| | | */ |
| | | function Lexer (handler) { |
| | | this.handler = handler |
| | | } |
| | | |
| | | /** |
| | | * @description æ§è¡è§£æ |
| | | * @param {String} content è¦è§£æçææ¬ |
| | | */ |
| | | Lexer.prototype.parse = function (content) { |
| | | this.content = content || '' |
| | | this.i = 0 // æ è®°è§£æä½ç½® |
| | | this.start = 0 // æ è®°ä¸ä¸ªåè¯çå¼å§ä½ç½® |
| | | this.state = this.text // å½åç¶æ |
| | | for (let len = this.content.length; this.i !== -1 && this.i < len;) { |
| | | this.state() |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description æ£æ¥æ ç¾æ¯å¦éå |
| | | * @param {String} method 妿éåè¦è¿è¡çæä½ |
| | | * @returns {Boolean} æ¯å¦éå |
| | | * @private |
| | | */ |
| | | Lexer.prototype.checkClose = function (method) { |
| | | const selfClose = this.content[this.i] === '/' |
| | | if (this.content[this.i] === '>' || (selfClose && this.content[this.i + 1] === '>')) { |
| | | if (method) { |
| | | this.handler[method](this.content.substring(this.start, this.i)) |
| | | } |
| | | this.i += selfClose ? 2 : 1 |
| | | this.start = this.i |
| | | this.handler.onOpenTag(selfClose) |
| | | if (this.handler.tagName === 'script') { |
| | | this.i = this.content.indexOf('</', this.i) |
| | | if (this.i !== -1) { |
| | | this.i += 2 |
| | | this.start = this.i |
| | | } |
| | | this.state = this.endTag |
| | | } else { |
| | | this.state = this.text |
| | | } |
| | | return true |
| | | } |
| | | return false |
| | | } |
| | | |
| | | /** |
| | | * @description ææ¬ç¶æ |
| | | * @private |
| | | */ |
| | | Lexer.prototype.text = function () { |
| | | this.i = this.content.indexOf('<', this.i) // æ¥æ¾æè¿çæ ç¾ |
| | | if (this.i === -1) { |
| | | // æ²¡ææ ç¾äº |
| | | if (this.start < this.content.length) { |
| | | this.handler.onText(this.content.substring(this.start, this.content.length)) |
| | | } |
| | | return |
| | | } |
| | | const c = this.content[this.i + 1] |
| | | if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) { |
| | | // æ ç¾å¼å¤´ |
| | | if (this.start !== this.i) { |
| | | this.handler.onText(this.content.substring(this.start, this.i)) |
| | | } |
| | | this.start = ++this.i |
| | | this.state = this.tagName |
| | | } else if (c === '/' || c === '!' || c === '?') { |
| | | if (this.start !== this.i) { |
| | | this.handler.onText(this.content.substring(this.start, this.i)) |
| | | } |
| | | const next = this.content[this.i + 2] |
| | | if (c === '/' && ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z'))) { |
| | | // æ ç¾ç»å°¾ |
| | | this.i += 2 |
| | | this.start = this.i |
| | | this.state = this.endTag |
| | | return |
| | | } |
| | | // å¤ç注é |
| | | let end = '-->' |
| | | if (c !== '!' || this.content[this.i + 2] !== '-' || this.content[this.i + 3] !== '-') { |
| | | end = '>' |
| | | } |
| | | this.i = this.content.indexOf(end, this.i) |
| | | if (this.i !== -1) { |
| | | this.i += end.length |
| | | this.start = this.i |
| | | } |
| | | } else { |
| | | this.i++ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description æ ç¾åç¶æ |
| | | * @private |
| | | */ |
| | | Lexer.prototype.tagName = function () { |
| | | if (blankChar[this.content[this.i]]) { |
| | | // è§£æå°æ ç¾å |
| | | this.handler.onTagName(this.content.substring(this.start, this.i)) |
| | | while (blankChar[this.content[++this.i]]); |
| | | if (this.i < this.content.length && !this.checkClose()) { |
| | | this.start = this.i |
| | | this.state = this.attrName |
| | | } |
| | | } else if (!this.checkClose('onTagName')) { |
| | | this.i++ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 屿§åç¶æ |
| | | * @private |
| | | */ |
| | | Lexer.prototype.attrName = function () { |
| | | let c = this.content[this.i] |
| | | if (blankChar[c] || c === '=') { |
| | | // è§£æå°å±æ§å |
| | | this.handler.onAttrName(this.content.substring(this.start, this.i)) |
| | | let needVal = c === '=' |
| | | const len = this.content.length |
| | | while (++this.i < len) { |
| | | c = this.content[this.i] |
| | | if (!blankChar[c]) { |
| | | if (this.checkClose()) return |
| | | if (needVal) { |
| | | // çå·åéå°ç¬¬ä¸ä¸ªé空å符 |
| | | this.start = this.i |
| | | this.state = this.attrVal |
| | | return |
| | | } |
| | | if (this.content[this.i] === '=') { |
| | | needVal = true |
| | | } else { |
| | | this.start = this.i |
| | | this.state = this.attrName |
| | | return |
| | | } |
| | | } |
| | | } |
| | | } else if (!this.checkClose('onAttrName')) { |
| | | this.i++ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 屿§å¼ç¶æ |
| | | * @private |
| | | */ |
| | | Lexer.prototype.attrVal = function () { |
| | | const c = this.content[this.i] |
| | | const len = this.content.length |
| | | if (c === '"' || c === "'") { |
| | | // æåå·ç屿§ |
| | | this.start = ++this.i |
| | | this.i = this.content.indexOf(c, this.i) |
| | | if (this.i === -1) return |
| | | this.handler.onAttrVal(this.content.substring(this.start, this.i)) |
| | | } else { |
| | | // 没æåå·ç屿§ |
| | | for (; this.i < len; this.i++) { |
| | | if (blankChar[this.content[this.i]]) { |
| | | this.handler.onAttrVal(this.content.substring(this.start, this.i)) |
| | | break |
| | | } else if (this.checkClose('onAttrVal')) return |
| | | } |
| | | } |
| | | while (blankChar[this.content[++this.i]]); |
| | | if (this.i < len && !this.checkClose()) { |
| | | this.start = this.i |
| | | this.state = this.attrName |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description ç»ææ ç¾ç¶æ |
| | | * @returns {String} ç»æçæ ç¾å |
| | | * @private |
| | | */ |
| | | Lexer.prototype.endTag = function () { |
| | | const c = this.content[this.i] |
| | | if (blankChar[c] || c === '>' || c === '/') { |
| | | this.handler.onCloseTag(this.content.substring(this.start, this.i)) |
| | | if (c !== '>') { |
| | | this.i = this.content.indexOf('>', this.i) |
| | | if (this.i === -1) return |
| | | } |
| | | this.start = ++this.i |
| | | this.state = this.text |
| | | } else { |
| | | this.i++ |
| | | } |
| | | } |
| | | |
| | | module.exports = Parser |
New file |
| | |
| | | <template> |
| | | <view id="_root" :class="(selectable?'_select ':'')+'_root'" :style="containerStyle"> |
| | | <slot v-if="!nodes[0]" /> |
| | | <!-- #ifndef APP-PLUS-NVUE --> |
| | | <node v-else :childs="nodes" :opts="[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]" name="span" /> |
| | | <!-- #endif --> |
| | | <!-- #ifdef APP-PLUS-NVUE --> |
| | | <web-view ref="web" src="/static/app-plus/mp-html/local.html" :style="'margin-top:-2px;height:' + height + 'px'" @onPostMessage="_onMessage" /> |
| | | <!-- #endif --> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | /** |
| | | * mp-html v2.5.1 |
| | | * @description 坿æ¬ç»ä»¶ |
| | | * @tutorial https://github.com/jin-yufeng/mp-html |
| | | * @property {String} container-style 容å¨çæ ·å¼ |
| | | * @property {String} content ç¨äºæ¸²æç html å符串 |
| | | * @property {Boolean} copy-link æ¯å¦å
许å¤é¨é¾æ¥è¢«ç¹å»æ¶èªå¨å¤å¶ |
| | | * @property {String} domain 主ååï¼ç¨äºæ¼æ¥é¾æ¥ |
| | | * @property {String} error-img å¾çåºéæ¶çå ä½å¾é¾æ¥ |
| | | * @property {Boolean} lazy-load æ¯å¦å¼å¯å¾çæå è½½ |
| | | * @property {string} loading-img å¾çå è½½è¿ç¨ä¸çå ä½å¾é¾æ¥ |
| | | * @property {Boolean} pause-video æ¯å¦å¨ææ¾ä¸ä¸ªè§é¢æ¶èªå¨æåå
¶ä»è§é¢ |
| | | * @property {Boolean} preview-img æ¯å¦å
许å¾ç被ç¹å»æ¶èªå¨é¢è§ |
| | | * @property {Boolean} scroll-table æ¯å¦ç»æ¯ä¸ªè¡¨æ ¼æ·»å ä¸ä¸ªæ»å¨å±ä½¿å
¶è½åç¬æ¨ªåæ»å¨ |
| | | * @property {Boolean | String} selectable æ¯å¦å¼å¯é¿æå¤å¶ |
| | | * @property {Boolean} set-title æ¯å¦å° title æ ç¾çå
容设置å°é¡µé¢æ é¢ |
| | | * @property {Boolean} show-img-menu æ¯å¦å
许å¾çè¢«é¿ææ¶æ¾ç¤ºèå |
| | | * @property {Object} tag-style æ ç¾çé»è®¤æ ·å¼ |
| | | * @property {Boolean | Number} use-anchor æ¯å¦ä½¿ç¨éç¹é¾æ¥ |
| | | * @event {Function} load dom ç»æå è½½å®æ¯æ¶è§¦å |
| | | * @event {Function} ready ææå¾çå è½½å®æ¯æ¶è§¦å |
| | | * @event {Function} imgtap å¾ç被ç¹å»æ¶è§¦å |
| | | * @event {Function} linktap 龿¥è¢«ç¹å»æ¶è§¦å |
| | | * @event {Function} play é³è§é¢ææ¾æ¶è§¦å |
| | | * @event {Function} error åªä½å è½½åºéæ¶è§¦å |
| | | */ |
| | | // #ifndef APP-PLUS-NVUE |
| | | import node from './node/node' |
| | | // #endif |
| | | import Parser from './parser' |
| | | const plugins = [] |
| | | // #ifdef APP-PLUS-NVUE |
| | | const dom = weex.requireModule('dom') |
| | | // #endif |
| | | export default { |
| | | name: 'mp-html', |
| | | data () { |
| | | return { |
| | | nodes: [], |
| | | // #ifdef APP-PLUS-NVUE |
| | | height: 3 |
| | | // #endif |
| | | } |
| | | }, |
| | | props: { |
| | | containerStyle: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | content: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | copyLink: { |
| | | type: [Boolean, String], |
| | | default: true |
| | | }, |
| | | domain: String, |
| | | errorImg: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | lazyLoad: { |
| | | type: [Boolean, String], |
| | | default: false |
| | | }, |
| | | loadingImg: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | pauseVideo: { |
| | | type: [Boolean, String], |
| | | default: true |
| | | }, |
| | | previewImg: { |
| | | type: [Boolean, String], |
| | | default: true |
| | | }, |
| | | scrollTable: [Boolean, String], |
| | | selectable: [Boolean, String], |
| | | setTitle: { |
| | | type: [Boolean, String], |
| | | default: true |
| | | }, |
| | | showImgMenu: { |
| | | type: [Boolean, String], |
| | | default: true |
| | | }, |
| | | tagStyle: Object, |
| | | useAnchor: [Boolean, Number] |
| | | }, |
| | | // #ifdef VUE3 |
| | | emits: ['load', 'ready', 'imgtap', 'linktap', 'play', 'error'], |
| | | // #endif |
| | | // #ifndef APP-PLUS-NVUE |
| | | components: { |
| | | node |
| | | }, |
| | | // #endif |
| | | watch: { |
| | | content (content) { |
| | | this.setContent(content) |
| | | } |
| | | }, |
| | | created () { |
| | | this.plugins = [] |
| | | for (let i = plugins.length; i--;) { |
| | | this.plugins.push(new plugins[i](this)) |
| | | } |
| | | }, |
| | | mounted () { |
| | | if (this.content && !this.nodes.length) { |
| | | this.setContent(this.content) |
| | | } |
| | | }, |
| | | beforeDestroy () { |
| | | this._hook('onDetached') |
| | | }, |
| | | methods: { |
| | | /** |
| | | * @description å°éç¹è·³è½¬çèå´éå®å¨ä¸ä¸ª scroll-view å
|
| | | * @param {Object} page scroll-view æå¨é¡µé¢çç¤ºä¾ |
| | | * @param {String} selector scroll-view çéæ©å¨ |
| | | * @param {String} scrollTop scroll-view scroll-top 屿§ç»å®çåéå |
| | | */ |
| | | in (page, selector, scrollTop) { |
| | | // #ifndef APP-PLUS-NVUE |
| | | if (page && selector && scrollTop) { |
| | | this._in = { |
| | | page, |
| | | selector, |
| | | scrollTop |
| | | } |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * @description éç¹è·³è½¬ |
| | | * @param {String} id è¦è·³è½¬çéç¹ id |
| | | * @param {Number} offset 跳转ä½ç½®çåç§»é |
| | | * @returns {Promise} |
| | | */ |
| | | navigateTo (id, offset) { |
| | | return new Promise((resolve, reject) => { |
| | | if (!this.useAnchor) { |
| | | reject(Error('Anchor is disabled')) |
| | | return |
| | | } |
| | | offset = offset || parseInt(this.useAnchor) || 0 |
| | | // #ifdef APP-PLUS-NVUE |
| | | if (!id) { |
| | | dom.scrollToElement(this.$refs.web, { |
| | | offset |
| | | }) |
| | | resolve() |
| | | } else { |
| | | this._navigateTo = { |
| | | resolve, |
| | | reject, |
| | | offset |
| | | } |
| | | this.$refs.web.evalJs('uni.postMessage({data:{action:"getOffset",offset:(document.getElementById(' + id + ')||{}).offsetTop}})') |
| | | } |
| | | // #endif |
| | | // #ifndef APP-PLUS-NVUE |
| | | let deep = ' ' |
| | | // #ifdef MP-WEIXIN || MP-QQ || MP-TOUTIAO |
| | | deep = '>>>' |
| | | // #endif |
| | | const selector = uni.createSelectorQuery() |
| | | // #ifndef MP-ALIPAY |
| | | .in(this._in ? this._in.page : this) |
| | | // #endif |
| | | .select((this._in ? this._in.selector : '._root') + (id ? `${deep}#${id}` : '')).boundingClientRect() |
| | | if (this._in) { |
| | | selector.select(this._in.selector).scrollOffset() |
| | | .select(this._in.selector).boundingClientRect() |
| | | } else { |
| | | // è·å scroll-view çä½ç½®åæ»å¨è·ç¦» |
| | | selector.selectViewport().scrollOffset() // è·åçªå£çæ»å¨è·ç¦» |
| | | } |
| | | selector.exec(res => { |
| | | if (!res[0]) { |
| | | reject(Error('Label not found')) |
| | | return |
| | | } |
| | | const scrollTop = res[1].scrollTop + res[0].top - (res[2] ? res[2].top : 0) + offset |
| | | if (this._in) { |
| | | // scroll-view 跳转 |
| | | this._in.page[this._in.scrollTop] = scrollTop |
| | | } else { |
| | | // 页é¢è·³è½¬ |
| | | uni.pageScrollTo({ |
| | | scrollTop, |
| | | duration: 300 |
| | | }) |
| | | } |
| | | resolve() |
| | | }) |
| | | // #endif |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * @description è·åææ¬å
容 |
| | | * @return {String} |
| | | */ |
| | | getText (nodes) { |
| | | let text = ''; |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | const node = nodes[i] |
| | | if (node.type === 'text') { |
| | | text += node.text.replace(/&/g, '&') |
| | | } else if (node.name === 'br') { |
| | | text += '\n' |
| | | } else { |
| | | // å级æ ç¾ååå æ¢è¡ |
| | | const isBlock = node.name === 'p' || node.name === 'div' || node.name === 'tr' || node.name === 'li' || (node.name[0] === 'h' && node.name[1] > '0' && node.name[1] < '7') |
| | | if (isBlock && text && text[text.length - 1] !== '\n') { |
| | | text += '\n' |
| | | } |
| | | // éå½è·ååèç¹çææ¬ |
| | | if (node.children) { |
| | | traversal(node.children) |
| | | } |
| | | if (isBlock && text[text.length - 1] !== '\n') { |
| | | text += '\n' |
| | | } else if (node.name === 'td' || node.name === 'th') { |
| | | text += '\t' |
| | | } |
| | | } |
| | | } |
| | | })(nodes || this.nodes) |
| | | return text |
| | | }, |
| | | |
| | | /** |
| | | * @description è·åå
容大å°åä½ç½® |
| | | * @return {Promise} |
| | | */ |
| | | getRect () { |
| | | return new Promise((resolve, reject) => { |
| | | uni.createSelectorQuery() |
| | | // #ifndef MP-ALIPAY |
| | | .in(this) |
| | | // #endif |
| | | .select('#_root').boundingClientRect().exec(res => res[0] ? resolve(res[0]) : reject(Error('Root label not found'))) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * @description æåææ¾åªä½ |
| | | */ |
| | | pauseMedia () { |
| | | for (let i = (this._videos || []).length; i--;) { |
| | | this._videos[i].pause() |
| | | } |
| | | // #ifdef APP-PLUS |
| | | const command = 'for(var e=document.getElementsByTagName("video"),i=e.length;i--;)e[i].pause()' |
| | | // #ifndef APP-PLUS-NVUE |
| | | let page = this.$parent |
| | | while (!page.$scope) page = page.$parent |
| | | page.$scope.$getAppWebview().evalJS(command) |
| | | // #endif |
| | | // #ifdef APP-PLUS-NVUE |
| | | this.$refs.web.evalJs(command) |
| | | // #endif |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * @description 设置åªä½ææ¾éç |
| | | * @param {Number} rate ææ¾éç |
| | | */ |
| | | setPlaybackRate (rate) { |
| | | this.playbackRate = rate |
| | | for (let i = (this._videos || []).length; i--;) { |
| | | this._videos[i].playbackRate(rate) |
| | | } |
| | | // #ifdef APP-PLUS |
| | | const command = 'for(var e=document.getElementsByTagName("video"),i=e.length;i--;)e[i].playbackRate=' + rate |
| | | // #ifndef APP-PLUS-NVUE |
| | | let page = this.$parent |
| | | while (!page.$scope) page = page.$parent |
| | | page.$scope.$getAppWebview().evalJS(command) |
| | | // #endif |
| | | // #ifdef APP-PLUS-NVUE |
| | | this.$refs.web.evalJs(command) |
| | | // #endif |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * @description 设置å
容 |
| | | * @param {String} content html å
容 |
| | | * @param {Boolean} append æ¯å¦å¨å°¾é¨è¿½å |
| | | */ |
| | | setContent (content, append) { |
| | | if (!append || !this.imgList) { |
| | | this.imgList = [] |
| | | } |
| | | const nodes = new Parser(this).parse(content) |
| | | // #ifdef APP-PLUS-NVUE |
| | | if (this._ready) { |
| | | this._set(nodes, append) |
| | | } |
| | | // #endif |
| | | this.$set(this, 'nodes', append ? (this.nodes || []).concat(nodes) : nodes) |
| | | |
| | | // #ifndef APP-PLUS-NVUE |
| | | this._videos = [] |
| | | this.$nextTick(() => { |
| | | this._hook('onLoad') |
| | | this.$emit('load') |
| | | }) |
| | | |
| | | if (this.lazyLoad || this.imgList._unloadimgs < this.imgList.length / 2) { |
| | | // 设置æå è½½ï¼æ¯ 350ms è·åé«åº¦ï¼ä¸åå认为å è½½å®æ¯ |
| | | let height = 0 |
| | | const callback = rect => { |
| | | if (!rect || !rect.height) rect = {} |
| | | // 350ms æ»é«åº¦æ åå就触å ready äºä»¶ |
| | | if (rect.height === height) { |
| | | this.$emit('ready', rect) |
| | | } else { |
| | | height = rect.height |
| | | setTimeout(() => { |
| | | this.getRect().then(callback).catch(callback) |
| | | }, 350) |
| | | } |
| | | } |
| | | this.getRect().then(callback).catch(callback) |
| | | } else { |
| | | // æªè®¾ç½®æå è½½ï¼çå¾
ææå¾çå è½½å®æ¯ |
| | | if (!this.imgList._unloadimgs) { |
| | | this.getRect().then(rect => { |
| | | this.$emit('ready', rect) |
| | | }).catch(() => { |
| | | this.$emit('ready', {}) |
| | | }) |
| | | } |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * @description è°ç¨æä»¶é©å彿° |
| | | */ |
| | | _hook (name) { |
| | | for (let i = plugins.length; i--;) { |
| | | if (this.plugins[i][name]) { |
| | | this.plugins[i][name]() |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // #ifdef APP-PLUS-NVUE |
| | | /** |
| | | * @description 设置å
容 |
| | | */ |
| | | _set (nodes, append) { |
| | | this.$refs.web.evalJs('setContent(' + JSON.stringify(nodes).replace(/%22/g, '') + ',' + JSON.stringify([this.containerStyle.replace(/(?:margin|padding)[^;]+/g, ''), this.errorImg, this.loadingImg, this.pauseVideo, this.scrollTable, this.selectable]) + ',' + append + ')') |
| | | }, |
| | | |
| | | /** |
| | | * @description æ¥æ¶å° web-view æ¶æ¯ |
| | | */ |
| | | _onMessage (e) { |
| | | const message = e.detail.data[0] |
| | | switch (message.action) { |
| | | // web-view åå§å宿¯ |
| | | case 'onJSBridgeReady': |
| | | this._ready = true |
| | | if (this.nodes) { |
| | | this._set(this.nodes) |
| | | } |
| | | break |
| | | // å
容 dom å è½½å®æ¯ |
| | | case 'onLoad': |
| | | this.height = message.height |
| | | this._hook('onLoad') |
| | | this.$emit('load') |
| | | break |
| | | // ææå¾çå è½½å®æ¯ |
| | | case 'onReady': |
| | | this.getRect().then(res => { |
| | | this.$emit('ready', res) |
| | | }).catch(() => { |
| | | this.$emit('ready', {}) |
| | | }) |
| | | break |
| | | // æ»é«åº¦åçåå |
| | | case 'onHeightChange': |
| | | this.height = message.height |
| | | break |
| | | // å¾çç¹å» |
| | | case 'onImgTap': |
| | | this.$emit('imgtap', message.attrs) |
| | | if (this.previewImg) { |
| | | uni.previewImage({ |
| | | current: parseInt(message.attrs.i), |
| | | urls: this.imgList |
| | | }) |
| | | } |
| | | break |
| | | // 龿¥ç¹å» |
| | | case 'onLinkTap': { |
| | | const href = message.attrs.href |
| | | this.$emit('linktap', message.attrs) |
| | | if (href) { |
| | | // éç¹è·³è½¬ |
| | | if (href[0] === '#') { |
| | | if (this.useAnchor) { |
| | | dom.scrollToElement(this.$refs.web, { |
| | | offset: message.offset |
| | | }) |
| | | } |
| | | } else if (href.includes('://')) { |
| | | // æå¼å¤é¾ |
| | | if (this.copyLink) { |
| | | plus.runtime.openWeb(href) |
| | | } |
| | | } else { |
| | | uni.navigateTo({ |
| | | url: href, |
| | | fail () { |
| | | uni.switchTab({ |
| | | url: href |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | break |
| | | } |
| | | case 'onPlay': |
| | | this.$emit('play') |
| | | break |
| | | // è·åå°éç¹çåç§»é |
| | | case 'getOffset': |
| | | if (typeof message.offset === 'number') { |
| | | dom.scrollToElement(this.$refs.web, { |
| | | offset: message.offset + this._navigateTo.offset |
| | | }) |
| | | this._navigateTo.resolve() |
| | | } else { |
| | | this._navigateTo.reject(Error('Label not found')) |
| | | } |
| | | break |
| | | // ç¹å» |
| | | case 'onClick': |
| | | this.$emit('tap') |
| | | this.$emit('click') |
| | | break |
| | | // åºé |
| | | case 'onError': |
| | | this.$emit('error', { |
| | | source: message.source, |
| | | attrs: message.attrs |
| | | }) |
| | | } |
| | | } |
| | | // #endif |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | /* #ifndef APP-PLUS-NVUE */ |
| | | /* æ ¹èç¹æ ·å¼ */ |
| | | ._root { |
| | | padding: 1px 0; |
| | | overflow-x: auto; |
| | | overflow-y: hidden; |
| | | -webkit-overflow-scrolling: touch; |
| | | } |
| | | |
| | | /* é¿æå¤å¶ */ |
| | | ._select { |
| | | user-select: text; |
| | | } |
| | | /* #endif */ |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <view :id="attrs.id" :class="'_block _'+name+' '+attrs.class" :style="attrs.style"> |
| | | <block v-for="(n, i) in childs" v-bind:key="i"> |
| | | <!-- å¾ç --> |
| | | <!-- å ä½å¾ --> |
| | | <image v-if="n.name==='img'&&!n.t&&((opts[1]&&!ctrl[i])||ctrl[i]<0)" class="_img" :style="n.attrs.style" :src="ctrl[i]<0?opts[2]:opts[1]" mode="widthFix" /> |
| | | <!-- æ¾ç¤ºå¾ç --> |
| | | <!-- #ifdef H5 || (APP-PLUS && VUE2) --> |
| | | <img v-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" /> |
| | | <!-- #endif --> |
| | | <!-- #ifndef H5 || (APP-PLUS && VUE2) --> |
| | | <!-- è¡¨æ ¼ä¸çå¾çï¼ä½¿ç¨ rich-text 鲿¢å¤§å°ä¸æ£ç¡® --> |
| | | <rich-text v-if="n.name==='img'&&n.t" :style="'display:'+n.t" :nodes="[{attrs:{style:n.attrs.style||'',src:n.attrs.src},name:'img'}]" :data-i="i" @tap.stop="imgTap" /> |
| | | <!-- #endif --> |
| | | <!-- #ifdef APP-HARMONY --> |
| | | <image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+ctrl[i]+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" /> |
| | | <!-- #endif --> |
| | | <!-- #ifndef H5 || APP-PLUS || MP-KUAISHOU --> |
| | | <image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;height:1px;'+n.attrs.style" :src="n.attrs.src" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))" :lazy-load="opts[0]" :webp="n.webp" :show-menu-by-longpress="opts[3]&&!n.attrs.ignore" :image-menu-prevent="!opts[3]||n.attrs.ignore" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" /> |
| | | <!-- #endif --> |
| | | <!-- #ifdef MP-KUAISHOU --> |
| | | <image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+n.attrs.style" :src="n.attrs.src" :lazy-load="opts[0]" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap"></image> |
| | | <!-- #endif --> |
| | | <!-- #ifdef APP-PLUS && VUE3 --> |
| | | <image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||''))" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" /> |
| | | <!-- #endif --> |
| | | <!-- ææ¬ --> |
| | | <!-- #ifdef MP-WEIXIN --> |
| | | <text v-else-if="n.text" :user-select="opts[4]=='force'&&isiOS" decode>{{n.text}}</text> |
| | | <!-- #endif --> |
| | | <!-- #ifndef MP-WEIXIN || MP-BAIDU || MP-ALIPAY || MP-TOUTIAO --> |
| | | <text v-else-if="n.text" decode>{{n.text}}</text> |
| | | <!-- #endif --> |
| | | <text v-else-if="n.name==='br'">\n</text> |
| | | <!-- 龿¥ --> |
| | | <view v-else-if="n.name==='a'" :id="n.attrs.id" :class="(n.attrs.href?'_a ':'')+n.attrs.class" hover-class="_hover" :style="'display:inline;'+n.attrs.style" :data-i="i" @tap.stop="linkTap"> |
| | | <node name="span" :childs="n.children" :opts="opts" style="display:inherit" /> |
| | | </view> |
| | | <!-- è§é¢ --> |
| | | <!-- #ifdef APP-PLUS --> |
| | | <view v-else-if="n.html" :id="n.attrs.id" :class="'_video '+n.attrs.class" :style="n.attrs.style" v-html="n.html" :data-i="i" @vplay.stop="play" /> |
| | | <!-- #endif --> |
| | | <!-- #ifndef APP-PLUS --> |
| | | <video v-else-if="n.name==='video'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :autoplay="n.attrs.autoplay" :controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :object-fit="n.attrs['object-fit']" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" @play="play" @error="mediaError" /> |
| | | <!-- #endif --> |
| | | <!-- #ifdef H5 || APP-PLUS --> |
| | | <iframe v-else-if="n.name==='iframe'" :style="n.attrs.style" :allowfullscreen="n.attrs.allowfullscreen" :frameborder="n.attrs.frameborder" :src="n.attrs.src" /> |
| | | <embed v-else-if="n.name==='embed'" :style="n.attrs.style" :src="n.attrs.src" /> |
| | | <!-- #endif --> |
| | | <!-- #ifndef MP-TOUTIAO || ((H5 || APP-PLUS) && VUE3) --> |
| | | <!-- é³é¢ --> |
| | | <audio v-else-if="n.name==='audio'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :author="n.attrs.author" :controls="n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster" :src="n.src[ctrl[i]||0]" :data-i="i" @play="play" @error="mediaError" /> |
| | | <!-- #endif --> |
| | | <view v-else-if="(n.name==='table'&&n.c)||n.name==='li'" :id="n.attrs.id" :class="'_'+n.name+' '+n.attrs.class" :style="n.attrs.style"> |
| | | <node v-if="n.name==='li'" :childs="n.children" :opts="opts" /> |
| | | <view v-else v-for="(tbody, x) in n.children" v-bind:key="x" :class="'_'+tbody.name+' '+tbody.attrs.class" :style="tbody.attrs.style"> |
| | | <node v-if="tbody.name==='td'||tbody.name==='th'" :childs="tbody.children" :opts="opts" /> |
| | | <block v-else v-for="(tr, y) in tbody.children" v-bind:key="y"> |
| | | <view v-if="tr.name==='td'||tr.name==='th'" :class="'_'+tr.name+' '+tr.attrs.class" :style="tr.attrs.style"> |
| | | <node :childs="tr.children" :opts="opts" /> |
| | | </view> |
| | | <view v-else :class="'_'+tr.name+' '+tr.attrs.class" :style="tr.attrs.style"> |
| | | <view v-for="(td, z) in tr.children" v-bind:key="z" :class="'_'+td.name+' '+td.attrs.class" :style="td.attrs.style"> |
| | | <node :childs="td.children" :opts="opts" /> |
| | | </view> |
| | | </view> |
| | | </block> |
| | | </view> |
| | | </view> |
| | | <!-- insert --> |
| | | <!-- å¯ææ¬ --> |
| | | <!-- #ifdef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) --> |
| | | <rich-text v-else-if="!n.c&&!handler.isInline(n.name, n.attrs.style)" :id="n.attrs.id" :style="n.f" :user-select="opts[4]" :nodes="[n]" /> |
| | | <!-- #endif --> |
| | | <!-- #ifndef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) --> |
| | | <rich-text v-else-if="!n.c" :id="n.attrs.id" :style="'display:inline;'+n.f" :preview="false" :selectable="opts[4]" :user-select="opts[4]" :nodes="[n]" /> |
| | | <!-- #endif --> |
| | | <!-- ç»§ç»éå½ --> |
| | | <view v-else-if="n.c===2" :id="n.attrs.id" :class="'_block _'+n.name+' '+n.attrs.class" :style="n.f+';'+n.attrs.style"> |
| | | <node v-for="(n2, j) in n.children" v-bind:key="j" :style="n2.f" :name="n2.name" :attrs="n2.attrs" :childs="n2.children" :opts="opts" /> |
| | | </view> |
| | | <node v-else :style="n.f" :name="n.name" :attrs="n.attrs" :childs="n.children" :opts="opts" /> |
| | | </block> |
| | | </view> |
| | | </template> |
| | | <script module="handler" lang="wxs"> |
| | | // è¡å
æ ç¾å表 |
| | | var inlineTags = { |
| | | abbr: true, |
| | | b: true, |
| | | big: true, |
| | | code: true, |
| | | del: true, |
| | | em: true, |
| | | i: true, |
| | | ins: true, |
| | | label: true, |
| | | q: true, |
| | | small: true, |
| | | span: true, |
| | | strong: true, |
| | | sub: true, |
| | | sup: true |
| | | } |
| | | /** |
| | | * @description 夿æ¯å¦ä¸ºè¡å
æ ç¾ |
| | | */ |
| | | module.exports = { |
| | | isInline: function (tagName, style) { |
| | | return inlineTags[tagName] || (style || '').indexOf('display:inline') !== -1 |
| | | } |
| | | } |
| | | </script> |
| | | <script> |
| | | import node from './node' |
| | | export default { |
| | | name: 'node', |
| | | options: { |
| | | // #ifdef MP-WEIXIN |
| | | virtualHost: true, |
| | | // #endif |
| | | // #ifdef MP-TOUTIAO |
| | | addGlobalClass: false |
| | | // #endif |
| | | }, |
| | | data () { |
| | | return { |
| | | ctrl: {}, |
| | | // #ifdef MP-WEIXIN |
| | | isiOS: uni.getSystemInfoSync().system.includes('iOS') |
| | | // #endif |
| | | } |
| | | }, |
| | | props: { |
| | | name: String, |
| | | attrs: { |
| | | type: Object, |
| | | default () { |
| | | return {} |
| | | } |
| | | }, |
| | | childs: Array, |
| | | opts: Array |
| | | }, |
| | | components: { |
| | | // #ifndef ((H5 || APP-PLUS) && VUE3) || APP-HARMONY |
| | | node |
| | | // #endif |
| | | }, |
| | | mounted () { |
| | | this.$nextTick(() => { |
| | | for (this.root = this.$parent; this.root.$options.name !== 'mp-html'; this.root = this.root.$parent); |
| | | }) |
| | | // #ifdef H5 || APP-PLUS |
| | | if (this.opts[0]) { |
| | | let i |
| | | for (i = this.childs.length; i--;) { |
| | | if (this.childs[i].name === 'img') break |
| | | } |
| | | if (i !== -1) { |
| | | this.observer = uni.createIntersectionObserver(this).relativeToViewport({ |
| | | top: 500, |
| | | bottom: 500 |
| | | }) |
| | | this.observer.observe('._img', res => { |
| | | if (res.intersectionRatio) { |
| | | this.$set(this.ctrl, 'load', 1) |
| | | this.observer.disconnect() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | // #endif |
| | | }, |
| | | beforeDestroy () { |
| | | // #ifdef H5 || APP-PLUS |
| | | if (this.observer) { |
| | | this.observer.disconnect() |
| | | } |
| | | // #endif |
| | | }, |
| | | methods: { |
| | | // #ifdef MP-WEIXIN |
| | | toJSON () { return this }, |
| | | // #endif |
| | | /** |
| | | * @description ææ¾è§é¢äºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | play (e) { |
| | | const i = e.currentTarget.dataset.i |
| | | const node = this.childs[i] |
| | | this.root.$emit('play', { |
| | | source: node.name, |
| | | attrs: { |
| | | ...node.attrs, |
| | | src: node.src[this.ctrl[i] || 0] |
| | | } |
| | | }) |
| | | // #ifndef APP-PLUS |
| | | if (this.root.pauseVideo) { |
| | | let flag = false |
| | | const id = e.target.id |
| | | for (let i = this.root._videos.length; i--;) { |
| | | if (this.root._videos[i].id === id) { |
| | | flag = true |
| | | } else { |
| | | this.root._videos[i].pause() // èªå¨æåå
¶ä»è§é¢ |
| | | } |
| | | } |
| | | // å°èªå·±å å
¥å表 |
| | | if (!flag) { |
| | | const ctx = uni.createVideoContext(id |
| | | // #ifndef MP-BAIDU |
| | | , this |
| | | // #endif |
| | | ) |
| | | ctx.id = id |
| | | if (this.root.playbackRate) { |
| | | ctx.playbackRate(this.root.playbackRate) |
| | | } |
| | | this.root._videos.push(ctx) |
| | | } |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * @description å¾çç¹å»äºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | imgTap (e) { |
| | | const node = this.childs[e.currentTarget.dataset.i] |
| | | if (node.a) { |
| | | this.linkTap(node.a) |
| | | return |
| | | } |
| | | if (node.attrs.ignore) return |
| | | // #ifdef H5 || APP-PLUS |
| | | node.attrs.src = node.attrs.src || node.attrs['data-src'] |
| | | // #endif |
| | | // #ifndef APP-HARMONY |
| | | this.root.$emit('imgtap', node.attrs) |
| | | // #endif |
| | | // #ifdef APP-HARMONY |
| | | this.root.$emit('imgtap', { |
| | | ...node.attrs |
| | | }) |
| | | // #endif |
| | | // èªå¨é¢è§å¾ç |
| | | if (this.root.previewImg) { |
| | | uni.previewImage({ |
| | | // #ifdef MP-WEIXIN |
| | | showmenu: this.root.showImgMenu, |
| | | // #endif |
| | | // #ifdef MP-ALIPAY |
| | | enablesavephoto: this.root.showImgMenu, |
| | | enableShowPhotoDownload: this.root.showImgMenu, |
| | | // #endif |
| | | current: parseInt(node.attrs.i), |
| | | urls: this.root.imgList |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description å¾çé¿æ |
| | | */ |
| | | imgLongTap (e) { |
| | | // #ifdef APP-PLUS |
| | | const attrs = this.childs[e.currentTarget.dataset.i].attrs |
| | | if (this.opts[3] && !attrs.ignore) { |
| | | uni.showActionSheet({ |
| | | itemList: ['ä¿åå¾ç'], |
| | | success: () => { |
| | | const save = path => { |
| | | uni.saveImageToPhotosAlbum({ |
| | | filePath: path, |
| | | success () { |
| | | uni.showToast({ |
| | | title: 'ä¿åæå' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | if (this.root.imgList[attrs.i].startsWith('http')) { |
| | | uni.downloadFile({ |
| | | url: this.root.imgList[attrs.i], |
| | | success: res => save(res.tempFilePath) |
| | | }) |
| | | } else { |
| | | save(this.root.imgList[attrs.i]) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * @description å¾çå è½½å®æäºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | imgLoad (e) { |
| | | const i = e.currentTarget.dataset.i |
| | | /* #ifndef H5 || (APP-PLUS && VUE2) */ |
| | | if (!this.childs[i].w) { |
| | | // 设置å宽度 |
| | | this.$set(this.ctrl, i, e.detail.width) |
| | | } else /* #endif */ if ((this.opts[1] && !this.ctrl[i]) || this.ctrl[i] === -1) { |
| | | // å è½½å®æ¯ï¼åæ¶å è½½ä¸å ä½å¾ |
| | | this.$set(this.ctrl, i, 1) |
| | | } |
| | | this.checkReady() |
| | | }, |
| | | |
| | | /** |
| | | * @description æ£æ¥æ¯å¦ææå¾çå è½½å®æ¯ |
| | | */ |
| | | checkReady () { |
| | | if (this.root && !this.root.lazyLoad) { |
| | | this.root._unloadimgs -= 1 |
| | | if (!this.root._unloadimgs) { |
| | | setTimeout(() => { |
| | | this.root.getRect().then(rect => { |
| | | this.root.$emit('ready', rect) |
| | | }).catch(() => { |
| | | this.root.$emit('ready', {}) |
| | | }) |
| | | }, 350) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description 龿¥ç¹å»äºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | linkTap (e) { |
| | | const node = e.currentTarget ? this.childs[e.currentTarget.dataset.i] : {} |
| | | const attrs = node.attrs || e |
| | | const href = attrs.href |
| | | this.root.$emit('linktap', Object.assign({ |
| | | innerText: this.root.getText(node.children || []) // 龿¥å
çææ¬å
容 |
| | | }, attrs)) |
| | | if (href) { |
| | | if (href[0] === '#') { |
| | | // 跳转éç¹ |
| | | this.root.navigateTo(href.substring(1)).catch(() => { }) |
| | | } else if (href.split('?')[0].includes('://')) { |
| | | // å¤å¶å¤é¨é¾æ¥ |
| | | if (this.root.copyLink) { |
| | | // #ifdef H5 |
| | | window.open(href) |
| | | // #endif |
| | | // #ifdef MP |
| | | uni.setClipboardData({ |
| | | data: href, |
| | | success: () => |
| | | uni.showToast({ |
| | | title: '龿¥å·²å¤å¶' |
| | | }) |
| | | }) |
| | | // #endif |
| | | // #ifdef APP-PLUS |
| | | plus.runtime.openWeb(href) |
| | | // #endif |
| | | } |
| | | } else { |
| | | // è·³è½¬é¡µé¢ |
| | | uni.navigateTo({ |
| | | url: href, |
| | | fail () { |
| | | uni.switchTab({ |
| | | url: href, |
| | | fail () { } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description é误äºä»¶ |
| | | * @param {Event} e |
| | | */ |
| | | mediaError (e) { |
| | | const i = e.currentTarget.dataset.i |
| | | const node = this.childs[i] |
| | | // å è½½å
¶ä»æº |
| | | if (node.name === 'video' || node.name === 'audio') { |
| | | let index = (this.ctrl[i] || 0) + 1 |
| | | if (index > node.src.length) { |
| | | index = 0 |
| | | } |
| | | if (index < node.src.length) { |
| | | this.$set(this.ctrl, i, index) |
| | | return |
| | | } |
| | | } else if (node.name === 'img') { |
| | | // #ifdef H5 && VUE3 |
| | | if (this.opts[0] && !this.ctrl.load) return |
| | | // #endif |
| | | // æ¾ç¤ºé误å ä½å¾ |
| | | if (this.opts[2]) { |
| | | this.$set(this.ctrl, i, -1) |
| | | } |
| | | this.checkReady() |
| | | } |
| | | if (this.root) { |
| | | this.root.$emit('error', { |
| | | source: node.name, |
| | | attrs: node.attrs, |
| | | // #ifndef H5 && VUE3 |
| | | errMsg: e.detail.errMsg |
| | | // #endif |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style> |
| | | /* a æ ç¾é»è®¤ææ */ |
| | | ._a { |
| | | padding: 1.5px 0 1.5px 0; |
| | | color: #366092; |
| | | word-break: break-all; |
| | | } |
| | | |
| | | /* a æ ç¾ç¹å»æææ */ |
| | | ._hover { |
| | | text-decoration: underline; |
| | | opacity: 0.7; |
| | | } |
| | | |
| | | /* å¾çé»è®¤ææ */ |
| | | ._img { |
| | | max-width: 100%; |
| | | -webkit-touch-callout: none; |
| | | } |
| | | |
| | | /* å
鍿 ·å¼ */ |
| | | |
| | | ._block { |
| | | display: block; |
| | | } |
| | | |
| | | ._b, |
| | | ._strong { |
| | | font-weight: bold; |
| | | } |
| | | |
| | | ._code { |
| | | font-family: monospace; |
| | | } |
| | | |
| | | ._del { |
| | | text-decoration: line-through; |
| | | } |
| | | |
| | | ._em, |
| | | ._i { |
| | | font-style: italic; |
| | | } |
| | | |
| | | ._h1 { |
| | | font-size: 2em; |
| | | } |
| | | |
| | | ._h2 { |
| | | font-size: 1.5em; |
| | | } |
| | | |
| | | ._h3 { |
| | | font-size: 1.17em; |
| | | } |
| | | |
| | | ._h5 { |
| | | font-size: 0.83em; |
| | | } |
| | | |
| | | ._h6 { |
| | | font-size: 0.67em; |
| | | } |
| | | |
| | | ._h1, |
| | | ._h2, |
| | | ._h3, |
| | | ._h4, |
| | | ._h5, |
| | | ._h6 { |
| | | display: block; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | ._image { |
| | | height: 1px; |
| | | } |
| | | |
| | | ._ins { |
| | | text-decoration: underline; |
| | | } |
| | | |
| | | ._li { |
| | | display: list-item; |
| | | } |
| | | |
| | | ._ol { |
| | | list-style-type: decimal; |
| | | } |
| | | |
| | | ._ol, |
| | | ._ul { |
| | | display: block; |
| | | padding-left: 40px; |
| | | margin: 1em 0; |
| | | } |
| | | |
| | | ._q::before { |
| | | content: '"'; |
| | | } |
| | | |
| | | ._q::after { |
| | | content: '"'; |
| | | } |
| | | |
| | | ._sub { |
| | | font-size: smaller; |
| | | vertical-align: sub; |
| | | } |
| | | |
| | | ._sup { |
| | | font-size: smaller; |
| | | vertical-align: super; |
| | | } |
| | | |
| | | ._thead, |
| | | ._tbody, |
| | | ._tfoot { |
| | | display: table-row-group; |
| | | } |
| | | |
| | | ._tr { |
| | | display: table-row; |
| | | } |
| | | |
| | | ._td, |
| | | ._th { |
| | | display: table-cell; |
| | | vertical-align: middle; |
| | | } |
| | | |
| | | ._th { |
| | | font-weight: bold; |
| | | text-align: center; |
| | | } |
| | | |
| | | ._ul { |
| | | list-style-type: disc; |
| | | } |
| | | |
| | | ._ul ._ul { |
| | | margin: 0; |
| | | list-style-type: circle; |
| | | } |
| | | |
| | | ._ul ._ul ._ul { |
| | | list-style-type: square; |
| | | } |
| | | |
| | | ._abbr, |
| | | ._b, |
| | | ._code, |
| | | ._del, |
| | | ._em, |
| | | ._i, |
| | | ._ins, |
| | | ._label, |
| | | ._q, |
| | | ._span, |
| | | ._strong, |
| | | ._sub, |
| | | ._sup { |
| | | display: inline; |
| | | } |
| | | |
| | | /* #ifdef APP-PLUS */ |
| | | ._video { |
| | | width: 300px; |
| | | height: 225px; |
| | | } |
| | | /* #endif */ |
| | | </style> |
New file |
| | |
| | | /** |
| | | * @fileoverview html è§£æå¨ |
| | | */ |
| | | |
| | | // é
ç½® |
| | | const config = { |
| | | // ä¿¡ä»»çæ ç¾ï¼ä¿ææ ç¾åä¸åï¼ |
| | | trustTags: makeMap('a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'), |
| | | |
| | | // å级æ ç¾ï¼è½¬ä¸º divï¼å
¶ä»çéä¿¡ä»»æ ç¾è½¬ä¸º spanï¼ |
| | | blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'), |
| | | |
| | | // #ifdef (MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE3 |
| | | // è¡å
æ ç¾ |
| | | inlineTags: makeMap('abbr,b,big,code,del,em,i,ins,label,q,small,span,strong,sub,sup'), |
| | | // #endif |
| | | |
| | | // è¦ç§»é¤çæ ç¾ |
| | | ignoreTags: makeMap('area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr'), |
| | | |
| | | // èªéåçæ ç¾ |
| | | voidTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'), |
| | | |
| | | // html å®ä½ |
| | | entities: { |
| | | lt: '<', |
| | | gt: '>', |
| | | quot: '"', |
| | | apos: "'", |
| | | ensp: '\u2002', |
| | | emsp: '\u2003', |
| | | nbsp: '\xA0', |
| | | semi: ';', |
| | | ndash: 'â', |
| | | mdash: 'â', |
| | | middot: '·', |
| | | lsquo: 'â', |
| | | rsquo: 'â', |
| | | ldquo: 'â', |
| | | rdquo: 'â', |
| | | bull: 'â¢', |
| | | hellip: 'â¦', |
| | | larr: 'â', |
| | | uarr: 'â', |
| | | rarr: 'â', |
| | | darr: 'â' |
| | | }, |
| | | |
| | | // é»è®¤çæ ç¾æ ·å¼ |
| | | tagStyle: { |
| | | // #ifndef APP-PLUS-NVUE |
| | | address: 'font-style:italic', |
| | | big: 'display:inline;font-size:1.2em', |
| | | caption: 'display:table-caption;text-align:center', |
| | | center: 'text-align:center', |
| | | cite: 'font-style:italic', |
| | | dd: 'margin-left:40px', |
| | | mark: 'background-color:yellow', |
| | | pre: 'font-family:monospace;white-space:pre', |
| | | s: 'text-decoration:line-through', |
| | | small: 'display:inline;font-size:0.8em', |
| | | strike: 'text-decoration:line-through', |
| | | u: 'text-decoration:underline' |
| | | // #endif |
| | | }, |
| | | |
| | | // svg 大å°å对ç
§è¡¨ |
| | | svgDict: { |
| | | animatetransform: 'animateTransform', |
| | | lineargradient: 'linearGradient', |
| | | viewbox: 'viewBox', |
| | | attributename: 'attributeName', |
| | | repeatcount: 'repeatCount', |
| | | repeatdur: 'repeatDur', |
| | | foreignobject: 'foreignObject' |
| | | } |
| | | } |
| | | const tagSelector = {} |
| | | let windowWidth, system |
| | | // #ifdef MP-WEIXIN |
| | | if (uni.canIUse('getWindowInfo')) { |
| | | windowWidth = uni.getWindowInfo().windowWidth |
| | | system = uni.getDeviceInfo().system |
| | | } else { |
| | | // #endif |
| | | const systemInfo = uni.getSystemInfoSync() |
| | | windowWidth = systemInfo.windowWidth |
| | | // #ifdef MP-WEIXIN |
| | | system = systemInfo.system |
| | | } |
| | | // #endif |
| | | const blankChar = makeMap(' ,\r,\n,\t,\f') |
| | | let idIndex = 0 |
| | | |
| | | // #ifdef H5 || APP-PLUS |
| | | config.ignoreTags.iframe = undefined |
| | | config.trustTags.iframe = true |
| | | config.ignoreTags.embed = undefined |
| | | config.trustTags.embed = true |
| | | // #endif |
| | | // #ifdef APP-PLUS-NVUE |
| | | config.ignoreTags.source = undefined |
| | | config.ignoreTags.style = undefined |
| | | // #endif |
| | | |
| | | /** |
| | | * @description å建 map |
| | | * @param {String} str éå·åé |
| | | */ |
| | | function makeMap (str) { |
| | | const map = Object.create(null) |
| | | const list = str.split(',') |
| | | for (let i = list.length; i--;) { |
| | | map[list[i]] = true |
| | | } |
| | | return map |
| | | } |
| | | |
| | | /** |
| | | * @description è§£ç html å®ä½ |
| | | * @param {String} str è¦è§£ç çå符串 |
| | | * @param {Boolean} amp è¦ä¸è¦è§£ç & |
| | | * @returns {String} è§£ç åçå符串 |
| | | */ |
| | | function decodeEntity (str, amp) { |
| | | let i = str.indexOf('&') |
| | | while (i !== -1) { |
| | | const j = str.indexOf(';', i + 3) |
| | | let code |
| | | if (j === -1) break |
| | | if (str[i + 1] === '#') { |
| | | // { å½¢å¼çå®ä½ |
| | | code = parseInt((str[i + 2] === 'x' ? '0' : '') + str.substring(i + 2, j)) |
| | | if (!isNaN(code)) { |
| | | str = str.substr(0, i) + String.fromCharCode(code) + str.substr(j + 1) |
| | | } |
| | | } else { |
| | | // å½¢å¼çå®ä½ |
| | | code = str.substring(i + 1, j) |
| | | if (config.entities[code] || (code === 'amp' && amp)) { |
| | | str = str.substr(0, i) + (config.entities[code] || '&') + str.substr(j + 1) |
| | | } |
| | | } |
| | | i = str.indexOf('&', i + 1) |
| | | } |
| | | return str |
| | | } |
| | | |
| | | /** |
| | | * @description åå¹¶å¤ä¸ªå级æ ç¾ï¼å å¿«é¿å
容渲æ |
| | | * @param {Array} nodes è¦åå¹¶çæ ç¾æ°ç» |
| | | */ |
| | | function mergeNodes (nodes) { |
| | | let i = nodes.length - 1 |
| | | for (let j = i; j >= -1; j--) { |
| | | if (j === -1 || nodes[j].c || !nodes[j].name || (nodes[j].name !== 'div' && nodes[j].name !== 'p' && nodes[j].name[0] !== 'h') || (nodes[j].attrs.style || '').includes('inline')) { |
| | | if (i - j >= 5) { |
| | | nodes.splice(j + 1, i - j, { |
| | | name: 'div', |
| | | attrs: {}, |
| | | children: nodes.slice(j + 1, i + 1) |
| | | }) |
| | | } |
| | | i = j - 1 |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description html è§£æå¨ |
| | | * @param {Object} vm ç»ä»¶å®ä¾ |
| | | */ |
| | | function Parser (vm) { |
| | | this.options = vm || {} |
| | | this.tagStyle = Object.assign({}, config.tagStyle, this.options.tagStyle) |
| | | this.imgList = vm.imgList || [] |
| | | this.imgList._unloadimgs = 0 |
| | | this.plugins = vm.plugins || [] |
| | | this.attrs = Object.create(null) |
| | | this.stack = [] |
| | | this.nodes = [] |
| | | this.pre = (this.options.containerStyle || '').includes('white-space') && this.options.containerStyle.includes('pre') ? 2 : 0 |
| | | } |
| | | |
| | | /** |
| | | * @description æ§è¡è§£æ |
| | | * @param {String} content è¦è§£æçææ¬ |
| | | */ |
| | | Parser.prototype.parse = function (content) { |
| | | // æä»¶å¤ç |
| | | for (let i = this.plugins.length; i--;) { |
| | | if (this.plugins[i].onUpdate) { |
| | | content = this.plugins[i].onUpdate(content, config) || content |
| | | } |
| | | } |
| | | |
| | | new Lexer(this).parse(content) |
| | | // åºæ æªéåçæ ç¾ |
| | | while (this.stack.length) { |
| | | this.popNode() |
| | | } |
| | | if (this.nodes.length > 50) { |
| | | mergeNodes(this.nodes) |
| | | } |
| | | return this.nodes |
| | | } |
| | | |
| | | /** |
| | | * @description å°æ ç¾æ´é²åºæ¥ï¼ä¸è¢« rich-text å
å«ï¼ |
| | | */ |
| | | Parser.prototype.expose = function () { |
| | | // #ifndef APP-PLUS-NVUE |
| | | for (let i = this.stack.length; i--;) { |
| | | const item = this.stack[i] |
| | | if (item.c || item.name === 'a' || item.name === 'video' || item.name === 'audio') return |
| | | item.c = 1 |
| | | } |
| | | // #endif |
| | | } |
| | | |
| | | /** |
| | | * @description å¤çæä»¶ |
| | | * @param {Object} node è¦å¤ççæ ç¾ |
| | | * @returns {Boolean} æ¯å¦è¦ç§»é¤æ¤æ ç¾ |
| | | */ |
| | | Parser.prototype.hook = function (node) { |
| | | for (let i = this.plugins.length; i--;) { |
| | | if (this.plugins[i].onParse && this.plugins[i].onParse(node, this) === false) { |
| | | return false |
| | | } |
| | | } |
| | | return true |
| | | } |
| | | |
| | | /** |
| | | * @description å°é¾æ¥æ¼æ¥ä¸ä¸»åå |
| | | * @param {String} url éè¦æ¼æ¥ç龿¥ |
| | | * @returns {String} æ¼æ¥åç龿¥ |
| | | */ |
| | | Parser.prototype.getUrl = function (url) { |
| | | const domain = this.options.domain |
| | | if (url[0] === '/') { |
| | | if (url[1] === '/') { |
| | | // // å¼å¤´çè¡¥å
åè®®å |
| | | url = (domain ? domain.split('://')[0] : 'http') + ':' + url |
| | | } else if (domain) { |
| | | // å¦åè¡¥å
æ´ä¸ªåå |
| | | url = domain + url |
| | | } /* #ifdef APP-PLUS */ else { |
| | | url = plus.io.convertLocalFileSystemURL(url) |
| | | } /* #endif */ |
| | | } else if (!url.includes('data:') && !url.includes('://')) { |
| | | if (domain) { |
| | | url = domain + '/' + url |
| | | } /* #ifdef APP-PLUS */ else { |
| | | url = plus.io.convertLocalFileSystemURL(url) |
| | | } /* #endif */ |
| | | } |
| | | return url |
| | | } |
| | | |
| | | /** |
| | | * @description è§£ææ ·å¼è¡¨ |
| | | * @param {Object} node æ ç¾ |
| | | * @returns {Object} |
| | | */ |
| | | Parser.prototype.parseStyle = function (node) { |
| | | const attrs = node.attrs |
| | | const list = (this.tagStyle[node.name] || '').split(';').concat((attrs.style || '').split(';')) |
| | | const styleObj = {} |
| | | let tmp = '' |
| | | |
| | | if (attrs.id && !this.xml) { |
| | | // æ´é²éç¹ |
| | | if (this.options.useAnchor) { |
| | | this.expose() |
| | | } else if (node.name !== 'img' && node.name !== 'a' && node.name !== 'video' && node.name !== 'audio') { |
| | | attrs.id = undefined |
| | | } |
| | | } |
| | | |
| | | // è½¬æ¢ width å height 屿§ |
| | | if (attrs.width) { |
| | | styleObj.width = parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px') |
| | | attrs.width = undefined |
| | | } |
| | | if (attrs.height) { |
| | | styleObj.height = parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px') |
| | | attrs.height = undefined |
| | | } |
| | | |
| | | for (let i = 0, len = list.length; i < len; i++) { |
| | | const info = list[i].split(':') |
| | | if (info.length < 2) continue |
| | | const key = info.shift().trim().toLowerCase() |
| | | let value = info.join(':').trim() |
| | | if ((value[0] === '-' && value.lastIndexOf('-') > 0) || value.includes('safe')) { |
| | | // å
¼å®¹æ§ç css ä¸å缩 |
| | | tmp += `;${key}:${value}` |
| | | } else if (!styleObj[key] || value.includes('import') || !styleObj[key].includes('import')) { |
| | | // éå¤çæ ·å¼è¿è¡è¦ç |
| | | if (value.includes('url')) { |
| | | // å¡«å
龿¥ |
| | | let j = value.indexOf('(') + 1 |
| | | if (j) { |
| | | while (value[j] === '"' || value[j] === "'" || blankChar[value[j]]) { |
| | | j++ |
| | | } |
| | | value = value.substr(0, j) + this.getUrl(value.substr(j)) |
| | | } |
| | | } else if (value.includes('rpx')) { |
| | | // è½¬æ¢ rpxï¼rich-text å
é¨ä¸æ¯æ rpxï¼ |
| | | value = value.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * windowWidth / 750 + 'px') |
| | | } |
| | | styleObj[key] = value |
| | | } |
| | | } |
| | | |
| | | node.attrs.style = tmp |
| | | return styleObj |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°æ ç¾å |
| | | * @param {String} name æ ç¾å |
| | | * @private |
| | | */ |
| | | Parser.prototype.onTagName = function (name) { |
| | | this.tagName = this.xml ? name : name.toLowerCase() |
| | | if (this.tagName === 'svg') { |
| | | this.xml = (this.xml || 0) + 1 // svg æ ç¾å
大å°åææ |
| | | config.ignoreTags.style = undefined // svg æ ç¾å
style å¯ç¨ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°å±æ§å |
| | | * @param {String} name 屿§å |
| | | * @private |
| | | */ |
| | | Parser.prototype.onAttrName = function (name) { |
| | | name = this.xml ? name : name.toLowerCase() |
| | | // #ifdef (VUE3 && (H5 || APP-PLUS)) || APP-PLUS-NVUE |
| | | if (name.includes('?') || name.includes(';')) { |
| | | this.attrName = undefined |
| | | return |
| | | } |
| | | // #endif |
| | | if (name.substr(0, 5) === 'data-') { |
| | | if (name === 'data-src' && !this.attrs.src) { |
| | | // data-src èªå¨è½¬ä¸º src |
| | | this.attrName = 'src' |
| | | } else if (this.tagName === 'img' || this.tagName === 'a') { |
| | | // a å img æ ç¾ä¿ç data- ç屿§ï¼å¯ä»¥å¨ imgtap å linktap äºä»¶ä¸ä½¿ç¨ |
| | | this.attrName = name |
| | | } else { |
| | | // å©ä½çç§»é¤ä»¥åå°å¤§å° |
| | | this.attrName = undefined |
| | | } |
| | | } else { |
| | | this.attrName = name |
| | | this.attrs[name] = 'T' // boolean å屿§ç¼ºç设置 |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°å±æ§å¼ |
| | | * @param {String} val 屿§å¼ |
| | | * @private |
| | | */ |
| | | Parser.prototype.onAttrVal = function (val) { |
| | | const name = this.attrName || '' |
| | | if (name === 'style' || name === 'href') { |
| | | // é¨å屿§è¿è¡å®ä½è§£ç |
| | | this.attrs[name] = decodeEntity(val, true) |
| | | } else if (name.includes('src')) { |
| | | // æ¼æ¥ä¸»åå |
| | | this.attrs[name] = this.getUrl(decodeEntity(val, true)) |
| | | } else if (name) { |
| | | this.attrs[name] = val |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°æ ç¾å¼å§ |
| | | * @param {Boolean} selfClose æ¯å¦æèªéåæ è¯ /> |
| | | * @private |
| | | */ |
| | | Parser.prototype.onOpenTag = function (selfClose) { |
| | | // æ¼è£
node |
| | | const node = Object.create(null) |
| | | node.name = this.tagName |
| | | node.attrs = this.attrs |
| | | // é¿å
å 为èªå¨ diff ä½¿å¾ type 被设置为 null 导è´é¨åå
容䏿¾ç¤º |
| | | if (this.options.nodes.length) { |
| | | node.type = 'node' |
| | | } |
| | | this.attrs = Object.create(null) |
| | | |
| | | const attrs = node.attrs |
| | | const parent = this.stack[this.stack.length - 1] |
| | | const siblings = parent ? parent.children : this.nodes |
| | | const close = this.xml ? selfClose : config.voidTags[node.name] |
| | | |
| | | // æ¿æ¢æ ç¾åéæ©å¨ |
| | | if (tagSelector[node.name]) { |
| | | attrs.class = tagSelector[node.name] + (attrs.class ? ' ' + attrs.class : '') |
| | | } |
| | | |
| | | // è½¬æ¢ embed æ ç¾ |
| | | if (node.name === 'embed') { |
| | | // #ifndef H5 || APP-PLUS |
| | | const src = attrs.src || '' |
| | | // æç
§åç¼åå type å° embed 转为 video æ audio |
| | | if (src.includes('.mp4') || src.includes('.3gp') || src.includes('.m3u8') || (attrs.type || '').includes('video')) { |
| | | node.name = 'video' |
| | | } else if (src.includes('.mp3') || src.includes('.wav') || src.includes('.aac') || src.includes('.m4a') || (attrs.type || '').includes('audio')) { |
| | | node.name = 'audio' |
| | | } |
| | | if (attrs.autostart) { |
| | | attrs.autoplay = 'T' |
| | | } |
| | | attrs.controls = 'T' |
| | | // #endif |
| | | // #ifdef H5 || APP-PLUS |
| | | this.expose() |
| | | // #endif |
| | | } |
| | | |
| | | // #ifndef APP-PLUS-NVUE |
| | | // å¤çé³è§é¢ |
| | | if (node.name === 'video' || node.name === 'audio') { |
| | | // 设置 id 以便è·å context |
| | | if (node.name === 'video' && !attrs.id) { |
| | | attrs.id = 'v' + idIndex++ |
| | | } |
| | | // 没æè®¾ç½® controls 乿²¡æè®¾ç½® autoplay çèªå¨è®¾ç½® controls |
| | | if (!attrs.controls && !attrs.autoplay) { |
| | | attrs.controls = 'T' |
| | | } |
| | | // ç¨æ°ç»å卿æå¯ç¨ç source |
| | | node.src = [] |
| | | if (attrs.src) { |
| | | node.src.push(attrs.src) |
| | | attrs.src = undefined |
| | | } |
| | | this.expose() |
| | | } |
| | | // #endif |
| | | |
| | | // å¤çèªéåæ ç¾ |
| | | if (close) { |
| | | if (!this.hook(node) || config.ignoreTags[node.name]) { |
| | | // éè¿ base æ ç¾è®¾ç½®ä¸»åå |
| | | if (node.name === 'base' && !this.options.domain) { |
| | | this.options.domain = attrs.href |
| | | } /* #ifndef APP-PLUS-NVUE */ else if (node.name === 'source' && parent && (parent.name === 'video' || parent.name === 'audio') && attrs.src) { |
| | | // 设置 source æ ç¾ï¼ä»
ç¶èç¹ä¸º video æ audio æ¶ææï¼ |
| | | parent.src.push(attrs.src) |
| | | } /* #endif */ |
| | | return |
| | | } |
| | | |
| | | // è§£æ style |
| | | const styleObj = this.parseStyle(node) |
| | | |
| | | // å¤çå¾ç |
| | | if (node.name === 'img') { |
| | | if (attrs.src) { |
| | | // æ è®° webp |
| | | if (attrs.src.includes('webp')) { |
| | | node.webp = 'T' |
| | | } |
| | | // data url å¾çå¦ææ²¡æè®¾ç½® original-src é»è®¤ä¸ºä¸å¯é¢è§çå°å¾ç |
| | | if (attrs.src.includes('data:') && this.options.previewImg !== 'all' && !attrs['original-src']) { |
| | | attrs.ignore = 'T' |
| | | } |
| | | if (!attrs.ignore || node.webp || attrs.src.includes('cloud://')) { |
| | | for (let i = this.stack.length; i--;) { |
| | | const item = this.stack[i] |
| | | if (item.name === 'a') { |
| | | node.a = item.attrs |
| | | } |
| | | if (item.name === 'table' && !node.webp && !attrs.src.includes('cloud://')) { |
| | | if (!styleObj.display || styleObj.display.includes('inline')) { |
| | | node.t = 'inline-block' |
| | | } else { |
| | | node.t = styleObj.display |
| | | } |
| | | styleObj.display = undefined |
| | | } |
| | | // #ifndef H5 || APP-PLUS |
| | | const style = item.attrs.style || '' |
| | | if (style.includes('flex:') && !style.includes('flex:0') && !style.includes('flex: 0') && (!styleObj.width || parseInt(styleObj.width) > 100)) { |
| | | styleObj.width = '100% !important' |
| | | styleObj.height = '' |
| | | for (let j = i + 1; j < this.stack.length; j++) { |
| | | this.stack[j].attrs.style = (this.stack[j].attrs.style || '').replace('inline-', '') |
| | | } |
| | | } else if (style.includes('flex') && styleObj.width === '100%') { |
| | | for (let j = i + 1; j < this.stack.length; j++) { |
| | | const style = this.stack[j].attrs.style || '' |
| | | if (!style.includes(';width') && !style.includes(' width') && style.indexOf('width') !== 0) { |
| | | styleObj.width = '' |
| | | break |
| | | } |
| | | } |
| | | } else if (style.includes('inline-block')) { |
| | | if (styleObj.width && styleObj.width[styleObj.width.length - 1] === '%') { |
| | | item.attrs.style += ';max-width:' + styleObj.width |
| | | styleObj.width = '' |
| | | } else { |
| | | item.attrs.style += ';max-width:100%' |
| | | } |
| | | } |
| | | // #endif |
| | | item.c = 1 |
| | | } |
| | | attrs.i = this.imgList.length.toString() |
| | | let src = attrs['original-src'] || attrs.src |
| | | // #ifndef H5 || MP-ALIPAY || APP-PLUS || MP-360 |
| | | if (this.imgList.includes(src)) { |
| | | // 妿æéå¤ç龿¥å对ååè¿è¡éæºå¤§å°å忢é¿å
é¢è§æ¶éä½ |
| | | let i = src.indexOf('://') |
| | | if (i !== -1) { |
| | | i += 3 |
| | | let newSrc = src.substr(0, i) |
| | | for (; i < src.length; i++) { |
| | | if (src[i] === '/') break |
| | | newSrc += Math.random() > 0.5 ? src[i].toUpperCase() : src[i] |
| | | } |
| | | newSrc += src.substr(i) |
| | | src = newSrc |
| | | } |
| | | } |
| | | // #endif |
| | | this.imgList.push(src) |
| | | if (!node.t) { |
| | | this.imgList._unloadimgs += 1 |
| | | } |
| | | // #ifdef H5 || APP-PLUS |
| | | if (this.options.lazyLoad) { |
| | | attrs['data-src'] = attrs.src |
| | | attrs.src = undefined |
| | | } |
| | | // #endif |
| | | } |
| | | } |
| | | if (styleObj.display === 'inline') { |
| | | styleObj.display = '' |
| | | } |
| | | // #ifndef APP-PLUS-NVUE |
| | | if (attrs.ignore) { |
| | | styleObj['max-width'] = styleObj['max-width'] || '100%' |
| | | attrs.style += ';-webkit-touch-callout:none' |
| | | } |
| | | // #endif |
| | | // 设置ç宽度è¶
åºå±å¹ï¼ä¸ºé¿å
åå½¢ï¼é«åº¦è½¬ä¸ºèªå¨ |
| | | if (parseInt(styleObj.width) > windowWidth) { |
| | | styleObj.height = undefined |
| | | } |
| | | // è®°å½æ¯å¦è®¾ç½®äºå®½é« |
| | | if (!isNaN(parseInt(styleObj.width))) { |
| | | node.w = 'T' |
| | | } |
| | | if (!isNaN(parseInt(styleObj.height)) && (!styleObj.height.includes('%') || (parent && (parent.attrs.style || '').includes('height')))) { |
| | | node.h = 'T' |
| | | } |
| | | if (node.w && node.h && styleObj['object-fit']) { |
| | | if (styleObj['object-fit'] === 'contain') { |
| | | node.m = 'aspectFit' |
| | | } else if (styleObj['object-fit'] === 'cover') { |
| | | node.m = 'aspectFill' |
| | | } |
| | | } |
| | | } else if (node.name === 'svg') { |
| | | siblings.push(node) |
| | | this.stack.push(node) |
| | | this.popNode() |
| | | return |
| | | } |
| | | for (const key in styleObj) { |
| | | if (styleObj[key]) { |
| | | attrs.style += `;${key}:${styleObj[key].replace(' !important', '')}` |
| | | } |
| | | } |
| | | attrs.style = attrs.style.substr(1) || undefined |
| | | // #ifdef (MP-WEIXIN || MP-QQ) && VUE3 |
| | | if (!attrs.style) { |
| | | delete attrs.style |
| | | } |
| | | // #endif |
| | | } else { |
| | | if ((node.name === 'pre' || ((attrs.style || '').includes('white-space') && attrs.style.includes('pre'))) && this.pre !== 2) { |
| | | this.pre = node.pre = 1 |
| | | } |
| | | node.children = [] |
| | | this.stack.push(node) |
| | | } |
| | | |
| | | // å å
¥èç¹æ |
| | | siblings.push(node) |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°æ ç¾ç»æ |
| | | * @param {String} name æ ç¾å |
| | | * @private |
| | | */ |
| | | Parser.prototype.onCloseTag = function (name) { |
| | | // 便¬¡åºæ å°å¹é
ä¸ºæ¢ |
| | | name = this.xml ? name : name.toLowerCase() |
| | | let i |
| | | for (i = this.stack.length; i--;) { |
| | | if (this.stack[i].name === name) break |
| | | } |
| | | if (i !== -1) { |
| | | while (this.stack.length > i) { |
| | | this.popNode() |
| | | } |
| | | } else if (name === 'p' || name === 'br') { |
| | | const siblings = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes |
| | | siblings.push({ |
| | | name, |
| | | attrs: { |
| | | class: tagSelector[name] || '', |
| | | style: this.tagStyle[name] || '' |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description å¤çæ ç¾åºæ |
| | | * @private |
| | | */ |
| | | Parser.prototype.popNode = function () { |
| | | const node = this.stack.pop() |
| | | let attrs = node.attrs |
| | | const children = node.children |
| | | const parent = this.stack[this.stack.length - 1] |
| | | const siblings = parent ? parent.children : this.nodes |
| | | |
| | | if (!this.hook(node) || config.ignoreTags[node.name]) { |
| | | // è·åæ é¢ |
| | | if (node.name === 'title' && children.length && children[0].type === 'text' && this.options.setTitle) { |
| | | uni.setNavigationBarTitle({ |
| | | title: children[0].text |
| | | }) |
| | | } |
| | | siblings.pop() |
| | | return |
| | | } |
| | | |
| | | if (node.pre && this.pre !== 2) { |
| | | // æ¯å¦å并空ç½ç¬¦æ è¯ |
| | | this.pre = node.pre = undefined |
| | | for (let i = this.stack.length; i--;) { |
| | | if (this.stack[i].pre) { |
| | | this.pre = 1 |
| | | } |
| | | } |
| | | } |
| | | |
| | | const styleObj = {} |
| | | |
| | | // è½¬æ¢ svg |
| | | if (node.name === 'svg') { |
| | | if (this.xml > 1) { |
| | | // å¤å± svg åµå¥ |
| | | this.xml-- |
| | | return |
| | | } |
| | | // #ifdef APP-PLUS-NVUE |
| | | (function traversal (node) { |
| | | if (node.name) { |
| | | // è°æ´ svg ç大å°å |
| | | node.name = config.svgDict[node.name] || node.name |
| | | for (const item in node.attrs) { |
| | | if (config.svgDict[item]) { |
| | | node.attrs[config.svgDict[item]] = node.attrs[item] |
| | | node.attrs[item] = undefined |
| | | } |
| | | } |
| | | for (let i = 0; i < (node.children || []).length; i++) { |
| | | traversal(node.children[i]) |
| | | } |
| | | } |
| | | })(node) |
| | | // #endif |
| | | // #ifndef APP-PLUS-NVUE |
| | | let src = '' |
| | | const style = attrs.style |
| | | attrs.style = '' |
| | | attrs.xmlns = 'http://www.w3.org/2000/svg'; |
| | | (function traversal (node) { |
| | | if (node.type === 'text') { |
| | | src += node.text |
| | | return |
| | | } |
| | | const name = config.svgDict[node.name] || node.name |
| | | if (name === 'foreignObject') { |
| | | for (const child of (node.children || [])) { |
| | | if (child.attrs && !child.attrs.xmlns) { |
| | | child.attrs.xmlns = 'http://www.w3.org/1999/xhtml' |
| | | break |
| | | } |
| | | } |
| | | } |
| | | src += '<' + name |
| | | for (const item in node.attrs) { |
| | | const val = node.attrs[item] |
| | | if (val) { |
| | | src += ` ${config.svgDict[item] || item}="${val.replace(/"/g, '')}"` |
| | | } |
| | | } |
| | | if (!node.children) { |
| | | src += '/>' |
| | | } else { |
| | | src += '>' |
| | | for (let i = 0; i < node.children.length; i++) { |
| | | traversal(node.children[i]) |
| | | } |
| | | src += '</' + name + '>' |
| | | } |
| | | })(node) |
| | | node.name = 'img' |
| | | node.attrs = { |
| | | src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'), |
| | | style, |
| | | ignore: 'T' |
| | | } |
| | | node.children = undefined |
| | | // #endif |
| | | this.xml = false |
| | | config.ignoreTags.style = true |
| | | return |
| | | } |
| | | |
| | | // #ifndef APP-PLUS-NVUE |
| | | // è½¬æ¢ align 屿§ |
| | | if (attrs.align) { |
| | | if (node.name === 'table') { |
| | | if (attrs.align === 'center') { |
| | | styleObj['margin-inline-start'] = styleObj['margin-inline-end'] = 'auto' |
| | | } else { |
| | | styleObj.float = attrs.align |
| | | } |
| | | } else { |
| | | styleObj['text-align'] = attrs.align |
| | | } |
| | | attrs.align = undefined |
| | | } |
| | | |
| | | // è½¬æ¢ dir 屿§ |
| | | if (attrs.dir) { |
| | | styleObj.direction = attrs.dir |
| | | attrs.dir = undefined |
| | | } |
| | | |
| | | // è½¬æ¢ font æ ç¾ç屿§ |
| | | if (node.name === 'font') { |
| | | if (attrs.color) { |
| | | styleObj.color = attrs.color |
| | | attrs.color = undefined |
| | | } |
| | | if (attrs.face) { |
| | | styleObj['font-family'] = attrs.face |
| | | attrs.face = undefined |
| | | } |
| | | if (attrs.size) { |
| | | let size = parseInt(attrs.size) |
| | | if (!isNaN(size)) { |
| | | if (size < 1) { |
| | | size = 1 |
| | | } else if (size > 7) { |
| | | size = 7 |
| | | } |
| | | styleObj['font-size'] = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', 'xxx-large'][size - 1] |
| | | } |
| | | attrs.size = undefined |
| | | } |
| | | } |
| | | // #endif |
| | | |
| | | // ä¸äºç¼è¾å¨çèªå¸¦ class |
| | | if ((attrs.class || '').includes('align-center')) { |
| | | styleObj['text-align'] = 'center' |
| | | } |
| | | |
| | | Object.assign(styleObj, this.parseStyle(node)) |
| | | |
| | | if (node.name !== 'table' && parseInt(styleObj.width) > windowWidth) { |
| | | styleObj['max-width'] = '100%' |
| | | styleObj['box-sizing'] = 'border-box' |
| | | } |
| | | |
| | | // #ifndef APP-PLUS-NVUE |
| | | if (config.blockTags[node.name]) { |
| | | node.name = 'div' |
| | | } else if (!config.trustTags[node.name] && !this.xml) { |
| | | // æªç¥æ ç¾è½¬ä¸º spanï¼é¿å
æ æ³æ¾ç¤º |
| | | node.name = 'span' |
| | | } |
| | | |
| | | if (node.name === 'a' || node.name === 'ad' |
| | | // #ifdef H5 || APP-PLUS |
| | | || node.name === 'iframe' // eslint-disable-line |
| | | // #endif |
| | | ) { |
| | | this.expose() |
| | | } else if (node.name === 'video') { |
| | | if ((styleObj.height || '').includes('auto')) { |
| | | styleObj.height = undefined |
| | | } |
| | | /* #ifdef APP-PLUS */ |
| | | let str = '<video style="width:100%;height:100%"' |
| | | for (const item in attrs) { |
| | | if (attrs[item]) { |
| | | str += ' ' + item + '="' + attrs[item] + '"' |
| | | } |
| | | } |
| | | if (this.options.pauseVideo) { |
| | | str += ' onplay="this.dispatchEvent(new CustomEvent(\'vplay\',{bubbles:!0}));for(var e=document.getElementsByTagName(\'video\'),t=0;t<e.length;t++)e[t]!=this&&e[t].pause()"' |
| | | } |
| | | str += '>' |
| | | for (let i = 0; i < node.src.length; i++) { |
| | | str += '<source src="' + node.src[i] + '">' |
| | | } |
| | | str += '</video>' |
| | | node.html = str |
| | | /* #endif */ |
| | | } else if ((node.name === 'ul' || node.name === 'ol') && node.c) { |
| | | // å表å¤ç |
| | | const types = { |
| | | a: 'lower-alpha', |
| | | A: 'upper-alpha', |
| | | i: 'lower-roman', |
| | | I: 'upper-roman' |
| | | } |
| | | if (types[attrs.type]) { |
| | | attrs.style += ';list-style-type:' + types[attrs.type] |
| | | attrs.type = undefined |
| | | } |
| | | for (let i = children.length; i--;) { |
| | | if (children[i].name === 'li') { |
| | | children[i].c = 1 |
| | | } |
| | | } |
| | | } else if (node.name === 'table') { |
| | | // è¡¨æ ¼å¤ç |
| | | // cellpaddingãcellspacingãborder è¿å 个常ç¨è¡¨æ ¼å±æ§éè¦éè¿è½¬æ¢å®ç° |
| | | let padding = parseFloat(attrs.cellpadding) |
| | | let spacing = parseFloat(attrs.cellspacing) |
| | | const border = parseFloat(attrs.border) |
| | | const bordercolor = styleObj['border-color'] |
| | | const borderstyle = styleObj['border-style'] |
| | | if (node.c) { |
| | | // padding å spacing é»è®¤ 2 |
| | | if (isNaN(padding)) { |
| | | padding = 2 |
| | | } |
| | | if (isNaN(spacing)) { |
| | | spacing = 2 |
| | | } |
| | | } |
| | | if (border) { |
| | | attrs.style += `;border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'}` |
| | | } |
| | | if (node.flag && node.c) { |
| | | // æ colspan æ rowspan ä¸å«æé¾æ¥çè¡¨æ ¼éè¿ grid å¸å±å®ç° |
| | | styleObj.display = 'grid' |
| | | if (styleObj['border-collapse'] === 'collapse') { |
| | | styleObj['border-collapse'] = undefined |
| | | spacing = 0 |
| | | } |
| | | if (spacing) { |
| | | styleObj['grid-gap'] = spacing + 'px' |
| | | styleObj.padding = spacing + 'px' |
| | | } else if (border) { |
| | | // æ é´éçæ
åµä¸é¿å
è¾¹æ¡éå |
| | | attrs.style += ';border-left:0;border-top:0' |
| | | } |
| | | |
| | | const width = [] // è¡¨æ ¼çå宽 |
| | | const trList = [] // tr å表 |
| | | const cells = [] // ä¿åæ°çåå
æ ¼ |
| | | const map = {}; // 被åå¹¶åå
æ ¼å ç¨çæ ¼å |
| | | |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].name === 'tr') { |
| | | trList.push(nodes[i]) |
| | | } else if (nodes[i].name === 'colgroup') { |
| | | let colI = 1 |
| | | for (const col of (nodes[i].children || [])) { |
| | | if (col.name === 'col') { |
| | | const style = col.attrs.style || '' |
| | | const start = style.indexOf('width') ? style.indexOf(';width') : 0 |
| | | // æååºå®½åº¦ |
| | | if (start !== -1) { |
| | | let end = style.indexOf(';', start + 6) |
| | | if (end === -1) { |
| | | end = style.length |
| | | } |
| | | width[colI] = style.substring(start ? start + 7 : 6, end) |
| | | } |
| | | colI += 1 |
| | | } |
| | | } |
| | | } else { |
| | | traversal(nodes[i].children || []) |
| | | } |
| | | } |
| | | })(children) |
| | | |
| | | for (let row = 1; row <= trList.length; row++) { |
| | | let col = 1 |
| | | for (let j = 0; j < trList[row - 1].children.length; j++) { |
| | | const td = trList[row - 1].children[j] |
| | | if (td.name === 'td' || td.name === 'th') { |
| | | // è¿ä¸ªæ ¼å被ä¸é¢çåå
æ ¼å ç¨ï¼ååå·++ |
| | | while (map[row + '.' + col]) { |
| | | col++ |
| | | } |
| | | let style = td.attrs.style || '' |
| | | let start = style.indexOf('width') ? style.indexOf(';width') : 0 |
| | | // æååº td ç宽度 |
| | | if (start !== -1) { |
| | | let end = style.indexOf(';', start + 6) |
| | | if (end === -1) { |
| | | end = style.length |
| | | } |
| | | if (!td.attrs.colspan) { |
| | | width[col] = style.substring(start ? start + 7 : 6, end) |
| | | } |
| | | style = style.substr(0, start) + style.substr(end) |
| | | } |
| | | // 设置ç«ç´å¯¹é½ |
| | | style += ';display:flex' |
| | | start = style.indexOf('vertical-align') |
| | | if (start !== -1) { |
| | | const val = style.substr(start + 15, 10) |
| | | if (val.includes('middle')) { |
| | | style += ';align-items:center' |
| | | } else if (val.includes('bottom')) { |
| | | style += ';align-items:flex-end' |
| | | } |
| | | } else { |
| | | style += ';align-items:center' |
| | | } |
| | | // è®¾ç½®æ°´å¹³å¯¹é½ |
| | | start = style.indexOf('text-align') |
| | | if (start !== -1) { |
| | | const val = style.substr(start + 11, 10) |
| | | if (val.includes('center')) { |
| | | style += ';justify-content: center' |
| | | } else if (val.includes('right')) { |
| | | style += ';justify-content: right' |
| | | } |
| | | } |
| | | style = (border ? `;border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'}` + (spacing ? '' : ';border-right:0;border-bottom:0') : '') + (padding ? `;padding:${padding}px` : '') + ';' + style |
| | | // å¤çååå¹¶ |
| | | if (td.attrs.colspan) { |
| | | style += `;grid-column-start:${col};grid-column-end:${col + parseInt(td.attrs.colspan)}` |
| | | if (!td.attrs.rowspan) { |
| | | style += `;grid-row-start:${row};grid-row-end:${row + 1}` |
| | | } |
| | | col += parseInt(td.attrs.colspan) - 1 |
| | | } |
| | | // å¤çè¡åå¹¶ |
| | | if (td.attrs.rowspan) { |
| | | style += `;grid-row-start:${row};grid-row-end:${row + parseInt(td.attrs.rowspan)}` |
| | | if (!td.attrs.colspan) { |
| | | style += `;grid-column-start:${col};grid-column-end:${col + 1}` |
| | | } |
| | | // è®°å½ä¸æ¹åå
æ ¼è¢«å ç¨ |
| | | for (let rowspan = 1; rowspan < td.attrs.rowspan; rowspan++) { |
| | | for (let colspan = 0; colspan < (td.attrs.colspan || 1); colspan++) { |
| | | map[(row + rowspan) + '.' + (col - colspan)] = 1 |
| | | } |
| | | } |
| | | } |
| | | if (style) { |
| | | td.attrs.style = style |
| | | } |
| | | cells.push(td) |
| | | col++ |
| | | } |
| | | } |
| | | if (row === 1) { |
| | | let temp = '' |
| | | for (let i = 1; i < col; i++) { |
| | | temp += (width[i] ? width[i] : 'auto') + ' ' |
| | | } |
| | | styleObj['grid-template-columns'] = temp |
| | | } |
| | | } |
| | | node.children = cells |
| | | } else { |
| | | // 没æä½¿ç¨åå¹¶åå
æ ¼çè¡¨æ ¼éè¿ table å¸å±å®ç° |
| | | if (node.c) { |
| | | styleObj.display = 'table' |
| | | } |
| | | if (!isNaN(spacing)) { |
| | | styleObj['border-spacing'] = spacing + 'px' |
| | | } |
| | | if (border || padding) { |
| | | // éå |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | const td = nodes[i] |
| | | if (td.name === 'th' || td.name === 'td') { |
| | | if (border) { |
| | | td.attrs.style = `border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'};${td.attrs.style || ''}` |
| | | } |
| | | if (padding) { |
| | | td.attrs.style = `padding:${padding}px;${td.attrs.style || ''}` |
| | | } |
| | | } else if (td.children) { |
| | | traversal(td.children) |
| | | } |
| | | } |
| | | })(children) |
| | | } |
| | | } |
| | | // ç»è¡¨æ ¼æ·»å ä¸ä¸ªåç¬çæ¨ªåæ»å¨å± |
| | | if (this.options.scrollTable && !(attrs.style || '').includes('inline')) { |
| | | const table = Object.assign({}, node) |
| | | node.name = 'div' |
| | | node.attrs = { |
| | | style: 'overflow:auto' |
| | | } |
| | | node.children = [table] |
| | | attrs = table.attrs |
| | | } |
| | | } else if ((node.name === 'tbody' || node.name === 'tr') && node.flag && node.c) { |
| | | node.flag = undefined; |
| | | (function traversal (nodes) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].name === 'td') { |
| | | // é¢è²æ ·å¼è®¾ç½®ç»åå
æ ¼é¿å
丢失 |
| | | for (const style of ['color', 'background', 'background-color']) { |
| | | if (styleObj[style]) { |
| | | nodes[i].attrs.style = style + ':' + styleObj[style] + ';' + (nodes[i].attrs.style || '') |
| | | } |
| | | } |
| | | } else { |
| | | traversal(nodes[i].children || []) |
| | | } |
| | | } |
| | | })(children) |
| | | } else if ((node.name === 'td' || node.name === 'th') && (attrs.colspan || attrs.rowspan)) { |
| | | for (let i = this.stack.length; i--;) { |
| | | if (this.stack[i].name === 'table' || this.stack[i].name === 'tbody' || this.stack[i].name === 'tr') { |
| | | this.stack[i].flag = 1 // æç¤ºå«æåå¹¶åå
æ ¼ |
| | | } |
| | | } |
| | | } else if (node.name === 'ruby') { |
| | | // è½¬æ¢ ruby |
| | | node.name = 'span' |
| | | for (let i = 0; i < children.length - 1; i++) { |
| | | if (children[i].type === 'text' && children[i + 1].name === 'rt') { |
| | | children[i] = { |
| | | name: 'div', |
| | | attrs: { |
| | | style: 'display:inline-block;text-align:center' |
| | | }, |
| | | children: [{ |
| | | name: 'div', |
| | | attrs: { |
| | | style: 'font-size:50%;' + (children[i + 1].attrs.style || '') |
| | | }, |
| | | children: children[i + 1].children |
| | | }, children[i]] |
| | | } |
| | | children.splice(i + 1, 1) |
| | | } |
| | | } |
| | | } else if (node.c) { |
| | | (function traversal (node) { |
| | | node.c = 2 |
| | | for (let i = node.children.length; i--;) { |
| | | const child = node.children[i] |
| | | // #ifdef (MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE3 |
| | | if (child.name && (config.inlineTags[child.name] || ((child.attrs.style || '').includes('inline') && child.children)) && !child.c) { |
| | | traversal(child) |
| | | } |
| | | // #endif |
| | | if (!child.c || child.name === 'table') { |
| | | node.c = 1 |
| | | } |
| | | } |
| | | })(node) |
| | | } |
| | | |
| | | if ((styleObj.display || '').includes('flex') && !node.c) { |
| | | for (let i = children.length; i--;) { |
| | | const item = children[i] |
| | | if (item.f) { |
| | | item.attrs.style = (item.attrs.style || '') + item.f |
| | | item.f = undefined |
| | | } |
| | | } |
| | | } |
| | | // flex å¸å±æ¶é¨åæ ·å¼éè¦æåå° rich-text å¤å± |
| | | const flex = parent && ((parent.attrs.style || '').includes('flex') || (parent.attrs.style || '').includes('grid')) |
| | | // #ifdef MP-WEIXIN |
| | | // æ£æ¥åºç¡åºçæ¬ virtualHost æ¯å¦å¯ç¨ |
| | | && !(node.c && wx.getNFCAdapter) // eslint-disable-line |
| | | // #endif |
| | | // #ifndef MP-WEIXIN || MP-QQ || MP-BAIDU || MP-TOUTIAO |
| | | && !node.c // eslint-disable-line |
| | | // #endif |
| | | if (flex) { |
| | | node.f = ';max-width:100%' |
| | | } |
| | | |
| | | if (children.length >= 50 && node.c && !(styleObj.display || '').includes('flex')) { |
| | | mergeNodes(children) |
| | | } |
| | | // #endif |
| | | |
| | | for (const key in styleObj) { |
| | | if (styleObj[key]) { |
| | | const val = `;${key}:${styleObj[key].replace(' !important', '')}` |
| | | /* #ifndef APP-PLUS-NVUE */ |
| | | if (flex && ((key.includes('flex') && key !== 'flex-direction') || key === 'align-self' || key.includes('grid') || styleObj[key][0] === '-' || (key.includes('width') && val.includes('%')))) { |
| | | node.f += val |
| | | if (key === 'width') { |
| | | attrs.style += ';width:100%' |
| | | } |
| | | } else /* #endif */ { |
| | | attrs.style += val |
| | | } |
| | | } |
| | | } |
| | | attrs.style = attrs.style.substr(1) || undefined |
| | | // #ifdef (MP-WEIXIN || MP-QQ) && VUE3 |
| | | for (const key in attrs) { |
| | | if (!attrs[key]) { |
| | | delete attrs[key] |
| | | } |
| | | } |
| | | // #endif |
| | | } |
| | | |
| | | /** |
| | | * @description è§£æå°ææ¬ |
| | | * @param {String} text ææ¬å
容 |
| | | */ |
| | | Parser.prototype.onText = function (text) { |
| | | if (!this.pre) { |
| | | // å并空ç½ç¬¦ |
| | | let trim = '' |
| | | let flag |
| | | for (let i = 0, len = text.length; i < len; i++) { |
| | | if (!blankChar[text[i]]) { |
| | | trim += text[i] |
| | | } else { |
| | | if (trim[trim.length - 1] !== ' ') { |
| | | trim += ' ' |
| | | } |
| | | if (text[i] === '\n' && !flag) { |
| | | flag = true |
| | | } |
| | | } |
| | | } |
| | | // å»é¤å«ææ¢è¡ç¬¦ç空串 |
| | | if (trim === ' ') { |
| | | if (flag) return |
| | | // #ifdef VUE3 |
| | | else { |
| | | const parent = this.stack[this.stack.length - 1] |
| | | if (parent && parent.name[0] === 't') return |
| | | } |
| | | // #endif |
| | | } |
| | | text = trim |
| | | } |
| | | const node = Object.create(null) |
| | | node.type = 'text' |
| | | // #ifdef (MP-BAIDU || MP-ALIPAY || MP-TOUTIAO) && VUE3 |
| | | node.attrs = {} |
| | | // #endif |
| | | node.text = decodeEntity(text) |
| | | if (this.hook(node)) { |
| | | // #ifdef MP-WEIXIN |
| | | if (this.options.selectable === 'force' && system.includes('iOS') && !uni.canIUse('rich-text.user-select')) { |
| | | this.expose() |
| | | } |
| | | // #endif |
| | | const siblings = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes |
| | | siblings.push(node) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description html è¯æ³åæå¨ |
| | | * @param {Object} handler é«å±å¤çå¨ |
| | | */ |
| | | function Lexer (handler) { |
| | | this.handler = handler |
| | | } |
| | | |
| | | /** |
| | | * @description æ§è¡è§£æ |
| | | * @param {String} content è¦è§£æçææ¬ |
| | | */ |
| | | Lexer.prototype.parse = function (content) { |
| | | this.content = content || '' |
| | | this.i = 0 // æ è®°è§£æä½ç½® |
| | | this.start = 0 // æ è®°ä¸ä¸ªåè¯çå¼å§ä½ç½® |
| | | this.state = this.text // å½åç¶æ |
| | | for (let len = this.content.length; this.i !== -1 && this.i < len;) { |
| | | this.state() |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description æ£æ¥æ ç¾æ¯å¦éå |
| | | * @param {String} method 妿éåè¦è¿è¡çæä½ |
| | | * @returns {Boolean} æ¯å¦éå |
| | | * @private |
| | | */ |
| | | Lexer.prototype.checkClose = function (method) { |
| | | const selfClose = this.content[this.i] === '/' |
| | | if (this.content[this.i] === '>' || (selfClose && this.content[this.i + 1] === '>')) { |
| | | if (method) { |
| | | this.handler[method](this.content.substring(this.start, this.i)) |
| | | } |
| | | this.i += selfClose ? 2 : 1 |
| | | this.start = this.i |
| | | this.handler.onOpenTag(selfClose) |
| | | if (this.handler.tagName === 'script') { |
| | | this.i = this.content.indexOf('</', this.i) |
| | | if (this.i !== -1) { |
| | | this.i += 2 |
| | | this.start = this.i |
| | | } |
| | | this.state = this.endTag |
| | | } else { |
| | | this.state = this.text |
| | | } |
| | | return true |
| | | } |
| | | return false |
| | | } |
| | | |
| | | /** |
| | | * @description ææ¬ç¶æ |
| | | * @private |
| | | */ |
| | | Lexer.prototype.text = function () { |
| | | this.i = this.content.indexOf('<', this.i) // æ¥æ¾æè¿çæ ç¾ |
| | | if (this.i === -1) { |
| | | // æ²¡ææ ç¾äº |
| | | if (this.start < this.content.length) { |
| | | this.handler.onText(this.content.substring(this.start, this.content.length)) |
| | | } |
| | | return |
| | | } |
| | | const c = this.content[this.i + 1] |
| | | if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) { |
| | | // æ ç¾å¼å¤´ |
| | | if (this.start !== this.i) { |
| | | this.handler.onText(this.content.substring(this.start, this.i)) |
| | | } |
| | | this.start = ++this.i |
| | | this.state = this.tagName |
| | | } else if (c === '/' || c === '!' || c === '?') { |
| | | if (this.start !== this.i) { |
| | | this.handler.onText(this.content.substring(this.start, this.i)) |
| | | } |
| | | const next = this.content[this.i + 2] |
| | | if (c === '/' && ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z'))) { |
| | | // æ ç¾ç»å°¾ |
| | | this.i += 2 |
| | | this.start = this.i |
| | | this.state = this.endTag |
| | | return |
| | | } |
| | | // å¤ç注é |
| | | let end = '-->' |
| | | if (c !== '!' || this.content[this.i + 2] !== '-' || this.content[this.i + 3] !== '-') { |
| | | end = '>' |
| | | } |
| | | this.i = this.content.indexOf(end, this.i) |
| | | if (this.i !== -1) { |
| | | this.i += end.length |
| | | this.start = this.i |
| | | } |
| | | } else { |
| | | this.i++ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description æ ç¾åç¶æ |
| | | * @private |
| | | */ |
| | | Lexer.prototype.tagName = function () { |
| | | if (blankChar[this.content[this.i]]) { |
| | | // è§£æå°æ ç¾å |
| | | this.handler.onTagName(this.content.substring(this.start, this.i)) |
| | | while (blankChar[this.content[++this.i]]); |
| | | if (this.i < this.content.length && !this.checkClose()) { |
| | | this.start = this.i |
| | | this.state = this.attrName |
| | | } |
| | | } else if (!this.checkClose('onTagName')) { |
| | | this.i++ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 屿§åç¶æ |
| | | * @private |
| | | */ |
| | | Lexer.prototype.attrName = function () { |
| | | let c = this.content[this.i] |
| | | if (blankChar[c] || c === '=') { |
| | | // è§£æå°å±æ§å |
| | | this.handler.onAttrName(this.content.substring(this.start, this.i)) |
| | | let needVal = c === '=' |
| | | const len = this.content.length |
| | | while (++this.i < len) { |
| | | c = this.content[this.i] |
| | | if (!blankChar[c]) { |
| | | if (this.checkClose()) return |
| | | if (needVal) { |
| | | // çå·åéå°ç¬¬ä¸ä¸ªé空å符 |
| | | this.start = this.i |
| | | this.state = this.attrVal |
| | | return |
| | | } |
| | | if (this.content[this.i] === '=') { |
| | | needVal = true |
| | | } else { |
| | | this.start = this.i |
| | | this.state = this.attrName |
| | | return |
| | | } |
| | | } |
| | | } |
| | | } else if (!this.checkClose('onAttrName')) { |
| | | this.i++ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 屿§å¼ç¶æ |
| | | * @private |
| | | */ |
| | | Lexer.prototype.attrVal = function () { |
| | | const c = this.content[this.i] |
| | | const len = this.content.length |
| | | if (c === '"' || c === "'") { |
| | | // æåå·ç屿§ |
| | | this.start = ++this.i |
| | | this.i = this.content.indexOf(c, this.i) |
| | | if (this.i === -1) return |
| | | this.handler.onAttrVal(this.content.substring(this.start, this.i)) |
| | | } else { |
| | | // 没æåå·ç屿§ |
| | | for (; this.i < len; this.i++) { |
| | | if (blankChar[this.content[this.i]]) { |
| | | this.handler.onAttrVal(this.content.substring(this.start, this.i)) |
| | | break |
| | | } else if (this.checkClose('onAttrVal')) return |
| | | } |
| | | } |
| | | while (blankChar[this.content[++this.i]]); |
| | | if (this.i < len && !this.checkClose()) { |
| | | this.start = this.i |
| | | this.state = this.attrName |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description ç»ææ ç¾ç¶æ |
| | | * @returns {String} ç»æçæ ç¾å |
| | | * @private |
| | | */ |
| | | Lexer.prototype.endTag = function () { |
| | | const c = this.content[this.i] |
| | | if (blankChar[c] || c === '>' || c === '/') { |
| | | this.handler.onCloseTag(this.content.substring(this.start, this.i)) |
| | | if (c !== '>') { |
| | | this.i = this.content.indexOf('>', this.i) |
| | | if (this.i === -1) return |
| | | } |
| | | this.start = ++this.i |
| | | this.state = this.text |
| | | } else { |
| | | this.i++ |
| | | } |
| | | } |
| | | |
| | | export default Parser |
New file |
| | |
| | | // çå¾
åå§å宿¯ |
| | | document.addEventListener('UniAppJSBridgeReady', () => { |
| | | document.body.onclick = () => |
| | | uni.postMessage({ |
| | | data: { |
| | | action: 'onClick' |
| | | } |
| | | }) |
| | | uni.postMessage({ |
| | | data: { |
| | | action: 'onJSBridgeReady' |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | let options |
| | | let medias = [] |
| | | |
| | | /** |
| | | * @description è·åæ ç¾çææå±æ§ |
| | | * @param {Element} ele |
| | | */ |
| | | function getAttrs (ele) { |
| | | const attrs = Object.create(null) |
| | | for (let i = ele.attributes.length; i--;) { |
| | | attrs[ele.attributes[i].name] = ele.attributes[i].value |
| | | } |
| | | return attrs |
| | | } |
| | | |
| | | /** |
| | | * @description å¾çå è½½åºé |
| | | */ |
| | | function onImgError () { |
| | | if (options[1]) { |
| | | this.src = options[1] |
| | | this.onerror = null |
| | | } |
| | | // åæ¶çå¬ç¹å» |
| | | this.onclick = null |
| | | this.ontouchstart = null |
| | | uni.postMessage({ |
| | | data: { |
| | | action: 'onError', |
| | | source: 'img', |
| | | attrs: getAttrs(this) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description æ£æ¥æ¯å¦ææå¾çå è½½å®æ¯ |
| | | */ |
| | | function checkReady () { |
| | | window.unloadimgs -= 1 |
| | | if (window.unloadimgs === 0) { |
| | | // ææå¾çå è½½å®æ¯ |
| | | uni.postMessage({ |
| | | data: { |
| | | action: 'onReady' |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description å建 dom ç»æ |
| | | * @param {object[]} nodes èç¹æ°ç» |
| | | * @param {Element} parent ç¶èç¹ |
| | | * @param {string} namespace å½åç©ºé´ |
| | | */ |
| | | function createDom (nodes, parent, namespace) { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | const node = nodes[i] |
| | | let ele |
| | | if (!node.type || node.type === 'node') { |
| | | let name = node.name |
| | | // svg éè¦è®¾ç½® namespace |
| | | if (name === 'svg') { |
| | | namespace = 'http://www.w3.org/2000/svg' |
| | | } |
| | | if (name === 'html' || name === 'body') { |
| | | name = 'div' |
| | | } |
| | | // å建æ ç¾ |
| | | if (!namespace) { |
| | | ele = document.createElement(name) |
| | | } else { |
| | | ele = document.createElementNS(namespace, name) |
| | | } |
| | | // è®¾ç½®å±æ§ |
| | | for (const item in node.attrs) { |
| | | ele.setAttribute(item, node.attrs[item]) |
| | | } |
| | | // éå½å建åèç¹ |
| | | if (node.children) { |
| | | createDom(node.children, ele, namespace) |
| | | } |
| | | |
| | | // å¤çå¾ç |
| | | if (name === 'img') { |
| | | window.unloadimgs += 1 |
| | | ele.onload = checkReady |
| | | ele.onerror = checkReady |
| | | if (!ele.src && ele.getAttribute('data-src')) { |
| | | ele.src = ele.getAttribute('data-src') |
| | | } |
| | | if (!node.attrs.ignore) { |
| | | // çå¬å¾çç¹å»äºä»¶ |
| | | ele.onclick = function (e) { |
| | | e.stopPropagation() |
| | | uni.postMessage({ |
| | | data: { |
| | | action: 'onImgTap', |
| | | attrs: getAttrs(this) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | if (options[2]) { |
| | | const image = new Image() |
| | | image.src = ele.src |
| | | ele.src = options[2] |
| | | image.onload = function () { |
| | | ele.src = this.src |
| | | } |
| | | image.onerror = function () { |
| | | ele.onerror() |
| | | } |
| | | } |
| | | ele.onerror = onImgError |
| | | } else if (name === 'a') { |
| | | // å¤ç龿¥ |
| | | ele.addEventListener('click', function (e) { |
| | | e.stopPropagation() |
| | | e.preventDefault() // 黿¢é»è®¤è·³è½¬ |
| | | const href = this.getAttribute('href') |
| | | let offset |
| | | if (href && href[0] === '#') { |
| | | offset = (document.getElementById(href.substr(1)) || {}).offsetTop |
| | | } |
| | | uni.postMessage({ |
| | | data: { |
| | | action: 'onLinkTap', |
| | | attrs: getAttrs(this), |
| | | offset |
| | | } |
| | | }) |
| | | }, true) |
| | | } else if (name === 'video' || name === 'audio') { |
| | | // å¤çé³è§é¢ |
| | | medias.push(ele) |
| | | if (!node.attrs.autoplay && !node.attrs.controls) { |
| | | ele.setAttribute('controls', 'true') |
| | | } |
| | | ele.onplay = function () { |
| | | uni.postMessage({ |
| | | data: { |
| | | action: 'onPlay' |
| | | } |
| | | }) |
| | | if (options[3]) { |
| | | for (let i = 0; i < medias.length; i++) { |
| | | if (medias[i] !== this) { |
| | | medias[i].pause() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ele.onerror = function () { |
| | | uni.postMessage({ |
| | | data: { |
| | | action: 'onError', |
| | | source: name, |
| | | attrs: getAttrs(this) |
| | | } |
| | | }) |
| | | } |
| | | } else if (name === 'table' && options[4] && !ele.style.cssText.includes('inline')) { |
| | | // å¤çè¡¨æ ¼ |
| | | const div = document.createElement('div') |
| | | div.style.overflow = 'auto' |
| | | div.appendChild(ele) |
| | | ele = div |
| | | } else if (name === 'svg') { |
| | | namespace = undefined |
| | | } |
| | | } else { |
| | | ele = document.createTextNode(node.text.replace(/&/g, '&')) |
| | | } |
| | | parent.appendChild(ele) |
| | | } |
| | | } |
| | | |
| | | // 设置 html å
容 |
| | | window.setContent = function (nodes, opts, append) { |
| | | const ele = document.getElementById('content') |
| | | |
| | | // 容卿 ·å¼ |
| | | if (opts[0]) { |
| | | document.body.style.cssText = opts[0] |
| | | } |
| | | |
| | | // é¿æå¤å¶ |
| | | if (!opts[5]) { |
| | | ele.style.userSelect = 'none' |
| | | } |
| | | |
| | | if (!append) { |
| | | ele.innerHTML = '' // ä¸è¿½å åå
æ¸
空 |
| | | medias = [] |
| | | } |
| | | |
| | | options = opts |
| | | window.unloadimgs = 0 |
| | | const fragment = document.createDocumentFragment() |
| | | createDom(nodes, fragment) |
| | | ele.appendChild(fragment) |
| | | |
| | | // 触åäºä»¶ |
| | | let height = ele.scrollHeight |
| | | uni.postMessage({ |
| | | data: { |
| | | action: 'onLoad', |
| | | height |
| | | } |
| | | }) |
| | | if (!window.unloadimgs) { |
| | | uni.postMessage({ |
| | | data: { |
| | | action: 'onReady', |
| | | height |
| | | } |
| | | }) |
| | | } |
| | | |
| | | clearInterval(window.timer) |
| | | window.timer = setInterval(() => { |
| | | if (ele.scrollHeight !== height) { |
| | | height = ele.scrollHeight |
| | | uni.postMessage({ |
| | | data: { |
| | | action: 'onHeightChange', |
| | | height: height |
| | | } |
| | | }) |
| | | } |
| | | }, 350) |
| | | } |
| | | |
| | | // åæ¶è®¡æ¶å¨ |
| | | window.onunload = function () { |
| | | clearInterval(window.timer) |
| | | } |
New file |
| | |
| | | !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).uni=n()}(this,(function(){"use strict";try{var e={};Object.defineProperty(e,"passive",{get:function(){!0}}),window.addEventListener("test-passive",null,e)}catch(e){}var n=Object.prototype.hasOwnProperty;function t(e,t){return n.call(e,t)}var i=[],a=function(e,n){var t={options:{timestamp:+new Date},name:e,arg:n};if(window.__dcloud_weex_postMessage||window.__dcloud_weex_){if("postMessage"===e){var a={data:[n]};return window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessage(a):window.__dcloud_weex_.postMessage(JSON.stringify(a))}var o={type:"WEB_INVOKE_APPSERVICE",args:{data:t,webviewIds:i}};window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessageToService(o):window.__dcloud_weex_.postMessageToService(JSON.stringify(o))}if(!window.plus)return window.parent.postMessage({type:"WEB_INVOKE_APPSERVICE",data:t,pageId:""},"*");if(0===i.length){var r=plus.webview.currentWebview();if(!r)throw new Error("plus.webview.currentWebview() is undefined");var d=r.parent(),s="";s=d?d.id:r.id,i.push(s)}if(plus.webview.getWebviewById("__uniapp__service"))plus.webview.postMessageToUniNView({type:"WEB_INVOKE_APPSERVICE",args:{data:t,webviewIds:i}},"__uniapp__service");else{var w=JSON.stringify(t);plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat("WEB_INVOKE_APPSERVICE",'",').concat(w,",").concat(JSON.stringify(i),");"))}},o={navigateTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("navigateTo",{url:encodeURI(n)})},navigateBack:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delta;a("navigateBack",{delta:parseInt(n)||1})},switchTab:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("switchTab",{url:encodeURI(n)})},reLaunch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("reLaunch",{url:encodeURI(n)})},redirectTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("redirectTo",{url:encodeURI(n)})},getEnv:function(e){window.plus?e({plus:!0}):e({h5:!0})},postMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a("postMessage",e.data||{})}},r=/uni-app/i.test(navigator.userAgent),d=/Html5Plus/i.test(navigator.userAgent),s=/complete|loaded|interactive/;var w=window.my&&navigator.userAgent.indexOf("AlipayClient")>-1;var u=window.swan&&window.swan.webView&&/swan/i.test(navigator.userAgent);var c=window.qq&&window.qq.miniProgram&&/QQ/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var g=window.tt&&window.tt.miniProgram&&/toutiaomicroapp/i.test(navigator.userAgent);var v=window.wx&&window.wx.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var p=window.qa&&/quickapp/i.test(navigator.userAgent);for(var l,_=function(){window.UniAppJSBridge=!0,document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady",{bubbles:!0,cancelable:!0}))},f=[function(e){if(r||d)return window.__dcloud_weex_postMessage||window.__dcloud_weex_?document.addEventListener("DOMContentLoaded",e):window.plus&&s.test(document.readyState)?setTimeout(e,0):document.addEventListener("plusready",e),o},function(e){if(v)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.wx.miniProgram},function(e){if(c)return window.QQJSBridge&&window.QQJSBridge.invoke?setTimeout(e,0):document.addEventListener("QQJSBridgeReady",e),window.qq.miniProgram},function(e){if(w){document.addEventListener("DOMContentLoaded",e);var n=window.my;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(u)return document.addEventListener("DOMContentLoaded",e),window.swan.webView},function(e){if(g)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(p){window.QaJSBridge&&window.QaJSBridge.invoke?setTimeout(e,0):document.addEventListener("QaJSBridgeReady",e);var n=window.qa;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){return document.addEventListener("DOMContentLoaded",e),o}],m=0;m<f.length&&!(l=f[m](_));m++);l||(l={});var E="undefined"!=typeof uni?uni:{};if(!E.navigateTo)for(var b in l)t(l,b)&&(E[b]=l[b]);return E.webView=l,E})); |
New file |
| | |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"> |
| | | <style> |
| | | html, |
| | | body { |
| | | width: 100%; |
| | | height: 100%; |
| | | overflow-x: scroll; |
| | | overflow-y: hidden; |
| | | } |
| | | |
| | | body { |
| | | margin: 0; |
| | | } |
| | | |
| | | video { |
| | | width: 300px; |
| | | height: 225px; |
| | | } |
| | | |
| | | img { |
| | | max-width: 100%; |
| | | -webkit-touch-callout: none; |
| | | } |
| | | </style> |
| | | </head> |
| | | |
| | | <body> |
| | | <div id="content" style="overflow: hidden;"></div> |
| | | <script type="text/javascript" src="./js/uni.webview.min.js"></script> |
| | | <script type="text/javascript" src="./js/handler.js"></script> |
| | | </body> |
New file |
| | |
| | | /** |
| | | * @fileoverview ç¨äºæµè¯ç html å
容 |
| | | */ |
| | | module.exports = `<title>坿æ¬ç¤ºä¾</title> |
| | | <div> |
| | | <section style="text-align: center; margin: 0px auto;"> |
| | | <section style="border-radius: 4px; border: 1px solid #757576; display: inline-block; padding: 5px 20px;"> |
| | | <span style="font-size: 18px; color: #595959;">è¡¨æ ¼</span> |
| | | </section> |
| | | </section> |
| | | <section style="margin-top: 1.5em;"> |
| | | <table width="100%" cellspacing="0" cellpadding="5"> |
| | | <thead> |
| | | <tr> |
| | | <th>æ é¢ 1</th> |
| | | <th>æ é¢ 2</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | <tr> |
| | | <td align="center">å
容 1</td> |
| | | <td align="center">å
容 2</td> |
| | | </tr> |
| | | <tr style="background-color: #f6f8fa;"> |
| | | <td align="center">å
容 3</td> |
| | | <td align="center"><a>龿¥</a></td> |
| | | </tr> |
| | | <tr> |
| | | <td align="center">å
容 5</td> |
| | | <td align="center">å
容 6</td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | <div style="font-size: 12px; color: gray; text-align: center; margin-top: 5px;">æ®éè¡¨æ ¼</div> |
| | | </section> |
| | | <section style="margin-top: 1.5em;"> |
| | | <table width="500px" cellspacing="0" cellpadding="5"> |
| | | <thead> |
| | | <tr> |
| | | <th>æ é¢ 1</th> |
| | | <th>æ é¢ 2</th> |
| | | <th>æ é¢ 3</th> |
| | | <th>æ é¢ 4</th> |
| | | <th>æ é¢ 5</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | <tr> |
| | | <td align="center">å
容 1</td> |
| | | <td align="center">å
容 2</td> |
| | | <td align="center">å
容 3</td> |
| | | <td align="center">å
容 4</td> |
| | | <td align="center">å
容 5</td> |
| | | </tr> |
| | | <tr style="background-color: #f6f8fa;"> |
| | | <td align="center"><a>龿¥</a></td> |
| | | <td align="center">å
容 7</td> |
| | | <td align="center">å
容 8</td> |
| | | <td align="center">å
容 9</td> |
| | | <td align="center">å
容 10</td> |
| | | </tr> |
| | | <tr> |
| | | <td align="center">å
容 11</td> |
| | | <td align="center">å
容 12</td> |
| | | <td align="center">å
容 13</td> |
| | | <td align="center">å
容 14</td> |
| | | <td align="center">å
容 15</td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | <div style="font-size: 12px; color: gray; text-align: center; margin-top: 5px;">é¿è¡¨æ ¼ï¼å¯ä»¥åç¬æ¨ªåæ»å¨</div> |
| | | </section> |
| | | <section style="margin-top: 1.5em;"> |
| | | <table width="100%" cellspacing="0" cellpadding="5"> |
| | | <thead> |
| | | <tr> |
| | | <th align="center">æ é¢ 1</th> |
| | | <th align="center">æ é¢ 2</th> |
| | | <th align="center">æ é¢ 3</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | <tr> |
| | | <td align="center" colspan="2">å
容 1</td> |
| | | <td align="center" rowspan="2">å
容 2</td> |
| | | </tr> |
| | | <tr> |
| | | <td align="center" rowspan="2">å
容 3</td> |
| | | <td align="center">å
容 4</td> |
| | | </tr> |
| | | <tr> |
| | | <td align="center" colspan="2">å
容 5</td> |
| | | </tr> |
| | | <tr> |
| | | <td align="center">å
容 6</td> |
| | | <td align="center">å
容 7</td> |
| | | <td align="center"><a>龿¥</a></td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | <div style="font-size: 12px; color: gray; text-align: center; margin-top: 5px;">嫿åå¹¶åå
æ ¼çè¡¨æ ¼</div> |
| | | </section> |
| | | <section id="list" style="text-align: center; margin: 0px auto; margin-top: 2em"> |
| | | <section style="border-radius: 4px; border: 1px solid #757576; display: inline-block; padding: 5px 20px;"> |
| | | <span style="font-size: 18px; color: #595959;">å表</span> |
| | | </section> |
| | | </section> |
| | | <section style="margin-top: 1.5em;"> |
| | | <ol style="margin-bottom: 1.5em;"> |
| | | <li>è¿æ¯ç¬¬ä¸æ¡å表项</li> |
| | | <li>è¿æ¯ç¬¬äºæ¡å表项</li> |
| | | <li>è¿æ¯ç¬¬ä¸æ¡ <a>龿¥</a></li> |
| | | </ol> |
| | | <ol type="A" style="margin-bottom: 1.5em;"> |
| | | <li>è¿æ¯ç¬¬ä¸æ¡å表项</li> |
| | | <li>è¿æ¯ç¬¬äºæ¡å表项</li> |
| | | <li>è¿æ¯ç¬¬ä¸æ¡ <a>龿¥</a></li> |
| | | </ol> |
| | | <ol type="I" style="margin-bottom: 1.5em;"> |
| | | <li>è¿æ¯ç¬¬ä¸æ¡å表项</li> |
| | | <li>è¿æ¯ç¬¬äºæ¡å表项</li> |
| | | <li>è¿æ¯ç¬¬ä¸æ¡ <a>龿¥</a></li> |
| | | </ol> |
| | | <ul> |
| | | <li>第ä¸çº§æ åºå表</li> |
| | | <li>第ä¸çº§æ åºå表 |
| | | <ul> |
| | | <li>第äºçº§æ åºå表</li> |
| | | <li>第äºçº§æ åºå表 |
| | | <ul> |
| | | <li>第ä¸çº§æ åºå表</li> |
| | | <li>第ä¸çº§ <a>龿¥</a></li> |
| | | </ul> |
| | | </li> |
| | | </ul> |
| | | </li> |
| | | </ul> |
| | | </section> |
| | | <section style="text-align: center; margin: 0px auto; margin-top: 2em"> |
| | | <section style="border-radius: 4px; border: 1px solid #757576; display: inline-block; padding: 5px 20px;"> |
| | | <span style="font-size: 18px; color: #595959;">ææ¬</span> |
| | | </section> |
| | | </section> |
| | | <section style="margin-top: 1.5em;"> |
| | | <p style="margin-bottom: 1em;"> |
| | | <ruby> |
| | | æ¼<rp>(</rp><rt>pin</rt><rp>)</rp> |
| | | é³<rp>(</rp><rt>yin</rt><rp>)</rp> |
| | | </ruby> |
| | | <i>æä½</i> |
| | | <b>ç²ä½</b> |
| | | 䏿 <sup>1</sup> |
| | | 䏿 <sub>2</sub> |
| | | </p> |
| | | <p style="margin-bottom: 1em;"> |
| | | <span style="text-decoration: overline;">ä¸å线</span> |
| | | <s>ä¸å线</s> |
| | | <u>ä¸å线</u> |
| | | </p> |
| | | <p> |
| | | <big>大ä¸å·</big> |
| | | <span>æ£å¸¸</span> |
| | | <small>å°ä¸å·</small> |
| | | </p> |
| | | <h2 style="margin-top: 0.5em;">大æ é¢</h2> |
| | | <h3 style="margin-top: 0.5em;">䏿 é¢</h3> |
| | | <h4 style="margin-top: 0.5em;">å°æ é¢</h4> |
| | | </section> |
| | | <section style="text-align: center; margin: 0px auto; margin-top: 2em"> |
| | | <section style="border-radius: 4px; border: 1px solid #757576; display: inline-block; padding: 5px 20px;"> |
| | | <span style="font-size: 18px; color: #595959;">龿¥</span> |
| | | </section> |
| | | </section> |
| | | <section style="margin-top: 1.5em; text-align: center;"> |
| | | <a href="#">跳转å°é¡¶é¨</a> <a href="#list">跳转å°å表</a> |
| | | <div style="font-size: 12px; color: gray; margin-top: 5px;">éç¹é¾æ¥ï¼å°æ»å¨å°å¯¹åºä½ç½®</div> |
| | | </section> |
| | | <section style="margin-top: 1.5em; text-align: center;"> |
| | | <a href="https://github.com/jin-yufeng/mp-html">å¤é¨é¾æ¥</a> |
| | | <div style="font-size: 12px; color: gray; margin-top: 5px;">å¤é¨é¾æ¥ï¼å°å¤å¶é¾æ¥</div> |
| | | </section> |
| | | <section style="margin-top: 1.5em; text-align: center;"> |
| | | <a href="/pages/jump/jump">å
é¨é¾æ¥</a> |
| | | <div style="font-size: 12px; color: gray; margin-top: 5px;">å
é¨é¾æ¥ï¼å°è·³è½¬é¡µé¢</div> |
| | | </section> |
| | | <section style="text-align: center; margin: 0px auto; margin-top: 2em"> |
| | | <section style="border-radius: 4px; border: 1px solid #757576; display: inline-block; padding: 5px 20px;"> |
| | | <span style="font-size: 18px; color: #595959;">å¾ç</span> |
| | | </section> |
| | | </section> |
| | | <section style="margin-top: 1.5em; text-align: center;"> |
| | | <img src="demo.jpg"> |
| | | <div style="font-size: 12px; color: gray; margin-top: 5px;">ç¹å»é¢è§</div> |
| | | </section> |
| | | <section style="margin-top: 1.5em; text-align: center;"> |
| | | <svg width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;"> |
| | | <path fill="#000" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z"> |
| | | <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"/> |
| | | </path> |
| | | </svg> |
| | | <div style="font-size: 12px; color: gray; margin-top: 5px;">svg å¨ç»</div> |
| | | </section> |
| | | </div>` |
New file |
| | |
| | | /** |
| | | * @fileoverview åå
æµè¯ |
| | | */ |
| | | const path = require('path') |
| | | const simulate = require('miniprogram-simulate') |
| | | |
| | | const html = require('./content') // æµè¯ html |
| | | const dist = '../dev/mp-weixin/components/mp-html/index' // ç»ä»¶ç®å½ |
| | | |
| | | // æ° api 模æ |
| | | wx.getWindowInfo = function () { |
| | | return { |
| | | windowWidth: 414 |
| | | } |
| | | } |
| | | wx.getDeviceInfo = function () { |
| | | return { |
| | | system: 'iOS 10.0.1' |
| | | } |
| | | } |
| | | const mpHtml = simulate.load(path.resolve(__dirname, dist), 'mp-html') |
| | | |
| | | // æ¸²ææµè¯ |
| | | test('render', async () => { |
| | | // åå»ºåæ¸²æé¡µé¢ |
| | | const id = simulate.load({ |
| | | data: { |
| | | containerStyle: '', |
| | | copyLink: true, |
| | | lazyLoad: true, |
| | | pauseVideo: true, |
| | | previewImg: true, |
| | | useAnchor: true |
| | | }, |
| | | template: |
| | | `<scroll-view id="scroll" style="height:100px" scroll-y scroll-top="{{top}}"> |
| | | <mp-html id="article" container-style="{{containerStyle}}" content="{{html}}" domain="https://mp-html.oss-cn-hangzhou.aliyuncs.com" copy-link="{{copyLink}}" loading-img="xxx" error-img="xxx" lazy-load="{{lazyLoad}}" pause-video="{{pauseVideo}}" preview-img="{{previewImg}}" scroll-table use-anchor="{{useAnchor}}">å è½½ä¸...</mp-html> |
| | | </scroll-view>`, |
| | | usingComponents: { |
| | | 'mp-html': mpHtml |
| | | } |
| | | }) |
| | | const page = simulate.render(id) |
| | | |
| | | // è®¾ç½®æ°æ® |
| | | page.setData({ |
| | | html |
| | | }) |
| | | await simulate.sleep(1000) |
| | | |
| | | const comp = page.querySelector('#article') |
| | | expect(comp.dom.tagName).toBe('MP-HTML') |
| | | |
| | | await simulate.sleep(50) |
| | | |
| | | // api æµè¯ |
| | | comp.instance.setContent( |
| | | `<!-- æµè¯ base æ ç¾ --> |
| | | <base href="https://xxx.com"> |
| | | <!-- æµè¯ script æ ç¾ --> |
| | | <script> |
| | | console.log('11') |
| | | </script> |
| | | <!-- æµè¯ embed æ ç¾ --> |
| | | <embed src="xxx.mp4" /> |
| | | <embed autostart src="xxx.m4a" /> |
| | | <!-- æµè¯ source æ ç¾ --> |
| | | <video src="xxx.mp4" style="height:auto" loop ></video> |
| | | <!-- æµè¯ table æ ç¾ --> |
| | | <table align="center"></table> |
| | | <table align="left" border="1"> |
| | | <td> |
| | | <a>xxx</a> |
| | | </td> |
| | | </table> |
| | | <table width="100%" border="1" style="border-collapse: collapse;"> |
| | | <colgroup><col style="width: 40%;"><col style="width: 60%;"></colgroup> |
| | | <tr> |
| | | <th style="vertical-align: bottom;" width="20%">æ é¢1</th> |
| | | <th width="80%">æ é¢2</th> |
| | | </tr> |
| | | <tr style="color:gray"> |
| | | <td colspan="2" style="vertical-align:middle;text-align:right"><a>å
容1</a></td> |
| | | </tr> |
| | | </table> |
| | | <table> |
| | | <tr> |
| | | <td><img src="xxx.jpg" style="display:block">å¾ç<td> |
| | | <td><img src="xxx.jpg">å¾ç<td> |
| | | </tr> |
| | | </table> |
| | | <!-- æµè¯ font æ ç¾ãä¸å屿§åæ³ãå®ä½ --> |
| | | <font color='red' face = "å®ä½" size=8 >更多</font > |
| | | <font size=0>1 < 2</font> |
| | | <font>&#aaa;&aaa;&</FONT> |
| | | <!-- æµè¯ rpx åä½å¤ç --> |
| | | <span id="anchor" style="font-size:30rpx">11</span> |
| | | <!-- æµè¯ pre æ ç¾å¤çï¼ä¿ç空ç½ç¬¦ï¼ --> |
| | | <div style="white-space:pre"> |
| | | <pre>var i = 0</pre> |
| | | </div> |
| | | <!-- æµè¯ä¸åæ
åµä¸çå¾çå¤ç --> |
| | | <img src="xxx" style="width:100px;height:100px;object-fit:contain"> |
| | | <img src="xxx" style="width:100px;object-fit:cover;height:100px;"> |
| | | <a data-test="test"> |
| | | <img src="//xxx.jpg"> |
| | | </a> |
| | | <div style="display:inline-block !important;display:block"> |
| | | <img style="width:100%;" src="xxx.jpg"> |
| | | </p> |
| | | </div> |
| | | <div style="display:flex"> |
| | | <div style="flex:1"> |
| | | <img src="//xxx.jpg" style="display:inline"> |
| | | </div> |
| | | </div> |
| | | <img style="width:auto" src="data:image/png;base64,xxxx"> |
| | | <img src="xxx" style="width:20px" height="10"> |
| | | <img src="yyy.webp" style="width:1000px" ignore> |
| | | <svg /> |
| | | <svg viewbox="0 0 1 1"><text>123</text><svg></svg></svg> |
| | | <svg><foreignobject><div>123</div></foreignobject></svg> |
| | | <div class="ql-align-center" style="background-image:url("/xxx.jpg?a=2&b=3")"></div> |
| | | <![CDATA[<]]> |
| | | <!-- æµè¯ flex å¸å±ãæªéåæ ç¾ãdata- 屿§å¤ç --> |
| | | <div style="display:flex;width:1000px"> |
| | | <div style="flex:1" dir="rtl">123</div> |
| | | </div> |
| | | </br><div data-test="xxx" style="display:flex;display:-webkit-flex;"><div> |
| | | <img data-src="/xxx.jpg" style="width:100%;height:100px"> `, true) // è¡¥å
æµè¯ |
| | | expect(comp.instance.getText().includes('æ´å¤')).toBe(true) // æ£æ¥ä¸æ¹çå®ä½æ¯å¦è¢«è§£ç |
| | | await comp.instance.getRect() |
| | | |
| | | await comp.instance.navigateTo('anchor') // åºäºé¡µé¢è·³è½¬ |
| | | comp.instance.in(page.instance) // é误设置 |
| | | comp.instance.in(page.instance, '#scroll', 'top') |
| | | await comp.instance.navigateTo('anchor') // åºäº scroll-view æ»å¨ |
| | | |
| | | page.setData({ |
| | | useAnchor: false |
| | | }) |
| | | await simulate.sleep(50) |
| | | comp.instance.setContent('<span id="test">123</span>', true) |
| | | try { |
| | | await comp.instance.navigateTo('anchor') // ç¦ç¨éç¹çæ
åµä¸è·³è½¬ |
| | | } catch (e) { } |
| | | |
| | | page.setData({ |
| | | containerStyle: 'white-space:pre-wrap' |
| | | }) |
| | | await simulate.sleep(50) |
| | | comp.instance.setContent(' ç©ºæ ¼\næ¢è¡') |
| | | expect(comp.instance.getText().includes('\n')).toBe(true) // æ£æ¥æ¢è¡æ¯å¦è¢«ä¿ç |
| | | |
| | | // æ 徿µè¯ |
| | | page.setData({ |
| | | lazyLoad: false |
| | | }) |
| | | await simulate.sleep(50) |
| | | comp.instance.setContent('<div>Hello world!</div>') |
| | | simulate.sleep(50) |
| | | |
| | | // é¿å
容æµè¯ |
| | | let content = '<div>1</div>'.repeat(50) + '<div>' |
| | | for (let i = 0; i < 50; i++) { |
| | | content += '<div>' + i + '</div>' |
| | | } |
| | | content += '<a>xxx</a>' |
| | | for (let i = 0; i < 3; i++) { |
| | | content += '<div>' + i + '</div>' |
| | | } |
| | | comp.instance.setContent(content) |
| | | simulate.sleep(50) |
| | | expect(comp.data.nodes.length).toBe(2) // åºè¯¥åå为 2 å |
| | | expect(comp.data.nodes[1].children.length).toBe(5) // åºè¯¥åå为 5 å |
| | | |
| | | await simulate.sleep(50) // çå¾
弿¥ api æ§è¡å®æ¯ |
| | | |
| | | // ç§»é¤èç¹ |
| | | comp.triggerLifeTime('detached') |
| | | }) |
| | | |
| | | // äºä»¶æµè¯ |
| | | test('event', async () => { |
| | | // 模æ api |
| | | wx.createVideoContext = function () { |
| | | // 模æè§é¢ context |
| | | return { |
| | | pause: function () { }, |
| | | playbackRate: function () { } |
| | | } |
| | | } |
| | | // æµè¯å¤±è´¥åè° |
| | | wx.navigateTo = function (obj) { |
| | | setTimeout(() => { |
| | | if (typeof obj.fail === 'function') { |
| | | obj.fail() |
| | | } |
| | | }, 0) |
| | | } |
| | | wx.switchTab = function (obj) { |
| | | setTimeout(() => { |
| | | if (typeof obj.fail === 'function') { |
| | | obj.fail() |
| | | } |
| | | }, 0) |
| | | } |
| | | |
| | | const comp = simulate.render(mpHtml) |
| | | comp.setData({ |
| | | selectable: 'force', |
| | | loadingImg: 'xxx' |
| | | }) |
| | | await simulate.sleep(50) |
| | | |
| | | comp.instance.setContent( |
| | | `<img src="xxx"> |
| | | <img src="yyy" width="100" height="50" ignore> |
| | | <a href="#aaa"><img src="xxx"></a> |
| | | <a href="https://github.com/jin-yufeng/mp-html">龿¥2</a> |
| | | <a href="pages/test/test">龿¥3</a> |
| | | <video src="xxx"></video> |
| | | <video> |
| | | <source src="/xxx"> |
| | | <source src="//yyy"> |
| | | </video> |
| | | <base href="https://xxx.com">`) |
| | | |
| | | await simulate.sleep(100) |
| | | |
| | | const node = comp.querySelector('#_root') |
| | | node.triggerLifeTime('attached') |
| | | comp.instance._add({ |
| | | detail: node.instance |
| | | }) |
| | | // 模æå¾çå è½½å®æ¯ |
| | | for (let i = 0; i <= 1; i++) { |
| | | node.instance.imgLoad({ |
| | | target: { |
| | | dataset: { |
| | | i: i.toString() |
| | | } |
| | | }, |
| | | detail: { |
| | | width: 100, |
| | | height: 100 |
| | | } |
| | | }) |
| | | // 模æå¾ç被ç¹å» |
| | | node.instance.imgTap({ |
| | | target: { |
| | | dataset: { |
| | | i: i.toString() |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | comp.setData({ |
| | | loadingImg: '' |
| | | }) |
| | | await simulate.sleep(350) |
| | | node.instance.imgLoad({ |
| | | target: { |
| | | dataset: { |
| | | i: '1' |
| | | } |
| | | } |
| | | }) |
| | | |
| | | // 模æå¾ç龿¥è¢«ç¹å» |
| | | node.instance.imgTap({ |
| | | target: { |
| | | dataset: { |
| | | i: '2_0' |
| | | } |
| | | } |
| | | }) |
| | | node.instance.noop() |
| | | // 模æå¾çåºé |
| | | const imgError = () => node.instance.mediaError({ |
| | | target: { |
| | | dataset: { |
| | | i: '0' |
| | | } |
| | | }, |
| | | detail: { |
| | | errMsg: 'test' |
| | | } |
| | | }) |
| | | imgError() |
| | | comp.setData({ |
| | | errorImg: 'xxx' |
| | | }, imgError) |
| | | // 模æé¾æ¥è¢«ç¹å» |
| | | for (let i = 2; i <= 4; i++) { |
| | | node.instance.linkTap({ |
| | | currentTarget: { |
| | | dataset: { |
| | | i: i.toString() |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | // 模æè§é¢ææ¾ |
| | | for (let i = 0; i < 3; i++) { |
| | | node.instance.play({ |
| | | target: { |
| | | id: 'v' + (i % 2), |
| | | dataset: { |
| | | i: (5 + (i % 2)).toString() |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | // è§é¢åéææ¾ |
| | | comp.instance.setPlaybackRate(1.5) |
| | | node.instance.play({ |
| | | target: { |
| | | id: 'v2', |
| | | dataset: { |
| | | i: '6' |
| | | } |
| | | } |
| | | }) |
| | | // æåè§é¢ææ¾ |
| | | comp.instance.pauseMedia() |
| | | // 模æè§é¢åºé |
| | | node.instance.mediaError({ |
| | | target: { |
| | | dataset: { |
| | | i: '6' |
| | | } |
| | | }, |
| | | detail: { |
| | | errMsg: 'test' |
| | | } |
| | | }) |
| | | |
| | | // ç¦ç¨ä¸äºåè½ |
| | | comp.setData({ |
| | | copyLink: false, |
| | | pauseVideo: false, |
| | | previewImg: false |
| | | }, () => { |
| | | // ç¦ç¨èªå¨æ·è´åç¹å»å¤é¨é¾æ¥ |
| | | node.instance.linkTap({ |
| | | currentTarget: { |
| | | dataset: { |
| | | i: '3' |
| | | } |
| | | } |
| | | }) |
| | | // ç¦ç¨èªå¨æååææ¾è§é¢ |
| | | node.instance.play({ |
| | | target: { |
| | | id: 'v0', |
| | | dataset: { |
| | | i: '5' |
| | | } |
| | | } |
| | | }) |
| | | // ç¦ç¨é¢è§åç¹å»å¾ç |
| | | node.instance.imgTap({ |
| | | target: { |
| | | dataset: { |
| | | i: '0' |
| | | } |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | await simulate.sleep(100) |
| | | }) |
New file |
| | |
| | | /** |
| | | * @fileoverview é
ç½®æä»¶ |
| | | */ |
| | | module.exports = { |
| | | /** |
| | | * @description éè¦çæä»¶å表 |
| | | */ |
| | | plugins: [ |
| | | // æéæå¼æ³¨éå³å¯ |
| | | // 'audio', // é³ä¹ææ¾å¨ |
| | | // 'editable', // å
容ç¼è¾ |
| | | // 'emoji', // å°è¡¨æ
|
| | | // 'highlight', // 代ç é«äº® |
| | | // 'markdown', // è§£æ md |
| | | // 'latex', // è§£æ latex |
| | | // 'search', // å
³é®è¯æç´¢ |
| | | // 'style', // è§£æ style æ ç¾ |
| | | // 'txv-video', // 使ç¨è
¾è®¯è§é¢ |
| | | // 'img-cache' // å¾çç¼å |
| | | // 'card', // å¡çå±ç¤º |
| | | ], |
| | | |
| | | /** |
| | | * @description è¦å¼å
¥å°ç»ä»¶ä¸çå¤é¨æ ·å¼ï¼cssï¼ |
| | | * ä»
æ¯ææ ç¾åå class éæ©å¨ |
| | | */ |
| | | externStyle: '', |
| | | |
| | | /** |
| | | * @description è¦å¼å
¥å°æ¨¡æ¿ä¸çèªå®ä¹æ ç¾ï¼ad çï¼ |
| | | * æ¯ä¸ªæ ç¾ä¸ºä¸ä¸ª objectï¼å
å« nameï¼æ ç¾åï¼å¿
è¦ï¼ãattrsï¼å±æ§å表ï¼éå¿
è¦ï¼ãplatformsï¼éè¦æ·»å çå¹³å°ï¼éå¿
è¦ï¼ |
| | | */ |
| | | customElements: [ |
| | | /* |
| | | // éè¦ä½¿ç¨å¹¿åæ ç¾åæå¼æ¤æ³¨é |
| | | { |
| | | name: 'ad', |
| | | attrs: ['unit-id'] |
| | | } |
| | | */ |
| | | ], |
| | | |
| | | /** |
| | | * @description babel é
ç½®ï¼es6 转 es5ï¼ |
| | | * @tutorial https://babeljs.io/docs/usage/options/ |
| | | */ |
| | | babel: { |
| | | presets: ['@babel/env'] |
| | | }, |
| | | |
| | | /** |
| | | * @description js å缩é
ç½® |
| | | * @tutorial https://www.npmjs.com/package/uglify-js#minify-options |
| | | */ |
| | | uglify: { |
| | | mangle: { |
| | | toplevel: true |
| | | }, |
| | | output: { |
| | | comments: /^!/ |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * @description html å缩é
ç½® |
| | | * @tutorial https://github.com/kangax/html-minifier#options-quick-reference |
| | | */ |
| | | htmlmin: { |
| | | caseSensitive: true, |
| | | collapseWhitespace: true, |
| | | removeComments: true, |
| | | keepClosingSlash: true |
| | | }, |
| | | |
| | | /** |
| | | * @description css å缩é
ç½® |
| | | * @tutorial https://github.com/jakubpawlowicz/clean-css#constructor-options |
| | | */ |
| | | cleanCss: { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * @fileoverview å°å¾®ä¿¡ç«¯ç代ç 转æ¢å°åä¸ªå¹³å° |
| | | */ |
| | | const through2 = require('through2') |
| | | |
| | | // api åç¼ |
| | | const prefix = { |
| | | weixin: { |
| | | wxml: 'wx:', |
| | | js: 'wx.' |
| | | }, |
| | | qq: { |
| | | wxml: 'qq:', |
| | | js: 'qq.' |
| | | }, |
| | | baidu: { |
| | | wxml: 's-', |
| | | js: 'swan.' |
| | | }, |
| | | alipay: { |
| | | wxml: 'a:', |
| | | js: 'my.' |
| | | }, |
| | | toutiao: { |
| | | wxml: 'tt:', |
| | | js: 'tt.' |
| | | } |
| | | } |
| | | // æä»¶ååç¼ |
| | | const suffix = { |
| | | weixin: { |
| | | wxml: '.wxml', |
| | | wxss: '.wxss' |
| | | }, |
| | | qq: { |
| | | wxml: '.qml', |
| | | wxss: '.qss' |
| | | }, |
| | | baidu: { |
| | | wxml: '.swan', |
| | | wxss: '.css' |
| | | }, |
| | | alipay: { |
| | | wxml: '.axml', |
| | | wxss: '.acss' |
| | | }, |
| | | toutiao: { |
| | | wxml: '.ttml', |
| | | wxss: '.ttss' |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description ååºä¸¤ä¸ªæ¬å·ä¹é´çå
容 |
| | | * @param {string} content æ»å
容 |
| | | * @param {number} i å¼å§ä½ç½® |
| | | */ |
| | | function getSection (content, i) { |
| | | let j = i + 1 |
| | | let num = 1 |
| | | const start = content[i] |
| | | const end = start === '(' ? ')' : '}' |
| | | while (num) { |
| | | if (content[j] === start) { |
| | | num++ |
| | | } else if (content[j] === end) { |
| | | num-- |
| | | } |
| | | j++ |
| | | } |
| | | return content.substring(i, j) |
| | | } |
| | | |
| | | /** |
| | | * @description å¤çä¸åå°ç¨åºå¹³å°é´çå·®å¼ |
| | | * @param {string} platform 使ç¨å¹³å° |
| | | */ |
| | | module.exports = function (platform) { |
| | | if (platform !== 'uni-app') { |
| | | platform = platform.split('-')[1] |
| | | } |
| | | return through2.obj(function (file, _, callback) { |
| | | if (file.isBuffer()) { |
| | | let content = file.contents.toString() |
| | | if (platform === 'uni-app') { |
| | | if (file.extname === '.js') { |
| | | content = content.replace(/\.properties/g, '') |
| | | } |
| | | } else { |
| | | // wxml æä»¶å¤ç |
| | | if (file.extname === '.wxml') { |
| | | content = content.replace(/wx:/g, prefix[platform].wxml) // æ¿æ¢ api åç¼ |
| | | file.extname = suffix[platform].wxml // ä¿®æ¹åç¼å |
| | | if (platform === 'qq') { |
| | | // wxs 转为 qs |
| | | content = content.replace(/<wxs/g, '<qs').replace(/<\/wxs/g, '</qs') |
| | | } else if (platform === 'baidu') { |
| | | content = content.replace(/s-if=['"]{{(\S+)}}['"]/g, 's-if="$1"') // s-if å s-for åä¸å {{}} |
| | | .replace(/s-for=['"]{{(\S+)}}['"]/g, 's-for="$1"') |
| | | .replace(/data="(.*?)"/g, 'data="{$1}"') |
| | | } else if (platform === 'alipay') { |
| | | content = content.replace('block-size', 'handle-size') |
| | | .replace(/longpress/g, 'longTap') |
| | | .replace(/bind([\S])/g, (_, $1) => { // bindevent 转为 onEvent |
| | | return 'on' + $1.toUpperCase() |
| | | }).replace(/catch([\S])/g, (_, $1) => { // catchevent 转为 catchEvent |
| | | return 'catch' + $1.toUpperCase() |
| | | }) |
| | | } |
| | | } else if (file.extname === '.js') { |
| | | // js æä»¶å¤ç |
| | | // æ¿æ¢ api åç¼ |
| | | content = content.replace(/wx\./g, prefix[platform].js) |
| | | |
| | | // æ¯ä»å®æ ¼å¼è½¬æ¢ |
| | | if (platform === 'alipay') { |
| | | // å° aa.triggerEvent('bb', cc) æ¿æ¢ä¸º aa.props.onBb && aa.props.onBb(cc) |
| | | content = content.replace(/([a-zA-Z0-9._]+).triggerEvent\(['"](\S+?)['"],*/g, function (_, $1, $2) { |
| | | const method = `${$1}.props.on${$2[0].toUpperCase()}${$2.slice(1)}` |
| | | return `${method}&&${method}(` |
| | | }) |
| | | |
| | | // è½¬æ¢ showToast |
| | | let i = content.indexOf('.showToast') |
| | | while (i !== -1) { |
| | | i += 10 |
| | | const section = getSection(content, i) |
| | | content = content.substr(0, i) + section.replace('title', 'content') + content.substr(i + section.length) |
| | | i = content.indexOf('.showToast', i) |
| | | } |
| | | // è½¬æ¢ showActionSheet |
| | | i = content.indexOf('.showActionSheet') |
| | | while (i !== -1) { |
| | | i += 16 |
| | | const section = getSection(content, i) |
| | | content = content.substr(0, i) + section.replace('itemList', 'items') + content.substr(i + section.length) |
| | | i = content.indexOf('.showActionSheet', i) |
| | | } |
| | | // è½¬æ¢ setClipboardData |
| | | i = content.indexOf('.setClipboardData') |
| | | while (i !== -1) { |
| | | i += 17 |
| | | const section = getSection(content, i) |
| | | content = content.substr(0, i - 4) + section.replace('data', 'text') + content.substr(i + section.length) |
| | | i = content.indexOf('.setClipboardData', i) |
| | | } |
| | | // ç»ä»¶æ ¼å¼è½¬æ¢ |
| | | if (content.includes('Component({')) { |
| | | // æ¿æ¢çå½å¨æ |
| | | content = content.replace('created:', 'didMount:') |
| | | .replace('attached:', 'didMount:') |
| | | .replace('detached:', 'didUnmount:') |
| | | // å° properties åæ®µè½¬ä¸º props æ ¼å¼ |
| | | i = content.indexOf('{', content.indexOf('properties:')) |
| | | let props |
| | | let propsStr = '{' |
| | | const objStr = getSection(content, i) |
| | | // ååºæ´ä¸ª properties åæ®µ |
| | | eval('props = ' + objStr) // eslint-disable-line |
| | | for (const item in props) { |
| | | if (!props[item]) continue |
| | | propsStr += item + ':' |
| | | if (props[item].value) { |
| | | // 设置äºé»è®¤å¼ |
| | | if (typeof props[item].value === 'boolean') { |
| | | propsStr += props[item].value ? '!0' : '!1' |
| | | } else { |
| | | propsStr += props[item].value |
| | | } |
| | | } else { |
| | | // 没æè®¾ç½®é»è®¤å¼ |
| | | const type = props[item].type || props[item] |
| | | if (type === String) { |
| | | propsStr += '""' |
| | | } else if (type === Boolean) { |
| | | propsStr += '!1' |
| | | } else if (type === Number) { |
| | | propsStr += '0' |
| | | } else if (type === Object) { |
| | | propsStr += '{}' |
| | | } else if (type === Array) { |
| | | propsStr += '[]' |
| | | } |
| | | } |
| | | propsStr += ',' |
| | | } |
| | | content = content.substr(0, i) + propsStr.substring(0, propsStr.length - 1) + '}' + content.substr(i + objStr.length) |
| | | } |
| | | |
| | | content = content.replace(/properties/g, 'props') |
| | | .replace(/\.setNavigationBarTitle/g, '.setNavigationBar') |
| | | } else { |
| | | content = content.replace(/\.properties/g, '.data') |
| | | } |
| | | } else if (file.extname === '.wxss') { |
| | | // wxss æä»¶å¤ç |
| | | file.extname = suffix[platform].wxss // ä¿®æ¹åç¼å |
| | | } |
| | | } |
| | | file.contents = Buffer.from(content) |
| | | } |
| | | this.push(file) |
| | | callback() |
| | | }) |
| | | } |
New file |
| | |
| | | { |
| | | "pages":[ |
| | | "pages/index/index", |
| | | "pages/jump/jump" |
| | | ], |
| | | "window":{ |
| | | "backgroundTextStyle":"light", |
| | | "navigationBarBackgroundColor": "#fff", |
| | | "navigationBarTitleText": "mp-html", |
| | | "navigationBarTextStyle":"black" |
| | | }, |
| | | "style": "v2" |
| | | } |
New file |
| | |
| | | const html = require('../../content') |
| | | Page({ |
| | | data: { |
| | | html: '', |
| | | tagStyle: { |
| | | table: 'box-sizing: border-box; border-top: 1px solid #dfe2e5; border-left: 1px solid #dfe2e5;', |
| | | th: 'border-right: 1px solid #dfe2e5; border-bottom: 1px solid #dfe2e5;', |
| | | td: 'border-right: 1px solid #dfe2e5; border-bottom: 1px solid #dfe2e5;', |
| | | li: 'margin: 5px 0;' |
| | | } |
| | | }, |
| | | onLoad () { |
| | | // 模æç½ç»è¯·æ± |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | html |
| | | }) |
| | | }, 200) |
| | | }, |
| | | load () { |
| | | console.log('dom æ å è½½å®æ¯') |
| | | }, |
| | | ready (e) { |
| | | console.log('ready äºä»¶è§¦åï¼', e) |
| | | }, |
| | | imgtap (e) { |
| | | console.log('imgtap äºä»¶è§¦åï¼', e) |
| | | }, |
| | | linktap (e) { |
| | | console.log('linktap äºä»¶è§¦åï¼', e) |
| | | } |
| | | }) |
New file |
| | |
| | | { |
| | | "usingComponents": { |
| | | "mp-html": "/components/mp-html/index" |
| | | } |
| | | } |
New file |
| | |
| | | <mp-html container-style="padding:20px" content="{{html}}" domain="https://mp-html.oss-cn-hangzhou.aliyuncs.com" lazy-load scroll-table selectable use-anchor tag-style="{{tagStyle}}" bindload="load" bindready="ready" bindimgtap="imgtap" bindlinktap="linktap"> |
| | | å è½½ä¸... |
| | | </mp-html> |
New file |
| | |
| | | <view>跳转æµè¯é¡µé¢</view> |
New file |
| | |
| | | { |
| | | "description": "项ç®é
ç½®æä»¶", |
| | | "setting": { |
| | | "urlCheck": true, |
| | | "es6": true, |
| | | "postcss": true, |
| | | "minified": true, |
| | | "newFeature": true |
| | | }, |
| | | "compileType": "miniprogram", |
| | | "appid": "touristappid", |
| | | "projectname": "mp-html" |
| | | } |
New file |
| | |
| | | <script> |
| | | export default {} |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
New file |
| | |
| | | ## 为åå°ç»ä»¶å
ç大å°ï¼é»è®¤ç»ä»¶å
ä¸ä¸å
å«ç¼è¾ãlatex å
¬å¼çæ©å±åè½ï¼éè¦ä½¿ç¨æ©å±åè½ç请åè䏿¹ç æä»¶æ©å± æ ç说æ |
| | | |
| | | ## åè½ä»ç» |
| | | - å
¨ç«¯æ¯æï¼å« `v3ãNVUE`ï¼ |
| | | - æ¯æä¸°å¯çæ ç¾ï¼å
æ¬ `table`ã`video`ã`svg` çï¼ |
| | | - æ¯æä¸°å¯çäºä»¶ææï¼èªå¨é¢è§å¾çã龿¥å¤ççï¼ |
| | | - æ¯æè®¾ç½®å ä½å¾ï¼å è½½ä¸ãåºéæ¶ãé¢è§æ¶ï¼ |
| | | - æ¯æéç¹è·³è½¬ãé¿æå¤å¶ç丰å¯åè½ |
| | | - æ¯æå¤§é¨å *html* å®ä½ |
| | | - 丰å¯çæä»¶ï¼å
³é®è¯æç´¢ãå
容ç¼è¾ã`latex` å
¬å¼çï¼ |
| | | - æçé«ãå®¹éæ§å¼ºä¸è½»éå |
| | | |
| | | æ¥ç [åè½ä»ç»](https://jin-yufeng.github.io/mp-html/#/overview/feature) äºè§£æ´å¤ |
| | | |
| | | ## ä½¿ç¨æ¹æ³ |
| | | - `uni_modules` æ¹å¼ |
| | | 1. ç¹å»å³ä¸è§ç `ä½¿ç¨ HBuilder X 导å
¥æä»¶` æé®ç´æ¥å¯¼å
¥é¡¹ç®æç¹å» `ä¸è½½æä»¶ ZIP` æé®ä¸è½½æä»¶å
å¹¶è§£åå°é¡¹ç®ç `uni_modules/mp-html` ç®å½ä¸ |
| | | 2. å¨éè¦ä½¿ç¨é¡µé¢ç `(n)vue` æä»¶ä¸æ·»å |
| | | ```html |
| | | <!-- ä¸éè¦å¼å
¥ï¼å¯ç´æ¥ä½¿ç¨ --> |
| | | <mp-html :content="html" /> |
| | | ``` |
| | | ```javascript |
| | | export default { |
| | | data() { |
| | | return { |
| | | html: '<div>Hello World!</div>' |
| | | } |
| | | } |
| | | } |
| | | ``` |
| | | 3. éè¦æ´æ°çæ¬æ¶å¨ `HBuilder X` ä¸å³é® `uni_modules/mp-html` ç®å½éæ© `仿件å¸åºæ´æ°` å³å¯ |
| | | |
| | | - æºç æ¹å¼ |
| | | 1. ä» [github](https://github.com/jin-yufeng/mp-html/tree/master/dist/uni-app) æ [gitee](https://gitee.com/jin-yufeng/mp-html/tree/master/dist/uni-app) ä¸è½½æºç |
| | | æä»¶å¸åºç **é uni_modules çæ¬** æ æ³æ´æ°ï¼ä¸å»ºè®®ä»æä»¶å¸åºè·å |
| | | 2. å¨éè¦ä½¿ç¨é¡µé¢ç `(n)vue` æä»¶ä¸æ·»å |
| | | ```html |
| | | <mp-html :content="html" /> |
| | | ``` |
| | | ```javascript |
| | | import mpHtml from '@/components/mp-html/mp-html' |
| | | export default { |
| | | // HBuilderX 2.5.5+ å¯ä»¥éè¿ easycom èªå¨å¼å
¥ |
| | | components: { |
| | | mpHtml |
| | | }, |
| | | data() { |
| | | return { |
| | | html: '<div>Hello World!</div>' |
| | | } |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | - npm æ¹å¼ |
| | | 1. å¨é¡¹ç®æ ¹ç®å½ä¸æ§è¡ |
| | | ```bash |
| | | npm install mp-html |
| | | ``` |
| | | 2. å¨éè¦ä½¿ç¨é¡µé¢ç `(n)vue` æä»¶ä¸æ·»å |
| | | ```html |
| | | <mp-html :content="html" /> |
| | | ``` |
| | | ```javascript |
| | | import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html' |
| | | export default { |
| | | // ä¸å¯çç¥ |
| | | components: { |
| | | mpHtml |
| | | }, |
| | | data() { |
| | | return { |
| | | html: '<div>Hello World!</div>' |
| | | } |
| | | } |
| | | } |
| | | ``` |
| | | 3. éè¦æ´æ°çæ¬æ¶æ§è¡ä»¥ä¸å½ä»¤å³å¯ |
| | | ```bash |
| | | npm update mp-html |
| | | ``` |
| | | |
| | | ä½¿ç¨ *cli* æ¹å¼è¿è¡ç项ç®ï¼éè¿ *npm* æ¹å¼å¼å
¥æ¶ï¼éè¦å¨ *vue.config.js* ä¸é
ç½® *transpileDependencies*ï¼è¯¦æ
å¯è§ [#330](https://github.com/jin-yufeng/mp-html/issues/330#issuecomment-913617687) |
| | | å¦æå¨ **nvue** ä¸ä½¿ç¨è¿è¦å° `dist/uni-app/static` ç®å½ä¸çå
容æ·è´å°é¡¹ç®ç `static` ç®å½ä¸ï¼å¦åæ æ³è¿è¡ |
| | | |
| | | æ¥ç [å¿«éå¼å§](https://jin-yufeng.github.io/mp-html/#/overview/quickstart) äºè§£æ´å¤ |
| | | |
| | | ## ç»ä»¶å±æ§ |
| | | |
| | | | 屿§ | ç±»å | é»è®¤å¼ | 说æ | |
| | | |:---:|:---:|:---:|---| |
| | | | container-style | String | | 容å¨çæ ·å¼ï¼[2.1.0+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v210)ï¼ | |
| | | | content | String | | ç¨äºæ¸²æç html å符串 | |
| | | | copy-link | Boolean | true | æ¯å¦å
许å¤é¨é¾æ¥è¢«ç¹å»æ¶èªå¨å¤å¶ | |
| | | | domain | String | | 主ååï¼ç¨äºé¾æ¥æ¼æ¥ï¼ | |
| | | | error-img | String | | å¾çåºéæ¶çå ä½å¾é¾æ¥ | |
| | | | lazy-load | Boolean | false | æ¯å¦å¼å¯å¾çæå è½½ | |
| | | | loading-img | String | | å¾çå è½½è¿ç¨ä¸çå ä½å¾é¾æ¥ | |
| | | | pause-video | Boolean | true | æ¯å¦å¨ææ¾ä¸ä¸ªè§é¢æ¶èªå¨æåå
¶ä»è§é¢ | |
| | | | preview-img | Boolean | true | æ¯å¦å
许å¾ç被ç¹å»æ¶èªå¨é¢è§ | |
| | | | scroll-table | Boolean | false | æ¯å¦ç»æ¯ä¸ªè¡¨æ ¼æ·»å ä¸ä¸ªæ»å¨å±ä½¿å
¶è½åç¬æ¨ªåæ»å¨ | |
| | | | selectable | Boolean | false | æ¯å¦å¼å¯ææ¬é¿æå¤å¶ | |
| | | | set-title | Boolean | true | æ¯å¦å° title æ ç¾çå
容设置å°é¡µé¢æ é¢ | |
| | | | show-img-menu | Boolean | true | æ¯å¦å
许å¾çè¢«é¿ææ¶æ¾ç¤ºèå | |
| | | | tag-style | Object | | 设置æ ç¾çé»è®¤æ ·å¼ | |
| | | | use-anchor | Boolean | false | æ¯å¦ä½¿ç¨éç¹é¾æ¥ | |
| | | |
| | | æ¥ç [屿§](https://jin-yufeng.github.io/mp-html/#/basic/prop) äºè§£æ´å¤ |
| | | |
| | | ## ç»ä»¶äºä»¶ |
| | | |
| | | | åç§° | è§¦åæ¶æº | |
| | | |:---:|---| |
| | | | load | dom æ å è½½å®æ¯æ¶ | |
| | | | ready | å¾çå è½½å®æ¯æ¶ | |
| | | | error | åçæ¸²æéè¯¯æ¶ | |
| | | | imgtap | å¾ç被ç¹å»æ¶ | |
| | | | linktap | 龿¥è¢«ç¹å»æ¶ | |
| | | | play | é³è§é¢ææ¾æ¶ | |
| | | |
| | | æ¥ç [äºä»¶](https://jin-yufeng.github.io/mp-html/#/basic/event) äºè§£æ´å¤ |
| | | |
| | | ## api |
| | | ç»ä»¶å®ä¾ä¸æä¾äºä¸äº `api` æ¹æ³å¯ä¾è°ç¨ |
| | | |
| | | | åç§° | ä½ç¨ | |
| | | |:---:|---| |
| | | | in | å°éç¹è·³è½¬çèå´éå®å¨ä¸ä¸ª scroll-view å
| |
| | | | navigateTo | éç¹è·³è½¬ | |
| | | | getText | è·åææ¬å
容 | |
| | | | getRect | è·å坿æ¬å
容çä½ç½®åå¤§å° | |
| | | | setContent | è®¾ç½®å¯ææ¬å
容 | |
| | | | imgList | è·åææå¾ççæ°ç» | |
| | | | pauseMedia | æåææ¾é³è§é¢ï¼[2.2.2+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v222)ï¼ | |
| | | | setPlaybackRate | 设置é³è§é¢ææ¾éçï¼[2.4.0+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v240)ï¼ | |
| | | |
| | | æ¥ç [api](https://jin-yufeng.github.io/mp-html/#/advanced/api) äºè§£æ´å¤ |
| | | |
| | | ## æä»¶æ©å± |
| | | é¤åºæ¬åè½å¤ï¼æ¬ç»ä»¶è¿æä¾äºä¸°å¯çæ©å±ï¼å¯æç
§éè¦éç¨ |
| | | |
| | | | åç§° | ä½ç¨ | |
| | | |:---:|---| |
| | | | audio | é³ä¹ææ¾å¨ | |
| | | | editable | å¯ææ¬ **ç¼è¾**ï¼[示ä¾é¡¹ç®](https://mp-html.oss-cn-hangzhou.aliyuncs.com/editable.zip)ï¼ | |
| | | | emoji | è§£æ emoji | |
| | | | highlight | 代ç åé«äº®æ¾ç¤º | |
| | | | markdown | 渲æ markdown | |
| | | | search | å
³é®è¯æç´¢ | |
| | | | style | å¹é
style æ ç¾ä¸çæ ·å¼ | |
| | | | txv-video | 使ç¨è
¾è®¯è§é¢ | |
| | | | img-cache | å¾çç¼å by [@PentaTea](https://github.com/PentaTea) | |
| | | | latex | 渲æ latex å
¬å¼ by [@Zeng-J](https://github.com/Zeng-J) | |
| | | |
| | | 仿件å¸åºå¯¼å
¥çå
ä¸ **ä¸å«æ** æ©å±æä»¶ï¼ä½¿ç¨æä»¶ééè¿å¾®ä¿¡å°ç¨åº `å¯ææ¬æä»¶` è·åæåè以䏿¹æ³è¿è¡æå
ï¼ |
| | | 1. è·å宿´ç»ä»¶å
|
| | | ```bash |
| | | npm install mp-html |
| | | ``` |
| | | 2. ç¼è¾ `tools/config.js` ä¸ç `plugins` 项ï¼éæ©éè¦çæä»¶ |
| | | 3. çææ°çç»ä»¶å
|
| | | å¨ `node_modules/mp-html` ç®å½ä¸æ§è¡ |
| | | ```bash |
| | | npm install |
| | | npm run build:uni-app |
| | | ``` |
| | | 4. æ·è´ `dist/uni-app` ä¸çå
容å°é¡¹ç®æ ¹ç®å½ |
| | | |
| | | æ¥ç [æä»¶](https://jin-yufeng.github.io/mp-html/#/advanced/plugin) äºè§£æ´å¤ |
| | | |
| | | ## å
³äº nvue |
| | | `nvue` 使ç¨åçæ¸²æï¼ä¸æ¯æé¨å `css` æ ·å¼ï¼ä¸ºå®ç°å `html` ç¸åçææï¼ç»ä»¶å
é¨éè¿ `web-view` è¿è¡æ¸²æï¼æ§è½ä¸å·®äºåçï¼æ ¹æ® `weex` 宿¹å»ºè®®ï¼`web` æ ç¾ä»
åºç¨å¨é常è§çéçº§åºæ¯ãå æ¤ï¼å¦æéè¿åççæ¹å¼ï¼å¦ `richtext`ï¼è½å¤æ»¡è¶³éè¦ï¼åä¸å»ºè®®ä½¿ç¨æ¬ç»ä»¶ï¼å¦ææè¾å¤ç坿æ¬å
容ï¼åå¯ä»¥ç´æ¥ä½¿ç¨ `vue` é¡µé¢ |
| | | ç±äºæ¸²ææ¹å¼ä¸å
¶ä»ç«¯ä¸åï¼æä»¥ä¸éå¶ï¼ |
| | | 1. 䏿¯æ `lazy-load` 屿§ |
| | | 2. è§é¢ä¸æ¯æå
¨å±ææ¾ |
| | | 3. å¦æå¨ `flex-direction: row` ç容å¨ä¸ä½¿ç¨ï¼éè¦ç»ç»ä»¶è®¾ç½®å®½åº¦æè®¾ç½® `flex: 1` å æ»¡å©ä½å®½åº¦ |
| | | |
| | | 纯 `nvue` 模å¼ä¸ï¼[æ¤é®é¢](https://ask.dcloud.net.cn/question/119678) ä¿®å¤åï¼ä¸æ¯æéè¿ `uni_modules` å¼å
¥ï¼éè¦æ¬å°å¼å
¥ï¼å° [dist/uni-app](https://github.com/jin-yufeng/mp-html/tree/master/dist/uni-app) ä¸çå
容æ·è´å°é¡¹ç®æ ¹ç®å½ä¸ï¼ |
| | | |
| | | ## ç«å³ä½éª |
| | |  |
| | | |
| | | ## é®é¢åé¦ |
| | | éå°é®é¢æ¶ï¼è¯·å
æ¥é
[常è§é®é¢](https://jin-yufeng.github.io/mp-html/#/question/faq) å [issue](https://github.com/jin-yufeng/mp-html/issues) 䏿¯å¦å·²æç¸åçé®é¢ |
| | | å¯éè¿ [issue](https://github.com/jin-yufeng/mp-html/issues/new/choose) ãæä»¶é®çæåéé®ä»¶å° [mp_html@126.com](mailto:mp_html@126.com) æé®ï¼ä¸å»ºè®®å¨è¯è®ºåºæé®ï¼ä¸æ¹ä¾¿åå¤ï¼ |
| | | æé®è¯·ä¸¥æ ¼æç
§ [issue 模æ¿](https://github.com/jin-yufeng/mp-html/issues/new/choose) ï¼æè¿°æ¸
æ¥ä½¿ç¨ç¯å¢ã`html` å
容æå¯å¤ç°ç `demo` 项ç®ä»¥åå¤ç°æ¹å¼ï¼å¯¹äº **æè¿°ä¸æ¸
**ã**æ æ³å¤ç°** æéå¤çé®é¢å°ä¸äºåå¤ |
| | | |
| | | 欢è¿å å
¥ `QQ` 交æµç¾¤ï¼ |
| | | 群1ï¼å·²æ»¡ï¼ï¼`699734691` |
| | | 群2ï¼å·²æ»¡ï¼ï¼`778239129` |
| | | 群3ï¼`960265313` |
| | | |
| | | æ¥ç [é®é¢åé¦](https://jin-yufeng.github.io/mp-html/#/question/feedback) äºè§£æ´å¤ |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="UTF-8" /> |
| | | <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" /> |
| | | <title></title> |
| | | <!--preload-links--> |
| | | <!--app-context--> |
| | | </head> |
| | | <body> |
| | | <div id="app"><!--app-html--></div> |
| | | <script type="module" src="/main.js"></script> |
| | | </body> |
| | | </html> |
New file |
| | |
| | | import App from './App' |
| | | |
| | | // #ifndef VUE3 |
| | | import Vue from 'vue' // eslint-disable-line |
| | | Vue.config.productionTip = false |
| | | App.mpType = 'app' |
| | | const app = new Vue({ |
| | | ...App |
| | | }) |
| | | app.$mount() |
| | | // #endif |
| | | |
| | | // #ifdef VUE3 |
| | | import { createSSRApp } from 'vue' // eslint-disable-line |
| | | export function createApp () { |
| | | const app = createSSRApp(App) |
| | | return { |
| | | app |
| | | } |
| | | } |
| | | // #endif |
New file |
| | |
| | | { |
| | | "name" : "mp-html", |
| | | "appid" : "", |
| | | "description" : "", |
| | | "versionName" : "1.0.0", |
| | | "versionCode" : "100", |
| | | "transformPx" : false, |
| | | "app-plus" : { |
| | | "usingComponents" : true, |
| | | "nvueCompiler" : "uni-app", |
| | | "compilerVersion" : 3, |
| | | "splashscreen" : { |
| | | "alwaysShowBeforeRender" : true, |
| | | "waiting" : true, |
| | | "autoclose" : true, |
| | | "delay" : 0 |
| | | }, |
| | | "modules" : {}, |
| | | "distribute" : { |
| | | "android" : {}, |
| | | "ios" : {}, |
| | | "sdkConfigs" : {} |
| | | } |
| | | }, |
| | | "quickapp" : {}, |
| | | "mp-weixin" : { |
| | | "appid" : "", |
| | | "setting" : { |
| | | "urlCheck" : false |
| | | }, |
| | | "usingComponents" : true |
| | | }, |
| | | "mp-alipay" : { |
| | | "usingComponents" : true |
| | | }, |
| | | "mp-baidu" : { |
| | | "usingComponents" : true |
| | | }, |
| | | "mp-toutiao" : { |
| | | "usingComponents" : true |
| | | }, |
| | | "uniStatistics": { |
| | | "enable": false |
| | | } |
| | | } |
New file |
| | |
| | | { |
| | | "pages": [ |
| | | { |
| | | "path": "pages/index/index" |
| | | }, |
| | | { |
| | | "path": "pages/jump/jump" |
| | | } |
| | | ], |
| | | "globalStyle": { |
| | | "navigationBarTextStyle": "black", |
| | | "navigationBarTitleText": "mp-html", |
| | | "navigationBarBackgroundColor": "#F8F8F8", |
| | | "backgroundColor": "#F8F8F8" |
| | | } |
| | | } |
New file |
| | |
| | | <template> |
| | | <view> |
| | | <mp-html container-style="padding:20px" :content="html" domain="https://mp-html.oss-cn-hangzhou.aliyuncs.com" lazy-load scroll-table selectable use-anchor :tag-style="tagStyle" @load="load" @ready="ready" @imgtap="imgtap" @linktap="linktap" /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | // éè¦æµè¯ nvue æ¶ï¼å°æ¬æä»¶åç¼æ¹ä¸º .nvue å³å¯ |
| | | // 注æï¼æ¤ç¤ºä¾ä¸å
å«ç¼è¾åè½ |
| | | import mpHtml from '@/components/mp-html/mp-html' |
| | | import html from '../../content' |
| | | export default { |
| | | // HBuilderX 2.5.5+ å¯ä»¥éè¿ easycom èªå¨å¼å
¥ |
| | | components: { |
| | | mpHtml |
| | | }, |
| | | data () { |
| | | return { |
| | | html: '', |
| | | tagStyle: { |
| | | table: 'box-sizing: border-box; border-top: 1px solid #dfe2e5; border-left: 1px solid #dfe2e5;', |
| | | th: 'border-right: 1px solid #dfe2e5; border-bottom: 1px solid #dfe2e5;', |
| | | td: 'border-right: 1px solid #dfe2e5; border-bottom: 1px solid #dfe2e5;', |
| | | li: 'margin: 5px 0;' |
| | | } |
| | | } |
| | | }, |
| | | onLoad () { |
| | | // 模æç½ç»è¯·æ± |
| | | setTimeout(() => { |
| | | this.html = html |
| | | }, 200) |
| | | }, |
| | | methods: { |
| | | load () { |
| | | console.log('dom æ å è½½å®æ¯') |
| | | }, |
| | | ready (e) { |
| | | console.log('ready äºä»¶è§¦åï¼', e) |
| | | }, |
| | | imgtap (e) { |
| | | console.log('imgtap äºä»¶è§¦åï¼', e) |
| | | }, |
| | | linktap (e) { |
| | | console.log('linktap äºä»¶è§¦åï¼', e) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <view> |
| | | 跳转æµè¯é¡µé¢ |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default {} |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
New file |
| | |
| | | /** |
| | | * @fileoverview æ¡ä»¶ç¼è¯ |
| | | */ |
| | | const through2 = require('through2') |
| | | |
| | | /** |
| | | * @description æ¡ä»¶ç¼è¯ |
| | | * @param {string} platform å¹³å° |
| | | */ |
| | | module.exports = function (platform) { |
| | | return through2.obj(function (file, _, callback) { |
| | | if (file.isBuffer()) { |
| | | // æä»¶å¤¹çº§å«çå¤ç |
| | | if (file.relative.includes('miniprogram')) { |
| | | if (platform !== 'uni-app') { |
| | | // 廿è¿ä¸å± |
| | | file.path = file.path.replace(/(.*)[/\\]miniprogram/, '$1') |
| | | } else { |
| | | // ä¸ç¨äºæ¬å¹³å°çæä»¶ |
| | | callback() |
| | | return |
| | | } |
| | | } else if (file.relative.includes('uni-app')) { |
| | | if (platform === 'uni-app') { |
| | | file.path = file.path.replace(/(.*)[/\\]uni-app/, '$1') |
| | | } else { |
| | | callback() |
| | | return |
| | | } |
| | | } |
| | | if (platform === 'uni-app') { |
| | | // uni-app å¹³å° vue3 è¦æ±ä½¿ç¨ es6 模å |
| | | let content = file.contents.toString() |
| | | if (file.basename === 'prism.min.js') { |
| | | content = content.replace('"undefined"!=typeof module&&module.exports&&(module.exports=Prism),', 'export default Prism;') |
| | | } else if (file.extname === '.js' && !file.relative.includes('static')) { |
| | | content = content.replace(/module.exports\s*=\s*/, 'export default ') |
| | | .replace(/const\s+([^\s=]+)\s*=\s*require\(([^)]+)\)/g, 'import $1 from $2') |
| | | } |
| | | file.contents = Buffer.from(content) |
| | | } else { |
| | | // å°ç¨åºå¹³å°è¿è¡è¿ä¸æ¥å¤ç |
| | | let content = file.contents.toString() |
| | | /** |
| | | * æ¹å¼1ï¼ |
| | | * 卿³¨é #if(n)def xxx å #endif ä¹é´çå
容伿 ¹æ®æ¯å¦å®ä¹ xxx å³å®æ¯å¦ä¿ç |
| | | */ |
| | | const commentReg = /\/\*[\s\S]*?\*\/|\/\/[^\n]*|<!--[\s\S]*?-->/g // æåæææ³¨é |
| | | const copy = content // æ·è´ä¸ä¸ªå¯æ¬ç¨äºæç´¢ |
| | | let match = commentReg.exec(copy) |
| | | const stack = [] |
| | | while (match) { |
| | | if (match[0].includes('#if')) { |
| | | stack.push([match[0], match.index]) |
| | | } else if (match[0].includes('#endif')) { |
| | | const item = stack.pop() |
| | | if (!item) { |
| | | throw Error('æ¡ä»¶ç¼è¯é误ï¼åå¨å¤ä½ç #endifï¼path:' + file.path + 'ï¼content: ' + content.substr(match.index, 100)) |
| | | } |
| | | const def = item[0].match(/MP-[A-Z]+/gi) || [] // ååºå®ä¹æ¡ä»¶ |
| | | let hit = false |
| | | for (let i = 0; i < def.length; i++) { |
| | | if (def[i] && platform === def[i].toLowerCase()) { |
| | | hit = true // å½ä¸ |
| | | break |
| | | } |
| | | } |
| | | // ä¸å¹é
|
| | | if ((item[0].includes('#ifdef') && !hit) || (item[0].includes('#ifndef') && hit)) { |
| | | let fill = '' |
| | | // ç¨ç©ºæ ¼å¡«å
|
| | | for (let j = item[1] + item[0].length; j < match.index; j++) { |
| | | if (content[j] === '\n') { |
| | | fill += '\n' |
| | | } else { |
| | | fill += ' ' |
| | | } |
| | | } |
| | | content = content.substr(0, item[1] + item[0].length) + fill + content.substr(match.index) |
| | | } |
| | | } |
| | | match = commentReg.exec(copy) |
| | | } |
| | | if (stack.length) { |
| | | throw Error('æ¡ä»¶ç¼è¯é误ï¼å卿ªéåç #ifdefï¼path:' + file.path + 'ï¼content: ' + content.substr(stack[0][1], 100)) |
| | | } |
| | | |
| | | /** |
| | | * æ¹å¼2ï¼ |
| | | * wxml ä¸å±æ§åå å¹³å°åå°ä»
ç¼è¯å°è¯¥å¹³å°ï¼å¦ mp-weixin:attr |
| | | */ |
| | | if (file.extname === '.wxml') { |
| | | content = content.replace(/([^:\s]+:[^=\s]+)\s*=\s*"(.*?)"/g, ($, $1, $2) => { |
| | | const platforms = $1.split(':') |
| | | let name = platforms.pop() |
| | | const last = platforms[platforms.length - 1] |
| | | if (last && !last.includes('mp')) { |
| | | name = platforms.pop() + ':' + name |
| | | } |
| | | if (!platforms.length) return $ |
| | | let i |
| | | for (i = platforms.length; i--;) { |
| | | if (platform === platforms[i].toLowerCase()) break |
| | | } |
| | | if (i >= 0) return `${name}="${$2}"` |
| | | return '' |
| | | }) |
| | | } |
| | | file.contents = Buffer.from(content) |
| | | } |
| | | } |
| | | this.push(file) |
| | | callback() |
| | | }) |
| | | } |
New file |
| | |
| | | const uglify = require('uglify-js') |
| | | const through2 = require('through2') |
| | | |
| | | /** |
| | | * @description å缩å
è wxs èæ¬ |
| | | */ |
| | | function wxs () { |
| | | return through2.obj(function (file, _, callback) { |
| | | if (file.isBuffer()) { |
| | | file.contents = Buffer.from(file.contents.toString().replace(/<wxs(.*?)>([\s\S]+?)<\/wxs>/, (_, $1, $2) => { |
| | | return `<wxs${$1}>${uglify.minify($2, { |
| | | fromString: true, |
| | | mangle: { |
| | | toplevel: true |
| | | } |
| | | }).code}</wxs>` |
| | | })) |
| | | } |
| | | this.push(file) |
| | | callback() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description å缩 json æä»¶ |
| | | */ |
| | | function json () { |
| | | return through2.obj(function (file, _, callback) { |
| | | if (file.isBuffer()) { |
| | | file.contents = Buffer.from(JSON.stringify(JSON.parse(file.contents.toString()))) |
| | | } |
| | | this.push(file) |
| | | callback() |
| | | }) |
| | | } |
| | | |
| | | module.exports = { |
| | | wxs, |
| | | json |
| | | } |
New file |
| | |
| | | /** |
| | | * @fileoverview å¤çæä»¶ |
| | | */ |
| | | const path = require('path') |
| | | const through2 = require('through2') |
| | | |
| | | const config = require('./config') |
| | | |
| | | config.plugins.sort((a, b) => { |
| | | // editable ç½®äºæåé¢ |
| | | if (a === 'editable') return 1 |
| | | if (b === 'editable') return -1 |
| | | // markdown ç½®äºæåé¢ |
| | | if (a === 'markdown') return -1 |
| | | if (b === 'markdown') return 1 |
| | | // å©ä½ä»»æé¡ºåº |
| | | return 0 |
| | | }) |
| | | |
| | | // æååæ¿æ¢æ ç¾åéæ©å¨ï¼ç»ä»¶ä¸ä»
æ¯æ class éæ©å¨ï¼ |
| | | const tagSelector = {} |
| | | let tagI = 0 |
| | | if (config.externStyle) { |
| | | config.externStyle = config.externStyle.replace(/[^,\s}]+(?=[^}]*{)/g, $ => { |
| | | if (!/[a-zA-Z_]/.test($[0])) return $ |
| | | if (tagSelector[$]) return '.' + tagSelector[$] |
| | | tagSelector[$] = '_' + tagI++ |
| | | return '.' + tagSelector[$] |
| | | }) |
| | | } |
| | | |
| | | module.exports = { |
| | | /** |
| | | * @description æå»ºæä»¶ |
| | | * @param {string} platform 使ç¨å¹³å° |
| | | */ |
| | | build (platform) { |
| | | const builds = {} // æå»ºæ¨¡å |
| | | let pluginImports = '' // æä»¶å¼å
¥ |
| | | let plugins = '' // æä»¶å表 |
| | | let voidTags = '' // å¢å çèªéåæ ç¾ |
| | | let wxml = '' // è¦å¼å
¥å° node.wxml ä¸çå
容 |
| | | let js = '' // è¦å¼å
¥å° node.js ä¸çå
容 |
| | | let wxss = config.externStyle // è¦å¼å
¥å° node.wxss ä¸çå
容 |
| | | const json = {} // è¦å¼å
¥å° node.json ä¸çå
容 |
| | | |
| | | // æ¶éæä»¶ä¸è¦åå
¥æ¨¡æ¿æä»¶çå
容 |
| | | for (let i = 0; i < config.plugins.length; i++) { |
| | | const plugin = config.plugins[i] |
| | | let build = {} |
| | | try { |
| | | // ä¸ç¨ build |
| | | if (platform === 'uni-app') { |
| | | build = require(`../plugins/${plugin}/uni-app/build.js`) |
| | | } else { |
| | | build = require(`../plugins/${plugin}/miniprogram/build.js`) |
| | | } |
| | | } catch (e) { } |
| | | try { |
| | | // éç¨ build |
| | | build = Object.assign(require(`../plugins/${plugin}/build.js`), build) |
| | | } catch (e) { } |
| | | // å¯ä»¥å¨å½åå¹³å°ä½¿ç¨ |
| | | if (!build.platform || build.platform.includes(platform)) { |
| | | builds[plugin] = build |
| | | if (platform === 'uni-app') { |
| | | plugins += plugin.replace(/-([a-z])/g, ($, $1) => $1.toUpperCase()) + ',' |
| | | pluginImports += `import ${plugin.replace(/-([a-z])/g, ($, $1) => $1.toUpperCase())} from './${plugin}/${build.main ? build.main : 'index.js'}'\n` |
| | | } else { |
| | | plugins += `require('./${plugin}/${build.main ? build.main : 'index.js'}'),` |
| | | } |
| | | if (build.template) { |
| | | wxml += build.template.replace('wx:if', 'wx:elif').replace('v-if', 'v-else-if') |
| | | } |
| | | if (build.methods) { |
| | | for (const method in build.methods) { |
| | | js += build.methods[method].toString() + ',' |
| | | } |
| | | } |
| | | if (build.usingComponents) { |
| | | Object.assign(json, build.usingComponents) |
| | | } |
| | | if (build.style) { |
| | | wxss += build.style |
| | | } |
| | | } |
| | | } |
| | | |
| | | // å å
¥å
¶ä»èªå®ä¹æ ç¾ |
| | | for (const item of config.customElements) { |
| | | if (platform === 'uni-app') { |
| | | if (item.platforms) { |
| | | wxml += '<!-- #ifdef ' + item.platforms.join(' || ').toUpperCase() + ' -->' |
| | | } |
| | | voidTags += item.name + ',' |
| | | wxml += '<' + item.name + ' v-else-if="n.name==\'' + item.name + '\'" :class="n.attrs.class" :style="n.attrs.style"' |
| | | if (item.attrs) { |
| | | for (const attr of item.attrs) { |
| | | wxml += ' :' + attr + '="n.attrs' |
| | | if (attr.includes('-')) { |
| | | wxml += '[\'' + attr + '\']"' |
| | | } else { |
| | | wxml += '.' + attr + '"' |
| | | } |
| | | } |
| | | } |
| | | wxml += ' />' |
| | | if (item.platforms) { |
| | | wxml += '<!-- #endif -->' |
| | | } |
| | | } else if (!item.platforms || item.platforms.join(',').toLowerCase().includes(platform)) { |
| | | voidTags += item.name + ',' |
| | | wxml += '<' + item.name + ' wx:elif="{{n.name==\'' + item.name + '\'}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}"' |
| | | if (item.attrs) { |
| | | for (const attr of item.attrs) { |
| | | wxml += ' ' + attr + '="{{n.attrs' |
| | | if (attr.includes('-')) { |
| | | wxml += '[\'' + attr + '\']}}"' |
| | | } else { |
| | | wxml += '.' + attr + '}}"' |
| | | } |
| | | } |
| | | } |
| | | wxml += ' />' |
| | | } |
| | | } |
| | | |
| | | return through2.obj(function (file, _, callback) { |
| | | if (file.isBuffer()) { |
| | | // src ç®å½ |
| | | if (file.base.includes('src')) { |
| | | let content = file.contents.toString() |
| | | if (file.basename === 'index.js' || file.basename === 'mp-html.vue') { |
| | | // 注åæä»¶å表 |
| | | if (platform === 'uni-app') { |
| | | content = content.replace(/const\s*plugins\s*=\s*\[\]/, `${pluginImports}const plugins=[${plugins}]`) |
| | | } else { |
| | | content = content.replace(/plugins\s*=\s*\[\]/, `plugins=[${plugins}]`) |
| | | } |
| | | } else if (file.basename === 'parser.js') { |
| | | // 设置æ ç¾åéæ©å¨ |
| | | content = content.replace(/tagSelector\s*=\s*{}/, `tagSelector=${JSON.stringify(tagSelector)}`) |
| | | // 设置èªéåæ ç¾ |
| | | .replace(/voidTags\s*:\s*makeMap\('/, 'voidTags: makeMap(\'' + voidTags) |
| | | } else if (file.basename === 'node.wxml') { |
| | | // å¼å
¥æ¨¡æ¿ |
| | | content = content.replace(/<!--\s*insert\s*-->/, wxml) |
| | | } else if (file.basename === 'node.js') { |
| | | // å¼å
¥æ¹æ³ |
| | | content = content.replace(/methods\s*:\s*{/, 'methods:{' + js) |
| | | } else if (file.basename === 'node.wxss') { |
| | | // å¼å
¥æ ·å¼ |
| | | content = wxss + content |
| | | } else if (file.basename === 'node.json') { |
| | | // å¼å
¥ç»ä»¶å£°æ |
| | | const comps = JSON.stringify(json).slice(1, -1) |
| | | if (comps) { |
| | | content = content.replace(/"usingComponents"\s*:\s*{/, '"usingComponents":{' + comps + ',') |
| | | } |
| | | } else if (file.basename === 'node.vue') { |
| | | // å¼å
¥ vue |
| | | content = content.replace(/<!--\s*insert\s*-->/, wxml) |
| | | .replace(/methods\s*:\s*{/, 'methods:{' + js) |
| | | .replace('<style>', '<style>' + wxss.replace(/\.[a-zA-Z_][^)}]*?[{,]/g, '/deep/ $&')).replace(/,url/g, ', url') |
| | | let importComp = '' |
| | | let comps = '' |
| | | for (let item in json) { |
| | | const val = json[item] |
| | | // æä»¶æ æ³éè¿è¿ç§æ¹å¼å¼å
¥ |
| | | if (val.includes('plugin://')) continue |
| | | item = item.replace(/-([a-z])/g, (_, $1) => $1.toUpperCase()) |
| | | importComp += 'import ' + item + " from '" + val + "'\n" |
| | | comps += item + ',\n' |
| | | } |
| | | content = content.replace('<script>', '<script>\n' + importComp) |
| | | .replace(/components\s*:\s*{/, 'components: {\n' + comps) |
| | | } else if (file.basename === 'local.html' && wxss) { |
| | | // å¼å
¥æ ·å¼ |
| | | content = '<style>' + wxss + '</style>' + content |
| | | } |
| | | file.contents = Buffer.from(content) |
| | | for (const item in builds) { |
| | | if (builds[item].handler) { |
| | | builds[item].handler(file, platform) |
| | | } |
| | | } |
| | | } else { |
| | | // plugins ç®å½ |
| | | const name = file.relative.split(path.sep)[0] |
| | | const build = builds[name] |
| | | // æ¬å¹³å°ä¸æ¯æä½¿ç¨ |
| | | if (!build || file.extname === '.md' || file.basename === 'build.js') { |
| | | callback() |
| | | return |
| | | } |
| | | // import |
| | | if (build.import) { |
| | | if (typeof build.import === 'string') { |
| | | if (file.relative.includes(build.import)) { |
| | | file.import = true |
| | | } |
| | | } else { |
| | | for (let i = 0; i < build.import.length; i++) { |
| | | if (file.relative.includes(build.import[i])) { |
| | | file.import = true |
| | | break |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (build.handler) { |
| | | build.handler(file, platform) |
| | | } |
| | | } |
| | | } |
| | | this.push(file) |
| | | callback() |
| | | }) |
| | | }, |
| | | /** |
| | | * @description å¼å
¥æ ·å¼æä»¶å° node.wxss ä¸ |
| | | */ |
| | | importCss () { |
| | | let css = '' |
| | | return through2.obj(function (file, _, callback) { |
| | | if (file.isBuffer()) { |
| | | let content = file.contents.toString() |
| | | // è¦è¢«å¼å
¥çæä»¶ |
| | | if (file.import) { |
| | | css += content |
| | | callback() |
| | | return |
| | | } |
| | | // å¼å
¥å°å¯¹åºä½ç½® |
| | | if (file.basename === 'node.wxss') { |
| | | content = css + content |
| | | } else if (file.basename === 'node.vue') { |
| | | content = content.replace('<style>', '<style>' + css.replace(/\.[a-z_][^)}]+?[{,]/g, '/deep/ $&')).replace(/,url/g, ', url') |
| | | } else if (file.basename === 'local.html' && css) { |
| | | content = '<style>' + css + '</style>' + content |
| | | } |
| | | file.contents = Buffer.from(content) |
| | | } |
| | | this.push(file) |
| | | callback() |
| | | }) |
| | | } |
| | | } |
node_modules/nanoid/LICENSE (deleted)
node_modules/nanoid/README.md (deleted)
node_modules/nanoid/async/index.browser.cjs (deleted)
node_modules/nanoid/async/index.browser.js (deleted)
node_modules/nanoid/async/index.cjs (deleted)
node_modules/nanoid/async/index.d.ts (deleted)
node_modules/nanoid/async/index.js (deleted)
node_modules/nanoid/async/index.native.js (deleted)
node_modules/nanoid/async/package.json (deleted)
node_modules/nanoid/bin/nanoid.cjs (deleted)
node_modules/nanoid/index.browser.cjs (deleted)
node_modules/nanoid/index.browser.js (deleted)
node_modules/nanoid/index.cjs (deleted)
node_modules/nanoid/index.d.cts (deleted)
node_modules/nanoid/index.d.ts (deleted)
node_modules/nanoid/index.js (deleted)
node_modules/nanoid/nanoid.js (deleted)
node_modules/nanoid/non-secure/index.cjs (deleted)
node_modules/nanoid/non-secure/index.d.ts (deleted)
node_modules/nanoid/non-secure/index.js (deleted)
node_modules/nanoid/non-secure/package.json (deleted)
node_modules/nanoid/package.json (deleted)
node_modules/nanoid/url-alphabet/index.cjs (deleted)
node_modules/nanoid/url-alphabet/index.js (deleted)
node_modules/nanoid/url-alphabet/package.json (deleted)
node_modules/p-limit/index.d.ts (deleted)
node_modules/p-limit/index.js (deleted)
node_modules/p-limit/license (deleted)
node_modules/p-limit/package.json (deleted)
node_modules/p-limit/readme.md (deleted)
node_modules/p-locate/index.d.ts (deleted)
node_modules/p-locate/index.js (deleted)
node_modules/p-locate/license (deleted)
node_modules/p-locate/package.json (deleted)
node_modules/p-locate/readme.md (deleted)
node_modules/p-try/index.d.ts (deleted)
node_modules/p-try/index.js (deleted)
node_modules/p-try/license (deleted)
node_modules/p-try/package.json (deleted)
node_modules/p-try/readme.md (deleted)
node_modules/path-exists/index.d.ts (deleted)
node_modules/path-exists/index.js (deleted)
node_modules/path-exists/license (deleted)
node_modules/path-exists/package.json (deleted)
node_modules/path-exists/readme.md (deleted)
node_modules/pngjs/.eslintignore (deleted)
node_modules/pngjs/.eslintrc.json (deleted)
node_modules/pngjs/.prettierignore (deleted)
node_modules/pngjs/LICENSE (deleted)
node_modules/pngjs/README.md (deleted)
node_modules/pngjs/browser.js (deleted)
node_modules/pngjs/coverage/lcov-report/base.css (deleted)
node_modules/pngjs/coverage/lcov-report/bitmapper.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/bitpacker.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/block-navigation.js (deleted)
node_modules/pngjs/coverage/lcov-report/chunkstream.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/constants.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/crc.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/favicon.png (deleted)
node_modules/pngjs/coverage/lcov-report/filter-pack.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/filter-parse-async.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/filter-parse-sync.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/filter-parse.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/format-normaliser.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/index.html (deleted)
node_modules/pngjs/coverage/lcov-report/interlace.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/packer-async.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/packer-sync.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/packer.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/paeth-predictor.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/parser-async.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/parser-sync.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/parser.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/png-sync.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/png.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/prettify.css (deleted)
node_modules/pngjs/coverage/lcov-report/prettify.js (deleted)
node_modules/pngjs/coverage/lcov-report/sort-arrow-sprite.png (deleted)
node_modules/pngjs/coverage/lcov-report/sorter.js (deleted)
node_modules/pngjs/coverage/lcov-report/sync-inflate.js.html (deleted)
node_modules/pngjs/coverage/lcov-report/sync-reader.js.html (deleted)
node_modules/pngjs/coverage/lcov.info (deleted)
node_modules/pngjs/lib/bitmapper.js (deleted)
node_modules/pngjs/lib/bitpacker.js (deleted)
node_modules/pngjs/lib/chunkstream.js (deleted)
node_modules/pngjs/lib/constants.js (deleted)
node_modules/pngjs/lib/crc.js (deleted)
node_modules/pngjs/lib/filter-pack.js (deleted)
node_modules/pngjs/lib/filter-parse-async.js (deleted)
node_modules/pngjs/lib/filter-parse-sync.js (deleted)
node_modules/pngjs/lib/filter-parse.js (deleted)
node_modules/pngjs/lib/format-normaliser.js (deleted)
node_modules/pngjs/lib/interlace.js (deleted)
node_modules/pngjs/lib/packer-async.js (deleted)
node_modules/pngjs/lib/packer-sync.js (deleted)
node_modules/pngjs/lib/packer.js (deleted)
node_modules/pngjs/lib/paeth-predictor.js (deleted)
node_modules/pngjs/lib/parser-async.js (deleted)
node_modules/pngjs/lib/parser-sync.js (deleted)
node_modules/pngjs/lib/parser.js (deleted)
node_modules/pngjs/lib/png-sync.js (deleted)
node_modules/pngjs/lib/png.js (deleted)
node_modules/pngjs/lib/sync-inflate.js (deleted)
node_modules/pngjs/lib/sync-reader.js (deleted)
node_modules/pngjs/package.json (deleted)
node_modules/postcss/LICENSE (deleted)
node_modules/postcss/README.md (deleted)
node_modules/postcss/lib/at-rule.d.ts (deleted)
node_modules/postcss/lib/at-rule.js (deleted)
node_modules/postcss/lib/comment.d.ts (deleted)
node_modules/postcss/lib/comment.js (deleted)
node_modules/postcss/lib/container.d.ts (deleted)
node_modules/postcss/lib/container.js (deleted)
node_modules/postcss/lib/css-syntax-error.d.ts (deleted)
node_modules/postcss/lib/css-syntax-error.js (deleted)
node_modules/postcss/lib/declaration.d.ts (deleted)
node_modules/postcss/lib/declaration.js (deleted)
node_modules/postcss/lib/document.d.ts (deleted)
node_modules/postcss/lib/document.js (deleted)
node_modules/postcss/lib/fromJSON.d.ts (deleted)
node_modules/postcss/lib/fromJSON.js (deleted)
node_modules/postcss/lib/input.d.ts (deleted)
node_modules/postcss/lib/input.js (deleted)
node_modules/postcss/lib/lazy-result.d.ts (deleted)
node_modules/postcss/lib/lazy-result.js (deleted)
node_modules/postcss/lib/list.d.ts (deleted)
node_modules/postcss/lib/list.js (deleted)
node_modules/postcss/lib/map-generator.js (deleted)
node_modules/postcss/lib/no-work-result.d.ts (deleted)
node_modules/postcss/lib/no-work-result.js (deleted)
node_modules/postcss/lib/node.d.ts (deleted)
node_modules/postcss/lib/node.js (deleted)
node_modules/postcss/lib/parse.d.ts (deleted)
node_modules/postcss/lib/parse.js (deleted)
node_modules/postcss/lib/parser.js (deleted)
node_modules/postcss/lib/postcss.d.mts (deleted)
node_modules/postcss/lib/postcss.d.ts (deleted)
node_modules/postcss/lib/postcss.js (deleted)
node_modules/postcss/lib/postcss.mjs (deleted)
node_modules/postcss/lib/previous-map.d.ts (deleted)
node_modules/postcss/lib/previous-map.js (deleted)
node_modules/postcss/lib/processor.d.ts (deleted)
node_modules/postcss/lib/processor.js (deleted)
node_modules/postcss/lib/result.d.ts (deleted)
node_modules/postcss/lib/result.js (deleted)
node_modules/postcss/lib/root.d.ts (deleted)
node_modules/postcss/lib/root.js (deleted)
node_modules/postcss/lib/rule.d.ts (deleted)
node_modules/postcss/lib/rule.js (deleted)
node_modules/postcss/lib/stringifier.d.ts (deleted)
node_modules/postcss/lib/stringifier.js (deleted)
node_modules/postcss/lib/stringify.d.ts (deleted)
node_modules/postcss/lib/stringify.js (deleted)
node_modules/postcss/lib/symbols.js (deleted)
node_modules/postcss/lib/terminal-highlight.js (deleted)
node_modules/postcss/lib/tokenize.js (deleted)
node_modules/postcss/lib/warn-once.js (deleted)
node_modules/postcss/lib/warning.d.ts (deleted)
node_modules/postcss/lib/warning.js (deleted)
node_modules/postcss/package.json (deleted)
node_modules/qrcode.vue/CHANGELOG.md (deleted)
node_modules/qrcode.vue/LICENSE (deleted)
node_modules/qrcode.vue/README-ja.md (deleted)
node_modules/qrcode.vue/README-zh_cn.md (deleted)
node_modules/qrcode.vue/README.md (deleted)
node_modules/qrcode.vue/dist/index.d.ts (deleted)
node_modules/qrcode.vue/dist/qrcode.vue.browser.js (deleted)
node_modules/qrcode.vue/dist/qrcode.vue.browser.min.js (deleted)
node_modules/qrcode.vue/dist/qrcode.vue.cjs.js (deleted)
node_modules/qrcode.vue/dist/qrcode.vue.esm.js (deleted)
node_modules/qrcode.vue/dist/qrcodegen.d.ts (deleted)
node_modules/qrcode.vue/package.json (deleted)
node_modules/qrcode/README.md (deleted)
node_modules/qrcode/bin/qrcode (deleted)
node_modules/qrcode/helper/to-sjis-browser.js (deleted)
node_modules/qrcode/helper/to-sjis.js (deleted)
node_modules/qrcode/lib/browser.js (deleted)
node_modules/qrcode/lib/can-promise.js (deleted)
node_modules/qrcode/lib/core/alignment-pattern.js (deleted)
node_modules/qrcode/lib/core/alphanumeric-data.js (deleted)
node_modules/qrcode/lib/core/bit-buffer.js (deleted)
node_modules/qrcode/lib/core/bit-matrix.js (deleted)
node_modules/qrcode/lib/core/byte-data.js (deleted)
node_modules/qrcode/lib/core/error-correction-code.js (deleted)
node_modules/qrcode/lib/core/error-correction-level.js (deleted)
node_modules/qrcode/lib/core/finder-pattern.js (deleted)
node_modules/qrcode/lib/core/format-info.js (deleted)
node_modules/qrcode/lib/core/galois-field.js (deleted)
node_modules/qrcode/lib/core/kanji-data.js (deleted)
node_modules/qrcode/lib/core/mask-pattern.js (deleted)
node_modules/qrcode/lib/core/mode.js (deleted)
node_modules/qrcode/lib/core/numeric-data.js (deleted)
node_modules/qrcode/lib/core/polynomial.js (deleted)
node_modules/qrcode/lib/core/qrcode.js (deleted)
node_modules/qrcode/lib/core/reed-solomon-encoder.js (deleted)
node_modules/qrcode/lib/core/regex.js (deleted)
node_modules/qrcode/lib/core/segments.js (deleted)
node_modules/qrcode/lib/core/utils.js (deleted)
node_modules/qrcode/lib/core/version-check.js (deleted)
node_modules/qrcode/lib/core/version.js (deleted)
node_modules/qrcode/lib/index.js (deleted)
node_modules/qrcode/lib/renderer/canvas.js (deleted)
node_modules/qrcode/lib/renderer/png.js (deleted)
node_modules/qrcode/lib/renderer/svg-tag.js (deleted)
node_modules/qrcode/lib/renderer/svg.js (deleted)
node_modules/qrcode/lib/renderer/terminal.js (deleted)
node_modules/qrcode/lib/renderer/terminal/terminal-small.js (deleted)
node_modules/qrcode/lib/renderer/terminal/terminal.js (deleted)
node_modules/qrcode/lib/renderer/utf8.js (deleted)
node_modules/qrcode/lib/renderer/utils.js (deleted)
node_modules/qrcode/lib/server.js (deleted)
node_modules/qrcode/license (deleted)
node_modules/qrcode/package.json (deleted)
node_modules/require-directory/.jshintrc (deleted)
node_modules/require-directory/.npmignore (deleted)
node_modules/require-directory/.travis.yml (deleted)
node_modules/require-directory/LICENSE (deleted)
node_modules/require-directory/README.markdown (deleted)
node_modules/require-directory/index.js (deleted)
node_modules/require-directory/package.json (deleted)
node_modules/require-main-filename/CHANGELOG.md (deleted)
node_modules/require-main-filename/LICENSE.txt (deleted)
node_modules/require-main-filename/README.md (deleted)
node_modules/require-main-filename/index.js (deleted)
node_modules/require-main-filename/package.json (deleted)
node_modules/set-blocking/CHANGELOG.md (deleted)
node_modules/set-blocking/LICENSE.txt (deleted)
node_modules/set-blocking/README.md (deleted)
node_modules/set-blocking/index.js (deleted)
node_modules/set-blocking/package.json (deleted)
node_modules/string-width/index.d.ts (deleted)
node_modules/string-width/index.js (deleted)
node_modules/string-width/license (deleted)
node_modules/string-width/package.json (deleted)
node_modules/string-width/readme.md (deleted)
node_modules/strip-ansi/index.d.ts (deleted)
node_modules/strip-ansi/index.js (deleted)
node_modules/strip-ansi/license (deleted)
node_modules/strip-ansi/package.json (deleted)
node_modules/strip-ansi/readme.md (deleted)
node_modules/uqrcodejs/LICENSE.md (deleted)
node_modules/uqrcodejs/README.md (deleted)
node_modules/uqrcodejs/package.json (deleted)
node_modules/uqrcodejs/uqrcode.js (deleted)
node_modules/vue/LICENSE (deleted)
node_modules/vue/README.md (deleted)
node_modules/vue/compiler-sfc/index.browser.js (deleted)
node_modules/vue/compiler-sfc/index.browser.mjs (deleted)
node_modules/vue/compiler-sfc/index.d.mts (deleted)
node_modules/vue/compiler-sfc/index.d.ts (deleted)
node_modules/vue/compiler-sfc/index.js (deleted)
node_modules/vue/compiler-sfc/index.mjs (deleted)
node_modules/vue/compiler-sfc/package.json (deleted)
node_modules/vue/compiler-sfc/register-ts.js (deleted)
node_modules/vue/dist/vue.cjs.js (deleted)
node_modules/vue/dist/vue.cjs.prod.js (deleted)
node_modules/vue/dist/vue.d.mts (deleted)
node_modules/vue/dist/vue.d.ts (deleted)
node_modules/vue/dist/vue.esm-browser.js (deleted)
node_modules/vue/dist/vue.esm-browser.prod.js (deleted)
node_modules/vue/dist/vue.esm-bundler.js (deleted)
node_modules/vue/dist/vue.global.js (deleted)
node_modules/vue/dist/vue.global.prod.js (deleted)
node_modules/vue/dist/vue.runtime.esm-browser.js (deleted)
node_modules/vue/dist/vue.runtime.esm-browser.prod.js (deleted)
node_modules/vue/dist/vue.runtime.esm-bundler.js (deleted)
node_modules/vue/dist/vue.runtime.global.js (deleted)
node_modules/vue/dist/vue.runtime.global.prod.js (deleted)
node_modules/vue/index.js (deleted)
node_modules/vue/index.mjs (deleted)
node_modules/vue/jsx-runtime/index.d.ts (deleted)
node_modules/vue/jsx-runtime/index.js (deleted)
node_modules/vue/jsx-runtime/index.mjs (deleted)
node_modules/vue/jsx-runtime/package.json (deleted)
node_modules/vue/jsx.d.ts (deleted)
node_modules/vue/package.json (deleted)
node_modules/vue/server-renderer/index.d.mts (deleted)
node_modules/vue/server-renderer/index.d.ts (deleted)
node_modules/vue/server-renderer/index.js (deleted)
node_modules/vue/server-renderer/index.mjs (deleted)
node_modules/vue/server-renderer/package.json (deleted)
node_modules/which-module/LICENSE (deleted)
node_modules/which-module/README.md (deleted)
node_modules/which-module/index.js (deleted)
node_modules/which-module/package.json (deleted)
node_modules/wrap-ansi/index.js (deleted)
node_modules/wrap-ansi/license (deleted)
node_modules/wrap-ansi/package.json (deleted)
node_modules/wrap-ansi/readme.md (deleted)
node_modules/y18n/CHANGELOG.md (deleted)
node_modules/y18n/LICENSE (deleted)
node_modules/y18n/README.md (deleted)
node_modules/y18n/index.js (deleted)
node_modules/y18n/package.json (deleted)
node_modules/yargs-parser/CHANGELOG.md (deleted)
node_modules/yargs-parser/LICENSE.txt (deleted)
node_modules/yargs-parser/README.md (deleted)
node_modules/yargs-parser/index.js (deleted)
node_modules/yargs-parser/lib/tokenize-arg-string.js (deleted)
node_modules/yargs-parser/package.json (deleted)
node_modules/yargs/CHANGELOG.md (deleted)
node_modules/yargs/LICENSE (deleted)
node_modules/yargs/README.md (deleted)
node_modules/yargs/build/lib/apply-extends.d.ts (deleted)
node_modules/yargs/build/lib/apply-extends.js (deleted)
node_modules/yargs/build/lib/argsert.d.ts (deleted)
node_modules/yargs/build/lib/argsert.js (deleted)
node_modules/yargs/build/lib/command.d.ts (deleted)
node_modules/yargs/build/lib/command.js (deleted)
node_modules/yargs/build/lib/common-types.d.ts (deleted)
node_modules/yargs/build/lib/common-types.js (deleted)
node_modules/yargs/build/lib/completion-templates.d.ts (deleted)
node_modules/yargs/build/lib/completion-templates.js (deleted)
node_modules/yargs/build/lib/completion.d.ts (deleted)
node_modules/yargs/build/lib/completion.js (deleted)
node_modules/yargs/build/lib/is-promise.d.ts (deleted)
node_modules/yargs/build/lib/is-promise.js (deleted)
node_modules/yargs/build/lib/levenshtein.d.ts (deleted)
node_modules/yargs/build/lib/levenshtein.js (deleted)
node_modules/yargs/build/lib/middleware.d.ts (deleted)
node_modules/yargs/build/lib/middleware.js (deleted)
node_modules/yargs/build/lib/obj-filter.d.ts (deleted)
node_modules/yargs/build/lib/obj-filter.js (deleted)
node_modules/yargs/build/lib/parse-command.d.ts (deleted)
node_modules/yargs/build/lib/parse-command.js (deleted)
node_modules/yargs/build/lib/process-argv.d.ts (deleted)
node_modules/yargs/build/lib/process-argv.js (deleted)
node_modules/yargs/build/lib/usage.d.ts (deleted)
node_modules/yargs/build/lib/usage.js (deleted)
node_modules/yargs/build/lib/validation.d.ts (deleted)
node_modules/yargs/build/lib/validation.js (deleted)
node_modules/yargs/build/lib/yargs.d.ts (deleted)
node_modules/yargs/build/lib/yargs.js (deleted)
node_modules/yargs/build/lib/yerror.d.ts (deleted)
node_modules/yargs/build/lib/yerror.js (deleted)
node_modules/yargs/index.js (deleted)
node_modules/yargs/locales/be.json (deleted)
node_modules/yargs/locales/de.json (deleted)
node_modules/yargs/locales/en.json (deleted)
node_modules/yargs/locales/es.json (deleted)
node_modules/yargs/locales/fi.json (deleted)
node_modules/yargs/locales/fr.json (deleted)
node_modules/yargs/locales/hi.json (deleted)
node_modules/yargs/locales/hu.json (deleted)
node_modules/yargs/locales/id.json (deleted)
node_modules/yargs/locales/it.json (deleted)
node_modules/yargs/locales/ja.json (deleted)
node_modules/yargs/locales/ko.json (deleted)
node_modules/yargs/locales/nb.json (deleted)
node_modules/yargs/locales/nl.json (deleted)
node_modules/yargs/locales/nn.json (deleted)
node_modules/yargs/locales/pirate.json (deleted)
node_modules/yargs/locales/pl.json (deleted)
node_modules/yargs/locales/pt.json (deleted)
node_modules/yargs/locales/pt_BR.json (deleted)
node_modules/yargs/locales/ru.json (deleted)
node_modules/yargs/locales/th.json (deleted)
node_modules/yargs/locales/tr.json (deleted)
node_modules/yargs/locales/zh_CN.json (deleted)
node_modules/yargs/locales/zh_TW.json (deleted)
node_modules/yargs/package.json (deleted)
node_modules/yargs/yargs.js (deleted)
package.json
pages.json
pages/fg/fg.vue
pages/history/history.vue
pages/index.vue
pages/mine/index.vue
pages/tjrecord/tjrecord.vue
pages/tjrecorddetail/tjrecorddetail.vue
pagesA/Examiner/Examiner.vue
pagesA/ReportDetails/ReportDetails.vue
pagesA/ReportOverview/ReportOverview.vue
pagesA/appointment/appointment.vue
pagesA/goHosp/goHosp.vue (deleted)
pagesA/hospIntroduce/hospIntroduce.vue
pagesB/mine/xuanzeyuanqv/xuanzeyuanqv.vue |