|
| 1 | +#/bin/bash |
| 2 | + |
| 3 | +function create_target_dir(){ |
| 4 | + rm -Rf ${TARGET_DIR} |
| 5 | + mkdir -p ${TARGET_DIR}/docs |
| 6 | +} |
| 7 | + |
| 8 | +function copy_resources() { |
| 9 | + cp ./mkdocs.yml ${TARGET_DIR}/mkdocs.yml |
| 10 | + cp -r docs/images ${TARGET_DIR}/docs |
| 11 | + cp -r docs/stylesheets ${TARGET_DIR}/docs/stylesheets |
| 12 | +} |
| 13 | + |
| 14 | +function write_file(){ |
| 15 | + FILE=$1 |
| 16 | + echo "" >> ${TARGET_DIR}/docs/index.md |
| 17 | + sed -e 's/..\/image/image/g' docs/${FILE} | sed -e 's/✘/X/g' >> ${TARGET_DIR}/docs/index.md |
| 18 | +} |
| 19 | + |
| 20 | +function write_text(){ |
| 21 | + TEXT=$1 |
| 22 | + echo "" >> ${TARGET_DIR}/docs/index.md |
| 23 | + echo "${TEXT}" >> ${TARGET_DIR}/docs/index.md |
| 24 | +} |
| 25 | + |
| 26 | +function write_guidelines(){ |
| 27 | + DIR=$1 |
| 28 | + FIRST_HEADER=$2 |
| 29 | + for f in docs/${DIR}/g-*.md |
| 30 | + do |
| 31 | + echo "" >> ${TARGET_DIR}/docs/index.md |
| 32 | + sed -e "s|# |${FIRST_HEADER} |g" $f >> ${TARGET_DIR}/docs/index.md |
| 33 | + done |
| 34 | +} |
| 35 | + |
| 36 | +function convert_to_pdf(){ |
| 37 | + cd ${TARGET_DIR} |
| 38 | + mkdocs build |
| 39 | + cd site |
| 40 | + weasyprint index.html ../../plsql.pdf |
| 41 | +} |
| 42 | + |
| 43 | +TARGET_DIR=work-pdf |
| 44 | + |
| 45 | +create_target_dir |
| 46 | +copy_resources |
| 47 | +write_file "index.md" |
| 48 | +write_file "1-introduction/introduction.md" |
| 49 | +write_file "2-naming-conventions/naming-conventions.md" |
| 50 | +write_file "3-coding-style/coding-style.md" |
| 51 | +write_text "# Language Usage" |
| 52 | +write_text "## General" |
| 53 | +write_guidelines "4-language-usage/1-general" "###" |
| 54 | +write_text "## Numeric Data Types" |
| 55 | +write_text "### General" |
| 56 | +write_guidelines "4-language-usage/2-variables-and-types/1-general" "####" |
| 57 | +write_text "### Numeric Data Types" |
| 58 | +write_guidelines "4-language-usage/2-variables-and-types/2-numeric-data-types" "####" |
| 59 | +write_text "### Character Data Types" |
| 60 | +write_guidelines "4-language-usage/2-variables-and-types/3-character-data-types" "####" |
| 61 | +write_text "### Boolean Data Types" |
| 62 | +write_guidelines "4-language-usage/2-variables-and-types/4-boolean-data-types" "####" |
| 63 | +write_text "### Large Objects" |
| 64 | +write_guidelines "4-language-usage/2-variables-and-types/5-large-objects" "####" |
| 65 | +write_text "## DML & SQL" |
| 66 | +write_text "### General" |
| 67 | +write_guidelines "4-language-usage/3-dml-and-sql/1-general" "####" |
| 68 | +write_file "5-complexity-analysis/complexity-analysis.md" |
| 69 | +write_file "6-code-reviews/code-reviews.md" |
| 70 | +write_file "7-tool-support/tool-support.md" |
| 71 | +write_file "9-appendix/appendix.md" |
| 72 | +convert_to_pdf |
0 commit comments