janoliver / inkslides

A rewrite of the inkscapeslide script to create PDF presentations out of inkscape SVG files.
MIT License
27 stars 7 forks source link

Inkslides doesn't create anything #5

Closed janoliver closed 6 years ago

janoliver commented 6 years ago

From this AUR comment: https://aur.archlinux.org/packages/inkslides-git/

====================

but it didn't work.

$ inkslides foo.svg
Parsing foo.svg ...
Creating SVG slides ...
PDF should be up to date. Quitting ...

There was an empty directory created in the working directory named .inkslides-foo. I'm happy to post a bug report upstream if you prefer.

janoliver commented 6 years ago

I just tried master on the example.svg and it worked fine. What is the layer structure of your SVG file?

protist commented 6 years ago

Hi, sorry for the delay. I tried master on the example.svg too, and I get the following error.

$ inkslides example.svg
Parsing example.svg ...
Traceback (most recent call last):
  File "/usr/bin/inkslides", line 11, in <module>
    load_entry_point('inkslides==2.0.0a1', 'console_scripts', 'inkslides')()
  File "/usr/lib/python3.6/site-packages/inkslides/inkslides.py", line 398, in main
    i.run(file=args.file, temp=args.temp)
  File "/usr/lib/python3.6/site-packages/inkslides/inkslides.py", line 99, in run
    self.parse()
  File "/usr/lib/python3.6/site-packages/inkslides/inkslides.py", line 165, in parse
    self.doc = parse(self.f_input, parser=parser)
  File "src/lxml/etree.pyx", line 3444, in lxml.etree.parse (src/lxml/etree.c:83188)
  File "src/lxml/parser.pxi", line 1834, in lxml.etree._parseDocument (src/lxml/etree.c:120760)
  File "src/lxml/parser.pxi", line 1860, in lxml.etree._parseDocumentFromURL (src/lxml/etree.c:121107)
  File "src/lxml/parser.pxi", line 1764, in lxml.etree._parseDocFromFile (src/lxml/etree.c:120015)
  File "src/lxml/parser.pxi", line 1161, in lxml.etree._BaseParser._parseDocFromFile (src/lxml/etree.c:114564)
  File "src/lxml/parser.pxi", line 598, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/etree.c:107741)
  File "src/lxml/parser.pxi", line 709, in lxml.etree._handleParseResult (src/lxml/etree.c:109450)
  File "src/lxml/parser.pxi", line 638, in lxml.etree._raiseParseError (src/lxml/etree.c:108304)
  File "example.svg", line 43
lxml.etree.XMLSyntaxError: Specification mandates value for attribute data-pjax-transient, line 43, column 89

In fact, I can't even open up example.svg in inkscape (I'm using the latest stable 0.92.3-1 on Arch). I get a popup saying Failed to load the requested file example.svg, and the following on the command line.

$ inkscape example.svg

(inkscape:8215): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",

(inkscape:8215): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",
example.svg:43: parser error : Specification mandates value for attribute data-pjax-transient
name="request-id" content="9CF1:639D:433FAD:5C10CE:5AA87151" data-pjax-transient
                                                                               ^
example.svg:46: parser error : Specification mandates value for attribute data-pjax-transient
  <meta name="selected-link" value="repo_source" data-pjax-transient>
                                                                    ^
example.svg:86: parser error : Specification mandates value for attribute data-pjax-transient
ps://github.com/janoliver/inkslides/blob/master/example.svg" data-pjax-transient
                                                                               ^
example.svg:102: parser error : Opening and ending tag mismatch: link line 100 and head
  </head>
         ^
example.svg:134: parser error : Opening and ending tag mismatch: div line 133 and option
  <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-site-sea
                                                 ^
example.svg:134: parser error : Opening and ending tag mismatch: div line 132 and form
  <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-site-sea
                                                        ^
example.svg:148: parser error : Opening and ending tag mismatch: input line 147 and label
    </label>
            ^
example.svg:149: parser error : Opening and ending tag mismatch: input line 137 and form
</form></div>
       ^
example.svg:149: parser error : Opening and ending tag mismatch: label line 135 and div
</form></div>
             ^
example.svg:151: parser error : Opening and ending tag mismatch: form line 134 and div
            </div>
                  ^
example.svg:235: parser error : Opening and ending tag mismatch: img line 233 and summary
      </summary>
                ^
