Skip to content

Commit

Permalink
added content() class method for guide and setup
Browse files Browse the repository at this point in the history
  • Loading branch information
terrancedejesus committed Feb 22, 2024
1 parent 5420537 commit 4b8f483
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions detection_rules/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ def code(cls, value: str, code='js'):
line_sep = "-" * 34
return f'[source, {code}]\n{line_sep}\n{value}\n{line_sep}'

@classmethod
def content(cls, value: str):
return f'\n{value}\n{line_sep}'

@classmethod
def title(cls, depth: int, value: str):
return f'{"=" * depth} {value}'
Expand Down Expand Up @@ -599,12 +603,12 @@ def metadata_str(self) -> str:
def guide_str(self) -> str:
"""Add the guide section to the rule detail page."""
guide = re.sub(self.elastic_hyperlink_pattern, r'\1', self.rule['note'])
return f'{AsciiDoc.title(4, "Investigation guide")}\n\n\n{AsciiDoc.code(guide, code="markdown")}'
return f'{AsciiDoc.title(4, "Investigation guide")}\n\n\n{AsciiDoc.content(guide)}'

def setup_str(self) -> str:
"""Add the setup section to the rule detail page."""
setup = re.sub(self.elastic_hyperlink_pattern, r'\1', self.rule['setup'])
return f'{AsciiDoc.title(4, "Setup")}\n\n\n{AsciiDoc.code(setup, code="markdown")}'
return f'{AsciiDoc.title(4, "Setup")}\n\n\n{AsciiDoc.content(setup)}'

def query_str(self) -> str:
"""Add the query section to the rule detail page."""
Expand Down

0 comments on commit 4b8f483

Please sign in to comment.