lib/docubot/page.rb
# Add IDs to elements that don't have them
Add IDs to elements that don't have them
Add IDs to elements that don ' t have them
def auto_id
		if @meta['auto-id'].as_boolean || @meta.toc.as_list.any?{ |toc| !toc['#'] }
			@nokodoc.css( AUTO_ID_ELEMENTS ).each do |node|
				next if node.has_attribute?('id')
				node['id'] = DocuBot.id_from_text(node.inner_text)[1..-1]
			end
			dirty_doc
		end
	end
def auto_id if @meta [ 'auto-id' ] . as_boolean || @meta . toc . as_list . any? { | toc | ! toc [ '#' ] } @nokodoc . css ( AUTO_ID_ELEMENTS ) . each do | node | next if node . has_attribute? ( 'id' ) node [ 'id' ] = DocuBot . id_from_text ( node . inner_text ) [ 1 .. - 1 ] end dirty_doc end end
Add IDs to elements that don't have them
Add IDs to elements that don ' t have them
# ...but only if a toc entry might reference one, or requested. # Strip off the unwanted leading '#'