Giter Club home page Giter Club logo

Comments (2)

tenfyzhong avatar tenfyzhong commented on June 17, 2024

I tested on python3.6 and everything seems to be working.

from tagbar-markdown.vim.

chriad avatar chriad commented on June 17, 2024

I had to change the following lines to make it work in my environment:

$ git diff bin/markdown2ctags.py
diff --git a/bin/markdown2ctags.py b/bin/markdown2ctags.py
index 71609db..6076679 100755
--- a/bin/markdown2ctags.py
+++ b/bin/markdown2ctags.py
@@ -103,13 +103,16 @@ settextSubjectRe = re.compile(r'^[^\s]+.*$')
 def findParent(previousSections, level):
     parents = filter(lambda s: s is not None,
                      reversed(previousSections[:level]))
-    return parents[0] if parents else None
+    l = list(parents)
+    if l:
+        return l[0]
+    else:
+        return None
 
 
 def findSections(filename, lines):
     sections = []
     inCodeBlock = False
-
     # Initialize previous sections to cope with documents that don't start
     # at the top-most heading type.
     previousSections = [None] * 7
@@ -214,7 +217,7 @@ def main():
         output = open(options.tagfile, 'wb')
 
     for filename in args:
-        f = open(filename, 'rb')
+        f = open(filename, 'r')
         lines = f.read().splitlines()
         f.close()
         sections = findSections(filename, lines)
○ → git diff ftplugin/markdown.vim
diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim
index 581c51a..0b9f1f6 100644
--- a/ftplugin/markdown.vim
+++ b/ftplugin/markdown.vim
@@ -18,7 +18,7 @@ endif
 let g:tagbar_type_markdown = {
             \'ctagstype': 'markdown',
             \ 'ctagsbin' : ctags_bin,
-            \ 'ctagsargs' : '-f - --sort=yes',
+            \ 'ctagsargs' : '-f - --sort=no',
             \ 'kinds' : [
             \     's:sections',
             \     'i:images',

I cannot use the --sort=yes switch because does not know how to compare two Tag objects

$ /home/chriad/.config/nvim/plugged/tagbar-markdown.vim/bin/markdown2ctags.py --sort=yes -f - ./README.md > tags
Traceback (most recent call last):
  File "/home/chriad/.config/nvim/plugged/tagbar-markdown.vim/bin/markdown2ctags.py", line 233, in <module>
    main()
  File "/home/chriad/.config/nvim/plugged/tagbar-markdown.vim/bin/markdown2ctags.py", line 225, in main
    genTagsFile(output, sectionsToTags(sections), sort=options.sort)
  File "/home/chriad/.config/nvim/plugged/tagbar-markdown.vim/bin/markdown2ctags.py", line 179, in genTagsFile
    tags = sorted(tags)
TypeError: '<' not supported between instances of 'Tag' and 'Tag'

from tagbar-markdown.vim.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.