def inline_anchor node
case node.type
when :ref
%(<anchor#{common_attributes node.target, nil, node.text}/>)
when :xref
if (path = node.attributes['path'])
%(<ulink url="#{node.target}">#{node.text || path}</ulink>)
else
linkend = node.attributes['fragment'] || node.target
(text = node.text) ? %(<link linkend="#{linkend}">#{text}</link>) : %(<xref linkend="#{linkend}"/>)
end
when :link
%(<ulink url="#{node.target}">#{node.text}</ulink>)
when :bibref
target = node.target
%(<anchor#{common_attributes target, nil, "[#{target}]"}/>[#{target}])
end
end