深夜读书会

 找回密码
 注册
搜索
查看: 1641|回复: 29

[讨论] 制作EPUB的简单脚本

 关闭 [复制链接]

28

主题

106

帖子

3220

积分

吃书妖怪

Rank: 5Rank: 5Rank: 5

积分
3220
贡献
3220
金币
3692
发表于 2022-5-26 20:54:45 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
本帖最后由 hoebec 于 2022-5-26 23:59 编辑

注意! 以下内容涉及 我的现实与网游被恋爱喜剧侵蚀了 台版1-8卷的各种原文

epub的机器转换实际是关于图片,排版,目录,注释,上标的一套解决方案(私有标准),基本上每种轮距都不太一致,所以最花时间的部分是预处理文本
脚本预设是使用"<chapter>"作为章节标志,可以修改为任意字符(单独一行)
注释是在行内直接输入,以"(注:" "(注:"之类特定文字提取
对于各种弹注方式,可以自己编写扩展
图片为直接输入文件名
可以修改参数方便直排横排
内置Duokan的样式,锁字体等
只支持输入Unicode格式的txt文件(utf16le),不支持Utf-8,论坛下载的txt文件必须先手动保存为Unicode格式

基本格式:
在txt同一文件夹内,以txt同名目录,或Images目录,或image目录作为图片文件夹,以fonts目录或font目录作为字体文件夹
在章节前,输入<chapter>作为单独一行
以图片文件夹内的图片文件名(包括后缀)作为单独一行,识别为图片行(大小写通用,jpg与jpeg通用)

运行方式:
双击运行vbs,拖放txt文件,ENTER,下一步输入作者名(脚本会尝试自动从txt文件读取),再下一步输入画师名(会尝试自动读取),ENTER,开始制作EPUB,等待1-2秒,脚本提示完成,并列出章节目录,及注释,上标,图片等统计结果

