markdown_record 0.1.3 → 0.1.4

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.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +63 -43
  3. data/app/helpers/markdown_record/application_helper.rb +23 -0
  4. data/app/helpers/markdown_record/controller_helpers.rb +1 -1
  5. data/app/helpers/markdown_record/view_helpers.rb +9 -3
  6. data/{lib → app/models}/markdown_record/base.rb +10 -0
  7. data/{lib → app/models}/markdown_record/content_fragment.rb +17 -2
  8. data/lib/generators/markdown_record_generator.rb +6 -0
  9. data/lib/markdown_record/configuration.rb +4 -0
  10. data/lib/markdown_record/file_sorting/base.rb +25 -0
  11. data/lib/markdown_record/file_sorting/date_sorter.rb +14 -0
  12. data/lib/markdown_record/file_sorting/sem_ver_sorter.rb +47 -0
  13. data/lib/markdown_record/{association.rb → models/association.rb} +20 -3
  14. data/lib/markdown_record/{associations.rb → models/associations.rb} +17 -9
  15. data/lib/markdown_record/{content_associations.rb → models/content_associations.rb} +4 -2
  16. data/lib/markdown_record/models/filtering.rb +13 -0
  17. data/lib/markdown_record/models/filters/array_filter.rb +11 -0
  18. data/lib/markdown_record/models/filters/base_filter.rb +35 -0
  19. data/lib/markdown_record/models/filters/hash_filter.rb +81 -0
  20. data/lib/markdown_record/models/filters/nil_filter.rb +11 -0
  21. data/lib/markdown_record/models/filters/range_filter.rb +11 -0
  22. data/lib/markdown_record/models/filters/regexp_filter.rb +11 -0
  23. data/lib/markdown_record/models/filters/symbol_filter.rb +14 -0
  24. data/lib/markdown_record/models/filters.rb +22 -0
  25. data/lib/markdown_record/models/model_inflator.rb +65 -0
  26. data/lib/markdown_record/path_utilities.rb +20 -11
  27. data/lib/markdown_record/rendering/content_dsl/attribute.rb +22 -0
  28. data/lib/markdown_record/{content_dsl → rendering/content_dsl}/directory_fragment.rb +3 -3
  29. data/lib/markdown_record/{content_dsl → rendering/content_dsl}/disable.rb +2 -2
  30. data/lib/markdown_record/{content_dsl → rendering/content_dsl}/enable.rb +2 -2
  31. data/lib/markdown_record/{content_dsl → rendering/content_dsl}/end_attribute.rb +3 -3
  32. data/lib/markdown_record/{content_dsl → rendering/content_dsl}/end_model.rb +3 -3
  33. data/lib/markdown_record/{content_dsl → rendering/content_dsl}/fragment.rb +3 -3
  34. data/lib/markdown_record/rendering/content_dsl/model.rb +22 -0
  35. data/lib/markdown_record/rendering/content_dsl/scope.rb +22 -0
  36. data/lib/markdown_record/{content_dsl → rendering/content_dsl}/use_layout.rb +3 -3
  37. data/lib/markdown_record/rendering/content_dsl.rb +45 -0
  38. data/lib/markdown_record/rendering/html_renderer.rb +22 -0
  39. data/lib/markdown_record/{indexer.rb → rendering/indexer.rb} +0 -10
  40. data/lib/markdown_record/rendering/json_renderer.rb +20 -0
  41. data/lib/markdown_record/rendering/nodes/html_base.rb +95 -0
  42. data/lib/markdown_record/rendering/nodes/html_directory.rb +51 -0
  43. data/lib/markdown_record/rendering/nodes/html_file.rb +48 -0
  44. data/lib/markdown_record/rendering/nodes/json_base.rb +55 -0
  45. data/lib/markdown_record/rendering/nodes/json_directory.rb +69 -0
  46. data/lib/markdown_record/rendering/nodes/json_file.rb +172 -0
  47. data/lib/markdown_record/{rendering.rb → rendering/rendering.rb} +1 -1
  48. data/lib/markdown_record/{validator.rb → rendering/validator.rb} +4 -4
  49. data/lib/markdown_record/version.rb +1 -1
  50. data/lib/markdown_record.rb +21 -14
  51. data/templates/demo/content/10_custom_models_and_associations.md.erb +27 -7
  52. data/templates/demo/content/11_controller_helpers.md.erb +2 -2
  53. data/templates/demo/content/12_configuration.md.erb +22 -3
  54. data/templates/demo/content/13_sandbox/1_foo.md +2 -1
  55. data/templates/demo/content/13_sandbox/2_sandbox_nested/1_bar.md +4 -1
  56. data/templates/demo/content/1_home.md.erb +30 -13
  57. data/templates/demo/content/2_installation.md.erb +61 -46
  58. data/templates/demo/content/3_rendering_basics.md.erb +3 -3
  59. data/templates/demo/content/4_content_dsl.md.erb +22 -11
  60. data/templates/demo/content/5_routes.md.erb +10 -7
  61. data/templates/demo/content/6_model_basics.md.erb +11 -11
  62. data/templates/demo/content/7_content_frags.md.erb +9 -6
  63. data/templates/demo/content/8_erb_syntax_and_view_helpers.md.erb +32 -11
  64. data/templates/demo/content/9_layouts.md.erb +3 -3
  65. data/templates/demo/layouts/_global_layout.html.erb +1 -0
  66. data/templates/demo/models/dsl_command.rb +6 -0
  67. data/templates/demo/models/section.rb +5 -0
  68. data/templates/render_content.thor +2 -1
  69. data/templates/tests/assets/images/ruby-logo.png +0 -0
  70. data/templates/tests/content/1_test_files_home.md.erb +31 -0
  71. data/templates/tests/content/2_content_dsl_tests/1_content_dsl.md.erb +162 -0
  72. data/templates/tests/content/2_content_dsl_tests/2_nested_directory/1_associations.md.erb +83 -0
  73. data/templates/tests/layouts/_concatenated_layout.html.erb +12 -0
  74. data/templates/tests/layouts/_custom_layout.html.erb +14 -0
  75. data/templates/tests/layouts/_file_layout.html.erb +15 -0
  76. data/templates/tests/layouts/_global_layout.html.erb +116 -0
  77. metadata +53 -34
  78. data/app/models/markdown_record/demo/dsl_command.rb +0 -10
  79. data/app/models/markdown_record/demo/section.rb +0 -9
  80. data/app/models/markdown_record/tests/child_model.rb +0 -15
  81. data/app/models/markdown_record/tests/fake_active_record_model.rb +0 -13
  82. data/app/models/markdown_record/tests/model.rb +0 -15
  83. data/app/models/markdown_record/tests/other_child_model.rb +0 -15
  84. data/lib/markdown_record/cli.rb +0 -54
  85. data/lib/markdown_record/content_dsl/attribute.rb +0 -22
  86. data/lib/markdown_record/content_dsl/model.rb +0 -23
  87. data/lib/markdown_record/content_dsl/render_format.rb +0 -22
  88. data/lib/markdown_record/content_dsl/render_strategy.rb +0 -22
  89. data/lib/markdown_record/content_dsl.rb +0 -37
  90. data/lib/markdown_record/html_renderer.rb +0 -194
  91. data/lib/markdown_record/json_renderer.rb +0 -270
  92. data/lib/markdown_record/model_inflator.rb +0 -107
  93. data/lib/markdown_record/routes_renderer.rb +0 -0
  94. /data/lib/markdown_record/{file_saver.rb → rendering/file_saver.rb} +0 -0
