Skip to content

Instantly share code, notes, and snippets.

@grabear
Forked from hugorodgerbrown/md_to_rst.sh
Last active April 17, 2017 01:16
Show Gist options
  • Save grabear/4da9fba78f70bff769c028ac1b51c9ae to your computer and use it in GitHub Desktop.
Save grabear/4da9fba78f70bff769c028ac1b51c9ae to your computer and use it in GitHub Desktop.

Revisions

  1. grabear renamed this gist Apr 17, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. grabear revised this gist Apr 17, 2017. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions md_to_rst.sh
    Original file line number Diff line number Diff line change
    @@ -1,21 +1,21 @@
    # This script was created to convert a directory full
    # of markdown files into rst equivalents. It uses
    # of Word Document (.docx) files into .md equivalents. It uses
    # pandoc to do the conversion.
    #
    # 1. Install pandoc from http://johnmacfarlane.net/pandoc/
    # 2. Copy this script into the directory containing the .md files
    # 3. Ensure that the script has execute permissions
    # 4. Run the script
    #

    # By default this will keep the original .md file

    FILES=*.md
    FILES=*.docx
    for f in $FILES
    do
    # extension="${f##*.}"
    filename="${f%.*}"
    echo "Converting $f to $filename.rst"
    `pandoc $f -t rst -o $filename.rst`
    echo "Converting $f to $filename.md"
    `pandoc $f -t markdown -o $filename.md`
    # uncomment this line to delete the source file.
    # rm $f
    done
  3. @hugorodgerbrown hugorodgerbrown revised this gist Apr 5, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion md_to_rst.sh
    Original file line number Diff line number Diff line change
    @@ -12,9 +12,9 @@
    FILES=*.md
    for f in $FILES
    do
    echo "Processing $f file..."
    # extension="${f##*.}"
    filename="${f%.*}"
    echo "Converting $f to $filename.rst"
    `pandoc $f -t rst -o $filename.rst`
    # uncomment this line to delete the source file.
    # rm $f
  4. @hugorodgerbrown hugorodgerbrown revised this gist Apr 5, 2013. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions md_to_rst.sh
    Original file line number Diff line number Diff line change
    @@ -13,9 +13,8 @@ FILES=*.md
    for f in $FILES
    do
    echo "Processing $f file..."
    extension="${f##*.}"
    # extension="${f##*.}"
    filename="${f%.*}"
    # take action on each file. $f store current file name
    `pandoc $f -t rst -o $filename.rst`
    # uncomment this line to delete the source file.
    # rm $f
  5. @hugorodgerbrown hugorodgerbrown revised this gist Apr 5, 2013. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions md_to_rst.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,13 @@
    # This script was created to convert a directory full
    # of markdown files into rst equivalents. It uses
    # pandoc to do the conversion.
    #
    # 1. Install pandoc from http://johnmacfarlane.net/pandoc/
    # 2. Copy this script into the directory containing the .md files
    # 3. Ensure that the script has execute permissions
    # 4. Run the script
    #
    # By default this will keep the original .md file

    FILES=*.md
    for f in $FILES
    @@ -10,4 +17,6 @@ do
    filename="${f%.*}"
    # take action on each file. $f store current file name
    `pandoc $f -t rst -o $filename.rst`
    # uncomment this line to delete the source file.
    # rm $f
    done
  6. @hugorodgerbrown hugorodgerbrown revised this gist Apr 5, 2013. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions md_to_rst.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    # This script was created to convert a directory full
    # of markdown files into rst equivalents. It uses
    # pandoc to do the conversion.

    FILES=*.md
    for f in $FILES
    do
  7. @hugorodgerbrown hugorodgerbrown created this gist Apr 5, 2013.
    9 changes: 9 additions & 0 deletions md_to_rst.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    FILES=*.md
    for f in $FILES
    do
    echo "Processing $f file..."
    extension="${f##*.}"
    filename="${f%.*}"
    # take action on each file. $f store current file name
    `pandoc $f -t rst -o $filename.rst`
    done