1
0

updated pandoc.sh

This commit is contained in:
notnull 2019-01-30 00:44:03 -08:00
parent 41136b92c6
commit 3954bfff8e
2 changed files with 17 additions and 24 deletions

View File

@ -154,3 +154,6 @@ C-h a to search for commands
tiling window: C-x [1..3]
C-k cut C-y paste
show only headlines: navigate to first heading and do C-c C-k
[[~/src/dox/docs/org/emacs.org][emacs goodies]]
* IDEA How to turn IDEA into a recognized keyword?
^^^ like this; also it can be done globally, that's a choice to be made.

View File

@ -1,14 +1,19 @@
#!/bin/bash
# set root path here? (currently this script is in script/, so org/ is ../)
# another 'trick' to fix the path is
dir=$(dirname $0/..)
# or
cd $(dirname $0/..) # $0 contains the full path to the script
# -s makes the doc a standalone document instead of a snippet
for doc in org/*.org
do
# this will return a list of files like 'org/somefile.org'
# to only get the filename we could enter the folder or
# use sed to replace it by regex or use basename.
# This will return a list of files like 'org/somefile.org'.
# To only get the filename we use sed and use basename.
filename=$(basename $doc) # we want to get rid of .org
nosuffix=$(echo "$filename"|sed -E "s/\.org$//")
# this looks terrible, i know. -E makes it POSIX compatible
# -E makes it POSIX compatible
# $ locks it to the end, ^ to the beginning
# * . ( ) { } [ ] need to be escaped with \
htmlfile="html/$nosuffix.html"
@ -19,28 +24,13 @@ do
sed -E "s/(<\/title>)/\1\n <link rel=\"stylesheet\" type=\"text\/css\" href=\"css\/style.css\">/" | \
sed -E "s/(<body>)/\1\n<div class=\"container\">\n/" | \
sed -E "s/(<\/body>)/\n<\/div>\n\1>/" > $htmlfile
# The Skeleton template requires that everything is wrapped in a
# div class="container".
pandoc -s $doc -o md/$nosuffix.md
# lets try!
# after this, I would like to do a bit of styling, but not sure what
# that looks like yet. maybe done in CSS instead .
# search and replace? it depends on how the CSS is.
# The Skeleton template requires that everything is wrapped in a
# div class="container" for example, but we could put the container
# styling on body instaed. etc. Whatever has the least overhead.
done # thanks emacs!
done
# one time only
pandoc org/README.org -o ./README.md
# one more thing: we need to write the link to the css stylesheet... one sec
# fi!
pandoc org/index.org -o ./index.html