This file is indexed.

/usr/lib/falcon/parser/render/docbook.fal is in libfalcon-engine1 0.9.6.9-git20120606-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
/*
   FALCON - Generic Parser
   FILE: doocbook.fal

   Generates a doocbook output of an input genparser.Context tree
   -------------------------------------------------------------------
   Author: Giancarlo Niccolai
   Begin: Sat, 30 Aug 2008 09:42:22 +0200

   -------------------------------------------------------------------
   (C) Copyright 2008: the FALCON developers (see list in AUTHORS file)

   See LICENSE file for licensing details.
*/


/*# Doocbook Renderer.
   @optparam frame An object used to surround produced data with proper docbook framing.

   The docbook renderer transforms the input text in a valid docbook output,
   which may be inserted under a <section> entry of a DocBook 5.1 document.

   Heading elements are treated as sections, and properly nested based on their level.

   If given, the @b frame object will be used to complete the document by appending
   and prepending proper XML and docbook starters.

   The @b frame object will provide an open() method that shall return the docbook
   code to declare the document (including the xml document declaration) and a close()
   method so that the whole document can be built through

   @code
      frame.open() + rendered_content + frame.close()
   @endcode
*/
class Renderer( frame )

   blevel = 0
   frame = frame

   renderers = [
      "text" => {node => Renderer.sgmlEscape(node.content) },
      "b" => .[ self._render_markup "emphasis" "role=\"bold\""],
      "i" => .[ self._render_markup "emphasis" nil],
      "u" => .[ self._render_markup "emphasis" nil],
      "sup" => .[self._render_markup "superscript" nil],
      "sub" => .[self._render_markup "subscript" nil],
      "pre" => .[self._render_markup "literal" nil],
      "tt" => .[self._render_markup "literal" nil],
      "ol" => .[self._render_markup "orderedlist" nil ],
      "ul" => .[self._render_markup "itemizedlist" nil ],
      "li" => .[self._render_li],

      "hr" => self._render_hr,
      "br" => self._renderUNKNOWN,

      "para" => self._render_para,
      "header" => self._render_header,

      "table" => self._render_table,
      "tr" => self._render_tr,
      "th" => self._render_header_cell,
      "td" => self._render_cell,
      "indent" => self._render_indent,
      "quote" => self._render_quote,

      "link" => self._render_link,
      "file" => self._render_file,

      "img" => self._render_img,
      "code" => self._render_code,
      "plugin" => self._render_plugin,
      "tag" => self._renderUNKNOWN
   ]

   init
      if frame
         if not frame provides open or not frame provides close
            raise GenericError( 10000, i"The 'frame' parameter must provide a callable open/close method pairs" )
         end
      end
   end

   function render( context )

      //preprocess standouts
      //self.preprocess( context.standouts )

      // and return the content
      content = self.rcont( context.topNode )

      // close opened sections
      while self.blevel > 0
         if self.frame
            content += self.frame.closeSection( self.blevel )
         else
            content += "</section>\n"
         end
         self.blevel--
      end

      f = self.frame
      if f
         return f.open() + content + f.close()
      else
         return content
      end
   end

   /*
   function preprocess( sout )
   end
   */


   function renderNode( node )
      if node.type in self.renderers
         return self.renderers[ node.type ]( node )
      else
         return self._renderUNKNOWN( node )
      end
   end


   function rcont( node )
      content = node.content
      if content: return Renderer.sgmlEscape( content )

      text = ""
      node = node.firstChild
      while node
         text += self.renderNode( node )
         node = node.next
      end
      return text
   end

   //==========================================================
   // rendering functions
   //

   function _renderUNKNOWN( node )
      return "<para>UNKNOWN NODE TYPE: " + node.type + " - " +self.rcont( node ) + "</para>\n"
   end


   function _render_para( node )
      content = self.rcont(node)
      return content ? "<para>" + content +"</para>\n" : ""
   end

   function _render_markup( tag, attribs, node )
      return "<" + tag + (attribs ? " " +attribs : "") +">" + self.rcont(node) + "</" + tag + ">"
   end

   function _render_li( node )
      return "<listitem><para>" + self.rcont(node) + "</para></listitem>\n"
   end

   function _render_hr( node )
      return "<para><literal>-----------------------------------------------</literal></para>\n"
   end


   function _render_header( node )
      content = self.rcont( node )
      return self.open_section( node.level, content, URI.encode(content) )
   end

   function open_section( level, id, title )
      prefix = self.go_to_level( level )
      if self.frame
         header = self.frame.openSection( level, id )
      else
         header = "<section id=\"" + id +"\">\n"
      end
      self.blevel = level + 1
      return prefix + header + "<title>" + title + "</title>\n"
   end

   function close_section( level )
      prefix = self.go_to_level( level )
      if self.frame
         header = self.frame.closeSection( level )
      else
         header = "</section>\n"
      end
      self.blevel = level
      return prefix + header
   end

   function go_to_level( l )
      prefix = ""
      while self.blevel+1 < l
         self.blevel++
         prefix += self.frame ? self.frame.openSection( self.blevel ) :  "<section>\n"
      end

      while self.blevel-1 > l
         prefix += self.frame ? self.frame.closeSection( self.blevel ) :  "</section>\n"
         self.blevel--
      end

      return prefix
   end


   function _render_table( node )
      return "<informaltable>\n<tgroup cols=\"0\">\n" +
              self.rcont(node) +
              "</tgroup></informaltable>\n"
   end

   function _render_tr( node )
      return "<row>"+ self.rcont(node) + "</row>\n"
   end

   function _render_header_cell( node )
      return "<entry><emphasis>"+ self.rcont(node) + "</emphasis></entry>\n"
   end

   function _render_cell( node )
       return "<entry>"+ self.rcont(node) + "</entry>\n"
   end

   function _render_indent( node )
      return "<litral>" + (" " * node.level ) +  "</literal><para>" +
         self.rcont(node) +
         "</para>\n"
   end

   function _render_link( node )
      i = bless(node.infos)

      link = "<ulink url=\"" + strEscape(i.name) + "\">" +
             Renderer.sgmlEscape(i.text ? i.text : i.name) + "</ulink>"
      return link
   end


   function _render_file( node )
      //todo
   end

   function _render_quote( node )
      attrib = node.infos["link"]
      if attrib
         return "<blockquote><attribution>" + Renderer.sgmlEscape(attrib) +
                "</attribution>\n<para>" + self.rcont(node) +"</para></blockquote>\n"
      else
         return "<blockquote><para>" + self.rcont(node) +"</para></blockquote>\n"
      end
   end

   function _render_img( node )
      // todo
   end

   function _render_code( node )
      return "<programlisting>"+ self.rcont(node) + "</programlisting>\n"
   end

   function _render_plugin( node )
      // not supported
   end

   function sgmlEscape( content )
      /*
      static
         amp = "&"[*0]
         lt = "<"[*0]
         gt = ">"[*0]
         qt = "\""[*0]
      end

      i = 0
      l = content.len()
      res = strBuffer( l )
      olds = 0
      while i < l
         c = content[*i]
         if c < 32 or c > 127
            res += content[olds:i]
            res += "&#"+c+";"
            olds = i+1
         elif c == amp
            res += content[olds:i]
            res += "&amp;"
            olds = i+1
         elif c == gt
            res += content[olds:i]
            res += "&gt;"
            olds = i+1
         elif c == lt
            res += content[olds:i]
            res += "&lt;"
            olds = i+1
         elif c == qt
            res += content[olds:i]
            res += "&quot;"
            olds = i+1
         end
         ++i
      end

      return res + content[olds:]
      */
      return content.replace( "&", "&amp;").replace( "<", "&lt;" ).replace( ">", "&gt;" ).replace("\"", "&quot;" )
   end
