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

Support bold/italic page numbers in AutoIndex #1286

Merged
merged 4 commits into from
Dec 6, 2023
Merged
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
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

## Version 1.6.1

- New 'Add Index Cross-references' feature links "See"/"Also see" references
to the relevant location in the index. References that cannot be linked
automatically are listed for manual linking
- New 'Add Index Cross-references' feature links "See"/"Also see"/"See also"
references to the relevant location in the index. References that cannot be
linked automatically are listed for manual linking
- Several tools added to support LaTeX/HTML/SVG workflow
- CP Character Substitutions now include `¬` -> `-`
- Bad words are loaded when good words file is loaded
Expand Down Expand Up @@ -37,6 +37,8 @@
selected text in the way other insertions do
- HTML AutoIndex could sometimes loop forever if it didn't find suitable
lines to convert to an index
- HTML index generation did not recognise page numbers that were marked
up as bold or italic


## Version 1.6.0
Expand Down
8 changes: 4 additions & 4 deletions src/lib/Guiguts/HTMLConvert.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4216,14 +4216,14 @@ sub fracconv {
# The rules are as follows:
# 1. Number must be preceded by a comma (optionally close quote) then one or more spaces
# 2. Number must be no more than 3 digits (word boundary \b used to avoid partial matches with 4 digit numbers)
# 3. Page range may be specified by hyphen or ndash between two numbers
# 3. Page range may be specified by hyphen/ndash and second number following the first
# 4. Number or range may be marked up italic or bold, e.g. <b>123</b> or <i>123-124</i>
sub addpagelinks {
my $selection = shift;
my $ndash = "\x{2013}";
my $rquot = q(["'\x{201d}\x{2019}]);
$selection =~
s/(,$rquot?) +(\d{1,3})([-$ndash])\b(\d{1,3})\b/$1 <a href="#$::htmllabels{pglabel}$2">$2$3$4<\/a>/g;
$selection =~ s/(,$rquot?) +\b(\d{1,3})\b/$1 <a href="#$::htmllabels{pglabel}$2">$2<\/a>/g;
s/(,$rquot?) +((<[ib]>)?\b(\d{1,3})([-$ndash]\d{1,3})?\b(<\/[ib]>)?)/$1 <a href="#$::htmllabels{pglabel}$4">$2<\/a>/g;
return $selection;
}

Expand All @@ -4248,7 +4248,7 @@ sub indexxref {
$textwindow->markSet( 'indexendmark', $indexend ); # Since row/col of indexend will change during insertions
my $indexstart = pop(@ranges);

my $SEESTR = '(also )*see'; # Change this if needed for different languages
my $SEESTR = '(also )?see( also)?'; # Change this if needed for different languages
my $SEESTRLEN = length($SEESTR); # Approx length just used for advancing search position
my $seepos = $indexstart;
my $seesawnum = 1;
Expand Down
Loading