Skip to content

Commit d910402

Browse files
committed
fix: export package desc to markdown
1 parent e1f5ef9 commit d910402

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ You can stop the process at anytime after step 2. You can restart the compressin
8989
5. Export the compressed results
9090
```
9191
cargo run --bin cmd export https://xxx.git --out-dir {OUTPUT_DIR}
92+
```
9293

9394
# Status Update
9495

script/make_parser.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515

1616
root=$(dirname $(realpath $(dirname $0)))
1717

18-
# # make go_ast
19-
# cd $root/src/compress/golang/plugin
20-
# go build -o ../../../../tools/parser/go_ast .
21-
22-
2318
# make lang
2419
cd $root/src/lang
2520
go build -o ../../tools/parser/lang .

src/bin/cmd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ compress: compress the repo. Including flags:
5959
--force-update-ast: force parsing repo and merge the previous result
6060
--not-load-external-symbol: not load external external symbols to speed up parsing
6161
--no-need-comment: not need comment in symbol content (only works for Go now)
62-
export: export the compress result to csv or markdown (default). Including flags:
62+
export: export the result to csv or markdown (default). Including flags:
6363
--csv: export the compress result to csv
6464
--out-dir <path>: output directory path, default is $WORK_DIR
6565
--public-only: only export the public symbols

src/export.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ pub fn to_markdown(repo: &Repository, opts: &ExportOptions) -> String {
198198
for (pkg_name, pkg) in module.packages.iter() {
199199
// 添加包标题
200200
md.push_str(&format!("## {}\n\n", pkg_name));
201+
if let Some(data) = &pkg.compress_data {
202+
md.push_str(&format!("{}\n\n", data));
203+
}
201204

202205
// 添加函数
203206
for (func_name, func) in pkg.functions.iter() {
@@ -207,7 +210,7 @@ pub fn to_markdown(repo: &Repository, opts: &ExportOptions) -> String {
207210

208211
md.push_str(&format!("### {}\n\n", func_name));
209212
if let Some(data) = &func.compress_data {
210-
md.push_str(&format!("- Description\n\n{}\n\n", data));
213+
md.push_str(&format!("{}\n\n", data));
211214
}
212215
md.push_str(&format!("- Position\n\n{}:{}\n\n", func.file, func.line));
213216
md.push_str(&format!(
@@ -224,7 +227,7 @@ pub fn to_markdown(repo: &Repository, opts: &ExportOptions) -> String {
224227

225228
md.push_str(&format!("### {}\n\n", type_name));
226229
if let Some(data) = &typ.compress_data {
227-
md.push_str(&format!("- Description\n\n{}\n\n", data));
230+
md.push_str(&format!("{}\n\n", data));
228231
}
229232
md.push_str(&format!("- Position\n\n{}:{}\n\n", typ.file, typ.line));
230233
md.push_str(&format!("- Codes\n\n```{}\n{}\n```\n\n", lang, typ.content));
@@ -238,7 +241,7 @@ pub fn to_markdown(repo: &Repository, opts: &ExportOptions) -> String {
238241

239242
md.push_str(&format!("### {}\n\n", var_name));
240243
if let Some(data) = &var.compress_data {
241-
md.push_str(&format!("- Description\n\n{}\n\n", data));
244+
md.push_str(&format!("{}\n\n", data));
242245
}
243246
md.push_str(&format!("- Position\n\n{}:{}\n\n", var.file, var.line));
244247
md.push_str(&format!("- Codes\n\n```{}\n{}\n```\n\n", lang, var.content));

0 commit comments

Comments
 (0)