From 41e9a769e9b6dc45dbda75fad7509a5c554b2c67 Mon Sep 17 00:00:00 2001 From: Larpon Date: Thu, 7 Jan 2021 20:25:29 +0100 Subject: [PATCH] doc: fix README embedding (#7929) --- vlib/v/doc/doc.v | 27 +++------------------------ vlib/v/doc/utils.v | 2 +- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/vlib/v/doc/doc.v b/vlib/v/doc/doc.v index 8f4bbe10cf..4208ed6670 100644 --- a/vlib/v/doc/doc.v +++ b/vlib/v/doc/doc.v @@ -267,12 +267,7 @@ pub fn (mut d Doc) file_ast(file_ast ast.File) map[string]DocNode { if module_comment == '' { continue } - /* - if d.head.comment != '' { - d.head.comment += '\n' - } - */ - d.head.comments << preceeding_comments //+= module_comment + d.head.comments << preceeding_comments } continue } @@ -280,13 +275,7 @@ pub fn (mut d Doc) file_ast(file_ast ast.File) map[string]DocNode { // the accumulated comments were interspersed before/between the imports; // just add them all to the module comments: if d.with_head { - // import_comments := merge_comments(preceeding_comments) - /* - if d.head.comment != '' { - d.head.comment += '\n' - } - */ - d.head.comments << preceeding_comments //+= import_comments + d.head.comments << preceeding_comments } preceeding_comments = [] imports_section = false @@ -310,17 +299,7 @@ pub fn (mut d Doc) file_ast(file_ast ast.File) map[string]DocNode { } } if d.with_comments && (preceeding_comments.len > 0) { - // last_comment := contents[contents.len - 1].comment - // cmt := last_comment + '\n' + merge_doc_comments(preceeding_comments) - /* - mut cmt := merge_doc_comments(preceeding_comments) - len := node.name.len - // fixed-width symbol name at start of comment - if cmt.starts_with(node.name) && cmt.len > len && cmt[len] == ` ` { - cmt = '`${cmt[..len]}`' + cmt[len..] - } - */ - node.comments << preceeding_comments //= cmt + node.comments << preceeding_comments } preceeding_comments = [] if node.parent_name.len > 0 { diff --git a/vlib/v/doc/utils.v b/vlib/v/doc/utils.v index 0e80e4a396..095522c462 100644 --- a/vlib/v/doc/utils.v +++ b/vlib/v/doc/utils.v @@ -56,7 +56,7 @@ pub fn merge_doc_comments(comments []DocComment) string { // break } mut cmt_content := cmt.text.trim_left('\x01') - if cmt_content.len == cmt.text.len || cmt.is_multi { + if cmt.is_multi { // ignore /* */ style comments for now continue // if cmt_content.len == 0 {