以下是实际的vbs制作脚本,必须以Unicode方式保存(保存为Unicode格式的txt,修改后缀名为vbs),大小约100k

  1. Set WshShell = CreateObject("Wscript.Shell")
  2. Set objFSO = CreateObject("scripting.filesystemobject")
  3. Set objAdodbStream = CreateObject("Adodb.Stream")
  4. scriptloadtempbat=objFSO.GetSpecialFolder(2)&"\"&"scriptloadtemp.bat"
  5. If Wscript.arguments.count=0 Then
  6.   WshShell.run "cmd /c echo @echo off>"&scriptloadtempbat&"",0,True
  7.   WshShell.run "cmd /c echo setlocal enabledelayedexpansion>>"&scriptloadtempbat&"",0,True
  8.   WshShell.run "cmd /c echo :input>>"&scriptloadtempbat&"",0,True
  9.   WshShell.run "cmd /c echo Set /p ""input=input txt:"">>"&scriptloadtempbat&"",0,True
  10.   WshShell.run "cmd /c echo if not defined input goto input>>"&scriptloadtempbat&"",0,True
  11.   WshShell.run "cmd /c echo start """" """&Wscript.ScriptFullName&""" !input!>>"&scriptloadtempbat&"",0,True
  12.   WshShell.run("cmd /c "&scriptloadtempbat&"")
  13.   Wscript.quit
  14. End If
  15. If Wscript.arguments.count=1 Then objFSO.DeleteFile(scriptloadtempbat)
  16. If Wscript.arguments.count=1 Then Input=Wscript.arguments(0)
  17. If not objFSO.FileExists(Input) Then Wscript.quit

  18. covername="封面"
  19. tocimgname="插圖"
  20. tocmakeinfo="製作信息"
  21. tocintroname="內容簡介"
  22. tocauthname="作者簡介"
  23. tocpagecolor="彩頁"
  24. toclistpage="目錄"
  25. tocimgpagename="插圖集"
  26. covername="封面"
  27. tocimgname="插图"
  28. tocmakeinfo="制作信息"
  29. tocintroname="内容简介"
  30. tocauthname="作者简介"
  31. tocpagecolor="彩页"
  32. toclistpage="目录"
  33. tocimgpagename="插图集"
  34. imagemissinginfo="找不到图片文件!"
  35. rubya="|"
  36. rubyb="《"
  37. rubyc="》"
  38. rubycount=0
  39. rubyerror=0
  40. footnotecount=0
  41. footnoteerror=0
  42. imagepage=1
  43. numbercenter=1
  44. symbolcenter=1
  45. lineheight="1.3"
  46. textindent="2em"
  47. margintop="1em"
  48. marginbottom="1em"
  49. marginp="0.5em"
  50. vrtl="vrtl"
  51. vrtl="hltr"
  52. rtl="rtl"
  53. rtl="ltr"
  54. author=EMPTY
  55. author2=EMPTY
  56. language="zh"
  57. publisher=""
  58. dcdate=""
  59. dcid="uid"
  60. chapterbreak="<chapter>"
  61. duokanbleed="leftright"
  62. duokancover="duokan-page-fitwindow"
  63. duokancover="duokan-page-fullscreen"
  64. duokanfontfixed=1
  65. emptylineskip=0
  66. footnotetype="newline"
  67. footnotetype="duokan"
  68. footnotecolor="#a0513c"
  69. footnotefontsize="0.8em"
  70. footnoteimagesize="0.9em"
  71. htmlfontbsn=EMPTY
  72. footnotebsn=EMPTY
  73. chaptercount=0
  74. fontcount=0
  75. tocimgline=1
  76. tocnum=0
  77. txtbackup=1
  78. inputfiledelete=0

  79. arrsymbol=Array("†","*","﹡","*","§","※","◆","◇","■","□","♣","♧","★","☆"," "," ","+","▪","▫","▲","△","▼","▽","●","○","◌","♡","♥","❤","■","○","×")
  80. arrintro=Array("简介","简 介","简 介","内容简介","书籍简介","簡介","簡 介","簡 介","內容簡介","書籍簡介","简介:","简 介:","简 介:","内容简介:","书籍简介:","簡介:","簡 介:","簡 介:","內容簡介:","書籍簡介:","简介︰","简 介︰","简 介︰","内容简介︰","书籍简介︰","簡介︰","簡 介︰","簡 介︰","內容簡介︰","書籍簡介︰","简介:","简 介:","简 介:","内容简介:","书籍简介:","簡介:","簡 介:","簡 介:","內容簡介:","書籍簡介:")
  81. arrauthor=Array("作者简介","作者簡介","作者简介:","作者簡介:","作者简介︰","作者簡介︰","作者简介:","作者簡介:")
  82. arrinfo=Array("制作信息","製作信息","制作信息:","製作信息:","制作信息︰","製作信息︰","制作信息:","製作信息:")
  83. arraut=Array("作者:","作者︰","作者:","作 者:","作 者︰","作 者:","作者 :","作者 ︰","作者 :","作 者 :","作 者 ︰","作 者 :")
  84. arrgak=Array("插画:","插画︰","插画:","插畫:","插畫︰","插畫:","绘者:","绘者︰","绘者:","繪者:","繪者︰","繪者:","画师:","画师︰","画师:","畫師:","畫師︰","畫師:","插 画:","插 画︰","插 画:","插 畫:","插 畫︰","插 畫:","绘 者:","绘 者︰","绘 者:","繪 者:","繪 者︰","繪 者:","画 师:","画 师︰","画 师:","畫 師:","畫 師︰","畫 師:")
  85. arrfootnote=Array("注","註","译注","编注","录注","校注","譯注","編注","錄注","译註","编註","录註","校註","譯註","編註","錄註","译者注","翻译注","编者注","编辑注","录入注","校对注","譯者注","翻譯注","編者注","編輯注","錄入注","校對注","译者註","翻译註","编者註","编辑註","录入註","校对註","譯者註","翻譯註","編者註","編輯註","錄入註","校對註")
  86. arrlabel=Array("<a>","</a>","<article>","</article>","<aside>","</aside>","<audio>","</audio>","<b>","</b>","<bdi>","</bdi>","<bdo>","<bdo dir=""ltr"">","<bdodir=""rtl"">","</bdo>","<big>","</big>","<blockquote>","</blockquote>","<body>","</body>","<br>","<br/>","<br/>","<button>","</button>","<caption>","</caption>","<center>","</center>","<cite>","</cite>","<code>","</code>","<col>","</col>","<colgroup>","</colgroup>","<command>","</command>","<datalist>","</datalist>","<dd>","</dd>","<del>","</del>","<div>","</div>","<dfn>","</dfn>","<dl>","</dl>","<dt>","</dt>","<em>","</em>","<fieldset>","</fieldset>","<figcaption>","</figcaption>","<figure>","</figure>","<footer>","</footer>","<form>","</form>","<frame>","</frame>","<h1>","</h1>","<h2>","</h2>","<h3>","</h3>","<h4>","</h4>","<h5>","</h5>","<h6>","</h6>","<head>","</head>","<hr>","<hr/>","<hr/>","<html>","</html>","<i>","</i>","<iframe>","</iframe>","<img>","</img>","<ins>","</ins>","<kbd>","</kbd>","<legend>","</legend>","<li>","</li>","<mark>","</mark>","<nav>","</nav>","<noframes>","</noframes>","<noscript>","</noscript>","<object>","</object>","<ol>","</ol>","<optgroup>","</optgroup>","<option>","</option>","<p>","</p>","<pre>","</pre>","<q>","</q>","<rp>","</rp>","<rt>","</rt>","<ruby>","</ruby>","<s>","</s>","<samp>","</samp>","<script>","</script>","<section>","</section>","<select>","</select>","<small>","</small>","<span>","</span>","<strike>","</strike>","<strong>","</strong>","<style>","</style>","<sub>","</sub>","<sup>","</sup>","<table>","</table>","<td>","</td>","<time>","</time>","<title>","</title>","<tr>","</tr>","<tt>","</tt>","<u>","</u>","<ul>","</ul>","<var>","</var>","<video>","</video>","<skip>","</skip>","<split>","</split>","<chapter>","<content>","</content>")
  87. FilterAuthor
  88. author = Inputbox("author:",,author)
  89. If IsEmpty(author) Then Wscript.quit
  90. If author<>EMPTY Then author2 = Inputbox("author2:",,author2)
  91. If IsEmpty(author2) Then Wscript.quit
  92. If dcdate<>EMPTY Then pubdate=dcdate&"T16:00:00+00:00"
  93. If uid=EMPTY Then uid=LCase(Mid(CreateObject("Scriptlet.TypeLib").GUID,2,36))
  94. If rtl="rtl" Then vrtl="vrtl"

  95. epubfiletitle=objFSO.GetBaseName(Input)
  96. tempmakingfolder=objFSO.GetSpecialFolder(2)&"\"&"tempmakingfolder"
  97. metainffolder=tempmakingfolder&"\"&"META-INF"
  98. oebpsfolder=tempmakingfolder&"\"&"OEBPS"
  99. textfolder=oebpsfolder&"\"&"Text"
  100. imagesfolder=oebpsfolder&"\"&"Images"
  101. stylesfolder=oebpsfolder&"\"&"Styles"
  102. fontsfolder=oebpsfolder&"\"&"Fonts"
  103. imgfolder=objFSO.GetParentFolderName(Input)&"\"&epubfiletitle
  104. fntfolder=objFSO.GetParentFolderName(Input)&"\"&"fonts"
  105. If not objFSO.FolderExists(imgfolder) Then imgfolder=objFSO.GetParentFolderName(Input)&"\"&"Images"
  106. If not objFSO.FolderExists(imgfolder) Then imgfolder=objFSO.GetParentFolderName(Input)&"\"&"image"
  107. If not objFSO.FolderExists(fntfolder) Then fntfolder=objFSO.GetParentFolderName(Input)&"\"&"font"

  108. If objFSO.FolderExists(tempmakingfolder) Then objFSO.DeleteFolder(tempmakingfolder)
  109. If not objFSO.FolderExists(tempmakingfolder) Then objFSO.createFolder(tempmakingfolder)
  110. objFSO.createFolder(metainffolder)
  111. objFSO.createFolder(oebpsfolder)
  112. objFSO.createFolder(textfolder)
  113. objFSO.createFolder(imagesfolder)
  114. objFSO.createFolder(stylesfolder)
  115. If txtbackup=1 Then
  116.   objFSO.createFolder(tempmakingfolder&"\"&"OEBPS"&"\"&"Backup")
  117.   objFSO.GetFile(Input).Copy(tempmakingfolder&"\"&"OEBPS"&"\"&"Backup"&"\"&"backup.txt")
  118. End If

  119. If objFSO.FolderExists(imgfolder) Then
  120.   For Each i in objFSO.GetFolder(imgfolder).files
  121.     ext=LCase(objFSO.GetExtensionName(i))
  122.     If ext="jpg" or ext="png" or ext="jpeg" or ext="webp" Then
  123.       imagecopycount=imagecopycount+1
  124.       i.attributes=0
  125.       objFSO.GetFile(i).Copy(imagesfolder&"\"&i.name)
  126.     End If
  127.   Next
  128.   If imagecopycount=EMPTY Then
  129.     Wscript.echo imagemissinginfo
  130.     Wscript.quit
  131.   End If
  132. Else
  133.   Wscript.echo imagemissinginfo
  134.   Wscript.quit
  135. End If

  136. If objFSO.FolderExists(fntfolder) Then
  137.   For Each i in objFSO.GetFolder(fntfolder).files
  138.     ext=LCase(objFSO.GetExtensionName(i))
  139.     bsn=LCase(objFSO.GetBaseName(i))
  140.     If ext="ttf" or ext="otf" Then
  141.       If bsn="footnote" Then footnotebsn=objFSO.GetBaseName(i)
  142.       If bsn<>"footnote" and htmlfontbsn=EMPTY Then htmlfontbsn=objFSO.GetBaseName(i)
  143.       If not objFSO.FolderExists(fontsfolder) Then objFSO.createFolder(fontsfolder)
  144.       i.attributes=0
  145.       objFSO.GetFile(i).Copy(fontsfolder&"\"&i.name)
  146.       fontcount=fontcount+1
  147.     End If
  148.   Next
  149.   If footnotebsn=EMPTY and htmlfontbsn<>EMPTY Then footnotebsn=htmlfontbsn
  150.   If htmlfontbsn<>EMPTY and duokanfontfixed=1 Then dcid="duokan-book-id"
  151. End If

  152. If not objFSO.FileExists(imagesfolder&"\"&"footnote.png") Then footnotetype="newline"
  153. For Each i in objFSO.GetFolder(imgfolder).files
  154.   imagecount=imagecount+1
  155.   coverext=LCase(objFSO.GetExtensionName(i))
  156.   If imagecount=1 Then coverimgfn=i.name
  157.   If LCase(objFSO.GetBaseName(i))="cover" Then coverimgfn=i.name
  158. Next
  159. covermtp=LCase(coverext)
  160. If covermtp="jpg" Then covermtp="jpeg"

  161. Set mimetype = objFSO.OpenTextFile(tempmakingfolder&"\"&"mimetype",2,1,0)
  162. mimetype.Write "application/epub+zip"
  163. mimetype.close
  164. Set containerxml = objFSO.OpenTextFile(metainffolder&"\"&"container.xml",2,1,0)
  165. containerxml.Write "<?xml version=""1.0"" encoding=""UTF-8""?>"&vblf&"<container version=""1.0"" xmlns=""urn:oasis:names:tc:opendocument:xmlns:container"">"&vblf&"    <rootfiles>"&vblf&"<rootfile full-path=""OEBPS/content.opf"" media-type=""application/oebps-package+xml""/>    </rootfiles>"&vblf&"</container>"&vblf&""
  166. containerxml.close
  167. Set contentopf = objFSO.OpenTextFile(oebpsfolder&"\"&"content.opf",2,1,-1)
  168. contentopf.WriteLine "<?xml version=""1.0""  encoding=""UTF-8""?>"
  169. contentopf.WriteLine "<package xmlns=""http://www.idpf.org/2007/opf"" version=""2.0"" unique-identifier="""&dcid&""">"
  170. contentopf.WriteLine "<metadata xmlns:dc=""http://purl.org/dc/elements/1.1/"" xmlns:opf=""http://www.idpf.org/2007/opf"">"
  171. contentopf.WriteLine "<meta name=""cover"" content=""cover-image""/>"
  172. contentopf.WriteLine "<meta name=""output encoding"" content=""utf-8""/>"
  173. contentopf.WriteLine "<dc:title>"&epubfiletitle&"</dc:title>"
  174. If author<>EMPTY Then contentopf.WriteLine "<dc:creator id=""creator01"">"&author&"</dc:creator>"
  175. If author2<>EMPTY Then contentopf.WriteLine "<dc:creator id=""creator02"">"&author2&"</dc:creator>"
  176. If language<>EMPTY Then contentopf.WriteLine "<dc:language>"&language&"</dc:language>"
  177. If publisher<>EMPTY Then contentopf.WriteLine "<dc:publisher>"&publisher&"</dc:publisher>"
  178. If pubdate<>EMPTY Then contentopf.WriteLine "<dc:date>"&pubdate&"</dc:date>"
  179. If uid<>EMPTY Then contentopf.WriteLine "<dc:identifier id="""&dcid&""">"&uid&"</dc:identifier>"
  180. contentopf.WriteLine "</metadata>"
  181. contentopf.WriteBlankLines(1)
  182. contentopf.WriteLine "<manifest>"
  183. contentopf.WriteLine space(4)&"<item id=""ncx"" media-type=""application/x-dtbncx+xml"" href=""toc.ncx""/>"
  184. contentopf.WriteLine space(4)&"<item id=""cover-image"" media-type=""image/"&covermtp&""" href=""Images/"&coverimgfn&"""/>"
  185. contentopf.WriteLine space(4)&"<item id=""style0001.css"" media-type=""text/css"" href=""Styles/style0001.css""/>"
  186. Set stylecss = objFSO.OpenTextFile(stylesfolder&"\"&"style0001.css",2,1,-1)
  187. stylecss.WriteLine "@charSet ""UTF-8"";"
  188. stylecss.WriteBlankLines(1)
  189. If fontcount>0 Then
  190.   For Each i in objFSO.GetFolder(fontsfolder).files
  191.     stylecss.WriteLine "@font-face {"
  192.     stylecss.WriteLine "  font-family: """&objFSO.GetBaseName(i)&""";"
  193.     stylecss.WriteLine "  src: url(../Fonts/"&i.name&");"
  194.     stylecss.WriteLine "}"
  195.     stylecss.WriteBlankLines(1)
  196.   Next
  197. End If
  198. stylecss.WriteLine "* { margin: 0; padding: 0; }"
  199. stylecss.WriteBlankLines(1)
  200. stylecss.WriteLine "img {"
  201. stylecss.WriteLine "  width:               100%;"
  202. stylecss.WriteLine "  height:              auto;"
  203. stylecss.WriteLine "  margin:              0;"
  204. stylecss.WriteLine "  padding:             0;"
  205. stylecss.WriteLine "  border:              none;"
  206. stylecss.WriteLine "  vertical-align:      baseline;"
  207. stylecss.WriteLine "  background:          transparent;"
  208. stylecss.WriteLine "}"
  209. stylecss.WriteBlankLines(1)
  210. stylecss.WriteLine "html,"
  211. stylecss.WriteLine ".hltr { writing-mode:         horizontal-tb; }"
  212. stylecss.WriteLine ".vrtl { writing-mode:         vertical-rl; }"
  213. stylecss.WriteBlankLines(1)
  214. stylecss.WriteLine "body {"
  215. stylecss.WriteLine "  font-size:          100%;"
  216. If htmlfontbsn<>EMPTY Then
  217.   stylecss.WriteLine "  font-family:        "&htmlfontbsn&";"
  218. End If
  219. stylecss.WriteLine "  vertical-align:     baseline;"
  220. stylecss.WriteLine "  line-height:        "&lineheight&";"
  221. stylecss.WriteLine "  text-indent:        "&textindent&";"
  222. stylecss.WriteLine "  background:         transparent;"
  223. stylecss.WriteBlankLines(1)
  224. stylecss.WriteLine "  word-spacing:       normal;"
  225. stylecss.WriteLine "  letter-spacing:     normal;"
  226. stylecss.WriteLine "  white-space:        normal;"
  227. stylecss.WriteLine "  word-wrap:          break-word;"
  228. stylecss.WriteBlankLines(1)
  229. stylecss.WriteLine "  line-break:         normal;"
  230. stylecss.WriteLine "  -epub-line-break:   normal;"
  231. stylecss.WriteBlankLines(1)
  232. stylecss.WriteLine "  word-break:         normal;"
  233. stylecss.WriteLine "  -epub-word-break:   normal;"
  234. stylecss.WriteBlankLines(1)
  235. stylecss.WriteLine "  hyphens:            auto;"
  236. stylecss.WriteLine "  -epub-hyphens:      auto;"
  237. stylecss.WriteBlankLines(1)
  238. stylecss.WriteLine "  font-weight:        normal;"
  239. stylecss.WriteBlankLines(1)
  240. stylecss.WriteLine "  margin-top:         "&margintop&";"
  241. stylecss.WriteLine "  margin-bottom:      "&marginbottom&";"
  242. stylecss.WriteLine "}"
  243. stylecss.WriteBlankLines(1)
  244. stylecss.WriteLine "p { margin-top: "&marginp&"; }"
  245. stylecss.WriteBlankLines(1)
  246. stylecss.WriteLine "a { text-decoration: none; }"
  247. stylecss.WriteBlankLines(1)
  248. stylecss.WriteLine ".font-1em30 { font-size: 1.3em; }"
  249. stylecss.WriteLine ".align-center { text-align: center; text-indent: 0; }"
  250. stylecss.WriteLine ".align-left { text-align: left; text-indent: 0; }"
  251. stylecss.WriteLine ".align-right { text-align: right; text-indent: 0; }"
  252. stylecss.WriteLine ".duokan-bleed { duokan-bleed: "&duokanbleed&"; }"
  253. stylecss.WriteBlankLines(1)
  254. stylecss.WriteLine ".footnote-img {"
  255. stylecss.WriteLine "  height:              "&footnoteimagesize&";"
  256. stylecss.WriteLine "  width:               auto;"
  257. stylecss.WriteLine "  margin-left:         0;"
  258. stylecss.WriteLine "  margin-right:        0;"
  259. stylecss.WriteLine "  margin-top:          0;"
  260. stylecss.WriteLine "  margin-bottom:       0;"
  261. stylecss.WriteLine "  padding:             0;"
  262. stylecss.WriteLine "  text-align:          left;"
  263. stylecss.WriteLine "  vertical-align:      top;"
  264. stylecss.WriteLine "}"
  265. stylecss.WriteBlankLines(1)
  266. stylecss.WriteLine ".footnote-text {"
  267. stylecss.WriteLine "  font-size:           "&footnotefontsize&";"
  268. If footnotebsn<>EMPTY Then
  269.   stylecss.WriteLine "  font-family:         "&footnotebsn&";"
  270. End If
  271. If footnotecolor<>EMPTY Then
  272.   stylecss.WriteLine "  color:               "&footnotecolor&";"
  273. End If
  274. stylecss.WriteLine "  margin-top:          0;"
  275. stylecss.WriteLine "  margin-bottom:       0;"
  276. stylecss.WriteLine "  padding:             0;"
  277. stylecss.WriteLine "  text-indent:         0;"
  278. stylecss.WriteLine "}"
  279. stylecss.WriteBlankLines(1)
  280. stylecss.WriteLine ".footnote-size {"
  281. stylecss.WriteLine "  font-size:           "&footnotefontsize&";"
  282. stylecss.WriteLine "}"
  283. stylecss.WriteBlankLines(1)
  284. stylecss.WriteLine ".footnote-color {"
  285. stylecss.WriteLine "  color:               "&footnotecolor&";"
  286. stylecss.WriteLine "}"
  287. stylecss.WriteBlankLines(1)
  288. stylecss.WriteLine ".border-dashed {"
  289. stylecss.WriteLine "  border:              1px dashed "&footnotecolor&";"
  290. stylecss.WriteLine "  border-radius:       5px;"
  291. stylecss.WriteLine "  padding:             1px 3px;"
  292. stylecss.WriteLine "}"
  293. stylecss.WriteBlankLines(1)
  294. stylecss.close
  295. Set tocncx = objFSO.OpenTextFile(oebpsfolder&"\"&"toc.ncx",2,1,-1)
  296. tocncx.WriteLine "<?xml version='1.0' encoding='utf-8'?>"
  297. tocncx.WriteLine "<ncx xmlns=""http://www.daisy.org/z3986/2005/ncx/"" version=""2005-1"" xml:lang="""&language&""">"
  298. tocncx.WriteLine "<head>"
  299. tocncx.WriteLine "<meta content="""&uid&""" name=""dtb:uid""/>"
  300. tocncx.WriteLine "<meta content=""2"" name=""dtb:depth""/>"
  301. tocncx.WriteLine "<meta content=""0"" name=""dtb:totalPageCount""/>"
  302. tocncx.WriteLine "<meta content=""0"" name=""dtb:maxPageNumber""/>"
  303. tocncx.WriteLine "</head>"
  304. tocncx.WriteLine "<docTitle>"
  305. tocncx.WriteLine space(2)&"<text>"&epubfiletitle&"</text>"
  306. tocncx.WriteLine "</docTitle>"
  307. tocncx.WriteLine "<navMap>"
  308. Set ptoc = objFSO.OpenTextFile(textfolder&"\"&"p-toc.xhtml",2,1,-1)
  309. ptoc.WriteLine "<?xml version=""1.0"" encoding=""UTF-8""?>"
  310. ptoc.WriteLine "<!DOCTYPE html>"
  311. ptoc.WriteLine "<html xmlns=""http://www.w3.org/1999/xhtml"" xmlns:epub=""http://www.idpf.org/2007/ops"" xml:lang="""&language&""" class="""&vrtl&""">"
  312. ptoc.WriteLine "<head>"
  313. ptoc.WriteLine "<meta charset=""UTF-8""/>"
  314. ptoc.WriteLine "<title>"&epubfiletitle&"</title>"
  315. ptoc.WriteLine "<link rel=""stylesheet"" type=""text/css"" href=""../Styles/style0001.css""/>"
  316. ptoc.WriteLine "</head>"
  317. ptoc.WriteLine "<body>"
  318. ptoc.WriteLine "<p class=""font-1em30 align-center""><a href=""cover.xhtml"">"&epubfiletitle&"</a></p>"
  319. ptoc.WriteLine "<br />"

  320. Dim ImgUsedArray
  321. ReDim ImgUsedArray(0)
  322. imgur=0
  323. ImgUsedArray(0)=coverimgfn
  324. Dim ImgMissingArray
  325. ReDim ImgMissingArray(0)
  326. imgnr=0
  327. ImgMissingArray(0)=coverimgfn

  328. epubcontentpreview=objFSO.GetSpecialFolder(2)&"\"&"epubcontentpreview.txt"
  329. Set pre = objFSO.OpenTextFile(epubcontentpreview,2,1,-1)
  330. Set fnp = objFSO.OpenTextFile(Input,1,0,-1)
  331. Do until fnp.AtEndOfStream
  332.   htline=fnp.ReadLine
  333.   htline=Trim(htline)
  334.   If htline=chapterbreak Then
  335.     chaptercount=chaptercount+1
  336.     If chaptercount>1 Then tocncx.WriteLine space(2)&"</navPoint>"
  337.     pch.WriteLine "</body></html>"
  338.     pch.close
  339.     htline=EMPTY
  340.     imgbw=EMPTY
  341.     imgbwch=EMPTY
  342.     splitbw=EMPTY
  343.     emptylinecount=0
  344.     linecountch=0
  345.     htlpn="p-ch"&Right("000"&chaptercount,3)&".xhtml"
  346.     htlpath=textfolder&"\"&htlpn
  347.     Set pch = objFSO.OpenTextFile(htlpath,2,1,-1)
  348.   End If

  349.   If chaptercount>0 Then
  350.     linecountch=linecountch+1
  351.     If linecountch=1 Then
  352.       Do while htline=EMPTY
  353.         htline=fnp.ReadLine
  354.         htline=Trim(htline)
  355.       Loop
  356.       imghtr4=LCase(Right(htline,4))
  357.       imghtr5=LCase(Right(htline,5))
  358.       If imghtr4=".jpg" or imghtr4=".png" or imghtr5=".jpeg" or imghtr5=".webp" Then
  359.         imgline=1
  360.         hta=htline
  361.         Do
  362.           htline=fnp.ReadLine
  363.           htline=Trim(htline)
  364.         Loop until htline<>EMPTY
  365.       End If
  366.       htmltitle=htline
  367.       htmltitle=ReplaceEsc(htmltitle)
  368.       htmlchapter=ReplaceRuby(htmltitle)
  369.       htmltitle=FilterRubyText(htmltitle)
  370.       htmltitle=FilterHtmlLabel(htmltitle)
  371.       htmltitle=FilterRubyText(htmltitle)
  372.       htmltitle=FilterFootnote(htmltitle)
  373.       pch.WriteLine "<?xml version=""1.0"" encoding=""UTF-8""?>"
  374.       pch.WriteLine "<!DOCTYPE html>"
  375.       pch.WriteLine "<html xmlns=""http://www.w3.org/1999/xhtml"" xmlns:epub=""http://www.idpf.org/2007/ops"" xml:lang="""&language&""" class="""&vrtl&""">"
  376.       pch.WriteLine "<head>"
  377.       pch.WriteLine "<meta charset=""UTF-8""/>"
  378.       pch.WriteLine "<title>"&htmltitle&"</title>"
  379.       pch.WriteLine "<link rel=""stylesheet"" type=""text/css"" href=""../Styles/style0001.css""/>"
  380.       pch.WriteLine "</head>"
  381.       pch.WriteLine "<body>"
  382.       If imgline=1 Then
  383.         hta=GetJpegName(hta)
  384.         imgtextpath=imgfolder&"\"&hta
  385.         If objFSO.FileExists(imgtextpath) Then
  386.           imgtextpathfn=objFSO.GetFile(imgtextpath).name
  387.           imgur=imgur+1
  388.           ReDim Preserve ImgUsedArray(imgur)
  389.           ImgUsedArray(imgur)=imgtextpathfn
  390.          Else
  391.           imgtextpathfn=hta
  392.           imgnr=imgnr+1
  393.           ReDim Preserve ImgMissingArray(imgnr)
  394.           ImgMissingArray(imgnr)=hta
  395.         End If
  396.         pch.WriteLine "<div class=""align-center duokan-image-single duokan-bleed""><img src=""../Images/"&imgtextpathfn&""" alt=""""/></div>"
  397.       End If
  398.       If Left(htmlchapter,6)<>"<skip>" Then
  399.         chaptertitle="<p class=""font-1em30 align-center"">"&htmlchapter&"</p>"
  400.         If rtl="rtl" Then
  401.           chaptertitle="<p class=""font-1em30"">"&htmlchapter&"</p>"
  402.         End If
  403.         ReplaceFootnote chaptertitle,honntai,bunshin
  404.         pch.WriteLine honntai
  405.         If bunshin<>EMPTY Then
  406.           pch.WriteLine bunshin
  407.         End If
  408.         honntai=EMPTY
  409.         bunshin=EMPTY
  410.       End If
  411.       tocnum=tocnum+1
  412.       tocncx.WriteLine space(2)&"<navPoint id=""np_"&tocnum&""" playOrder="""&tocnum&""">"
  413.       tocncx.WriteLine space(4)&"<navLabel>"
  414.       tocncx.WriteLine space(6)&"<text>"&htmltitle&"</text>"
  415.       tocncx.WriteLine space(4)&"</navLabel>"
  416.       tocncx.WriteLine space(4)&"<content src=""Text/"&htlpn&"""/>"
  417.       ptoc.WriteLine "<p class=""align-center""><a href="""&htlpn&""">"&htmltitle&"</a></p>"
  418.       pre.WriteLine htmltitle
  419.     End If
  420.     If linecountch>1 Then
  421.       hta=htline
  422.       If hta="<split>" Then hta=EMPTY
  423.       If hta=EMPTY and imgbwch<>1 and emptylineskip<>1 and splitbw<>1 Then
  424.         emptylinecount=emptylinecount+1
  425.       End If
  426.       If hta<>EMPTY Then
  427.         imghtr4=LCase(Right(hta,4))
  428.         imghtr5=LCase(Right(hta,5))
  429.         If imghtr4=".jpg" or imghtr4=".png" or imghtr5=".jpeg" or imghtr5=".webp" Then
  430.           imgline=1
  431.           imgbwch=1
  432.         End If
  433.         If imgline=1 Then
  434.           hta=GetJpegName(hta)
  435.           imgtextpath=imgfolder&"\"&hta
  436.           If objFSO.FileExists(imgtextpath) Then
  437.             imgtextpathfn=objFSO.GetFile(imgtextpath).name
  438.             imgur=imgur+1
  439.             ReDim Preserve ImgUsedArray(imgur)
  440.             ImgUsedArray(imgur)=imgtextpathfn
  441.            Else
  442.             imgtextpathfn=hta
  443.             imgnr=imgnr+1
  444.             ReDim Preserve ImgMissingArray(imgnr)
  445.             ImgMissingArray(imgnr)=hta
  446.           End If
  447.           pch.WriteLine "<div class=""align-center duokan-image-single duokan-bleed""><a name="""&imgtextpathfn&"""><img src=""../Images/"&imgtextpathfn&""" alt=""""/></a></div>"
  448.           If tocimgline=1 Then
  449.             tocimgcount=tocimgcount+1
  450.             tocnum=tocnum+1
  451.             tocncx.WriteLine space(6)&"<navPoint id=""np_"&tocnum&""" playOrder="""&tocnum&""">"
  452.             tocncx.WriteLine space(6)&"<navLabel>"
  453.             tocncx.WriteLine space(6)&"<text>"&tocimgname&""&tocimgcount&"</text>"
  454.             tocncx.WriteLine space(6)&"</navLabel>"
  455.             tocncx.WriteLine space(6)&"<content src=""Text/"&htlpn&"#"&imgtextpathfn&"""/>"
  456.             tocncx.WriteLine space(6)&"</navPoint>"
  457.             pre.WriteLine "  "&tocimgname&tocimgcount
  458.           End If
  459.         End If
  460.         If imgline<>1 Then
  461.           If imgbwch=EMPTY Then
  462.             If emptylinecount<>0 Then
  463.               For emc=1 To emptylinecount
  464.                 pch.WriteLine "<br />"
  465.               Next
  466.               emptylinecount=0
  467.             End If
  468.           End If
  469.           hta=ReplaceEsc(hta)
  470.           hta=ReplaceRuby(hta)
  471.           If CheckTagpSkip(hta)=EMPTY Then
  472.             If CheckSymbol(hta)=1 and symbolcenter=1 or IsNumeric(hta) and numbercenter=1 Then
  473.               ftn="<p class=""align-center"">"&hta&"</p>"
  474.              Else
  475.               ftn="<p>"&hta&"</p>"
  476.             End If
  477.            Else
  478.             ftn=hta
  479.           End If
  480.           ReplaceFootnote ftn,honntai,bunshin
  481.           pch.WriteLine honntai
  482.           If bunshin<>EMPTY Then
  483.             pch.WriteLine bunshin
  484.           End If
  485.           honntai=EMPTY
  486.           bunshin=EMPTY
  487.         End If
  488.       End If
  489.     End If
  490.   End If

  491.   If chaptercount=0 Then
  492.     linecountp=linecountp+1
  493.     If linecountp=1 Then
  494.       htlp=htlp+1
  495.       htmltitle=htline
  496.       htmltitle=ReplaceEsc(htmltitle)
  497.       htmlchapter=ReplaceRuby(htmltitle)
  498.       htmltitle=FilterRubyText(htmltitle)
  499.       htmltitle=FilterHtmlLabel(htmltitle)
  500.       htmltitle=FilterRubyText(htmltitle)
  501.       htmltitle=FilterFootnote(htmltitle)
  502.       htlpn="p-"&Right("000"&htlp,3)&".xhtml"
  503.       htlpath=textfolder&"\"&htlpn
  504.       Set pch = objFSO.OpenTextFile(htlpath,2,1,-1)
  505.       pch.WriteLine "<?xml version=""1.0"" encoding=""UTF-8""?>"
  506.       pch.WriteLine "<!DOCTYPE html>"
  507.       pch.WriteLine "<html xmlns=""http://www.w3.org/1999/xhtml"" xmlns:epub=""http://www.idpf.org/2007/ops"" xml:lang="""&language&""" class="""&vrtl&""">"
  508.       pch.WriteLine "<head>"
  509.       pch.WriteLine "<meta charset=""UTF-8""/>"
  510.       pch.WriteLine "<title>"&htmltitle&"</title>"
  511.       pch.WriteLine "<link rel=""stylesheet"" type=""text/css"" href=""../Styles/style0001.css""/>"
  512.       pch.WriteLine "</head>"
  513.       pch.WriteLine "<body>"
  514.       If Left(htmlchapter,6)<>"<skip>" Then
  515.         chaptertitle="<p class=""font-1em30 align-center"">"&htmlchapter&"</p>"
  516.         If rtl="rtl" Then
  517.           chaptertitle="<p class=""font-1em30"">"&htmlchapter&"</p>"
  518.         End If
  519.         ReplaceFootnote chaptertitle,honntai,bunshin
  520.         pch.WriteLine honntai
  521.         If bunshin<>EMPTY Then
  522.           pch.WriteLine bunshin
  523.         End If
  524.         honntai=EMPTY
  525.         bunshin=EMPTY
  526.       End If
  527.       tocnum=tocnum+1
  528.       tocncx.WriteLine space(2)&"<navPoint id=""np_"&tocnum&""" playOrder="""&tocnum&""">"
  529.       tocncx.WriteLine space(4)&"<navLabel>"
  530.       tocncx.WriteLine space(6)&"<text>"&covername&"</text>"
  531.       tocncx.WriteLine space(4)&"</navLabel>"
  532.       tocncx.WriteLine space(4)&"<content src=""Text/cover.xhtml""/>"
  533.       tocncx.WriteLine space(2)&"</navPoint>"
  534.       pre.WriteLine covername
  535.     End If
  536.     If linecountp>1 Then
  537.       hta=htline
  538.       If hta="<split>" Then
  539.         hta=EMPTY
  540.         splitbw=1
  541.         emptylinecount=0
  542.       End If
  543.       If imgbw=1 Then emptylinecount=0
  544.       If hta=EMPTY and imgbw<>1 and emptylineskip<>1 and splitbw<>1 Then
  545.         emptylinecount=emptylinecount+1
  546.       End If
  547.       If hta<>EMPTY Then
  548.         imghtr4=LCase(Right(hta,4))
  549.         imghtr5=LCase(Right(hta,5))
  550.         If imghtr4=".jpg" or imghtr4=".png" or imghtr5=".jpeg" or imghtr5=".webp" Then
  551.           imgline=1
  552.         End If
  553.         If imgline=1 Then
  554.           hta=GetJpegName(hta)
  555.           imgtextpath=imgfolder&"\"&hta
  556.           If objFSO.FileExists(imgtextpath) Then
  557.             imgtextpathfn=objFSO.GetFile(imgtextpath).name
  558.             imgur=imgur+1
  559.             ReDim Preserve ImgUsedArray(imgur)
  560.             ImgUsedArray(imgur)=imgtextpathfn
  561.            Else
  562.             imgtextpathfn=hta
  563.             imgnr=imgnr+1
  564.             ReDim Preserve ImgMissingArray(imgnr)
  565.             ImgMissingArray(imgnr)=hta
  566.           End If
  567.           pch.WriteLine "</body></html>"
  568.           pch.close
  569.           htlp=htlp+1
  570.           htlpn="p-"&Right("000"&htlp,3)&".xhtml"
  571.           htlpath=textfolder&"\"&htlpn
  572.           Set pch = objFSO.OpenTextFile(htlpath,2,1,-1)
  573.           colorpage=colorpage+1
  574.           If colorpage=1 Then
  575.             tocnum=tocnum+1
  576.             tocncx.WriteLine space(2)&"<navPoint id=""np_"&tocnum&""" playOrder="""&tocnum&""">"
  577.             tocncx.WriteLine space(4)&"<navLabel>"
  578.             tocncx.WriteLine space(6)&"<text>"&tocpagecolor&"</text>"
  579.             tocncx.WriteLine space(4)&"</navLabel>"
  580.             tocncx.WriteLine space(4)&"<content src=""Text/"&htlpn&"""/>"
  581.             tocncx.WriteLine space(2)&"</navPoint>"
  582.             ptoc.WriteLine "<p class=""align-center""><a href="""&htlpn&""">"&tocpagecolor&"</a></p>"
  583.             pre.WriteLine tocpagecolor
  584.           End If
  585.           pch.WriteLine "<?xml version=""1.0"" encoding=""UTF-8""?>"
  586.           pch.WriteLine "<!DOCTYPE html>"
  587.           pch.WriteLine "<html xmlns=""http://www.w3.org/1999/xhtml"" xmlns:epub=""http://www.idpf.org/2007/ops"" xml:lang="""&language&""" class="""&vrtl&""">"
  588.           pch.WriteLine "<head>"
  589.           pch.WriteLine "<meta charset=""UTF-8""/>"
  590.           pch.WriteLine "<title>"&tocpagecolor&"</title>"
  591.           pch.WriteLine "<link rel=""stylesheet"" type=""text/css"" href=""../Styles/style0001.css""/>"
  592.           pch.WriteLine "</head>"
  593.           pch.WriteLine "<body>"
  594.           pch.WriteLine "<div class=""align-center duokan-image-single duokan-bleed""><a name="""&imgtextpathfn&"""><img src=""../Images/"&htline&""" alt=""""/></a></div>"
  595.           imgbw=1
  596.         End If
  597.         If imgline<>1 Then
  598.           If CheckIntro(hta)=1 Then tocintro=1
  599.           If CheckInfo(hta)=1 Then tocinfo=1
  600.           If CheckAuthor(hta)=1 Then tocauthor=1
  601.           If Left(hta,9)="<content>" and Right(hta,10)="</content>" Then tocpage=1
  602.           hta=ReplaceEsc(hta)
  603.           hta=ReplaceRuby(hta)
  604.           If imgbw<>1 and splitbw<>1 Then
  605.             If emptylinecount<>0 Then
  606.               For emc=1 To emptylinecount
  607.                 pch.WriteLine "<br />"
  608.               Next
  609.               emptylinecount=0
  610.             End If
  611.             If CheckTagpSkip(hta)=EMPTY Then
  612.               If CheckSymbol(hta)=1 and symbolcenter=1 or IsNumeric(hta) and numbercenter=1 Then
  613.                 ftn="<p class=""align-center"">"&hta&"</p>"
  614.                Else
  615.                 ftn="<p>"&hta&"</p>"
  616.               End If
  617.              Else
  618.               ftn=hta
  619.             End If
  620.             ReplaceFootnote ftn,honntai,bunshin
  621.             pch.WriteLine honntai
  622.             If bunshin<>EMPTY Then
  623.               pch.WriteLine bunshin
  624.             End If
  625.             honntai=EMPTY
  626.             bunshin=EMPTY
  627.           End If
  628.           If imgbw=1 or splitbw=1 Then
  629.             imgbw=EMPTY
  630.             splitbw=EMPTY
  631.             pch.WriteLine "</body></html>"
  632.             pch.close
  633.             htlp=htlp+1
  634.             htlpn="p-"&Right("000"&htlp,3)&".xhtml"
  635.             htlpath=textfolder&"\"&htlpn
  636.             Set pch = objFSO.OpenTextFile(htlpath,2,1,-1)
  637.             pch.WriteLine "<?xml version=""1.0"" encoding=""UTF-8""?>"
  638.             pch.WriteLine "<!DOCTYPE html>"
  639.             pch.WriteLine "<html xmlns=""http://www.w3.org/1999/xhtml"" xmlns:epub=""http://www.idpf.org/2007/ops"" xml:lang="""&language&""" class="""&vrtl&""">"
  640.             pch.WriteLine "<head>"
  641.             pch.WriteLine "<meta charset=""UTF-8""/>"
  642.             pch.WriteLine "<title>"&htmltitle&"</title>"
  643.             pch.WriteLine "<link rel=""stylesheet"" type=""text/css"" href=""../Styles/style0001.css""/>"
  644.             pch.WriteLine "</head>"
  645.             pch.WriteLine "<body>"
  646.             If CheckTagpSkip(hta)<>1 Then
  647.               If CheckSymbol(hta)=1 and symbolcenter=1 or IsNumeric(hta) and numbercenter=1 Then
  648.                 ftn="<p class=""align-center"">"&hta&"</p>"
  649.                Else
  650.                 ftn="<p>"&hta&"</p>"
  651.               End If
  652.              Else
  653.               ftn=hta
  654.             End If
  655.             ReplaceFootnote ftn,honntai,bunshin
  656.             pch.WriteLine honntai
  657.             If bunshin<>EMPTY Then
  658.               pch.WriteLine bunshin
  659.             End If
  660.             honntai=EMPTY
  661.             bunshin=EMPTY
  662.           End If
  663.           If tocintro=1 and tocintrowr=EMPTY Then
  664.             tocintrowr=1
  665.             tocnum=tocnum+1
  666.             tocncx.WriteLine space(2)&"<navPoint id=""np_"&tocnum&""" playOrder="""&tocnum&""">"
  667.             tocncx.WriteLine space(4)&"<navLabel>"
  668.             tocncx.WriteLine space(6)&"<text>"&tocintroname&"</text>"
  669.             tocncx.WriteLine space(4)&"</navLabel>"
  670.             tocncx.WriteLine space(4)&"<content src=""Text/"&htlpn&"""/>"
  671.             tocncx.WriteLine space(2)&"</navPoint>"
  672.             ptoc.WriteLine "<p class=""align-center""><a href="""&htlpn&""">"&tocintroname&"</a></p>"
  673.             pre.WriteLine tocintroname
  674.           End If
  675.           If tocinfo=1 and tocinfowr=EMPTY Then
  676.             tocinfowr=1
  677.             tocnum=tocnum+1
  678.             tocncx.WriteLine space(2)&"<navPoint id=""np_"&tocnum&""" playOrder="""&tocnum&""">"
  679.             tocncx.WriteLine space(4)&"<navLabel>"
  680.             tocncx.WriteLine space(6)&"<text>"&tocmakeinfo&"</text>"
  681.             tocncx.WriteLine space(4)&"</navLabel>"
  682.             tocncx.WriteLine space(4)&"<content src=""Text/"&htlpn&"""/>"
  683.             tocncx.WriteLine space(2)&"</navPoint>"
  684.             ptoc.WriteLine "<p class=""align-center""><a href="""&htlpn&""">"&tocmakeinfo&"</a></p>"
  685.             pre.WriteLine tocmakeinfo
  686.           End If
  687.           If tocauthor=1 and tocauthwr=EMPTY Then
  688.             tocauthwr=1
  689.             tocnum=tocnum+1
  690.             tocncx.WriteLine space(2)&"<navPoint id=""np_"&tocnum&""" playOrder="""&tocnum&""">"
  691.             tocncx.WriteLine space(4)&"<navLabel>"
  692.             tocncx.WriteLine space(6)&"<text>"&tocauthname&"</text>"
  693.             tocncx.WriteLine space(4)&"</navLabel>"
  694.             tocncx.WriteLine space(4)&"<content src=""Text/"&htlpn&"""/>"
  695.             tocncx.WriteLine space(2)&"</navPoint>"
  696.             ptoc.WriteLine "<p class=""align-center""><a href="""&htlpn&""">"&tocauthname&"</a></p>"
  697.             pre.WriteLine tocauthname
  698.           End If
  699.           If tocpage=1 and tocpagewr=EMPTY Then
  700.             tocpagewr=1
  701.             tocnum=tocnum+1
  702.             contenthtmlfile=htlpn
  703.             tocncx.WriteLine space(2)&"<navPoint id=""np_"&tocnum&""" playOrder="""&tocnum&""">"
  704.             tocncx.WriteLine space(4)&"<navLabel>"
  705.             tocncx.WriteLine space(6)&"<text>"&toclistpage&"</text>"
  706.             tocncx.WriteLine space(4)&"</navLabel>"
  707.             tocncx.WriteLine space(4)&"<content src=""Text/"&htlpn&"""/>"
  708.             tocncx.WriteLine space(2)&"</navPoint>"
  709.             ptoc.WriteLine "<p class=""align-center""><a href="""&htlpn&""">"&toclistpage&"</a></p>"
  710.             pre.WriteLine toclistpage
  711.           End If
  712.         End If
  713.       End If
  714.     End If
  715.   End If
  716.   imgline=EMPTY
  717. Loop

  718. pch.WriteLine "</body></html>"
  719. pch.close
  720. fnp.close
  721. tocncx.WriteLine space(2)&"</navPoint>"
  722. If contenthtmlfile=EMPTY Then
  723.   tocnum=tocnum+1
  724.   tocncx.WriteLine space(2)&"<navPoint id=""np_"&tocnum&""" playOrder="""&tocnum&""">"
  725.   tocncx.WriteLine space(4)&"<navLabel>"
  726.   tocncx.WriteLine space(6)&"<text>"&toclistpage&"</text>"
  727.   tocncx.WriteLine space(4)&"</navLabel>"
  728.   tocncx.WriteLine space(4)&"<content src=""Text/p-toc.xhtml""/>"
  729.   tocncx.WriteLine space(2)&"</navPoint>"
  730.   ptoc.WriteLine "<p class=""align-center""><a href=""p-toc.xhtml"">"&toclistpage&"</a></p>"
  731.   pre.WriteLine toclistpage
  732. End If
  733. If imagepage=1 Then
  734.   tocnum=tocnum+1
  735.   tocncx.WriteLine space(2)&"<navPoint id=""np_"&tocnum&""" playOrder="""&tocnum&""">"
  736.   tocncx.WriteLine space(4)&"<navLabel>"
  737.   tocncx.WriteLine space(6)&"<text>"&tocimgpagename&"</text>"
  738.   tocncx.WriteLine space(4)&"</navLabel>"
  739.   tocncx.WriteLine space(4)&"<content src=""Text/t-img.xhtml""/>"
  740.   tocncx.WriteLine space(2)&"</navPoint>"
  741.   ptoc.WriteLine "<p class=""align-center""><a href=""t-img.xhtml"">"&tocimgpagename&"</a></p>"
  742.   pre.WriteLine tocimgpagename
  743. End If
  744. tocncx.WriteLine "</navMap>"
  745. tocncx.WriteLine "</ncx>"
  746. tocncx.close
  747. ptoc.WriteLine "</body></html>"
  748. ptoc.close
  749. If contenthtmlfile<>EMPTY Then
  750.   objFSO.DeleteFile(textfolder&"\"&contenthtmlfile)
  751.   objFSO.GetFile(textfolder&"\"&"p-toc.xhtml").name=contenthtmlfile
  752. End If
  753. pre.WriteBlankLines(1)
  754. pre.WriteLine "Image Not Used:"
  755. imgurc=0
  756. For Each ir in objFSO.GetFolder(imagesfolder).files
  757.   For iu=0 To UBound(ImgUsedArray)
  758.     If LCase(ir.name)=LCase(ImgUsedArray(iu)) Then
  759.       imu=1
  760.       Exit For
  761.      Else
  762.       imu=EMPTY
  763.     End If
  764.   Next
  765.   If imu=EMPTY Then
  766.     pre.WriteLine ir.name
  767.     imgurc=imgurc+1
  768.   End If
  769. Next
  770. If imgurc=0 Then pre.WriteLine "none"
  771. pre.WriteBlankLines(1)
  772. pre.WriteLine "Image Not Exists:"
  773. If UBound(ImgMissingArray)=0 Then
  774.   pre.WriteLine "none"
  775. Else
  776.   For i=1 To UBound(ImgMissingArray)
  777.     pre.WriteLine ImgMissingArray(i)
  778.   Next
  779. End If
  780. pre.WriteBlankLines(1)
  781. pre.WriteLine "Ruby-Count: "&rubycount
  782. pre.WriteLine "Ruby-Error: "&rubyerror
  783. pre.WriteLine "Footnote-Count: "&footnotecount
  784. pre.WriteLine "Footnote-Error: "&footnoteerror
  785. pre.close

  786. Set coverhtml = objFSO.OpenTextFile(textfolder&"\"&"cover.xhtml",2,1,-1)
  787. coverhtml.WriteLine "<?xml version=""1.0"" encoding=""UTF-8""?>"
  788. coverhtml.WriteLine "<!DOCTYPE html>"
  789. coverhtml.WriteLine "<html xmlns=""http://www.w3.org/1999/xhtml"" xmlns:epub=""http://www.idpf.org/2007/ops"" xml:lang="""&language&""" class="""&vrtl&""">"
  790. coverhtml.WriteLine "<head>"
  791. coverhtml.WriteLine "<meta charset=""UTF-8""/>"
  792. coverhtml.WriteLine "<title>封面</title>"
  793. coverhtml.WriteLine "<link rel=""stylesheet"" type=""text/css"" href=""../Styles/style0001.css""/>"
  794. coverhtml.WriteLine "</head>"
  795. coverhtml.WriteLine "<body>"
  796. coverhtml.WriteLine "<p class=""align-center""><img src=""../Images/"&coverimgfn&""" alt=""""/></p>"
  797. coverhtml.WriteLine "</body>"
  798. coverhtml.WriteLine "</html>"
  799. coverhtml.close
  800. If imagepage=1 Then
  801.   Set timg = objFSO.OpenTextFile(textfolder&"\"&"t-img.xhtml",2,1,-1)
  802.   timg.WriteLine "<?xml version=""1.0"" encoding=""UTF-8""?>"
  803.   timg.WriteLine "<!DOCTYPE html>"
  804.   timg.WriteLine "<html xmlns=""http://www.w3.org/1999/xhtml"" xmlns:epub=""http://www.idpf.org/2007/ops"" xml:lang="""&language&""" class="""&vrtl&""">"
  805.   timg.WriteLine "<head>"
  806.   timg.WriteLine "<meta charset=""UTF-8""/>"
  807.   timg.WriteLine "<title>"&tocimgpagename&"</title>"
  808.   timg.WriteLine "<link rel=""stylesheet"" type=""text/css"" href=""../Styles/style0001.css""/>"
  809.   timg.WriteLine "</head>"
  810.   timg.WriteLine "<body>"
  811.   For Each i in objFSO.GetFolder(imagesfolder).files
  812.     timg.WriteLine "<div class=""align-center duokan-image-single duokan-bleed""><img src=""../Images/"&i.name&""" alt=""""/></div>"
  813.   Next
  814.   timg.WriteLine "</body>"
  815.   timg.WriteLine "</html>"
  816.   timg.close
  817. End If
  818. For Each i in objFSO.GetFolder(imagesfolder).files
  819.   mtp=LCase(objFSO.GetExtensionName(i))
  820.   If mtp="jpg" Then mtp="jpeg"
  821.   contentopf.WriteLine space(4)&"<item id="""&i.name&""" media-type=""image/"&mtp&""" href=""Images/"&i.name&"""/>"
  822. Next
  823. If fontcount>0 Then
  824.   For Each i in objFSO.GetFolder(fontsfolder).files
  825.     mtp=LCase(objFSO.GetExtensionName(i))
  826.     contentopf.WriteLine space(4)&"<item id="""&i.name&""" media-type=""application/x-font-"&mtp&""" href=""Fonts/"&i.name&"""/>"
  827.   Next
  828. End If
  829. For Each i in objFSO.GetFolder(textfolder).files
  830.   contentopf.WriteLine space(4)&"<item id="""&i.name&""" media-type=""application/xhtml+xml"" href=""Text/"&i.name&"""/>"
  831. Next
  832. contentopf.WriteLine "</manifest>"
  833. contentopf.WriteBlankLines(1)
  834. contentopf.WriteLine "<spine page-progression-direction="""&rtl&""" toc=""ncx"">"
  835. For Each i in objFSO.GetFolder(textfolder).files
  836.   spinecount=spinecount+1
  837.   If spinecount=1 Then
  838.     contentopf.WriteLine space(4)&"<itemref idref="""&i.name&""" linear=""yes"" properties="""&duokancover&"""/>"
  839.    Else
  840.     contentopf.WriteLine space(4)&"<itemref idref="""&i.name&""" linear=""yes""/>"
  841.   End If
  842. Next
  843. contentopf.WriteLine "</spine>"
  844. contentopf.WriteBlankLines(1)
  845. contentopf.WriteLine "<guide>"
  846. contentopf.WriteLine "<reference type=""cover"" title=""Cover"" href=""cover.xhtml""/>"
  847. contentopf.WriteLine "</guide>"
  848. contentopf.WriteLine "</package>"
  849. contentopf.close

  850. Utf8Convert stylesfolder&"\"&"style0001.css"
  851. Utf8Convert oebpsfolder&"\"&"content.opf"
  852. Utf8Convert oebpsfolder&"\"&"toc.ncx"
  853. For Each i in objFSO.GetFolder(textfolder).files
  854.   Utf8Convert i.path
  855. Next

  856. Output=objFSO.GetParentFolderName(Input)&"\"&epubfiletitle&".zip"
  857. OutputEpub=objFSO.GetParentFolderName(Input)&"\"&epubfiletitle&".epub"
  858. If objFSO.FileExists(Output) Then
  859.   objFSO.GetFile(Output).attributes=0
  860.   objFSO.DeleteFile(Output)
  861. End If
  862. objFSO.CreateTextFile(Output,2).Write Chr(80)&Chr(75)&Chr(5)&Chr(6)&String(18,Chr(0))
  863. CreateObject("Shell.Application").NameSpace(Output).CopyHere tempmakingfolder&"\"&"mimetype"
  864. Wscript.sleep 100
  865. CreateObject("Shell.Application").NameSpace(Output).CopyHere metainffolder
  866. Wscript.sleep 100
  867. CreateObject("Shell.Application").NameSpace(Output).CopyHere oebpsfolder
  868. Wscript.sleep 1500
  869. If inputfiledelete=1 Then
  870.   objFSO.DeleteFile(Input)
  871.   If objFSO.FolderExists(imgfolder) Then objFSO.DeleteFolder(imgfolder)
  872.   If objFSO.FolderExists(fntfolder) Then objFSO.DeleteFolder(fntfolder)
  873. End If
  874. Wscript.echo "done"
  875. If objFSO.FileExists(OutputEpub) Then objFSO.DeleteFile(OutputEpub)
  876. objFSO.GetFile(Output).move(OutputEpub)
  877. objFSO.DeleteFolder(tempmakingfolder)
  878. WshShell.run epubcontentpreview,1,True
  879. objFSO.DeleteFile(epubcontentpreview)
  880. Wscript.quit

  881. Function CheckFootnote(a)
  882.   CheckFootnote=EMPTY
  883.   For kw=0 To UBound(arrfootnote)
  884.     If a=arrfootnote(kw) Then
  885.       CheckFootnote=1
  886.       Exit For
  887.     End If
  888.   Next
  889. End Function

  890. Function CheckIntro(a)
  891.   CheckIntro=EMPTY
  892.   For kw=0 To UBound(arrintro)
  893.     If a=arrintro(kw) Then
  894.       CheckIntro=1
  895.       Exit For
  896.     End If
  897.   Next
  898. End Function

  899. Function CheckAuthor(a)
  900.   CheckAuthor=EMPTY
  901.   For kw=0 To UBound(arrauthor)
  902.     If a=arrauthor(kw) Then
  903.       CheckAuthor=1
  904.       Exit For
  905.     End If
  906.   Next
  907. End Function

  908. Function CheckInfo(a)
  909.   CheckInfo=EMPTY
  910.   For kw=0 To UBound(arrinfo)
  911.     If a=arrinfo(kw) Then
  912.       CheckInfo=1
  913.       Exit For
  914.     End If
  915.   Next
  916. End Function

  917. Function CheckAut(a)
  918.   For kw=0 To UBound(arraut)
  919.     If Left(a,5)=arraut(kw) Then author=Trim(Mid(a,6))
  920.     If Left(a,4)=arraut(kw) Then author=Trim(Mid(a,5))
  921.     If Left(a,3)=arraut(kw) Then author=Trim(Mid(a,4))
  922.     If author<>EMPTY Then Exit For
  923.   Next
  924. End Function

  925. Function CheckGak(a)
  926.   For kw=0 To UBound(arrgak)
  927.     If Left(a,4)=arrgak(kw) Then author2=Trim(Mid(a,5))
  928.     If Left(a,3)=arrgak(kw) Then author2=Trim(Mid(a,4))
  929.     If author2<>EMPTY Then Exit For
  930.   Next
  931. End Function

  932. Function CheckLabel(a)
  933.   CheckLabel=EMPTY
  934.   For kw=0 To UBound(arrlabel)
  935.     If LCase(a)=arrlabel(kw) Then
  936.       CheckLabel=1
  937.       Exit For
  938.     End If
  939.   Next
  940. End Function

  941. Function CheckSymbol(a)
  942.   CheckSymbol=EMPTY
  943.   For cls=1 To Len(a)
  944.     For kw=0 To UBound(arrsymbol)
  945.       If Mid(a,cls,1)=arrsymbol(kw) Then
  946.         SymbolStat=1
  947.         Exit For
  948.        Else
  949.         SymbolStat=EMPTY
  950.       End If
  951.     Next
  952.     If SymbolStat=EMPTY Then
  953.       Exit For
  954.     End If
  955.   Next
  956.   If SymbolStat=1 Then CheckSymbol=1
  957. End Function

  958. Function ReplaceEsc(a)
  959.   Do
  960.     a1=InStr(a,"<")
  961.     a2=0
  962.     If a1>0 Then
  963.       b=b&Left(a,a1-1)
  964.       a=Right(a,Len(a)-a1+1)
  965.       a2=InStr(a,">")
  966.       If a2>0 Then
  967.         ab=Left(a,a2)
  968.         a=Right(a,Len(a)-a2)
  969.         abtrim=Mid(ab,2,Len(ab)-2)
  970.         If CheckLabel(ab)=EMPTY Then
  971.           If Left(ab,4)<>"<img" and Left(ab,5)<>"<span" and Left(ab,6)<>"<audio" and Left(ab,6)<>"video" and Left(ab,7)<>"<source" Then
  972.             ab="&lt;"&abtrim&"&gt;"
  973.           End If
  974.         End If
  975.       End If
  976.     End If
  977.     b=b&ab
  978.     ab=EMPTY
  979.     abtrim=EMPTY
  980.   Loop while a2>0
  981.   b=b&a
  982.   ReplaceEsc=b
  983. End Function

  984. Function Utf8Convert(UnicodeFile)
  985.   objAdodbStream.Charset="Unicode"
  986.   objAdodbStream.Open
  987.   objAdodbStream.LoadFromFile UnicodeFile
  988.   OutputText = objAdodbStream.ReadText
  989.   objAdodbStream.Close
  990.   objAdodbStream.Charset="Utf-8"
  991.   objAdodbStream.Open
  992.   objAdodbStream.WriteText OutputText
  993.   objAdodbStream.SaveToFile UnicodeFile,2
  994.   objAdodbStream.Close
  995. End Function

  996. Function ReplaceRuby(a)
  997.   Do
  998.     a1=InStr(a,rubya)
  999.     If a1>0 Then
  1000.       b=Right(a,Len(a)-a1)
  1001.       a=Left(a,a1-1)
  1002.       b1=InStr(b,rubyb)
  1003.       b2=InStr(b,rubya)
  1004.       If b1>0 Then
  1005.         c=Right(b,Len(b)-b1)
  1006.         b=Left(b,b1-1)
  1007.         c1=InStr(c,rubyc)
  1008.         If c1=0 Then
  1009.           rubyerror=rubyerror+1
  1010.         End If
  1011.         If c1>0 Then
  1012.           d=Right(c,Len(c)-c1)
  1013.           c=Left(c,c1-1)
  1014.           If b=EMPTY or c=EMPTY Then
  1015.             rubyerror=rubyerror+1
  1016.           End If
  1017.         End If
  1018.       End If
  1019.     End If
  1020.     rubyint="<ruby>"
  1021.     rubymid="<rt>"
  1022.     rubyend="</rt></ruby>"
  1023.     If b<>EMPTY and c<>EMPTY Then
  1024.       rubystr=1
  1025.       rubycount=rubycount+1
  1026.       rubyinlinestr=rubyint&b&rubymid&c&rubyend
  1027.       rubyspanstr="<span id=""ruby"&rubycount&""">"&rubyinlinestr&"</span>"
  1028.       a=a&rubyspanstr&d
  1029.       b3=InStr(c,rubya)
  1030.       b4=InStr(c,rubyb)
  1031.       b5=InStr(b,rubya)
  1032.       b6=InStr(b,rubyc)
  1033.       If b3>0 or b4>0 or b5>0 or b6>0 Then
  1034.         rubyerror=rubyerror+1
  1035.       End If
  1036.       If b1>0 and b2>0 Then
  1037.         If b1>b2 Then
  1038.           rubyerror=rubyerror+1
  1039.         End If
  1040.       End If
  1041.       If rubystr=1 and rubytablestat=1 Then
  1042.         rubytablehtmlfn=rubyhref
  1043.         rubyhrefstr="<a href="""&rubytablehtmlfn&"#ruby"&rubycount&""">"&rubyinlinestr&"</a>"
  1044.         rubytexthtmlstr=rubytexthtmlstr&" "&rubyhrefstr
  1045.         If rubycount=1 Then
  1046.           rubytexthtmlstr=rubyhrefstr
  1047.         End If
  1048.         rubyhrefstr=EMPTY
  1049.         rubytablehtmlfn=EMPTY
  1050.       End If
  1051.      Else
  1052.       a=a&b&c&d
  1053.       rubystr=EMPTY
  1054.     End If
  1055.     a1=EMPTY
  1056.     b1=EMPTY
  1057.     c1=EMPTY
  1058.     b=EMPTY
  1059.     c=EMPTY
  1060.     d=EMPTY
  1061.     b2=EMPTY
  1062.     b3=EMPTY
  1063.     b4=EMPTY
  1064.     b5=EMPTY
  1065.     b6=EMPTY
  1066.   Loop while rubystr=1
  1067.   ReplaceRuby=a
  1068. End Function

  1069. Function FilterRubyLabel(a)
  1070.   Do
  1071.     rubyfilter=EMPTY
  1072.     For i=1 To Len(a)-5
  1073.       If LCase(Mid(a,i,6))="<ruby>" Then
  1074.         b=Right(a,Len(a)-i+1)
  1075.         a=Left(a,i-1)
  1076.         b1=Right(b,Len(b)-6)
  1077.         b2=Instr(b1,"<")
  1078.         If b2>0 Then
  1079.           b3=Left(b1,b2-1)
  1080.           For r=1 To Len(b)-6
  1081.             If LCase(Mid(b,r,7))="</ruby>" Then
  1082.               c=Right(b,Len(b)-r-6)
  1083.               b=Left(b,r-1)
  1084.               rubyfilter=1
  1085.               Exit For
  1086.             End If
  1087.           Next
  1088.         End If
  1089.       End If
  1090.       If rubyfilter=1 Then
  1091.         Exit For
  1092.       End If
  1093.     Next
  1094.     If rubyfilter=1 Then
  1095.       a=a&b3&c
  1096.      Else
  1097.       a=a&b
  1098.     End If
  1099.     b=EMPTY
  1100.     c=EMPTY
  1101.   Loop while rubyfilter=1
  1102.   FilterRubyLabel=a
  1103. End Function

  1104. Function FilterHtmlLabel(a)
  1105.   Do
  1106.     a1=InStr(a,"<")
  1107.     a2=0
  1108.     If a1>0 Then
  1109.       b=b&Left(a,a1-1)
  1110.       a=Right(a,Len(a)-a1+1)
  1111.       a2=InStr(a,">")
  1112.       If a2>0 Then
  1113.         ab=Left(a,a2)
  1114.         a=Right(a,Len(a)-a2)
  1115.         If CheckLabel(ab)=1 Then
  1116.           ab=EMPTY
  1117.         End If
  1118.       End If
  1119.     End If
  1120.     b=b&ab
  1121.     ab=EMPTY
  1122.   Loop while a2>0
  1123.   b=b&a
  1124.   FilterHtmlLabel=b
  1125. End Function

  1126. Function FilterRubyText(a)
  1127.   Do
  1128.     rubytext=EMPTY
  1129.     efa=a
  1130.     For i=1 To Len(a)
  1131.       If Mid(a,i,1)=rubya Then
  1132.         b=Right(a,Len(a)-i)
  1133.         efb=Right(a,Len(a)-i+1)
  1134.         efa=Left(a,i-1)
  1135.         For r=1 To Len(b)
  1136.           If Mid(b,r,1)=rubyb Then
  1137.             c=Right(b,Len(b)-r)
  1138.             For w=1 To Len(c)
  1139.               If Mid(c,w,1)=rubyc Then
  1140.                 efd=Right(c,Len(c)-w)
  1141.                 efc=Left(c,w-1)
  1142.                 efb=Left(b,r-1)
  1143.                 rubytext=1
  1144.                 Exit For
  1145.               End If
  1146.             Next
  1147.           End If
  1148.           If rubytext=1 Then
  1149.             Exit For
  1150.           End If
  1151.         Next
  1152.       End If
  1153.       If rubytext=1 Then
  1154.         Exit For
  1155.       End If
  1156.     Next
  1157.     a=efa&efb&efd
  1158.     efa=EMPTY
  1159.     efb=EMPTY
  1160.     efc=EMPTY
  1161.     efd=EMPTY
  1162.   Loop while rubytext=1
  1163.   FilterRubyText=a
  1164. End Function

  1165. Function CheckTagpSkip(a)
  1166.   If a="<br/>" or a="<br />" or Left(a,4)="<hr " or Left(a,3)="<p>" or Left(a,3)="<p " or Left(a,4)="<div" Then
  1167.     CheckTagpSkip=1
  1168.   End If
  1169. End Function

  1170. Function ReplaceFootnote(a,HonnTaiLine,BunShinLine)
  1171.   Do
  1172.     footnotestr=EMPTY
  1173.     For i=1 To Len(a)-2
  1174.       b=Mid(a,i,3)
  1175.       a1=Mid(a,1,i-1)
  1176.       a2=Mid(a,i)
  1177.       b1=Left(b,1)
  1178.       b2=Mid(b,2,1)
  1179.       b3=Right(b,1)
  1180.       If b1="(" or b1="(" Then
  1181.         If CheckFootnote(b2)=1 Then
  1182.           If b3=":" or b3=":" or b3="︰" Then
  1183.             footnotestat=1
  1184.             footnotestrlen=1
  1185.           End If
  1186.         End If
  1187.       End If

  1188.       If footnotestat=EMPTY Then
  1189.         b=Mid(a,i,4)
  1190.         a1=Mid(a,1,i-1)
  1191.         a2=Mid(a,i)
  1192.         b1=Left(b,1)
  1193.         b2=Mid(b,2,2)
  1194.         b3=Right(b,1)
  1195.         If b1="(" or b1="(" Then
  1196.           If CheckFootnote(b2)=1 Then
  1197.             If b3=":" or b3=":" or b3="︰" Then
  1198.               footnotestat=1
  1199.               footnotestrlen=2
  1200.             End If
  1201.           End If
  1202.         End If
  1203.       End If

  1204.       If footnotestat=EMPTY Then
  1205.         b=Mid(a,i,5)
  1206.         a1=Mid(a,1,i-1)
  1207.         a2=Mid(a,i)
  1208.         b1=Left(b,1)
  1209.         b2=Mid(b,2,3)
  1210.         b3=Right(b,1)
  1211.         If b1="(" or b1="(" Then
  1212.           If CheckFootnote(b2)=1 Then
  1213.             If b3=":" or b3=":" or b3="︰" Then
  1214.               footnotestat=1
  1215.               footnotestrlen=3
  1216.             End If
  1217.           End If
  1218.         End If
  1219.       End If

  1220.       If footnotestat=1 Then
  1221.         If b1="(" Then be1=")"
  1222.         If b1="(" Then be1=")"
  1223.         be=Instr(a2,be1)
  1224.         a3=Mid(a2,2)
  1225.         be2=Instr(a3,b1)
  1226.         If be>0 and be2>0 Then
  1227.           If be>be2 Then
  1228.             footnoteerror=footnoteerror+1
  1229.           End If
  1230.         End If
  1231.         If be=0 Then
  1232.           footnoteerror=footnoteerror+1
  1233.         End If
  1234.         If be>0 Then
  1235.           If footnotestrlen=1 Then
  1236.             c=Mid(a,i+be)
  1237.             d=Mid(a,i+1,be-2)
  1238.           End If
  1239.           If footnotestrlen=2 Then
  1240.             c=Mid(a,i+be)
  1241.             d=Mid(a,i+1,be-2)
  1242.           End If
  1243.           If footnotestrlen=3 Then
  1244.             c=Mid(a,i+be)
  1245.             d=Mid(a,i+1,be-2)
  1246.           End If
  1247.           footnotestr=1
  1248.           footnotecount=footnotecount+1
  1249.           footnotestatd=footnotestatd+1
  1250.         End If
  1251.       End If

  1252.       If footnotestr=1 Then
  1253.         If footnotetype="duokan" Then
  1254.           bn="<a class=""duokan-footnote"" href=""#duokanfootnote"&footnotecount&"""><img class=""footnote-img"" src=""../Images/footnote.png""/></a>"
  1255.           a=a1&bn&c
  1256.           If footnotestatd=1 Then
  1257.             d="<ol class=""duokan-footnote-content"">"&vbcrlf&"<li class=""duokan-footnote-item"" id=""duokanfootnote"&footnotecount&"""><p class=""footnote-text"">"&d&"</p></li>"
  1258.            Else
  1259.             d="<li class=""duokan-footnote-item"" id=""duokanfootnote"&footnotecount&"""><p class=""footnote-text"">"&d&"</p></li>"
  1260.           End If
  1261.           e=e&d&vbcrlf
  1262.         End If
  1263.         If footnotetype="newline" Then
  1264.           bn="<img class=""footnote-img"" src=""../Images/footnote.png"" id=""footnote"&footnotecount&"""/>"
  1265.           a=a1&bn&c
  1266.           d="<div class=""footnote-text align-left border-dashed-color"">"&d&"</div>"
  1267.           e=e&d&vbcrlf
  1268.         End If
  1269.       End If

  1270.       a1=EMPTY
  1271.       a2=EMPTY
  1272.       a3=EMPTY
  1273.       b=EMPTY
  1274.       b1=EMPTY
  1275.       b2=EMPTY
  1276.       b3=EMPTY
  1277.       be=EMPTY
  1278.       be1=EMPTY
  1279.       be2=EMPTY
  1280.       c=EMPTY
  1281.       d=EMPTY
  1282.       bn=EMPTY
  1283.       footnotestat=EMPTY
  1284.       footnotestrlen=EMPTY
  1285.       If footnotestr=1 Then
  1286.         Exit For
  1287.       End If
  1288.     Next
  1289.   Loop while footnotestr=1
  1290.   If footnotetype="duokan" Then
  1291.     If footnotestatd>0 Then
  1292.       e=e&"</ol>"
  1293.     End If
  1294.   End If
  1295.   HonnTaiLine=a
  1296.   BunShinLine=e
  1297. End Function

  1298. Function FilterFootnote(a)
  1299.   Do
  1300.     footnotestr=EMPTY
  1301.     For i=1 To Len(a)-2
  1302.       b=Mid(a,i,3)
  1303.       a1=Mid(a,1,i-1)
  1304.       a2=Mid(a,i)
  1305.       b1=Left(b,1)
  1306.       b2=Mid(b,2,1)
  1307.       b3=Right(b,1)
  1308.       If b1="(" or b1="(" Then
  1309.         If CheckFootnote(b2)=1 Then
  1310.           If b3=":" or b3=":" or b3="︰" Then
  1311.             footnotestat=1
  1312.             footnotestrlen=1
  1313.           End If
  1314.         End If
  1315.       End If

  1316.       If footnotestat=EMPTY Then
  1317.         b=Mid(a,i,4)
  1318.         a1=Mid(a,1,i-1)
  1319.         a2=Mid(a,i)
  1320.         b1=Left(b,1)
  1321.         b2=Mid(b,2,2)
  1322.         b3=Right(b,1)
  1323.         If b1="(" or b1="(" Then
  1324.           If CheckFootnote(b2)=1 Then
  1325.             If b3=":" or b3=":" or b3="︰" Then
  1326.               footnotestat=1
  1327.               footnotestrlen=2
  1328.             End If
  1329.           End If
  1330.         End If
  1331.       End If

  1332.       If footnotestat=EMPTY Then
  1333.         b=Mid(a,i,5)
  1334.         a1=Mid(a,1,i-1)
  1335.         a2=Mid(a,i)
  1336.         b1=Left(b,1)
  1337.         b2=Mid(b,2,3)
  1338.         b3=Right(b,1)
  1339.         If b1="(" or b1="(" Then
  1340.           If CheckFootnote(b2)=1 Then
  1341.             If b3=":" or b3=":" or b3="︰" Then
  1342.               footnotestat=1
  1343.               footnotestrlen=3
  1344.             End If
  1345.           End If
  1346.         End If
  1347.       End If

  1348.       If footnotestat=1 Then
  1349.         If b1="(" Then be1=")"
  1350.         If b1="(" Then be1=")"
  1351.         be=Instr(a2,be1)
  1352.         If be>0 Then
  1353.           c=Mid(a,i+be)
  1354.           a=a1&c
  1355.           footnotestr=1
  1356.         End If
  1357.       End If
  1358.       a1=EMPTY
  1359.       a2=EMPTY
  1360.       b=EMPTY
  1361.       b1=EMPTY
  1362.       b2=EMPTY
  1363.       b3=EMPTY
  1364.       be=EMPTY
  1365.       be1=EMPTY
  1366.       c=EMPTY
  1367.       footnotestat=EMPTY
  1368.       footnotestrlen=EMPTY
  1369.       If footnotestr=1 Then
  1370.         Exit For
  1371.       End If
  1372.     Next
  1373.   Loop while footnotestr=1
  1374.   FilterFootnote=a
  1375. End Function

  1376. Function GetJpegName(a)
  1377.   GetJpegName=a
  1378.   bsn=objFSO.GetBaseName(a)
  1379.   ext=LCase(objFSO.GetExtensionName(a))
  1380.   If ext="jpg" or ext="jpeg" Then
  1381.     If objFSO.FileExists(imagesfolder&"\"&bsn&".jpg") Then GetJpegName=objFSO.GetFile(imagesfolder&"\"&bsn&".jpg").name
  1382.     If objFSO.FileExists(imagesfolder&"\"&bsn&".jpeg") Then GetJpegName=objFSO.GetFile(imagesfolder&"\"&bsn&".jpeg").name
  1383.   End If
  1384. End Function

  1385. Function FilterAuthor()
  1386.   Set autread = objFSO.OpenTextFile(Input,1,0,-1)
  1387.   Do until autread.AtEndOfStream
  1388.     autline=Trim(autread.ReadLine)
  1389.     If author=EMPTY and autline<>EMPTY Then CheckAut(autline)
  1390.     If author2=EMPTY and autline<>EMPTY Then CheckGak(autline)
  1391.     If autline=chapterbreak Then Exit Do
  1392.     If author<>EMPTY and author2<>EMPTY Then Exit Do
  1393.   Loop
  1394.   autread.Close
  1395. End Function
复制代码


实际效果:http://ritdon.com/forum.php?mod=viewthread&tid=10011
(txt备份版的epub文件内有用来转换的txt文件,可以对照格式)
这个脚本的打包方式是先创建一个空zip文件,然后把图片及网页文件复制进去,再修改后缀名为epub,用压缩软件打开即可

相当简单的脚本,不保证效果,可能有未知的Bug,请谨慎运行





评分

参与人数 1金币 +10 收起 理由
rdo2pr + 10 好长

查看全部评分

回复

使用道具 举报

28

主题

106

帖子

3220

积分

吃书妖怪

Rank: 5Rank: 5Rank: 5

积分
3220
贡献
3220
金币
3692
 楼主| 发表于 2022-5-26 20:55:41 | 显示全部楼层
本帖最后由 hoebec 于 2022-5-26 23:56 编辑

预处理脚本

运行方式:
双击运行vbs,拖放txt文件,ENTER,得到文件名加"-r"的新txt文件,并显示统计情况

使用效果:
匹配论坛下载的txt文件,自动读取章节目录,在章节名前加标识,转化图片行,预览注释行

  1. set WshShell = CreateObject("Wscript.Shell")
  2. set objFSO = CreateObject("scripting.filesystemobject")
  3. scriptloadtempbat=objFSO.GetSpecialFolder(2)&"\"&"scriptloadtemp.bat"
  4. If Wscript.arguments.count=0 Then
  5.   WshShell.run "cmd /c echo @echo off>"&scriptloadtempbat&"",0,True
  6.   WshShell.run "cmd /c echo setlocal enabledelayedexpansion>>"&scriptloadtempbat&"",0,True
  7.   WshShell.run "cmd /c echo :input>>"&scriptloadtempbat&"",0,True
  8.   WshShell.run "cmd /c echo Set /p ""input=input txt:"">>"&scriptloadtempbat&"",0,True
  9.   WshShell.run "cmd /c echo if not defined input goto input>>"&scriptloadtempbat&"",0,True
  10.   WshShell.run "cmd /c echo start """" """&Wscript.ScriptFullName&""" !input!>>"&scriptloadtempbat&"",0,True
  11.   WshShell.run("cmd /c "&scriptloadtempbat&"")
  12.   Wscript.quit
  13. End If
  14. If Wscript.arguments.count=1 Then objFSO.DeleteFile(scriptloadtempbat)
  15. If Wscript.arguments.count=1 Then Input=Wscript.arguments(0)
  16. If not objFSO.FileExists(Input) Then Wscript.quit

  17. rubya="|"
  18. rubyb="《"
  19. rubyc="》"
  20. rubycount=0
  21. rubyerror=0
  22. footnotecount=0
  23. footnoteerror=0
  24. chapterbreak="<chapter>"
  25. imagemissinginfo="找不到图片文件!?"
  26. chaptererrorinfo="章节列表过长!?"
  27. imagefilter=0
  28. imagemissing=0
  29. contentread=0
  30. contentend=0
  31. contentcount=0
  32. contentmaxline=100
  33. spliterror=0
  34. symbolcentercount=0
  35. numbercentercount=0
  36. contentidlecount=0
  37. imagecopycount=0
  38. imageusedcount=0
  39. imageidlecount=0
  40. footnoteline=EMPTY
  41. footnoteerrorline=EMPTY
  42. rubyerrorline=EMPTY

  43. epubfiletitle=objFSO.GetBaseName(Input)
  44. Output=objFSO.GetParentFolderName(Input)&"\"&epubfiletitle&"-new.txt"
  45. imgfolder=objFSO.GetParentFolderName(Input)&"\"&epubfiletitle
  46. If not objFSO.FolderExists(imgfolder) Then imgfolder=objFSO.GetParentFolderName(Input)&"\"&"Images"
  47. If not objFSO.FolderExists(imgfolder) Then imgfolder=objFSO.GetParentFolderName(Input)&"\"&"image"
  48. If objFSO.FolderExists(imgfolder) Then
  49.   For Each i in objFSO.GetFolder(imgfolder).files
  50.     ext=LCase(objFSO.GetExtensionName(i))
  51.     If ext="jpg" or ext="png" or ext="jpeg" or ext="webp" Then
  52.       imagecopycount=imagecopycount+1
  53.     End If
  54.   Next
  55.   If imagecopycount=0 Then
  56.     Wscript.echo imagemissinginfo
  57.     Wscript.quit
  58.   End If
  59. Else
  60.   Wscript.echo imagemissinginfo
  61.   Wscript.quit
  62. End If

  63. arrsymbol=Array("†","*","﹡","*","§","※","◆","◇","■","□","♣","♧","★","☆"," "," ","+","▪","▫","▲","△","▼","▽","●","○","◌","♡","♥","❤","■","○","×")
  64. arrfootnote=Array("注","註","译注","编注","录注","校注","譯注","編注","錄注","译註","编註","录註","校註","譯註","編註","錄註","译者注","翻译注","编者注","编辑注","录入注","校对注","譯者注","翻譯注","編者注","編輯注","錄入注","校對注","译者註","翻译註","编者註","编辑註","录入註","校对註","譯者註","翻譯註","編者註","編輯註","錄入註","校對註")
  65. arrcontent=Array("contents","content","contents","content","目录","目錄","目次","目 录","目 錄","目 次","目 录","目 錄","目 次","table of contents","table of content","table of contents","table of content","table of contents","table of content","table of contents","table of content")
  66. arrimage=Array("插图","(插图","(插图","插圖","(插圖","(插圖","[RitImg]")

  67. Dim ContentReadArray
  68. ReDim ContentReadArray(0)
  69. ContentReadArray(0)=EMPTY
  70. Dim ContentUsedArray
  71. ReDim ContentUsedArray(0)
  72. ContentUsedArray(0)=EMPTY
  73. Dim ImgUsedArray
  74. ReDim ImgUsedArray(0)
  75. ImgUsedArray(0)=EMPTY

  76. epubcontentpreview=objFSO.GetSpecialFolder(2)&"\"&"epubcontentpreview.txt"
  77. Set pre = objFSO.OpenTextFile(epubcontentpreview,2,1,-1)
  78. Set fnp = objFSO.OpenTextFile(Input,1,0,-1)
  79. Set fop = objFSO.OpenTextFile(Output,2,1,-1)
  80. Do until fnp.AtEndOfStream
  81.   htline=fnp.ReadLine
  82.   hta=Trim(htline)
  83.   If hta=EMPTY Then
  84.     fop.WriteLine htline
  85.   End If
  86.   If chapterlinebw=1 and hta<>EMPTY Then fop.WriteBlankLines(1)
  87.   chapterlinebw=EMPTY
  88.   If hta<>EMPTY Then
  89.     hta=FilterImage(hta)
  90.     prehta=Left(htline,Len(htline)-Len(RTrim(htline)))
  91.     If imagefilter=1 Then
  92.       For Each i in objFSO.GetFolder(imgfolder).files
  93.         If LCase(objFSO.GetBaseName(i))=LCase(hta) Then
  94.           hta=i.name
  95.           imgline=1
  96.           imageusedcount=imageusedcount+1
  97.           ReDim Preserve ImgUsedArray(imageusedcount)
  98.           ImgUsedArray(imageusedcount)=hta
  99.           Exit For
  100.          Else
  101.           imgline=0
  102.         End If
  103.       Next
  104.       If imgline=0 Then
  105.         hta=Trim(htline)
  106.         imagemissing=imagemissing+1
  107.         imgmisline=imgmisline&vbcrlf&hta
  108.       End If
  109.       fop.WriteLine prehta&hta
  110.       imgbw=1
  111.     End If
  112.     If imagefilter<>1 Then
  113.       If contentcount>0 Then
  114.         For ce=1 To UBound(ContentReadArray)
  115.           If LCase(hta)=LCase(ContentReadArray(ce)) Then
  116.             contentend=1
  117.             chapterline=1
  118.             chapterlinebw=1
  119.             contentusedcount=contentusedcount+1
  120.             ReDim Preserve ContentUsedArray(contentusedcount)
  121.             ContentUsedArray(contentusedcount)=hta
  122.             Exit For
  123.           End If
  124.         Next
  125.       End If
  126.       If hta="<split>" and contentread=1 Then contentend=1
  127.       If Left(hta,9)="<content>" and Right(hta,10)="</content>" and contentread=0 Then
  128.         contentreadline=1
  129.        Else
  130.         contentreadline=EMPTY
  131.       End If
  132.       If CheckContent(hta)=1 or contentreadline=1 Then
  133.         If contentread=0 and contentend=0 Then
  134.           contentread=1
  135.           If contentreadline=EMPTY Then
  136.             htline=prehta&"<content>"&hta&"</content>"
  137.           End If
  138.         End If
  139.       End If
  140.       If CheckContent(hta)=EMPTY and contentreadline=EMPTY Then
  141.         If contentread=1 and contentend=0 and CheckEnDashUnique(hta)=0 Then
  142.           contentcount=contentcount+1
  143.           ReDim Preserve ContentReadArray(contentcount)
  144.           ContentReadArray(contentcount)=hta
  145.           If contentcount>contentmaxline Then
  146.             pre.close
  147.             fnp.close
  148.             fop.close
  149.             objFSO.DeleteFile(epubcontentpreview)
  150.             objFSO.DeleteFile(Output)
  151.             Wscript.echo chaptererrorinfo
  152.             Wscript.quit
  153.           End If
  154.          Else
  155.           If chapterline=1 and chapterbreakbw=0 Then
  156.             fop.WriteLine chapterbreak
  157.           End If
  158.         End If
  159.       End If
  160.       RubyCheck(htline)
  161.       FootnoteCheck(htline)
  162.       If CheckSymbol(hta)=1 Then symbolcentercount=symbolcentercount+1
  163.       If IsNumeric(hta) Then
  164.         numbercentercount=numbercentercount+1
  165.         numbercenter=numbercenter&hta&space(2)
  166.       End If
  167.       fop.WriteLine htline
  168.       If hta=chapterbreak Then
  169.         If chapterbreakbw=1 or splitbw=1 Then
  170.           spliterror=spliterror+1
  171.         End If
  172.         chapterbreakbw=1
  173.        Else
  174.         chapterbreakbw=0
  175.       End If
  176.       If hta="<split>" Then
  177.         If chapterbreakbw=1 or splitbw=1 or imgbw=1 Then
  178.           spliterror=spliterror+1
  179.         End If
  180.         splitbw=1
  181.        Else
  182.         splitbw=0
  183.       End If
  184.       imgbw=0
  185.     End If
  186.   End If
  187.   chapterline=EMPTY
  188.   contentreadline=EMPTY
  189. Loop

  190. For ir=1 To UBound(ContentReadArray)
  191.   For iu=1 To UBound(ContentUsedArray)
  192.     If ContentReadArray(ir)=ContentUsedArray(iu) Then
  193.       imu=1
  194.       Exit For
  195.      Else
  196.       imu=EMPTY
  197.     End If
  198.   Next
  199.   If imu=EMPTY Then
  200.     contentidlecount=contentidlecount+1
  201.     contentidle=contentidle&vbcrlf&ContentReadArray(ir)
  202.   End If
  203. Next
  204. For Each ir in objFSO.GetFolder(imgfolder).files
  205.   For iu=1 To UBound(ImgUsedArray)
  206.     If LCase(ir.name)=LCase(ImgUsedArray(iu)) Then
  207.       imu=1
  208.       Exit For
  209.      Else
  210.       imu=EMPTY
  211.     End If
  212.   Next
  213.   If imu=EMPTY Then
  214.     imageidlecount=imageidlecount+1
  215.     imageidle=imageidle&vbcrlf&ir.name
  216.   End If
  217. Next

  218. pre.WriteLine "Footnote-Count: "&footnotecount
  219. pre.WriteLine "Ruby-Count: "&rubycount
  220. pre.WriteLine "Symbol-Center: "&symbolcentercount
  221. pre.WriteLine "Number-Center: "&numbercentercount
  222. If numbercentercount>0 Then pre.WriteLine "Number-Center-Line: "&numbercenter
  223. pre.WriteBlankLines(1)
  224. pre.WriteLine "Footnote-Error: "&footnoteerror
  225. pre.WriteLine "Ruby-Error: "&rubyerror
  226. pre.WriteLine "Split-Error: "&spliterror
  227. pre.WriteBlankLines(1)
  228. If contentidlecount=0 Then contentidle="none"
  229. pre.WriteLine "Content Not Used:"
  230. pre.WriteLine contentidle
  231. pre.WriteBlankLines(1)
  232. If imageidlecount=0 Then imageidle="none"
  233. pre.WriteLine "Image Not Used:"
  234. pre.WriteLine imageidle
  235. pre.WriteBlankLines(1)
  236. If imagemissing=0 Then imgmisline="none"
  237. pre.WriteLine "Image Not Exists:"
  238. pre.WriteLine imgmisline
  239. pre.WriteBlankLines(1)
  240. If footnotecount=0 Then footnoteline="none"
  241. pre.WriteLine "Footnote-Line:"
  242. pre.WriteLine footnoteline
  243. pre.WriteBlankLines(1)
  244. If footnoteerror=0 Then footnoteerrorline="none"
  245. pre.WriteLine "Footnote-Error-Line:"
  246. pre.WriteLine footnoteerrorline
  247. pre.WriteBlankLines(1)
  248. If rubyerror=0 Then rubyerrorline="none"
  249. pre.WriteLine "Ruby-Error-Line:"
  250. pre.WriteLine rubyerrorline
  251. pre.close
  252. fnp.close
  253. fop.close

  254. Wscript.echo "done"
  255. WshShell.run epubcontentpreview,,True
  256. objFSO.DeleteFile(epubcontentpreview)
  257. Wscript.quit

  258. Function FilterImage(a)
  259.   FilterImage=a
  260.   imagefilter=0
  261.   For kw=0 To UBound(arrimage)
  262.     If LCase(Left(a,Len(arrimage(kw))))=LCase(arrimage(kw)) Then
  263.       b=Mid(a,Len(arrimage(kw))+1)
  264.       If b<>EMPTY Then
  265.         If Left(a,1)="(" or Left(a,1)="(" Then
  266.           If Len(b)>1 Then
  267.             imagefilter=1
  268.             FilterImage=Left(b,Len(b)-1)
  269.           End If
  270.          Else
  271.           imagefilter=1
  272.           FilterImage=b
  273.         End If
  274.       End If
  275.     End If
  276.   Next
  277. End Function

  278. Function CheckFootnote(a)
  279.   CheckFootnote=EMPTY
  280.   For kw=0 To UBound(arrfootnote)
  281.     If a=arrfootnote(kw) Then
  282.       CheckFootnote=1
  283.       Exit For
  284.     End If
  285.   Next
  286. End Function

  287. Function CheckContent(a)
  288.   CheckContent=EMPTY
  289.   For kw=0 To UBound(arrcontent)
  290.     If LCase(a)=arrcontent(kw) Then
  291.       CheckContent=1
  292.       Exit For
  293.     End If
  294.   Next
  295. End Function

  296. Function CheckSymbol(a)
  297.   CheckSymbol=EMPTY
  298.   For cls=1 To Len(a)
  299.     For kw=0 To UBound(arrsymbol)
  300.       If Mid(a,cls,1)=arrsymbol(kw) Then
  301.         SymbolStat=1
  302.         Exit For
  303.        Else
  304.         SymbolStat=EMPTY
  305.       End If
  306.     Next
  307.     If SymbolStat=EMPTY Then
  308.       Exit For
  309.     End If
  310.   Next
  311.   If SymbolStat=1 Then CheckSymbol=1
  312. End Function

  313. Function CheckEnDashUnique(a)
  314.   CheckEnDashUnique=1
  315.   For ti=1 To Len(a)
  316.     If Mid(a,ti,1)<>"-" Then
  317.       CheckEnDashUnique=0
  318.       Exit For
  319.     End If
  320.   Next
  321. End Function

  322. Function FootnoteCheck(a)
  323.   footnotelinetype=0
  324.   footnotelinea=a
  325.   footnoteerrortype=0
  326.   Do
  327.     footnotestr=EMPTY
  328.     For i=1 To Len(a)-2
  329.       b=Mid(a,i,3)
  330.       a1=Mid(a,1,i-1)
  331.       a2=Mid(a,i)
  332.       b1=Left(b,1)
  333.       b2=Mid(b,2,1)
  334.       b3=Right(b,1)
  335.       If b1="(" or b1="(" Then
  336.         If CheckFootnote(b2)=1 Then
  337.           If b3=":" or b3=":" or b3="︰" Then
  338.             footnotestat=1
  339.             footnotestrlen=1
  340.           End If
  341.         End If
  342.       End If

  343.       If footnotestat=EMPTY Then
  344.         b=Mid(a,i,4)
  345.         a1=Mid(a,1,i-1)
  346.         a2=Mid(a,i)
  347.         b1=Left(b,1)
  348.         b2=Mid(b,2,2)
  349.         b3=Right(b,1)
  350.         If b1="(" or b1="(" Then
  351.           If CheckFootnote(b2)=1 Then
  352.             If b3=":" or b3=":" or b3="︰" Then
  353.               footnotestat=1
  354.               footnotestrlen=2
  355.             End If
  356.           End If
  357.         End If
  358.       End If

  359.       If footnotestat=EMPTY Then
  360.         b=Mid(a,i,5)
  361.         a1=Mid(a,1,i-1)
  362.         a2=Mid(a,i)
  363.         b1=Left(b,1)
  364.         b2=Mid(b,2,3)
  365.         b3=Right(b,1)
  366.         If b1="(" or b1="(" Then
  367.           If CheckFootnote(b2)=1 Then
  368.             If b3=":" or b3=":" or b3="︰" Then
  369.               footnotestat=1
  370.               footnotestrlen=3
  371.             End If
  372.           End If
  373.         End If
  374.       End If

  375.       If footnotestat=1 Then
  376.         If b1="(" Then be1=")"
  377.         If b1="(" Then be1=")"
  378.         be=Instr(a2,be1)
  379.         a3=Mid(a2,2)
  380.         be2=Instr(a3,b1)
  381.         If be>0 Then
  382.           c=Mid(a,i+be)
  383.           a=a1&c
  384.           footnotestr=1
  385.         End If
  386.         If be>0 and be2>0 Then
  387.           If be>be2 Then
  388.             footnoteerrortype=1
  389.             footnoteerror=footnoteerror+1
  390.             Exit Do
  391.           End If
  392.         End If
  393.         If be=0 Then
  394.           footnoteerrortype=2
  395.           footnoteerror=footnoteerror+1
  396.           Exit Do
  397.         End If
  398.       End If
  399.       a1=EMPTY
  400.       a2=EMPTY
  401.       b=EMPTY
  402.       b1=EMPTY
  403.       b2=EMPTY
  404.       b3=EMPTY
  405.       be=EMPTY
  406.       be1=EMPTY
  407.       c=EMPTY
  408.       footnotestat=EMPTY
  409.       footnotestrlen=EMPTY
  410.       If footnotestr=1 Then
  411.         footnotelinetype=1
  412.         footnotecount=footnotecount+1
  413.         Exit For
  414.       End If
  415.     Next
  416.   Loop while footnotestr=1
  417.   If footnotelinetype=1 Then
  418.     footnoteline=footnoteline&vbcrlf&vbcrlf&footnotelinea
  419.   End If
  420.   If footnoteerrortype<>0 Then
  421.     footnoteerrorline=footnoteerrorline&vbcrlf&vbcrlf&footnotelinea
  422.   End If
  423. End Function

  424. Function RubyCheck(a)
  425.   rubyerrorlinea=a
  426.   rubyerrortype=0
  427.   Do
  428.     a1=InStr(a,rubya)
  429.     If a1>0 Then
  430.       b=Right(a,Len(a)-a1)
  431.       a=Left(a,a1-1)
  432.       b1=InStr(b,rubyb)
  433.       b2=InStr(b,rubya)
  434.       If b1>0 Then
  435.         c=Right(b,Len(b)-b1)
  436.         b=Left(b,b1-1)
  437.         c1=InStr(c,rubyc)
  438.         If c1=0 Then
  439.           rubyerrortype=1
  440.           rubyerror=rubyerror+1
  441.           Exit Do
  442.         End If
  443.         If c1>0 Then
  444.           d=Right(c,Len(c)-c1)
  445.           c=Left(c,c1-1)
  446.           If b=EMPTY or c=EMPTY Then
  447.             rubyerrortype=2
  448.             rubyerror=rubyerror+1
  449.             Exit Do
  450.           End If
  451.         End If
  452.       End If
  453.     End If
  454.     rubyint="<ruby>"
  455.     rubymid="<rt>"
  456.     rubyend="</rt></ruby>"
  457.     If rubyrp=1 Then
  458.       rubymid="<rp>"&rubyb&"</rp><rt>"
  459.       rubyend="</rt><rp>"&rubyc&"</rp></ruby>"
  460.     End If
  461.     If b<>EMPTY and c<>EMPTY Then
  462.       a=a&rubyint&b&rubymid&c&rubyend&d
  463.       rubystr=1
  464.       rubycount=rubycount+1
  465.       b3=InStr(c,rubya)
  466.       b4=InStr(c,rubyb)
  467.       b5=InStr(b,rubya)
  468.       b6=InStr(b,rubyc)
  469.       If b3>0 or b4>0 or b5>0 or b6>0 Then
  470.         rubyerrortype=3
  471.         rubyerror=rubyerror+1
  472.         Exit Do
  473.       End If
  474.       If b1>0 and b2>0 Then
  475.         If b1>b2 Then
  476.           rubyerrortype=4
  477.           rubyerror=rubyerror+1
  478.           Exit Do
  479.         End If
  480.       End If
  481.      Else
  482.       a=a&b&c&d
  483.       rubystr=EMPTY
  484.     End If
  485.     a1=EMPTY
  486.     b1=EMPTY
  487.     c1=EMPTY
  488.     b=EMPTY
  489.     c=EMPTY
  490.     d=EMPTY
  491.     b2=EMPTY
  492.     b3=EMPTY
  493.     b4=EMPTY
  494.     b5=EMPTY
  495.     b6=EMPTY
  496.   Loop while rubystr=1
  497.   If rubyerrortype<>0 Then
  498.     rubyerrorline=rubyerrorline&vbcrlf&vbcrlf&rubyerrorlinea
  499.   End If
  500. End Function
复制代码
回复 支持 反对

使用道具 举报

28

主题

106

帖子

3220

积分

吃书妖怪

Rank: 5Rank: 5Rank: 5

积分
3220
贡献
3220
金币
3692
 楼主| 发表于 2022-5-26 20:56:12 | 显示全部楼层
本帖最后由 hoebec 于 2022-5-27 23:27 编辑

实际操作

以 [藤谷ある][我的现实与网游被恋爱喜剧侵蚀了][1] 为例:
http://ritdon.com/forum.php?mod= ... &extra=page%3D4

1. 下载txt文件,修改txt文件名为 我的现实与网游被恋爱喜剧侵蚀了 1.txt,文件名为EPUB的标题
2. 下载zip图片包,解压文件,把图片所在目录移动到txt的当前文件夹,重命名目录名为 我的现实与网游被恋爱喜剧侵蚀了 1 (或者重命名为Images,或image),这个目录将被识别为txt的配套图片文件夹


3. txt文件的修改1
原文:
我的现实与网游被恋爱喜剧侵蚀了[1]

制作信息:
----------------
发布:深夜读书会
论坛:ritdon.com
----------------

书籍信息
----------------
书名:我的现实与网游被恋爱喜剧侵蚀了
卷号:1
作者:藤谷ある
插画:三嶋くろね
翻译:赵圣媛
简介:
阿宅变成万人迷!?
线上被当少女宠,现实误为众人「公」!?
鹭宫慧太是沉迷于线上RPG游戏的重度玩家,不过他操纵的是女性角色,所属公会的成员也几乎都是女性玩家。某一天参加网聚的时候,他被误认成是公会里唯一的男性角色——骑士大人,导致他在现实世界与网路世界都很受女孩子欢迎!这是什么陷阱?拥有现实和网路两种不同生活的慧太被性格南辕北辙的少女们所环绕,展开了一场有趣的恋爱喜剧。
----------------

修改为:
我的现实与网游被恋爱喜剧侵蚀了 1
制作信息:
----------------
发布:深夜读书会
论坛:ritdon.com
----------------

<split>
书籍信息
----------------
书名:我的现实与网游被恋爱喜剧侵蚀了
卷号:1
作者:藤谷ある
插画:三嶋くろね
翻译:赵圣媛
简介:
阿宅变成万人迷!?
线上被当少女宠,现实误为众人「公」!?
鹭宫慧太是沉迷于线上RPG游戏的重度玩家,不过他操纵的是女性角色,所属公会的成员也几乎都是女性玩家。某一天参加网聚的时候,他被误认成是公会里唯一的男性角色——骑士大人,导致他在现实世界与网路世界都很受女孩子欢迎!这是什么陷阱?拥有现实和网路两种不同生活的慧太被性格南辕北辙的少女们所环绕,展开了一场有趣的恋爱喜剧。
----------------

修改提示:
主要是要在 书籍信息 前加一行 <split>,分割上下文为两个xhtml文件



4. 预处理脚本自动切分章节

原文
目录
----------------
#10 【虽然是序章,却是终章,真糟糕】
#01 【突然被表白,真糟糕】
#02 【网聚就像后宫,真糟糕】
#03 【我的东西被夺走了,真糟糕】
#04 【跟猫一样的那个女孩子很像外星人,真糟糕】
#05 【红茶水滴里飘出黑暗的香气,真糟糕】
#06 【棉花糖染上蔷薇色,真糟糕】
#07 【草莓乳酪冰淇淋有公主的味道,真糟糕】
#08 【朋友列表是空的,真糟糕】
#09 【骑士大人是骑士大人,真糟糕】
----------------

#10 【虽然是序章,却是终章,真糟糕】
总而言之,这里是二次元世界,绝对不是三次元(现实)。

修改结果
<content>目录</content>
----------------
#10 【虽然是序章,却是终章,真糟糕】
#01 【突然被表白,真糟糕】
#02 【网聚就像后宫,真糟糕】
#03 【我的东西被夺走了,真糟糕】
#04 【跟猫一样的那个女孩子很像外星人,真糟糕】
#05 【红茶水滴里飘出黑暗的香气,真糟糕】
#06 【棉花糖染上蔷薇色,真糟糕】
#07 【草莓乳酪冰淇淋有公主的味道,真糟糕】
#08 【朋友列表是空的,真糟糕】
#09 【骑士大人是骑士大人,真糟糕】
----------------

<chapter>
#10 【虽然是序章,却是终章,真糟糕】

修改提示:
以 目录 为关键词,从下一行开始读取目录列表,读取的同时检测是否为已存在的目录行,当读取到 #10 【虽然是序章,却是终章,真糟糕】 就判断目录行已结束,开始进入第一个章节,之后每次读取到已存在的章节名就判断达到下一章节,自动在每个章节前加 <chapter> , 目录 不是唯一的判断关键词,在脚本最开始的arrcontent部分可以自己修改
如果读取的章节名超过100行,就判断为没有目录行未结束(没有检测到第一个章节),检测的方法是除去行首及行末空格后,检测是否一致
目录 这一行会被修改为 <content>目录</content> ,并记录为xhtml目录位置,之后的内容会被实际的目录代替,不会显示

如果在目录列表与第一个章节之间还有文本内容的情况
第8卷原文
目录
----------------
#01 【潜入,真糟糕】
#02 【无微不至,真糟糕】
#03 【尤克,真糟糕】
#04 【我与她的回忆,真糟糕】
#05 【启程,真糟糕】
#06 【现实被雫侵蚀了,真糟糕】
#07 【版本更新通知】
----------------

〈前情提要〉
MMORPG【杰克斯贝鲁特】的玩家鹭宫慧太

预先手动修改为
目录
----------------
#01 【潜入,真糟糕】
#02 【无微不至,真糟糕】
#03 【尤克,真糟糕】
#04 【我与她的回忆,真糟糕】
#05 【启程,真糟糕】
#06 【现实被雫侵蚀了,真糟糕】
#07 【版本更新通知】
----------------

<split>
〈前情提要〉
MMORPG【杰克斯贝鲁特】的玩家鹭宫慧太

在目录列表内容后加 <split> ,之后的内容就不再读取为章节目录行,只检测是否已达到新章节
如果目录列表与第一个章节之间没有文本内容(空行不算),加<split>会记录一个章节分割错误




5.预处理脚本转换图片行

原文
「咦……我……」

[RitImg]p023

我刻意摆出忸怩害羞的少女模样。我觉得暂停对话然后模糊带过是最好的办法。

修改提示:
以 [RitImg] 为关键词,检测图片文件夹内是否有文件名为p023的图片文件(只支持jpg,png,jpeg,webp这4种后缀名,大小写通用,jpg与jpeg通用),如果找到对应的图片文件,就把 [RitImg]p023 修改为p023.jpg,如果没有匹配的文件名,就记录为图片缺失行,在最后的统计中显示

修改结果
「咦……我……」

p023.jpg

我刻意摆出忸怩害羞的少女模样。我觉得暂停对话然后模糊带过是最好的办法。



6. 手动修改注释行
原文
没想到小棉把身体更往我这边靠了过来。而且她穿的是无袖衬衫,所以整个露出来的上臂与上臂之间产生※左右合体的感觉,这实在太让人受不了!不过,她本人是因为少根筋才这么做的吧~(编注:指大型机械人的合体动作。)

修改结果
没想到小棉把身体更往我这边靠了过来。而且她穿的是无袖衬衫,所以整个露出来的上臂与上臂之间产生左右合体(编注:指大型机械人的合体动作。)的感觉,这实在太让人受不了!不过,她本人是因为少根筋才这么做的吧~

修改提示:
此处的注释是对 左右合体 的注释,预处理脚本会在统计结果中列出这一行,修改必须手动
就是把注释内容直接放在 左右合体 的后面,这个位置也是多看弹注图片及其他弹注的切入点,(和)两个符号不会在最后的EPUB中显示,除非保留行内注释的方式

注释内容内有(和)符号的情况
原文
「呵呵,的确和※纳豆很接近呢,差点儿就要出手了……不对吧!想趁乱和我缔结婚约啊!」(译注:原文是取日文中「交换聘礼」(结纳)和「纳豆」(纳豆)汉字字形相近。)

修改结果
「呵呵,的确和纳豆(译注:原文是取日文中「交换聘礼」(结纳)和「纳豆」(纳豆)汉字字形相近。)很接近呢,差点儿就要出手了……不对吧!想趁乱和我缔结婚约啊!」

修改提示:
把最外端的(和)换成 ( 和 ) ,就是键盘上的英文括号




7. 上标的格式

原文
只要吃了这个串烧,STR<臂力>和VIT<体力>就会暂时提升5,是与头目对战或进行迷宫攻略之前必要的补给品,尤其对前锋系职业的玩家来说是相当重要的食品道具。

修改结果
只要吃了这个串烧,|STR《臂力》和|VIT《体力》就会暂时提升5,是与头目对战或进行迷宫攻略之前必要的补给品,尤其对前锋系职业的玩家来说是相当重要的食品道具。

修改提示:
上标需要3个符号才能准确标记,但会降低txt文本的阅读连贯性,可以对比手动修改,符号可以使用任意(要使用<和>两个符号,必须修改脚本,把xxx=ReplaceEsc(xxx)这样的行删掉)

上标符号与书名号的混用
原文
《WEAPON<武器> BREAKAGE<破损>!》

修改结果
《|WEAPON《武器》 |BREAKAGE《破损》!》

修改提示:
上标格式内不能有书名号,但外部可以




8. 预处理脚本的统计结果
预处理脚本运行后得到文件名加后缀-r的新txt文件,以及一个统计结果(txt,自动打开) ,显示图片文件夹内未使用的图片文件,找不到对应文件的图片行,文本手动分割的错误(<split>的位置),注释行,以及需要预先手动修改的注释行
有任何报错都需要对照重新修改原txt,重新运行预处理脚本,直到无报错为止
预处理脚本可以用手动代替




9. 运行实际转换脚本,并得到预览结果
预处理脚本运行后得到文件名加后缀-r的新txt文件,无报错后,删除原txt,把新txt文件的-r后缀去掉,运行实际转换脚本,拖放,ENTER,得到EPUB文件以及一个目录预览,一样是有出错信息就对照修改重新运行



Tips

行首及行末的空格会被忽略
图片行前后的空行会被忽略
<split>行前后的空行会被忽略
<chapter>行前后的空行会被忽略
章节第一行以<skip>开始,将不显示
章节以图片行开始,将以第二行为标题名,<skip>也起作用,其余地方的<skip>不产生效果
<split>及<chapter>不能是txt文件的第一个非空行,也不能是最后一个
<split>会切分xhtml文件,但只在第一个章节前有效
<split>不能与<split>,<chapter>,图片行连用
作者名和插画名不能留空
使用多看弹注显示必须在图片文件夹内有一个文件名为footnote.png的图片
脚本基本是固定给非图片行前后分别加<p>和</p>,如果是以"<hr "  "<p>"  "<p " "<div" 开始的行,会直接写入xhtml文件(也会处理注释和上标)
在实际转换脚本里,<content>目录</content> 这样的行是判断EPUB内目录xhtml位置的行,等效于 <content></content> ,如果在第一个章节前找不到这样的行,目录将放在卷末



设置参数(实际转换脚本的开始部分)

rubya="|"   上标第一个符号
rubyb="《"    上标第二个符号
rubyc="》"    上标第三个符号
imagepage=1  在卷末是否生成一个图片合集的页面(1为生成,0为不生成)
numbercenter=1  数字单独一行是否居中(1为居中,0为不居中)
symbolcenter=1   全部为符号的行是否居中(1为居中,0为不居中),具体符号见arrsymbol
rtl="rtl"
rtl="ltr"  翻页方式,ltr为左到右,rtl为右到左(同时设置直排),以新的一行为准
language="zh"  语言
publisher=""  出版社
dcdate=""  发行日期(yyyy-mm-dd)
chapterbreak="<chapter>"  章节切分标志
duokanbleed="leftright"  多看图片样式
duokancover="duokan-page-fitwindow"
duokancover="duokan-page-fullscreen"  多看封面样式
duokanfontfixed=1  多看锁字体设置
emptylineskip=0  是否忽略所有空行(1为忽略,0为不忽略)
footnotetype="newline"  使用换行注释
footnotetype="duokan"  使用多看弹注(以新一行为准)
footnotecolor="#a0513c"  注释颜色
footnotefontsize="0.8em"  注释字体大小
footnoteimagesize="0.9em"  注释图片大小
txtbackup=1  是否备份txt到EPUB包内(OEBPS\Backup\backup.txt)
inputfiledelete=0  是否删除原文件(包括图片文件夹,字体文件夹,1为删除,0为不删除)

在实际转换脚本的最后有一行 Wscript.sleep 1500 ,这是EPUB文件的预估打包时间(1500毫秒/1.5秒),对20M以内的EPUB文件应该都没问题,如果打包时间不够长,后缀名变为epub时就会报错,修改增加时间重新运行即可
回复 支持 1 反对 0

使用道具 举报

19

主题

152

帖子

1643

积分

图书委员

Rank: 4Rank: 4

积分
1643
贡献
1643
金币
186
发表于 2022-5-28 20:00:53 | 显示全部楼层
看麻了,告辞
回复 支持 反对

使用道具 举报

62

主题

6724

帖子

1万

积分

图书迷宫

Rank: 7Rank: 7Rank: 7

积分
13263
贡献
13263
金币
878
发表于 2022-5-28 20:02:54 | 显示全部楼层
不得不赞叹一声 很详尽。
回复 支持 反对

使用道具 举报

3

主题

5572

帖子

8858

积分

禁书目录

Rank: 6Rank: 6

积分
8858
贡献
8858
金币
866
发表于 2022-5-29 10:45:49 | 显示全部楼层
虽然我不想否认你努力的成果。。但是用sigil做不是更方便吗。。而且还能实时看自己做的有没有bug
游客,本帖隐藏的内容需要积分高于 3117 才可浏览,您当前积分为 0

回复 支持 反对

使用道具 举报

1

主题

390

帖子

1016

积分

小书痴

Rank: 3

积分
1016
贡献
1016
金币
2371
发表于 2022-5-29 11:25:19 | 显示全部楼层
不明觉厉,程序大佬nb,虽然我看不懂
回复 支持 反对

使用道具 举报

28

主题

106

帖子

3220

积分

吃书妖怪

Rank: 5Rank: 5Rank: 5

积分
3220
贡献
3220
金币
3692
 楼主| 发表于 2022-5-29 19:35:22 | 显示全部楼层
本帖最后由 hoebec 于 2022-5-29 19:41 编辑
huihug 发表于 2022-5-29 10:45
虽然我不想否认你努力的成果。。但是用sigil做不是更方便吗。。而且还能实时看自己做的有没有bug
...


做封面字体消耗时间太多了,自动脚本肯定做不了的,除非把做好的行直接写入txt文件

这方面我也不熟,要做的话肯定是先考虑抠图

如果是说插图的内文的文字,用css也可以做出渐变
回复 支持 反对

使用道具 举报

1

主题

96

帖子

266

积分

初翻书页

Rank: 2Rank: 2

积分
266
贡献
266
金币
0
发表于 2022-5-29 20:48:05 | 显示全部楼层
啊这,感觉好难
回复 支持 反对

使用道具 举报

3

主题

5572

帖子

8858

积分

禁书目录

Rank: 6Rank: 6

积分
8858
贡献
8858
金币
866
发表于 2022-5-29 20:54:26 | 显示全部楼层
hoebec 发表于 2022-5-29 19:35
做封面字体消耗时间太多了,自动脚本肯定做不了的,除非把做好的行直接写入txt文件

这方面我也不熟,要做的 ...

封面那边貌似有大佬做出来了,不过只有电脑才能正确显示。。
就是把笔画打出来然后覆盖上去,不过确实有些只能抠图了
渐变的话我也看到有人做出来过,就是那个代码量太大。。
貌似使用到了自动生成,只要把首颜色和尾颜色打进去就能自动生成的样子
回复 支持 反对

使用道具 举报

28

主题

106

帖子

3220

积分

吃书妖怪

Rank: 5Rank: 5Rank: 5

积分
3220
贡献
3220
金币
3692
 楼主| 发表于 2022-5-30 14:25:07 | 显示全部楼层
本帖最后由 hoebec 于 2022-5-30 14:33 编辑

关于封面图片的选择:
默认是以文件名为 cover 的图片为封面,如果没有这样的文件名,就以第一张图片为封面

多看弹注的附加制作:
低版本的Duokan阅读器在某些机器上不能加载系统字体(?),导致弹注内容显示为空白
正文部分在这种情况下也无法显示,但可以通过引入外置字体解决,弹注就只能通过增加EPUB包的内置字体解决
如果弹注在Duokan无法显示,就在字体文件夹加入一个文件名为 footnote 的字体文件(ttf/otf),会自动变为注释的专有字体,预处理脚本的统计结果的所有注释行字符就是字集化所需要的字符
字体文件夹存在 footnote 以外的字体文件(ttf/otf)时,第一个这样的文件会被自动设置为EPUB的全局字体(这种情况下可以不需要footnote字体文件),多看锁字体设置在这个基础上才会生效

多看弹注无法显示是一直都存在的问题,似乎也只能用内置字体解决


回复 支持 反对

使用道具 举报

8

主题

372

帖子

1401

积分

小书痴

Rank: 3

积分
1401
贡献
1401
金币
741
发表于 2022-5-30 15:10:32 | 显示全部楼层
很长的代码,做起来应该很费事吧?
但你这代码还是有一些致命的缺点
主要的问题集中如下:
1、坛子里的书的格式只能用千奇百怪形容,有的图片前会加{ritimage},有的图片又单纯以“插图+文件名”表示
     有的txt不加彩插标记,有的txt干脆就没格式。
     这些都要制作者一个个去检查确认调整。
2、很多书籍会具有标新立异的标题格式。
     有的txt会直接用插图做标题,有的会直接以一句很长的话做标题(说的就是你,孤单一人的异世界之旅)
     还有的细分为主标题次标题章标题节标题卷标题……
     程序,除非用了复杂的机器学习人工智能,否则很难识别这些标题。
     更何况,很多txt不给出目录,甚至糟糕的是目录给出的格式和章节标题格式完全不一致。
因此想通过一劳永逸的办法,利用脚本批量制作书籍,至少在这个站点里边,只会陷入特例陷阱,会在无限的特例中死循环。
回复 支持 反对

使用道具 举报

8

主题

372

帖子

1401

积分

小书痴

Rank: 3

积分
1401
贡献
1401
金币
741
发表于 2022-5-30 15:12:29 | 显示全部楼层
基于上贴的问题:
与其制作自动制作脚本,不如制作一系列更为灵活的“导入工具”,基于使用者以灵活的编辑空间,以方便使用者进行导入检查编辑
回复 支持 反对

使用道具 举报

28

主题

106

帖子

3220

积分

吃书妖怪

Rank: 5Rank: 5Rank: 5

积分
3220
贡献
3220
金币
3692
 楼主| 发表于 2022-5-30 16:02:58 | 显示全部楼层
本帖最后由 hoebec 于 2022-5-30 16:14 编辑
香露露 发表于 2022-5-30 15:12
基于上贴的问题:
与其制作自动制作脚本,不如制作一系列更为灵活的“导入工具”,基于使用者以灵活的编辑 ...


这个脚本能做的事也不多,只是将按格式整理好的文本转成EPUB,大部分工作还是要手动检查,不过能提供给不想动手做EPUB的人一个转换工具,适用性可靠性就不能要求更多了,对提高制作技术也没什么用

对于自己仔细制作过的EPUB总是没兴趣看,所以要想保留看书的新鲜感,最大的要诀是不要太花功夫去做
下载好txt和图包,简单几步转换,30秒后就在手机的多看里面显示了,这样不挺爽,30秒太少,2分钟也不多

现在EPUB的风声都紧了,自己做自己看才是王道
回复 支持 1 反对 0

使用道具 举报

3

主题

5572

帖子

8858

积分

禁书目录

Rank: 6Rank: 6

积分
8858
贡献
8858
金币
866
发表于 2022-5-30 16:23:45 | 显示全部楼层
香露露 发表于 2022-5-30 15:12
基于上贴的问题:
与其制作自动制作脚本,不如制作一系列更为灵活的“导入工具”,基于使用者以灵活的编辑 ...

啊这。。你这是想让他设计个类似sigil的东西诶。。
回复 支持 反对

使用道具 举报

8

主题

372

帖子

1401

积分

小书痴

Rank: 3

积分
1401
贡献
1401
金币
741
发表于 2022-5-30 23:45:52 | 显示全部楼层
huihug 发表于 2022-5-30 16:23
啊这。。你这是想让他设计个类似sigil的东西诶。。

请容我小小炫耀一下,这是我做的软件,大概就是你所说的类似sigil的东西。

                               
登录/注册后可看大图

唯一的问题是,做的书籍是自己设计的格式,而非epub。
虽然也可以保存为epub啦……但存在一些问题,比如不好处理图片什么的,反正挺……呃,麻烦,的,所以就没考虑过发布这个软件。
回复 支持 反对

使用道具 举报

8

主题

372

帖子

1401

积分

小书痴

Rank: 3

积分
1401
贡献
1401
金币
741
发表于 2022-5-31 00:00:05 | 显示全部楼层
hoebec 发表于 2022-5-30 16:02
这个脚本能做的事也不多,只是将按格式整理好的文本转成EPUB,大部分工作还是要手动检查,不过能提供给不想 ...

怎么说呢……我只是在说,这个脚本的缺点是不够灵活,泛用性不够强。
倒不是真要求作出什么大的操作。
这样吧,我给你推荐我本人制作、在用的奇怪的东西作为参考……

                               
登录/注册后可看大图

我现在差不多都是用这个玩意处理下载来的txt,然后导入到上贴中炫耀的小软件里,然后选好封面,按ctrl+s,再选WiFi传书直接传到手机的客户端里。
最快的情况下,20秒钟解决一本书(当然这是极端理想的情况)。
回复 支持 反对

使用道具 举报

1

主题

84

帖子

2647

积分

图书委员

Rank: 4Rank: 4

积分
2647
贡献
2647
金币
986
发表于 2022-5-31 02:55:57 | 显示全部楼层
sigil最大的问题就是处理大量字会百分百卡死。
回复 支持 反对

使用道具 举报

1

主题

65

帖子

190

积分

初翻书页

Rank: 2Rank: 2

积分
190
贡献
190
金币
27
发表于 2022-5-31 06:50:19 | 显示全部楼层
要不要试试calibre的txt规则转换啊.支持的导入导出格式都挺多的
回复 支持 反对

使用道具 举报

28

主题

106

帖子

3220

积分

吃书妖怪

Rank: 5Rank: 5Rank: 5

积分
3220
贡献
3220
金币
3692
 楼主| 发表于 2022-5-31 06:58:31 | 显示全部楼层
香露露 发表于 2022-5-31 00:00
怎么说呢……我只是在说,这个脚本的缺点是不够灵活,泛用性不够强。
倒不是真要求作出什么大的操作。
这 ...

20秒还包括传输过程的话,速度也太极限了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|ritdon

GMT+8, 2024-4-29 11:18 , Processed in 0.312140 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表