Class: CSL::Style
- Inherits:
-
Node
show all
- Extended by:
- Loader
- Includes:
- InheritableNameOptions
- Defined in:
- lib/csl/style.rb,
lib/csl/style/date.rb,
lib/csl/style/sort.rb,
lib/csl/style/text.rb,
lib/csl/style/group.rb,
lib/csl/style/label.rb,
lib/csl/style/macro.rb,
lib/csl/style/names.rb,
lib/csl/style/choose.rb,
lib/csl/style/layout.rb,
lib/csl/style/number.rb,
lib/csl/style/citation.rb,
lib/csl/style/bibliography.rb
Defined Under Namespace
Classes: Bibliography, Choose, Citation, Date, DatePart, EtAl, Group, Label, Layout, Macro, Name, NamePart, Names, Number, Sort, Substitute, Text
Class Attribute Summary collapse
Instance Attribute Summary collapse
Attributes included from Loader
#extension, #prefix, #root
Attributes inherited from Node
#attributes
Attributes included from Treelike
#children, #nodename, #parent
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Loader
extend_name, extend_path, list, load
#inheritable_name_options, #inheritable_names_options
Methods inherited from Node
#<=>, #attribute?, #attributes?, #attributes_for, constantize, create, create_attributes, #custom_attributes, #deep_copy, #default_attribute?, #default_attributes, default_attributes, #each, #exact_match?, #format_page_ranges?, #formatting_options, #has_attributes?, #has_default_attributes?, #has_language?, hide_default_attributes!, hide_default_attributes?, #initialize_copy, #inspect, match?, #match?, matches?, #merge!, parse, parse!, #quotes?, #reverse_merge!, #save_to, show_default_attributes!, #strip_periods?, #tags, #textnode?, types
#nesting
#pretty_print, #tags, #to_xml
Methods included from Treelike
#<<, #add_child, #add_children, #ancestors, #closest, #delete_child, #delete_children, #depth, #descendants, #each_ancestor, #each_child, #each_descendant, #each_sibling, #empty?, #find_child, #find_children, #has_children?, #root, #root?, #siblings, #unlink
Constructor Details
#initialize(attributes = {}) {|_self| ... } ⇒ Style
Returns a new instance of Style.
52
53
54
55
56
57
|
# File 'lib/csl/style.rb', line 52
def initialize(attributes = {})
super(attributes, &nil)
children[:locale], children[:macro], @macros, @errors = [], [], {}, []
yield self if block_given?
end
|
Class Attribute Details
Returns the value of attribute default.
18
19
20
|
# File 'lib/csl/style.rb', line 18
def default
@default
end
|
Instance Attribute Details
Returns the value of attribute errors.
37
38
39
|
# File 'lib/csl/style.rb', line 37
def errors
@errors
end
|
Returns the value of attribute macros.
37
38
39
|
# File 'lib/csl/style.rb', line 37
def macros
@macros
end
|
Class Method Details
.load(input = nil) ⇒ Object
20
21
22
|
# File 'lib/csl/style.rb', line 20
def load(input = nil)
super(input || Style.default)
end
|
Instance Method Details
#added_child(node) ⇒ Object
60
61
62
63
64
|
# File 'lib/csl/style.rb', line 60
def added_child(node)
delegate = :"added_#{node.nodename}"
send delegate, node if respond_to?(delegate, true)
node
end
|
#deleted_child(node) ⇒ Object
67
68
69
70
71
|
# File 'lib/csl/style.rb', line 67
def deleted_child(node)
delegate = :"deleted_#{node.nodename}"
send delegate, node if respond_to?(delegate, true)
node
end
|
#demote_non_dropping_particle ⇒ Object
Also known as:
demote_particle
119
120
121
|
# File 'lib/csl/style.rb', line 119
def demote_non_dropping_particle
attributes[:'demote-non-dropping-particle']
end
|
#demote_non_dropping_particle? ⇒ Boolean
Also known as:
demote_particle?
124
125
126
|
# File 'lib/csl/style.rb', line 124
def demote_non_dropping_particle?
attribute?(:'demote-non-dropping-particle')
end
|
#has_page_range_format? ⇒ Boolean
133
134
135
|
# File 'lib/csl/style.rb', line 133
def has_page_range_format?
attribute?(:'page-range-format')
end
|
#id ⇒ String
89
90
91
92
|
# File 'lib/csl/style.rb', line 89
def id
return unless info.has_id?
info.id.to_s
end
|
#independent? ⇒ Boolean
110
111
112
|
# File 'lib/csl/style.rb', line 110
def independent?
!dependent?
end
|
#independent_parent ⇒ Object
114
115
116
117
|
# File 'lib/csl/style.rb', line 114
def independent_parent
return unless dependent?
load_related_style_from independent_parent_link
end
|
82
83
84
|
# File 'lib/csl/style.rb', line 82
def info
children[:info] ||= Info.new
end
|
#initialize_without_hyphen? ⇒ Boolean
129
130
131
|
# File 'lib/csl/style.rb', line 129
def initialize_without_hyphen?
attribute?(:'initialize-with-hyphen') && !attributes[:'initialize-with-hyphen']
end
|
#page_range_format ⇒ Object
137
138
139
|
# File 'lib/csl/style.rb', line 137
def page_range_format
attributes[:'page-range-format']
end
|
#template ⇒ Style
103
104
105
106
|
# File 'lib/csl/style.rb', line 103
def template
return unless has_template?
load_related_style_from template_link
end
|
#title ⇒ String
95
96
97
98
|
# File 'lib/csl/style.rb', line 95
def title
return unless info.has_title?
info.title.to_s
end
|
#valid? ⇒ Boolean
77
78
79
|
# File 'lib/csl/style.rb', line 77
def valid?
validate.empty?
end
|
73
74
75
|
# File 'lib/csl/style.rb', line 73
def validate
@errors = Schema.validate self
end
|