2015-11-20 46 views
0

我试图运行这个简单的例子: pandoc -t slidy -s habits.txt -o habits.html habits.txt如下图所示:Slidy工作在Safari浏览器,但无法在Chrome

% Habits 
% John Doe 
% March 22, 2005 

# In the morning 

## Getting up 

- Turn off alarm 
- Get out of bed 

## Breakfast 

- Eat eggs 
- Drink coffee 

# In the evening 

## Dinner 

- Eat spaghetti 
- Drink wine 

这是在Mac OS X 10.10.5使用Safari 9.0.1 (10601.2.7.2),Chrome 46.0.2490.86(64位)和Pandoc 1.15.2。

生成的HTML文件在Safari中正常显示为带有计数器,帮助和目录的幻灯片,但未在Chrome中显示。在Chrome中,它只是一个带有标题的平面html,其中会有单独的幻灯片标题。

任何想法如何解决这个问题?

这里的HTML:

<?xml version="1.0" encoding="utf-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <meta http-equiv="Content-Style-Type" content="text/css" /> 
    <meta name="generator" content="pandoc" /> 
    <meta name="author" content="John Doe" /> 
    <meta name="date" content="2005-03-22" /> 
    <title>Habits</title> 
    <style type="text/css">code{white-space: pre;}</style> 
    <link rel="stylesheet" type="text/css" media="screen, projection, print" 
    href="http://www.w3.org/Talks/Tools/Slidy2/styles/slidy.css" /> 
    <script src="http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js" 
    charset="utf-8" type="text/javascript"></script> 
</head> 
<body> 
<div class="slide titlepage"> 
    <h1 class="title">Habits</h1> 
    <p class="author"> 
John Doe 
    </p> 
    <p class="date">March 22, 2005</p> 
</div> 
<div id="in-the-morning" class="titleslide slide section level1"><h1>In the morning</h1></div><div id="getting-up" class="slide section level2"> 
<h1>Getting up</h1> 
<ul> 
<li>Turn off alarm</li> 
<li>Get out of bed</li> 
</ul> 
</div><div id="breakfast" class="slide section level2"> 
<h1>Breakfast</h1> 
<ul> 
<li>Eat eggs</li> 
<li>Drink coffee</li> 
</ul> 
</div> 
<div id="in-the-evening" class="titleslide slide section level1"><h1>In the evening</h1></div><div id="dinner" class="slide section level2"> 
<h1>Dinner</h1> 
<ul> 
<li>Eat spaghetti</li> 
<li>Drink wine</li> 
</ul> 
</div> 
</body> 
</html> 
+0

你可以发布生成的html吗? – mb21

+0

完成。谢谢你停下来。 – Gabi

回答

3

同事想通了:habits.html将正常在Chrome中呈现,如果托管的服务器上,并通过定期访问的URL,而不是在它从本地读磁盘。这里的诊断:

It is hitting this error in chrome on slidy.js ln 1275:

Uncaught SecurityError: Failed to execute 'pushState' on 'History': A history state object with URL 'file:///Users/brettleibowitz/Desktop/slidy.html#(1)' cannot be created in a document with origin 'null'.

+1

jup,你可以用python -m SimpleHTTPServer产生一个简单的服务器 – mb21

+0

谢谢你的提示!我只是试了一下,而且工作。 – Gabi

相关问题