Reputation: 22332
In scribble, I can use defproc
and defform
to define the documentation for a function or macro. And then scribble uses the nearest defform
in the file to determine what module the function/macro is defined in.
However, sometimes it sometimes makes sense to have the documentation for the same module split up across multiple scribble files.
(Say if you want the documentation for a init
function to be in repl.scrbl
, and you wan the documentation for find
in api.scrbl
. But both of them are defined in the same module, say repl.rkt
.)
However, Scribble complains when there are multiple substantiations of the same defmodule
in the docs:
WARNING: collected information for key multiple times: '(index-entry (mod-path "zordoz")); values: (list '("zordoz") (list (link-element (style "RktModLink" (list 'tt-chars #0=(list (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex"))))) (cached-element (style "RktSym" (list 'tt-chars #0#)) "zordoz... (list '("zordoz") (list (link-element (style "RktModLink" (list 'tt-chars #0=(list (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex"))))) (cached-element (style "RktSym" (list 'tt-chars #0#)) "zordoz...
WARNING: collected information for key multiple times: '(mod-path "zordoz"); values: '#(("REPL") (mod-path "zordoz") (2) (doc #"main" #"index.html") #f) '#(("API") (mod-path "zordoz") (3) (doc #"main" #"index.html") #f)
raco setup: rendering: <pkgs>/zordoz/scribblings/main.scrbl
WARNING: collected information for key multiple times: '(index-entry (mod-path "zordoz")); values: (list '("zordoz") (list (link-element (style "RktModLink" (list 'tt-chars #0=(list (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex"))))) (cached-element (style "RktSym" (list 'tt-chars #0#)) "zordoz... (list '("zordoz") (list (link-element (style "RktModLink" (list 'tt-chars #0=(list (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex"))))) (cached-element (style "RktSym" (list 'tt-chars #0#)) "zordoz...
WARNING: collected information for key multiple times: '(mod-path "zordoz"); values: '#(("REPL") (mod-path "zordoz") (2) (doc #"main" #"index.html") #f) '#(("API") (mod-path "zordoz") (3) (doc #"main" #"index.html") #f)
So, is there any way I can document both functions across multiple scribble files, even though they are defined in the same module?
Upvotes: 1
Views: 80
Reputation: 22332
If both of these files are included as subsections of another file, say main.rkt
, you can put the defproc
in that file and the two other files will use it as the module for defproc
and defform
.
For example:
#lang scribble/manual
@title{Zordoz}
@defmodule[zordoz]
@include-section[repl.scrbl]
@include-section[api.scrbl]
Upvotes: 0