Arc Forumnew | comments | leaders | submitlogin
Odd behavior with some HTML-work
2 points by wfarr 6149 days ago | 13 comments
I'm getting some odd behavior with the following usage in a webapp:

  (mac tab (href . body)
    `(tag (a href ,href)
       (div (class "tab") (pr ,@body))))
    
  ;; Inside my page I do stuff like this
  (div (id "tabBar")
    (tab "blog"  "Home")
    (tab "about" "About"))
The expected results of the above being:

  <div id="tabBar">
    <a href="blog"><div class="tab">Home</div></a>
    <a href="about"><div class="tab">About</div></a>
  </div>
However, while the resulting HTML seems to be the same as the expected result, some of my CSS on for the <div class="tab"> is not working, despite the exact same CSS and HTML for the document being used here:

http://dev.compiz-fusion.org/~wfarr/files/www-mockup/index.html

It's also interesting to note that while the HTML is the same in both documents, when examining them both with Firebug, in the version linked above all looks well, but in my local version (the Arc one) the <a> tags around the tabs are grayed out.

Any ideas?



1 point by wfarr 6148 days ago | link

For clarity's sake, here's my blogpage macro:

  (mac blogpage (title . body)
    `(tag html
       (tag head
          (prn "<link rel=\"stylesheet\" type=\"text/css\" href=\"index.css\">")
          (tag title (pr ,title)))
       (tag body
         (div (id "container")
           (div (id "header")
             (pr blogtitle*))
           (div (id "tabBar")
             (maketab "blog" "Home")
             (maketab "about" "About")
             (maketab "emacs" "Emacs")
             (when (admin user)
               (tab "newpost" "New")))
           (div (id "main")
             (div (id "content") ,@body)
             (div (id "sidebar")
               (link "archive")))
           (div (id "footer") (pr copyright*))))))
Please note that in this case, I renamed my tabs macro to maketab, to avoid conflicts.

-----

2 points by cadaver 6148 days ago | link

What you need is a doctype:

  (mac blogpage (title . body)
    `(do (prn "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">")
         (tag html
          ...
That should sort out the CSS problems.

-----

2 points by cooldude127 6148 days ago | link

maybe we could use some doctype macros in html.arc

-----

1 point by wfarr 6148 days ago | link

Additionally, I'd like to see the link macro replaced by something that doesn't... uh, conflict with the <link> tag (which is forcing us to use ugly (pr)s right now instead of (tag)).

-----

1 point by cooldude127 6148 days ago | link

what's wrong with this:

  (attribute link type opstring)
  (attribute link href opstring)
  (attribute link rel  opstring)
  (gentag type "text/css" rel "stylesheet" href "styles.css")

-----

1 point by wfarr 6148 days ago | link

While the doctype would sort them out usually, it seems that (defop index.css ...) is serving up the page oddly now, such that the CSS isn't being applied.

-----

2 points by sjs 6148 days ago | link

It's a clever hack but I'm not crazy about the inline CSS and JS in news.arc. I would just serve static files and as a bonus you'll get all the benefits of the CSS and JS modes of your text editor while editing the stuff. Perhaps pg just wanted to keep the arc dir tidy and doesn't actually do that on news.yc.

-----

2 points by wfarr 6148 days ago | link

Thanks.

I'll test it when "anarki" unbreaks for me.

-----

1 point by cadaver 6148 days ago | link

I've had a look at your index.css and it seems that all the ".tab" rules only work inside a #container.

Wrap your HTML with a <div id="container"> ... </div> and see if that works.

-----

1 point by wfarr 6148 days ago | link

It is already. I'm sorry if I didn't make that clear.

-----

1 point by cooldude127 6148 days ago | link

well, i know tab is already a macro defined for tables, but if your html is what you expect, that's probably not the problem.

-----

1 point by wfarr 6148 days ago | link

Just for the sake of having checked, renaming the macro makes no difference in this case.

-----

1 point by cooldude127 6148 days ago | link

i didn't think so. not really sure then

-----