example.svg:262: parser error : Opening and ending tag mismatch: li line 262 and option
        <li><!-- '"` --><!-- </textarea></xmp> --></option></form><form class="l
                                                           ^
example.svg:262: parser error : Opening and ending tag mismatch: ul line 237 and form
        <li><!-- '"` --><!-- </textarea></xmp> --></option></form><form class="l
                                                                  ^
example.svg:266: parser error : Opening and ending tag mismatch: summary line 230 and li
        </form></li>
                    ^
example.svg:267: parser error : Opening and ending tag mismatch: details line 229 and ul
      </ul>
           ^
example.svg:268: parser error : Opening and ending tag mismatch: li line 227 and details
    </details>
              ^
example.svg:269: parser error : Opening and ending tag mismatch: ul line 175 and li
  </li>
       ^
example.svg:270: parser error : Opening and ending tag mismatch: div line 173 and ul
</ul>
     ^
example.svg:274: parser error : Opening and ending tag mismatch: div line 130 and option
        <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="sr-on
                                                       ^
example.svg:274: parser error : Opening and ending tag mismatch: div line 119 and form
        <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="sr-on
                                                              ^
example.svg:278: parser error : Opening and ending tag mismatch: header line 118 and div
</form>      </div>
                   ^
example.svg:280: parser error : Opening and ending tag mismatch: body line 104 and div
  </div>
        ^
example.svg:281: parser error : Opening and ending tag mismatch: meta line 96 and header
</header>
         ^
example.svg:285: parser error : Opening and ending tag mismatch: link line 94 and div
  </div>
        ^
example.svg:297: parser error : Specification mandates value for attribute itemscope
        <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class="">
                       ^
example.svg:297: parser error : attributes construct error
        <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class="">
                       ^
example.svg:297: parser error : Couldn't find end of Start Tag div line 297
        <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class="">
                       ^
example.svg:298: parser error : Specification mandates value for attribute data-pjax-container
    <div id="js-repo-pjax-container" data-pjax-container >
                                                         ^
example.svg:312: parser error : Opening and ending tag mismatch: li line 311 and option
        <!-- '"` --><!-- </textarea></xmp> --></option></form><form data-autosub
                                                       ^
example.svg:312: parser error : Opening and ending tag mismatch: ul line 310 and form
        <!-- '"` --><!-- </textarea></xmp> --></option></form><form data-autosub
                                                              ^
example.svg:387: parser error : Opening and ending tag mismatch: div line 308 and li
  </li>
       ^
example.svg:392: parser error : Opening and ending tag mismatch: div line 391 and option
    <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="starred j
                                                   ^
example.svg:392: parser error : Opening and ending tag mismatch: li line 389 and form
    <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="starred j
                                                          ^
example.svg:407: parser error : Opening and ending tag mismatch: div line 307 and option
    <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="unstarred
                                                   ^
example.svg:407: parser error : Opening and ending tag mismatch: div line 298 and form
    <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="unstarred
                                                          ^
example.svg:423: parser error : Opening and ending tag mismatch: link line 93 and li
  </li>
       ^
example.svg:449: parser error : Opening and ending tag mismatch: meta line 91 and ul
</ul>
     ^
example.svg:459: parser error : Opening and ending tag mismatch: meta line 89 and div
    </div>
          ^
example.svg:463: parser error : Specification mandates value for attribute itemscope
     itemtype="http://schema.org/BreadcrumbList"
     ^
example.svg:463: parser error : attributes construct error
     itemtype="http://schema.org/BreadcrumbList"
     ^
example.svg:463: parser error : Couldn't find end of Start Tag nav line 461
     itemtype="http://schema.org/BreadcrumbList"
     ^
example.svg:467: parser error : Specification mandates value for attribute itemscope
  <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElemen
                  ^
example.svg:467: parser error : attributes construct error
  <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElemen
                  ^
example.svg:467: parser error : Couldn't find end of Start Tag span line 467
  <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElemen
                  ^
example.svg:472: parser error : Opening and ending tag mismatch: meta line 471 and a
</a>  </span>
    ^
example.svg:472: parser error : Opening and ending tag mismatch: a line 468 and span
</a>  </span>
             ^
example.svg:474: parser error : Specification mandates value for attribute itemscope
    <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElem
                    ^
example.svg:474: parser error : attributes construct error
    <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElem
                    ^
