card-mod-content 0.12.0 → 0.13.3

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
2
  SHA256:
3
- metadata.gz: c70d983eed31e1e69a646f97bfd617e414f4fc58f4e12b2e78779f4518911869
4
- data.tar.gz: 66fe32d82cd73cb8fbae02ef8e2bf568dad409d79f7430eddbce3d9be9836871
3
+ metadata.gz: 2d4bf4c3d68999515a54cd1015fdd183cf8bf0a756ffd2bd171b4ff4723d50b8
4
+ data.tar.gz: d2cfd66cd9b4ef214c70743010616fdefe65662731d7a475bc9788604d522074
5
5
  SHA512:
6
- metadata.gz: 58e6df74fa73efe4804c8a178da5aa1aca3e53d426b858d1a234510956061d93e3f6eee5194ba8c355006bcc8583447d70ab258d0c354443aa480acc61f4e168
7
- data.tar.gz: f912d472dcc0a6e6721f89045c94516510e1ceb47ffa65aacc74a25eb70b1bbef447f9999f19ac91d39cedfdc7044d29e0664c51ff3fca9d3026c178e2d3c96b
6
+ metadata.gz: b81064c8f3ccec506a7a244fcc8ba6a2e09174bf64c36378c93178c9997db0a34d70415892dfd4562984b9b8c439372c25642ede54a0c90923e09384b40b25cf
7
+ data.tar.gz: 850b39a36d0a179e39218cfcb2dd24c4f98bede5278bb1edebfb7fd1f9bf4a2da0fff5f7ab706f892a6967f1061df55c4c0026b38a1c8521d4727b7630e0a74b
@@ -0,0 +1,7 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ class AddAssetFileCard < Cardio::Migration::Core
4
+ def up
5
+ ensure_code_card "Asset file", type_id: Card::CardtypeID
6
+ end
7
+ end
@@ -0,0 +1,24 @@
1
+ def source_paths
2
+ []
3
+ end
4
+
5
+ def find_file file_path
6
+ unknown_file?(file_path) ? nil : file_path
7
+ end
8
+
9
+ def unknown_file? file_path
10
+ return false if File.exist? file_path
11
+
12
+ Rails.logger.info "couldn't locate file #{file_path}"
13
+ true
14
+ end
15
+
16
+ def existing_source_paths
17
+ Array.wrap(source_paths).reject do |file_path|
18
+ unknown_file?(file_path)
19
+ end.compact
20
+ end
21
+
22
+ def source_changed? since:
23
+ existing_source_paths.any? { |path| ::File.mtime(path) > since }
24
+ end
@@ -1,3 +1,5 @@
1
+ include_set Abstract::Sources
2
+
1
3
  class << self
2
4
  def included host_class
3
5
  track_mod_name host_class, caller
@@ -31,12 +33,6 @@ def source_dir
31
33
  end
32
34
  end
33
35
 
34
- def find_file filename
35
- File.join(mod_path, source_dir, filename).tap do |file_path|
36
- return nil if unknown_file? filename, file_path
37
- end
38
- end
39
-
40
36
  def mod_path
41
37
  modname = file_content_mod_name
42
38
  if (match = modname.match(/^card-mod-(\w*)/))
@@ -45,28 +41,17 @@ def mod_path
45
41
  Cardio::Mod.dirs.path modname
46
42
  end
47
43
 
48
- def unknown_file? filename, file_path
49
- return false if File.exist? file_path
50
-
51
- Rails.logger.info "couldn't locate file #{filename} at #{file_path}"
52
- true
53
- end
54
-
55
- def existing_source_paths
44
+ def source_paths
56
45
  Array.wrap(source_files).map do |filename|
57
- find_file(filename)
58
- end.compact
59
- end
60
-
61
- def source_changed? since:
62
- existing_source_paths.any? { |path| ::File.mtime(path) > since }
46
+ ::File.join mod_path, source_dir, filename
47
+ end
63
48
  end
64
49
 
65
50
  def content
66
- Array.wrap(source_files).map do |filename|
67
- if (source_path = find_file filename)
51
+ Array.wrap(source_paths).map do |path|
52
+ if (source_path = find_file path)
68
53
  Rails.logger.debug "reading file: #{source_path}"
69
- File.read source_path
54
+ ::File.read source_path
70
55
  end
71
56
  end.compact.join "\n"
72
57
  end
@@ -0,0 +1,14 @@
1
+ format :html do
2
+ view :input do
3
+ "Content can't be edited."
4
+ end
5
+
6
+ def short_content
7
+ fa_icon("exclamation-circle", class: "text-muted pr-2") +
8
+ wrap_with(:span, "read-only", class: "text-muted")
9
+ end
10
+
11
+ def standard_submit_button
12
+ multi_card_editor? ? super : ""
13
+ end
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-content
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-07-05 00:00:00.000000000 Z
13
+ date: 2021-09-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.102.0
21
+ version: 1.103.3
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 1.102.0
28
+ version: 1.103.3
29
29
  description: ''
30
30
  email:
31
31
  - info@decko.org
@@ -33,17 +33,19 @@ executables: []
33
33
  extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
+ - db/migrate_core_cards/20201115133753_add_asset_file_card.rb
36
37
  - lib/card/content/chunk/escaped_literal.rb
37
- - lib/card/content/chunk/keep_escaped_literal.rb
38
38
  - lib/card/content/chunk/link.rb
39
39
  - lib/card/content/chunk/nest.rb
40
40
  - lib/card/content/chunk/query_reference.rb
41
41
  - lib/card/content/chunk/reference.rb
42
42
  - lib/card/content/chunk/uri.rb
43
43
  - lib/card/content/chunk/view_stub.rb
44
- - set/abstract/code_file.rb
44
+ - set/abstract/00_sources.rb
45
+ - set/abstract/01_code_file.rb
45
46
  - set/abstract/haml_file.rb
46
47
  - set/abstract/lock.rb
48
+ - set/abstract/read_only.rb
47
49
  - set/abstract/templated_nests.rb
48
50
  - set/abstract/vendor_code_file.rb
49
51
  - set/all/chunk.rb
@@ -78,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
80
  - !ruby/object:Gem::Version
79
81
  version: '0'
80
82
  requirements: []
81
- rubygems_version: 3.2.15
83
+ rubygems_version: 3.1.6
82
84
  signing_key:
83
85
  specification_version: 4
84
86
  summary: card content handling
@@ -1,26 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- class Card
4
- class Content
5
- module Chunk
6
- # These are basic chunks that have a pattern and can be protected.
7
- # This chunk is used for markdown processing to ensure that
8
- # the escaping survives the markdown rendering.
9
- class KeepEscapedLiteral < Abstract
10
- FULL_RE = { "[" => /\A\\\[\[[^\]]*\]\]/,
11
- "{" => /\A\\\{\{[^}]*\}\}/ }.freeze
12
- Card::Content::Chunk.register_class self,
13
- prefix_re: '\\\\(?:\\[\\[|\\{\\{)',
14
- idx_char: "\\"
15
-
16
- def self.full_re prefix
17
- FULL_RE[prefix[1, 1]]
18
- end
19
-
20
- def interpret match, _content
21
- @process_chunk = match[0].sub(/^\\(.)/, '\\\\\\\\\1')
22
- end
23
- end
24
- end
25
- end
26
- end