forked from jirikuncar/marc-json-schema
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarc_fields.tpl
27 lines (26 loc) · 1.03 KB
/
marc_fields.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{%- for tag, field in data if tag|length() == 3 %}
@extend
{{ clean_name(field.name) }}:
{%- if 'subfields' in field %}
creator:
@legacy((('{{ tag }}', '{{ tag }}__', '{{ tag}}__%'), ''),
{%- for code, subfield in field.get('subfields').iteritems() %}
('{{ tag }}__{{ code }}', '{{ clean_name(subfield['name']) }}'){{ ')' if loop.last else ',' }}
{%- endfor %}
marc, '{{ tag }}..', {
{%- for code, subfield in field.get('subfields').iteritems() -%}
'{{ clean_name(subfield['name']) }}': value['{{ code }}']{{ '' if loop.last else ', ' }}
{%- endfor -%}}
producer:
json_for_marc(), {
{%- for code, subfield in field.get('subfields').iteritems() -%}
'{{ tag }}__{{ code }}': '{{ clean_name(subfield['name']) }}'{{ '' if loop.last else ', ' }}
{%- endfor -%}}
{%- else %}
creator:
@legacy(('{{ tag }}', ''), )
marc, '{{ tag }}', value
producer:
json_for_marc(), {'{{ tag }}': ''}
{%- endif %}
{%- endfor %}