Cleanup add_doc
This commit is contained in:
parent
e94078cc9c
commit
384582aeba
|
@ -50,17 +50,17 @@ fn add_doc(
|
||||||
section_id: &Option<String>,
|
section_id: &Option<String>,
|
||||||
items: &[&str],
|
items: &[&str],
|
||||||
) {
|
) {
|
||||||
let doc_ref = if let &Some(ref id) = section_id {
|
let url = if let &Some(ref id) = section_id {
|
||||||
Cow::Owned(format!("{}#{}", anchor_base, id))
|
Cow::Owned(format!("{}#{}", anchor_base, id))
|
||||||
} else {
|
} else {
|
||||||
Cow::Borrowed(anchor_base.into())
|
Cow::Borrowed(anchor_base)
|
||||||
};
|
};
|
||||||
let doc_ref = utils::collapse_whitespace(doc_ref.trim());
|
let url = utils::collapse_whitespace(url.trim());
|
||||||
let key = doc_urls.len();
|
let doc_ref = doc_urls.len().to_string();
|
||||||
doc_urls.push(doc_ref.into());
|
doc_urls.push(url.into());
|
||||||
|
|
||||||
let items = items.iter().map(|&x| utils::collapse_whitespace(x.trim()));
|
let items = items.iter().map(|&x| utils::collapse_whitespace(x.trim()));
|
||||||
index.add_doc(&key.to_string(), items);
|
index.add_doc(&doc_ref, items);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Renders markdown into flat unformatted text and adds it to the search index.
|
/// Renders markdown into flat unformatted text and adds it to the search index.
|
||||||
|
|
Loading…
Reference in New Issue