@@ -0,0 +1,6 @@
1
+ class DslCommand < ::MarkdownRecord::Base
2
+ attribute :name
3
+ attribute :description
4
+
5
+ belongs_to_content :section
6
+ end
@@ -0,0 +1,5 @@
1
+ class Section < ::MarkdownRecord::Base
2
+ attribute :name
3
+
4
+ has_many_content :dsl_commands
5
+ end
@@ -1,7 +1,7 @@
1
1
  require "thor"
2
2
 
3
3
  class RenderContent < Thor
4
- include MarkdownRecord::Rendering
4
+ include MarkdownRecord::RenderingHelpers
5
5
 
6
6
  class_option :subdirectory, required: false, type: :string, aliases: :d, default: ""
7
7
  class_option :save, type: :boolean, aliases: :s, default: false
@@ -11,6 +11,7 @@ class RenderContent < Thor
11
11
  desc "html", "renders html content"
12
12
  def html
13
13
  return unless validate
14
+
14
15
  lines = []
15
16
  strategy_options = generate_render_strategy_options(options)
16
17
  report_start(lines, strategy_options, "html")
@@ -0,0 +1,31 @@
1
+ # Test Files Home
2
+
3
+ This file links to the other test files, and thus test the link helpers.
4
+
5
+ Here is a link to the Content DSL Test concatenated file:
6
+
7
+ <%= link_to_markdown_record(::MarkdownRecord::ContentFragment.find("content/content_dsl_tests"), "Content DSL Test File") %>
8
+
9
+ Here is a link to the associations file that uses `fragment.find_relative`:
10
+
11
+ <%= link_to_markdown_record(fragment.find_relative("content_dsl_tests/nested_directory/associations"), "Associations Test Files") %>
12
+
13
+ Here is a complete list of links to all the rendered test files (each item has a JSON and an HTML version), all of which use the routes described above:
14
+
15
+ <% ::MarkdownRecord::ContentFragment.all.each do |frag| %>
16
+ - <%= link_to_markdown_record(frag, frag.id) %><br>
17
+ <% end %>
18
+
19
+ <% ::MarkdownRecord::ContentFragment.all.each do |frag| %>
20
+ - <%= link_to_markdown_record_html(frag, frag.html_route) %><br>
21
+ <% end %>
22
+
23
+ <% ::MarkdownRecord::ContentFragment.all.each do |frag| %>
24
+ - <%= link_to_markdown_record_json(frag, frag.json_route) %><br>
25
+ <% end %>
26
+
27
+ Here is an image generated using `image_tag` to verify that Rails tag helpers are working:
28
+
29
+ <%= image_tag("ruby-logo") %>
30
+
31
+ <!--model { "id": 1, "type": "tests/model", "string_field": "foo", "int_field": 100, "float_field": 95.5, "bool_field": true, "date_field": "03/13/2023", "maybe_field": null, "hash_field": {} }-->
@@ -0,0 +1,162 @@
1
+ This file uses the following Content DSL Methods:
2
+
3
+ - `directory_fragment`
4
+ - `fragment`
5
+ - `use_layout`
6
+ - `scope`
7
+ - `model`
8
+ - `attribute` (using types: `html`, `md`, `int`, `float`, `string`)
9
+ - `end_attribute`
10
+ - `end_model`
11
+ - `disable`
12
+ - `enable`
13
+
14
+ This file should use the custom layout, which has a pink border.
15
+
16
+ ```html
17
+ <!---use_layout:_custom_layout.html.erb-->
18
+ ````
19
+ <!--use_layout:_custom_layout.html.erb-->
20
+
21
+ This file's directory content fragment is defined as so (the breadcrumb links should reflect the name field):
22
+
23
+ ```html
24
+ <!---directory_fragment { "name": "Content DSL Tests", "parent_id": "content/test_files_home" } -->
25
+ ````
26
+ <!--directory_fragment { "name": "Content DSL Tests", "parent_id": "content/test_files_home" } -->
27
+
28
+ This file's content fragment is defined as so:
29
+
30
+ ```html
31
+ <!---fragment { "string_field": "foo", "int_field": 100, "float_field": 95.5, "bool_field": true, "date_field": "03/13/2023", "maybe_field": null }-->
32
+ ````
33
+ <!--fragment { "string_field": "foo", "int_field": 100, "float_field": 95.5, "bool_field": true, "date_field": "03/13/2023", "maybe_field": null }-->
34
+
35
+ The models defined in this subdirectory and it's nested directories are all in an isolated scope, using the `scope` DSL method:
36
+
37
+ ```html
38
+ <!---scope:v_0_1_3-->
39
+ ````
40
+ <!--scope:v_0_1_3-->
41
+
42
+ The following MarkdownRecord::Tests::Model instances are defined:
43
+
44
+ ```html
45
+ <!---model { "id": 1, "type": "tests/model", "string_field": "foo", "int_field": 100, "float_field": 95.5, "bool_field": true, "date_field": "03/13/2023", "maybe_field": null, "hash_field": {} }-->
46
+ ```
47
+
48
+ <!--model { "id": 1, "type": "tests/model", "string_field": "foo", "int_field": 100, "float_field": 95.5, "bool_field": true, "date_field": "03/13/2023", "maybe_field": null, "hash_field": {} }-->
49
+
50
+ <% model = Tests::Model.find(1, "v_0_1_3")%>
51
+ Rendered: <% report = if model.present? %>
52
+ <span class="success">YES</span>
53
+ <% else %>
54
+ <span class="failure">NO</span>
55
+ <% end %>
56
+
57
+ ----
58
+
59
+ ```html
60
+ <!---model { "id": 2, "type": "tests/model", "string_field": "bar", "int_field": 42, "float_field": 99.9, "bool_field": false, "date_field": "12/25/2020", "maybe_field": 50, "hash_field": { "some_data": { "some_field": 999 }} }-->
61
+ ```
62
+
63
+ <!--model { "id": 2, "type": "tests/model", "string_field": "bar", "int_field": 42, "float_field": 99.9, "bool_field": false, "date_field": "12/25/2020", "maybe_field": 50, "hash_field": { "some_data": { "some_field": 999 }} }-->
64
+
65
+ <% model = Tests::Model.find(2, "v_0_1_3")%>
66
+ Rendered: <% report = if model.present? %>
67
+ <span class="success">YES</span>
68
+ <% else %>
69
+ <span class="failure">NO</span>
70
+ <% end %>
71
+
72
+ ----
73
+
74
+ The following attributes are defined:
75
+
76
+ ```html
77
+ <!---attribute:html:test_html_attribute-->
78
+ <p>This is an html test attribute value for test model 2.</p>
79
+ <!---end_attribute-->
80
+ ```
81
+
82
+ <!--attribute:html:test_html_attribute-->
83
+ <p>This is an html test attribute value for test model 2.</p>
84
+ <!--end_attribute-->
85
+
86
+ ----
87
+
88
+ ```html
89
+ <!---attribute:md:test_md_attribute-->
90
+ #### This is a markdown test attribute value for test model 2.
91
+ <!---end_attribute-->
92
+ ```
93
+
94
+ <!--attribute:md:test_md_attribute-->
95
+ #### This is a markdown test attribute value for test model 2.
96
+ <!--end_attribute-->
97
+
98
+ ----
99
+
100
+ ```html
101
+ <!---attribute:int:test_int_attribute-->
102
+ 999
103
+ <!---end_attribute-->
104
+ ```
105
+
106
+ <!--attribute:int:test_int_attribute-->
107
+ 999
108
+ <!--end_attribute-->
109
+
110
+ ----
111
+
112
+ The following model should not be rendered:
113
+
114
+ ```html
115
+ <!---disable-->
116
+ <!---model { "id": 3, "type": "tests/model", "string_field": "bar", "int_field": 42, "float_field": 99.9, "bool_field": false, "date_field": "12/25/2020", "maybe_field": 50, "hash_field": { "some_data": { "some_field": 999 }} }-->
117
+ <!---enable-->
118
+ ```
119
+
120
+ <!--disable-->
121
+ <!--model { "id": 3, "type": "tests/model", "string_field": "bar", "int_field": 42, "float_field": 99.9, "bool_field": false, "date_field": "12/25/2020", "maybe_field": 50, "hash_field": { "some_data": { "some_field": 999 }} }-->
122
+ <!--enable-->
123
+
124
+ <% model = Tests::Model.find(3, scope)%>
125
+ Rendered: <% report = if model.present? %>
126
+ <span class="failure">YES</span>
127
+ <% else %>
128
+ <span class="success">NO</span>
129
+ <% end %>
130
+
131
+ ----
132
+
133
+ More attributes:
134
+
135
+ ```html
136
+ <!---attribute:float:test_float_attribute-->
137
+ 96.3
138
+ <!---end_attribute-->
139
+ ```
140
+
141
+ ----
142
+
143
+ <!--attribute:float:test_float_attribute-->
144
+ 96.3
145
+ <!--end_attribute-->
146
+
147
+ <!--end_model-->
148
+
149
+ This attribute should be on the first model, instead of the second one:
150
+
151
+ ```html
152
+ <!---attribute:string:test_float_attribute-->
153
+ This is a string test attribute value for test model 1.
154
+ <!---end_attribute-->
155
+ ```
156
+
157
+ <!--attribute:string:test_float_attribute-->
158
+ This is a string test attribute value for test model 1.
159
+ <!--end_attribute-->
160
+
161
+ <!--end_model-->
162
+
@@ -0,0 +1,83 @@
1
+ <!--directory_fragment { "author": "You", "name": "Sandbox", "parent_id": "content/content_dsl_tests/content_dsl" } -->
2
+ <!--use_layout:_custom_layout.html.erb-->
3
+
4
+ This file should use the custom layout, which has a pink border.
5
+
6
+ This file defines several Tests::ChildModel instances:
7
+
8
+ ```html
9
+ <!---model { "id": 1, "type": "tests/child_model", "model_id": 1, "string_field": "hey", "int_field": 100, "float_field": 95.5, "bool_field": true, "date_field": "03/13/2023", "maybe_field": null, "hash_field": {} }-->
10
+ ```
11
+
12
+ <!--model { "id": 1, "type": "tests/child_model", "model_id": 1, "string_field": "hey", "int_field": 100, "float_field": 95.5, "bool_field": true, "date_field": "03/13/2023", "maybe_field": null, "hash_field": {} }-->
13
+
14
+ <% model = Tests::ChildModel.find(1, scope)%>
15
+ Rendered: <% report = if model.present? %>
16
+ <span class="success">YES</span>
17
+ <% else %>
18
+ <span class="failure">NO</span>
19
+ <% end %>
20
+
21
+ ----
22
+
23
+ ```html
24
+ <!---model { "id": 2, "type": "tests/child_model", "model_id": 1, "string_field": "asdf", "int_field": 333, "float_field": 10.5, "bool_field": false, "date_field": "01/01/2000", "maybe_field": 7, "hash_field": {} }-->
25
+ ```
26
+
27
+ <!--model { "id": 2, "type": "tests/child_model", "model_id": 1, "string_field": "asdf", "int_field": 333, "float_field": 10.5, "bool_field": false, "date_field": "01/01/2000", "maybe_field": 7, "hash_field": {} }-->
28
+
29
+ <% model = Tests::ChildModel.find(2, scope)%>
30
+ Rendered: <% report = if model.present? %>
31
+ <span class="success">YES</span>
32
+ <% else %>
33
+ <span class="failure">NO</span>
34
+ <% end %>
35
+
36
+ ----
37
+
38
+ ```html
39
+ <!---model { "id": 3, "type": "tests/child_model", "model_id": 2, "string_field": "qwert", "int_field": 42, "float_field": 1776, "bool_field": true, "date_field": "09/11/2001", "maybe_field": null, "hash_field": { "some_data": { "some_field": 555 }} }-->
40
+ ```
41
+
42
+ <!--model { "id": 3, "type": "tests/child_model", "model_id": 2, "string_field": "qwert", "int_field": 42, "float_field": 1776, "bool_field": true, "date_field": "09/11/2001", "maybe_field": null, "hash_field": { "some_data": { "some_field": 555 }} }-->
43
+
44
+ <% model = Tests::ChildModel.find(3, scope)%>
45
+ Rendered: <% report = if model.present? %>
46
+ <span class="success">YES</span>
47
+ <% else %>
48
+ <span class="failure">NO</span>
49
+ <% end %>
50
+
51
+ ----
52
+
53
+ ```html
54
+ <!---model { "id": 4, "type": "tests/child_model", "model_id": 2, "string_field": "ho", "int_field": 42, "float_field": 99.9, "bool_field": false, "date_field": "12/25/2020", "maybe_field": 50, "hash_field": { "some_data": { "some_field": 999 }} }-->
55
+ ```
56
+
57
+ <!--model { "id": 4, "type": "tests/child_model", "model_id": 2, "string_field": "ho", "int_field": 42, "float_field": 99.9, "bool_field": false, "date_field": "12/25/2020", "maybe_field": 50, "hash_field": { "some_data": { "some_field": 999 }} }-->
58
+
59
+ <% model = Tests::ChildModel.find(4, scope)%>
60
+ Rendered: <% report = if model.present? %>
61
+ <span class="success">YES</span>
62
+ <% else %>
63
+ <span class="failure">NO</span>
64
+ <% end %>
65
+
66
+ ----
67
+
68
+ And one MarkdownRecord::Tests::OtherChildModels:
69
+
70
+ ```html
71
+ <!---model { "id": 1, "type": "tests/other_child_model", "model_id": 2, "string_field": "ho", "int_field": 42, "float_field": 99.9, "bool_field": false, "date_field": "12/25/2020", "maybe_field": 50, "hash_field": { "some_data": { "some_field": 999 }} }-->
72
+ ```
73
+
74
+ <!--model { "id": 1, "type": "tests/other_child_model", "model_id": 2, "string_field": "ho", "int_field": 42, "float_field": 99.9, "bool_field": false, "date_field": "12/25/2020", "maybe_field": 50, "hash_field": { "some_data": { "some_field": 999 }} }-->
75
+
76
+ <% model = Tests::OtherChildModel.find(1, scope)%>
77
+ Rendered: <% report = if model.present? %>
78
+ <span class="success">YES</span>
79
+ <% else %>
80
+ <span class="failure">NO</span>
81
+ <% end %>
82
+
83
+ ----
@@ -0,0 +1,12 @@
1
+ <style>
2
+ .concatenated{
3
+ border: 1px solid #a5d6ff;
4
+ padding: 10px;
5
+ }
6
+ </style>
7
+
8
+ <div class="concatenated">
9
+ <%= raw(html) %>
10
+ <%= raw("<!--#{subdirectory}/#{filename}-->") %>
11
+ <p class="rendered_at"><em>The above content was rendered from source files at: <%= link_to_markdown_record(fragment, fragment.id) %></em></p>
12
+ </div>
@@ -0,0 +1,14 @@
1
+ <style>
2
+ .custom_layout_file {
3
+ padding: 10px;
4
+ border: 1px solid pink;
5
+ margin-bottom: 10px;
6
+ }
7
+ </style>
8
+
9
+ <div class="custom_layout_file">
10
+ <h3>Rendered Using a Custom Layout</h3>
11
+ <%= raw(html) %>
12
+ <%= raw("<!--#{subdirectory}/#{filename}-->") %>
13
+ <p class="rendered_at"><em>The above content was rendered from source files at: <%= link_to_markdown_record(fragment, fragment.id) %></em></p>
14
+ </div>
@@ -0,0 +1,15 @@
1
+ <style>
2
+
3
+ .file {
4
+ padding: 10px;
5
+ border: 1px solid #cc4400;
6
+ margin-bottom: 10px;
7
+ }
8
+
9
+ </style>
10
+
11
+ <div class="file">
12
+ <%= raw(html) %>
13
+ <%= raw("<!--#{subdirectory}/#{filename}-->") %>
14
+ <p class="rendered_at"><em>The above content was rendered from source files at: <%= link_to_markdown_record(fragment, fragment.id) %></em></p>
15
+ </div>
@@ -0,0 +1,116 @@
1
+ <style>
2
+ body{
3
+ background-color: black;
4
+ padding: 10px;
5
+ }
6
+
7
+ code{
8
+ padding: 0.2em 0.4em;
9
+ margin: 0;
10
+ font-size: 85%;
11
+ white-space: break-spaces;
12
+ background-color: rgb(110 118 129 / 40%);
13
+ border-radius: 6px;
14
+ }
15
+
16
+ pre{
17
+ padding: 16px;
18
+ overflow: auto;
19
+ font-size: 85%;
20
+ line-height: 1.45;
21
+ color: #f2f2f2;
22
+ background-color: #161b22;
23
+ border-radius: 6px;
24
+ font-family: andale mono, monaco, monospace;
25
+ word-wrap: normal;
26
+ }
27
+
28
+ pre code{
29
+ color: inherit;
30
+ background-color: inherit;
31
+ font-family: inherit;
32
+ padding: 0px;
33
+ margin: 0;
34
+ font-size: inherit;
35
+ white-space: inherit;
36
+ background-color: inherit;
37
+ border-radius: 0px;
38
+ }
39
+
40
+ h1{
41
+ color: #6699ff;
42
+ }
43
+
44
+ h2{
45
+ color: #b3ccff;
46
+ }
47
+
48
+ h3{
49
+ color: #b3ccff;
50
+ }
51
+
52
+ h4{
53
+ color: #b3ccff;
54
+ }
55
+
56
+ a{
57
+ color: #33ffcc;
58
+ }
59
+
60
+ .container {
61
+ margin-bottom: 10px;
62
+ padding: 10px;
63
+ color: #f2f2f2;
64
+ background-color: #0d1117;
65
+ font-family: trebuchet ms;
66
+ font-size: 16px;
67
+ line-height: 1.5;
68
+ }
69
+
70
+ .rendered_at{
71
+ font-size: 12px;
72
+ }
73
+
74
+ .navigation ul{
75
+ padding: 0px;
76
+ }
77
+
78
+ .navigation li{
79
+ display: inline;
80
+ }
81
+
82
+ .success{
83
+ color: green;
84
+ }
85
+
86
+ .failure{
87
+ color: red;
88
+ }
89
+ </style>
90
+
91
+ <div class="container">
92
+ <div class="navigation">
93
+ <ul>
94
+ <li>Breadcrumbs: </li>
95
+ <% fragment.parents_from("content/test_files_home").each_with_index do |frag, index| %>
96
+ <% unless index == 0%>
97
+ <span class="breadcrumb_divider">/</span>
98
+ <% end %>
99
+ <li><%= link_to_markdown_record(frag)%></li>
100
+ <% end %>
101
+ </ul>
102
+ </div>
103
+ <%= raw(html) %>
104
+ <%= raw("<!--#{subdirectory}/#{filename}-->") %>
105
+ <div class="navigation">
106
+ <ul>
107
+ <li>Breadcrumbs: </li>
108
+ <% fragment.parents_from("content/test_files_home").each_with_index do |frag, index| %>
109
+ <% unless index == 0%>
110
+ <span class="breadcrumb_divider">/</span>
111
+ <% end %>
112
+ <li><%= link_to_markdown_record(frag)%></li>
113
+ <% end %>
114
+ </ul>
115
+ </div>
116
+ </div>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_record
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
  - Bryant Morrill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-15 00:00:00.000000000 Z
