Skip to content

Commit

Permalink
Map title/subtitle of the rst parser
Browse files Browse the repository at this point in the history
Without it we might not get proper hierarchy in the sidebar because
of missing parent tags.
  • Loading branch information
techee committed Apr 27, 2024
1 parent f21e1de commit e00a268
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/tagmanager/tm_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,8 @@ static TMParserMapGroup group_HAXE[] = {
};

static TMParserMapEntry map_REST[] = {
{'H', tm_tag_undef_t}, // title
{'h', tm_tag_undef_t}, // subtitle
{'H', tm_tag_enumerator_t}, // title
{'h', tm_tag_field_t}, // subtitle
{'c', tm_tag_namespace_t}, // chapter
{'s', tm_tag_member_t}, // section
{'S', tm_tag_macro_t}, // subsection
Expand All @@ -601,6 +601,8 @@ static TMParserMapEntry map_REST[] = {
{'d', tm_tag_undef_t}, // substdef
};
static TMParserMapGroup group_REST[] = {
{N_("Title"), TM_ICON_NONE, tm_tag_enumerator_t},
{N_("Subtitle"), TM_ICON_NONE, tm_tag_field_t},
{N_("Chapter"), TM_ICON_NONE, tm_tag_namespace_t},
{N_("Section"), TM_ICON_NONE, tm_tag_member_t},
{N_("Subsection"), TM_ICON_NONE, tm_tag_macro_t},
Expand Down
8 changes: 8 additions & 0 deletions tests/ctags/simple.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
=======================================
Title
=======================================

---------------------------------------
Subtitle
---------------------------------------

Chapter 1
=========

Expand Down
12 changes: 8 additions & 4 deletions tests/ctags/simple.rst.tags
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Chapter 1�256�0
namespace: Chapter 1
Chapter 2�256�0
namespace: Chapter 2
Chapter 1�256�Subtitle�0
namespace: Subtitle :: Chapter 1
Chapter 2�256�Subtitle�0
namespace: Subtitle :: Chapter 2
Section 1.1�64�Chapter 1�0
member: Chapter 1 :: Section 1.1
Section 1.2�64�Chapter 1�0
Expand All @@ -14,3 +14,7 @@ Subsection 1.1.1
macro: Section 1.1 :: Subsection 1.1.1
Subsubsection 1.1.1.1�16384�Subsection 1.1.1�0
variable: Subsection 1.1.1 :: Subsubsection 1.1.1.1
Subtitle�8�Title�0
field: Title :: Subtitle
Title�4�0
enumerator: Title

0 comments on commit e00a268

Please sign in to comment.