pirka 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8efc7a4fc80d21165bc3028ce64eaec7da9ad6a0
4
- data.tar.gz: cc83f7eda83e32e524382b68d0e38945ae37ad35
2
+ SHA256:
3
+ metadata.gz: bd1b22a15c9dd99418edca6f320dc3f6d5fbe152f74b0eaa17ba583610c5b9df
4
+ data.tar.gz: 735034a97ad26d56367c5ddb37f927dc17838a533cd23c90ae43d8cb07f3dd54
5
5
  SHA512:
6
- metadata.gz: 51263f69726fc459254de1fe5d466cf3fe46a54a4ae69610c5b605b0794e742aa06ce8f86362fb75819a06ff1c883454bd82481ea9116b90b544116918d7c875
7
- data.tar.gz: f59125cb2a8383bb709680c10308fac044ebedcfa42ce414434ec6bb7da5fcf9005d6dbc206c04ab621110106852332691279579e076967768f98545ca17a08e
6
+ metadata.gz: 993c374b526f34980c0948569256079ce6f75c485f67681a8efaba802242df36b9474f08d46651079ec0c96343924044cc79b7c5ec15695a4ead85a2d8167e69
7
+ data.tar.gz: 4a98c2df96fa0355dd8c56e0faa1925d003ad6b2413f9d465888792e1543f31e4ffc0940b49d24205f33fadbbd91b72dadcf193f3945f353a6c3851177e33583
data/.yardopts CHANGED
@@ -1 +1 @@
1
- --markup markdown --markup-provider kramdown --title "Pirka Documentation" --protected
1
+ --markup asciidoc --markup-provider asciidoctor --title "Pirka Documentation" --protected
@@ -1,14 +1,18 @@
1
- ### 0.1.2 / 2017-03-06
1
+ === 0.1.4 / 2019-05-03
2
+
3
+ * [BUG FIX]Don't refer to undefined variable
4
+
5
+ === 0.1.2 / 2017-03-06
2
6
 
3
7
  * Make it possible to specify CSS selector when detecting source code
4
8
  * Make it possible to use location specific middleware
5
9
  * Add `TextLineNum` middleware
6
10
 
7
- ### 0.1.1 / 2017-03-05
11
+ === 0.1.1 / 2017-03-05
8
12
 
9
13
  * Introduce middleware architecture
10
14
 
11
- ### 0.1.0 / 2017-03-05
15
+ === 0.1.0 / 2017-03-05
12
16
 
13
17
  * Initial release:
14
18
 
data/Gemfile CHANGED
@@ -5,10 +5,6 @@ gem 'epub-maker', path: '../epub-maker'
5
5
 
6
6
  gemspec
7
7
 
8
- group :development do
9
- gem 'kramdown'
10
- end
11
-
12
8
  if RUBY_PLATFORM.match /darwin/
13
9
  gem 'terminal-notifier'
14
10
  end
