jspp 0.1.6 → 0.1.8
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.
- data/bin/jspp +6 -6
- metadata +2 -2
data/bin/jspp
CHANGED
|
@@ -27,11 +27,11 @@ multiline
|
|
|
27
27
|
|
|
28
28
|
DIR = File.dirname ARGV.first || '.'
|
|
29
29
|
R_INCLUDE = %r{/\*>\s*(.+?)\s*\*/}
|
|
30
|
-
R_INCLUDE_INSIDE_STRING =
|
|
30
|
+
R_INCLUDE_INSIDE_STRING = %r{"#{R_INCLUDE.source}"}
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
def get_file
|
|
34
|
-
if path.index
|
|
33
|
+
def get_file path=''
|
|
34
|
+
if path.index'http://' or path.index'https://'
|
|
35
35
|
require 'open-uri'
|
|
36
36
|
open(path).read
|
|
37
37
|
else
|
|
@@ -39,17 +39,17 @@ def get_file(path='')
|
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
def parse
|
|
42
|
+
def parse text=''
|
|
43
43
|
text.gsub!(R_INCLUDE_INSIDE_STRING) {
|
|
44
44
|
'"' << parse(get_file $1).gsub(/$/, '\\').chop << '"'
|
|
45
45
|
}
|
|
46
46
|
text.gsub!(R_INCLUDE) {
|
|
47
|
-
parse
|
|
47
|
+
parse get_file $1
|
|
48
48
|
}
|
|
49
49
|
text
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
if $stdin.tty? and ARGV.empty? or ARGV.delete
|
|
52
|
+
if $stdin.tty? and ARGV.empty? or ARGV.delete'-h' or ARGV.delete'--help'
|
|
53
53
|
puts HELP
|
|
54
54
|
else
|
|
55
55
|
print parse ARGF.read
|