texttube 5.0.3 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.travis.yml +10 -0
- data/CHANGES.md +7 -0
- data/README.md +58 -0
- data/lib/texttube/filters/spiffing.rb +42 -0
- data/lib/texttube/version.rb +1 -1
- data/spec/spiffing_spec.rb +45 -0
- metadata +13 -16
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b47d63e19e203d6f4106bf4d2480564ee96066f8
|
4
|
+
data.tar.gz: 8571feb1cf49c77b3e988f51ab585fef6feb3aeb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c50fa2a734a53a7509332d181617534e05af3f2ba2dbcb9284ed3875601447ff525430b53bb2948268ea39d89124131aebc2fa9153ca7a1e38f649716b9ed7f4
|
7
|
+
data.tar.gz: e4496355c3571e6bbc8d17e7f296322c25113406733c3e58579e45caa33ef01e675934f081eb357d9fae42a65da68e0753242c8d14be5951d4bd81f3ecf248cb
|
data/.travis.yml
ADDED
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
Pass a string through filters to transform it.
|
4
4
|
|
5
|
+
### Note! ###
|
6
|
+
|
7
|
+
If you're having a problem with the TextTube::InsideBlock filter on Heroku it could be because of the version of Libxml2 it uses, as [the problem given here states](http://stackoverflow.com/q/8598958/335847), which means Nokogiri won't always work properly on Heroku. When using the InsideBlock filter this can be a problem, so use the `hpricot` branch instead.
|
8
|
+
|
9
|
+
### Build status ###
|
10
|
+
|
11
|
+
Master branch:
|
12
|
+
[](https://travis-ci.org/yb66/TextTube)
|
13
|
+
|
14
|
+
Develop branch:
|
15
|
+
[](https://travis-ci.org/yb66/TextTube)
|
16
|
+
|
5
17
|
### Why? ###
|
6
18
|
|
7
19
|
I wanted to run a filter across articles I'd written for [my blog](http://iainbarnett.me.uk/), but also for the atom feed to the blog. Both needed some of the filters, but the atom feed needed less of them and slightly different options.
|
@@ -290,6 +302,52 @@ The language was specified with a leading `::::ruby`. It didn't have to be as th
|
|
290
302
|
|
291
303
|
Many thanks to Eleni Karinou and [Annette Smith](https://twitter.com/moosecatear) for brainsplatting a new name for the library, and after many unusable and clearly disturbing suggestions, to Annette for the final name (and its future spin off, which will remain secret for now).
|
292
304
|
|
305
|
+
### Spiffing ###
|
306
|
+
|
307
|
+
Transforms CSS written in British English into its ugly sister from across the pond. Inspired by [visualidiot's SpiffingCSS](http://spiffingcss.com/).
|
308
|
+
|
309
|
+
content = <<CSS
|
310
|
+
body {
|
311
|
+
background-colour: darkgrey;
|
312
|
+
background-photograph: url(logo.gif);
|
313
|
+
transparency: .7;
|
314
|
+
|
315
|
+
font: 72px "Comic Sans", cursive !please;
|
316
|
+
font-weight: plump;
|
317
|
+
p { text-align: centre }
|
318
|
+
fieldset input {
|
319
|
+
text-transform: capitalise;
|
320
|
+
}
|
321
|
+
}
|
322
|
+
CSS
|
323
|
+
|
324
|
+
require 'texttube/base'
|
325
|
+
require 'texttube/filters/spiffing'
|
326
|
+
|
327
|
+
class CssString < TextTube::Base
|
328
|
+
register TextTube::Spiffing
|
329
|
+
end
|
330
|
+
|
331
|
+
puts CssString.new(content).filter
|
332
|
+
|
333
|
+
# output:
|
334
|
+
|
335
|
+
body {
|
336
|
+
background-color: darkgray;
|
337
|
+
background-image: url(logo.gif);
|
338
|
+
opacity: .7;
|
339
|
+
|
340
|
+
font: 72px "Comic Sans", cursive !important;
|
341
|
+
font-weight: bold;
|
342
|
+
p { text-align: center }
|
343
|
+
fieldset input {
|
344
|
+
text-transform: capitalize;
|
345
|
+
}
|
346
|
+
}
|
347
|
+
|
348
|
+
God save the Queen!
|
349
|
+
|
350
|
+
|
293
351
|
### Licence ###
|
294
352
|
|
295
353
|
Copyright (c) 2013 Iain Barnett
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require_relative "../filterable.rb"
|
3
|
+
|
4
|
+
module TextTube
|
5
|
+
|
6
|
+
# Will transform the Queen's English into American English for use in CSS, as the current CSS standards prefer ugly words.
|
7
|
+
# Inspired by visualidiot's SpiffingCSS (see http://spiffingcss.com/)
|
8
|
+
module Spiffing
|
9
|
+
extend TextTube::Filterable
|
10
|
+
|
11
|
+
filter_with :spiffing do |text|
|
12
|
+
TextTube::Spiffing.run text
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
# The dictionary.
|
17
|
+
DICTIONARY = {
|
18
|
+
# Queen's English # Primitive English from our stateside
|
19
|
+
# friends from across the pond.
|
20
|
+
'colour' => 'color',
|
21
|
+
'grey' => 'gray',
|
22
|
+
'!please' => '!important',
|
23
|
+
'transparency' => 'opacity',
|
24
|
+
'centre' => 'center',
|
25
|
+
'plump' => 'bold',
|
26
|
+
'photograph' => 'image',
|
27
|
+
'capitalise' => 'capitalize'
|
28
|
+
}
|
29
|
+
|
30
|
+
# @param [String] content
|
31
|
+
# @param [Hash] options
|
32
|
+
def self.run( content, options={})
|
33
|
+
ugly_child = content.dup
|
34
|
+
# warn ugly_child
|
35
|
+
DICTIONARY.each do |english, ugly|
|
36
|
+
ugly_child.sub! english, ugly
|
37
|
+
# warn ugly_child
|
38
|
+
end
|
39
|
+
ugly_child
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/texttube/version.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require_relative '../lib/texttube/base.rb'
|
5
|
+
require 'texttube/filters/spiffing'
|
6
|
+
|
7
|
+
describe "TextTube" do
|
8
|
+
let(:content) { <<CSS
|
9
|
+
body {
|
10
|
+
background-colour: darkgrey;
|
11
|
+
background-photograph: url(logo.gif);
|
12
|
+
transparency: .7;
|
13
|
+
|
14
|
+
font: 72px "Comic Sans", cursive !please;
|
15
|
+
font-weight: plump;
|
16
|
+
p { text-align: centre }
|
17
|
+
fieldset input {
|
18
|
+
text-transform: capitalise;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
CSS
|
22
|
+
}
|
23
|
+
|
24
|
+
let(:expected) { <<EXPECTED
|
25
|
+
body {
|
26
|
+
background-color: darkgray;
|
27
|
+
background-image: url(logo.gif);
|
28
|
+
opacity: .7;
|
29
|
+
|
30
|
+
font: 72px "Comic Sans", cursive !important;
|
31
|
+
font-weight: bold;
|
32
|
+
p { text-align: center }
|
33
|
+
fieldset input {
|
34
|
+
text-transform: capitalize;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
EXPECTED
|
38
|
+
}
|
39
|
+
class CssString < TextTube::Base
|
40
|
+
register TextTube::Spiffing
|
41
|
+
end
|
42
|
+
|
43
|
+
subject { CssString.new(content).filter }
|
44
|
+
it { should == expected }
|
45
|
+
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: texttube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0
|
5
|
-
prerelease:
|
4
|
+
version: 5.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Iain Barnett
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-07-25 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: nokogiri
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: coderay
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,20 +34,19 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '1.0'
|
46
|
-
description:
|
47
|
-
|
48
|
-
'
|
41
|
+
description: |2
|
42
|
+
Some markdown filters I find useful.
|
49
43
|
email: iainspeed @nospam@ gmail.com
|
50
44
|
executables: []
|
51
45
|
extensions: []
|
52
46
|
extra_rdoc_files: []
|
53
47
|
files:
|
54
48
|
- .gitignore
|
49
|
+
- .travis.yml
|
55
50
|
- CHANGES.md
|
56
51
|
- Gemfile
|
57
52
|
- README.md
|
@@ -66,6 +61,7 @@ files:
|
|
66
61
|
- lib/texttube/filters/embedding_video.rb
|
67
62
|
- lib/texttube/filters/inside_block.rb
|
68
63
|
- lib/texttube/filters/link_reffing.rb
|
64
|
+
- lib/texttube/filters/spiffing.rb
|
69
65
|
- lib/texttube/version.rb
|
70
66
|
- spec/coderay_spec.rb
|
71
67
|
- spec/embedding_audio_spec.rb
|
@@ -73,30 +69,30 @@ files:
|
|
73
69
|
- spec/link_reffing_spec.rb
|
74
70
|
- spec/markdownfilters_spec.rb
|
75
71
|
- spec/spec_helper.rb
|
72
|
+
- spec/spiffing_spec.rb
|
76
73
|
- texttube.gemspec
|
77
74
|
homepage: https://github.com/yb66/TextTube
|
78
75
|
licenses: []
|
76
|
+
metadata: {}
|
79
77
|
post_install_message:
|
80
78
|
rdoc_options: []
|
81
79
|
require_paths:
|
82
80
|
- lib
|
83
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
82
|
requirements:
|
86
|
-
- -
|
83
|
+
- - '>='
|
87
84
|
- !ruby/object:Gem::Version
|
88
85
|
version: 1.9.1
|
89
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
87
|
requirements:
|
92
|
-
- -
|
88
|
+
- - '>='
|
93
89
|
- !ruby/object:Gem::Version
|
94
90
|
version: '0'
|
95
91
|
requirements: []
|
96
92
|
rubyforge_project:
|
97
|
-
rubygems_version:
|
93
|
+
rubygems_version: 2.0.3
|
98
94
|
signing_key:
|
99
|
-
specification_version:
|
95
|
+
specification_version: 4
|
100
96
|
summary: Some useful filters for markdown that I use in my blogs
|
101
97
|
test_files:
|
102
98
|
- spec/coderay_spec.rb
|
@@ -105,3 +101,4 @@ test_files:
|
|
105
101
|
- spec/link_reffing_spec.rb
|
106
102
|
- spec/markdownfilters_spec.rb
|
107
103
|
- spec/spec_helper.rb
|
104
|
+
- spec/spiffing_spec.rb
|