You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This gem is a port of the [`html-pipeline` gem](https://github.com/jch/html-pipeline) to RubyMotion, for use on iOS and macOS. Currently synced with `html-pipeline` release [`v.2.11.0`](https://github.com/jch/html-pipeline/releases/tag/v2.11.0)
7
-
8
-
Several of the standard filters, such as `AutolinkFilter` and `EmojiFilter`, are initially disabled, as they rely on other Ruby gems that don't have RubyMotion equivalents. Please feel free to submit a pull request that enables any of them.
9
-
10
-
We use [HTMLKit](https://github.com/iabudiab/HTMLKit) to take the place of Nokogiri.
11
-
12
-
Below is a copy of the original README file, until I'm able to flesh this one out more.
13
-
14
-
But you can build a pipeline like this:
15
-
16
-
```ruby
17
-
pipeline =MotionHTMLPipeline::Pipeline.new [
18
-
MotionHTMLPipeline::Pipeline::HttpsFilter,
19
-
MotionHTMLPipeline::Pipeline::ImageMaxWidthFilter
20
-
]
21
-
result = pipeline.call("<a href='http://example.com/one.png'>link</a> <img src='one.png'>", {http_url:'http://example.com'})
22
-
result[:output].to_s
23
-
```
24
-
25
-
---
26
-
# HTML::Pipeline
6
+
_This gem is a port of the [`html-pipeline` gem](https://github.com/jch/html-pipeline) to RubyMotion, for use on iOS and macOS. Currently synced with `html-pipeline` release [`v.2.11.0`](https://github.com/jch/html-pipeline/releases/tag/v2.11.0)_
27
7
28
8
GitHub HTML processing filters and utilities. This module includes a small
29
9
framework for defining DOM based content filters and applying them to user
@@ -34,95 +14,93 @@ provided content. Read an introduction about this project in
34
14
-[Usage](#usage)
35
15
-[Examples](#examples)
36
16
-[Filters](#filters)
37
-
-[Dependencies](#dependencies)
17
+
-[Disabled Filters](#disabled-filters)
38
18
-[Documentation](#documentation)
39
19
-[Extending](#extending)
40
20
-[3rd Party Extensions](#3rd-party-extensions)
41
21
-[Instrumenting](#instrumenting)
42
22
-[Contributing](#contributing)
43
23
-[Contributors](#contributors)
44
-
-[Releasing A New Version](#releasing-a-new-version)
45
24
46
25
## Installation
47
26
48
27
Add this line to your application's Gemfile:
49
28
50
29
```ruby
51
-
gem 'html-pipeline'
30
+
gem 'motion-html-pipeline'
52
31
```
53
32
54
-
And then execute:
33
+
and to your `Rakefile`
55
34
56
-
```sh
57
-
$ bundle
35
+
```ruby
36
+
require'motion-html-pipeline'
58
37
```
59
38
60
-
Or install it yourself as:
39
+
And then execute:
61
40
62
41
```sh
63
-
$ gem install html-pipeline
42
+
$ bundle
64
43
```
65
44
66
45
## Usage
67
46
68
-
This library provides a handful of chainable HTML filters to transform user
69
-
content into markup. A filter takes an HTML string or
70
-
`Nokogiri::HTML::DocumentFragment`, optionally manipulates it, and then
47
+
This library provides a handful of chain-able HTML filters to transform user
48
+
content into markup. A filter takes an HTML string or a
49
+
`MotionHTMLPipeline::DocumentFragment`, optionally manipulates it, and then
71
50
outputs the result.
72
51
73
-
For example, to transform Markdown source into Markdown HTML:
52
+
For example, to transform an image URL into an image tag:
To generate CSS for HTML formatted code, use the [Rouge CSS Theme](https://github.com/jneen/rouge#css-theme-options)`#css` method. `rouge` is a dependency of the `SyntaxHighlightFilter`.
111
-
112
85
Some filters take an optional **context** and/or **result** hash. These are
113
86
used to pass around arguments and metadata between filters in a pipeline. For
114
-
example, if you don't want to use GitHub formatted Markdown, you can pass an
115
-
option in the context hash:
87
+
example, with the `AbsoluteSourceFilter` you can pass in `:image_base_url` in
*`MentionFilter` - replace `@user` mentions with links
181
158
*`AbsoluteSourceFilter` - replace relative image urls with fully qualified versions
159
+
*`HttpsFilter` - HTML Filter for replacing http github urls with https versions.
160
+
*`ImageMaxWidthFilter` - link to full size image for large images
161
+
162
+
### Disabled Filters
163
+
164
+
Several of the standard filters, such as `AutolinkFilter` and `EmojiFilter`, are initially disabled, as they rely on other Ruby gems that don't have RubyMotion equivalents. Please feel free to submit a pull request that enables any of them.
165
+
166
+
*`MentionFilter` - replace `@user` mentions with links
182
167
*`AutolinkFilter` - auto_linking urls in HTML
183
168
*`CamoFilter` - replace http image urls with [camo-fied](https://github.com/atmos/camo) https versions
184
169
*`EmailReplyFilter` - util filter for working with emails
[an issue](https://github.com/jch/html-pipeline/issues) first. This allows us discuss
258
-
whether the filter is a common enough use case to belong in this gem, or should be
259
-
built as an external gem.
217
+
Many people have built their own filters for [html-pipeline](https://github.com/jch/html-pipeline/issues). Although these have not been converted to run with RubyMotion, most of them should be easy convert.
260
218
261
219
Here are some extensions people have built:
262
220
@@ -282,22 +240,25 @@ Here are some extensions people have built:
282
240
283
241
## Instrumenting
284
242
243
+
_Although instrumenting was ported, it has not been used real-world, and may not work
244
+
properly at this time._
245
+
285
246
Filters and Pipelines can be set up to be instrumented when called. The pipeline
0 commit comments