[plt-dev] "poll": scribble syntax & indentation
On Mar 7, Robby Findler wrote:
> On Fri, Mar 6, 2009 at 1:36 PM, Eli Barzilay <eli at barzilay.org> wrote:
> > For example, this:
> >
> > #lang scribble/text
> > function foo() {
> > @list{if (1 < 2)
> > something1
> > else
> > something2
> > fi
> > }
> > return
> > }
> >
> > will not come out right.
>
> I think I don't get what coming out right would be here. It looks right to me!
The current output of this is:
function foo() {
if (1 < 2)
something1
else
something2
fi
return
}
instead of
function foo() {
if (1 < 2)
something1
else
something2
fi
return
}
This is because the list has this contents:
"if (1 < 2)" "\n"
" something1" "\n"
"else" "\n"
" something2" "\n"
"fi"
So the indentation that you see inside the resulting "if" block is the
indentation that is internal to the `list' expression, ignoring the
context. Here's a more exaggerated example:
#lang scribble/text
function foo() {
newline
@list{if (1 < 2)
something1
else
something2
fi
}
return
}
prints:
function foo() {
newline
if (1 < 2)
something1
else
something2
fi
return
}
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!