How to use the sma.utils.extract_urls 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 u in self.links:
					text = text.replace(u, self.links[u].markdownify(summary=True))
			return text
		# make markdown
		output = ""
		if back_link:
			output = "%s\n\n" % back_link
		output = "%s_%s:_\n" % (output, self.initiator.name)
		initial_message = self.message
		initial_lines = initial_message.split('\n')
		for l in initial_lines:
			output = "%s### %s\n" % (output, l)
		ouput = "%s---\n" % output
		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
def mdl(text):
			urls = utils.extract_urls(text)
			for u in urls:
				if u in self.links:
					text = text.replace(u, self.links[u].markdownify(summary=True))
			return text
		# make markdown
github sdockray / sma / sma / archiver.py View on Github external
def mdl(text):
			urls = utils.extract_urls(text)
			for u in urls:
				if u in self.links:
					text = text.replace(u, self.links[u].markdownify(summary=True))
			return text
		# make path for posts