1 # Copyright (C) 2005 Alex Schroeder <alex@emacswiki.org>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the
15 # Free Software Foundation, Inc.
16 # 59 Temple Place, Suite 330
17 # Boston, MA 02111-1307 USA
19 $ModulesDescription .= '<p><a href="http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/mac.pl">mac.pl</a>, see <a href="http://www.oddmuse.org/cgi-bin/oddmuse/Mac">Mac</a></p>';
21 use Unicode
::Normalize
;
23 *OldMacAllPagesList
= *AllPagesList
;
24 *AllPagesList
= *NewMacAllPagesList
;
26 sub NewMacAllPagesList
{
27 $refresh = GetParam
('refresh', 0);
28 if ($IndexInit && !$refresh) {
31 OldMacAllPagesList
(@_);
34 foreach my $id (@IndexList) {
43 *OldMacGrepFiltered
= *GrepFiltered
;
44 *GrepFiltered
= *NewMacGrepFiltered
;
46 sub NewMacGrepFiltered
{
47 my @pages = OldMacGrepFiltered
(@_);
48 foreach my $id (@pages) {
54 push(@MyInitVariables, \
&MacFixEncoding
);
57 # disable grep if searching for non-ascii stuff:
60 # $ echo schroeder > /tmp/dir/schroeder
61 # $ echo schröder > /tmp/dir/schröder
62 # $ echo SCHRÖDER > /tmp/dir/SCHRÖDER-UP # don't use SCHRÖDER because of HFS
63 # $ grep -rli schröder /tmp/dir
65 # $ grep -rli SCHRÖDER /tmp/dir
68 # Why is grep not finding the upper case variant in the SCHRÖDER-UP
71 $UseGrep = 0 if GetParam
('search', '') =~ /[x{0080}-\x{fffd}]/;
73 # the rest is only necessary if using namespaces.pl
74 return unless %Namespaces;
76 for my $key (keys %Namespaces) {
79 $hash{$key} = $NamespaceRoot . '/' . $key . '/';
83 for my $key (keys %InterSite) {
86 $hash{$key} = $Namespaces{$key} if $Namespaces{$key};
93 *OldMacDraftFiles
= *DraftFiles
;
94 *DraftFiles
= *NewMacDraftFiles
;
96 sub NewMacDraftFiles
{
97 return map { NFC
($_) } OldMacDraftFiles
(@_);