Skip to content

Separate options for the module type prefix in IDs (anchors) and file names#34

Merged
msuchane merged 8 commits intomainfrom
no-id-prefixes-21
Oct 21, 2022
Merged

Separate options for the module type prefix in IDs (anchors) and file names#34
msuchane merged 8 commits intomainfrom
no-id-prefixes-21

Conversation

@msuchane
Copy link
Collaborator

Closes #21

@msuchane msuchane self-assigned this Oct 14, 2022
@msuchane msuchane requested review from Levi-Leah and mjahoda October 14, 2022 19:42
@msuchane
Copy link
Collaborator Author

msuchane commented Oct 14, 2022

Hi @mjahoda and @Levi-Leah,

Could you please test a new version of newdoc? It splits the prefix configuration by file name and ID (anchor), and by default, it uses the prefix in the file name but not in the ID (anchor).

How to test:

  1. Install the Rust toolchain at version 1.60 or later. Either install cargo from your distribution packages or use https://rustup.rs/.

  2. Compile and install the testing version of newdoc:

    $ cargo install --git https://github.com/redhat-documentation/newdoc.git --branch no-id-prefixes-21
    
  3. Generate files using newdoc and test the following options:

    • --no-file-prefixes: Disables the file-name prefix.
    • --anchor-prefixes: Enables the ID (anchor) prefix.
  4. Uninstall the testing version of newdoc:

    $ cargo uninstall newdoc
    

Thanks for your help!

@mjahoda
Copy link

mjahoda commented Oct 15, 2022

@msuchane Thank you for your great work. Just a nitpick to step 2 in the test instructions - there is a copy-paste error doubling the commands and the options.

All works as designed:

[INFO] ‣ File generated: ./proc_testing-defaults.adoc
[INFO]   include::<path>/proc_testing-defaults.adoc[leveloffset=+1]
$ newdoc -p "Testing no-prefixes" -C --no-file-prefixes
[INFO] ‣ File generated: ./testing-no-prefixes.adoc
[INFO]   include::<path>/testing-no-prefixes.adoc[leveloffset=+1]
$ newdoc -p "Testing anchor-prefixes" -C --anchor-prefixes
[INFO] ‣ File generated: ./proc_testing-anchor-prefixes.adoc
[INFO]   include::<path>/proc_testing-anchor-prefixes.adoc[leveloffset=+1]
$ grep "id=" *testing*.adoc
proc_testing-anchor-prefixes.adoc:[id="proc_testing-anchor-prefixes_{context}"]
proc_testing-defaults.adoc:[id="testing-defaults_{context}"]
testing-no-prefixes.adoc:[id="testing-no-prefixes_{context}"]```

Copy link

@mjahoda mjahoda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As described in #34 (comment), I verified the changes.

@msuchane
Copy link
Collaborator Author

Thanks, @mjahoda! For your review and also for discovering the copy-paste typo. After all the programming was done, my copy-paste strength apparently left me :-D

Copy link

@Levi-Leah Levi-Leah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected. LGTM!

@msuchane
Copy link
Collaborator Author

Thanks for your reviews. I'm merging the branch and I'll release the new version in a moment.

@msuchane msuchane merged commit ac0a81e into main Oct 21, 2022
@msuchane msuchane deleted the no-id-prefixes-21 branch October 21, 2022 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ID without a prefix by default

3 participants