Skip to content

Commit 6bd31d1

Browse files
committed
Address HTML parsing bug with '<unsigned char>'
When listing text contains something like static_cast<unsigned char>(thing) HTML parses `<unsigned char>` as an HTML tag before Markdeep gets a chance to see it. We had temporarily addressed this by adding spaces inside the angle brackets, and sent an inquiry off to Morgan McGuire, creator of Markdeep. His response was that Markdeep couldn't address this given the parsing order, and to just wrap the entire listing in <script type="preformatted"> ... </script> Resolves #1463
1 parent f32cc8d commit 6bd31d1

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

books/RayTracingTheNextWeek.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,7 @@
17061706
byte values for each pixel. The following listing assumes that you have copied the `stb_image.h`
17071707
header into a folder called `external`. Adjust according to your directory structure.
17081708

1709+
<script type="preformatted">
17091710
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
17101711
#ifndef RTW_STB_IMAGE_H
17111712
#define RTW_STB_IMAGE_H
@@ -1807,7 +1808,7 @@
18071808
return 0;
18081809
if (1.0 <= value)
18091810
return 255;
1810-
return static_cast< unsigned char >(256.0 * value);
1811+
return static_cast<unsigned char>(256.0 * value);
18111812
}
18121813

18131814
void convert_to_bytes() {
@@ -1835,6 +1836,7 @@
18351836
#endif
18361837
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18371838
[Listing [rtw_image]: <kbd>[rtw_stb_image.h] The rtw_image helper class]
1839+
</script>
18381840

18391841
If you are writing your implementation in a language other than C or C++, you'll need to locate (or
18401842
write) an image loading library that provides similar functionality.

src/TheNextWeek/rtw_stb_image.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class rtw_image {
107107
return 0;
108108
if (1.0 <= value)
109109
return 255;
110-
return static_cast< unsigned char >(256.0 * value);
110+
return static_cast<unsigned char>(256.0 * value);
111111
}
112112

113113
void convert_to_bytes() {

src/TheRestOfYourLife/rtw_stb_image.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class rtw_image {
107107
return 0;
108108
if (1.0 <= value)
109109
return 255;
110-
return static_cast< unsigned char >(256.0 * value);
110+
return static_cast<unsigned char>(256.0 * value);
111111
}
112112

113113
void convert_to_bytes() {

0 commit comments

Comments
 (0)