Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into bold-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
windymilla committed Dec 1, 2023
2 parents e40c3dd + 9ce845d commit 1c97490
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 30 deletions.
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# Changelog


## 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
- Several tools added to support LaTeX/HTML/SVG workflow
- CP Character Substitutions now include `¬` -> `-`
- Bad words are loaded when good words file is loaded
- Bad words are marked in the Spell Query results, and the number of bad
words is reported
- Highlight Character/Regex now has a history pulldown
- Large good/bad words files are added to project dictionary much faster
- PPhtml reports unused/undefined classes more accurately
- Prev/Next Img buttons no longer pop the Page Marker Adjust dialog, and
respect the Auto Img setting
- 'Change All' has been removed from Spell Check due to undesirable
behavior
- Basic Fixup options are now persistent across different runs of Guiguts
- The Word Count and QuickSearch Count dialogs have clearer titles
- Included latest version of ebookmaker (0.12.36)
- Included latest version of Epubcheck (5.1.0)
- New TROUBLESHOOTING.md guide included with release

### Bug Fixes

- Coincident page markers (due to blank pages) were sometimes reversed
during file load/save or search/replace
- Fractions including commas (e.g. 1/10,000) did not convert correctly
- Some places where user could type a regex were not validated like the
Search/Replace dialog. The error message is also more useful
- Pphtml didn't always cope with @media correctly
- Non-existent directories used to give errors on Mac systems
- Some methods of inserting Unicode characters did not replace existing
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


## Version 1.6.0

- Removed `Convert Windows CP1252 Characters` menu option
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# DON'T FORGET to update the version number in guiguts.pl too
VERSION=1.6.0
VERSION=1.6.1

# zip utility to use
ZIP=zip -rv9
Expand Down
2 changes: 1 addition & 1 deletion src/guiguts.pl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#use criticism 'gentle';

# DON'T FORGET to update the version number in makefile too
our $VERSION = '1.6.0';
our $VERSION = '1.6.1';

use FindBin;
use lib $FindBin::Bin . "/lib";
Expand Down
59 changes: 31 additions & 28 deletions src/lib/Guiguts/SpellCheck.pm
Original file line number Diff line number Diff line change
Expand Up @@ -476,51 +476,54 @@ sub spelladdtexttags {
#
# Add spellings from good_words.txt & bad_words.txt to the project dictionary
sub spelladdgoodwords {
my $textwindow = $::textwindow;
my $top = $::top;
my $ans = $top->messageBox(
my $top = $::top;
my $ans = $top->messageBox(
-icon => 'warning',
-type => 'YesNo',
-default => 'yes',
-title => 'Warning',
-message =>
'Warning: Before adding good_words.txt to project dictionary, first check it does not contain misspellings, multiple spellings, etc. Continue?'
'Before adding good/bad words to project dictionary, first check they only contain words that you wish to add. Continue?'
);
if ( $ans =~ /no/i ) {
return;
}
return if $ans =~ /no/i;

::busy();
my $pwd = ::getcwd();
chdir $::globallastpath;
my $gwladded = spelladdwords( "good_words.txt", \%::projectdict );
my $bwladded = spelladdwords( "bad_words.txt", \%::projectbadwords );
chdir $pwd;
::unbusy();

my $fh;
if ( $gwladded or $bwladded ) {
spellsaveprojdict();
} else {
$top->messageBox(
-icon => 'warning',
-title => 'Word lists not found',
-message => 'Neither good_words.txt nor bad_words.txt were found'
);
}
}

#
# Add words from given file to given dict - return whether file opened OK
sub spelladdwords {
my $filename = shift;
my $dictref = shift;

# Load good words first - these files may not be utf8-encoded, so don't assume they are
if ( open( $fh, "<", "good_words.txt" ) ) {
::busy();
my $fh;
if ( open( $fh, "<", $filename ) ) {
while ( my $line = <$fh> ) {
utf8::decode($line);
$line =~ s/\s+$//;
next if $line eq '';
$::projectdict{$line} = '';
$dictref->{$line} = '';
}
close($fh);

# The bad_words.txt file often doesn't exist, so don't error if that's the case
if ( open( $fh, "<", "bad_words.txt" ) ) {
while ( my $line = <$fh> ) {
utf8::decode($line);
$line =~ s/\s+$//;
next if $line eq '';
$::projectbadwords{$line} = '';
}
close($fh);
}
spellsaveprojdict();
::unbusy();
} else {
::warnerror("Could not open good_words.txt");
return 1;
}
chdir $pwd;
return 0; # Failed to find file
}

#
Expand Down

0 comments on commit 1c97490

Please sign in to comment.