Class: Wikisys::Pages

Inherits:
Object
  • Object
show all
Defined in:
lib/wikisys.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath = '.', debug: false) ⇒ Pages

Returns a new instance of Pages.



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
# File 'lib/wikisys.rb', line 318

def initialize(filepath='.', debug: false)
  
  @filepath, @debug = filepath, debug
  
  entries_file = File.join(@filepath, 'entries.txt')
  
  if File.exists?(entries_file) then
    @entries = DxLite.new(entries_file)
  else
    @entries = DxLite.new('entries/entry(title, tags)')
    @entries.save entries_file
  end

  # check for the mindwords raw document file
  mindwords_file = File.join(@filepath, 'mindwords.txt')
  
  if File.exists?(mindwords_file) then 
    @mw = MindWords.new(mindwords_file)
  else
    @mw = MindWords.new
    @mw.filepath = mindwords_file
  end
  
  @pg = Wiki.new @filepath, entries: @entries, debug: @debug
  
  #scan_md_files()
  
end

Instance Attribute Details

#entriesObject

Returns the value of attribute entries.



316
317
318
# File 'lib/wikisys.rb', line 316

def entries
  @entries
end

#mwObject

Returns the value of attribute mw.



316
317
318
# File 'lib/wikisys.rb', line 316

def mw
  @mw
end

Instance Method Details

#new_pg(filename) ⇒ Object



347
348
349
350
351
352
353
354
355
356
357
# File 'lib/wikisys.rb', line 347

def new_pg(filename)
  
  @pg.new_build(filename)
  @entries.save
  
  update_mw(@pg.title, @pg.tags)
  @mw.save if @mw.lines.any?        
  
  build_html(filename)
  
end

#update_pg(filename) ⇒ Object



359
360
361
362
363
364
365
366
367
368
369
# File 'lib/wikisys.rb', line 359

def update_pg(filename)
  
  @pg.modify_build(filename)
  @entries.save
  
  update_mw(@pg.title, @pg.tags)
  @mw.save if @mw.lines.any?        
  
  build_html(filename)
  
end