Merge pull request #2791 from ehuss/un-pub-unique-id
Move id_from_content private
This commit is contained in:
commit
534725cbb8
1 changed files with 2 additions and 7 deletions
|
|
@ -43,9 +43,7 @@ pub fn normalize_id(content: &str) -> String {
|
||||||
|
|
||||||
/// Generate an ID for use with anchors which is derived from a "normalised"
|
/// Generate an ID for use with anchors which is derived from a "normalised"
|
||||||
/// string.
|
/// string.
|
||||||
// This function should be made private when the deprecation expires.
|
fn id_from_content(content: &str) -> String {
|
||||||
#[deprecated(since = "0.4.16", note = "use unique_id_from_content instead")]
|
|
||||||
pub fn id_from_content(content: &str) -> String {
|
|
||||||
let mut content = content.to_string();
|
let mut content = content.to_string();
|
||||||
|
|
||||||
// Skip any tags or html-encoded stuff
|
// Skip any tags or html-encoded stuff
|
||||||
|
|
@ -67,10 +65,7 @@ pub fn id_from_content(content: &str) -> String {
|
||||||
/// Each ID returned will be unique, if the same `id_counter` is provided on
|
/// Each ID returned will be unique, if the same `id_counter` is provided on
|
||||||
/// each call.
|
/// each call.
|
||||||
pub fn unique_id_from_content(content: &str, id_counter: &mut HashMap<String, usize>) -> String {
|
pub fn unique_id_from_content(content: &str, id_counter: &mut HashMap<String, usize>) -> String {
|
||||||
let id = {
|
let id = id_from_content(content);
|
||||||
#[allow(deprecated)]
|
|
||||||
id_from_content(content)
|
|
||||||
};
|
|
||||||
|
|
||||||
// If we have headers with the same normalized id, append an incrementing counter
|
// If we have headers with the same normalized id, append an incrementing counter
|
||||||
let id_count = id_counter.entry(id.clone()).or_insert(0);
|
let id_count = id_counter.entry(id.clone()).or_insert(0);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue