0

考虑以下 Scribble 文档:

#lang scribble/manual

@title[#:tag "MyTitle"]{MyTitle}

@(module bq racket/base
    (require scribble/html/html)
    (provide blockquote))
@(require 'bq)

@blockquote{
   "Ho, ho, ho! -- Santa Claus."
}

如果我尝试用 构建它scribble --dest . test.scrbl,它会失败

/Users/varun/Code/test.scrbl:10:0: not valid in document body (need a pre-part for decode) in: (element 'blockquote '() '("\"Ho, ho, ho! -- Santa Claus.\"") #f)
  context...:
   body of "/Users/varun/Code/test.scrbl"
   .../private/map.rkt:40:19: loop
   .../racket/cmdline.rkt:191:51
   body of "/Applications/Racket v8.0/share/pkgs/scribble-lib/scribble/run.rkt"

我不明白这个错误。它指的是什么“前部分”?我发现一篇博客文章“用 Scribble 写论文”描述了一个类似的错误;在那里,问题是数字没有转换为字符串。但是,我这里确实有一个字符串,所以我不明白问题是什么。

4

2 回答 2

1

问题是scribble/html未连接到scribble/manual,并且在那里构造的“元素”是一个 HTML 元素。您不能使用scribble/html此类文档中的功能。

如果你想在 scribble 中使用块引用,你可能想要使用nested-flow.

于 2021-12-10T19:54:05.310 回答
0

Based on what Sam said in his answer, as well as a similar comment on Twitter, I ended up defining a blockquote as:

@(require scribble/core scribble/decode)
@(define (blockquote . strs)
      (make-nested-flow (make-style "blockquote" '(command))
                        (decode-flow strs)))

(Source: https://sourcegraph.com/github.com/flock-lab/flock/-/blob/docs/main.scrbl?L9-L11)

This can be used without quotes:

@blockquote{Ho, ho, ho! -- Santa Claus.}
于 2021-12-11T02:30:43.920 回答