Skip to content

Commit 2ca932e

Browse files
author
Mathieu Martin
authored
Make all fields linkable directly via an HTML ID (#1148)
1 parent 1f63f27 commit 2ca932e

File tree

8 files changed

+1647
-417
lines changed

8 files changed

+1647
-417
lines changed

docs/field-details.asciidoc

Lines changed: 1636 additions & 409 deletions
Large diffs are not rendered by default.

experimental/generated/ecs/ecs_flat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'@timestamp':
2-
dashed_name: -timestamp
2+
dashed_name: timestamp
33
description: 'Date/time when the event originated.
44
55
This is the date/time extracted from the event, typically representing when the

experimental/generated/ecs/ecs_nested.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ base:
158158
events. These fields are common across all types of events.
159159
fields:
160160
'@timestamp':
161-
dashed_name: -timestamp
161+
dashed_name: timestamp
162162
description: 'Date/time when the event originated.
163163
164164
This is the date/time extracted from the event, typically representing when

generated/ecs/ecs_flat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'@timestamp':
2-
dashed_name: -timestamp
2+
dashed_name: timestamp
33
description: 'Date/time when the event originated.
44
55
This is the date/time extracted from the event, typically representing when the

generated/ecs/ecs_nested.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ base:
160160
events. These fields are common across all types of events.
161161
fields:
162162
'@timestamp':
163-
dashed_name: -timestamp
163+
dashed_name: timestamp
164164
description: 'Date/time when the event originated.
165165
166166
This is the date/time extracted from the event, typically representing when

scripts/schema/finalizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def field_finalizer(details, path):
176176
name_array = path + [details['field_details']['node_name']]
177177
flat_name = '.'.join(name_array)
178178
details['field_details']['flat_name'] = flat_name
179-
details['field_details']['dashed_name'] = re.sub('[@_\.]', '-', flat_name)
179+
details['field_details']['dashed_name'] = re.sub('[_\.]', '-', flat_name).replace('@', '')
180180
if 'multi_fields' in details['field_details']:
181181
for mf in details['field_details']['multi_fields']:
182182
mf['flat_name'] = flat_name + '.' + mf['name']

scripts/templates/field_details.j2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ beta::[ {{ fieldset['beta'] }}]
3232
{% if 'original_fieldset' not in field -%}
3333

3434
{# `Field` column -#}
35-
| {{ field['flat_name'] }}
35+
|
36+
[[field-{{field['dashed_name']}}]]
37+
<<field-{{field['dashed_name']}}, {{ field['flat_name'] }}>>
38+
3639
{# `Description` column -#}
3740
{#- Beta fields will add the `beta` label -#}
3841
{% if field['beta'] -%}

scripts/tests/unit/test_schema_finalizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def test_calculate_final_values(self):
268268
timestamp_details = base_fields['@timestamp']['field_details']
269269
self.assertEqual(timestamp_details['flat_name'], '@timestamp',
270270
"Field sets with root=true must not namespace field names with the field set's name")
271-
self.assertEqual(timestamp_details['dashed_name'], '-timestamp')
271+
self.assertEqual(timestamp_details['dashed_name'], 'timestamp')
272272
# root=false
273273
self.assertEqual(server_fields['ip']['field_details']['flat_name'], 'server.ip',
274274
"Field sets with root=false must namespace field names with the field set's name")
@@ -288,7 +288,7 @@ def test_calculate_final_values(self):
288288
def test_dashed_name_cleanup(self):
289289
details = {'field_details': {'node_name': '@time.stamp_'}}
290290
finalizer.field_finalizer(details, [])
291-
self.assertEqual(details['field_details']['dashed_name'], '-time-stamp-')
291+
self.assertEqual(details['field_details']['dashed_name'], 'time-stamp-')
292292

293293
# field_group_at_path
294294

0 commit comments

Comments
 (0)