Class: SistemKebut::Section::XMLBuilder

Inherits:
PembangunXML show all
Defined in:
lib/xml/section.rb

Constant Summary collapse

MARGIN =
{
  'w:left' => '1134', 
  'w:right' => '1134', 
  'w:gutter' => '0', 
  'w:header' => '0', 
  'w:top' => '1134', 
  'w:footer' => '0', 
  'w:bottom' => '1134'
}
GRID =
{
  'w:type' => 'default', 
  'w:linePitch' => '600', 
  'w:charSpace' => '32768'
}

Instance Attribute Summary

Attributes inherited from PembangunXML

#sumber, #xml

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PembangunXML

#build, #initialize

Constructor Details

This class inherits a constructor from SistemKebut::PembangunXML

Class Method Details

.default(xml) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/xml/section.rb', line 19

def self.default(xml)
  xml.sectPr do 
    xml.type('w:val' => 'nextPage')
    xml.pgSz('w:w' => '11906', 'w:h' => '16838')
    xml.pgMar(MARGIN)
    xml.pgNumType('w:fmt' => 'decimal', 'w:start' => '64')
    xml.formProt('w:val' => 'false')
    xml.textDirection('w:val' => 'lrTb')
    xml.docGrid(GRID)
  end
end

Instance Method Details

#bet_docGrid(h) ⇒ Object



51
52
53
54
55
56
57
# File 'lib/xml/section.rb', line 51

def bet_docGrid(h)
  return {
    'w:type' => h[:type].to_s, 
    'w:linePitch' => h[:linePitch].to_s, 
    'w:charSpace' => h[:charSpace].to_s
  }
end

#bet_pgMar(h) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/xml/section.rb', line 35

def bet_pgMar(h)
  return {
    'w:left' => h[:left].to_s, 
    'w:right' => h[:right].to_s, 
    'w:gutter' => h[:gutter].to_s, 
    'w:header' => h[:header].to_s, 
    'w:top' => h[:top].to_s, 
    'w:footer' => h[:footer].to_s, 
    'w:bottom' => h[:bottom].to_s
  }
end

#bet_pgNumType(h) ⇒ Object



47
48
49
# File 'lib/xml/section.rb', line 47

def bet_pgNumType(h)
  { 'w:fmt' => h[:fmt].to_s, 'w:start' => h[:start].to_s }
end

#bet_pgSz(h) ⇒ Object



31
32
33
# File 'lib/xml/section.rb', line 31

def bet_pgSz(h)
  { 'w:w' => h[:width].to_s, 'w:h' => h[:height].to_s }
end

#font_styleObject



72
73
74
75
# File 'lib/xml/section.rb', line 72

def font_style
  fstyle = SistemKebut::Paragraph::TNR
  xml.rFonts('w:ascii' => fstyle, 'w:hAnsi' => fstyle)
end

#startObject



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/xml/section.rb', line 59

def start
  xml.p do
    xml.pPr do 
      xml.pStyle('w:val' => 'Normal')
      xml.bidi('w:val' => '0')
      xml.rPr do 
        font_style
      end
    end
    xml_sectPr
  end
end

#xml_sectPrObject



77
78
79
80
81
# File 'lib/xml/section.rb', line 77

def xml_sectPr
  xml.r do 
    xml.br('w:type' => 'page')
  end
end