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

T6342: add parsing of docs element #32

Open
wants to merge 1 commit into
base: current
Choose a base branch
from
Open

Conversation

rebortg
Copy link
Member

@rebortg rebortg commented Jan 8, 2025

Change Summary

Add support to parse <docs> elements from xml

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Other (please describe):

Related Task(s)

Related PR(s)

vyos/vyos-1x#4292

Proposed changes

How to test

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@rebortg rebortg marked this pull request as ready for review January 9, 2025 13:22
@jestabro jestabro self-requested a review January 10, 2025 02:06
Comment on lines +203 to +207
in
match x with
| Xml.Element ("docs", _, children) ->
List.fold_left aux d children
| _ -> d
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
in
match x with
| Xml.Element ("docs", _, children) ->
List.fold_left aux d children
| _ -> d
in Xml.fold aux d x

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Granted the documentation on Xml-light is sparse (contained in its .mli files), but Xml.fold will do the left fold over children and avoid the redundancy above.

usageExample: string;
hints: doc_hints list;
} [@@deriving yojson]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have not adopted strict formatting yet, but for the moment, I'd suggest consistency in the file: 4 space indent; closing brace aligned with start of definition.

usageExample: string;
hints: doc_hints list;
} [@@deriving to_yojson]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting, as mentioned above.

@jestabro
Copy link
Contributor

Looks good, Robert; suggestions above. Also, you may want to check for trailing whitespace on several lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants