diff options
author | Yuchen Pei <me@ypei.me> | 2021-07-01 12:35:30 +1000 |
---|---|---|
committer | Yuchen Pei <me@ypei.me> | 2021-07-01 12:35:30 +1000 |
commit | 661762ba8fd5fd685bfbe99473d7286efa85b381 (patch) | |
tree | cfad97238a7e8ce897c6e1d5f689b98fd284a4a8 | |
parent | 6c8e5849392cc2541bbdb84d43ce4be2d7fe4319 (diff) |
removed temporary scripts for the migration.
-rwxr-xr-x | convert_microposts.sh | 12 | ||||
-rwxr-xr-x | convert_microposts_standalone.sh | 11 | ||||
-rw-r--r-- | filter-standalone.hs | 39 | ||||
-rw-r--r-- | filter.hs | 41 | ||||
-rwxr-xr-x | mathjax-librejs.sh | 5 | ||||
-rwxr-xr-x | md2org.sh | 9 |
6 files changed, 0 insertions, 117 deletions
diff --git a/convert_microposts.sh b/convert_microposts.sh deleted file mode 100755 index 8df8a3f..0000000 --- a/convert_microposts.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -for md in $(ls ./microposts/*.md); do - base=$(basename $md) - fname="${base%%.*}" -# pandoc -s -f markdown -t org -o ./microposts/${fname}.org ./microposts/${md} - echo "pandoc -s -f markdown -t org --filter ./filter.hs --metadata filename=${fname} -o ./microposts/${fname}.org ${md}" - pandoc -s -f markdown -t org --filter ./filter.hs --metadata filename=${fname} -o ./microposts/${fname}.org ${md} -done - -rm ./microposts/microblog.org -f -cat ./microposts/*.org > ./microposts/microblog.org diff --git a/convert_microposts_standalone.sh b/convert_microposts_standalone.sh deleted file mode 100755 index b78b733..0000000 --- a/convert_microposts_standalone.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -for md in $(ls ./microposts/*.md); do - base=$(basename $md) - fname="${base%%.*}" -# pandoc -s -f markdown -t org -o ./microposts/${fname}.org ${md} - echo "pandoc -s -f markdown -t org --filter ./filter.hs --metadata filename=${fname} -o ./microposts/${fname}.org ${md}" - pandoc -s -f markdown -t org --filter ./filter-standalone.hs --metadata title=${fname} -o ./microposts/${fname}.org ${md} -# sed -i "s/:END:/&\n/" ./microposts/${fname}.org # add a new line before the content -done -sed -i 's/^\(#+date:\s\+\)\(.\{10\}\)/\1<\2>/' ./microposts/*.org # fix the dates diff --git a/filter-standalone.hs b/filter-standalone.hs deleted file mode 100644 index 8bd769d..0000000 --- a/filter-standalone.hs +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env runhaskell --- filter.hs -{-- -A filter to help convert a markdown file to an org file. -It does the following: -1. Remove all headings ---} -import Text.Pandoc.JSON -import Data.Text -import Data.Map.Strict - -main :: IO () -main = toJSONFilter filter'' - -filter'' :: Pandoc -> Pandoc -filter'' (Pandoc meta blocks) = - Pandoc meta (filter' <$> blocks) - -getFilename :: Meta -> Text -getFilename meta = - case lookupMeta (pack "filename") meta of - Just (MetaString s) -> s - _ -> pack "" - -makeInlines :: Text -> [Inline] -makeInlines s = [Str s] - -getFilenameInlines :: Meta -> [Inline] -getFilenameInlines = makeInlines . getFilename - -makeCustomId :: Text -> Attr -makeCustomId s = (pack "", [], [(pack "CUSTOM_ID", s)]) - -emptyAttr :: Attr -emptyAttr = (pack "", [], []) - -filter' :: Block -> Block -filter' (Header _ _ _) = Null -filter' x = x diff --git a/filter.hs b/filter.hs deleted file mode 100644 index 8db4980..0000000 --- a/filter.hs +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env runhaskell --- filter.hs -{-- -A filter to help convert a vimwiki file to an org file. -It does the following: -1. Remove metadata -2. Add filename or empty as a level three heading -3. Remove all other headings ---} -import Text.Pandoc.JSON -import Data.Text -import Data.Map.Strict - -main :: IO () -main = toJSONFilter filter'' - -filter'' :: Pandoc -> Pandoc -filter'' (Pandoc meta blocks) = - Pandoc (Meta {unMeta = Data.Map.Strict.empty}) ((Header 3 (makeCustomId $ getFilename meta) ((docDate meta) ++ [Str $ pack ": "] ++ (getFilenameInlines meta))) : (filter' <$> blocks)) - -getFilename :: Meta -> Text -getFilename meta = - case lookupMeta (pack "filename") meta of - Just (MetaString s) -> s - _ -> pack "" - -makeInlines :: Text -> [Inline] -makeInlines s = [Str s] - -getFilenameInlines :: Meta -> [Inline] -getFilenameInlines = makeInlines . getFilename - -makeCustomId :: Text -> Attr -makeCustomId s = (pack "", [], [(pack "CUSTOM_ID", s)]) - -emptyAttr :: Attr -emptyAttr = (pack "", [], []) - -filter' :: Block -> Block -filter' (Header _ _ _) = Null -filter' x = x diff --git a/mathjax-librejs.sh b/mathjax-librejs.sh deleted file mode 100755 index 592a15d..0000000 --- a/mathjax-librejs.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -sed -i 's/^\s*\*\s*Copyright/ * @licstart The following is the entire license notice for the \n * JavaScript code in this page.\n *\n&/' $1 - -sed -i 's/^\s*\*\// *\n * @licend The above is the entire license notice\n * for the JavaScript code in this page.\n&/' $1 diff --git a/md2org.sh b/md2org.sh deleted file mode 100755 index ef01b6d..0000000 --- a/md2org.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -dir=$1 -for file in $(ls $dir); do - base=$(basename $file) - name="${base%%.*}" - echo "pandoc -f markdown -t org -s -o $dir/$name.org $dir/$file" - pandoc -f markdown -t org -s -o $dir/$name.org $dir/$file -done |