end





/*# Frame creating a book frame
   @param encoding The target encoding that will be placed in the xml declaration
   @param name The name of the book
   @param title Title of the book as a whole
   @optparam author The author
   @optparam copyyear Year of copyright
   @optparam copyholder Holder of copyright

*/

class BookFrame( encoding, name, title, author, copyyear, copyholder )
   encoding = encoding
   name = name
   title = title
   author = author
   copyyear = copyyear
   copyholder = copyholder

   function open()
      str = "<?xml version=\"1.0\" encoding=\"" + self.encoding + "\"?>\n"
      str += "
         <!DOCTYPE book
         PUBLIC \"-//OASIS//DTD DocBook XML V4.1.2//EN\"
         \"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd\">\n"
      str += "<book>\n"
      str += "<bookinfo>\n"
      str += "<title>" + Renderer.sgmlEscape( self.title ) + "</title>\n"
      if self.author
         str += "<author><firstname>" + Renderer.sgmlEscape( self.author ) + "</firstname></author>\n"
      end
      if self.copyyear and self.copyholder
         str+= "<copyright>\n"
         str += "<year>" + self.copyyear + "</year>\n"
         str += "<holder>" + Renderer.sgmlEscape( self.copyholder ) + "</holder>\n"
         str+= "</copyright>\n"
      end
      str += "</bookinfo>\n"

      return str
   end

   function close()
      return  "</book>\n"
   end

   function openSection( level, id )
      ids = id ? " id=\"" + strEscape(id) +"\"" : ""
      if level == 0
         return @"<chapter$(ids)>\n"
      else
         return @"<sect$(level)$(ids)>\n"
      end
   end

   function closeSection( level )
      if level == 0
         return "</chapter>\n"
      else
         return @"</sect$(level)>\n"
      end
   end
