谁能告诉我额外的字符是从哪里来的?
输出如下: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>
home.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>
删除
<%= debug(params) if Rails.env.development? %>
行和您的调试信息应该不再可见
我想问题可能出在CSS上。
检查是否为链接激活了content-attribute
也许这有帮助:http://davidwalsh.name/optimize-your-links-for-print-using-css-show-url或http://www.alistapart.com/articles/improvingprint