qutebrowser_url_mark 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3a5626e25b6b083441b55e0b3d7cd6b489c8e65732e72c04d2b9a26bed1e24c
4
- data.tar.gz: ad3561d51c1646657130b38d6ba80c70ced79cab8966f28fa29433a12d3e8a08
3
+ metadata.gz: 1e2722362d734db376956caf9cae4fe8b7851297f6597e781d5c9b9c1adae7b3
4
+ data.tar.gz: 1e024d0ee12032532a43445f04c998c139b3a81c3831b73e1a3de696f91d2d27
5
5
  SHA512:
6
- metadata.gz: e30cc66e220bc3b21b254e039855edb7ea0a92a8c4ed9a3ac5a7dcf8a896224454e1f0ff6f808faf8da1169ce6bf015dd3dac211eadee50c9fde31c4acab212e
7
- data.tar.gz: fd2470de8c5026d31f9848c50273880ea36eca1e0c9c74e7fd541184aed1f87a021acdb48d25c122bd2d1855423772308e83348194f92623051a210b0cfa9428
6
+ metadata.gz: 28d94822e9c59a2eb02cd509a7e6ae547dd83e92ee0f9da86692024a7febcd78edd49919dd587c2c95a70c8075b5e55c5172a8d8aa227adee1c0e0767542ea34
7
+ data.tar.gz: dda51fac0d6c2a880da159b900fc5d26256789b13b5a0fa4f263e35260d34470733d8a8c0818a2cfee17e9cb8888bdf14bd933609ec66fabe7c8f8b62a2d925f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.2.0 - 2025-04-06
6
+
7
+ Added XBEL dumper. Please see the example command line tool
8
+ `qutebrowser-url-mark` for its usage.
9
+
10
+ ## 0.1.1 - 2025-03-12
11
+
12
+ This is a maintenance release.
13
+
5
14
  ## 0.1.0 - 2024-01-09
6
15
 
7
16
  - Initial release
data/README.md CHANGED
@@ -27,4 +27,17 @@ Bug reports and pull requests are welcome.
27
27
 
28
28
  ## License
29
29
 
30
- This gem is released under the GNU General Public License version 3 or later.
30
+ Copyright (C) 2025 gemmaro
31
+
32
+ This program is free software: you can redistribute it and/or modify
33
+ it under the terms of the GNU General Public License as published by
34
+ the Free Software Foundation, either version 3 of the License, or
35
+ (at your option) any later version.
36
+
37
+ This program is distributed in the hope that it will be useful,
38
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
39
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40
+ GNU General Public License for more details.
41
+
42
+ You should have received a copy of the GNU General Public License
43
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
data/Rakefile CHANGED
@@ -13,11 +13,22 @@ Rake::TestTask.new(:test) do |t|
13
13
  t.test_files = FileList['test/**/*_test.rb']
14
14
  end
15
15
 
16
- require 'rubocop/rake_task'
16
+ default = %i[test]
17
17
 
18
- RuboCop::RakeTask.new
18
+ rubocop = true
19
19
 
20
- task default: %i[test rubocop]
20
+ begin
21
+ require 'rubocop/rake_task'
22
+ rescue LoadError
23
+ rubocop = false
24
+ end
25
+
26
+ if rubocop
27
+ RuboCop::RakeTask.new
28
+ default << :rubocop
29
+ end
30
+
31
+ task(default:)
21
32
 
22
33
  task :sig do
23
34
  sh 'typeprof',
@@ -1,11 +1,27 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # Copyright (C) 2025 gemmaro
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
3
18
  require 'yaml'
4
19
  require 'optparse'
5
20
  require 'logger'
6
21
  require 'json'
7
22
  require 'pp'
8
23
  require_relative '../lib/qutebrowser_url_mark'
24
+ require_relative '../lib/qutebrowser_url_mark/xbel_dumper'
9
25
 
10
26
  # proc which takes store and output
11
27
  dump = PP.method(:pp)
@@ -25,6 +41,7 @@ logger.level = :warn
25
41
  OptionParser.new do |parser|
26
42
  parser.on('--yaml', 'dump parsed store as YAML') { dump = YAML.method(:dump) }
27
43
  parser.on('--json', 'dump parsed store as JSON') { dump = JSON.method(:dump) }
44
+ parser.on("--xbel", "dump parsed store as XBEL") { dump = QutebrowserURLMark::XBELDumper }
28
45
  parser.on('--input=PATH', 'input path for URI marks') do |path|
