Skip to content

Commit 040f91a

Browse files
committed
chm: escape %
fixes titles like operator""
1 parent 123ee6a commit 040f91a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

make_chm.php

+5
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ function buildChm( $cpp = true )
5151
{
5252
$filelow = strtolower( $file );
5353
$relativename = substr( $filelow, strlen( $sourceDir ) + 1 );
54+
$relativename = str_replace( "%", "_", $relativename ); // escape %
5455

5556
// current file
5657
//echo( $relativename."\n" );
@@ -151,6 +152,10 @@ function buildChm( $cpp = true )
151152
$new_value = str_replace( "/" , "-", $e->getAttribute("title"));
152153
// fix bad titles where space is used instead of _
153154
$new_value = str_replace( " " , "_", $new_value);
155+
if (! strstr($new_value, "http")) {
156+
// escape relative %
157+
$new_value = str_replace( "%" , "_", urlencode($new_value));
158+
}
154159

155160
$e->setAttribute("href", $new_value.".html" );
156161

make_chm.sh

+1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ sed -i '/chmhelp\\首页.html/d' "${i}"
4545
mv "${i}" "chm_temp/${i}"
4646
"${ICONV}" -c -f UTF-8 -t GB18030 "chm_temp/${i}" > "${i}"
4747
done
48+
rm -rf chm_temp
4849

4950
"${HHC}" cppreference.hhp

0 commit comments

Comments
 (0)