obf 0.2.6 → 0.2.7
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 +4 -4
- data/README.md +44 -3
- data/lib/obf/external.rb +1 -1
- data/lib/tinycolor_convert.js +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fef34ab3a181c76b6c107a31dce9afcc447cf739
|
4
|
+
data.tar.gz: 662acf486037c269ec73c1a412bab3602fb45028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cb389f8925f8ce59b0d968bcf1518870a68aa24f7ad38c28a5e53b1c0857eb2940410a9e07d0da02bcf02f082d623280ce203191031409cb1cbb4d2a0853d24
|
7
|
+
data.tar.gz: 1e6423f85d4668b8fa3eb49d7855ae0d7824cb7d6d519b130b52eafd16f9c15bb4e34a4c4d9b08d60ac8313de6c1c5c3d94686ca5b22c80931d35978d85359ff
|
data/README.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# OBF Parser
|
2
2
|
|
3
|
-
|
3
|
+
[](http://badge.fury.io/rb/obf)
|
4
|
+
|
5
|
+
This ruby library is to make it easier to handle .obf and .obz files. These files
|
6
|
+
are part of the Open Board Format, an effort to standardize communication board layouts
|
7
|
+
for assistive technology and AAC users. The file format is JSON-structured and can
|
8
|
+
be completely self-contained or reference external URLs.
|
9
|
+
|
10
|
+
This library makes it easy to convert to and from .obf and .obz files for generating
|
11
|
+
images and pdfs, and supports converting some proprietary formats to .obf and .obz.
|
4
12
|
|
5
13
|
## Installation
|
6
14
|
This is packaged as the `obf` rubygem, so you can just add the dependency to
|
@@ -11,12 +19,45 @@ your Gemfile or install the gem on your system:
|
|
11
19
|
To require the library in your project:
|
12
20
|
|
13
21
|
require 'obf'
|
22
|
+
|
23
|
+
External converters require node. PDF and PNG conversion require imagemagick and node.
|
24
|
+
PNG conversion also requires ghostscript.
|
14
25
|
|
15
26
|
## Usage
|
16
27
|
|
28
|
+
OBF supports multiple conversion schemes, the simplest of which are obf, obz, pdf and png
|
29
|
+
|
17
30
|
```ruby
|
18
|
-
|
31
|
+
# convert an .obf file to a .pdf
|
32
|
+
OBF::PDF.from_obf('path/to/input.obf', 'path/to/output.pdf')
|
33
|
+
# convert an .obz package to a .pdf
|
34
|
+
OBF::PDF.from_obf('path/to/input.obz', 'path/to/output.pdf')
|
35
|
+
|
36
|
+
# convert an .obf file to a .png image
|
37
|
+
OBF::PNG.from_obf('path/to/input.obf', 'path/to/output.png')
|
38
|
+
# convert an .obz package to a .png image
|
39
|
+
OBF::PNG.from_obf('path/to/input.obz', 'path/to/output.png')
|
19
40
|
```
|
20
41
|
|
21
|
-
|
42
|
+
The gem also supports converting some native packages into OBF files
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
content = OBF::Picto4Me.to_external('path/to/picto4mefile.zip')
|
46
|
+
OBF::OBZ.from_external(content, 'path/to/output.obz')
|
47
|
+
```
|
48
|
+
### External Imports
|
49
|
+
|
50
|
+
The <code>external</code> options are the most interesting. Once you understand the
|
51
|
+
makeup of these external resources, you can generate them from any other system and
|
52
|
+
easily convert a system's content to .obf, .obz, .pdf or .png.
|
53
|
+
|
54
|
+
The makeup of these files closely resembles the layout of an .obf file according to
|
55
|
+
the .obf spec. You can see an example generator in <code>lib/obf/picto4me.rb</code>,
|
56
|
+
or dig into the specifics yourself in <code>lib/obf/external.rb</code>.
|
57
|
+
|
58
|
+
## Future Work
|
22
59
|
|
60
|
+
We've talked about including some utilities to make translation easier. Basically
|
61
|
+
something that would take an .obf or .obz file and spit out a set of translation strings,
|
62
|
+
and another something that would take an .obf or .obz file and a set of translation strings
|
63
|
+
and generate a new, translated result.
|
data/lib/obf/external.rb
CHANGED
@@ -33,7 +33,7 @@ module OBF::External
|
|
33
33
|
'top' => original_button['top'],
|
34
34
|
'width' => original_button['width'],
|
35
35
|
'height' => original_button['height'],
|
36
|
-
'border_color' =>
|
36
|
+
'border_color' => OBF::Utils.fix_color(original_button['border_color'] || "#aaa", 'rgb'),
|
37
37
|
'background_color' => OBF::Utils.fix_color(original_button['background_color'] || "#fff", 'rgb')
|
38
38
|
}
|
39
39
|
if original_button['load_board']
|
data/lib/tinycolor_convert.js
CHANGED