data/README.adoc ADDED
@@ -0,0 +1,206 @@
1
+ = Pirka
2
+
3
+ * https://gitlab.com/KitaitiMakoto/pirka[Homepage]
4
+ * http://www.rubydoc.info/gems/pirka[Documentation]
5
+ * mailto:KitaitiMakoto+at+,gmail.com[Email]
6
+
7
+ == Description
8
+
9
+ Pirka highlights source code syntax in EPUB books
10
+
11
+ == Features
12
+
13
+ * Highlights synatax in EPUB files
14
+ * Extracts `<code>` elements from EPUB files and asks you which programing language they are, and then uses them to highlight
15
+ * Downloads shared code and language information from Git repository
16
+
17
+ == Examples
18
+
19
+ === Highlighting source code syntax in EPUB books
20
+
21
+ ....
22
+ $ pirka path/to/book.epub
23
+ ....
24
+
25
+ It's a short cut to:
26
+
27
+ ....
28
+ $ pirka highlight path/to/book.epub
29
+ ....
30
+
31
+ To highlight books, run `pirka update`(see below for details) just after installation because `pirka highlight` requires library files.
32
+
33
+ === Detecting source code from EPUB books
34
+
35
+ ....
36
+ $ pirka detect path/to/book.epub
37
+ Detecting code from "Book Title"
38
+ Library file was saved to:
39
+ path/to/library.yaml
40
+ ....
41
+
42
+ `library.yaml` here includes:
43
+
44
+ * location of `<code>` element(expressed by link:http://www.idpf.org/epub/linking/cfi/[EPUB CFI] but you don't need to undarstand it.)
45
+ * `language` field with blank value
46
+ * file path in EPUB file(zip archive)
47
+ * source code
48
+
49
+ Example:
50
+
51
+ ....
52
+ epubcfi(/6/64!/4/2/30/2): # location
53
+ language: # language name. blank at first
54
+ item: OEBPS/text/p-003-003.xhtml # file path in zip archive
55
+ code: | # source code
56
+ f1 = open("|cat", "w")
57
+ f2 = open("|sed 's/a/b/'", "w")
58
+ f1.print "Hello\n"
59
+ f2.print "abc\n"
60
+ f1.close
61
+ f2.close
62
+ ....
63
+
64
+ In Pirka context, the file is called *library*.
65
+
66
+ `pirka highlight` command determines programming languages of source code according to this file.
67
+ Read source code, determine languages, write it at `language` field, remove `code` field, and then
68
+ you can highlight the EPUB file by `pirka highlight`.
69
+
70
+ You also determine languages interactively. Set `-i`(`--interactive`) option:
71
+
72
+ $ pirka detect -i path/to/book.epub
73
+
74
+ === Updating libraries
75
+
76
+ ....
77
+ $ pirka update
78
+ ....
79
+
80
+ Pirka provides official library files for some EPUB books as Git repository(https://gitlab.com/KitaitiMakoto/pirka-library). `pirka update` command fetches the files from the repository and you benefit from it.
81
+
82
+ Additionally, you can host library files by your own and make Pirka recognizes it by configuration file. See later section for that.
83
+
84
+ === Listing supported books
85
+
86
+ ....
87
+ $ pirka lib
88
+ ....
89
+
90
+ `pirka lib` command lists books Pirka can highlight with:
91
+
92
+ * Release Identifier(special identifier for EPUB books)
93
+ * location of library file
94
+ * title
95
+ * some other metadata
96
+
97
+ === Configuration
98
+
99
+ Pirka can be configured by environment variables, config file and command-line options.
100
+
101
+ ==== Environment variables
102
+
103
+ `XDG_DATA_HOME`::
104
+ Affects directory to save library files. +
105
+ Library files are saved to `$XDG_DATA_HOME/pirka/local` +
106
+ The directory is used to search library, too. +
107
+ Default: `$HOME/.local/share`
108
+
109
+ `XDG_DATA_DIRS`::
110
+ Affects directory to search library files. +
111
+ You can specify multiple directory by seperating with a colon like `XDG_DATA_DIRS=/dir1:/dir2`. +
112
+ `/dir1/pirka/local` and `/dir2/pirka/local` are used to search library, for example. +
113
+ Default: `/usr/local/share:/usr/share`
114
+
115
+ `XDG_CONFIG_HOME`::
116
+ Affects directory to search and save config file. +
117
+ `$XDG_CONFIG_DIRS/pirka.yaml` is recognized as config file. +
118
+ Default: `$HOME/.config`
119
+
120
+ `XDG_CONFIG_DIRS`::
121
+ Affects directory to search config file. +
122
+ You can specify multiple directory by seperating with a colon like `XDG_CONFIG_DIRS=/dir1:/dir2`. +
123
+ `/dir1/pirka.yaml` and `/dir2/pirka.yaml` are searched as config file. +
124
+ Default: `/etc/xdg`
125
+
126
+ ==== Config file
127
+
128
+ Config file is a YAML file. Properties below are recognized:
129
+
130
+ `data_home`::
131
+ Directory to save and search library files. +
132
+ Default: `$XDG_CONFIG_HOME/pirka/local`
133
+
134
+ `additional_directories`::
135
+ Directories to search library files. +
136
+ Expressed by sequence(array). +
137
+ Default: `[]`
138
+
139
+ `library_repositories`::
140
+ Git repository URIs used by `pirka lib` command. +
141
+ Expressed by sequence(array). +
142
+ Default: `[]`
143
+
144
+ ==== Command-line options
145
+
146
+ You can configure Pirka by `pirka` command's global options:
147
+
148
+ `-c`, `--config=FILE`::
149
+ Path to config file. +
150
+ Default: $HOME/.config/pirka.yaml
151
+
152
+ `-s`, `--data-home=DIRECTORY`::
153
+ Same to config file's `data_home` property.
154
+
155
+ `-d`, `--directory=DIRECTORY`::
156
+ Same to config file's `additional_directories` property. +
157
+ Able to multilpe times.
158
+
159
+ You can also see help by
160
+
161
+ ....
162
+ $ pirka --help
163
+ Pirka highlights source code syntax in EPUB files
164
+
165
+ Usage: pirka [global options] [<command>] [options]
166
+
167
+ Global options:
168
+ -c, --config=FILE Config file. Defaults to /Users/ikeda/.config/pirka.yaml
169
+ -s, --data-home=DIRECTORY Directory to *SAVE* library data
170
+ -d, --directory=DIRECTORY Directory to *SEARCH* library data.
171
+ Specify multiple times to add multiple directories.
172
+
173
+ Commands:
174
+ highlight Highlights source code in EPUB file
175
+ detect Detects source code from EPUB file and generate library file
176
+ update Update library files by remote files
177
+ lib Show library infomation
178
+ If command is ommitted, highlight is used with no option
179
+ ....
180
+
181
+ == Requirements
182
+
183
+ * Ruby 2.2 or later
184
+ * C compiler to compile link:http://www.nokogiri.org/[Nokogiri] gem
185
+
186
+ == Install
187
+
188
+ ....
189
+ $ gem install pirka
190
+ ....
191
+
192
+ === Make faster
193
+
194
+ By default, Pirka uses link:https://github.com/javanthropus/archive-zip[archive-zip] gem, a pure Ruby implementation, for zip archive but you can make command execution faster by using link:https://bitbucket.org/winebarrel/zip-ruby/wiki/Home[Zip/Ruby] gem, a C implementation. Just install Zip/Ruby:
195
+
196
+ ....
197
+ $ gem install zipruby
198
+ ....
199
+
200
+ Pirka, actually internally-used link:https://kitaitimakoto.gitlab.io/epub-parser/file.Home.html[EPUB Parser], tries to load Zip/Ruby and use it if available.
201
+
202
+ == Copyright
203
+
204
+ Copyright (c) 2017 KITAITI Makoto
205
+
206
+ See {file:COPYING.txt} for details.
data/Rakefile CHANGED
@@ -23,5 +23,6 @@ Rake::TestTask.new do |test|
23
23
  end
24
24
 
25
25
  require 'yard'
26
+ require 'asciidoctor'
26
27
  YARD::Rake::YardocTask.new
27
28
  task :doc => :yard
data/app/highlight.rb CHANGED
@@ -77,7 +77,7 @@ module Pirka
77
77
  def find_library(epub)
78
78
  library = @library_path ? Library.load_file(@library_path) :
79
79
  Library.find_by_release_identifier(epub.release_identifier)
80
- raise RuntimeError, "Cannot find code list #{Library.filename(epub.release_identifier)} for #{epub.release_identifier}(#{epub_path}) in any directory of #{Library.directories.join(", ")}" unless library
80
+ raise RuntimeError, "Cannot find code list #{Library.filename(epub.release_identifier)} for #{epub.release_identifier}(#{epub.epub_file}) in any directory of #{Library.directories.join(", ")}" unless library
81
81
  library
82
82
  end
83
83
 
data/lib/pirka/version.rb CHANGED
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Pirka
19
19
  # pirka version
20
- VERSION = "0.1.3"
20
+ VERSION = "0.1.4"
21
21
  EPUB_PARSER_VERSION = "0.3.2"
22
22
  end
data/pirka.gemspec CHANGED
@@ -46,4 +46,5 @@ Gem::Specification.new do |gem|
46
46
  gem.add_development_dependency 'pry'
47
47
  gem.add_development_dependency 'pry-doc'
48
48
  gem.add_development_dependency 'zipruby'
49
+ gem.add_development_dependency 'asciidoctor'
49
50
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pirka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - KITAITI Makoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-08 00:00:00.000000000 Z
11
+ date: 2019-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: epub-parser
@@ -234,6 +234,20 @@ dependencies:
234
234
  - - ">="
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: asciidoctor
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
237
251
  description: Pirka highlights source code syntax in EPUB books
238
252
  email: KitaitiMakoto@gmail.com
239
253
  executables:
@@ -245,9 +259,9 @@ files:
245
259
  - ".gitignore"
246
260
  - ".yardopts"
247
261
  - COPYING.txt
248
- - ChangeLog.md
262
+ - ChangeLog.adoc
249
263
  - Gemfile
250
- - README.md
264
+ - README.adoc
251
265
  - Rakefile
252
266
  - app.rb
253
267
  - app/detect.rb
@@ -285,8 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
285
299
  - !ruby/object:Gem::Version
286
300
  version: '0'
287
301
  requirements: []
288
- rubyforge_project:
289
- rubygems_version: 2.6.11
302
+ rubygems_version: 3.0.3
290
303
  signing_key:
291
304
  specification_version: 4
292
305
  summary: Syntax highlighting tool for EPUB books
data/README.md DELETED
@@ -1,203 +0,0 @@
1
- Pirka
2
- =====
3
-
4
- * [Homepage](https://gitlab.com/KitaitiMakoto/pirka)
5
- * [Documentation](http://www.rubydoc.info/gems/pirka)
6
- * [Email](mailto:KitaitiMakoto at gmail.com)
7
-
8
- Description
9
- -----------
10
-
11
- Pirka highlights source code syntax in EPUB books
12
-
13
- Features
14
- --------
15
-
16
- * Highlights synatax in EPUB files
17
- * Extracts `<code>` elements from EPUB files and asks you which programing language they are, and then uses them to highlight
18
- * Downloads shared code and language information from Git repository
19
-
20
- Examples
21
- --------
22
-
23
- ### Highlighting source code syntax in EPUB books ###
24
-
25
- $ pirka path/to/book.epub
26
-
27
- It's a short cut to:
28
-
29
- $ pirka highlight path/to/book.epub
30
-
31
- To highlight books, run `pirka update`(see below for details) just after installation because `pirka highlight` requires library files.
32
-
33
- ### Detecting source code from EPUB books ###
34
-
35
- $ pirka detect path/to/book.epub
36
- Detecting code from "Book Title"
37
- Library file was saved to:
38
- path/to/library.yaml
39
-
40
- `library.yaml` here includes:
41
-
42
- * location of `<code>` element(expressed by [EPUB CFI][] but you don't need to undarstand it.)
43
- * `language` field with blank value
44
- * file path in EPUB file(zip archive)
45
- * source code
46
-
47
- Example:
48
-
49
- epubcfi(/6/64!/4/2/30/2): # location
50
- language: # language name. blank at first
51
- item: OEBPS/text/p-003-003.xhtml # file path in zip archive
52
- code: | # source code
53
- f1 = open("|cat", "w")
54
- f2 = open("|sed 's/a/b/'", "w")
55
- f1.print "Hello\n"
56
- f2.print "abc\n"
57
- f1.close
58
- f2.close
59
-
60
- In Pirka context, the file is called *library*.
61
-
62
- `pirka highlight` command determines programming languages of source code according to this file.
63
- Read source code, determine languages, write it at `language` field, remove `code` field, and then
64
- you can highlight the EPUB file by `pirka highlight`.
65
-
66
- You also determine languages interactively. Set `-i`(`--interactive`) option:
67
-
68
- $ pirka detect -i path/to/book.epub
69
-
70
- [EPUB CFI]: http://www.idpf.org/epub/linking/cfi/
71
-
72
- ### Updating libraries ###
73
-
74
- $ pirka update
75
-
76
- Pirka provides official library files for some EPUB books as Git repository([https://gitlab.com/KitaitiMakoto/pirka-library](https://gitlab.com/KitaitiMakoto/pirka-library)). `pirka update` command fetches the files from the repository and you benefit from it.
77
-
78
- Additionally, you can host library files by your own and make Pirka recognizes it by configuration file. See later section for that.
79
-
80
- ### Listing supported books ###
81
-
82
- $ pirka lib
83
-
84
- `pirka lib` command lists books Pirka can highlight with:
85
-
86
- * Release Identifier(special identifier for EPUB books)
87
- * location of library file
88
- * title
89
- * some other metadata
90
-
91
- ### Configuration ###
92
-
93
- Pirka can be configured by environment variables, config file and command-line options.
94
-
95
- #### Environment variables ####
96
-
97
- `XDG_DATA_HOME`
98
- : Affects directory to save library files.
99
- : Library files are saved to `$XDG_DATA_HOME/pirka/local`
100
- : The directory is used to search library, too.
101
- : Default: `$HOME/.local/share`
102
-
103
- `XDG_DATA_DIRS`
104
- : Affects directory to save library files.
105
- : You can specify multiple directory by seperating with a colon like `XDG_DATA_DIRS=/dir1:/dir2`.
106
- : `/dir1/pirka/local` and `/dir2/pirka/local` are used to search library, for example.
107
- : Default: `/usr/local/share:/usr/share`
108
-
109
- `XDG_CONFIG_HOME`
110
- : Affects directory to search and save config file.
111
- : `$XDG_CONFIG_DIRS/pirka.yaml` is recognized as config file.
112
- : Default: `$HOME/.config`
113
-
114
- `XDG_CONFIG_DIRS`
115
- : Affects directory to search config file.
116
- : You can specify multiple directory by seperating with a colon like `XDG_CONFIG_DIRS=/dir1:/dir2`.
117
- : `/dir1/pirka.yaml` and `/dir2/pirka.yaml` are searched as config file.
118
- : Default: `/etc/xdg`
119
-
120
- #### Config file ####
121
-
122
- Config file is a YAML file. Properties below are recognized:
123
-
124
- `data_home`
125
- : Directory to save and search library files.
126
- : Default: `$XDG_CONFIG_HOME/pirka/local`
127
-
128
- `additional_directories`
129
- : Directories to search library files.
130
- : Expressed by sequence(array).
131
- : Default: `[]`
132
-
133
- `library_repositories`
134
- : Git repository URIs used by `pirka lib` command.
135
- : Expressed by sequence(array).
136
- : Default: `[]`
137
-
138
- #### Command-line options ####
139
-
140
- You can configure Pirka by `pirka` command's global options:
141
-
142
- `-c`, `--config=FILE`
143
- : Path to config file.
144
- : Default: /Users/ikeda/.config/pirka.yaml
145
-
146
- `-s`, `--data-home=DIRECTORY`
147
- : Same to config file's `data_home` property.
148
-
149
- `-d`, `--directory=DIRECTORY`
150
- : Same to config file's `additional_directories` property.
151
- : Able to multilpe times.
152
-
153
- You can also see help by
154
-
155
- $ pirka --help
156
- Pirka highlights source code syntax in EPUB files
157
-
158
- Usage: pirka [global options] [<command>] [options]
159
-
160
- Global options:
161
- -c, --config=FILE Config file. Defaults to /Users/ikeda/.config/pirka.yaml
162
- -s, --data-home=DIRECTORY Directory to *SAVE* library data
163
- -d, --directory=DIRECTORY Directory to *SEARCH* library data.
164
- Specify multiple times to add multiple directories.
165
-
166
- Commands:
167
- highlight Highlights source code in EPUB file
168
- detect Detects source code from EPUB file and generate library file
169
- update Update library files by remote files
170
- lib Show library infomation
171
- If command is ommitted, highlight is used with no option
172
-
173
- Requirements
174
- ------------
175
-
176
- * Ruby 2.2 or later
177
- * C compiler to compile [Nokogiri][] gem
178
-
179
- [Nokogiri]: http://www.nokogiri.org/
180
-
181
- Install
182
- -------
183
-
184
- $ gem install pirka
185
-
186
- ### Make faster ###
187
-
188
- By default, Pirka uses [archive-zip][] gem, a pure Ruby implementation, for zip archive but you can make command execution faster by using [Zip/Ruby][] gem, a C implementation. Just install Zip/Ruby:
189
-
190
- $ gem install zipruby
191
-
192
- Pirka, actually internally-used [EPUB Parser][], tries to load Zip/Ruby and use it if available.
193
-
194
- [archive-zip]: https://github.com/javanthropus/archive-zip
195
- [Zip/Ruby]: https://bitbucket.org/winebarrel/zip-ruby/wiki/Home
196
- [EPUB Parser]: http://www.rubydoc.info/gems/epub-parser/file/docs/Home.markdown
197
-
198
- Copyright
199
- ---------
200
-
201
- Copyright (c) 2017 KITAITI Makoto
202
-
203
- See {file:COPYING.txt} for details.