example.svg:474: parser error : Couldn't find end of Start Tag span line 474
    <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElem
                    ^
example.svg:480: parser error : Opening and ending tag mismatch: meta line 479 and a
</a>    </span>
    ^
example.svg:480: parser error : Opening and ending tag mismatch: a line 475 and span
</a>    </span>
               ^
example.svg:482: parser error : Specification mandates value for attribute itemscope
  <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElemen
                  ^
example.svg:482: parser error : attributes construct error
  <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElemen
                  ^
example.svg:482: parser error : Couldn't find end of Start Tag span line 482
  <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElemen
                  ^
example.svg:488: parser error : Opening and ending tag mismatch: meta line 487 and a
</a>  </span>
    ^
example.svg:488: parser error : Opening and ending tag mismatch: a line 483 and span
</a>  </span>
             ^
example.svg:505: parser error : Opening and ending tag mismatch: link line 86 and nav
</nav>
      ^
example.svg:508: parser error : Opening and ending tag mismatch: meta line 81 and div
  </div>
        ^
example.svg:528: parser error : Specification mandates value for attribute data-pjax
ass="select-menu-modal-holder js-menu-content js-navigation-container" data-pjax
                                                                               ^
example.svg:539: parser error : Opening and ending tag mismatch: input line 538 and div
        </div>
              ^
example.svg:599: parser error : Specification mandates value for attribute data-pjax
            data-hotkey="t">
            ^
example.svg:599: parser error : attributes construct error
            data-hotkey="t">
            ^
example.svg:599: parser error : Couldn't find end of Start Tag a line 596
            data-hotkey="t">
            ^
example.svg:601: parser error : Opening and ending tag mismatch: div line 595 and a
      </a>
          ^
example.svg:619: parser error : Entity 'hellip' not defined
      Fetching contributors&hellip;
                                   ^
example.svg:649: parser error : Opening and ending tag mismatch: div line 630 and option
          <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="inl
                                                         ^
example.svg:649: parser error : Opening and ending tag mismatch: div line 629 and form
          <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="inl
                                                                ^
example.svg:651: parser error : Specification mandates value for attribute data-disable-with
ia-label="Fork this project and edit the file" data-hotkey="e" data-disable-with
                                                                               ^
example.svg:655: parser error : Opening and ending tag mismatch: div line 628 and option
        <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="inlin
                                                       ^
example.svg:655: parser error : Opening and ending tag mismatch: div line 511 and form
        <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="inlin
                                                              ^
example.svg:657: parser error : Specification mandates value for attribute data-disable-with
            aria-label="Fork this project and delete the file" data-disable-with
                                                                               ^
example.svg:667: parser error : Opening and ending tag mismatch: meta line 80 and div
</div>
      ^
example.svg:688: parser error : Opening and ending tag mismatch: link line 78 and div
  </div>
        ^
example.svg:692: parser error : Opening and ending tag mismatch: div line 691 and option
    <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-jump-t
                                                   ^
example.svg:692: parser error : Opening and ending tag mismatch: meta line 75 and form
    <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-jump-t
                                                          ^
example.svg:693: parser error : Entity 'hellip' not defined
ejump-input js-jump-to-line-field" type="text" placeholder="Jump to line&hellip;
                                                                               ^
example.svg:693: parser error : Specification mandates value for attribute autofocus
pe="text" placeholder="Jump to line&hellip;" aria-label="Jump to line" autofocus
                                                                               ^
example.svg:695: parser error : Opening and ending tag mismatch: input line 693 and form
</form>  </div>
       ^
example.svg:695: parser error : Opening and ending tag mismatch: form line 692 and div
</form>  </div>
               ^
example.svg:698: parser error : Opening and ending tag mismatch: meta line 73 and div
  </div>
        ^
example.svg:700: parser error : Opening and ending tag mismatch: meta line 71 and div
</div>
      ^
example.svg:702: parser error : Opening and ending tag mismatch: meta line 69 and div
    </div>
          ^
example.svg:703: parser error : Opening and ending tag mismatch: meta line 68 and div
  </div>
        ^
example.svg:705: parser error : Opening and ending tag mismatch: meta line 66 and div
  </div>
        ^
example.svg:711: parser error : Entity 'copy' not defined
      <li class="mr-3">&copy; 2018 <span title="0.40450s from unicorn-1139317075
                             ^
