remy / inliner

Node utility to inline images, CSS and JavaScript for a web page - useful for mobile sites
MIT License
1.1k stars 165 forks source link

internal href's contain the input html file name and cannot be renamed. #124

Closed kiwichris closed 7 years ago

kiwichris commented 7 years ago

I have a sphinx generated single html file I am wanting to inline to a single html file. The document is called c_user (C User Manual) so if I:

$ /usr/local/bin/inliner -n index.html > c_user.html
$ grep "index\.html" c_user.html 
    <link rel="top" title="None" href="index.html#document-index"> 
            <a href="index.html#document-index" class="icon icon-home"> RTEMS C User Manual
<li class="toctree-l1"><a class="reference internal" href="index.html#document-preface">1. Preface</a></li>
<li class="toctree-l1"><a class="reference internal" href="index.html#document-overview">2. Overview</a></li>

I assumed I could rename the output given I am redirecting it to a file. Would having links as:

href="#document-preface"

Solve this?

I would prefer having:

x.html y.html

rather than:

x/index.html y/index.html

Thanks Chris

remy commented 7 years ago

Old issue, but just getting around to these.

Technically speaking, the href you have there is pointing to a resource, which is why it doesn't quite work for you.

I'd suggest two options:

  1. change the original so the href="#document-preface" instead of href="index.html#document-preface"
  2. Modify the file with something like perl? perl -pe 's/href="index.html#/href="#/g' -i c_user.html (make sure to backup first, I've given it a quick test, but it's not 💯 guarenteed!).