3 Star 0 Fork 0

Gitee 极速下载 / clippings-gem

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/BadTudou/clippings-gem
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README
MIT

Clippings

Clippings can parse notes and highlights in your Kindle clippings.

Installation

Add this line to your application's Gemfile:

gem 'clippings'

And then execute:

$ bundle

Or install it yourself as:

$ gem install clippings

Usage

require 'clippings'
clippings = Clippings::Parse.new("My Clippings.txt")
notes = clippings.parseForNote
notes.each do |title, note|
    print title, note[:author], note[:fragment]
end

Example

test.txt

==========
HTTP权威指南 (图灵程序设计丛书) ([美]David Gourley Brian Totty Marjorie Sayer Sailu Reddy Aushu Aggarwal)
- 您在位置 #425-426的标注 | 添加于 2017年6月16日星期五 下午8:21:59

下报文是如何通过传输控制协议(Transmission Control Protocol,TCP)连接从一个地方搬移到另一个地方去的。
==========
HTTP权威指南 (图灵程序设计丛书) ([美]David Gourley Brian Totty Marjorie Sayer Sailu Reddy Aushu Aggarwal)
- 您在位置 #802 的笔记 | 添加于 2017年6月16日星期五 下午9:02:31

解析相对url 的算法
==========
The Well-Grounded Rubyist, Second Edition (David A. Black)
- 您在位置 #7107-7107的标注 | 添加于 2017年9月5日星期二 上午10:13:28

Ranges have begin and end methods,
==========
The Well-Grounded Rubyist, Second Edition (David A. Black)
- 您在位置 #7193-7193的标注 | 添加于 2017年9月5日星期二 上午10:28:42

To remove an object, use delete:
==========

Code

require 'clippings'
clippings = Clippings::Parse.new("test.txt")
notes = clippings.parseForNote
p notes

Output

{
    "HTTP权威指南 (图灵程序设计丛书)"=>
        {
            :title=>"HTTP权威指南 (图灵程序设计丛书)", 
            :author=>"[美]David Gourley Brian Totty Marjorie Sayer Sailu Reddy Aushu Aggarwal", 
            :fragment=>
                [
                    {
                        :content=>"HTTP 是个应用层协议\r\n", 
                        :type=>"标注", 
                        :date=>" 2017年6月16日星期五 下午8:22:18"
                    }, 
                    {
                        :content=>"解析相对url 的算法\r\n", 
                        :type=>"笔记", 
                        :date=>" 2017年6月16日星期五 下午9:02:31"
                    }, 
                    {   
                        :content=>"RFC 2396 中\r\n", 
                        :type=>"标注", 
                        :date=>" 2017年6月16日星期五 下午9:02:31"
                    }
                ]
        }, 
    "The Well-Grounded Rubyist, Second Edition"=>
        {
            :title=>"The Well-Grounded Rubyist, Second Edition", 
            :author=>"David A. Black", 
            :fragment=>
                [
                    {
                        :content=>"Ranges have begin and end methods,\r\n",
                        :type=>"标注", 
                        :date=>" 2017年9月5日星期二 上午10:13:28"
                    }, 
                    {
                        :content=>"To remove an object, use delete:\r\n", 
                        :type=>"标注", 
                        :date=>" 2017年9月5日星期二 上午10:28:42"
                    }
                ]
        }
}

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/badtudou/clippings-gem.

License

The gem is available as open source under the terms of the MIT License.

The MIT License (MIT) Copyright (c) 2017 badtudou Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Clippings Clippings 能够解析 Kindle 剪贴文件中的笔记和标记 expand collapse
Ruby and 2 more languages
MIT
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
Ruby
1
https://gitee.com/mirrors/clippings-gem.git
git@gitee.com:mirrors/clippings-gem.git
mirrors
clippings-gem
clippings-gem
master

Search