json, an output representation, first pass
[software/sisu] / lib / sisu / se_file_op.rb
index 8a47b1cdb6556266f46287d640681a5447f0b050..9a95baa5b45ea6917df7dd8cde07943d821257d3 100644 (file)
@@ -418,6 +418,12 @@ module SiSU_File_Op
         fn=base_filename.xml_scaffold_structure_collapse
         make_file(path,fn)
       end
+      def json
+        path=output_path.json.dir
+        make_path(path)
+        fn=base_filename.json
+        make_file(path,fn)
+      end
       def manpage
         path=output_path.manpage.dir
         make_path(path)
@@ -713,6 +719,17 @@ module SiSU_File_Op
         end
         self
       end
+      def json
+        def dir
+          output_path.json.dir + '/' \
+          + base_filename.json
+        end
+        def rel
+          output_path.json.rel + '/' \
+          + base_filename.json
+        end
+        self
+      end
       def sqlite_discrete
         def dir
           output_path.sqlite_discrete.dir + '/' \
@@ -1241,6 +1258,24 @@ module SiSU_File_Op
         end
         i18n(fnh)
       end
+      def json(fh=nil)
+        fh=default_hash_build(fh,Sfx[:json])
+        fh[:lng]=lang_code?(fh[:lng])
+        fnh=if output_dir_structure.by_filename?
+          {
+            fn: 'scroll',
+            ft: fh[:ft],
+            lng: fh[:lng],
+          }
+        else
+          {
+            fn: fh[:fn],
+            ft: fh[:ft],
+            lng: fh[:lng],
+          }
+        end
+        i18n(fnh)
+      end
       def pdf_p(fh=nil)
         fh=default_hash_build(fh,Sfx[:pdf])
         fh[:lng]=lang_code?(fh[:lng])
@@ -2330,6 +2365,30 @@ module SiSU_File_Op
         end
         self
       end
+      def json
+        def ft
+          'json'
+        end
+        def dir
+          set_path(ft).dir.abc
+        end
+        def url
+          set_path(ft).url.abc
+        end
+        def rel
+          set_path(ft).rel.abc
+        end
+        def rcp
+          set_path(ft).rcp.abc
+        end
+        def rel_sm
+          set_path(ft).rel_sm.ab
+        end
+        def rel_image
+          '../../_sisu/image'
+        end
+        self
+      end
       def pdf
         def ft
           'pdf'