feat(attestation): list tags errors and substitute missing tag by libelle
This commit is contained in:
parent
6f49dd892d
commit
f7484eb0e5
16 changed files with 139 additions and 55 deletions
|
@ -5,13 +5,14 @@ class TiptapService
|
|||
children(node[:content], substitutions, 0)
|
||||
end
|
||||
|
||||
def used_tags(node, tags = Set.new)
|
||||
# NOTE: node must be deep symbolized keys
|
||||
def used_tags_and_libelle_for(node, tags = Set.new)
|
||||
case node
|
||||
in type: 'mention', attrs: { id: }
|
||||
tags << id
|
||||
in { content: } if content.is_a?(Array)
|
||||
content.each { used_tags(_1, tags) }
|
||||
else
|
||||
in type: 'mention', attrs: { id:, label: }, **rest
|
||||
tags << [id, label]
|
||||
in { content:, **rest } if content.is_a?(Array)
|
||||
content.each { used_tags_and_libelle_for(_1, tags) }
|
||||
in type:, **rest
|
||||
# noop
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue