Extract Args section from Google-style docstring
(docstring: &str)
| 693 | |
| 694 | /// Extract Args section from Google-style docstring |
| 695 | fn extract_args_section_google(docstring: &str) -> Option<String> { |
| 696 | let lines: Vec<&str> = docstring.lines().collect(); |
| 697 | let mut in_args_section = false; |
| 698 | let mut args_lines = Vec::new(); |
| 699 | |
| 700 | for line in lines { |
| 701 | let trimmed = line.trim(); |
| 702 | |
| 703 | if trimmed == "Args:" || trimmed == "Arguments:" || trimmed == "Parameters:" { |
| 704 | in_args_section = true; |
| 705 | continue; |
| 706 | } |
| 707 | |
| 708 | if in_args_section { |
| 709 | if trimmed.ends_with(':') && !trimmed.contains(' ') && trimmed.len() > 1 { |
| 710 | break; |
| 711 | } |
| 712 | args_lines.push(line); |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | if args_lines.is_empty() { |
| 717 | None |
| 718 | } else { |
| 719 | Some(args_lines.join("\n")) |
| 720 | } |
| 721 | } |
| 722 | |
| 723 | /// Parse a single parameter line from Google-style docstring |
| 724 | fn parse_google_param_line(line: &str) -> Option<(String, String)> { |
no test coverage detected