json, an output representation, first pass
[software/sisu] / lib / sisu / hub_actions.rb
index 52ad9da66ac6f76c573cd168d136281a760f7fe9..a946591d21ee1cf7dec5f29d19660961b9f9282f 100644 (file)
@@ -382,6 +382,22 @@ module SiSU_Hub_Actions
             end
           end
         end
+        def json?
+          if @opt.act[:json][:set]==:on                 #% --js, -J
+            if @opt.f_pths.length > 0
+              require_relative 'json'                   # json.rb
+              SiSU_JSON::Source.new(@opt).read
+            else
+              msg='json request requires sisu markup files'
+              if (@opt.act[:verbose_plus][:set]==:on \
+              || @opt.act[:maintenance][:set]==:on)
+                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
+                  mark(msg)
+              else puts msg
+              end
+            end
+          end
+        end
         def xhtml?
           if @opt.act[:xhtml][:set]==:on                 #% --xhtml, -b
             if @opt.f_pths.length > 0