doc: fix README embedding (#7929)

pull/7952/head
Larpon 2021-01-07 20:25:29 +01:00 committed by GitHub
parent af1d28dee7
commit 41e9a769e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 25 deletions

View File

@ -267,12 +267,7 @@ pub fn (mut d Doc) file_ast(file_ast ast.File) map[string]DocNode {
if module_comment == '' { if module_comment == '' {
continue continue
} }
/* d.head.comments << preceeding_comments
if d.head.comment != '' {
d.head.comment += '\n'
}
*/
d.head.comments << preceeding_comments //+= module_comment
} }
continue 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; // the accumulated comments were interspersed before/between the imports;
// just add them all to the module comments: // just add them all to the module comments:
if d.with_head { if d.with_head {
// import_comments := merge_comments(preceeding_comments) d.head.comments << preceeding_comments
/*
if d.head.comment != '' {
d.head.comment += '\n'
}
*/
d.head.comments << preceeding_comments //+= import_comments
} }
preceeding_comments = [] preceeding_comments = []
imports_section = false 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) { if d.with_comments && (preceeding_comments.len > 0) {
// last_comment := contents[contents.len - 1].comment node.comments << preceeding_comments
// 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
} }
preceeding_comments = [] preceeding_comments = []
if node.parent_name.len > 0 { if node.parent_name.len > 0 {

View File

@ -56,7 +56,7 @@ pub fn merge_doc_comments(comments []DocComment) string {
// break // break
} }
mut cmt_content := cmt.text.trim_left('\x01') 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 // ignore /* */ style comments for now
continue continue
// if cmt_content.len == 0 { // if cmt_content.len == 0 {