How to use the sma.files.save_txt function in sma

To help you get started, we’ve selected a few sma examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sdockray / sma / sma / archiver.py View on Github external
if self.link and self.link in self.links:
			output = "%s%s\n" % (output, self.links[self.link].markdownify(summary=True))
		urls = utils.extract_urls(initial_message)
		for u in urls:
			if not u==self.link and u in self.links:
				output = "%s%s\n" % (output, self.links[u].markdownify(summary=True))
		output = "%s\n" % output
		for c in self.comments:
			output = "%s**%s:**\n%s\n\n" % (output, c.user.name, mdl(c.message))
		self.save_markdown(output, save_location=save_location) 
		#
		users_str = ' - '.join([self.users[k].name for k in self.users])
		if not save_location:
			title = initial_message if initial_message else self.link if hasattr(self, 'link') and self.link else 'no title available'
			title = utils.truncate(re.sub('[\r\n]', ' / ', title), 180)
			files.save_txt(title, subdir=self.id, filename="title.txt")
github sdockray / sma / sma / archiver.py View on Github external
#	output = "%s\n%s" % (output, self.links[k].markdownify(summary=True, prefer_snapshot=True))
		output = "%s\n\n" % output
		output = "%sPosts\n-----\n" % output
		# show all posts
		back_link = "[< back to %s](%s)" % (self.name, "/group/"+self.id)
		for k in self.posts:
			self.posts[k].markdownify(save_location=os.path.join(path, "%s.md" % k), back_link=back_link)
			output = "%s* [%s](%s)\n" % (output, self.posts[k].get_shorty(), "/group/%s/post/%s" %(self.id, k))
		output = "%s\n\n" % output
		output = "%sContributors\n------------\n" % output
		# show all posts
		for k in self.users:
			output = "%s* %s\n" % (output, self.users[k].name)
		# save
		self.save_markdown(output)
		files.save_txt(self.name, subdir=self.id, filename="title.txt")
github sdockray / sma / sma / archiver.py View on Github external
def save_markdown(self, md, save_location=None):
		files.save_txt(md, subdir=self.id, save_location=save_location)