Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Cannot convert correctly for references links #38

@aaranxu

Description

@aaranxu

When I put the current docs of the official Rust source, I found there were some incorrect results on references link that is [ref] style in the original book, such as some [references]s rather than [references][references]s occurred in the article primitive types.

I have looked up the src of the tool and found the issue was on the /src/helpers/adjust_reference_names.rs that could not dealt with all kinds of references links:

    let reference_link = Regex::new(r"(?x)
        \]\[                # This is a link to a reference
        (?P<id>.+?)         # The reference name
        \]
    ").unwrap();
...
        if reference_link.is_match(line) {
            let new_line = reference_link.replace_all(line, |matches: &Captures| {
                format!("][{prefix}--{id}]",
                    prefix = prefix,
                    id = matches.name("id").expect("no id in ref link")
                )
            });
            return initial + &new_line + "\n";
        }

The code just works on unique style of the references links.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions