main
黄海 1 year ago
parent 019d09004d
commit 2fc1aef04d

File diff suppressed because one or more lines are too long

@ -1,5 +1,7 @@
package UnitTest;
import java.io.*;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.RuntimeUtil;
import com.alibaba.fastjson.JSONArray;
@ -12,8 +14,18 @@ https://github.com/markmap/markmap
*/
public class Swdt {
public static void main(String[] args) {
String workingPath = "D:\\dsWork\\QingLong\\src\\main\\java\\UnitTest\\";
public static String workingPath = "D:\\dsWork\\QingLong\\src\\main\\java\\UnitTest\\";
public static String getColorTxt(String txt, int num, String color) {
String content = FileUtil.readUtf8String(workingPath + "Swdt_Color.txt");
content = content.replace("{{color}}", color);
content = content.replace("{{txt}}", txt);
content = content.replace("{{num}}", String.valueOf(num));
return content;
}
public static void main(String[] args) throws IOException {
String km = "初中物理八年级上(人教版)";
String sourceJson = "Swdt.json";
String targetMd = "Swdt.md";
@ -25,7 +37,7 @@ public class Swdt {
String res = "# " + km + "\n";
for (int i = 0; i < jTree.size(); i++) {
String title = jTree.getJSONObject(i).getString("title");
res += "## " + title + "\n";
res += "## " + getColorTxt(title,99,"#ff5722") + "\n";
JSONArray jChildren = jTree.getJSONObject(i).getJSONArray("children");
if (jChildren != null) {
int rowCount = 3;//每行3个
@ -49,5 +61,29 @@ public class Swdt {
}
String str = RuntimeUtil.execForStr(cmd);
System.out.println(str);
// 修改html文件
File file = new File(workingPath + targetHtml);
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);
StringBuilder content = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
if (line.indexOf("<title>Markmap</title>") >= 0) {
String modifiedLine = line.replaceAll("<title>Markmap</title>", "<title>建设情况</title>");
//读取字体文件,填充内容
String fontStr = FileUtil.readUtf8String(new File(workingPath + "Swdt_Font.txt"));
content.append(modifiedLine).append("\n");
content.append(fontStr).append("\n");
} else {
content.append(line).append("\n");
}
}
br.close();
FileWriter fw = new FileWriter(file);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(content.toString());
bw.close();
}
}

@ -1,26 +1,26 @@
# 初中物理八年级上(人教版)
## 第一章  机械运动
## <div style="position: relative;"><span style="padding: 8px 20px;border-radius: 24px;background-color: #ff5722;font-size: 14px; border: 5px solid #ecf0f1;color: #fff;font-family: 'PingFang';">第一章  机械运动</span><span style="position: absolute;left: -15px; padding: 2px 6px;border-radius: 20px;background-color: #fff;font-size: 12px;border: 2px solid #ff5722;color: #ff5722;font-family: 'PingFang';">99+</span></div>
### 第1节 长度和时间的测量
#### 第2节 运动的描述
##### 第3节 运动的快慢
### 第4节 测量平均速度
#### 本章复习
## 第二章  声现象
## <div style="position: relative;"><span style="padding: 8px 20px;border-radius: 24px;background-color: #ff5722;font-size: 14px; border: 5px solid #ecf0f1;color: #fff;font-family: 'PingFang';">第二章  声现象</span><span style="position: absolute;left: -15px; padding: 2px 6px;border-radius: 20px;background-color: #fff;font-size: 12px;border: 2px solid #ff5722;color: #ff5722;font-family: 'PingFang';">99+</span></div>
### 第1节 声音的产生与传播
#### 第2节 声音的特性
##### 第3节 声的利用
### 第4节 噪音的危害和控制
#### 本章复习
## 第三章  物态变化
## <div style="position: relative;"><span style="padding: 8px 20px;border-radius: 24px;background-color: #ff5722;font-size: 14px; border: 5px solid #ecf0f1;color: #fff;font-family: 'PingFang';">第三章  物态变化</span><span style="position: absolute;left: -15px; padding: 2px 6px;border-radius: 20px;background-color: #fff;font-size: 12px;border: 2px solid #ff5722;color: #ff5722;font-family: 'PingFang';">99+</span></div>
### 第1节 温度
#### 第2节 熔化和凝固
##### 第3节 汽化和液化
### 第4节 升华和凝华
#### 本章复习
## 第四章  光现象
## <div style="position: relative;"><span style="padding: 8px 20px;border-radius: 24px;background-color: #ff5722;font-size: 14px; border: 5px solid #ecf0f1;color: #fff;font-family: 'PingFang';">第四章  光现象</span><span style="position: absolute;left: -15px; padding: 2px 6px;border-radius: 20px;background-color: #fff;font-size: 12px;border: 2px solid #ff5722;color: #ff5722;font-family: 'PingFang';">99+</span></div>
### 第1节 光的直线传播
#### 第2节 光的反射
##### 第3节 平面镜成像
@ -28,7 +28,7 @@
#### 第5节 光的色散
##### 本章复习
## 第五章  透镜及其应用
## <div style="position: relative;"><span style="padding: 8px 20px;border-radius: 24px;background-color: #ff5722;font-size: 14px; border: 5px solid #ecf0f1;color: #fff;font-family: 'PingFang';">第五章  透镜及其应用</span><span style="position: absolute;left: -15px; padding: 2px 6px;border-radius: 20px;background-color: #fff;font-size: 12px;border: 2px solid #ff5722;color: #ff5722;font-family: 'PingFang';">99+</span></div>
### 第1节 透镜
#### 第2节 生活中的透镜
##### 第3节 凸透镜成像的规律
@ -36,16 +36,16 @@
#### 第5节 显微镜和望远镜
##### 本章复习
## 第六章  质量与密度
## <div style="position: relative;"><span style="padding: 8px 20px;border-radius: 24px;background-color: #ff5722;font-size: 14px; border: 5px solid #ecf0f1;color: #fff;font-family: 'PingFang';">第六章  质量与密度</span><span style="position: absolute;left: -15px; padding: 2px 6px;border-radius: 20px;background-color: #fff;font-size: 12px;border: 2px solid #ff5722;color: #ff5722;font-family: 'PingFang';">99+</span></div>
### 第1节 质量
#### 第2节 密度
##### 第3节 测量物质的密度
### 第4节 密度与社会生活
#### 本章复习
## 期中复习
## <div style="position: relative;"><span style="padding: 8px 20px;border-radius: 24px;background-color: #ff5722;font-size: 14px; border: 5px solid #ecf0f1;color: #fff;font-family: 'PingFang';">期中复习</span><span style="position: absolute;left: -15px; padding: 2px 6px;border-radius: 20px;background-color: #fff;font-size: 12px;border: 2px solid #ff5722;color: #ff5722;font-family: 'PingFang';">99+</span></div>
## 期末复习
## <div style="position: relative;"><span style="padding: 8px 20px;border-radius: 24px;background-color: #ff5722;font-size: 14px; border: 5px solid #ecf0f1;color: #fff;font-family: 'PingFang';">期末复习</span><span style="position: absolute;left: -15px; padding: 2px 6px;border-radius: 20px;background-color: #fff;font-size: 12px;border: 2px solid #ff5722;color: #ff5722;font-family: 'PingFang';">99+</span></div>
## 本册复习
## <div style="position: relative;"><span style="padding: 8px 20px;border-radius: 24px;background-color: #ff5722;font-size: 14px; border: 5px solid #ecf0f1;color: #fff;font-family: 'PingFang';">本册复习</span><span style="position: absolute;left: -15px; padding: 2px 6px;border-radius: 20px;background-color: #fff;font-size: 12px;border: 2px solid #ff5722;color: #ff5722;font-family: 'PingFang';">99+</span></div>

@ -0,0 +1 @@
<div style="position: relative;"><span style="padding: 8px 20px;border-radius: 24px;background-color: {{color}};font-size: 14px; border: 5px solid #ecf0f1;color: #fff;font-family: 'PingFang';">{{txt}}</span><span style="position: absolute;left: -15px; padding: 2px 6px;border-radius: 20px;background-color: #fff;font-size: 12px;border: 2px solid {{color}};color: {{color}};font-family: 'PingFang';">{{num}}+</span></div>

@ -0,0 +1,6 @@
<style>
@font-face {
font-family: 'PingFang';
src: url('https://dsideal.obs.cn-north-1.myhuaweicloud.com/wb/PingFang.ttf') format('truetype');
}
</style>
Loading…
Cancel
Save