Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve EPUB writer for links with only fragment identifier #1884

Closed
rgaiacs opened this issue Jan 17, 2015 · 2 comments
Closed

Improve EPUB writer for links with only fragment identifier #1884

rgaiacs opened this issue Jan 17, 2015 · 2 comments

Comments

@rgaiacs
Copy link
Contributor

rgaiacs commented Jan 17, 2015

Summary

Links to sections are fixed but others links aren't.

Steps To Reproduce

$ cat sample.md 
Topics
======

1.  [Topic Title One](#topic-title-one)

Topic Title One
===============

Paragraphs of text including [key word 1](#key-word-1).

Reference
=========

<span id="key-word-1">key word 1</span>
:   Definition of first term
$ pandoc -t epub -o sample.{epub,md}

Actual Results

Short Version

$ unzip -c sample.epub ch00{1,2,3}.xhtml | grep "a href"
<li><a href="ch002.xhtml">Topic Title One</a></li>
<p>Paragraphs of text including <a href="#key-word-1">key word 1</a>.</p>

Long Version

$ unzip -c sample.epub ch00{1,2,3}.xhtml
Archive:  sample.epub
  inflating: ch001.xhtml             
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.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" />
  <title>Topics</title>
  <link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body>
<div id="topics" class="section level1">
<h1>Topics</h1>
<ol style="list-style-type: decimal">
<li><a href="ch002.xhtml">Topic Title One</a></li>
</ol>
</div>
</body>
</html>


  inflating: ch002.xhtml             
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.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" />
  <title>Topic Title One</title>
  <link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body>
<div id="topic-title-one" class="section level1">
<h1>Topic Title One</h1>
<p>Paragraphs of text including <a href="#key-word-1">key word 1</a>.</p>
</div>
</body>
</html>


  inflating: ch003.xhtml             
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.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" />
  <title>Reference</title>
  <link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body>
<div id="reference" class="section level1">
<h1>Reference</h1>
<dl>
<dt><span id="key-word-1">key word 1</span></dt>
<dd>Definition of first term
</dd>
</dl>
</div>
</body>
</html>


Expected Results

Short Version

$ unzip -c sample.epub ch00{1,2,3}.xhtml | grep "a href"
<li><a href="ch002.xhtml">Topic Title One</a></li>
<p>Paragraphs of text including <a href="ch003.xhtml#key-word-1">key word 1</a>.</p>

Long Version

$ unzip -c sample.epub ch00{1,2,3}.xhtml
Archive:  sample.epub
  inflating: ch001.xhtml             
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.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" />
  <title>Topics</title>
  <link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body>
<div id="topics" class="section level1">
<h1>Topics</h1>
<ol style="list-style-type: decimal">
<li><a href="ch002.xhtml">Topic Title One</a></li>
</ol>
</div>
</body>
</html>


  inflating: ch002.xhtml             
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.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" />
  <title>Topic Title One</title>
  <link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body>
<div id="topic-title-one" class="section level1">
<h1>Topic Title One</h1>
<p>Paragraphs of text including <a href="ch003.xhtml#key-word-1">key word 1</a>.</p>
</div>
</body>
</html>


  inflating: ch003.xhtml             
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.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" />
  <title>Reference</title>
  <link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body>
<div id="reference" class="section level1">
<h1>Reference</h1>
<dl>
<dt><span id="key-word-1">key word 1</span></dt>
<dd>Definition of first term
</dd>
</dl>
</div>
</body>
</html>


Environment Information

$ pandoc --version | head -n 1
pandoc 1.13.3
@mpickering
Copy link
Collaborator

I was under the impression that this already happened.

@jgm
Copy link
Owner

jgm commented Jan 17, 2015

The previous fix didn't cover IDs in spans and divs. This has now been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants