File tree Expand file tree Collapse file tree 1 file changed +45
-16
lines changed
src/moon_json/applications Expand file tree Collapse file tree 1 file changed +45
-16
lines changed Original file line number Diff line number Diff line change 1818# -----------------------------------------------------------------------
1919
2020module MoonScript
21- class MoonJson
22- class Parser
23- def parse_application_head: String
24- location = @parser .location
25- head = @parser .read_string
26- path = Path [root, head].to_s
27-
28- error! :application_head_not_exists do
29- end
30-
31- File .read(path)
32- rescue JSON ::ParseException
33- error! application_head_invalid do
34- end
35- end
21+ class MoonJson
22+ class Parser
23+ def parse_application_head : String
24+ location =
25+ @parser .location
26+
27+ head =
28+ @parser .read_string
29+
30+ path =
31+ Path [root, head].to_s
32+
33+ error! :application_head_not_exists do
34+ block do
35+ text " The"
36+ bold " head"
37+ text " field of"
38+ bold " the application object"
39+ text " points to a file that does not exists."
40+ end
41+
42+ block do
43+ text " It should point to an HTML file, which would be injected to the"
44+ text " <head> tag of the generated HTML. It is used to include"
45+ text " external dependencies like (CSS, JS, analytics, etc...)"
46+ end
47+
48+ snippet snippet_data(location)
49+ end unless File .exists?(path)
50+
51+ File .read(path)
52+ rescue JSON ::ParseException
53+ error! :application_head_invalid do
54+ block do
55+ text " The"
56+ bold " head"
57+ text " field of"
58+ bold " the application object"
59+ text " should be a string, but it's not:"
60+ end
61+
62+ snippet snippet_data
3663 end
64+ end
3765 end
38- end
66+ end
67+ end
You can’t perform that action at this time.
0 commit comments