-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add flag Find all Markdown files, Ignore ts/te tags, Automatically at the end/head of the file. #115
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
Conversation
--auto Ignore ts/te tags, Automatically at the end/head of the file --head The TOC is generated in the header of the file, requires --auto
ekalinin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch!
Could you, please, check my comments.
And one more thing: could you add some tests for a new functionality?
| # | ||
|
|
||
| gh_toc_version="0.7.0" | ||
| gh_toc_version="0.8.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave current value for now
| echo "yes";; | ||
| *) | ||
| echo "no";; | ||
| https* | http*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you, please, revert these changes?
Thus, total diff will be much smaller and easier to review.
Thanks.
| exit 1 | ||
| fi | ||
| local toc=`echo "$rawhtml" | gh_toc_grab "$gh_src_copy"` | ||
| local toc=$(echo "$rawhtml" | gh_toc_grab "$gh_src_copy") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point to change ` to $(?
Without this change total diff will be much simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Find all Markdown files for non-hidden folders | ||
| # | ||
| all_md_filename="" | ||
| gh_all_md_filename() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using globals is a bad pattern.
Could you, please, improve gh_all_md_filename and just return the result from the function (without using global variable all_md_filename).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right
| local ts="<\!--ts-->" | ||
| local te="<\!--te-->" | ||
| local dt=`date +'%F_%H%M%S'` | ||
| local dt=$(date +'%F_%H%M%S') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And again :) what's the point to change ` to $(?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| local ext=".orig.${dt}" | ||
| local toc_path="${gh_src}.toc.${dt}" | ||
| local toc_footer="<!-- Added by: `whoami`, at: `date` -->" | ||
| local toc_footer="<!-- Added by: $(whoami), at: $(date) -->" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And again :) what's the point to change ` to $(?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # clear old TOC | ||
| sed -i${ext} "/${ts}/,/${te}/{//!d;}" "$gh_src" | ||
| # create toc file | ||
| echo "${toc}" > "${toc_path}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please, revert back the origin formatting?
Without this change total diff will be much simpler.
| echo "os: `lsb_release -d | cut -f 2`" | ||
| echo "kernel: `cat /proc/version`" | ||
| echo "shell: `$SHELL --version`" | ||
| echo "os: $(lsb_release -d | cut -f 2)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And again :) what's the point to change ` to $(?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
I could revert to these changes, but this project seems to need a shell style checker |
--all Find all Markdown files for non-hidden folders
--auto Ignore ts/te tags, Automatically at the end/head of the file
--head The TOC is generated in the header of the file, requires --auto