# HG changeset patch # User Jeff Hammel # Date 1393145358 28800 # Node ID d87a17e1abac505b200ee206b6b339092a5417f4 # Parent 6e6a2adaa9f6c6ae0e1c041d0c285147e120cfa4 -> http://k0s.org/hg/TextShaper/rev/e6f680d25d63 diff -r 6e6a2adaa9f6 -r d87a17e1abac python/url2txt.py --- a/python/url2txt.py Thu Feb 20 12:11:17 2014 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -#!/usr/bin/env python - -# TODO: add url2txt as pluggable thingy for smartopen - -# xclip -o | sed 's/_//' | sed 's/.html//' - -def url2txt(url): - """gets the text equivalent of a URL""" - url = url.rstrip('/') - if '/' in url: - url = url.rsplit('/')[-1] - if '.' in url: - url = url.split('.', 1)[0] - url = url.replace('_', ' ') - return url - -if __name__ == '__main__': - import sys - print url2txt(' '.join(sys.argv[1:]))