From 85fffe0dcef6c420ab8ee2b6d299687f4849b80e Mon Sep 17 00:00:00 2001 From: Boris Batkin Date: Wed, 13 May 2026 02:35:19 -0700 Subject: [PATCH] daslib/rst_comment: add --detail_output flag for non-default doc trees Lets a consumer (e.g. dasImgui's utils/imgui2rst.das, or any other project that vendors daslang's RST tooling) redirect the per-function detail snippets at a custom location matching its own topic_root. `--detail_output Y` writes per-symbol details to `Y/detail/`, matching the natural read path `{topic_root}/detail/...` so the consumer can set `topic_root = Y` and have writes and reads line up without the existing `--docs_output X` flag's `/index/` segment (which is load-bearing for the Eden / dasimgui-game style invocation pattern that pairs `--docs_output X` with `topic_root = X/index`). Default behavior (no flag) and `--docs_output` semantics are unchanged. daslang's own das2rst doesn't pass either flag, so the default daslang doc build is byte-identical. Co-Authored-By: Claude Opus 4.7 (1M context) --- daslib/rst_comment.das | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/daslib/rst_comment.das b/daslib/rst_comment.das index 659e670571..160af2dae2 100644 --- a/daslib/rst_comment.das +++ b/daslib/rst_comment.das @@ -469,8 +469,14 @@ class RstComment : AstCommentReader { if (is_in_completion()) return var output : string let args = get_command_line_arguments() + let detailIds = args |> find_index("--detail_output") let outputIds = args |> find_index("--docs_output") - if (outputIds >= 0) { + if (detailIds >= 0) { + // `--detail_output Y` → write to `Y/detail/`. Matches the natural + // read path `{topic_root}/detail/...` so the consumer can set + // `topic_root = Y` without the `/index/` segment. + output = args[detailIds+1] + "/detail/" + } elif (outputIds >= 0) { output = args[outputIds+1] + "/index/detail/" } else { output = get_das_root() + "/doc/source/stdlib/generated/detail/"