| 1 |
$CUSTOM_TITLES = 1; |
| 2 |
$CUSTOM_TITLES_LENGTH = 6; |
| 3 |
|
| 4 |
# modified version of make_long_title |
| 5 |
# does not include the section number in the title (name) of the file |
| 6 |
sub custom_title_hook { |
| 7 |
local($_)= @_; |
| 8 |
local($num_words) = $CUSTOM_TITLES_LENGTH; |
| 9 |
#RRM: scan twice for short words, due to the $4 overlap |
| 10 |
# Cannot use \b , else words break at accented letters |
| 11 |
$_ =~ s/(^|\s)\s*($GENERIC_WORDS)(\'|(\s))/$4/ig; |
| 12 |
$_ =~ s/(^|\s)\s*($GENERIC_WORDS)(\'|(\s))/$4/ig; |
| 13 |
#remove leading numbering, unless that's all there is. |
| 14 |
local($sec_num); |
| 15 |
if (!(/^\d+(\.\d*)*\s*$/)&&(s/^\s*(\d+(\.\d*)*)\s*/$sec_num=$1;''/e)) |
| 16 |
{ $num_words-- }; |
| 17 |
&remove_markers; s/<[^>]*>//g; #remove tags |
| 18 |
#revert entities, etc. to TeX-form... |
| 19 |
s/([\200-\377])/"\&#".ord($1).";"/eg; |
| 20 |
$_ = &revert_to_raw_tex($_); |
| 21 |
|
| 22 |
# get $LONG_TITLES number of words from what remains |
| 23 |
$_ = &get_first_words($_, $num_words) if ($num_words); |
| 24 |
# ...and cleanup accents, spaces and punctuation |
| 25 |
$_ = join('', (0 ? $sec_num : ''), $_); |
| 26 |
s/\\\W\{?|\}//g; s/\s/_/g; s/\W/_/g; s/__+/_/g; s/_+$//; |
| 27 |
$_; |
| 28 |
} |