json, an output representation, first pass
[software/sisu] / lib / sisu / json_persist.rb
1 # encoding: utf-8
2 =begin
3
4 * Name: SiSU
5
6 ** Description: documents, structuring, processing, publishing, search
7 *** html segment generation, processing
8
9 ** Author: Ralph Amissah
10 [ralph@amissah.com]
11 [ralph.amissah@gmail.com]
12
13 ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Ralph Amissah,
15 All Rights Reserved.
16
17 ** License: GPL 3 or later:
18
19 SiSU, a framework for document structuring, publishing and search
20
21 Copyright (C) Ralph Amissah
22
23 This program is free software: you can redistribute it and/or modify it
24 under the terms of the GNU General Public License as published by the Free
25 Software Foundation, either version 3 of the License, or (at your option)
26 any later version.
27
28 This program is distributed in the hope that it will be useful, but WITHOUT
29 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
30 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31 more details.
32
33 You should have received a copy of the GNU General Public License along with
34 this program. If not, see [http://www.gnu.org/licenses/].
35
36 If you have Internet connection, the latest version of the GPL should be
37 available at these locations:
38 [http://www.fsf.org/licensing/licenses/gpl.html]
39 [http://www.gnu.org/licenses/gpl.html]
40
41 ** SiSU uses:
42 * Standard SiSU markup syntax,
43 * Standard SiSU meta-markup syntax, and the
44 * Standard SiSU object citation numbering and system
45
46 ** Hompages:
47 [http://www.jus.uio.no/sisu]
48 [http://www.sisudoc.org]
49
50 ** Git
51 [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary]
52 [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/json_persist.rb;hb=HEAD]
53
54 =end
55 module SiSU_JSON_Persist
56 class Persist
57 @@persist=nil
58 attr_accessor :head,:toc,:body,:tail,:open,:close,:sc,:endnotes,:book_idx,:metadata
59 #attr_accessor :head,:body,:tail,:open,:close,:sc
60 #@@odf={ body: [], head: [], toc: [], metadata: [], tail: [], book_idx: [], endnotes: [] }
61 def initialize(args=nil)
62 @@persist=args=(args ? args : (@@persist || persist_init_hash_values))
63 @head=args[:head]
64 @toc=args[:toc]
65 @body=args[:body]
66 @tail=args[:tail]
67 @open=args[:open]
68 @close=args[:close]
69 @sc=args[:sc]
70 @endnotes=args[:endnotes]
71 @book_idx=args[:book_idx]
72 @metadata=args[:metadata]
73 end
74 def head
75 @head
76 end
77 def toc
78 @toc
79 end
80 def body
81 @body
82 end
83 def tail
84 @tail
85 end
86 def open
87 @open
88 end
89 def close
90 @close
91 end
92 def sc
93 @sc
94 end
95 def endnotes
96 @endnotes
97 end
98 def book_idx
99 @book_idx
100 end
101 def metadata
102 @metadata
103 end
104 def persist_init_hash_values
105 {
106 head: [],
107 toc: [],
108 body: [],
109 tail: [],
110 open: [],
111 close: [],
112 sc: [],
113 endnotes: [],
114 book_idx: [],
115 metadata: [],
116 }
117 end
118 def persist_init
119 @@persist=nil
120 Persist.new(persist_init_hash_values)
121 end
122 end
123 end
124 __END__