authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-07-28 20:49:55+02:00
committergravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-07-28 21:37:36+02:00
log2c7387aef5c24a463ef9fc15809df570b6463bba
tree082894b9b3059fad9268a8b0a8aa2301a8f796f5
parente863292fe2f280945d914e7e98fbc704b68f1004

autodoc: better short description algorithm


1 files changed, 14 insertions(+), 5 deletions(-)

lib/docs/main.js+14-5
...@@ -2639,14 +2639,23 @@ var zigAnalysis;...@@ -2639,14 +2639,23 @@ var zigAnalysis;
2639 });2639 });
2640 }2640 }
26412641
2642 2642
2643 function shortDescMarkdown(docs) {2643 function shortDescMarkdown(docs) {
2644 let parts = docs.trim().split("\n");2644 const trimmed_docs = docs.trim();
2645 let firstLine = parts[0];2645 let index = trimmed_docs.indexOf('.');
2646 return markdown(firstLine);2646 if (index < 0) {
2647 index = trimmed_docs.indexOf('\n');
2648 if (index < 0) {
2649 index = trimmed_docs.length;
2650 }
2651 } else {
2652 index += 1; // include the period
2653 }
2654 const slice = trimmed_docs.slice(0, index);
2655 return markdown(slice);
2647 }2656 }
26482657
2649 2658
2650 function markdown(input) {2659 function markdown(input) {
2651 const raw_lines = input.split('\n'); // zig allows no '\r', so we don't need to split on CR2660 const raw_lines = input.split('\n'); // zig allows no '\r', so we don't need to split on CR
2652 2661