撤回了mathjax本地化
This commit is contained in:
1 parent
0b40d96222
commit
76e56532e2
8 files changed
+95
-92
No files matched your search
Generated
+60
-64
@@ -5,18 +5,14 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="6b18b44a-df57-4212-a857-9e291ebe5dd2" name="更改" comment="">
|
<list default="true" id="6b18b44a-df57-4212-a857-9e291ebe5dd2" name="更改" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/docutranslate/static/MathJax.js" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/docutranslate/static/mermaid.js" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/docutranslate/template/__init__.py" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/docutranslate/template/markdown.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/docutranslate/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/__init__.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/docutranslate/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/__init__.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/docutranslate/agents/agent.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/agents/agent.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/docutranslate/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/app.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/docutranslate/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/app.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/docutranslate/global_values/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/global_values/__init__.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/docutranslate/static/MathJax.js" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/static/MathJax.js" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/docutranslate/static/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/static/index.html" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/docutranslate/static/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/static/index.html" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/docutranslate/template/markdown.html" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/template/markdown.html" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/docutranslate/translater.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/translater.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/docutranslate/translater.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/translater.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/pyproject.toml" beforeDir="false" afterPath="$PROJECT_DIR$/pyproject.toml" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -47,62 +43,62 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">{
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"DefaultHtmlFileTemplate": "HTML File",
|
"DefaultHtmlFileTemplate": "HTML File",
|
||||||
"JavaScript 调试.output.html (1).executor": "Run",
|
"JavaScript 调试.output.html (1).executor": "Run",
|
||||||
"JavaScript 调试.output.html.executor": "Run",
|
"JavaScript 调试.output.html.executor": "Run",
|
||||||
"JavaScript 调试.regex.md_中文.html.executor": "Run",
|
"JavaScript 调试.regex.md_中文.html.executor": "Run",
|
||||||
"JavaScript 调试.regex_中文.html.executor": "Run",
|
"JavaScript 调试.regex_中文.html.executor": "Run",
|
||||||
"JavaScript 调试.test.html.executor": "Run",
|
"JavaScript 调试.test.html.executor": "Run",
|
||||||
"JavaScript 调试.test2.html.executor": "Run",
|
"JavaScript 调试.test2.html.executor": "Run",
|
||||||
"JavaScript 调试.test2_英文.html.executor": "Run",
|
"JavaScript 调试.test2_英文.html.executor": "Run",
|
||||||
"JavaScript 调试.test4-1_中文.html.executor": "Run",
|
"JavaScript 调试.test4-1_中文.html.executor": "Run",
|
||||||
"JavaScript 调试.互联网认证授权机制.html.executor": "Run",
|
"JavaScript 调试.互联网认证授权机制.html.executor": "Run",
|
||||||
"JavaScript 调试.互联网认证授权机制_英文.html.executor": "Run",
|
"JavaScript 调试.互联网认证授权机制_英文.html.executor": "Run",
|
||||||
"JavaScript 调试.毕业论文_英文.html.executor": "Run",
|
"JavaScript 调试.毕业论文_英文.html.executor": "Run",
|
||||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||||
"Python 测试.Python 测试 (markdown_mask.py 内).executor": "Run",
|
"Python 测试.Python 测试 (markdown_mask.py 内).executor": "Run",
|
||||||
"Python 测试.markdown_mask.Test.test_basic_link_masking 的 Python 测试.executor": "Run",
|
"Python 测试.markdown_mask.Test.test_basic_link_masking 的 Python 测试.executor": "Run",
|
||||||
"Python 测试.pytest (test_html.py 内).executor": "Run",
|
"Python 测试.pytest (test_html.py 内).executor": "Run",
|
||||||
"Python.1test.executor": "Run",
|
"Python.1test.executor": "Run",
|
||||||
"Python.2test2 (1).executor": "Run",
|
"Python.2test2 (1).executor": "Run",
|
||||||
"Python.PDFtranslater (1).executor": "Run",
|
"Python.PDFtranslater (1).executor": "Run",
|
||||||
"Python.PDFtranslater (2).executor": "Run",
|
"Python.PDFtranslater (2).executor": "Run",
|
||||||
"Python.agent.executor": "Debug",
|
"Python.agent.executor": "Debug",
|
||||||
"Python.agent_utils.executor": "Run",
|
"Python.agent_utils.executor": "Run",
|
||||||
"Python.app (1).executor": "Run",
|
"Python.app (1).executor": "Run",
|
||||||
"Python.app.executor": "Run",
|
"Python.app.executor": "Run",
|
||||||
"Python.app2.executor": "Run",
|
"Python.app2.executor": "Run",
|
||||||
"Python.app_test (1).executor": "Run",
|
"Python.app_test (1).executor": "Run",
|
||||||
"Python.convert.executor": "Run",
|
"Python.convert.executor": "Run",
|
||||||
"Python.converter_docling.executor": "Run",
|
"Python.converter_docling.executor": "Run",
|
||||||
"Python.converter_mineru.executor": "Run",
|
"Python.converter_mineru.executor": "Run",
|
||||||
"Python.markdown_splitter.executor": "Debug",
|
"Python.markdown_splitter.executor": "Debug",
|
||||||
"Python.markdown_utils.executor": "Run",
|
"Python.markdown_utils.executor": "Run",
|
||||||
"Python.test.executor": "Run",
|
"Python.test.executor": "Run",
|
||||||
"Python.test1.executor": "Run",
|
"Python.test1.executor": "Run",
|
||||||
"Python.test2.executor": "Run",
|
"Python.test2.executor": "Run",
|
||||||
"Python.test3.executor": "Run",
|
"Python.test3.executor": "Run",
|
||||||
"Python.test4.executor": "Run",
|
"Python.test4.executor": "Run",
|
||||||
"Python.testhtml.executor": "Run",
|
"Python.testhtml.executor": "Run",
|
||||||
"Python.translater.executor": "Run",
|
"Python.translater.executor": "Run",
|
||||||
"Python.切分测试.executor": "Run",
|
"Python.切分测试.executor": "Run",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
|
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
|
||||||
"RunOnceActivity.git.unshallow": "true",
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
"git-widget-placeholder": "dev",
|
"git-widget-placeholder": "main",
|
||||||
"last_opened_file_path": "C:/Users/jxgm/Desktop/translate/docutranslate",
|
"last_opened_file_path": "C:/Users/jxgm/Desktop/translate/docutranslate",
|
||||||
"list.type.of.created.stylesheet": "CSS",
|
"list.type.of.created.stylesheet": "CSS",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}</component>
|
}]]></component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
<key name="CopyFile.RECENT_KEYS">
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
<recent name="C:\Users\jxgm\Desktop\translate\docutranslate" />
|
<recent name="C:\Users\jxgm\Desktop\translate\docutranslate" />
|
||||||
@@ -642,14 +638,14 @@
|
|||||||
<breakpoints>
|
<breakpoints>
|
||||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||||
<url>file://$PROJECT_DIR$/docutranslate/translater.py</url>
|
<url>file://$PROJECT_DIR$/docutranslate/translater.py</url>
|
||||||
<line>250</line>
|
<line>240</line>
|
||||||
<option name="timeStamp" value="2" />
|
<option name="timeStamp" value="2" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
</component>
|
</component>
|
||||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||||
<SUITE FILE_PATH="coverage/filetranslate$app_test__1_.coverage" NAME="app_test (1) 覆盖结果" MODIFIED="1748227675220" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" />
|
<SUITE FILE_PATH="coverage/filetranslate$app_test__1_.coverage" NAME="app_test (1) 覆盖结果" MODIFIED="1748234136289" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" />
|
||||||
<SUITE FILE_PATH="coverage/filetranslate$test.coverage" NAME="test 覆盖结果" MODIFIED="1747472297913" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" />
|
<SUITE FILE_PATH="coverage/filetranslate$test.coverage" NAME="test 覆盖结果" MODIFIED="1747472297913" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" />
|
||||||
<SUITE FILE_PATH="coverage/filetranslate$convert.coverage" NAME="convert 覆盖结果" MODIFIED="1746963490689" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/docutranslate/utils" />
|
<SUITE FILE_PATH="coverage/filetranslate$convert.coverage" NAME="convert 覆盖结果" MODIFIED="1746963490689" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/docutranslate/utils" />
|
||||||
<SUITE FILE_PATH="coverage/PDFtranslate$PDFtranslater__1_.coverage" NAME="PDFtranslater (1) 覆盖结果" MODIFIED="1746633258205" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/pdftranslate_packages" />
|
<SUITE FILE_PATH="coverage/PDFtranslate$PDFtranslater__1_.coverage" NAME="PDFtranslater (1) 覆盖结果" MODIFIED="1746633258205" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/pdftranslate_packages" />
|
||||||
|
|||||||
@@ -188,7 +188,6 @@ translater = FileTranslater(base_url="<baseurl>", # 默认的模型baseurl
|
|||||||
docling_artifact=None, # 使用提前下载好的docling模型
|
docling_artifact=None, # 使用提前下载好的docling模型
|
||||||
convert_engin="mineru", # 可选minerU或docling
|
convert_engin="mineru", # 可选minerU或docling
|
||||||
mineru_token="<mineru-token>", # minerU的token,使用minerU时必填
|
mineru_token="<mineru-token>", # minerU的token,使用minerU时必填
|
||||||
tips=True # 开场提示
|
|
||||||
)
|
)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
__version__="0.2.25"
|
__version__="0.2.26"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ async def _perform_translation(params: Dict[str, Any], file_contents: bytes, ori
|
|||||||
model_id=params['model_id'],
|
model_id=params['model_id'],
|
||||||
convert_engin=params['convert_engin'],
|
convert_engin=params['convert_engin'],
|
||||||
mineru_token=params['mineru_token'],
|
mineru_token=params['mineru_token'],
|
||||||
tips=False # Assuming tips are not needed for server-side processing
|
|
||||||
)
|
)
|
||||||
await ft.translate_bytes_async(
|
await ft.translate_bytes_async(
|
||||||
name=original_filename,
|
name=original_filename,
|
||||||
@@ -376,10 +375,12 @@ async def get_logs_from_queue():
|
|||||||
async def download_markdown(filename_with_ext: str):
|
async def download_markdown(filename_with_ext: str):
|
||||||
if not current_state["download_ready"] or not current_state["markdown_content"] or not current_state[
|
if not current_state["download_ready"] or not current_state["markdown_content"] or not current_state[
|
||||||
"original_filename_stem"]:
|
"original_filename_stem"]:
|
||||||
|
print("Markdown 内容尚未准备好或不可用。")
|
||||||
raise HTTPException(status_code=404, detail="Markdown 内容尚未准备好或不可用。")
|
raise HTTPException(status_code=404, detail="Markdown 内容尚未准备好或不可用。")
|
||||||
|
|
||||||
requested_stem = Path(filename_with_ext).stem.replace("_translated", "")
|
requested_stem = Path(filename_with_ext).stem.replace("_translated", "")
|
||||||
if requested_stem != current_state["original_filename_stem"]:
|
if requested_stem != current_state["original_filename_stem"]:
|
||||||
|
print("请求的文件名与当前结果不符。")
|
||||||
raise HTTPException(status_code=404, detail="请求的文件名与当前结果不符。")
|
raise HTTPException(status_code=404, detail="请求的文件名与当前结果不符。")
|
||||||
|
|
||||||
actual_filename = f"{current_state['original_filename_stem']}_translated.md"
|
actual_filename = f"{current_state['original_filename_stem']}_translated.md"
|
||||||
|
|||||||
@@ -1 +1,7 @@
|
|||||||
if(document.getElementById&&document.childNodes&&document.createElement){if(!(window.MathJax&&MathJax.Hub)){if(window.MathJax){window.MathJax={AuthorConfig:window.MathJax}}else{window.MathJax={}}MathJax.isPacked=true;MathJax.version="2.7.1";MathJax.fileversion="2.7.1";MathJax.cdnVersion="2.7.1";MathJax.cdnFileVersions={};(function(d){var b=window[d];if(!b){b=window[d]={}}var e=[];var c=function(f){var g=f.constructor;if(!g){g=function(){}}for(var h in f){if(h!=="constructor"&&f.hasOwnProperty(h)){g[h]=f[h]}}return g};var a=function(){return function(){return arguments.callee.Init.call(this,arguments)}};b.Object=c({constructor:a(),Subclass:function(f,h){var g=a();g.SUPER=this;g.Init=this.Init;g.Subclass=this.Subclass;g.Augment=this.Augment;g.protoFunction=this.protoFunction;g.can=this.can;g.has=this.has;g.isa=this.isa;g.prototype=new this(e);g.prototype.constructor=g;g.Augment(f,h);return g},Init:function(f){var g=this;if(f.length===1&&f[0]===e){return g}if(!(g instanceof f.callee)){g=new f.callee(e)}return g.Init.apply(g,f)||g},Augment:function(f,g){var h;if(f!=null){for(h in f){if(f.hasOwnProperty(h)){this.protoFunction(h,f[h])}}if(f.toString!==this.prototype.toString&&f.toString!=={}.toString){this.protoFunction("toString",f.toString)}}if(g!=null){for(h in g){if(g.hasOwnProperty(h)){this[h]=g[h]}}}return this},protoFunction:function(g,f){this.prototype[g]=f;if(typeof f==="function"){f.SUPER=this.SUPER.prototype}},prototype:{Init:function(){},SUPER:function(f){return f.callee.SUPER},can:function(f){return typeof(this[f])==="function"},has:function(f){return typeof(this[f])!=="undefined"},isa:function(f){return(f instanceof Object)&&(this instanceof f)}},can:function(f){return this.prototype.can.call(this,f)},has:function(f){return this.prototype.has.call(this,f)},isa:function(g){var f=this;while(f){if(f===g){return true}else{f=f.SUPER}}return false},SimpleSUPER:c({constructor:function(f){return this.SimpleSUPER.define(f)},define:function(f){var h={};if(f!=null){for(var g in f){if(f.hasOwnProperty(g)){h[g]=this.wrap(g,f[g])}}if(f.toString!==this.prototype.toString&&f.toString!=={}.toString){h.toString=this.wrap("toString",f.toString)}}return h},wrap:function(i,h){if(typeof(h)!=="function"||!h.toString().match(/\.\s*SUPER\s*\(/)){return h}var g=function(){this.SUPER=g.SUPER[i];try{var f=h.apply(this,arguments)}catch(j){delete this.SUPER;throw j}delete this.SUPER;return f};g.toString=function(){return h.toString.apply(h,arguments)};return g}})});b.Object.isArray=Array.isArray||function(f){return Object.prototype.toString.call(f)==="[object Array]"};b.Object.Array=Array})("MathJax");(function(BASENAME){var BASE=window[BASENAME];if(!BASE){BASE=window[BASENAME]={}}var isArray=BASE.Object.isArray;var CALLBACK=function(data){var cb=function(){return arguments.callee.execute.apply(arguments.callee,arguments)};for(var id in CALLBACK.prototype){if(CALLBACK.prototype.hasOwnProperty(id)){if(typeof(data[id])!=="undefined"){cb[id]=data[id]}else{cb[id]=CALLBACK.prototype[id]}}}cb.toString=CALLBACK.prototype.toString;return cb};CALLBACK.prototype={isCallback:true,hook:function(){},data:[],object:window,execute:function(){if(!this.called||this.autoReset){this.called=!this.autoReset;return this.hook.apply(this.object,this.data.concat([].slice.call(arguments,0)))}},reset:function(){delete this.called},toString:function(){return this.hook.toString.apply(this.hook,arguments)}};var ISCALLBACK=function(f){return(typeof(f)==="function"&&f.isCallback)};var EVAL=function(code){return eval.call(window,code)};var TESTEVAL=function(){EVAL("var __TeSt_VaR__ = 1");if(window.__TeSt_VaR__){try{delete window.__TeSt_VaR__}catch(error){window.__TeSt_VaR__=null}}else{if(window.execScript){EVAL=function(code){BASE.__code=code;code="try {"+BASENAME+".__result = eval("+BASENAME+".__code)} catch(err) {"+BASENAME+".__result = err}";window.execScript(code);var result=BASE.__result;delete BASE.__result;delete BASE.__code;if(result instanceof Error){throw result}return result}}else{EVAL=function(code){BASE.__code=code;code="try {"+BASENAME+".__result = eval("+BASENAME+".__code)} catch(err) {"+BASENAME+".__result = err}";var head=(document.getElementsByTagName("head"))[0];if(!head){head=document.body}var script=document.createElement("script");script.appendChild(document.createTextNode(code));head.appendChild(script);head.removeChild(script);var result=BASE.__result;delete BASE.__result;delete BASE.__code;if(result instanceof Error){throw result}return result}}}TESTEVAL=null};var USING=function(args,i){if(arguments.length>1){if(arguments.length===2&&!(typeof arguments[0]==="function")&&arguments[0] instanceof Object&&typeof arguments[1]==="number"){args=[].slice.call(args,i)}else{args=[].slice.call(arguments,0)}}if(isArray(args)&&args.length===1){args=args[0]}if(typeof args==="function"){if(args.execute===CALLBACK.prototype.execute){return args}return CALLBACK({hook:args})}else{if(isArray(args)){if(typeof(args[0])==="string"&&args[1] instanceof ObjectLine truncated
|
/**
|
||||||
|
* Skipped minification because the original files appears to be already minified.
|
||||||
|
* Original file: /npm/mathjax@3.2.2/es5/tex-mml-chtml.js
|
||||||
|
*
|
||||||
|
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||||||
|
*/
|
||||||
|
(function(){"use strict";var __webpack_modules__={351:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},l=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.AssistiveMmlHandler=e.AssistiveMmlMathDocumentMixin=e.AssistiveMmlMathItemMixin=e.LimitedMmlVisitor=void 0;var c=r(4474),u=r(9259),p=r(7233),h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.getAttributes=function(e){return t.prototype.getAttributes.call(this,e).replace(/ ?id=".*?"/,"")},e}(u.SerializedMmlVisitor);function f(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.assistiveMml=function(t,e){if(void 0===e&&(e=!1),!(this.state()>=c.STATE.ASSISTIVEMML)){if(!this.isEscaped&&(t.options.enableAssistiveMml||e)){var r=t.adaptor,n=t.toMML(this.root).replace(/\n */g,"").replace(/<!--.*?-->/g,""),o=r.firstChild(r.body(r.parse(n,"text/html"))),i=r.node("mjx-assistive-mml",{unselectable:"on",display:this.display?"block":"inline"},[o]);r.setAttribute(r.firstChild(this.typesetRoot),"aria-hidden","true"),r.setStyle(this.typesetRoot,"position","relative"),r.append(this.typesetRoot,i)}this.state(c.STATE.ASSISTIVEMML)}},e}(t)}function d(t){var e;return e=function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,a([],s(e),!1))||this,o=n.constructor,i=o.ProcessBits;return i.has("assistive-mml")||i.allocate("assistive-mml"),n.visitor=new h(n.mmlFactory),n.options.MathItem=f(n.options.MathItem),"addStyles"in n&&n.addStyles(o.assistiveStyles),n}return o(e,t),e.prototype.toMML=function(t){return this.visitor.visitTree(t)},e.prototype.assistiveMml=function(){var t,e;if(!this.processed.isSet("assistive-mml")){try{for(var r=l(this.math),n=r.next();!n.done;n=r.next()){n.value.assistiveMml(this)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.processed.set("assistive-mml")}return this},e.prototype.state=function(e,r){return void 0===r&&(r=!1),t.prototype.state.call(this,e,r),e<c.STATE.ASSISTIVEMML&&this.processed.clear("assistive-mml"),this},e}(t),e.OPTIONS=i(i({},t.OPTIONS),{enableAssistiveMml:!0,renderActions:(0,p.expandable)(i(i({},t.OPTIONS.renderActions),{assistiveMml:[c.STATE.ASSISTIVEMML]}))}),e.assistiveStyles={"mjx-assistive-mml":{position:"absolute !important",top:"0px",left:"0px",clip:"rect(1px, 1px, 1px, 1px)",padding:"1px 0px 0px 0px !important",border:"0px !important",display:"block !important",width:"auto !important",overflow:"hidden !important","-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},'mjx-assistive-mml[display="block"]':{width:"100% !important"}},e}e.LimitedMmlVisitor=h,(0,c.newState)("ASSISTIVEMML",153),e.AssistiveMmlMathItemMixin=f,e.AssistiveMmlMathDocumentMixin=d,e.AssistiveMmlHandler=function(t){return t.documentClass=d(t.documentClass),t}},5282:function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var r=new Map;e.default=r},5445:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,Line truncated
|
||||||
@@ -699,7 +699,6 @@
|
|||||||
try {
|
try {
|
||||||
const response = await fetch("/meta")
|
const response = await fetch("/meta")
|
||||||
let meta = await response.json();
|
let meta = await response.json();
|
||||||
console.log(meta)
|
|
||||||
versionDisplay.textContent = `版本号${meta.version}`;
|
versionDisplay.textContent = `版本号${meta.version}`;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn("获取版本号失败", error);
|
console.warn("获取版本号失败", error);
|
||||||
|
|||||||
@@ -10,14 +10,24 @@
|
|||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type="text/x-mathjax-config">
|
<script>
|
||||||
MathJax.Hub.Config({
|
MathJax = {
|
||||||
messageStyle: "none",
|
loader: {load: ['[tex]/ams']},
|
||||||
tex2jax: {
|
tex: {
|
||||||
inlineMath: [ ['$','$'], ["\\\\(","\\\\)"] ],
|
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
||||||
processEscapes: true
|
displayMath: [['$$', '$$'], ['\\[', '\\]']],
|
||||||
}
|
processEscapes: true,
|
||||||
});
|
formatError: (error) => {
|
||||||
|
}, // 空函数,不显示任何错误
|
||||||
|
packages: {'[+]': ['ams']}, // 启用AMS宏包
|
||||||
|
autoload: {color: [], colorv2: ['color']} // 颜色支持
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
renderActions: {
|
||||||
|
addMenu: [0, '', '']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
{{MathJax}}
|
{{MathJax}}
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ class FileTranslater:
|
|||||||
max_concurrent=20, timeout=2000,
|
max_concurrent=20, timeout=2000,
|
||||||
convert_engin: Literal["docling", "mineru"] = "mineru",
|
convert_engin: Literal["docling", "mineru"] = "mineru",
|
||||||
docling_artifact: Path | str | None = None,
|
docling_artifact: Path | str | None = None,
|
||||||
mineru_token: str = None,
|
mineru_token: str = None):
|
||||||
tips=True):
|
|
||||||
self.convert_engin = convert_engin
|
self.convert_engin = convert_engin
|
||||||
self.mineru_token = mineru_token.strip() if mineru_token is not None else None
|
self.mineru_token = mineru_token.strip() if mineru_token is not None else None
|
||||||
if isinstance(file_path, str):
|
if isinstance(file_path, str):
|
||||||
@@ -46,15 +45,6 @@ class FileTranslater:
|
|||||||
translater_logger.info("检测到docling_artifact文件夹")
|
translater_logger.info("检测到docling_artifact文件夹")
|
||||||
self.docling_artifact = artifact_path
|
self.docling_artifact = artifact_path
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
if tips:
|
|
||||||
print("""
|
|
||||||
=======
|
|
||||||
[docutranslate](https://github.com/xunbu/docutranslate)
|
|
||||||
>以下操作会自动从[huggingface](https://huggingface.co)下载模型,windows需要使用**管理员模式**打开IDE运行脚本,并按需换源
|
|
||||||
- 第一次使用该库读取、翻译非markdown文本
|
|
||||||
- 第一次使用该库的公式识别或代码识别功能
|
|
||||||
=======
|
|
||||||
""")
|
|
||||||
|
|
||||||
def _markdown_format(self):
|
def _markdown_format(self):
|
||||||
# 该方法还需要改进
|
# 该方法还需要改进
|
||||||
@@ -305,18 +295,20 @@ class FileTranslater:
|
|||||||
|
|
||||||
def export_to_html(self, title="title") -> str:
|
def export_to_html(self, title="title") -> str:
|
||||||
markdowner = markdown2.Markdown(extras=['tables', 'fenced-code-blocks', 'mermaid', "code-friendly"])
|
markdowner = markdown2.Markdown(extras=['tables', 'fenced-code-blocks', 'mermaid', "code-friendly"])
|
||||||
# TODO:实现完全本地化css和js
|
|
||||||
# language=html
|
# language=html
|
||||||
pico=Path(__file__).parent / "static" / "pico.css"
|
pico=Path(__file__).parent / "static" / "pico.css"
|
||||||
html = Path(__file__).parent / "template" / "markdown.html"
|
html = Path(__file__).parent / "template" / "markdown.html"
|
||||||
MathJax=Path(__file__).parent / "static" / "MathJax.js"
|
MathJax=Path(__file__).parent / "static" / "MathJax.js"
|
||||||
mermaid=Path(__file__).parent / "static" / "mermaid.js"
|
mermaid=Path(__file__).parent / "static" / "mermaid.js"
|
||||||
|
#TODO:实现MathJax本地化
|
||||||
render = jinja2.Template(html.read_text()).render(
|
render = jinja2.Template(html.read_text()).render(
|
||||||
title=title,
|
title=title,
|
||||||
pico=f"<style>{pico.read_text()}</style>",
|
pico=f"<style>\n{pico.read_text()}\n</style>",
|
||||||
|
# markdown=markdowner.convert(self.markdown),
|
||||||
markdown=markdowner.convert(self.markdown.replace("\\", "\\\\")),
|
markdown=markdowner.convert(self.markdown.replace("\\", "\\\\")),
|
||||||
MathJax=f"<script>{MathJax.read_text()}</script>",
|
MathJax=r'<script src=" https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-mml-chtml.min.js "></script>',
|
||||||
mermaid=f"<script>{mermaid.read_text()}</script>",
|
# MathJax=f'<script>\n{MathJax.read_text()}\n</script>',
|
||||||
|
mermaid=f"<script>\n{mermaid.read_text()}\n</script>",
|
||||||
)
|
)
|
||||||
return render
|
return render
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user