TaskValidator.Parsers.TaskExtractor (TaskValidator v0.9.5)

View Source

Extracts tasks from markdown table and detailed sections.

This module specializes in parsing different task formats found in TaskList documents, including table rows and detailed task sections with subtasks.

Summary

Functions

Extracts detailed task sections from markdown content.

Extracts tasks from a markdown table section.

Extracts subtasks from a task content section.

Merges table tasks with their detailed task information.

Functions

extract_detailed_tasks(lines)

@spec extract_detailed_tasks([String.t()]) :: {:ok, [map()]}

Extracts detailed task sections from markdown content.

Looks for sections that start with "### TASKID:" and extracts all content and subtasks for each task.

extract_from_table(lines, section_header, default_status \\ :planned)

@spec extract_from_table([String.t()], String.t(), atom()) ::
  {:ok, [TaskValidator.Core.Task.t()]} | {:error, String.t()}

Extracts tasks from a markdown table section.

Parameters

  • lines: List of markdown lines
  • section_header: The header to look for (e.g., "## Current Tasks")
  • default_status: Default status to assign to tasks from this section

Returns

{:ok, list(Task.t())} with extracted tasks or {:error, reason}

extract_subtasks(task_content)

@spec extract_subtasks([String.t()]) :: [TaskValidator.Core.Task.t()]

Extracts subtasks from a task content section.

Supports both numbered subtasks (#### 1. Description (TASK001-1)) and checkbox subtasks (- [x] Description [TASK001a]).

merge_table_with_details(table_tasks, detailed_tasks)

@spec merge_table_with_details([TaskValidator.Core.Task.t()], [map()]) :: [
  TaskValidator.Core.Task.t()
]

Merges table tasks with their detailed task information.

Table tasks provide basic metadata while detailed tasks provide full content, subtasks, and additional fields.