kunfei 3 лет назад
Родитель
Сommit
1ca3b9846d

+ 15 - 0
app/src/main/assets/updateLog.md

@@ -14,6 +14,21 @@
 
 **2023/05/19**
 
+* 目录格式化js添加一个公用变量gInt, int类型默认值0
+
+> 示例1
+
+```
+"第" + index + "章" + title
+```
+
+> 示例2
+
+```
+gInt++
+"第" + gInt + "章" + title
+```
+
 * 优化修复bug
 * 其中一些更新由 Xwite, Horis 提供
 

+ 1 - 0
app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt

@@ -121,6 +121,7 @@ object BookChapterList {
         coroutineContext.ensureActive()
         val formatJs = tocRule.formatJs
         val bindings = SimpleBindings()
+        bindings["gInt"] = 0
         list.forEachIndexed { index, bookChapter ->
             bookChapter.index = index
             if (!formatJs.isNullOrBlank()) {