example.svg:770: parser error : Opening and ending tag mismatch: meta line 65 and body
  </body>
         ^
example.svg:771: parser error : Opening and ending tag mismatch: meta line 60 and html
</html>
       ^
example.svg:773: parser error : Premature end of data in tag meta line 51

^
example.svg:773: parser error : Premature end of data in tag meta line 50

^
example.svg:773: parser error : Premature end of data in tag meta line 49

^
example.svg:773: parser error : Premature end of data in tag meta line 48

^
example.svg:773: parser error : Premature end of data in tag meta line 46

^
example.svg:773: parser error : Premature end of data in tag meta line 43

^
example.svg:773: parser error : Premature end of data in tag link line 42

^
example.svg:773: parser error : Premature end of data in tag meta line 41

^
example.svg:773: parser error : Premature end of data in tag link line 40

^
example.svg:773: parser error : Premature end of data in tag link line 39

^
example.svg:773: parser error : Premature end of data in tag meta line 34

^
example.svg:773: parser error : Premature end of data in tag link line 33

^
example.svg:773: parser error : Premature end of data in tag link line 32

^
example.svg:773: parser error : Premature end of data in tag meta line 31

^
example.svg:773: parser error : Premature end of data in tag meta line 28

^
example.svg:773: parser error : Premature end of data in tag link line 17

^
example.svg:773: parser error : Premature end of data in tag link line 16

^
example.svg:773: parser error : Premature end of data in tag link line 15

^
example.svg:773: parser error : Premature end of data in tag link line 14

^
example.svg:773: parser error : Premature end of data in tag link line 13

^
example.svg:773: parser error : Premature end of data in tag link line 12

^
example.svg:773: parser error : Premature end of data in tag link line 11

^
example.svg:773: parser error : Premature end of data in tag meta line 10

^
example.svg:773: parser error : Premature end of data in tag head line 9

^
example.svg:773: parser error : Premature end of data in tag html line 8

^
janoliver commented 6 years ago

Your example.svg seems to be the HTML source of https://github.com/janoliver/inkslides/blob/master/example.svg. Please download the correct svg file (https://raw.githubusercontent.com/janoliver/inkslides/master/example.svg) and try again.

protist commented 6 years ago

Oops, sorry. I've been stupid on two accounts. After downloading the correct example file, inkslides does work for me. I also re-read the Usage, and realised it wasn't working because my slides weren't in the correct sublayer format. Apologies again.

I understand the rationale for the nested sublayers; that's really cool! However, I was wondering if there could be an option to not use this layer architecture, and just render top-level slides instead. I'm using JessyInk, and I'd like to create a backup PDF, just in case there are any SVG rendering issues when I present. The JessyInk format just consists of top-level slides. If I nest them, they are no longer displayed. I also tried copying the SVG, then nesting all the slides, but this is very tedious. There doesn't appear to be a way to do this with multiple slides, apart from of editing the source directly.

janoliver commented 6 years ago

In inkslides/inkslides.py modify the function get_layer_structure(self) so that it reads:

def get_layer_structure(self):
    """
    Determine the layer structure
    """
    slide_tree = []
    num_slide = 0

    # iterate in reverse because svg is formated in this way
    for slide in self.doc.getroot().xpath('./svg:g[@inkscape:groupmode="layer"]', namespaces=nsmap):
        num_slide += 1
        current_slide = [get_label(slide)]
        self.add_master_layers(current_slide)
        self.add_imported_layers(slide, current_slide)
        slide_tree.append((num_slide, current_slide[:]))

return slide_tree

That should do the trick. Please close the issue when it works.

protist commented 6 years ago

That works perfectly. Thank you. I'm more than happy to close it, but before that, would it be possible to include this in the code, perhaps as an option for the end user?

janoliver commented 6 years ago

Sure, why not. There is now a --flat command line parameter that does what you need.

protist commented 6 years ago

Thank you! This works very well!

krkri commented 5 years ago

Hi, I'm having similar issues. I can create a pdf using the flag "--flat". However, my "master slide" does not show up as background for all of the slides on the pdf. Works fine when opening the document as svg in firefox. I would be grateful if you could assist me. Best regards, Kristian

janoliver commented 5 years ago

Hi @krkri , could you maybe provide a minimal (not) working example?

krkri commented 5 years ago

Sure. Using inkslides --flat blackboardNew gives the pdf.

blackboardNew.zip