11
+ date: 2023-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -171,48 +171,57 @@ files:
171
171
  - app/helpers/markdown_record/application_helper.rb
172
172
  - app/helpers/markdown_record/controller_helpers.rb
173
173
  - app/helpers/markdown_record/view_helpers.rb
174
- - app/models/markdown_record/demo/dsl_command.rb
175
- - app/models/markdown_record/demo/section.rb
176
- - app/models/markdown_record/tests/child_model.rb
177
- - app/models/markdown_record/tests/fake_active_record_model.rb
178
- - app/models/markdown_record/tests/model.rb
179
- - app/models/markdown_record/tests/other_child_model.rb
174
+ - app/models/markdown_record/base.rb
175
+ - app/models/markdown_record/content_fragment.rb
180
176
  - config/routes.rb
181
177
  - lib/generators/markdown_record_generator.rb
182
178
  - lib/markdown_record.rb
183
- - lib/markdown_record/association.rb
184
- - lib/markdown_record/associations.rb
185
- - lib/markdown_record/base.rb
186
- - lib/markdown_record/cli.rb
187
179
  - lib/markdown_record/configuration.rb
188
- - lib/markdown_record/content_associations.rb
189
- - lib/markdown_record/content_dsl.rb
190
- - lib/markdown_record/content_dsl/attribute.rb
191
- - lib/markdown_record/content_dsl/directory_fragment.rb
192
- - lib/markdown_record/content_dsl/disable.rb
193
- - lib/markdown_record/content_dsl/enable.rb
194
- - lib/markdown_record/content_dsl/end_attribute.rb
195
- - lib/markdown_record/content_dsl/end_model.rb
196
- - lib/markdown_record/content_dsl/fragment.rb
197
- - lib/markdown_record/content_dsl/model.rb
198
- - lib/markdown_record/content_dsl/render_format.rb
199
- - lib/markdown_record/content_dsl/render_strategy.rb
200
- - lib/markdown_record/content_dsl/use_layout.rb
201
- - lib/markdown_record/content_fragment.rb
202
180
  - lib/markdown_record/engine.rb
