Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator for asciidoc representation of all ECS fields #347

Merged
merged 28 commits into from
Mar 20, 2019

Conversation

webmat
Copy link
Contributor

@webmat webmat commented Feb 27, 2019

This code generates both the index page for the fields section, and the detailed page for each fieldset.

TODO

  • Fix fieldset order: Base first, then alphabetic
  • Fix field order: preserve original order from schema files
  • Default short description for fieldsets to description. Raise if description has newlines.
  • Render table with complete field set details
  • Revert back to alphabetical sorting for fields
  • Render the footnotes as well?
  • Mention where a field set is expected to be reused.
    • In fieldset, list acceptable destination fieldsets.
    • In destination fieldset, mention which fieldsets are expected here, as contractions linking to their canonical documentation.
  • Replace markdown in schemas with asciidoc markup (e.g. hyperlinks)

How to visualize this PR

Via GitHub's rendering of asciidoc, in my branch

Or in the ECS repo

make generate
make docs

http://localhost:8000/ecs-fields.html 👀

@webmat
Copy link
Contributor Author

webmat commented Feb 27, 2019

@dedemorton Hey this uses the 3 column layout you were proposing in elastic/beats#9519. I'm doing so with a twist: we're packing a bit of information vertically, for each row:

  • Middle column is short description (1 line) and on line below, the example for the field
  • Rightmost column is ECS level followed by the field's datatype.

I'm not in love with how exactly this first attempt looks, but I think it's a good start :-)

cc @karenzone

@webmat
Copy link
Contributor Author

webmat commented Feb 27, 2019

Index page:

ecs-fields-index

Details page:

ecs-fields-details

@webmat webmat force-pushed the asciidoc-fields branch 2 times, most recently from 76c29f6 to 40dccec Compare March 1, 2019 03:22
@webmat
Copy link
Contributor Author

webmat commented Mar 1, 2019

Updated screenshots.

Index page

Notice Base is now first.

ecs-fields-index

Fieldset details page

  • Still has summary table at the beginning
  • Below, each field is detailed in full
  • Trimmed down the summary table, since we now have details below
  • Fields are now displayed in the same order as they're listed in schemas/*.yml

ecs-fields-details

@dedemorton
Copy link

@webmat I like the second layout is better (the table in the first iteration was a little confusing visually when you added the level and type info). It would be nice for the entries in the table to link to the full description under field details.

@karenzone I pinged you about this in slack, but wanted to ask if you can make sure this content builds OK with the asciidoctor version of the doc build.

tl;dr for @webmat: we're eventually migrating to asciidoctor, which is more restrictive than asciidoc.

@webmat
Copy link
Contributor Author

webmat commented Mar 1, 2019

@dedemorton Yes, linking to the detail section was next on my TODO :-) As for the table, I agree the second is better. But I'm, still experimenting to find just the right way to integrate the level, I'm still not satisfied. So ideas are welcome there as well.

I'm more than happy to build using both versions of the tooling, to make sure things will remain ok when we switch over. Just point me in the right direction :-)

@webmat
Copy link
Contributor Author

webmat commented Mar 1, 2019

Actually since ECS now has short descriptions everywhere, 4 columns renders pretty good. My favourite below is "type last". I'm also attaching a bunch of 3-col experiments as a zip. I really prefer 4 cols.

level last

level-last-base

level-last-http

type last

type-last-base

type-last-http

3 columns

3-col.zip

@webmat
Copy link
Contributor Author

webmat commented Mar 1, 2019

Actually, here's another format that I think works best. Going with this for now.

I call this one Mike ;-)

mike-base

mike-http

@webmat
Copy link
Contributor Author

webmat commented Mar 1, 2019

HTTP is really cramped, though 🤔

@dedemorton
Copy link

dedemorton commented Mar 1, 2019

HTTP is really cramped, though

Yah the overall layout of tables in really bad. Unfortunately the knobs for adjusting cell padding in asciidoc don't work with our doc build. I haven't tested on asciidoctor. I've been wanting a css change for quite awhile, but that's not happened yet.

To build with asciidoctor, run the docker-based version of the doc build (build_docs instead of build_docs.pl) and include the --asciidoctor flag. Sometimes one problem can cause many messages, so don't lose hope. :-) Reach out to Nik E if you have questions about the asciidoctor build.

