Skip to content

Commit 48787df

Browse files
committed
vault backup: 2025-12-28 19:29:12
1 parent a38d6f3 commit 48787df

File tree

2 files changed

+73
-14
lines changed

2 files changed

+73
-14
lines changed

.obsidian/workspace.json

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -225,25 +225,25 @@
225225
},
226226
"active": "e95b8039e26e6542",
227227
"lastOpenFiles": [
228+
"source/_posts/2026年全球纸浆市场深度研究报告:供需大分流与结构性重构下的价格博弈.md",
229+
"source/_posts/2025全球贵金属市场年度深度报告:宏观范式重构、工业需求爆发与广期所(GFEX)的定价革命.md",
230+
"public/2025/02/14/锁仓与平仓之比较/index.html",
231+
"public/2025/02/14/通用语言模型(AI)与商品投资策略/index.html",
232+
"public/2025/02/14/研究应该像破案/index.html",
233+
"public/2025/02/14/泰国南部降雨形成机制/index.html",
234+
"public/2025/02/14/日本蜡烛图:上吊线和锤子线/index.html",
235+
"public/2025/02/14/日本蜡烛图技术:星线/index.html",
236+
"public/2025/02/14/日本蜡烛图技术:乌云盖顶形态及刺进形态/index.html",
237+
"public/2025/02/14/单边的风险一定大于套利吗?/index.html",
238+
"public/2025/02/14/伊朗简史/index.html",
239+
"public/2025/02/14/gamma ai情缘/index.html",
228240
"public/charts/index.md",
229241
"source/charts/index.md",
230242
"source/index.md",
231-
"source/_posts/2025全球贵金属市场年度深度报告:宏观范式重构、工业需求爆发与广期所(GFEX)的定价革命.md",
232243
"source/_posts/2026年黑色产业链深度展望报告:新均衡下的结构性重塑与全球博弈.md",
233244
"source/模板/嵌入网站.md",
234-
"source/charts/preciousmetals/测试标题_20251228012103/index.html",
235-
"source/charts/preciousmetals/测试标题_20251228012103",
236-
"source/charts/preciousmetals/手动测试标题_20251228011916/index.html",
237-
"source/charts/preciousmetals/手动测试标题_20251228011916",
238-
"source/charts/preciousmetals/index_20251228011822/index.html",
239-
"source/charts/preciousmetals/index_20251228011822",
240-
"source/charts/preciousmetals/index.html",
241-
"source/charts/preciousmetals",
242-
"scripts/chart_tag.js",
243-
"scripts",
244245
"Pasted image 20251227093005.png",
245246
"source/模板/博客模板.md",
246-
"source/_posts/2026年全球纸浆市场深度研究报告:供需大分流与结构性重构下的价格博弈.md",
247247
"source/_posts/橡胶多空影响研究框架.md",
248248
"source/_posts/2025-12-25-market-summary.md",
249249
"source/_posts/我眼中的马斯克.md",
@@ -260,7 +260,6 @@
260260
"source/_posts/通用语言模型(AI)与商品投资策略.md",
261261
"source/_posts/美债问题简述.md",
262262
"source/_posts/索罗斯大战英镑.md",
263-
"source/_posts/由海岸线有多长联想到的交易方式.md",
264-
"source/_posts/研究应该像破案.md"
263+
"source/_posts/由海岸线有多长联想到的交易方式.md"
265264
]
266265
}

scripts/auto_charts.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
/**
5+
* Hexo Tag: {% chart_list %}
6+
* 功能: 自动列出 charts 下的子文件夹
7+
* 智能点: 尝试读取 index.html 里的 <title> 作为显示名称
8+
*/
9+
hexo.extend.tag.register('chart_list', function(args) {
10+
const chartsDir = path.join(hexo.source_dir, 'charts');
11+
let html = '<ul class="chart-list-auto">';
12+
13+
if (fs.existsSync(chartsDir)) {
14+
const files = fs.readdirSync(chartsDir);
15+
16+
files.forEach(file => {
17+
// 忽略 index.md 和隐藏文件
18+
if (file === 'index.md' || file.startsWith('.')) return;
19+
20+
const fullPath = path.join(chartsDir, file);
21+
const stat = fs.statSync(fullPath);
22+
23+
if (stat.isDirectory()) {
24+
let displayName = file; // 默认用文件夹名
25+
26+
// --- 智能读取开始 ---
27+
try {
28+
// 尝试寻找该文件夹下的 index.html
29+
const indexPath = path.join(fullPath, 'index.html');
30+
if (fs.existsSync(indexPath)) {
31+
const content = fs.readFileSync(indexPath, 'utf-8');
32+
// 使用正则提取 <title> 内容
33+
const match = content.match(/<title>(.*?)<\/title>/i);
34+
if (match && match[1]) {
35+
displayName = match[1].trim(); // 提取成功!用 HTML 里的标题
36+
}
37+
}
38+
} catch (e) {
39+
// 如果读取出错,就还是用文件夹名,不做处理
40+
}
41+
// --- 智能读取结束 ---
42+
43+
// 如果还是文件名,稍微美化一下(首字母大写)
44+
if (displayName === file) {
45+
displayName = file.charAt(0).toUpperCase() + file.slice(1);
46+
}
47+
48+
html += `
49+
<li style="margin-bottom: 8px;">
50+
<a href="/charts/${file}/" target="_blank" style="text-decoration: none; font-size: 1.1em;">
51+
📊 <strong>${displayName}</strong>
52+
</a>
53+
</li>`;
54+
}
55+
});
56+
}
57+
58+
html += '</ul>';
59+
return html;
60+
});

0 commit comments

Comments
 (0)