203
181
  - lib/markdown_record/errors/base.rb
204
182
  - lib/markdown_record/errors/duplicate_filename_error.rb
205
183
  - lib/markdown_record/errors/duplicate_id_error.rb
206
184
  - lib/markdown_record/errors/missing_parent_error.rb
207
- - lib/markdown_record/file_saver.rb
208
- - lib/markdown_record/html_renderer.rb
209
- - lib/markdown_record/indexer.rb
210
- - lib/markdown_record/json_renderer.rb
211
- - lib/markdown_record/model_inflator.rb
185
+ - lib/markdown_record/file_sorting/base.rb
186
+ - lib/markdown_record/file_sorting/date_sorter.rb
187
+ - lib/markdown_record/file_sorting/sem_ver_sorter.rb
188
+ - lib/markdown_record/models/association.rb
189
+ - lib/markdown_record/models/associations.rb
190
+ - lib/markdown_record/models/content_associations.rb
191
+ - lib/markdown_record/models/filtering.rb
192
+ - lib/markdown_record/models/filters.rb
193
+ - lib/markdown_record/models/filters/array_filter.rb
194
+ - lib/markdown_record/models/filters/base_filter.rb
195
+ - lib/markdown_record/models/filters/hash_filter.rb
196
+ - lib/markdown_record/models/filters/nil_filter.rb
197
+ - lib/markdown_record/models/filters/range_filter.rb
198
+ - lib/markdown_record/models/filters/regexp_filter.rb
199
+ - lib/markdown_record/models/filters/symbol_filter.rb
200
+ - lib/markdown_record/models/model_inflator.rb
212
201
  - lib/markdown_record/path_utilities.rb
