GitBucket
Pull requests
Issues
Snippets
Sign in
takane
/
maketoc.sh
Fork
0
Created at Wed Jan 25 21:41:33 JST 2023
Download ZIP
HTTP
Embed
Embed this snippet in your website.
HTTP
Clone with Git using the repository's web address.
Code
Revision
Forks
takane
revised this
on 26 Jan 2023
86f7b63
maketoc.sh
#!/bin/bash echo " <style> h2:before {content:none;}</style> ## 目次 <dl class=\"toc\">" pdfgrep -n '(^第[0-9]章)|([0-9]{1,}\.){2,}|^参考|^謝辞|^付録' $1 |grep '^[0-9]*:[^ ]'|awk -F: ' { if ($2 ~ /([0-9]{1,}\.){3}/) { print "<div><dt class=\"depth-3\">",$2, "</dt><dd>",$1,"</dd></div>" } else if ($2 ~ /([0-9]{1,}\.){2}/) { print "<div><dt class=\"depth-2\">",$2, "</dt><dd>",$1,"</dd></div>" } else { print "<div><dt>",$2, "</dt><dd>",$1,"</dd></div>" } }' echo '</dl>'
#!/bin/bash echo " <style> h2:before {content:none;}</style> ## 目次 <dl class=\"toc\">" pdfgrep -n '(^第[0-9]章)|([0-9]\.){2,}|^参考|^謝辞|^付録' $1 |grep '^[0-9]*:[^ ]'|awk -F: ' { if ($2 ~ /([0-9]\.){3}/) { print "<div><dt class=\"depth-3\">",$2, "</dt><dd>",$1,"</dd></div>" } else if ($2 ~ /([0-9]\.){2}/) { print "<div><dt class=\"depth-2\">",$2, "</dt><dd>",$1,"</dd></div>" } else { print "<div><dt>",$2, "</dt><dd>",$1,"</dd></div>" } }' echo '</dl>'
takane
revised this
on 25 Jan 2023
No changes.
b2391e6
takane
revised this
on 25 Jan 2023
No changes.
36f8204
takane
revised this
on 25 Jan 2023
No changes.
a0c0edd
takane
revised this
on 25 Jan 2023
b12d0c5
maketoc.sh
#!/bin/bash echo " <style> h2:before {content:none;}</style> ## 目次 <dl class=\"toc\">" pdfgrep -n '(^第[0-9]章)|([0-9]\.){2,}|^参考|^謝辞|^付録' $1 |grep '^[0-9]*:[^ ]'|awk -F: ' { if ($2 ~ /([0-9]\.){3}/) { print "<div><dt class=\"depth-3\">",$2, "</dt><dd>",$1,"</dd></div>" } else if ($2 ~ /([0-9]\.){2}/) { print "<div><dt class=\"depth-2\">",$2, "</dt><dd>",$1,"</dd></div>" } else { print "<div><dt>",$2, "</dt><dd>",$1,"</dd></div>" } }' echo '</dl>'