{"action":"closed","issue":{"url":"https://api.github.com/repos/suchow/Dissertate/issues/14","labels_url":"https://api.github.com/repos/suchow/Dissertate/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/suchow/Dissertate/issues/14/comments","events_url":"https://api.github.com/repos/suchow/Dissertate/issues/14/events","html_url":"https://github.com/suchow/Dissertate/issues/14","id":26754655,"number":14,"title":"build.command meh","user":{"login":"X4","id":84343,"avatar_url":"https://avatars.githubusercontent.com/u/84343?v=3","gravatar_id":"","url":"https://api.github.com/users/X4","html_url":"https://github.com/X4","followers_url":"https://api.github.com/users/X4/followers","following_url":"https://api.github.com/users/X4/following{/other_user}","gists_url":"https://api.github.com/users/X4/gists{/gist_id}","starred_url":"https://api.github.com/users/X4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/X4/subscriptions","organizations_url":"https://api.github.com/users/X4/orgs","repos_url":"https://api.github.com/users/X4/repos","events_url":"https://api.github.com/users/X4/events{/privacy}","received_events_url":"https://api.github.com/users/X4/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-02-02T04:56:02Z","updated_at":"2016-01-18T04:32:13Z","closed_at":"2016-01-18T04:32:13Z","body":"I made this a few months ago. Take what you can, it's all yours.\r\nDon't know why you ran sed and I broke here back then, so I commented it out. You can merge it with your current stuff, if you want. No obligations, you can dump this also, if it's not of use. It's still a good day :)\r\nActually, you can use debug, error, success etc. from here: https://github.com/spf13/spf13-vim/blob/3.0/bootstrap.sh too, if you want. That's a style I usually follow to get my scripts cleaner. Also why \"sh\", almost every OS has bash or even zsh.\r\n\r\n```bash\r\n#!/bin/sh\r\ndebug=''\r\nnolog=''\r\nbibtex='bibtex'\r\nlatex='xelatex'\r\n\r\nif [[ $debug -eq \"1\" ]]; then\r\n\tnolog=\" 2>/dev/null\"\r\n\tnonstop=\"-interaction=nonstopmode\"\r\n\tlatex=\"$latex $nonstop\"\r\nfi\r\nset_basedir() {\r\n  BASEDIR=$(dirname $0)\r\n  cd $BASEDIR\r\n  cd ../chapters\r\n}\r\n\r\n# convert all .md files in the chapters directory to .docx\r\ncreate_docx() {\r\n  for i in *.md ; do\r\n\r\n    # generate Word file\r\n    filename_wd=${i/%???/}.docx\r\n    pandoc $i \\\r\n           --from=markdown+tex_math_dollars+tex_math_single_backslash+implicit_figures \\\r\n           --to=docx \\\r\n           --reference-docx=\"derivatives/word/style.docx\" \\\r\n           --bibliography=\"references.bib\" \\\r\n           -o derivatives/word/$filename_wd\r\n\r\n  done\r\n}\r\n\r\n# convert all .md files in the chapters directory to .tex\r\ncreate_tex() {\r\n  for i in *.md ; do\r\n\r\n    filename_tex=${i/%???/}.tex\r\n    pandoc $i \\\r\n\t  --from=markdown+tex_math_dollars+tex_math_single_backslash+implicit_figures \\\r\n\t  --to=latex \\\r\n\t  --latex-engine=\"$latex\"\\\r\n\t  --chapters \\\r\n\t  --bibliography=\"references.bib\" \\\r\n\t  --natbib \\\r\n\t  -o derivatives/tex/$filename_tex\r\n  done\r\n}\r\n\r\ncleanup_tex() {\r\n  cd derivatives/tex/\r\n  for i in *.tex ; do\r\n  pwd\r\n    echo \"mv $i .$i\"\r\n    echo \"awk -f .tst.awk .$i > \t\t\t\t\t\t\t   $i $nolog\"\r\n    sed -i='' 's/\\(\\\\\\includegraphics{\\)\\([^}]*\\)\\(}\\)/\\\\\\makebox[\\\\\\textwidth]{\\1\\2\\3}/g' $i $nolog\r\n    #sed -i '' 's/\\\\\\includegraphics{/\\\\\\makebox[\\\\\\textwidth][c]{\\\\\\includegraphics{/g'   $i $nolog\r\n    #sed -i '' 's/\\\\\\caption{/}\\\\\\caption{/g' \t\t\t\t\t\t   $i $nolog\r\n    #rm .$i\r\n  done\r\n  cd ../..\r\n}\r\n\r\n#convert  all .md in frontmatter folder\r\ncreate_frontmatter() {\r\n  cd ../frontmatter\r\n\r\n  for i in *.md ; do\r\n    filename_tex=${i/%???/}.tex\t\t$nolog\r\n    pandoc -o $filename_tex $i\t\t$nolog\r\n  done\r\n\r\n  for i in *.tex ; do\r\n    mv $i .$i\r\n    awk -f .tst.awk .$i > $i\t\t$nolog\r\n    rm .$i\r\ndone\r\n}\r\n\r\ncompile() {\r\n  cd ..\r\n  $latex  dissertation\t\t\t$nolog\r\n  $bibtex bibtex dissertation\t\t$nolog\r\n  $latex  dissertation\t\t\t$nolog\r\n  $latex  dissertation\t\t\t$nolog\r\n}\r\n\r\n\r\ncleanup() {\r\n  # hide the log\r\n  mv \"dissertation.log\" \".logged\"\r\n\r\n  # kill temp files\r\n  rm \"./frontmatter/thanks.tex\"\r\n  rm \"./frontmatter/abstract.tex\"\r\n  rm \"./frontmatter/dedication.tex\"\r\n  rm \"./frontmatter/personalize.tex\"\r\n\r\n  # delete all the junk files\r\n  find . -name \"*.log\" -exec rm -rf {} \\;\r\n  find . -name \"*.aux\" -exec rm -rf {} \\;\r\n  find . -name \"*.toc\" -exec rm -rf {} \\;\r\n  find . -name \"*.blg\" -exec rm -rf {} \\;\r\n  find . -name \"*.bbl\" -exec rm -rf {} \\;\r\n  find . -name \"*.out\" -exec rm -rf {} \\;\r\n  find . -name \"*.brf\" -exec rm -rf {} \\;\r\n  find . -name \"*.tex-e\" -exec rm -rf {} \\;\r\n  find . -name \"*.lof\" -exec rm -rf {} \\;\r\n  find . -name \"*.lot\" -exec rm -rf {} \\;\r\n  find . -name \"*.loa\" -exec rm -rf {} \\;\r\n}\r\n\r\n######################## MAIN()\r\n  set_basedir\r\n  create_docx\r\n  create_tex\r\n  cleanup_tex\r\n  create_frontmatter\r\n  compile\r\n  cleanup\r\n```"}}