feat: improved latex generator script
This commit is contained in:
parent
0efddc3457
commit
b17c8b97d4
@ -18,8 +18,12 @@ echo "Generating modified Markdown file..."
|
|||||||
#prefix every \ with a \
|
#prefix every \ with a \
|
||||||
sed -i -e 's/\\\\ *$/\\\\\\\\/g' "$NEWNAME"
|
sed -i -e 's/\\\\ *$/\\\\\\\\/g' "$NEWNAME"
|
||||||
|
|
||||||
# prefix every _ with an \
|
bat "$NEWNAME"
|
||||||
sed -i -e 's/_/\\_/g' "$NEWNAME"
|
|
||||||
|
# prefix every individual _ with an \
|
||||||
|
sed -i -e 's/_([^_])/\\_\1/g' "$NEWNAME"
|
||||||
|
|
||||||
|
bat "$NEWNAME"
|
||||||
|
|
||||||
# remove tags section at the front
|
# remove tags section at the front
|
||||||
sed -i -e 's/tags:.*//g' "$NEWNAME"
|
sed -i -e 's/tags:.*//g' "$NEWNAME"
|
||||||
@ -28,11 +32,32 @@ sed -i -e 's/---$//g' "$NEWNAME"
|
|||||||
#remove markdown links
|
#remove markdown links
|
||||||
sed -i -e 's/\[.*\](.*)//g' "$NEWNAME"
|
sed -i -e 's/\[.*\](.*)//g' "$NEWNAME"
|
||||||
|
|
||||||
# remove html tags
|
# remove code block lang declaration
|
||||||
|
sed -i -e 's/```.*/```/g' "$NEWNAME"
|
||||||
|
|
||||||
|
bat "$NEWNAME"
|
||||||
|
|
||||||
|
# add newlines around code block declaration
|
||||||
|
sed -i -e 's/``` *$/\n```\n/g' "$NEWNAME"
|
||||||
|
|
||||||
|
bat "$NEWNAME"
|
||||||
|
|
||||||
|
# replace special HTML tags
|
||||||
sed -i -e 's/<div id="page-break-after"\/>/\\pagebreak/g' "$NEWNAME"
|
sed -i -e 's/<div id="page-break-after"\/>/\\pagebreak/g' "$NEWNAME"
|
||||||
|
sed -i -e 's/<br>/\\newline/g' "$NEWNAME"
|
||||||
|
|
||||||
|
# remove html tags
|
||||||
sed -i -e 's/<[a-zA-Z ]*>\(.*\)<\/[a-zA-Z =]*>/\1/g' "$NEWNAME"
|
sed -i -e 's/<[a-zA-Z ]*>\(.*\)<\/[a-zA-Z =]*>/\1/g' "$NEWNAME"
|
||||||
sed -i -e 's/<.*\/>//g' "$NEWNAME"
|
sed -i -e 's/<.*\/>//g' "$NEWNAME"
|
||||||
|
sed -i -e 's/<.*>//g' "$NEWNAME"
|
||||||
|
|
||||||
|
# replace arrows
|
||||||
|
sed -i -e 's/->/$\\rightarrow$/g' "$NEWNAME"
|
||||||
|
sed -i -e 's/<-/$\\leftarrow$/g' "$NEWNAME"
|
||||||
|
sed -i -e 's/=>/$\\Rightarrow$/g' "$NEWNAME"
|
||||||
|
sed -i -e 's/<=/$\\Leftarrow$/g' "$NEWNAME"
|
||||||
|
|
||||||
|
bat "$NEWNAME"
|
||||||
|
|
||||||
echo "Generating LaTeX file..."
|
echo "Generating LaTeX file..."
|
||||||
echo "\documentclass[a4paper, 11pt]{article}
|
echo "\documentclass[a4paper, 11pt]{article}
|
||||||
|
Loading…
Reference in New Issue
Block a user