29
46
  no_input_stream or logger.warn('input path') { 'ignoring stdin' }
30
47
  input = path
@@ -1,3 +1,18 @@
1
+ # Copyright (C) 2025 gemmaro
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
1
16
  module QutebrowserURLMark
2
- VERSION = '0.1.0'
17
+ VERSION = '0.2.0'
3
18
  end
@@ -0,0 +1,14 @@
1
+ require "rexml"
2
+
3
+ class QutebrowserURLMark::XBELDumper
4
+ def self.[](store, output)
5
+ document = REXML::Document.new
6
+ xbel = document.add_element("xbel", "version" => "1.0")
7
+ store.each do |name, link|
8
+ bookmark = xbel.add_element("bookmark", "href" => link)
9
+ title = bookmark.add_element("title")
10
+ title.text = name
11
+ end
12
+ document.write(output, _indent = 2)
13
+ end
14
+ end
@@ -1,27 +1,43 @@
1
+ # Copyright (C) 2025 gemmaro
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
1
16
  require 'uri'
2
17
  require 'stringio'
3
18
  require_relative 'qutebrowser_url_mark/version'
4
19
 
5
- # Parsing methods have an argument +store+, which is a class to insert URL marks.
6
- # The instance object of the class must have +new+ and +[]=+ method.
20
+ # Parsing methods have an argument +store+ with +[]=+ method.
7
21
  module QutebrowserURLMark
8
- class Error < StandardError; end
22
+ Error = Class.new(StandardError)
9
23
 
10
- def self.parse_quickmarks(source, store: Hash, parse_uri: true)
11
- source.each_line.each_with_object(Hash.new) do |line, store|
24
+ def self.parse_quickmarks(source, store: Hash.new, parse_uri: true)
25
+ source.each_line do |line|
12
26
  line.strip!
13
27
  key, _, url = line.rpartition(/\s+/)
14
- !key.empty? or raise Error, "invalid quickmark: #{line.inspect}"
28
+ key.empty? and raise Error, "invalid quickmark: #{line.inspect}"
15
29
  store[key] = parse_uri ? URI(url) : url
16
30
  end
31
+ store
17
32
  end
18
33
 
19
- def self.parse_bookmarks(source, store: Hash, parse_uri: true)
20
- source.each_line.each_with_object(Hash.new) do |line, store|
34
+ def self.parse_bookmarks(source, store: Hash.new, parse_uri: true)
35
+ source.each_line do |line|
21
36
  line.strip!
22
37
  url, _, key = line.partition(/\s+/)
23
38
  store[parse_uri ? URI(url) : url] = key
24
39
  end
40
+ store
25
41
  end
26
42
 
27
43
  class << self
data/manifest.scm CHANGED
@@ -1,2 +1,2 @@
1
1
  (specifications->manifest (list "ruby@3.1" "ruby-rubocop" "ruby-rubocop-rake"
2
- "ruby-simplecov"))
2
+ "ruby-simplecov" "ruby-rexml"))
@@ -1,3 +1,18 @@
1
+ # Copyright (C) 2025 gemmaro
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
1
16
  module QutebrowserURLMark
2
17
  VERSION: String
3
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qutebrowser_url_mark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - gemmaro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-09 00:00:00.000000000 Z
11
+ date: 2025-04-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: qutebrowser_url_mark is a library for parsing and serializing qutebrowser's
14
14
  URL marks (quickmarks or bookmarks).
@@ -27,6 +27,7 @@ files:
27
27
  - exe/qutebrowser-url-mark
28
28
  - lib/qutebrowser_url_mark.rb
29
29
  - lib/qutebrowser_url_mark/version.rb
30
+ - lib/qutebrowser_url_mark/xbel_dumper.rb
30
31
  - manifest.scm
31
32
  - sig/qutebrowser_url_mark.gen.rbs
32
33
  - sig/qutebrowser_url_mark.rbs
@@ -37,6 +38,7 @@ metadata:
37
38
  homepage_uri: https://codeberg.org/gemmaro/qutebrowser-url-mark
38
39
  source_code_uri: https://codeberg.org/gemmaro/qutebrowser-url-mark.git
39
40
  changelog_uri: https://codeberg.org/gemmaro/qutebrowser-url-mark/src/branch/main/CHANGELOG.md
41
+ documetation_uri: https://rubydoc.info/gems/qutebrowser_url_mark
40
42
  post_install_message:
41
43
  rdoc_options: []
42
44
  require_paths: