14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/asciidoctor/foodogsquared/extensions/fdroid-inline-macro.rb', line 14
def process(parent, target, attrs)
doc = parent.document
app_id = target
app_metadata_uri = %(https://gitlab.com/fdroid/fdroiddata/-/raw/master/metadata/#{app_id}.yml)
metadata = OpenURI.open_uri(app_metadata_uri) { |f| YAML.safe_load(f.read) }
attrs['caption'] ||= metadata['AutoName']
url = %(https://f-droid.org/#{attrs['lang']}/packages/#{app_id})
doc.register :links, url
create_anchor parent, attrs['caption'], type: :link, target: url
end
|