card-mod-content 0.14.2 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/real.yml +27 -0
- data/data/test.yml +32 -0
- data/lib/card/content/chunk/link.rb +0 -1
- data/lib/card/content/chunk/nest.rb +0 -2
- data/lib/card/content/chunk/uri.rb +17 -17
- data/set/abstract/01_code_content.rb +19 -0
- data/set/abstract/02_code_file.rb +32 -0
- data/set/abstract/read_only.rb +1 -1
- data/set/all/chunk.rb +12 -9
- metadata +10 -8
- data/db/migrate_core_cards/20201115133753_add_asset_file_card.rb +0 -7
- data/set/abstract/01_code_file.rb +0 -85
- data/set/abstract/vendor_code_file.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af70b2c7dd6325fddf41719756af50e5c495b579e5f07d8b6099aa97df929135
|
4
|
+
data.tar.gz: 478c8eb7b8df2e7a1482cbc31422c2c9f55b34c1e19e37343c0380405797cb25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23920a9f1ce7783de6e6fc29a69235b2e04b5c3fafba390279e9e646c31095a7472513d55ca701aa8dd5b67d5efb3aa1a202a5474fb389e89da28327dcfe3f62
|
7
|
+
data.tar.gz: 9eb909a81cd2e2dd4eb38f14e6fd3d6d135882e3765b27ad9814f3a48e3f09c911d60fb7a7f060bb4a386f4560d50c3df61b8f4a9e0003b9278f0b26d68c07b0
|
data/data/real.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
- :name: "*default"
|
2
|
+
:type: :setting
|
3
|
+
:codename: default
|
4
|
+
- :name: "*structure"
|
5
|
+
:type: :setting
|
6
|
+
:codename: structure
|
7
|
+
- :name:
|
8
|
+
- :all
|
9
|
+
- :default
|
10
|
+
|
11
|
+
- :name:
|
12
|
+
- :cardtype
|
13
|
+
- :type
|
14
|
+
- :structure
|
15
|
+
:content: |
|
16
|
+
{{+:description|content}}
|
17
|
+
{{_|add_button}}{{_|configure_button}}
|
18
|
+
{{+:type+:by_name|content}}
|
19
|
+
|
20
|
+
- :name:
|
21
|
+
- :cardtype
|
22
|
+
- :self
|
23
|
+
- :structure
|
24
|
+
:content: |-
|
25
|
+
{{+description|content}}
|
26
|
+
{{_|add_button}}{{_|configure_button}}\n
|
27
|
+
{{_|grouped_list}}\n"
|
data/data/test.yml
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
- :name: UserForm
|
3
|
+
:type: :cardtype
|
4
|
+
- :name: Book
|
5
|
+
:type: :cardtype
|
6
|
+
- :name: Author
|
7
|
+
:type: :cardtype
|
8
|
+
|
9
|
+
- :name:
|
10
|
+
- UserForm
|
11
|
+
- :type
|
12
|
+
- :structure
|
13
|
+
:type: :nest_list
|
14
|
+
:content: "{{+name}} {{+age}} {{+description}}"
|
15
|
+
- :name:
|
16
|
+
- Book
|
17
|
+
- :type
|
18
|
+
- :structure
|
19
|
+
:type: :nest_list
|
20
|
+
:content: by {{+author}}, design by {{+illustrator}}
|
21
|
+
|
22
|
+
- :name: Stam Broker
|
23
|
+
:type: Author
|
24
|
+
- :name: Darles Chickens
|
25
|
+
:type: Author
|
26
|
+
|
27
|
+
- :name: Iliad
|
28
|
+
:type: Book
|
29
|
+
- :name: Parry Hotter
|
30
|
+
:type: Book
|
31
|
+
- :name: 50 grades of shy
|
32
|
+
:type: Book
|
@@ -2,26 +2,26 @@
|
|
2
2
|
|
3
3
|
require "uri"
|
4
4
|
|
5
|
-
# This wiki chunk matches arbitrary URIs, using patterns from the Ruby URI
|
6
|
-
# modules.
|
7
|
-
# It parses out a variety of fields that could be used by formats to format
|
8
|
-
# the links in various ways (shortening domain names, hiding email addresses)
|
9
|
-
# It matches email addresses and host.com.au domains without schemes (http://)
|
10
|
-
# but adds these on as required.
|
11
|
-
#
|
12
|
-
# The heuristic used to match a URI is designed to err on the side of caution.
|
13
|
-
# That is, it is more likely to not autolink a URI than it is to accidently
|
14
|
-
# autolink something that is not a URI. The reason behind this is it is easier
|
15
|
-
# to force a URI link by prefixing 'http://' to it than it is to escape and
|
16
|
-
# incorrectly marked up non-URI.
|
17
|
-
#
|
18
|
-
# I'm using a part of the [ISO 3166-1 Standard][iso3166] for country name
|
19
|
-
# suffixes.
|
20
|
-
# The generic names are from www.bnoack.com/data/countrycode2.html)
|
21
|
-
# [iso3166]: http://geotags.com/iso3166/
|
22
5
|
class Card
|
23
6
|
class Content
|
24
7
|
module Chunk
|
8
|
+
# This wiki chunk matches arbitrary URIs, using patterns from the Ruby URI
|
9
|
+
# modules.
|
10
|
+
# It parses out a variety of fields that could be used by formats to format
|
11
|
+
# the links in various ways (shortening domain names, hiding email addresses)
|
12
|
+
# It matches email addresses and host.com.au domains without schemes (http://)
|
13
|
+
# but adds these on as required.
|
14
|
+
#
|
15
|
+
# The heuristic used to match a URI is designed to err on the side of caution.
|
16
|
+
# That is, it is more likely to not autolink a URI than it is to accidently
|
17
|
+
# autolink something that is not a URI. The reason behind this is it is easier
|
18
|
+
# to force a URI link by prefixing 'http://' to it than it is to escape and
|
19
|
+
# incorrectly marked up non-URI.
|
20
|
+
#
|
21
|
+
# I'm using a part of the [ISO 3166-1 Standard][iso3166] for country name
|
22
|
+
# suffixes.
|
23
|
+
# The generic names are from www.bnoack.com/data/countrycode2.html)
|
24
|
+
# [iso3166]: http://geotags.com/iso3166/
|
25
25
|
class Uri < Abstract
|
26
26
|
SCHEMES = %w[irc http https ftp ssh git sftp file ldap ldaps mailto].freeze
|
27
27
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
format :html do
|
2
|
+
view :input do
|
3
|
+
# Localize
|
4
|
+
"Content is stored in file and can't be edited."
|
5
|
+
end
|
6
|
+
|
7
|
+
view :bar_middle do
|
8
|
+
short_content
|
9
|
+
end
|
10
|
+
|
11
|
+
def short_content
|
12
|
+
icon_tag(:warning, class: "text-muted pe-2") +
|
13
|
+
wrap_with(:span, "file", class: "text-muted")
|
14
|
+
end
|
15
|
+
|
16
|
+
def standard_submit_button
|
17
|
+
multi_card_editor? ? super : ""
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
include_set Abstract::Sources
|
2
|
+
include_set Abstract::CodeContent
|
3
|
+
|
4
|
+
class << self
|
5
|
+
def included host_class
|
6
|
+
track_mod_name host_class, caller
|
7
|
+
end
|
8
|
+
|
9
|
+
def track_mod_name host_class, caller
|
10
|
+
host_class.mattr_accessor :file_content_mod_name
|
11
|
+
host_class.file_content_mod_name = Card::Set.mod_name(caller)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def source_paths
|
16
|
+
# OVERRIDE to use paths for content
|
17
|
+
end
|
18
|
+
|
19
|
+
def content
|
20
|
+
Array.wrap(source_paths).map do |path|
|
21
|
+
if (source_path = find_file path)
|
22
|
+
Rails.logger.debug "reading file: #{source_path}"
|
23
|
+
::File.read source_path
|
24
|
+
end
|
25
|
+
end.compact.join "\n"
|
26
|
+
end
|
27
|
+
|
28
|
+
format :html do
|
29
|
+
view :file_size do
|
30
|
+
"#{card.name}: #{number_to_human_size card.content.bytesize}"
|
31
|
+
end
|
32
|
+
end
|
data/set/abstract/read_only.rb
CHANGED
data/set/all/chunk.rb
CHANGED
@@ -124,21 +124,24 @@ format do
|
|
124
124
|
|
125
125
|
def explicit_edit_fields_config
|
126
126
|
edit_fields.map do |cardish, options|
|
127
|
-
|
128
|
-
options = normalized_edit_field_options options, Card::Name[field_mark]
|
129
|
-
[field_mark, options]
|
127
|
+
normalized_edit_field_config cardish, options
|
130
128
|
end
|
131
129
|
end
|
132
130
|
|
133
|
-
def
|
134
|
-
options ||=
|
135
|
-
|
131
|
+
def normalized_edit_field_config cardish, options={}
|
132
|
+
options ||= {}
|
133
|
+
field_mark = normalized_edit_field_mark cardish, options
|
134
|
+
options[:title] ||= Card::Name[field_mark]
|
135
|
+
[field_mark, options]
|
136
136
|
end
|
137
137
|
|
138
|
-
def normalized_edit_field_mark cardish, options
|
139
|
-
return cardish if
|
140
|
-
(options.is_a?(Hash) && options.delete(:absolute))
|
138
|
+
def normalized_edit_field_mark cardish, options={}
|
139
|
+
return cardish if options.delete(:absolute) || normalized_edit_field_mark?(cardish)
|
141
140
|
|
142
141
|
card.name.field cardish
|
143
142
|
end
|
143
|
+
|
144
|
+
def normalized_edit_field_mark? cardish
|
145
|
+
cardish.is_a?(Card) || (cardish.is_a?(String) && cardish.to_name.compound?)
|
146
|
+
end
|
144
147
|
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.
|
4
|
+
version: 0.15.1
|
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:
|
13
|
+
date: 2023-03-29 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.
|
21
|
+
version: 1.105.1
|
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.
|
28
|
+
version: 1.105.1
|
29
29
|
description: ''
|
30
30
|
email:
|
31
31
|
- info@decko.org
|
@@ -33,7 +33,8 @@ executables: []
|
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files: []
|
35
35
|
files:
|
36
|
-
-
|
36
|
+
- data/real.yml
|
37
|
+
- data/test.yml
|
37
38
|
- lib/card/content/chunk/escaped_literal.rb
|
38
39
|
- lib/card/content/chunk/link.rb
|
39
40
|
- lib/card/content/chunk/nest.rb
|
@@ -42,12 +43,12 @@ files:
|
|
42
43
|
- lib/card/content/chunk/uri.rb
|
43
44
|
- lib/card/content/chunk/view_stub.rb
|
44
45
|
- set/abstract/00_sources.rb
|
45
|
-
- set/abstract/
|
46
|
+
- set/abstract/01_code_content.rb
|
47
|
+
- set/abstract/02_code_file.rb
|
46
48
|
- set/abstract/haml_file.rb
|
47
49
|
- set/abstract/lock.rb
|
48
50
|
- set/abstract/read_only.rb
|
49
51
|
- set/abstract/templated_nests.rb
|
50
|
-
- set/abstract/vendor_code_file.rb
|
51
52
|
- set/all/chunk.rb
|
52
53
|
- set/all/contextual_content.rb
|
53
54
|
- set/all/templating.rb
|
@@ -65,6 +66,7 @@ metadata:
|
|
65
66
|
wiki_uri: https://decko.org
|
66
67
|
documentation_url: http://docs.decko.org/
|
67
68
|
card-mod: content
|
69
|
+
card-mod-group: gem-defaults
|
68
70
|
post_install_message:
|
69
71
|
rdoc_options: []
|
70
72
|
require_paths:
|
@@ -80,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
82
|
- !ruby/object:Gem::Version
|
81
83
|
version: '0'
|
82
84
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
85
|
+
rubygems_version: 3.3.11
|
84
86
|
signing_key:
|
85
87
|
specification_version: 4
|
86
88
|
summary: card content handling
|
@@ -1,85 +0,0 @@
|
|
1
|
-
include_set Abstract::Sources
|
2
|
-
|
3
|
-
class << self
|
4
|
-
def included host_class
|
5
|
-
track_mod_name host_class, caller
|
6
|
-
end
|
7
|
-
|
8
|
-
def track_mod_name host_class, caller
|
9
|
-
host_class.mattr_accessor :file_content_mod_name
|
10
|
-
host_class.file_content_mod_name = Card::Set.mod_name(caller)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
# FIXME: these should abstracted and configured on the types
|
15
|
-
# (same codes for `rake card:create:codefile`)
|
16
|
-
|
17
|
-
# @return [Array<String>, String] the name of file(s) to be loaded
|
18
|
-
def source_files
|
19
|
-
case type_id
|
20
|
-
when CoffeeScriptID then "#{codename}.js.coffee"
|
21
|
-
when JavaScriptID then "#{codename}.js"
|
22
|
-
when CssID then "#{codename}.css"
|
23
|
-
when ScssID then "#{codename}.scss"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def source_dir
|
28
|
-
case type_id
|
29
|
-
when CoffeeScriptID, JavaScriptID then "lib/javascript"
|
30
|
-
when CssID, ScssID then "lib/stylesheets"
|
31
|
-
else
|
32
|
-
"lib"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def mod_path
|
37
|
-
modname = file_content_mod_name
|
38
|
-
if (match = modname.match(/^card-mod-(\w*)/))
|
39
|
-
modname = match[1]
|
40
|
-
end
|
41
|
-
Cardio::Mod.dirs.path modname
|
42
|
-
end
|
43
|
-
|
44
|
-
def source_paths
|
45
|
-
Array.wrap(source_files).map do |filename|
|
46
|
-
::File.join mod_path, source_dir, filename
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def content
|
51
|
-
Array.wrap(source_paths).map do |path|
|
52
|
-
if (source_path = find_file path)
|
53
|
-
Rails.logger.debug "reading file: #{source_path}"
|
54
|
-
::File.read source_path
|
55
|
-
end
|
56
|
-
end.compact.join "\n"
|
57
|
-
end
|
58
|
-
|
59
|
-
format :html do
|
60
|
-
view :input do
|
61
|
-
# Localize
|
62
|
-
"Content is stored in file and can't be edited."
|
63
|
-
end
|
64
|
-
|
65
|
-
view :file_size do
|
66
|
-
"#{card.name}: #{number_to_human_size card.content.bytesize}"
|
67
|
-
end
|
68
|
-
|
69
|
-
def short_content
|
70
|
-
fa_icon("exclamation-circle", class: "text-muted pr-2") +
|
71
|
-
wrap_with(:span, "file", class: "text-muted")
|
72
|
-
end
|
73
|
-
|
74
|
-
def standard_submit_button
|
75
|
-
multi_card_editor? ? super : ""
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def coffee_files files
|
80
|
-
files.map { |f| "script_#{f}.js.coffee" }
|
81
|
-
end
|
82
|
-
|
83
|
-
def scss_files files
|
84
|
-
files.map { |f| "style_#{f}.scss" }
|
85
|
-
end
|