Skip to content

Commit

Permalink
html2myst: handle function declarations in section bodies.
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicah committed Aug 30, 2024
1 parent 5ebba41 commit d017cb1
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 99 deletions.
7 changes: 5 additions & 2 deletions html2myst/html2myst.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def process_block(self, element):

self.process_admonition_block(admonition, element)
return admonition
if element.name == 'pre':
if element.name == 'pre' or (element.name == 'code' and has_class(element, 'methodsynopsis')):
if has_class(element, 'cpp'):
code = nodes.Block('{code} cpp')
elif has_class(element, 'c'):
Expand All @@ -233,7 +233,10 @@ def process_block(self, element):
else:
print(fg.li_red, 'Unknown code listing:', fg.li_cyan, element['class'], reset)
code = nodes.Block('{code}')
code += text_content(element, clean=False).replace('\n', '\r')
if element.name == 'pre':
code += text_content(element, clean=False).replace('\n', '\r')
else:
code += text_content(element)
return code
if element.name == 'table':
num_headers = len(list(element.select(':scope > thead > tr')))
Expand Down
4 changes: 3 additions & 1 deletion kits/game/global-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

Declared in: game/WindowScreen.h


:::{code} cpp
void set_mouse_position(int32 x, int32 y);
:::

Moves the cursor hot spot to ({hparam}`x`, {hparam}`y`) in the screen
coordinate system, where {hparam}`x` is a left-to-right index to a pixel
Expand Down
56 changes: 42 additions & 14 deletions kits/game/graphics-card-hook-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

## define_cursor()Index: 0


:::{code} cpp
int32 define_cursor(uchar* xorMask, uchar* andMask, int32 width, int32 height, int32 hotX, int32 hotY);
:::

Tells the driver to create a cursor image as defined by the arguments. The
first two arguments, {hparam}`xorMask` and {hparam}`andMask`, are bit
Expand Down Expand Up @@ -69,15 +71,19 @@ display the cursor image.

## move_cursor()Index: 1


:::{code} cpp
int32 move_cursor(int32 screenX, int32 screenY);
:::

Tells the driver to move the cursor so the hot spot corresponds to
({hparam}`screenX`, {hparam}`screenY`). The arguments are display area
coordinates (not frame buffer coordinates).

## show_cursor()Index: 2


:::{code} cpp
int32 show_cursor(bool flag);
:::

If the {hparam}`flag` argument is {cpp:expr}`true`, the driver should show
the cursor image on-screen; if it's {cpp:expr}`false`, it should remove the
Expand All @@ -88,7 +94,9 @@ If the driver is asked to show the cursor before

## draw_line_with_8_bit_depth()Index: 3


:::{code} cpp
int32 draw_line_with_8_bit_depth(int32 startX, int32 endX, int32 startY, int32 endY, uint8 colorIndex, bool clipToRect, int16 clipLeft, int16 clipTop, int16 clipRight, int16 clipBottom);
:::

Tells the driver to draw a straight, 8-bit color, minimally thin line.

Expand Down Expand Up @@ -117,7 +125,9 @@ Depth](./_static/images/draw_line_with_8_bit_depth.png)

## draw_line_with_32_bit_depth()Index: 4


:::{code} cpp
int32 draw_line_with_32_bit_depth(int32 startX, int32 endX, int32 startY, int32 endY, uint32 color, bool clipToRect, int16 clipLeft, int16 clipTop, int16 clipRight, int16 clipBottom);
:::

This is the same as {cpp:func}`draw_line_with_8_bit_depth()` except for the
color argument. Here, {hparam}`color` is a 32-bit value with 8-bit red,
Expand All @@ -127,7 +137,9 @@ that the driver specified when it received the

## draw_rect_with_8_bit_depth()Index: 5


:::{code} cpp
int32 draw_rect_with_8_bit_depth(int32 left, int32 top, int32 right, int32 bottom, uint8 colorIndex);
:::

Tells the driver to fill a rectangle, specified by the first four
arguments, with the color at {hparam}`colorIndex` in the 8-bit color table.
Expand All @@ -136,7 +148,9 @@ should be included in the area being filled.

## draw_rect_with_32_bit_depth()Index: 6


:::{code} cpp
int32 draw_rect_with_32_bit_depth(int32 left, int32 top, int32 right, int32 bottom, uint32 color);
:::

This is the same as {cpp:func}`draw_rect_with_8_bit_depth()` except for the
{hparam}`color` argument. Here, {hparam}`color` is a 32-bit value with
Expand All @@ -146,7 +160,9 @@ in the order that the driver specified when it received the

## blit()Index: 7


:::{code} cpp
int32 blit(int32 sourceX, int32 sourceY, int32 destinationX, int32 destinationY, int32 width, int32 height);
:::

Tells the driver to copy pixel data from a source rectangle to a
destination rectangle. All coordinates and sizes are in frame buffer space.
Expand All @@ -161,7 +177,9 @@ buffer.

## draw_array_with_8_bit_depth(), indexed_color_lineIndex: 8


:::{code} cpp
int32 draw_array_with_8_bit_depth(indexed_color_line* array, int32 numItems, bool clipToRect, int16 clipLeft, int16 clipTop, int16 clipRight, int16 clipBottom);
:::

Tells the driver to draw an array of lines in 8-bit depth. The line
{hparam}`array` holds a total of {hparam}`numItems`. Each item is specified
Expand Down Expand Up @@ -208,7 +226,9 @@ The lines should be minimally thin, as described under

## draw_array_with_32_bit_depth(), rgb_color_lineIndex: 9


:::{code} cpp
int32 draw_array_with_32_bit_depth(rgb_color_line* array, int32 numItems, bool clipToRect, int16 clipLeft, int16 clipTop, int16 clipRight, int16 clipBottom);
:::

Except for the color specification, which is encoded in the
{htype}`rgb_color_line` structure, this is the same as
Expand Down Expand Up @@ -246,7 +266,9 @@ widths: auto

## sync()Index: 10


:::{code} cpp
int32 sync();
:::

The driver should implement this function to block until all other
currently-executing hook functions have finished. (More accurately, you
Expand All @@ -263,14 +285,18 @@ in-coming hook functions while sitting in sync().

## invert_rect()Index: 11


:::{code} cpp
int32 invert_rect(int32 left, int32 top, int32 right, int32 bottom);
:::

Tells the driver to invert the colors in the rectangle specified by the
arguments. The sides of the rectangle are included in the inversion.

## draw_line_with_16_bit_depth()Index: 12


:::{code} cpp
int32 draw_line_with_16_bit_depth(int32 startX, int32 endX, int32 startY, int32 endY, uint16 color, bool clipToRect, int16 clipLeft, int16 clipTop, int16 clipRight, int16 clipBottom);
:::

This is the same as {cpp:func}`draw_line_with_8_bit_depth()` except for the
color argument. Here, {hparam}`color` is a 16-bit value with red, green,
Expand All @@ -280,7 +306,9 @@ order that the driver specified when it received the

## draw_rect_with_16_bit_depth()Index: 13


:::{code} cpp
int32 draw_rect_with_16_bit_depth(int32 left, int32 top, int32 right, int32 bottom, uint16 color);
:::

This is the same as {cpp:func}`draw_rect_with_8_bit_depth()` except for the
color argument. Here, {hparam}`color` is a 16-bit value with red, green,
Expand Down
Loading

0 comments on commit d017cb1

Please sign in to comment.