Refactor code in qsgen2 script
This commit refactors the code in the qsgen2 script. It fixes the assignment of the variable by using the correct syntax for capturing the match in the regular expression. It also fixes the assignment of the variable in the function. These changes ensure that the script works correctly with both the native and markdown generators.
This commit is contained in:
parent
b615627436
commit
30c99c11b9
6
qsgen2
6
qsgen2
@ -511,7 +511,8 @@ function _pages() {
|
|||||||
if (${debug}) _msg debug "_pages: Finding page_title"
|
if (${debug}) _msg debug "_pages: Finding page_title"
|
||||||
if [[ ${generator} == "native" ]]; then
|
if [[ ${generator} == "native" ]]; then
|
||||||
# Use Zsh built in functions to find page_title
|
# Use Zsh built in functions to find page_title
|
||||||
[[ "${page_content}" =~ ^#title=(.*) ]] && local page_title=$match[1]
|
[[ "${page_content}" =~ ^#title=(.*) ]]; then
|
||||||
|
local page_title=$match[1]
|
||||||
#local page_title=$( echo ${page_content} | head -2 | grep \#title | cut -d= -f2 )
|
#local page_title=$( echo ${page_content} | head -2 | grep \#title | cut -d= -f2 )
|
||||||
elif [[ ${generator} == "markdown" ]]; then
|
elif [[ ${generator} == "markdown" ]]; then
|
||||||
while IFS= read -r line
|
while IFS= read -r line
|
||||||
@ -694,7 +695,8 @@ function _blogs() {
|
|||||||
# Array sdate = Name day=1, Year=2, Month=3, Number day=4
|
# Array sdate = Name day=1, Year=2, Month=3, Number day=4
|
||||||
sdate=( $( echo ${content} | grep DATE | sed "s|DATE\ ||" | sed "s|\-|\ |g" ) )
|
sdate=( $( echo ${content} | grep DATE | sed "s|DATE\ ||" | sed "s|\-|\ |g" ) )
|
||||||
if [[ ${generator} == "native" ]]; then
|
if [[ ${generator} == "native" ]]; then
|
||||||
if [[ "${content}" =~ "^BLOG_TITLE (.*)$" ]] && btitle=$match[1]
|
if [[ "${content}" =~ "^BLOG_TITLE (.*)$" ]]; then
|
||||||
|
btitle=$match[1]
|
||||||
#btitle=$( echo ${content} | grep BLOG_TITLE | cut -d' ' -f2- )
|
#btitle=$( echo ${content} | grep BLOG_TITLE | cut -d' ' -f2- )
|
||||||
elif [[ ${generator} == "markdown" ]]; then
|
elif [[ ${generator} == "markdown" ]]; then
|
||||||
while IFS= read -r line
|
while IFS= read -r line
|
||||||
|
Loading…
Reference in New Issue
Block a user