-2

有人可以告诉我多余的字符是从哪里来的吗?

这是输出的样子:http ://screencast.com/t/f0sgNPzMu

我不太明白所有额外字符的来源。

这是我的文件:

    ##application.html.erb

    <!DOCTYPE html>
    <html>
    <head>
      <title><%= title %></title>
      <%= javascript_include_tag "application" %>
      <%= render 'layouts/stylesheets' %>
      <%= csrf_meta_tags %>
     </head>
     <body>
        <div class="container">
          <%= render 'layouts/header' %>
          <section class="round">
            <%= yield %>
          </section>
          <%= render 'layouts/footer' %>
          <%= debug(params) if Rails.env.development? %>
        </div>
      </body>
     </html>
 
##_header.html.erb
    <header>
     <%= link_to logo, root_path %>
     <nav>
       <ul>
        <li><%= link_to 'Home', root_path %></li>
        <li><%= link_to 'Help', help_path %></li>
        <li><%= link_to 'Sign in', '#' %></li>
       </ul>
     </nav>
     </header>

主页.html.erb

 <h1>Sample App</h1>
 <p>
 This is the home page
 </p>
 <%= link_to "Sign up now!", signup_path, :class => "signup_button round" %>

这是 HTML 页面源代码:

     </head>
     <body>
        <div class="container">
          <header>
       <a href="/"><img alt="Sample App" class="round" src="/assets/logo.png" /></a>
       <nav>
       <ul>
         <li><a href="/">Home</a></li>
         <li><a href="/help">Help</a></li>
         <li><a href="#">Sign in</a></li>
       </ul>
     </nav>
     </header>
 
          <section class="round">
            <h1>Sample App</h1>
      <p>
       This is the home page
      </p>
      <a href="/signup" class="signup_button round">Sign up now!</a>
 
 
          </section>
          <footer>
      <nav>
       <ul>
        <li><a href="/about">About</a></li>
        <li><a href="/contact">Contact</a></li>
       <li>
        <a href="http://news.railstutorial.org/news">News</a></li>
       <li>
        <a href='http://rails.tutorials.org'>Rails Tutorial</a>
      </li>
      </ul>
      </nav>
      </footer>
 
          <pre class='debug_dump'>--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
controller: pages
action: home
          </pre>
        </div>
        </body>
        </html>

提前致谢。

4

2 回答 2

2

去除那个

<%= debug(params) if Rails.env.development? %>

行,您的调试信息不​​应再可见

于 2013-01-20T21:59:14.803 回答
1

我认为,问题可能出在 CSS 中。

检查您是否为链接激活了内容属性。

也许这有帮助:http ://davidwalsh.name/optimize-your-links-for-print-using-css-show-url或http://www.alistapart.com/articles/improvingprint

于 2013-01-20T23:34:51.227 回答