@@ -3,14 +3,14 @@ Namespace wx.newdocs
3
3
4
4
Class DocsBuffer
5
5
6
- Method New()
7
-
8
- End
9
-
10
- Method New( docs:DocsNode,baseDir:String )
6
+ Method New( docs:DocsNode, parent:DocsNode, module:Module, baseDir:String="" )
11
7
12
8
_docs=docs
13
9
10
+ _parent=parent
11
+
12
+ _module=module
13
+
14
14
_baseDir=baseDir
15
15
16
16
End
@@ -74,7 +74,7 @@ Class DocsBuffer
74
74
Local tag:=line.Slice( 1,j )
75
75
Local arg:=line.Slice( j+1 ).Trim()
76
76
77
- Select tag
77
+ Select tag.ToLower()
78
78
Case "deprecated"
79
79
80
80
Emit( "(Deprecated: "+arg+")" )
@@ -92,6 +92,8 @@ Class DocsBuffer
92
92
_return=arg
93
93
94
94
Case "import"
95
+
96
+ If arg.StartsWith("~q") And arg.EndsWith("~q") Then arg = arg.Slice(1,-1)
95
97
96
98
Local path:=_baseDir+arg
97
99
@@ -102,14 +104,44 @@ Class DocsBuffer
102
104
103
105
Local docs:=New DocsNode( "","",_docs,DocsType.Nav,True )
104
106
105
- Local buf:=New DocsBuffer( docs,ExtractDir( path ) )
107
+ Local buf:=New DocsBuffer( docs, _parent, _module, ExtractDir( path ) )
106
108
107
109
buf.Emit( src )
108
110
109
111
docs.Markdown=buf.Flush()
110
112
Else
111
113
Print "DocsBuffer: Can't @import file '"+path+"'"
114
+ Print " FileName: "+arg
115
+ 'Debug()
112
116
Endif
117
+
118
+ Case "image"
119
+
120
+ If arg.StartsWith("~q") And arg.EndsWith("~q") Then arg = arg.Slice(1,-1)
121
+
122
+ Local srcImage:String, dstImage:String
123
+
124
+ If _module
125
+ srcImage = _module.baseDir+"images/"+arg
126
+ dstImage = "modules/"+_module.name+"/images/"+arg
127
+ Endif
128
+
129
+ If srcImage And dstImage And GetFileType( srcImage ) = FileType.File
130
+ 'Print "Importing Image: "+arg
131
+ 'Print " FileName: "+arg
132
+ 'Debug()
133
+
134
+ EmitLine( "<img src=~q../images/"+arg+"~q alt=~qImage~q>" )
135
+
136
+ DocsMaker.AddImage(srcImage, dstImage)
137
+
138
+ Else
139
+ Print "DocsBuffer: '@image' Can't find file '"+arg+"'"
140
+ If _docs Then Print " Entity: "+_docs.DeclPath
141
+ If srcImage Then Print " Expected location: "+srcImage
142
+ 'Debug()
143
+ Endif
144
+
113
145
114
146
Case "example"
115
147
@@ -144,7 +176,7 @@ Class DocsBuffer
144
176
145
177
Local docs:=New DocsNode( ident,label,_docs,DocsType.Decl )
146
178
147
- Local buf:=New DocsBuffer( docs,_baseDir )
179
+ Local buf:=New DocsBuffer( docs, _parent, _module, _baseDir )
148
180
149
181
buf.EmitLines( lines.Slice( i ) )
150
182
@@ -196,9 +228,51 @@ Class DocsBuffer
196
228
Return markdown
197
229
End
198
230
231
+ Method Debug()
232
+ Print " DocsBuffer.Debug()"
233
+ Print " BaseDir : "+_baseDir
234
+ If _docs
235
+ Print " _docs.Ident : "+_docs.Ident
236
+ Print " _docs.Label : "+_docs.Label
237
+ Print " _docs.FilePath : "+_docs.FilePath
238
+ Print " _docs.FilePathUrl: "+_docs.FilePathUrl
239
+ Print " _docs.DeclPath : "+_docs.DeclPath
240
+ Print " _docs.DeclLink : "+_docs.DeclLink
241
+ Else
242
+ Print " _docs:DocsNode = Null"
243
+ Endif
244
+ If _parent
245
+ Print " _parent.Ident : "+_parent.Ident
246
+ Print " _parent.Label : "+_parent.Label
247
+ Print " _parent.FilePath : "+_parent.FilePath
248
+ Print " _parent.FilePathUrl: "+_parent.FilePathUrl
249
+ Print " _parent.DeclPath : "+_parent.DeclPath
250
+ Print " _parent.DeclLink : "+_parent.DeclLink
251
+ Else
252
+ Print " _docs:DocsNode = Null"
253
+ Endif
254
+ If _module
255
+ Print " _module.name: "+_module.name
256
+ Print " _module.srcPath: "+_module.srcPath
257
+ Print " _module.ident: "+_module.ident
258
+ Print " _module.baseDir: "+_module.baseDir
259
+ Print " _module.buildDir: "+_module.buildDir
260
+ Print " _module.outputDir: "+_module.outputDir
261
+ Print " _module.cacheDir: "+_module.cacheDir
262
+ Print " _module.hfileDir: "+_module.hfileDir
263
+ Print " _module.cfileDir: "+_module.cfileDir
264
+ Print " _module.afile: "+_module.afile
265
+ Print " _module.rfile: "+_module.rfile
266
+ Else
267
+ Print " _module:Module = Null"
268
+ Endif
269
+ End
270
+
199
271
Private
200
272
201
273
Field _docs:DocsNode
274
+ Field _parent:DocsNode
275
+ Field _module:Module
202
276
field _baseDir:String
203
277
Field _lines:=New StringStack
204
278
Field _label:String
0 commit comments