213
- - lib/markdown_record/rendering.rb
214
- - lib/markdown_record/routes_renderer.rb
215
- - lib/markdown_record/validator.rb
202
+ - lib/markdown_record/rendering/content_dsl.rb
203
+ - lib/markdown_record/rendering/content_dsl/attribute.rb
204
+ - lib/markdown_record/rendering/content_dsl/directory_fragment.rb
205
+ - lib/markdown_record/rendering/content_dsl/disable.rb
206
+ - lib/markdown_record/rendering/content_dsl/enable.rb
207
+ - lib/markdown_record/rendering/content_dsl/end_attribute.rb
208
+ - lib/markdown_record/rendering/content_dsl/end_model.rb
209
+ - lib/markdown_record/rendering/content_dsl/fragment.rb
210
+ - lib/markdown_record/rendering/content_dsl/model.rb
211
+ - lib/markdown_record/rendering/content_dsl/scope.rb
212
+ - lib/markdown_record/rendering/content_dsl/use_layout.rb
213
+ - lib/markdown_record/rendering/file_saver.rb
214
+ - lib/markdown_record/rendering/html_renderer.rb
215
+ - lib/markdown_record/rendering/indexer.rb
216
+ - lib/markdown_record/rendering/json_renderer.rb
217
+ - lib/markdown_record/rendering/nodes/html_base.rb
218
+ - lib/markdown_record/rendering/nodes/html_directory.rb
219
+ - lib/markdown_record/rendering/nodes/html_file.rb
220
+ - lib/markdown_record/rendering/nodes/json_base.rb
221
+ - lib/markdown_record/rendering/nodes/json_directory.rb
222
+ - lib/markdown_record/rendering/nodes/json_file.rb
223
+ - lib/markdown_record/rendering/rendering.rb
224
+ - lib/markdown_record/rendering/validator.rb
216
225
  - lib/markdown_record/version.rb
