Much better (I hope) get_html_title implementation, first try to find <title>, if that fails, get the first non-tag string in the file.
This commit is contained in:
parent
c31d3e77ca
commit
c7c130e591
1 changed files with 7 additions and 6 deletions
|
|
@ -98,12 +98,13 @@ fn get_md_title {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_html_title {
|
fn get_html_title {
|
||||||
# H1 is not reliable because htmlroff doesn't use it :(
|
t=`{sed -n '32q; s/^.*<[Tt][Ii][Tt][Ll][Ee]> *([^<]+) *(<\/[Tt][Ii][Tt][Ll][Ee]>.*)?$/\1/p' < $1}
|
||||||
#desc=`{cat $1 | sed 32q | grep '<[Hh]1>' | sed 's/<[Hh]1>(.*)(<\/[Hh]1>|$)/\1/;s/<[^>]*>//g;1q'}
|
|
||||||
# Pick the first line of body instead
|
# As a backup we might want to pick the first 'non-tag' text in the file with:
|
||||||
desc=`{sed -n '/<[Bb][Oo][Dd][Yy]/,/./s/(<[^>]*>|$)//gp' < $1}
|
if(~ $"t '')
|
||||||
if(~ $#desc 0)
|
t=`{sed -n -e 's/^(<[^>]+>)*([^<]+).*/\2/p; 32q' < $1 | sed 1q}
|
||||||
desc=`{sed 's/<[^>]*>//g; 1q' < $1}
|
|
||||||
|
echo $t
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_file_title {
|
fn get_file_title {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue