Skip to content

Commit

Permalink
ReStructuredText: skip prefixed whitespaces when parsing markup lines
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed Jul 31, 2023
1 parent 9db5222 commit 422cdce
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--sort=no
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
OVERVIEW input.rst /^ .. [OVERVIEW] `Satellite Overview, Concepts, and Deployment Considerations <https:\/\/access.r/;" C
ADMIN input.rst /^ .. [ADMIN] `Administering Red Hat Satellite <https:\/\/access.redhat.com\/documentation\/en-us/;" C
LOC input.rst /^ .. [LOC] `Chapter 6. Managing Locations <https:\/\/access.redhat.com\/documentation\/en-us\/re/;" C
USERROLE input.rst /^ .. [USERROLE] `Chapter 7. Managing Users and Roles <https:\/\/access.redhat.com\/documentation/;" C
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* Satellite Overview

.. [OVERVIEW] `Satellite Overview, Concepts, and Deployment Considerations <https://access.redhat.com/documentation/en-us/red_hat_satellite/6.12/html/satellite_overview_concepts_and_deployment_considerations/index>`_
* Administering Red Hat Satellite

.. [ADMIN] `Administering Red Hat Satellite <https://access.redhat.com/documentation/en-us/red_hat_satellite/6.12/html/administering_red_hat_satellite/index>`_
.. [LOC] `Chapter 6. Managing Locations <https://access.redhat.com/documentation/en-us/red_hat_satellite/6.12/html/administering_red_hat_satellite/managing_locations_admin>`_
.. [USERROLE] `Chapter 7. Managing Users and Roles <https://access.redhat.com/documentation/en-us/red_hat_satellite/6.12/html/administering_red_hat_satellite/managing_users_and_roles_admin#doc-wrapper>`_
11 changes: 8 additions & 3 deletions parsers/rst.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,14 @@ static int get_kind(char c, bool overline, struct sectionTracker tracker[])

static const unsigned char *is_markup_line (const unsigned char *line, char reftype)
{
if ((line [0] == '.') && (line [1] == '.') && (line [2] == ' ')
&& (line [3] == reftype))
return line + 4;
unsigned int i = 0;

while (isspace(line[i]))
i++;

if ((line [i+0] == '.') && (line [i+1] == '.') && (line [i+2] == ' ')
&& (line [i+3] == reftype))
return line + i + 4;
return NULL;
}

Expand Down

0 comments on commit 422cdce

Please sign in to comment.