`scribble/text-render` doesn't respect `(linebreak)`
LiberalArtist opened this issue · 3 comments
Scribble doesn't handle (linebreak)
properly when generating plain text output. For example:
philip@bastet:/tmp/scrbl$ cat scribble-text-newline.scrbl
#lang scribble/base
abc @(linebreak) 123
philip@bastet:/tmp/scrbl$ scribble --text scribble-text-newline.scrbl
[Output to scribble-text-newline.txt]
philip@bastet:/tmp/scrbl$ cat scribble-text-newline.txt
abc 123
philip@bastet:/tmp/scrbl$
It looks like something needs to happen in render-paragraph
, but I'm not immediately sure how to communicate which newlines to keep—maybe specials?
Related to racket/racket#4301
Edit: Fixed the example.
I'm a bit confused. I think you want the evaluation result to be something that has newline characters, not printing a newline character (which is what newline
does), no?
#lang scribble/base
abc @(newline) 123
@(displayln "qwerty")
I don't expect to see any qwerty
in the generated file either (but I do get the newline and qwerty
in the stdout).
According to the doc of decode-flow
:
A sequence of two or more newlines separated only by whitespace is parsed as a compound-paragraph separator.
So:
#lang scribble/base
abc
def
is rendered as:
abc def
while:
#lang scribble/base
abc
def
is rendered as:
abc
def
So if you want a new paragraph, perhaps use '("\n" "\n")
or something like that?
#lang scribble/base
abc@|'("\n" "\n")|def
for me correctly outputs:
abc
def
Ah, sorry, I wrote this confusingly. I meant (linebreak)
from scribble/base
, which produces an element with the style name 'newline
. I'll edit the post above. The implementation in #334 works (with caveats as noted); I'll fix the commit message now.
Ah, yes, I think it is indeed broken.
@history
from scribble/manual
is at least one place that uses linebreak
, and it is rendered incorrectly in the text mode too.