1
0
mirror of https://github.com/RyanGreenup/cadmus.git synced 2025-08-21 05:11:32 +02:00

tools webtitle now uses CLIP_IN #1

This commit is contained in:
ryangreenup
2020-07-24 01:12:31 +10:00
parent bdb1fc9e15
commit b515f47ae8
2 changed files with 13 additions and 24 deletions

View File

@@ -295,7 +295,7 @@ CadmusTools () {
case "$1" in case "$1" in
new) shift; makeNewNote "${@}" && exit 0 new) shift; makeNewNote "${@}" && exit 0
;; ;;
webtitle) shift; "${script_dir}/tools/PrintWebTitle.sh" webtitle) shift; "${script_dir}/tools/PrintWebTitle.sh" "$(CLIP_OUT)" | CLIP_IN
;; ;;
backlinks) shift; "${script_dir}/tools/List-Backlinks.sh" "${NOTES_DIR}" ${@:-} && exit 0 backlinks) shift; "${script_dir}/tools/List-Backlinks.sh" "${NOTES_DIR}" ${@:-} && exit 0
;; ;;

View File

@@ -32,17 +32,7 @@ if [ "$1" == "-h" ]; then
fi fi
if [[ "$1" == *-m* ]]; then >&2 echo "
echo "Will Export as markdown Format"
type="md"
elif [[ "$1" == *-o* ]]; then
echo "Will Export as Org Format"
type="org"
elif [[ "$1" == *-l* ]]; then
echo "Will Export as LaTeX Format"
type="latex"
else
echo "
Please Specify an export Format Please Specify an export Format
@@ -58,15 +48,15 @@ else
if [[ $type == m ]]; then if [[ $type == m ]]; then
echo "" echo ""
echo "Will Export as markdown Format" >&2 echo "Will Export as markdown Format"
type="md" type="md"
elif [[ $type == o ]]; then elif [[ $type == o ]]; then
echo "" >&2 echo ""
echo "Will Export as Org Format" >&2 echo "Will Export as Org Format"
type="org" type="org"
elif [[ $type == l ]]; then elif [[ $type == l ]]; then
echo "" >&2 echo ""
echo "Will Export as LaTeX Format" >&2 echo "Will Export as LaTeX Format"
type="latex" type="latex"
else else
echo " echo "
@@ -77,12 +67,11 @@ else
exit 0 exit 0
fi fi
fi
# echo "The chosen format is $type" # To debug var assignment # echo "The chosen format is $type" # To debug var assignment
### Take the link Variable ### Take the link Variable
arglink=$(xclip -o -selection clipboard) arglink="${1}"
#### Print the Link #### Print the Link
@@ -94,7 +83,7 @@ ORANGE='\033[0;33m'
NC='\033[0m' # No Color NC='\033[0m' # No Color
#printf "I ${BLUE}love${NC} Stack Overflow\n" #printf "I ${BLUE}love${NC} Stack Overflow\n"
printf " >&2 printf "
The Chosen Link is: The Chosen Link is:
@@ -106,7 +95,7 @@ title=$(wget -qO- $arglink |
perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)\s*<\/title/si' | perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)\s*<\/title/si' |
recode html..) recode html..)
echo $title >&2 echo $title
### Return the Appropriate Ouput ### Return the Appropriate Ouput
@@ -117,7 +106,7 @@ elif [[ $type == org ]]; then
elif [[ $type == latex ]]; then elif [[ $type == latex ]]; then
outputlink="\href{$arglink}{$title}" outputlink="\href{$arglink}{$title}"
else else
echo "the variable \$type doesn't match what was expected >&2 echo "the variable \$type doesn't match what was expected
despite correct input, this is a bug in the program despite correct input, this is a bug in the program
" "
exit 1 exit 1
@@ -126,10 +115,10 @@ fi
### Copy the link to the clipboard ### Copy the link to the clipboard
echo $outputlink | xclip -selection clipboard echo $outputlink
printf "The following link has been put in the clipboard: >&2 printf "The following link has been put in the clipboard:
${ORANGE} $outputlink \n" ${ORANGE} $outputlink \n"