end


/*# Frame creating a book frame -- in docbook 5
   @param encoding The target encoding that will be placed in the xml declaration
   @param name The name of the book
   @param title Title of the book as a whole
   @optparam author The author
   @optparam copyyear Year of copyright
   @optparam copyholder Holder of copyright
*/

class Book5Frame( encoding, name, title, author, copyyear, copyholder )
   encoding = encoding
   name = name
   title = title
   author = author
   copyyear = copyyear
   copyholder = copyholder

   function open()
      str = "<?xml version=\"1.0\" encoding=\"" + self.encoding + "\"?>\n"
      str += "<book xml:id=\""+self.name+"\" xmlns=\"http://docbook.org/ns/docbook\" version=\"5.0\">\n"
      str += "<bookinfo>\n"
      str += "<title>" + Renderer.sgml( self.title ) + "</title>\n"
      if self.author
         str += "<author><firstname>" + Renderer.sgmlEscape( self.author ) + "</firstname></author>\n"
      end
      if self.copyyear and self.copyholder
         str+= "<copyright>\n"
         str += "<year>" + self.copyyear + "</year>\n"
         str += "<holder>" + Renderer.sgmlEscape( self.copyholder ) + "</holder>\n"
         str+= "</copyright>\n"
      end
      str += "</bookinfo>\n"

      return str
   end

   function close()
      return  "</book>\n"
   end

   function openSection( level, id )
      ids = id ? " id=\"" + strEscape(id) +"\"" : ""
      if level == 0
         return @"<chapter$(ids)>\n"
      else
         return @"<section$(ids)>\n"
      end
   end

   function closeSection( level )
      if level == 0
         return "</chapter>\n"
      else
         return "</section>\n"
      end
   end
end



/*# Frame creating an article frame
   @param encoding The target encoding that will be placed in the xml declaration
   @optparam optparam lang The language of the article.
*/

class ArticleFrame( encoding, lang )
   encoding = encoding
   lang = lang ? lang : ""

   function open()
      str = "<?xml version=\"1.0\" encoding=\"" + self.encoding + "\"?>\n"
      str += "
         <!DOCTYPE article
         PUBLIC \"-//OASIS//DTD DocBook XML V4.1.2//EN\"
         \"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd\">\n"
      str += "<article"
      if self.lang: str += " lang=\"" + self.lang + "\""
      str+=">\n"
      return str
   end

   function close()
      return "</article>\n"
   end

   function openSection( level, id )
      return "<sect" + (level + 1) + (id? " id=\"" + strEscape(id) +"\"": "") + ">\n"
   end

   function closeSection( level )
      return "</sect" + (level+1) + ">\n"
   end

end

/*# Frame creating an article frame in DocBook 5
   @param encoding The target encoding that will be placed in the xml declaration
   @optparam optparam lang The language of the article.
*/

class Article5Frame( encoding, lang )
   encoding = encoding
   lang = lang ? lang : ""

   function open()
      str = "<?xml version=\"1.0\" encoding=\"" + self.encoding + "\"?>\n"
      str += "<article xmlns=\"http://docbook.org/ns/docbook\" version=\"5.0\""
      if self.lang: str += " lang=\"" + self.lang + "\""
      str+=">\n"
      return str
   end

   function close()
      return "</article>\n"
   end

   function openSection( level, id )
      return "<section"+ (id? " id=\"" + strEscape(id) +"\"": "") + ">\n"
   end

   function closeSection( level )
      return "</section>\n"
   end

end