id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,testcase,blockedby,blocking,related,differential
4836,literate markdown not handled correctly by unlit,guest,,"This simple program in literate haskell, using markdown in the comments gives unlit problems:
{{{
### Ok so lets try this again.
### A page that loads and compiles:
> myfact 0 = 1
> myfact n = n * n-1
Lets see if it works!
}}}
If I run unlit and collect the output I can see where it went wrong:
{{{
$ ~/lib/ghc-7.0.1/unlit Main.lhs Main.lpp
$ cat Main.lpp
### Ok so lets try this again.
### A page that loads and compiles:
myfact 0 = 1
myfact n = n * n-1
}}}
When I look through the source code of unlit.c I think the place to check for this would be here:
{{{
if ( c == '#' ) {
if ( ignore_shebang ) {
c1 = egetc(istream);
if ( c1 == '!' ) {
while (c=egetc(istream), !isLineTerm(c)) ;
return SHEBANG;
}
myputc(c, ostream);
c=c1;
}
if ( leavecpp ) {
myputc(c, ostream);
while (c=egetc(istream), !isLineTerm(c))
myputc(c,ostream);
myputc('\n',ostream);
return HASH;
}
}
}}}
It seems that cabal has a similar unlit function:
http://www.haskell.org/ghc/docs/latest/html/libraries/Cabal-1.10.0.0/src/Distribution-Simple-PreProcess-Unlit.html#unlit
I haven't tested it but, I think the cabal version would handle this case correctly (or be easier to fix than a C program from 1990). Would it be possible/wise/feasible to extract the cabal version and make it a permanent replacement for the current unlit.c code?",bug,new,low,7.12.1,Compiler,7.0.1,,,dagitj@… jmg@… trevor@… bjp@…,Unknown/Multiple,Unknown/Multiple,GHC rejects valid program,,,,#7120,