Mercurial > hg > TextShaper
annotate textshaper/textshaper.py @ 8:22c830449604
textshaper/whitespace.py
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sun, 20 Oct 2013 18:07:06 -0700 |
parents | 6e382347af17 |
children |
rev | line source |
---|---|
1
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
2 |
6 | 3 # TODO: extract from this document |
4 | |
1
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
5 """ |
2
e5adf3414c6b
-> http://k0s.org/portfolio/ideas/cleanuptext.py
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
6 textshaper : text manipulation |
1
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
7 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
8 So you have a block of text ... |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
9 What do you want to do with it?!? |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
10 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
11 == Desired Functionality == |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
12 |
2
e5adf3414c6b
-> http://k0s.org/portfolio/ideas/cleanuptext.py
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
13 - onelineit |
e5adf3414c6b
-> http://k0s.org/portfolio/ideas/cleanuptext.py
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
14 - quoting |
e5adf3414c6b
-> http://k0s.org/portfolio/ideas/cleanuptext.py
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
15 - dequoting (including e.g. +/-, diff-ish shit) |
e5adf3414c6b
-> http://k0s.org/portfolio/ideas/cleanuptext.py
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
16 - remove whitespace |
e5adf3414c6b
-> http://k0s.org/portfolio/ideas/cleanuptext.py
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
17 - removing timestamps |
e5adf3414c6b
-> http://k0s.org/portfolio/ideas/cleanuptext.py
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
18 - removing/adding irc quote tags |
e5adf3414c6b
-> http://k0s.org/portfolio/ideas/cleanuptext.py
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
19 |
1
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
20 == Previous work == |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
21 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
22 /corpus of past programs -> consolidate/ |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
23 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
24 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
25 Interface: |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
26 - library code |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
27 - (n)curses |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
28 - javascript/REST |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
29 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
30 Consider the pattern: |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
31 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
32 * things that add and/or remove a thing |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
33 * things that alter spacing |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
34 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
35 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
36 == Reference == |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
37 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
38 Previous k0s.ware (big and small): |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
39 - http://k0s.org/hg/config/rev/5e0b4ec36013 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
40 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
41 Highly related (~> identity): http://k0s.org/portfolio/ideas/cleanuptext.py |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
42 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
43 Ubuntu packages: |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
44 - par (paragraph reformatter) |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
45 """ |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
46 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
47 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
48 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
49 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
50 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
51 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
52 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
53 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
54 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
55 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
56 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
57 |
92baf2c5652f
-> http://k0s.org/portfolio/ideas/textshaper.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
58 |
2
e5adf3414c6b
-> http://k0s.org/portfolio/ideas/cleanuptext.py
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
59 |