예제 #1
0
 def handle(self, *args, **options):
     pages = Page.objects.all()
     for page in pages:
         content = page.load_content()
         page.content = wikinotes_markdown(content)
         page.save()
         self.stdout.write("Refreshed %s\n" % page)
예제 #2
0
	def handle(self, *args, **options):
		pages = Page.objects.all()
		for page in pages:
			content = page.load_content()
			page.content = wikinotes_markdown(content)
			page.save()
			self.stdout.write("Refreshed %s\n" % page)
예제 #3
0
	def save_content(self, content, message, username):
		self.content = wikinotes_markdown(content)
		self.save()
		path = self.get_filepath()
		repo = Git(path)
		filename = '%scontent.md' % path
		file = open(filename, 'wt')
		file.write(content.encode('utf-8'))
		file.close()
		repo.add('content.md')
		message = 'Minor edit' if not message else message
		repo.commit(message, username, '*****@*****.**')
예제 #4
0
파일: pages.py 프로젝트: tahnok/wikinotes
	def save_content(self, content, message, username):
		path = self.get_filepath()
		# If the file doesn't end with a newline, add one
		content += '' if content.endswith('\r\n') else '\r\n'
		self.content = wikinotes_markdown(content)
		self.save()
		repo = self.get_repo()
		filename = '%scontent.md' % path
		file = open(filename, 'wt')
		file.write(content.encode('utf-8'))
		file.close()

		repo.commit(message, username, '')
예제 #5
0
    def save_content(self, content, message, username, start=0, end=0):
        # If start and end are valid, use them
        if end > 0:
            saved_content = self.load_content()
            lines = saved_content.splitlines()
            # Ignore edge cases lol
            if end <= len(lines):
                all_lines = lines[:start] + content.splitlines() + lines[end:]
                content = '\r\n'.join(all_lines)

        path = self.get_filepath()
        # If the file doesn't end with a newline, add one
        content += '' if content.endswith('\r\n') else '\r\n'
        self.content = wikinotes_markdown(content)
        self.save()
        repo = self.get_repo()
        filename = '%scontent.md' % path
        file = open(filename, 'wt')
        file.write(content.encode('utf-8'))
        file.close()

        repo.commit(message, username, '')
예제 #6
0
    def save_content(self, content, message, username, start=0, end=0):
        # If start and end are valid, use them
        if end > 0:
            saved_content = self.load_content()
            lines = saved_content.splitlines()
            # Ignore edge cases lol
            if end <= len(lines):
                all_lines = lines[:start] + content.splitlines() + lines[end:]
                content = '\r\n'.join(all_lines)

        path = self.get_filepath()
        # If the file doesn't end with a newline, add one
        content += '' if content.endswith('\r\n') else '\r\n'
        self.content = wikinotes_markdown(content)
        self.save()
        repo = self.get_repo()
        filename = '%scontent.md' % path
        file = open(filename, 'wt')
        file.write(content.encode('utf-8'))
        file.close()

        commit = repo.commit(message, username, '')
        return commit.hexsha
예제 #7
0
	def test_markdown(self):
		# To make it easier to debug failures
		expected = self.expected.splitlines()
		for index, line in enumerate(wikinotes_markdown(self.raw).splitlines()):
			self.assertEqual(line, expected[index])