Arc Forumnew | comments | leaders | submitlogin
3 points by fallintothis 5535 days ago | link | parent

  (defop src req
    (w/infile inf "../arc/pittshuttle.arc"
      (whiler l (readline inf) nil (prn l (br)))))
The reason you get trailing nils is because you have (prn l (br)). br is defined in html.arc as

  (def br ((o n 1)) 
    (repeat n (pr "<br>")) 
    (prn))
So, (br) will print 1 <br> tag, then a newline. (prn) returns nil. Hence,

  (prn "blah" (br))
first evaluates its arguments: (br) prints "<br>", then returns nil. So, this essentially does

  (prn "<br>")
  (prn "blah" nil)
which prints

  <br>
  blahnil
What you meant was

  (defop src req
    (w/infile inf "../arc/pittshuttle.arc"
      (whiler l (readline inf) nil
        (prn l)
        (br))))
But this still doesn't preserve the whitespace. For source code, you probably want the <pre> and <code> tags.

  (defop src req
    (prn "<pre><code>"
         (eschtml (filechars "../arc/pittshuttle.arc"))
         "</code></pre>"))
Alternatively, you might serve it as a static file.

Or, as a shameless plug, if you use Vim you could get my syntax highlighter (http://www.vim.org/scripts/script.php?script_id=2720) and use :TOhtml. :)



1 point by evanrmurphy 5535 days ago | link

It's fixed now. Thanks, that is so much better.

Checking out your syntax highlighter now. :)

-----

1 point by evanrmurphy 5529 days ago | link

The syntax highlighter has increased my quality of life substantially (insomuch as my life is coding in Vim, which it is for a good part these days :) .

The red highlighting that suddenly appears for mismatched parens is very useful. Saves me a lot of cursoring around to make sure all are matched up. The only nuisance in my own usage is sometimes it's distracting if I deliberately have a temporary mismatch while editing code.

-----

1 point by fallintothis 5528 days ago | link

Good to hear, thanks!

The parenthesis highlighting is a bit of an all-or-nothing proposition, since Vim can't really tell if you intended to leave unmatched parentheses. You can disable it altogether (which won't highlight any paren errors) with

  :hi link arcParenError NONE
and re-enable it with

  :hi link arcParenError Error
Similarly, there's arcBracketError for [] syntax.

If you find any, feel free to let me know of code it doesn't highlight correctly: http://bitbucket.org/fallintothis/arc-vim/issues/

-----