217
226
  - templates/Thorfile
218
227
  - templates/base/content/example_content.md
@@ -239,8 +248,18 @@ files:
239
248
  - templates/demo/layouts/_custom_layout.html.erb
240
249
  - templates/demo/layouts/_file_layout.html.erb
241
250
  - templates/demo/layouts/_global_layout.html.erb
251
+ - templates/demo/models/dsl_command.rb
252
+ - templates/demo/models/section.rb
242
253
  - templates/markdown_record_initializer.rb
243
254
  - templates/render_content.thor
255
+ - templates/tests/assets/images/ruby-logo.png
256
+ - templates/tests/content/1_test_files_home.md.erb
257
+ - templates/tests/content/2_content_dsl_tests/1_content_dsl.md.erb
258
+ - templates/tests/content/2_content_dsl_tests/2_nested_directory/1_associations.md.erb
259
+ - templates/tests/layouts/_concatenated_layout.html.erb
260
+ - templates/tests/layouts/_custom_layout.html.erb
261
+ - templates/tests/layouts/_file_layout.html.erb
262
+ - templates/tests/layouts/_global_layout.html.erb
244
263
  homepage: https://github.com/WriterZephos/markdown_record
245
264
  licenses:
246
265
  - MIT
@@ -1,10 +0,0 @@
1
- module MarkdownRecord
2
- module Demo
3
- class DslCommand < ::MarkdownRecord::Base
4
- attribute :name
5
- attribute :description
6
-
7
- belongs_to_content :section
8
- end
9
- end
10
- end
@@ -1,9 +0,0 @@
1
- module MarkdownRecord
2
- module Demo
3
- class Section < ::MarkdownRecord::Base
4
- attribute :name
5
-
6
- has_many_content :dsl_commands
7
- end
8
- end
9
- end
@@ -1,15 +0,0 @@
1
- module MarkdownRecord
2
- module Tests
3
- class ChildModel < ::MarkdownRecord::Base
4
- attribute :string_field
5
- attribute :int_field
6
- attribute :float_field
7
- attribute :bool_field
8
- attribute :date_field
9
- attribute :maybe_field
10
- attribute :hash_field
11
-
12
- belongs_to_content :model
13
- end
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- module MarkdownRecord
2
- module Tests
3
- class FakeActiveRecordModel
4
- include ::ActiveAttr::Model
5
- include ::MarkdownRecord::ContentAssociations
6
- attribute :model_ids
7
- attribute :child_model_id
8
-
9
- has_many_content :models
10
- belongs_to_content :child_model
11
- end
12
- end
13
- end
@@ -1,15 +0,0 @@
1
- module MarkdownRecord
2
- module Tests
3
- class Model < ::MarkdownRecord::Base
4
- attribute :string_field
5
- attribute :int_field
6
- attribute :float_field
7
- attribute :bool_field
8
- attribute :date_field
9
- attribute :maybe_field
10
- attribute :hash_field
11
-
12
- has_many_content :child_models
13
- end
14
- end
15
- end