@webmat
Copy link
Contributor Author

webmat commented Mar 1, 2019

I realize I haven't posted a full page rendering of the listing of field sets, yet. With the new short descriptions, the page looks great :-)

field-index-page

Also, moving back to the layout initially proposed in #334, which has all of the information directly in the table (no need for details section below):

base

http

@webmat
Copy link
Contributor Author

webmat commented Mar 1, 2019

First experiment displaying what field sets may be nested under host. Feedback welcome.

host-details-with-nesting

@webmat
Copy link
Contributor Author

webmat commented Mar 19, 2019

Looking for ideas on how to best word the section about field reuses at the bottom of the fieldset detail page.

Here's a screenshot of user.*. This fieldset is special, it's the only one with another fieldset that can be nested under it (group) and that is expected to be nested in other places.

Input on the wording of this section is particularly welcome 😆 This gets the job done, but it's not concise.

user_fieldset_details_v2

@webmat
Copy link
Contributor Author

webmat commented Mar 19, 2019

@ruflin As of now, this PR doesn't render footnotes yet. Only agent and cloud have one, and I'm not sure what to do with it.

I wonder if we should drop this attribute altogether. If we need to flesh out details about a section, we should do it in the main description, I think.

What do you think?

@webmat
Copy link
Contributor Author

webmat commented Mar 19, 2019

@karenzone Your input would be welcome on how best to display information about field reuse.

Where a field set is expected is currently two sentences (just like in the readme), whereas what's expected to be nested under a field set is a table.

Should we do all sentences, no tables? Should we do two tables? Only one table, with an added column that explains which direction the reuse goes?

See the screenshot above, where user.* is on both sides of the field reuse :-)

@webmat
Copy link
Contributor Author

webmat commented Mar 20, 2019

Ok, this is ready for final review, IMO.

We can revisit how reusability is rendered as a separate PR. What we currently have there is functional, though.

@webmat webmat added review and removed in progress labels Mar 20, 2019
@webmat webmat changed the title WIP Generator for asciidoc representation of all ECS fields. Generator for asciidoc representation of all ECS fields. Mar 20, 2019
@webmat webmat changed the title Generator for asciidoc representation of all ECS fields. Generator for asciidoc representation of all ECS fields Mar 20, 2019
@ruflin
Copy link
Member

ruflin commented Mar 20, 2019

I skimmed through the code and looked at the docs locally. What is most important for me in this PR is that we have the docs in asciidocs and can iterate on top of it. There are a few things I would change but lets discuss it later as it's just about pages and formatting, not the general idea.

@webmat webmat merged commit 37cbd2a into elastic:master Mar 20, 2019
webmat added a commit to webmat/ecs that referenced this pull request Mar 20, 2019
This code generates both the index page for the fields section, and the detailed page for each fieldset.

Also in this PR:

- If `short` not set, copy `definition` to it
- If `short` contains \n, fail. Beginning of an ECS linter.
- Beef up the local file imports in tests.
  - autopep8 ignore E402, in order to leave local imports alone
- Create generators/ecs_helpers.py, to start reusing functionality beween generators
webmat pushed a commit to webmat/ecs that referenced this pull request Mar 20, 2019
webmat added a commit that referenced this pull request Mar 20, 2019
webmat pushed a commit to webmat/ecs that referenced this pull request Mar 20, 2019
webmat added a commit to webmat/ecs that referenced this pull request Mar 20, 2019
webmat added a commit that referenced this pull request Mar 20, 2019
@webmat webmat mentioned this pull request Mar 20, 2019
3 tasks
webmat added a commit that referenced this pull request Mar 21, 2019
…of all ECS fields (#347) (#392)

This code generates both the index page for the fields section, and the detailed page for each fieldset.

Also in this PR:

- If `short` not set, copy `definition` to it
- If `short` contains \n, fail. Beginning of an ECS linter.
- Beef up the local file imports in tests.
  - autopep8 ignore E402, in order to leave local imports alone
- Create generators/ecs_helpers.py, to start reusing functionality beween generators
webmat added a commit to webmat/ecs that referenced this pull request Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants