コード例 #1
0
    def do_publish(self, notename=""):
        import os.path
        publish_list = self.dirs[0]
        nopublish_list = self.dirs[1]

        #notename = os.path.basename(notename).replace(".org","").replace(".html","")

        publish_line = util.publish_note(notename)
        print(publish_line)

        nopublish_data = open(nopublish_list, "r").readlines()
        nopublish_data = [
            i.strip().replace("+ [[", "- [[") for i in nopublish_data
        ]

        if not os.path.exists(publish_list):
            output = open(publish_list, "w")
            print(publish_line, file=output)
            #self.scan()
            #for _note in reversed(sorted(self.notes_db.keys())):
            #    publish_line = util.publish_note(self.notes_db[_note])

            #    if publish_line in nopublish_data:
            #        continue
            #    print >> output,publish_line
            output.close()
        else:
            publish_line = util.publish_note(notename)

            if publish_line == None:
                print(
                    "ERROR: Can not publish note: %s, are you sure it exists?"
                    % notename)
                return

            data = open(publish_list, "r").readlines()
            data = [i.strip() for i in data]

            if publish_line in data or publish_line in nopublish_data:
                print("publish done")
                return
            output = open(publish_list, "w")
            print(publish_line, file=output)
            for line in data:
                if line in nopublish_data:
                    continue
                print(line, file=output)
            output.close()
        print("publish done")
コード例 #2
0
ファイル: parser.py プロジェクト: smashell/OrgNote
    def do_publish(self,notename=""):
        import os.path
        publish_list = self.dirs[0]
        nopublish_list = self.dirs[1]

        notename = os.path.basename(notename).replace(".org","").replace(".html","")

        publish_line = util.publish_note(notename)

        nopublish_data = open(nopublish_list,"r").readlines()
        nopublish_data = [i.strip().replace("+ [[","- [[") for i in nopublish_data]

        if not os.path.exists(publish_list):
            output = open(publish_list,"w")
            print >> output,publish_line
            #self.scan()
            #for _note in reversed(sorted(self.notes_db.keys())):
            #    publish_line = util.publish_note(self.notes_db[_note])
                
            #    if publish_line in nopublish_data: 
            #        continue
            #    print >> output,publish_line
            output.close()
        else:
            publish_line = util.publish_note(notename)

            if publish_line == None:
                print "ERROR: Can not publish note: %s, are you sure it exists?" % notename
                return

            data = open(publish_list,"r").readlines()
            data = [i.strip() for i in data]

            if publish_line in data or publish_line in nopublish_data:
                print "publish done"
                return
            output = open(publish_list,"w")
            print >> output,publish_line
            for line in data:
                if line in nopublish_data: 
                    continue
                print >> output,line
            output.close()
        print "publish done"
コード例 #3
0
ファイル: parser.py プロジェクト: smashell/OrgNote
    def do_status(self):
        
        publish_list = self.dirs[0]
        nopublish_list = self.dirs[1]
        
        publish_data = open(publish_list,"r").readlines()
        publish_data = [i.strip() for i in publish_data]

        nopublish_data = open(nopublish_list,"r").readlines()
        nopublish_data = [i.strip().replace("+ [[","- [[") for i in nopublish_data]
        
        all_publish = True
        self.scan()
        for _note in reversed(sorted(self.notes_db.keys())):
            publish_line = util.publish_note(self.notes_db[_note])
            if publish_line not in publish_data and publish_line not in nopublish_data:
                print "%s not publish yet!" % _note
                all_publish = False

        if all_publish:
            print "all notes published!"
コード例 #4
0
    def do_status(self):

        publish_list = self.dirs[0]
        nopublish_list = self.dirs[1]

        publish_data = open(publish_list, "r").readlines()
        publish_data = [i.strip() for i in publish_data]

        nopublish_data = open(nopublish_list, "r").readlines()
        nopublish_data = [
            i.strip().replace("+ [[", "- [[") for i in nopublish_data
        ]

        all_publish = True
        self.scan()
        for _note in reversed(sorted(self.notes_db.keys())):
            publish_line = util.publish_note(self.notes_db[_note])
            if publish_line not in publish_data and publish_line not in nopublish_data:
                print("%s not publish yet!" % _note)
                all_publish = False

        if all_publish:
            print("all notes published!")