Skip to content

Footer message that keeps replicating #787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shinyaohtani opened this issue Apr 10, 2020 · 4 comments · Fixed by #794
Closed

Footer message that keeps replicating #787

shinyaohtani opened this issue Apr 10, 2020 · 4 comments · Fixed by #794
Labels

Comments

@shinyaohtani
Copy link
Contributor

Even if a footer message has already been added to the file specified in config.base, if I execute the script to add a change log for the newly developed part, a footer message will be added one by one every time.

  • before
    This Changelog was automatically generated by...
  • after
    This Changelog was automatically generated by...
    This Changelog was automatically generated by...
  • after 2 times (keep replicating infinitely)
    This Changelog was automatically generated by...
    This Changelog was automatically generated by...
    This Changelog was automatically generated by...

Maybe, this code doesn't work:

log.gsub!(/#{credit_line}(\n)?/, "") # Remove old credit lines

  • Environment
    • macOS Catalina (10.15.4)
    • project: giturl
    • ruby: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
@shinyaohtani
Copy link
Contributor Author

shinyaohtani commented Apr 10, 2020

credit_line = "\n\n\\* *This..."

In order to find the exactly same expression, "*" should be escaped as "\*"

> "\\*".sub(/\\\*/,'ok')
=> "ok"

@olleolleolle
Copy link
Collaborator

olleolleolle commented Apr 10, 2020

@shinyaohtani Would you like to make a PR with a fix and a test?

Or, perhaps you have a set of reproduce steps, for someone who would like to provide a fix?

@shinyaohtani
Copy link
Contributor Author

@olleolleolle ok, I'll make PR.

@shinyaohtani
Copy link
Contributor Author

@olleolleolle I sent pull request about "replicating template messages". Would you please review when you have time?
PR: #794

olleolleolle added a commit that referenced this issue Apr 15, 2020
Header, footer and '\n' will be treated correctly

Issue: #787
- Stop generating headers and footers indefinitely, leaving only one right each time.
  - To find the exact same string as the key, the Regex key must be escaped with Regex.escape().
  - First I have been fixing only credit_line, but this framework should be applied not only to credit_line but also to header and frontmatter, so I changed header and frontmatter to be deleted once.
- Automatically remove only the automatically added '\n' and not remove any additional '\n' that may have been added manually by the user.
- specs for this issue is prepared.

- Modified require statements which are automatically added by "rspec-kickstarter"

Co-Authored-By: Olle Jonsson <olle.jonsson@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants