shollingsworth / freeplane_tools

This package provides tooling around translating freeplane mindmap files into other useful formats
MIT License
3 stars 0 forks source link

parser error when node text has format #1

Open qyqx opened 3 years ago

qyqx commented 3 years ago

Error

mm2github.py -w -o /dev/stdout ~/t.mm 
Saving file to: /dev/stdout
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/bin/mm2github.py", line 48, in <module>
    main(args)
  File "/opt/homebrew/Caskroom/miniforge/base/bin/mm2github.py", line 38, in main
    mm.write_document(outfile)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/freeplane_tools/base.py", line 159, in write_document
    fileh.write(self.get_document())
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/freeplane_tools/github.py", line 46, in get_document
    self._toc(),
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/freeplane_tools/base.py", line 135, in _toc
    return "\n".join(n.toc_entry for n in self._iternodes() if n.toc_entry)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/freeplane_tools/base.py", line 135, in <genexpr>
    return "\n".join(n.toc_entry for n in self._iternodes() if n.toc_entry)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/freeplane_tools/base.py", line 107, in toc_entry
    return f"{pad}[{self.text}](#{self._toc_name})"
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/freeplane_tools/github.py", line 15, in _toc_name
    return re.sub("[^a-zA-Z0-9]", "-", self.text).lower() + "-"
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/re.py", line 210, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object

node content

<node ID="ID_1521234531" CREATED="1632342121801" MODIFIED="1637123461801"><richcontent TYPE="NODE">

<html>
  <head>

  </head>
  <body>
    <p>
      test text
    </p>
  </body>
</html>
</richcontent>
</node>
shollingsworth commented 2 years ago

I'll take a look at this in the next few days. thanks for submitting a bug report.