|
18 | 18 | CALLOUT_SOURCE_BLOCK_ROLE ||= 'external-callout-block' |
19 | 19 | CALLOUT_ORDERED_LIST_ROLE ||= 'external-callout-list' |
20 | 20 |
|
| 21 | + STANDALONE_CALLOUT_LIST_STYLE ||= 'calloutlist' |
| 22 | + |
21 | 23 | LOCATION_TOKEN_RX ||= /@(\d+)|(@\/(?:\\\/|[^\/])+?\/[ig]{0,2})/ |
22 | 24 | LOCATION_TOKEN_ARRAY_RX ||= /^(@\d+|@\/(?:\\\/|[^\/]|)+?\/[ig]{0,2})((\s+@\d+)|(\s+@\/(?:\\\/|[^\/]|)+?\/[ig]{0,2}))*$/ |
23 | 25 |
|
|
33 | 35 | # The makes sure it's the right kind of list. |
34 | 36 | document.find_by context: :olist do |list| |
35 | 37 |
|
36 | | - if external_callout_list? list |
| 38 | + # if there is as calloutlist style attached to the block |
| 39 | + # then simply style the block as a colist. This will allow folk |
| 40 | + # to create callout blocks that can be attached to annotated images etc. |
37 | 41 |
|
38 | | - owner_block = owning_block list |
| 42 | + if list.style.include? STANDALONE_CALLOUT_LIST_STYLE |
39 | 43 |
|
40 | | - owner_block.subs.replace(owner_block.subs + [:callouts]).uniq |
| 44 | + list.context = :colist |
41 | 45 |
|
42 | | - process_callouts(list, owner_block) |
| 46 | + else |
43 | 47 |
|
44 | | - list.context = :colist |
| 48 | + if external_callout_list? list |
| 49 | + |
| 50 | + owner_block = owning_block list |
45 | 51 |
|
46 | | - owner_block.add_role(CALLOUT_SOURCE_BLOCK_ROLE) unless owner_block.has_role?(CALLOUT_SOURCE_BLOCK_ROLE) |
47 | | - list.add_role(CALLOUT_ORDERED_LIST_ROLE) unless list.has_role?(CALLOUT_ORDERED_LIST_ROLE) |
| 52 | + owner_block.subs.replace(owner_block.subs + [:callouts]).uniq |
| 53 | + |
| 54 | + process_callouts(list, owner_block) |
| 55 | + |
| 56 | + list.context = :colist |
| 57 | + |
| 58 | + owner_block.add_role(CALLOUT_SOURCE_BLOCK_ROLE) unless owner_block.has_role?(CALLOUT_SOURCE_BLOCK_ROLE) |
| 59 | + list.add_role(CALLOUT_ORDERED_LIST_ROLE) unless list.has_role?(CALLOUT_ORDERED_LIST_ROLE) |
| 60 | + |
| 61 | + end |
48 | 62 |
|
49 | 63 | end |
50 | 64 |
|
|
0 commit comments