7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/asciidoctor/nabetani/abstractblock-xreftext.rb', line 7
def xreftext xrefstyle = nil
if (val = reftext) && !val.empty?
val
elsif xrefstyle
if @numbered
case xrefstyle
when 'custom'
fmt = @document.attributes["xrefcustomformat"]
fmt.gsub( "[$SECT_NUMS$]", sectnum.gsub( /[\.\,]$/, "" ) ).gsub( "[$TITLE$]", title )
when 'full'
if (type = @sectname) == 'chapter' || type == 'appendix'
quoted_title = sub_placeholder (sub_quotes '_%s_'), title
else
quoted_title = sub_placeholder (sub_quotes @document.compat_mode ? %q(``%s'') : '"`%s`"'), title
end
if (signifier = @document.attributes[%(#{type}-refsig)])
%(#{signifier} #{sectnum '.', ','} #{quoted_title})
else
%(#{sectnum '.', ','} #{quoted_title})
end
when 'short'
if (signifier = @document.attributes[%(#{@sectname}-refsig)])
%(#{signifier} #{sectnum '.', ''})
else
sectnum '.', ''
end
else (type = @sectname) == 'chapter' || type == 'appendix' ? (sub_placeholder (sub_quotes '_%s_'), title) : title
end
else (type = @sectname) == 'chapter' || type == 'appendix' ? (sub_placeholder (sub_quotes '_%s_'), title) : title
end
else
title
end
end
|