Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add newline flag #39

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Several options are available via command-line switches. Type `bash bg2obs.sh -h
| `-e` | Include editorial headers (default is Off)|
| `-a` | Create an alias in the YAML front matter with a more user-friendly chapter title (e.g., "Genesis 1") (default is Off)|
| `-i` | Show progress information while the script is running (i.e. "verbose" mode) (default is Off)|
| `-n` | Start chapters and verses on a new line that starts with an H5 or H6 heading (default is Off)|
| `-c` | Include *inline* navigation for the [breadcrumbs](https://github.com/SkepticMystic/breadcrumbs) plugin (e.g. 'up', 'next','previous') (default is Off)|
| `-y` | Include navigation for the breadcrumbs plugin in the *frontmatter* (YAML) (default is Off)|
| `-h` | Display help |
Expand Down
30 changes: 18 additions & 12 deletions bg2obs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,23 @@ boldwords="false" # Set words of Jesus in bold
headers="false" # Include editorial headers
aliases="false" # Create an alias in the YAML front matter for each chapter title
verbose="false" # Show download progress for each chapter
newline="false" # Start chapters and verses on a new line
breadcrumbs_inline="false" # Print breadcrumbs in the file
breadcrumbs_yaml="false" # Print breadcrumbs in the YAML

# Process command line args
while getopts 'v:beaicy?h' c
while getopts 'v:beaincy?h' c
do
case $c in
v) translation=$OPTARG ;;
b) boldwords="true" ;;
e) headers="true" ;;
a) aliases="true" ;;
i) verbose="true" ;;
n) newline="true" ;;
c) breadcrumbs_inline="true" ;;
y) breadcrumbs_yaml="true" ;;
h|?) usage ;;
h|?) usage ;;
esac
done

Expand Down Expand Up @@ -168,14 +170,18 @@ filename=${export_prefix}$chapter # Setting the filename
fi
fi

if [[ $boldwords = "true" && $headers = "false" ]] ; then
text=$(ruby bg2md.rb -e -c -b -f -l -r -v "${translation}" "${book} ${chapter}") # This calls the 'bg2md_mod' script
elif [[ $boldwords = "true" && $headers = "true" ]] ; then
text=$(ruby bg2md.rb -c -b -f -l -r -v "${translation}" "${book} ${chapter}") # This calls the 'bg2md_mod' script
elif [[ $boldwords = "false" && $headers = "true" ]] ; then
text=$(ruby bg2md.rb -e -c -f -l -r -v "${translation}" "${book} ${chapter}") # This calls the 'bg2md_mod' script
else
text=$(ruby bg2md.rb -e -c -f -l -r -v "${translation}" "${book} ${chapter}") # This calls the 'bg2md_mod' script
if [[ $boldwords = "true" && $headers = "false" && $newline = "false" ]] ; then
text=$(ruby bg2md.rb -e -c -b -f -r -v "${translation}" "${book} ${chapter}") # This calls the 'bg2md_mod' script
elif [[ $boldwords = "true" && $headers = "true" && $newline = "false" ]] ; then
text=$(ruby bg2md.rb -c -b -f -r -v "${translation}" "${book} ${chapter}") # This calls the 'bg2md_mod' script
elif [[ $boldwords = "false" && $headers = "true" && $newline = "false" ]] ; then
text=$(ruby bg2md.rb -e -c -f -r -v "${translation}" "${book} ${chapter}") # This calls the 'bg2md_mod' script
elif [[ $boldwords = "true" && $headers = "false" && $newline = "true" ]] ; then
text=$(ruby bg2md.rb -e -c -b -f -l -r -v "${translation}" "${book} ${chapter}") # This calls the 'bg2md_mod' script
elif [[ $boldwords = "true" && $headers = "true" && $newline = "true" ]] ; then
text=$(ruby bg2md.rb -c -b -f -l -r -v "${translation}" "${book} ${chapter}") # This calls the 'bg2md_mod' script
elif [[ $boldwords = "false" && $headers = "true" && $newline = "true" ]] ; then
text=$(ruby bg2md.rb -e -c -f -l -r -v "${translation}" "${book} ${chapter}") # This calls the 'bg2md_mod' script
fi


Expand Down Expand Up @@ -222,7 +228,7 @@ alias="Aliases: [${book} ${chapter}]" # Add other aliases or 'Tags:' here if des
elif [ ${aliases} == "false" ] && [ ${breadcrumbs_yaml} == "true" ]; then
yaml="${yaml_start}${bc_yaml}${yaml_end}"
fi


export="${yaml}${export}"
# Export
Expand Down Expand Up @@ -269,4 +275,4 @@ find . -name "*.md" -print0 | xargs -0 perl -pi -e 's/\<crossref intro.*crossref

if [[ $verbose = "true" ]]; then
echo "Download complete. Markdown files ready for Obsidian import."
fi
fi