Tian Yunhao
6 years ago
813 changed files with 503148 additions and 177 deletions
Binary file not shown.
@ -0,0 +1,180 @@ |
|||||||
|
<?xml version="1.0" ?> |
||||||
|
<JediCodeFormatSettings> |
||||||
|
<WriteVersion> 2.44 </WriteVersion> |
||||||
|
<WriteDateTime> 39387.7118126273 </WriteDateTime> |
||||||
|
<Description> JEDI Code Format Settings </Description> |
||||||
|
<Obfuscate> |
||||||
|
<Enabled> False </Enabled> |
||||||
|
<Caps> 1 </Caps> |
||||||
|
<RemoveComments> True </RemoveComments> |
||||||
|
<RemoveWhiteSpace> True </RemoveWhiteSpace> |
||||||
|
<RemoveIndent> True </RemoveIndent> |
||||||
|
<RebreakLines> True </RebreakLines> |
||||||
|
</Obfuscate> |
||||||
|
<Clarify> |
||||||
|
<OnceOffs> 0 </OnceOffs> |
||||||
|
<Warnings> True </Warnings> |
||||||
|
<WarnUnusedParams> True </WarnUnusedParams> |
||||||
|
<IgnoreUnusedParams> Sender </IgnoreUnusedParams> |
||||||
|
<FileExtensions> dpr, pas, pp </FileExtensions> |
||||||
|
</Clarify> |
||||||
|
<Indent> |
||||||
|
<IndentationSpaces> 2 </IndentationSpaces> |
||||||
|
<FirstLevelIndent> 2 </FirstLevelIndent> |
||||||
|
<HasFirstLevelIndent> False </HasFirstLevelIndent> |
||||||
|
<IndentGlobals> True </IndentGlobals> |
||||||
|
<IndentClasses> True </IndentClasses> |
||||||
|
<IndentProcedures> False </IndentProcedures> |
||||||
|
<KeepCommentsWithCodeInGlobals> True </KeepCommentsWithCodeInGlobals> |
||||||
|
<KeepCommentsWithCodeInProcs> True </KeepCommentsWithCodeInProcs> |
||||||
|
<KeepCommentsWithCodeInClassDef> True </KeepCommentsWithCodeInClassDef> |
||||||
|
<KeepCommentsWithCodeElsewhere> True </KeepCommentsWithCodeElsewhere> |
||||||
|
<IndentBeginEnd> False </IndentBeginEnd> |
||||||
|
<IndentbeginEndSpaces> 2 </IndentbeginEndSpaces> |
||||||
|
<IndentElse> False </IndentElse> |
||||||
|
<IndentCaseElse> True </IndentCaseElse> |
||||||
|
</Indent> |
||||||
|
<Spaces> |
||||||
|
<TabsToSpaces> True </TabsToSpaces> |
||||||
|
<SpacesToTabs> False </SpacesToTabs> |
||||||
|
<SpacesPerTab> 2 </SpacesPerTab> |
||||||
|
<SpacesForTab> 2 </SpacesForTab> |
||||||
|
<FixSpacing> True </FixSpacing> |
||||||
|
<SpaceBeforeClassHeritage> False </SpaceBeforeClassHeritage> |
||||||
|
<SpacesBeforeColonVar> 0 </SpacesBeforeColonVar> |
||||||
|
<SpacesBeforeColonConst> 0 </SpacesBeforeColonConst> |
||||||
|
<SpacesBeforeColonParam> 0 </SpacesBeforeColonParam> |
||||||
|
<SpacesBeforeColonFn> 0 </SpacesBeforeColonFn> |
||||||
|
<SpacesBeforeColonClassVar> 0 </SpacesBeforeColonClassVar> |
||||||
|
<SpacesBeforeColonRecordField> 0 </SpacesBeforeColonRecordField> |
||||||
|
<SpacesBeforeColonCaseLabel> 0 </SpacesBeforeColonCaseLabel> |
||||||
|
<SpacesBeforeColonLabel> 0 </SpacesBeforeColonLabel> |
||||||
|
<MaxSpacesInCode> 2 </MaxSpacesInCode> |
||||||
|
<UseMaxSpacesInCode> True </UseMaxSpacesInCode> |
||||||
|
<SpaceForOperator> 0 </SpaceForOperator> |
||||||
|
<SpaceBeforeOpenBracketsInFunctionDeclaration> False </SpaceBeforeOpenBracketsInFunctionDeclaration> |
||||||
|
<SpaceBeforeOpenBracketsInFunctionCall> False </SpaceBeforeOpenBracketsInFunctionCall> |
||||||
|
<SpaceBeforeOpenSquareBracketsInExpression> False </SpaceBeforeOpenSquareBracketsInExpression> |
||||||
|
<SpaceAfterOpenBrackets> False </SpaceAfterOpenBrackets> |
||||||
|
<SpaceBeforeCloseBrackets> False </SpaceBeforeCloseBrackets> |
||||||
|
</Spaces> |
||||||
|
<Returns> |
||||||
|
<WhenRebreakLines> 2 </WhenRebreakLines> |
||||||
|
<MaxLineLength> 90 </MaxLineLength> |
||||||
|
<NumReturnsAfterFinalEnd> 1 </NumReturnsAfterFinalEnd> |
||||||
|
<RemoveBadReturns> True </RemoveBadReturns> |
||||||
|
<AddGoodReturns> True </AddGoodReturns> |
||||||
|
<UsesOnePerLine> False </UsesOnePerLine> |
||||||
|
<RemoveExpressionReturns> True </RemoveExpressionReturns> |
||||||
|
<RemoveVarReturns> True </RemoveVarReturns> |
||||||
|
<NoReturnsInProperty> True </NoReturnsInProperty> |
||||||
|
<RemoveProcedureDefReturns> True </RemoveProcedureDefReturns> |
||||||
|
<RemoveReturns> True </RemoveReturns> |
||||||
|
<RemoveVarBlankLines> True </RemoveVarBlankLines> |
||||||
|
<RemoveProcHeaderBlankLines> True </RemoveProcHeaderBlankLines> |
||||||
|
<Block> 1 </Block> |
||||||
|
<BlockBegin> 1 </BlockBegin> |
||||||
|
<Label> 1 </Label> |
||||||
|
<LabelBegin> 1 </LabelBegin> |
||||||
|
<CaseLabel> 1 </CaseLabel> |
||||||
|
<CaseBegin> 1 </CaseBegin> |
||||||
|
<CaseElse> 0 </CaseElse> |
||||||
|
<CaseElseBegin> 0 </CaseElseBegin> |
||||||
|
<EndElse> 1 </EndElse> |
||||||
|
<ElseIf> 1 </ElseIf> |
||||||
|
<ElseBegin> 0 </ElseBegin> |
||||||
|
<BeforeCompilerDirectUses> 1 </BeforeCompilerDirectUses> |
||||||
|
<BeforeCompilerDirectStatements> 0 </BeforeCompilerDirectStatements> |
||||||
|
<BeforeCompilerDirectGeneral> 1 </BeforeCompilerDirectGeneral> |
||||||
|
<AfterCompilerDirectUses> 1 </AfterCompilerDirectUses> |
||||||
|
<AfterCompilerDirectStatements> 0 </AfterCompilerDirectStatements> |
||||||
|
<AfterCompilerDirectGeneral> 1 </AfterCompilerDirectGeneral> |
||||||
|
<ReturnChars> 0 </ReturnChars> |
||||||
|
<RemoveConsecutiveBlankLines> True </RemoveConsecutiveBlankLines> |
||||||
|
<MaxConsecutiveBlankLines> 4 </MaxConsecutiveBlankLines> |
||||||
|
<MaxBlankLinesInSection> 1 </MaxBlankLinesInSection> |
||||||
|
<LinesBeforeProcedure> 1 </LinesBeforeProcedure> |
||||||
|
</Returns> |
||||||
|
<Comments> |
||||||
|
<RemoveEmptyDoubleSlashComments> True </RemoveEmptyDoubleSlashComments> |
||||||
|
<RemoveEmptyCurlyBraceComments> True </RemoveEmptyCurlyBraceComments> |
||||||
|
</Comments> |
||||||
|
<Capitalisation> |
||||||
|
<Enabled> True </Enabled> |
||||||
|
<ReservedWords> 1 </ReservedWords> |
||||||
|
<Operators> 1 </Operators> |
||||||
|
<Directives> 1 </Directives> |
||||||
|
<Constants> 1 </Constants> |
||||||
|
<Types> 1 </Types> |
||||||
|
</Capitalisation> |
||||||
|
<SpecificWordCaps> |
||||||
|
<Enabled> True </Enabled> |
||||||
|
<Words> </Words> |
||||||
|
</SpecificWordCaps> |
||||||
|
<Identifiers> |
||||||
|
<Enabled> True </Enabled> |
||||||
|
<Words> ActivePage, AnsiCompareStr, AnsiCompareText, AnsiUpperCase, AsBoolean, AsDateTime, AsFloat, AsInteger, Assign, AsString, AsVariant, BeginDrag, Buttons, Caption, Checked, Classes, ClassName, Clear, Close, Components, Controls, Count, Create, Data, Dec, Delete, Destroy, Dialogs, Enabled, EndDrag, EOF, Exception, Execute, False, FieldByName, First, Forms, Free, FreeAndNil, GetFirstChild, Graphics, Height, idAbort, idCancel, idIgnore, IDispatch, idNo, idOk, idRetry, idYes, Inc, Initialize, IntToStr, ItemIndex, IUnknown, Lines, Math, MaxValue, mbAbort, mbAll, mbCancel, mbHelp, mbIgnore, mbNo, mbOK, mbRetry, mbYes, mbYesToAll, Messages, MinValue, mnNoToAll, mrAbort, mrAll, mrCancel, mrIgnore, mrNo, mrNone, mrNoToAll, mrOk, mrRetry, mrYes, mrYesToAll, mtConfirmation, mtCustom, mtError, mtInformation, mtWarning, Name, Next, Open, Ord, ParamStr, PChar, Perform, ProcessMessages, Read, ReadOnly, RecordCount, Register, Release, Result, Sender, SetFocus, Show, ShowMessage, Source, StdCtrls, StrToInt, SysUtils, TAutoObject, TButton, TComponent, TDataModule, Text, TForm, TFrame, TList, TNotifyEvent, TObject, TObjectList, TPageControl, TPersistent, True, TStringList, TStrings, TTabSheet, Unassigned, Value, Visible, WideString, Width, Windows, Write </Words> |
||||||
|
</Identifiers> |
||||||
|
<NotIdent> |
||||||
|
<Enabled> True </Enabled> |
||||||
|
<Words> False, Name, nil, PChar, Read, ReadOnly, True, WideString, Write </Words> |
||||||
|
</NotIdent> |
||||||
|
<UnitNameCaps> |
||||||
|
<Enabled> True </Enabled> |
||||||
|
<Words> ActnColorMaps, ActnCtrls, ActnList, ActnMan, ActnMenus, ActnPopup, ActnRes, ADOConst, ADODB, ADOInt, AppEvnts, AxCtrls, BandActn, bdeconst, bdemts, Buttons, CheckLst, Classes, Clipbrd.pas, CmAdmCtl, ComCtrls, ComStrs, Consts, Controls, CtlConsts, CtlPanel, CustomizeDlg, DataBkr, DB, DBActns, dbcgrids, DBClient, DBClientActnRes, DBClientActns, DBCommon, DBConnAdmin, DBConsts, DBCtrls, DbExcept, DBGrids, DBLocal, DBLocalI, DBLogDlg, dblookup, DBOleCtl, DBPWDlg, DBTables, DBXpress, DdeMan, Dialogs, DrTable, DSIntf, ExtActns, ExtCtrls, ExtDlgs, FileCtrl, FMTBcd, Forms, Graphics, GraphUtil, Grids, HTTPIntr, IB, IBBlob, IBCustomDataSet, IBDatabase, IBDatabaseInfo, IBDCLConst, IBErrorCodes, IBEvents, IBExternals, IBExtract, IBGeneratorEditor, IBHeader, IBIntf, IBQuery, IBRestoreEditor, IBSecurityEditor, IBServiceEditor, IBSQL, IBSQLMonitor, IBStoredProc, IBTable, IBUpdateSQL, IBUtils, IBXConst, ImgList, Jcl8087, JclAbstractContainers, JclAlgorithms, JclAnsiStrings, JclAppInst, JclArrayLists, JclArraySets, JclBase, JclBinaryTrees, JclBorlandTools, JclCIL, JclCLR, JclCOM, JclComplex, JclCompression, JclConsole, JclContainerIntf, JclCounter, JclDateTime, JclDebug, JclDotNet, JclEDI, JclEDI_ANSIX12, JclEDI_ANSIX12_Ext, JclEDI_UNEDIFACT, JclEDI_UNEDIFACT_Ext, JclEDISEF, JclEDITranslators, JclEDIXML, JclExprEval, JclFileUtils, JclFont, JclGraphics, JclGraphUtils, JclHashMaps, JclHashSets, JclHookExcept, JclIniFiles, JclLANMan, JclLinkedLists, JclLocales, JclLogic, JclMapi, JclMath, JclMetadata, JclMIDI, JclMime, JclMiscel, JclMsdosSys, JclMultimedia, JclNTFS, JclPCRE, JclPeImage, JclPrint, JclQGraphics, JclQGraphUtils, JclQueues, JclRegistry, JclResources, JclRTTI, JclSchedule, JclSecurity, JclShell, JclSimpleXml, JclStacks, JclStatistics, JclStreams, JclStrHashMap, JclStringLists, JclStrings, JclStructStorage, JclSvcCtrl, JclSynch, JclSysInfo, JclSysUtils, JclTask, JclTD32, JclUnicode, JclUnitConv, JclUnitVersioning, JclUnitVersioningProviders, JclValidation, JclVectors, JclWideFormat, JclWideStrings, JclWin32, JclWin32Ex, JclWinMIDI, ListActns, Mask, MConnect, Menus, Midas, MidasCon, MidConst, MPlayer, MtsRdm, Mxconsts, ObjBrkr, OleAuto, OleConst, OleCtnrs, OleCtrls, OleDB, OleServer, Outline, Printers, Provider, recerror, ScktCnst, ScktComp, ScktMain, SConnect, ShadowWnd, SimpleDS, SMINTF, SqlConst, SqlExpr, SqlTimSt, StdActnMenus, StdActns, StdCtrls, StdStyleActnCtrls, SvcMgr, SysUtils, TabNotBk, Tabs, TConnect, Themes, ToolWin, ValEdit, VDBConsts, WinHelpViewer, XPActnCtrls, XPMan, XPStyleActnCtrls </Words> |
||||||
|
</UnitNameCaps> |
||||||
|
<Asm> |
||||||
|
<Caps> 0 </Caps> |
||||||
|
<BreaksAfterLabel> 0 </BreaksAfterLabel> |
||||||
|
<BreaksAfterLabelEnabled> False </BreaksAfterLabelEnabled> |
||||||
|
<StatementIndentEnabled> False </StatementIndentEnabled> |
||||||
|
<StatementIndent> 0 </StatementIndent> |
||||||
|
<ParamsIndentEnabled> False </ParamsIndentEnabled> |
||||||
|
<ParamsIndent> 0 </ParamsIndent> |
||||||
|
</Asm> |
||||||
|
<PreProcessor> |
||||||
|
<Enabled> True </Enabled> |
||||||
|
<DefinedSymbols> DELPHI5_UP, MSWINDOWS </DefinedSymbols> |
||||||
|
<DefinedOptions> </DefinedOptions> |
||||||
|
</PreProcessor> |
||||||
|
<Align> |
||||||
|
<AlignAssign> True </AlignAssign> |
||||||
|
<AlignConst> True </AlignConst> |
||||||
|
<AlignTypedef> True </AlignTypedef> |
||||||
|
<AlignVars> True </AlignVars> |
||||||
|
<AlignComment> True </AlignComment> |
||||||
|
<AlignFields> True </AlignFields> |
||||||
|
<InterfaceOnly> False </InterfaceOnly> |
||||||
|
<MinColumn> 2 </MinColumn> |
||||||
|
<MaxColumn> 60 </MaxColumn> |
||||||
|
<MaxVariance> 1 </MaxVariance> |
||||||
|
<MaxVarianceInterface> 10 </MaxVarianceInterface> |
||||||
|
<MaxUnalignedStatements> 0 </MaxUnalignedStatements> |
||||||
|
</Align> |
||||||
|
<Replace> |
||||||
|
<Enabled> False </Enabled> |
||||||
|
<Words> </Words> |
||||||
|
</Replace> |
||||||
|
<Uses> |
||||||
|
<RemoveEnabled> False </RemoveEnabled> |
||||||
|
<InsertInterfaceEnabled> False </InsertInterfaceEnabled> |
||||||
|
<InsertImplementationEnabled> False </InsertImplementationEnabled> |
||||||
|
<FindReplaceEnabled> False </FindReplaceEnabled> |
||||||
|
<Remove> </Remove> |
||||||
|
<InsertInterface> </InsertInterface> |
||||||
|
<InsertImplementation> </InsertImplementation> |
||||||
|
<Find> </Find> |
||||||
|
<Replace> </Replace> |
||||||
|
</Uses> |
||||||
|
<Transform> |
||||||
|
<BeginEndStyle> 1 </BeginEndStyle> |
||||||
|
<AddBlockEndSemicolon> True </AddBlockEndSemicolon> |
||||||
|
<SortUsesInterface> False </SortUsesInterface> |
||||||
|
<SortUsesImplmentation> False </SortUsesImplmentation> |
||||||
|
<SortUsesProgram> False </SortUsesProgram> |
||||||
|
<SortUsesBreakOnReturn> False </SortUsesBreakOnReturn> |
||||||
|
<SortUsesBreakOnComment> True </SortUsesBreakOnComment> |
||||||
|
<SortUsesSortOrder> 0 </SortUsesSortOrder> |
||||||
|
<SortUsesNoComments> False </SortUsesNoComments> |
||||||
|
</Transform> |
||||||
|
</JediCodeFormatSettings> |
@ -0,0 +1,54 @@ |
|||||||
|
let child_process = require('child_process'); |
||||||
|
let streamToString = require('stream-to-string'); |
||||||
|
let tempfile = require('tempfile'); |
||||||
|
let fs = require('fs-extra'); |
||||||
|
|
||||||
|
module.exports = async (code, lang) => { |
||||||
|
let timer, result, tempFile; |
||||||
|
try { |
||||||
|
let process, pascalAddProgram; |
||||||
|
if (lang === 'pas') { |
||||||
|
tempFile = tempfile('.pas'); |
||||||
|
|
||||||
|
if (code.indexOf('program') === -1) { |
||||||
|
code = 'program format\n' + code; |
||||||
|
pascalAddProgram = true; |
||||||
|
} |
||||||
|
|
||||||
|
await fs.writeFile(tempFile, code); |
||||||
|
process = child_process.spawn(`${__dirname}/../bin/jcf`, [tempFile, '-inplace']); |
||||||
|
} else { |
||||||
|
process = child_process.spawn(`clang-format -style="{BasedOnStyle: Google, IndentWidth: 4, AccessModifierOffset: -4, SortIncludes: false, AllowShortIfStatementsOnASingleLine: false, ColumnLimit: 110, Cpp11BracedListStyle: false }" -assume-filename="a.${lang}"`, { shell: true }); |
||||||
|
process.stdin.setEncoding('utf-8'); |
||||||
|
process.stdin.write(code); |
||||||
|
process.stdin.end(); |
||||||
|
} |
||||||
|
|
||||||
|
timer = setTimeout(() => process.kill(), 5000); |
||||||
|
|
||||||
|
if (lang === 'pas') { |
||||||
|
await streamToString(process.stdout); |
||||||
|
result = await fs.readFile(tempFile, 'utf-8'); |
||||||
|
if (pascalAddProgram) result = result.replace('program format\n', ''); |
||||||
|
} else { |
||||||
|
result = await streamToString(process.stdout); |
||||||
|
} |
||||||
|
|
||||||
|
await new Promise((resolve, reject) => { |
||||||
|
let exit = code => { |
||||||
|
if (code === 0) resolve(); |
||||||
|
else reject(code); |
||||||
|
} |
||||||
|
|
||||||
|
if (process.exitCode !== null) exit(process.exitCode); |
||||||
|
else process.on('close', exit); |
||||||
|
}); |
||||||
|
} catch (e) { |
||||||
|
console.log(e.stack); |
||||||
|
result = null; |
||||||
|
} |
||||||
|
|
||||||
|
clearTimeout(timer); |
||||||
|
try { if (tempFile) await fs.delete(tempFile); } catch (e) {} |
||||||
|
return result; |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
let Sequelize = require('sequelize'); |
||||||
|
let db = syzoj.db; |
||||||
|
|
||||||
|
let model = db.define('formatted_code', { |
||||||
|
key: { type: Sequelize.STRING(50), primaryKey: true }, |
||||||
|
code: { type: Sequelize.TEXT('medium') } |
||||||
|
}, { |
||||||
|
timestamps: false, |
||||||
|
tableName: 'formatted_code', |
||||||
|
indexes: [ |
||||||
|
{ |
||||||
|
fields: ['key'] |
||||||
|
} |
||||||
|
] |
||||||
|
}); |
||||||
|
|
||||||
|
let Model = require('./common'); |
||||||
|
class FormattedCode extends Model { |
||||||
|
static async create(val) { |
||||||
|
return FormattedCode.fromRecord(FormattedCode.model.build(Object.assign({ |
||||||
|
key: "", |
||||||
|
code: "" |
||||||
|
}, val))); |
||||||
|
} |
||||||
|
|
||||||
|
getModel() { return model; } |
||||||
|
} |
||||||
|
|
||||||
|
FormattedCode.model = model; |
||||||
|
|
||||||
|
module.exports = FormattedCode; |
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,335 @@ |
|||||||
|
(function webpackUniversalModuleDefinition(root, factory) { |
||||||
|
if(typeof exports === 'object' && typeof module === 'object') |
||||||
|
module.exports = factory(require("katex")); |
||||||
|
else if(typeof define === 'function' && define.amd) |
||||||
|
define(["katex"], factory); |
||||||
|
else if(typeof exports === 'object') |
||||||
|
exports["renderMathInElement"] = factory(require("katex")); |
||||||
|
else |
||||||
|
root["renderMathInElement"] = factory(root["katex"]); |
||||||
|
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { |
||||||
|
return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
/******/ // The module cache
|
||||||
|
/******/ var installedModules = {}; |
||||||
|
/******/ |
||||||
|
/******/ // The require function
|
||||||
|
/******/ function __webpack_require__(moduleId) { |
||||||
|
/******/ |
||||||
|
/******/ // Check if module is in cache
|
||||||
|
/******/ if(installedModules[moduleId]) { |
||||||
|
/******/ return installedModules[moduleId].exports; |
||||||
|
/******/ } |
||||||
|
/******/ // Create a new module (and put it into the cache)
|
||||||
|
/******/ var module = installedModules[moduleId] = { |
||||||
|
/******/ i: moduleId, |
||||||
|
/******/ l: false, |
||||||
|
/******/ exports: {} |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // Execute the module function
|
||||||
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
||||||
|
/******/ |
||||||
|
/******/ // Flag the module as loaded
|
||||||
|
/******/ module.l = true; |
||||||
|
/******/ |
||||||
|
/******/ // Return the exports of the module
|
||||||
|
/******/ return module.exports; |
||||||
|
/******/ } |
||||||
|
/******/ |
||||||
|
/******/ |
||||||
|
/******/ // expose the modules object (__webpack_modules__)
|
||||||
|
/******/ __webpack_require__.m = modules; |
||||||
|
/******/ |
||||||
|
/******/ // expose the module cache
|
||||||
|
/******/ __webpack_require__.c = installedModules; |
||||||
|
/******/ |
||||||
|
/******/ // define getter function for harmony exports
|
||||||
|
/******/ __webpack_require__.d = function(exports, name, getter) { |
||||||
|
/******/ if(!__webpack_require__.o(exports, name)) { |
||||||
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
||||||
|
/******/ } |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // define __esModule on exports
|
||||||
|
/******/ __webpack_require__.r = function(exports) { |
||||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
||||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
||||||
|
/******/ } |
||||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // create a fake namespace object
|
||||||
|
/******/ // mode & 1: value is a module id, require it
|
||||||
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||||
|
/******/ // mode & 4: return value when already ns object
|
||||||
|
/******/ // mode & 8|1: behave like require
|
||||||
|
/******/ __webpack_require__.t = function(value, mode) { |
||||||
|
/******/ if(mode & 1) value = __webpack_require__(value); |
||||||
|
/******/ if(mode & 8) return value; |
||||||
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
||||||
|
/******/ var ns = Object.create(null); |
||||||
|
/******/ __webpack_require__.r(ns); |
||||||
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
||||||
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
||||||
|
/******/ return ns; |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||||
|
/******/ __webpack_require__.n = function(module) { |
||||||
|
/******/ var getter = module && module.__esModule ? |
||||||
|
/******/ function getDefault() { return module['default']; } : |
||||||
|
/******/ function getModuleExports() { return module; }; |
||||||
|
/******/ __webpack_require__.d(getter, 'a', getter); |
||||||
|
/******/ return getter; |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||||
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
||||||
|
/******/ |
||||||
|
/******/ // __webpack_public_path__
|
||||||
|
/******/ __webpack_require__.p = ""; |
||||||
|
/******/ |
||||||
|
/******/ |
||||||
|
/******/ // Load entry module and return exports
|
||||||
|
/******/ return __webpack_require__(__webpack_require__.s = 1); |
||||||
|
/******/ }) |
||||||
|
/************************************************************************/ |
||||||
|
/******/ ([ |
||||||
|
/* 0 */ |
||||||
|
/***/ (function(module, exports) { |
||||||
|
|
||||||
|
module.exports = __WEBPACK_EXTERNAL_MODULE__0__; |
||||||
|
|
||||||
|
/***/ }), |
||||||
|
/* 1 */ |
||||||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
||||||
|
|
||||||
|
"use strict"; |
||||||
|
__webpack_require__.r(__webpack_exports__); |
||||||
|
|
||||||
|
// EXTERNAL MODULE: external "katex"
|
||||||
|
var external_katex_ = __webpack_require__(0); |
||||||
|
var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_); |
||||||
|
|
||||||
|
// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js
|
||||||
|
/* eslint no-constant-condition:0 */ |
||||||
|
var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) { |
||||||
|
// Adapted from
|
||||||
|
// https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
|
||||||
|
var index = startIndex; |
||||||
|
var braceLevel = 0; |
||||||
|
var delimLength = delimiter.length; |
||||||
|
|
||||||
|
while (index < text.length) { |
||||||
|
var character = text[index]; |
||||||
|
|
||||||
|
if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) { |
||||||
|
return index; |
||||||
|
} else if (character === "\\") { |
||||||
|
index++; |
||||||
|
} else if (character === "{") { |
||||||
|
braceLevel++; |
||||||
|
} else if (character === "}") { |
||||||
|
braceLevel--; |
||||||
|
} |
||||||
|
|
||||||
|
index++; |
||||||
|
} |
||||||
|
|
||||||
|
return -1; |
||||||
|
}; |
||||||
|
|
||||||
|
var splitAtDelimiters = function splitAtDelimiters(startData, leftDelim, rightDelim, display) { |
||||||
|
var finalData = []; |
||||||
|
|
||||||
|
for (var i = 0; i < startData.length; i++) { |
||||||
|
if (startData[i].type === "text") { |
||||||
|
var text = startData[i].data; |
||||||
|
var lookingForLeft = true; |
||||||
|
var currIndex = 0; |
||||||
|
var nextIndex = void 0; |
||||||
|
nextIndex = text.indexOf(leftDelim); |
||||||
|
|
||||||
|
if (nextIndex !== -1) { |
||||||
|
currIndex = nextIndex; |
||||||
|
finalData.push({ |
||||||
|
type: "text", |
||||||
|
data: text.slice(0, currIndex) |
||||||
|
}); |
||||||
|
lookingForLeft = false; |
||||||
|
} |
||||||
|
|
||||||
|
while (true) { |
||||||
|
if (lookingForLeft) { |
||||||
|
nextIndex = text.indexOf(leftDelim, currIndex); |
||||||
|
|
||||||
|
if (nextIndex === -1) { |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
finalData.push({ |
||||||
|
type: "text", |
||||||
|
data: text.slice(currIndex, nextIndex) |
||||||
|
}); |
||||||
|
currIndex = nextIndex; |
||||||
|
} else { |
||||||
|
nextIndex = findEndOfMath(rightDelim, text, currIndex + leftDelim.length); |
||||||
|
|
||||||
|
if (nextIndex === -1) { |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
finalData.push({ |
||||||
|
type: "math", |
||||||
|
data: text.slice(currIndex + leftDelim.length, nextIndex), |
||||||
|
rawData: text.slice(currIndex, nextIndex + rightDelim.length), |
||||||
|
display: display |
||||||
|
}); |
||||||
|
currIndex = nextIndex + rightDelim.length; |
||||||
|
} |
||||||
|
|
||||||
|
lookingForLeft = !lookingForLeft; |
||||||
|
} |
||||||
|
|
||||||
|
finalData.push({ |
||||||
|
type: "text", |
||||||
|
data: text.slice(currIndex) |
||||||
|
}); |
||||||
|
} else { |
||||||
|
finalData.push(startData[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return finalData; |
||||||
|
}; |
||||||
|
|
||||||
|
/* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters); |
||||||
|
// CONCATENATED MODULE: ./contrib/auto-render/auto-render.js
|
||||||
|
/* eslint no-console:0 */ |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var auto_render_splitWithDelimiters = function splitWithDelimiters(text, delimiters) { |
||||||
|
var data = [{ |
||||||
|
type: "text", |
||||||
|
data: text |
||||||
|
}]; |
||||||
|
|
||||||
|
for (var i = 0; i < delimiters.length; i++) { |
||||||
|
var delimiter = delimiters[i]; |
||||||
|
data = auto_render_splitAtDelimiters(data, delimiter.left, delimiter.right, delimiter.display || false); |
||||||
|
} |
||||||
|
|
||||||
|
return data; |
||||||
|
}; |
||||||
|
/* Note: optionsCopy is mutated by this method. If it is ever exposed in the |
||||||
|
* API, we should copy it before mutating. |
||||||
|
*/ |
||||||
|
|
||||||
|
|
||||||
|
var auto_render_renderMathInText = function renderMathInText(text, optionsCopy) { |
||||||
|
var data = auto_render_splitWithDelimiters(text, optionsCopy.delimiters); |
||||||
|
var fragment = document.createDocumentFragment(); |
||||||
|
|
||||||
|
for (var i = 0; i < data.length; i++) { |
||||||
|
if (data[i].type === "text") { |
||||||
|
fragment.appendChild(document.createTextNode(data[i].data)); |
||||||
|
} else { |
||||||
|
var span = document.createElement("span"); |
||||||
|
var math = data[i].data; // Override any display mode defined in the settings with that
|
||||||
|
// defined by the text itself
|
||||||
|
|
||||||
|
optionsCopy.displayMode = data[i].display; |
||||||
|
|
||||||
|
try { |
||||||
|
external_katex_default.a.render(math, span, optionsCopy); |
||||||
|
} catch (e) { |
||||||
|
if (!(e instanceof external_katex_default.a.ParseError)) { |
||||||
|
throw e; |
||||||
|
} |
||||||
|
|
||||||
|
optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e); |
||||||
|
fragment.appendChild(document.createTextNode(data[i].rawData)); |
||||||
|
continue; |
||||||
|
} |
||||||
|
|
||||||
|
fragment.appendChild(span); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return fragment; |
||||||
|
}; |
||||||
|
|
||||||
|
var renderElem = function renderElem(elem, optionsCopy) { |
||||||
|
for (var i = 0; i < elem.childNodes.length; i++) { |
||||||
|
var childNode = elem.childNodes[i]; |
||||||
|
|
||||||
|
if (childNode.nodeType === 3) { |
||||||
|
// Text node
|
||||||
|
var frag = auto_render_renderMathInText(childNode.textContent, optionsCopy); |
||||||
|
i += frag.childNodes.length - 1; |
||||||
|
elem.replaceChild(frag, childNode); |
||||||
|
} else if (childNode.nodeType === 1) { |
||||||
|
(function () { |
||||||
|
// Element node
|
||||||
|
var className = ' ' + childNode.className + ' '; |
||||||
|
var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(function (x) { |
||||||
|
return className.indexOf(' ' + x + ' ') === -1; |
||||||
|
}); |
||||||
|
|
||||||
|
if (shouldRender) { |
||||||
|
renderElem(childNode, optionsCopy); |
||||||
|
} |
||||||
|
})(); |
||||||
|
} // Otherwise, it's something else, and ignore it.
|
||||||
|
|
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
var renderMathInElement = function renderMathInElement(elem, options) { |
||||||
|
if (!elem) { |
||||||
|
throw new Error("No element provided to render"); |
||||||
|
} |
||||||
|
|
||||||
|
var optionsCopy = {}; // Object.assign(optionsCopy, option)
|
||||||
|
|
||||||
|
for (var option in options) { |
||||||
|
if (options.hasOwnProperty(option)) { |
||||||
|
optionsCopy[option] = options[option]; |
||||||
|
} |
||||||
|
} // default options
|
||||||
|
|
||||||
|
|
||||||
|
optionsCopy.delimiters = optionsCopy.delimiters || [{ |
||||||
|
left: "$$", |
||||||
|
right: "$$", |
||||||
|
display: true |
||||||
|
}, { |
||||||
|
left: "\\(", |
||||||
|
right: "\\)", |
||||||
|
display: false |
||||||
|
}, // LaTeX uses $…$, but it ruins the display of normal `$` in text:
|
||||||
|
// {left: "$", right: "$", display: false},
|
||||||
|
// \[…\] must come last in this array. Otherwise, renderMathInElement
|
||||||
|
// will search for \[ before it searches for $$ or \(
|
||||||
|
// That makes it susceptible to finding a \\[0.3em] row delimiter and
|
||||||
|
// treating it as if it were the start of a KaTeX math zone.
|
||||||
|
{ |
||||||
|
left: "\\[", |
||||||
|
right: "\\]", |
||||||
|
display: true |
||||||
|
}]; |
||||||
|
optionsCopy.ignoredTags = optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code"]; |
||||||
|
optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || []; |
||||||
|
optionsCopy.errorCallback = optionsCopy.errorCallback || console.error; // Enable sharing of global macros defined via `\gdef` between different
|
||||||
|
// math elements within a single call to `renderMathInElement`.
|
||||||
|
|
||||||
|
optionsCopy.macros = optionsCopy.macros || {}; |
||||||
|
renderElem(elem, optionsCopy); |
||||||
|
}; |
||||||
|
|
||||||
|
/* harmony default export */ var auto_render = __webpack_exports__["default"] = (renderMathInElement); |
||||||
|
|
||||||
|
/***/ }) |
||||||
|
/******/ ])["default"]; |
||||||
|
}); |
@ -0,0 +1 @@ |
|||||||
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,function(r){return function(r){var n={};function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=r,o.c=n,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)}([function(e,t){e.exports=r},function(e,t,r){"use strict";r.r(t);var n=r(0),l=r.n(n),s=function(e,t,r){for(var n=r,o=0,a=e.length;n<t.length;){var i=t[n];if(o<=0&&t.slice(n,n+a)===e)return n;"\\"===i?n++:"{"===i?o++:"}"===i&&o--,n++}return-1},d=function(e,t,r,n){for(var o=[],a=0;a<e.length;a++)if("text"===e[a].type){var i=e[a].data,l=!0,d=0,f=void 0;for(-1!==(f=i.indexOf(t))&&(d=f,o.push({type:"text",data:i.slice(0,d)}),l=!1);;){if(l){if(-1===(f=i.indexOf(t,d)))break;o.push({type:"text",data:i.slice(d,f)}),d=f}else{if(-1===(f=s(r,i,d+t.length)))break;o.push({type:"math",data:i.slice(d+t.length,f),rawData:i.slice(d,f+r.length),display:n}),d=f+r.length}l=!l}o.push({type:"text",data:i.slice(d)})}else o.push(e[a]);return o},i=function(e,t){for(var r=function(e,t){for(var r=[{type:"text",data:e}],n=0;n<t.length;n++){var o=t[n];r=d(r,o.left,o.right,o.display||!1)}return r}(e,t.delimiters),n=document.createDocumentFragment(),o=0;o<r.length;o++)if("text"===r[o].type)n.appendChild(document.createTextNode(r[o].data));else{var a=document.createElement("span"),i=r[o].data;t.displayMode=r[o].display;try{l.a.render(i,a,t)}catch(e){if(!(e instanceof l.a.ParseError))throw e;t.errorCallback("KaTeX auto-render: Failed to parse `"+r[o].data+"` with ",e),n.appendChild(document.createTextNode(r[o].rawData));continue}n.appendChild(a)}return n};t.default=function(e,t){if(!e)throw new Error("No element provided to render");var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);r.delimiters=r.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\[",right:"\\]",display:!0}],r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},function e(t,r){for(var n=0;n<t.childNodes.length;n++){var o=t.childNodes[n];if(3===o.nodeType){var a=i(o.textContent,r);n+=a.childNodes.length-1,t.replaceChild(a,o)}else 1===o.nodeType&&function(){var t=" "+o.className+" ";-1===r.ignoredTags.indexOf(o.nodeName.toLowerCase())&&r.ignoredClasses.every(function(e){return-1===t.indexOf(" "+e+" ")})&&e(o,r)}()}}(e,r)}}]).default}); |
@ -0,0 +1,14 @@ |
|||||||
|
/* Force selection of entire .katex/.katex-display blocks, so that we can |
||||||
|
* copy/paste the entire source code. If you omit this CSS, partial |
||||||
|
* selections of a formula will work, but will copy the ugly HTML |
||||||
|
* representation instead of the LaTeX source code. (Full selections will |
||||||
|
* still produce the LaTeX source code.) |
||||||
|
*/ |
||||||
|
.katex, |
||||||
|
.katex-display { |
||||||
|
user-select: all; |
||||||
|
-moz-user-select: all; |
||||||
|
-webkit-user-select: all; |
||||||
|
-ms-user-select: all; |
||||||
|
} |
||||||
|
|
@ -0,0 +1,208 @@ |
|||||||
|
(function webpackUniversalModuleDefinition(root, factory) { |
||||||
|
if(typeof exports === 'object' && typeof module === 'object') |
||||||
|
module.exports = factory(); |
||||||
|
else if(typeof define === 'function' && define.amd) |
||||||
|
define([], factory); |
||||||
|
else { |
||||||
|
var a = factory(); |
||||||
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; |
||||||
|
} |
||||||
|
})((typeof self !== 'undefined' ? self : this), function() { |
||||||
|
return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
/******/ // The module cache
|
||||||
|
/******/ var installedModules = {}; |
||||||
|
/******/ |
||||||
|
/******/ // The require function
|
||||||
|
/******/ function __webpack_require__(moduleId) { |
||||||
|
/******/ |
||||||
|
/******/ // Check if module is in cache
|
||||||
|
/******/ if(installedModules[moduleId]) { |
||||||
|
/******/ return installedModules[moduleId].exports; |
||||||
|
/******/ } |
||||||
|
/******/ // Create a new module (and put it into the cache)
|
||||||
|
/******/ var module = installedModules[moduleId] = { |
||||||
|
/******/ i: moduleId, |
||||||
|
/******/ l: false, |
||||||
|
/******/ exports: {} |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // Execute the module function
|
||||||
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
||||||
|
/******/ |
||||||
|
/******/ // Flag the module as loaded
|
||||||
|
/******/ module.l = true; |
||||||
|
/******/ |
||||||
|
/******/ // Return the exports of the module
|
||||||
|
/******/ return module.exports; |
||||||
|
/******/ } |
||||||
|
/******/ |
||||||
|
/******/ |
||||||
|
/******/ // expose the modules object (__webpack_modules__)
|
||||||
|
/******/ __webpack_require__.m = modules; |
||||||
|
/******/ |
||||||
|
/******/ // expose the module cache
|
||||||
|
/******/ __webpack_require__.c = installedModules; |
||||||
|
/******/ |
||||||
|
/******/ // define getter function for harmony exports
|
||||||
|
/******/ __webpack_require__.d = function(exports, name, getter) { |
||||||
|
/******/ if(!__webpack_require__.o(exports, name)) { |
||||||
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
||||||
|
/******/ } |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // define __esModule on exports
|
||||||
|
/******/ __webpack_require__.r = function(exports) { |
||||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
||||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
||||||
|
/******/ } |
||||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // create a fake namespace object
|
||||||
|
/******/ // mode & 1: value is a module id, require it
|
||||||
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||||
|
/******/ // mode & 4: return value when already ns object
|
||||||
|
/******/ // mode & 8|1: behave like require
|
||||||
|
/******/ __webpack_require__.t = function(value, mode) { |
||||||
|
/******/ if(mode & 1) value = __webpack_require__(value); |
||||||
|
/******/ if(mode & 8) return value; |
||||||
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
||||||
|
/******/ var ns = Object.create(null); |
||||||
|
/******/ __webpack_require__.r(ns); |
||||||
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
||||||
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
||||||
|
/******/ return ns; |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||||
|
/******/ __webpack_require__.n = function(module) { |
||||||
|
/******/ var getter = module && module.__esModule ? |
||||||
|
/******/ function getDefault() { return module['default']; } : |
||||||
|
/******/ function getModuleExports() { return module; }; |
||||||
|
/******/ __webpack_require__.d(getter, 'a', getter); |
||||||
|
/******/ return getter; |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||||
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
||||||
|
/******/ |
||||||
|
/******/ // __webpack_public_path__
|
||||||
|
/******/ __webpack_require__.p = ""; |
||||||
|
/******/ |
||||||
|
/******/ |
||||||
|
/******/ // Load entry module and return exports
|
||||||
|
/******/ return __webpack_require__(__webpack_require__.s = 2); |
||||||
|
/******/ }) |
||||||
|
/************************************************************************/ |
||||||
|
/******/ ([ |
||||||
|
/* 0 */ |
||||||
|
/***/ (function(module, exports, __webpack_require__) { |
||||||
|
|
||||||
|
// extracted by mini-css-extract-plugin
|
||||||
|
|
||||||
|
/***/ }), |
||||||
|
/* 1 */, |
||||||
|
/* 2 */ |
||||||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
||||||
|
|
||||||
|
"use strict"; |
||||||
|
__webpack_require__.r(__webpack_exports__); |
||||||
|
|
||||||
|
// EXTERNAL MODULE: ./contrib/copy-tex/copy-tex.css
|
||||||
|
var copy_tex = __webpack_require__(0); |
||||||
|
|
||||||
|
// CONCATENATED MODULE: ./contrib/copy-tex/katex2tex.js
|
||||||
|
// Set these to how you want inline and display math to be delimited.
|
||||||
|
var defaultCopyDelimiters = { |
||||||
|
inline: ['$', '$'], |
||||||
|
// alternative: ['\(', '\)']
|
||||||
|
display: ['$$', '$$'] // alternative: ['\[', '\]']
|
||||||
|
|
||||||
|
}; // Replace .katex elements with their TeX source (<annotation> element).
|
||||||
|
// Modifies fragment in-place. Useful for writing your own 'copy' handler,
|
||||||
|
// as in copy-tex.js.
|
||||||
|
|
||||||
|
var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters) { |
||||||
|
if (copyDelimiters === void 0) { |
||||||
|
copyDelimiters = defaultCopyDelimiters; |
||||||
|
} |
||||||
|
|
||||||
|
// Remove .katex-html blocks that are preceded by .katex-mathml blocks
|
||||||
|
// (which will get replaced below).
|
||||||
|
var katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html'); |
||||||
|
|
||||||
|
for (var i = 0; i < katexHtml.length; i++) { |
||||||
|
var element = katexHtml[i]; |
||||||
|
|
||||||
|
if (element.remove) { |
||||||
|
element.remove(null); |
||||||
|
} else { |
||||||
|
element.parentNode.removeChild(element); |
||||||
|
} |
||||||
|
} // Replace .katex-mathml elements with their annotation (TeX source)
|
||||||
|
// descendant, with inline delimiters.
|
||||||
|
|
||||||
|
|
||||||
|
var katexMathml = fragment.querySelectorAll('.katex-mathml'); |
||||||
|
|
||||||
|
for (var _i = 0; _i < katexMathml.length; _i++) { |
||||||
|
var _element = katexMathml[_i]; |
||||||
|
|
||||||
|
var texSource = _element.querySelector('annotation'); |
||||||
|
|
||||||
|
if (texSource) { |
||||||
|
if (_element.replaceWith) { |
||||||
|
_element.replaceWith(texSource); |
||||||
|
} else { |
||||||
|
_element.parentNode.replaceChild(texSource, _element); |
||||||
|
} |
||||||
|
|
||||||
|
texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1]; |
||||||
|
} |
||||||
|
} // Switch display math to display delimiters.
|
||||||
|
|
||||||
|
|
||||||
|
var displays = fragment.querySelectorAll('.katex-display annotation'); |
||||||
|
|
||||||
|
for (var _i2 = 0; _i2 < displays.length; _i2++) { |
||||||
|
var _element2 = displays[_i2]; |
||||||
|
_element2.innerHTML = copyDelimiters.display[0] + _element2.innerHTML.substr(copyDelimiters.inline[0].length, _element2.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1]; |
||||||
|
} |
||||||
|
|
||||||
|
return fragment; |
||||||
|
}; |
||||||
|
/* harmony default export */ var katex2tex = (katexReplaceWithTex); |
||||||
|
// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.js
|
||||||
|
|
||||||
|
// Global copy handler to modify behavior on .katex elements.
|
||||||
|
|
||||||
|
document.addEventListener('copy', function (event) { |
||||||
|
var selection = window.getSelection(); |
||||||
|
|
||||||
|
if (selection.isCollapsed) { |
||||||
|
return; // default action OK if selection is empty
|
||||||
|
} |
||||||
|
|
||||||
|
var fragment = selection.getRangeAt(0).cloneContents(); |
||||||
|
|
||||||
|
if (!fragment.querySelector('.katex-mathml')) { |
||||||
|
return; // default action OK if no .katex-mathml elements
|
||||||
|
} // Preserve usual HTML copy/paste behavior.
|
||||||
|
|
||||||
|
|
||||||
|
var html = []; |
||||||
|
|
||||||
|
for (var i = 0; i < fragment.childNodes.length; i++) { |
||||||
|
html.push(fragment.childNodes[i].outerHTML); |
||||||
|
} |
||||||
|
|
||||||
|
event.clipboardData.setData('text/html', html.join('')); // Rewrite plain-text version.
|
||||||
|
|
||||||
|
event.clipboardData.setData('text/plain', katex2tex(fragment).textContent); // Prevent normal copy handling.
|
||||||
|
|
||||||
|
event.preventDefault(); |
||||||
|
}); |
||||||
|
|
||||||
|
/***/ }) |
||||||
|
/******/ ])["default"]; |
||||||
|
}); |
@ -0,0 +1 @@ |
|||||||
|
.katex,.katex-display{-moz-user-select:all;-ms-user-select:all;-webkit-user-select:all;user-select:all} |
@ -0,0 +1 @@ |
|||||||
|
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,function(){return function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=2)}([function(e,t,n){},,function(e,t,n){"use strict";n.r(t);n(0);var p={inline:["$","$"],display:["$$","$$"]},l=function(e,t){void 0===t&&(t=p);for(var n=e.querySelectorAll(".katex-mathml + .katex-html"),r=0;r<n.length;r++){var o=n[r];o.remove?o.remove(null):o.parentNode.removeChild(o)}for(var l=e.querySelectorAll(".katex-mathml"),i=0;i<l.length;i++){var a=l[i],u=a.querySelector("annotation");u&&(a.replaceWith?a.replaceWith(u):a.parentNode.replaceChild(u,a),u.innerHTML=t.inline[0]+u.innerHTML+t.inline[1])}for(var f=e.querySelectorAll(".katex-display annotation"),c=0;c<f.length;c++){var d=f[c];d.innerHTML=t.display[0]+d.innerHTML.substr(t.inline[0].length,d.innerHTML.length-t.inline[0].length-t.inline[1].length)+t.display[1]}return e};document.addEventListener("copy",function(e){var t=window.getSelection();if(!t.isCollapsed){var n=t.getRangeAt(0).cloneContents();if(n.querySelector(".katex-mathml")){for(var r=[],o=0;o<n.childNodes.length;o++)r.push(n.childNodes[o].outerHTML);e.clipboardData.setData("text/html",r.join("")),e.clipboardData.setData("text/plain",l(n).textContent),e.preventDefault()}}})}]).default}); |
@ -0,0 +1,137 @@ |
|||||||
|
(function webpackUniversalModuleDefinition(root, factory) { |
||||||
|
if(typeof exports === 'object' && typeof module === 'object') |
||||||
|
module.exports = factory(require("katex")); |
||||||
|
else if(typeof define === 'function' && define.amd) |
||||||
|
define(["katex"], factory); |
||||||
|
else { |
||||||
|
var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]); |
||||||
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; |
||||||
|
} |
||||||
|
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { |
||||||
|
return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
/******/ // The module cache
|
||||||
|
/******/ var installedModules = {}; |
||||||
|
/******/ |
||||||
|
/******/ // The require function
|
||||||
|
/******/ function __webpack_require__(moduleId) { |
||||||
|
/******/ |
||||||
|
/******/ // Check if module is in cache
|
||||||
|
/******/ if(installedModules[moduleId]) { |
||||||
|
/******/ return installedModules[moduleId].exports; |
||||||
|
/******/ } |
||||||
|
/******/ // Create a new module (and put it into the cache)
|
||||||
|
/******/ var module = installedModules[moduleId] = { |
||||||
|
/******/ i: moduleId, |
||||||
|
/******/ l: false, |
||||||
|
/******/ exports: {} |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // Execute the module function
|
||||||
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
||||||
|
/******/ |
||||||
|
/******/ // Flag the module as loaded
|
||||||
|
/******/ module.l = true; |
||||||
|
/******/ |
||||||
|
/******/ // Return the exports of the module
|
||||||
|
/******/ return module.exports; |
||||||
|
/******/ } |
||||||
|
/******/ |
||||||
|
/******/ |
||||||
|
/******/ // expose the modules object (__webpack_modules__)
|
||||||
|
/******/ __webpack_require__.m = modules; |
||||||
|
/******/ |
||||||
|
/******/ // expose the module cache
|
||||||
|
/******/ __webpack_require__.c = installedModules; |
||||||
|
/******/ |
||||||
|
/******/ // define getter function for harmony exports
|
||||||
|
/******/ __webpack_require__.d = function(exports, name, getter) { |
||||||
|
/******/ if(!__webpack_require__.o(exports, name)) { |
||||||
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
||||||
|
/******/ } |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // define __esModule on exports
|
||||||
|
/******/ __webpack_require__.r = function(exports) { |
||||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
||||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
||||||
|
/******/ } |
||||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // create a fake namespace object
|
||||||
|
/******/ // mode & 1: value is a module id, require it
|
||||||
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||||
|
/******/ // mode & 4: return value when already ns object
|
||||||
|
/******/ // mode & 8|1: behave like require
|
||||||
|
/******/ __webpack_require__.t = function(value, mode) { |
||||||
|
/******/ if(mode & 1) value = __webpack_require__(value); |
||||||
|
/******/ if(mode & 8) return value; |
||||||
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
||||||
|
/******/ var ns = Object.create(null); |
||||||
|
/******/ __webpack_require__.r(ns); |
||||||
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
||||||
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
||||||
|
/******/ return ns; |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||||
|
/******/ __webpack_require__.n = function(module) { |
||||||
|
/******/ var getter = module && module.__esModule ? |
||||||
|
/******/ function getDefault() { return module['default']; } : |
||||||
|
/******/ function getModuleExports() { return module; }; |
||||||
|
/******/ __webpack_require__.d(getter, 'a', getter); |
||||||
|
/******/ return getter; |
||||||
|
/******/ }; |
||||||
|
/******/ |
||||||
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||||
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
||||||
|
/******/ |
||||||
|
/******/ // __webpack_public_path__
|
||||||
|
/******/ __webpack_require__.p = ""; |
||||||
|
/******/ |
||||||
|
/******/ |
||||||
|
/******/ // Load entry module and return exports
|
||||||
|
/******/ return __webpack_require__(__webpack_require__.s = 1); |
||||||
|
/******/ }) |
||||||
|
/************************************************************************/ |
||||||
|
/******/ ([ |
||||||
|
/* 0 */ |
||||||
|
/***/ (function(module, exports) { |
||||||
|
|
||||||
|
module.exports = __WEBPACK_EXTERNAL_MODULE__0__; |
||||||
|
|
||||||
|
/***/ }), |
||||||
|
/* 1 */ |
||||||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
||||||
|
|
||||||
|
"use strict"; |
||||||
|
__webpack_require__.r(__webpack_exports__); |
||||||
|
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); |
||||||
|
/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__); |
||||||
|
|
||||||
|
var scripts = document.body.getElementsByTagName("script"); |
||||||
|
scripts = Array.prototype.slice.call(scripts); |
||||||
|
scripts.forEach(function (script) { |
||||||
|
if (!script.type || !script.type.match(/math\/tex/i)) { |
||||||
|
return -1; |
||||||
|
} |
||||||
|
|
||||||
|
var display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null; |
||||||
|
var katexElement = document.createElement(display ? "div" : "span"); |
||||||
|
katexElement.setAttribute("class", display ? "equation" : "inline-equation"); |
||||||
|
|
||||||
|
try { |
||||||
|
katex__WEBPACK_IMPORTED_MODULE_0___default.a.render(script.text, katexElement, { |
||||||
|
displayMode: display |
||||||
|
}); |
||||||
|
} catch (err) { |
||||||
|
//console.error(err); linter doesn't like this
|
||||||
|
katexElement.textContent = script.text; |
||||||
|
} |
||||||
|
|
||||||
|
script.parentNode.replaceChild(katexElement, script); |
||||||
|
}); |
||||||
|
|
||||||
|
/***/ }) |
||||||
|
/******/ ])["default"]; |
||||||
|
}); |
@ -0,0 +1 @@ |
|||||||
|
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],t);else{var r="object"==typeof exports?t(require("katex")):t(e.katex);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"!=typeof self?self:this,function(r){return function(r){var n={};function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=r,o.c=n,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)}([function(e,t){e.exports=r},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),u=document.body.getElementsByTagName("script");(u=Array.prototype.slice.call(u)).forEach(function(t){if(!t.type||!t.type.match(/math\/tex/i))return-1;var e=null!=t.type.match(/mode\s*=\s*display(;|\s|\n|$)/),r=document.createElement(e?"div":"span");r.setAttribute("class",e?"equation":"inline-equation");try{o.a.render(t.text,r,{displayMode:e})}catch(e){r.textContent=t.text}t.parentNode.replaceChild(r,t)})}]).default}); |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,8 @@ |
|||||||
|
define("ace/ext/beautify",["require","exports","module","ace/token_iterator"],function(e,t,n){"use strict";function i(e,t){return e.type.lastIndexOf(t+".xml")>-1}var r=e("../token_iterator").TokenIterator;t.singletonTags=["area","base","br","col","command","embed","hr","html","img","input","keygen","link","meta","param","source","track","wbr"],t.blockTags=["article","aside","blockquote","body","div","dl","fieldset","footer","form","head","header","html","nav","ol","p","script","section","style","table","tbody","tfoot","thead","ul"],t.beautify=function(e){var n=new r(e,0,0),s=n.getCurrentToken(),o=e.getTabString(),u=t.singletonTags,a=t.blockTags,f,l=!1,c=!1,h=!1,p="",d="",v="",m=0,g=0,y=0,b=0,w=0,E=0,S=!1,x,T=0,N=0,C=[],k=!1,L,A=!1,O=!1,M=!1,_=!1,D={0:0},P={},H=function(){f&&f.value&&f.type!=="string.regexp"&&(f.value=f.value.trim())},B=function(){p=p.replace(/ +$/,"")},j=function(){p=p.trimRight(),l=!1};while(s!==null){T=n.getCurrentTokenRow(),C=n.$rowTokens,f=n.stepForward();if(typeof s!="undefined"){d=s.value,w=0,M=v==="style"||e.$modeId==="ace/mode/css",i(s,"tag-open")?(O=!0,f&&(_=a.indexOf(f.value)!==-1),d==="</"&&(_&&!l&&N<1&&N++,M&&(N=1),w=1,_=!1)):i(s,"tag-close")?O=!1:i(s,"comment.start")?_=!0:i(s,"comment.end")&&(_=!1),!O&&!N&&s.type==="paren.rparen"&&s.value.substr(0,1)==="}"&&N++,T!==x&&(N=T,x&&(N-=x));if(N){j();for(;N>0;N--)p+="\n";l=!0,!i(s,"comment")&&!s.type.match(/^(comment|string)$/)&&(d=d.trimLeft())}if(d){s.type==="keyword"&&d.match(/^(if|else|elseif|for|foreach|while|switch)$/)?(P[m]=d,H(),h=!0,d.match(/^(else|elseif)$/)&&p.match(/\}[\s]*$/)&&(j(),c=!0)):s.type==="paren.lparen"?(H(),d.substr(-1)==="{"&&(h=!0,A=!1,O||(N=1)),d.substr(0,1)==="{"&&(c=!0,p.substr(-1)!=="["&&p.trimRight().substr(-1)==="["?(j(),c=!1):p.trimRight().substr(-1)===")"?j():B())):s.type==="paren.rparen"?(w=1,d.substr(0,1)==="}"&&(P[m-1]==="case"&&w++,p.trimRight().substr(-1)==="{"?j():(c=!0,M&&(N+=2))),d.substr(0,1)==="]"&&p.substr(-1)!=="}"&&p.trimRight().substr(-1)==="}"&&(c=!1,b++,j()),d.substr(0,1)===")"&&p.substr(-1)!=="("&&p.trimRight().substr(-1)==="("&&(c=!1,b++,j()),B()):s.type!=="keyword.operator"&&s.type!=="keyword"||!d.match(/^(=|==|===|!=|!==|&&|\|\||and|or|xor|\+=|.=|>|>=|<|<=|=>)$/)?s.type==="punctuation.operator"&&d===";"?(j(),H(),h=!0,M&&N++):s.type==="punctuation.operator"&&d.match(/^(:|,)$/)?(j(),H(),h=!0,l=!1):s.type==="support.php_tag"&&d==="?>"&&!l?(j(),c=!0):i(s,"attribute-name")&&p.substr(-1).match(/^\s$/)?c=!0:i(s,"attribute-equals")?(B(),H()):i(s,"tag-close")&&(B(),d==="/>"&&(c=!0)):(j(),H(),c=!0,h=!0);if(l&&(!s.type.match(/^(comment)$/)||!!d.substr(0,1).match(/^[/#]$/))&&(!s.type.match(/^(string)$/)||!!d.substr(0,1).match(/^['"]$/))){b=y;if(m>g){b++;for(L=m;L>g;L--)D[L]=b}else m<g&&(b=D[m]);g=m,y=b,w&&(b-=w),A&&!E&&(b++,A=!1);for(L=0;L<b;L++)p+=o}s.type==="keyword"&&d.match(/^(case|default)$/)&&(P[m]=d,m++),s.type==="keyword"&&d.match(/^(break)$/)&&P[m-1]&&P[m-1].match(/^(case|default)$/)&&m--,s.type==="paren.lparen"&&(E+=(d.match(/\(/g)||[]).length,m+=d.length),s.type==="keyword"&&d.match(/^(if|else|elseif|for|while)$/)?(A=!0,E=0):!E&&d.trim()&&s.type!=="comment"&&(A=!1);if(s.type==="paren.rparen"){E-=(d.match(/\)/g)||[]).length;for(L=0;L<d.length;L++)m--,d.substr(L,1)==="}"&&P[m]==="case"&&m--}c&&!l&&(B(),p.substr(-1)!=="\n"&&(p+=" ")),p+=d,h&&(p+=" "),l=!1,c=!1,h=!1;if(i(s,"tag-close")&&(_||a.indexOf(v)!==-1)||i(s,"doctype")&&d===">")_&&f&&f.value==="</"?N=-1:N=1;i(s,"tag-open")&&d==="</"?m--:i(s,"tag-open")&&d==="<"&&u.indexOf(f.value)===-1?m++:i(s,"tag-name")?v=d:i(s,"tag-close")&&d==="/>"&&u.indexOf(v)===-1&&m--,x=T}}s=f}p=p.trim(),e.doc.setValue(p)},t.commands=[{name:"beautify",exec:function(e){t.beautify(e.session)},bindKey:"Ctrl-Shift-B"}]}); (function() { |
||||||
|
window.require(["ace/ext/beautify"], function(m) { |
||||||
|
if (typeof module == "object" && typeof exports == "object" && module) { |
||||||
|
module.exports = m; |
||||||
|
} |
||||||
|
}); |
||||||
|
})(); |
||||||
|
|
@ -0,0 +1,8 @@ |
|||||||
|
define("ace/ext/elastic_tabstops_lite",["require","exports","module","ace/editor","ace/config"],function(e,t,n){"use strict";var r=function(e){this.$editor=e;var t=this,n=[],r=!1;this.onAfterExec=function(){r=!1,t.processRows(n),n=[]},this.onExec=function(){r=!0},this.onChange=function(e){r&&(n.indexOf(e.start.row)==-1&&n.push(e.start.row),e.end.row!=e.start.row&&n.push(e.end.row))}};(function(){this.processRows=function(e){this.$inChange=!0;var t=[];for(var n=0,r=e.length;n<r;n++){var i=e[n];if(t.indexOf(i)>-1)continue;var s=this.$findCellWidthsForBlock(i),o=this.$setBlockCellWidthsToMax(s.cellWidths),u=s.firstRow;for(var a=0,f=o.length;a<f;a++){var l=o[a];t.push(u),this.$adjustRow(u,l),u++}}this.$inChange=!1},this.$findCellWidthsForBlock=function(e){var t=[],n,r=e;while(r>=0){n=this.$cellWidthsForRow(r);if(n.length==0)break;t.unshift(n),r--}var i=r+1;r=e;var s=this.$editor.session.getLength();while(r<s-1){r++,n=this.$cellWidthsForRow(r);if(n.length==0)break;t.push(n)}return{cellWidths:t,firstRow:i}},this.$cellWidthsForRow=function(e){var t=this.$selectionColumnsForRow(e),n=[-1].concat(this.$tabsForRow(e)),r=n.map(function(e){return 0}).slice(1),i=this.$editor.session.getLine(e);for(var s=0,o=n.length-1;s<o;s++){var u=n[s]+1,a=n[s+1],f=this.$rightmostSelectionInCell(t,a),l=i.substring(u,a);r[s]=Math.max(l.replace(/\s+$/g,"").length,f-u)}return r},this.$selectionColumnsForRow=function(e){var t=[],n=this.$editor.getCursorPosition();return this.$editor.session.getSelection().isEmpty()&&e==n.row&&t.push(n.column),t},this.$setBlockCellWidthsToMax=function(e){var t=!0,n,r,i,s=this.$izip_longest(e);for(var o=0,u=s.length;o<u;o++){var a=s[o];if(!a.push){console.error(a);continue}a.push(NaN);for(var f=0,l=a.length;f<l;f++){var c=a[f];t&&(n=f,i=0,t=!1);if(isNaN(c)){r=f;for(var h=n;h<r;h++)e[h][o]=i;t=!0}i=Math.max(i,c)}}return e},this.$rightmostSelectionInCell=function(e,t){var n=0;if(e.length){var r=[];for(var i=0,s=e.length;i<s;i++)e[i]<=t?r.push(i):r.push(0);n=Math.max.apply(Math,r)}return n},this.$tabsForRow=function(e){var t=[],n=this.$editor.session.getLine(e),r=/\t/g,i;while((i=r.exec(n))!=null)t.push(i.index);return t},this.$adjustRow=function(e,t){var n=this.$tabsForRow(e);if(n.length==0)return;var r=0,i=-1,s=this.$izip(t,n);for(var o=0,u=s.length;o<u;o++){var a=s[o][0],f=s[o][1];i+=1+a,f+=r;var l=i-f;if(l==0)continue;var c=this.$editor.session.getLine(e).substr(0,f),h=c.replace(/\s*$/g,""),p=c.length-h.length;l>0&&(this.$editor.session.getDocument().insertInLine({row:e,column:f+1},Array(l+1).join(" ")+" "),this.$editor.session.getDocument().removeInLine(e,f,f+1),r+=l),l<0&&p>=-l&&(this.$editor.session.getDocument().removeInLine(e,f+l,f),r+=l)}},this.$izip_longest=function(e){if(!e[0])return[];var t=e[0].length,n=e.length;for(var r=1;r<n;r++){var i=e[r].length;i>t&&(t=i)}var s=[];for(var o=0;o<t;o++){var u=[];for(var r=0;r<n;r++)e[r][o]===""?u.push(NaN):u.push(e[r][o]);s.push(u)}return s},this.$izip=function(e,t){var n=e.length>=t.length?t.length:e.length,r=[];for(var i=0;i<n;i++){var s=[e[i],t[i]];r.push(s)}return r}}).call(r.prototype),t.ElasticTabstopsLite=r;var i=e("../editor").Editor;e("../config").defineOptions(i.prototype,"editor",{useElasticTabstops:{set:function(e){e?(this.elasticTabstops||(this.elasticTabstops=new r(this)),this.commands.on("afterExec",this.elasticTabstops.onAfterExec),this.commands.on("exec",this.elasticTabstops.onExec),this.on("change",this.elasticTabstops.onChange)):this.elasticTabstops&&(this.commands.removeListener("afterExec",this.elasticTabstops.onAfterExec),this.commands.removeListener("exec",this.elasticTabstops.onExec),this.removeListener("change",this.elasticTabstops.onChange))}}})}); (function() { |
||||||
|
window.require(["ace/ext/elastic_tabstops_lite"], function(m) { |
||||||
|
if (typeof module == "object" && typeof exports == "object" && module) { |
||||||
|
module.exports = m; |
||||||
|
} |
||||||
|
}); |
||||||
|
})(); |
||||||
|
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,8 @@ |
|||||||
|
; (function() { |
||||||
|
window.require(["ace/ext/error_marker"], function(m) { |
||||||
|
if (typeof module == "object" && typeof exports == "object" && module) { |
||||||
|
module.exports = m; |
||||||
|
} |
||||||
|
}); |
||||||
|
})(); |
||||||
|
|
@ -0,0 +1,8 @@ |
|||||||
|
define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../../lib/dom"),i="#ace_settingsmenu, #kbshortcutmenu {background-color: #F7F7F7;color: black;box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);padding: 1em 0.5em 2em 1em;overflow: auto;position: absolute;margin: 0;bottom: 0;right: 0;top: 0;z-index: 9991;cursor: default;}.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);background-color: rgba(255, 255, 255, 0.6);color: black;}.ace_optionsMenuEntry:hover {background-color: rgba(100, 100, 100, 0.1);transition: all 0.3s}.ace_closeButton {background: rgba(245, 146, 146, 0.5);border: 1px solid #F48A8A;border-radius: 50%;padding: 7px;position: absolute;right: -8px;top: -8px;z-index: 100000;}.ace_closeButton{background: rgba(245, 146, 146, 0.9);}.ace_optionsMenuKey {color: darkslateblue;font-weight: bold;}.ace_optionsMenuCommand {color: darkcyan;font-weight: normal;}.ace_optionsMenuEntry input, .ace_optionsMenuEntry button {vertical-align: middle;}.ace_optionsMenuEntry button[ace_selected_button=true] {background: #e7e7e7;box-shadow: 1px 0px 2px 0px #adadad inset;border-color: #adadad;}.ace_optionsMenuEntry button {background: white;border: 1px solid lightgray;margin: 0px;}.ace_optionsMenuEntry button:hover{background: #f0f0f0;}";r.importCssString(i),n.exports.overlayPage=function(t,n,i,s,o,u){function l(e){e.keyCode===27&&a.click()}i=i?"top: "+i+";":"",o=o?"bottom: "+o+";":"",s=s?"right: "+s+";":"",u=u?"left: "+u+";":"";var a=document.createElement("div"),f=document.createElement("div");a.style.cssText="margin: 0; padding: 0; position: fixed; top:0; bottom:0; left:0; right:0;z-index: 9990; background-color: rgba(0, 0, 0, 0.3);",a.addEventListener("click",function(){document.removeEventListener("keydown",l),a.parentNode.removeChild(a),t.focus(),a=null}),document.addEventListener("keydown",l),f.style.cssText=i+s+o+u,f.addEventListener("click",function(e){e.stopPropagation()});var c=r.createElement("div");c.style.position="relative";var h=r.createElement("div");h.className="ace_closeButton",h.addEventListener("click",function(){a.click()}),c.appendChild(h),f.appendChild(c),f.appendChild(n),a.appendChild(f),document.body.appendChild(a),t.blur()}}),define("ace/ext/menu_tools/get_editor_keyboard_shortcuts",["require","exports","module","ace/lib/keys"],function(e,t,n){"use strict";var r=e("../../lib/keys");n.exports.getEditorKeybordShortcuts=function(e){var t=r.KEY_MODS,n=[],i={};return e.keyBinding.$handlers.forEach(function(e){var t=e.commandKeyBinding;for(var r in t){var s=r.replace(/(^|-)\w/g,function(e){return e.toUpperCase()}),o=t[r];Array.isArray(o)||(o=[o]),o.forEach(function(e){typeof e!="string"&&(e=e.name),i[e]?i[e].key+="|"+s:(i[e]={key:s,command:e},n.push(i[e]))})}}),n}}),define("ace/ext/keybinding_menu",["require","exports","module","ace/editor","ace/ext/menu_tools/overlay_page","ace/ext/menu_tools/get_editor_keyboard_shortcuts"],function(e,t,n){"use strict";function i(t){if(!document.getElementById("kbshortcutmenu")){var n=e("./menu_tools/overlay_page").overlayPage,r=e("./menu_tools/get_editor_keyboard_shortcuts").getEditorKeybordShortcuts,i=r(t),s=document.createElement("div"),o=i.reduce(function(e,t){return e+'<div class="ace_optionsMenuEntry"><span class="ace_optionsMenuCommand">'+t.command+"</span> : "+'<span class="ace_optionsMenuKey">'+t.key+"</span></div>"},"");s.id="kbshortcutmenu",s.innerHTML="<h1>Keyboard Shortcuts</h1>"+o+"</div>",n(t,s,"0","0","0",null)}}var r=e("ace/editor").Editor;n.exports.init=function(e){r.prototype.showKeyboardShortcuts=function(){i(this)},e.commands.addCommands([{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e,t){e.showKeyboardShortcuts()}}])}}); (function() { |
||||||
|
window.require(["ace/ext/keybinding_menu"], function(m) { |
||||||
|
if (typeof module == "object" && typeof exports == "object" && module) { |
||||||
|
module.exports = m; |
||||||
|
} |
||||||
|
}); |
||||||
|
})(); |
||||||
|
|
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue