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

Add format_list method to handle Unordered and OrderedLists #65

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

aapomm
Copy link
Contributor

@aapomm aapomm commented Dec 13, 2023

Summary

Nexpose doesn't quite yet support / and it simply removes it from the output. We want to convert these to Textile's lists: * and #.

Proposed Solution
Parse the UnorderedList/OrderedList from the input and format them to use * and #.

Other Information

If there's anything else that's important and relevant to your pull
request, mention that information here. This could include
benchmarks, or other information.

Thanks for contributing to Dradis!

Copyright assignment

Collaboration is difficult with commercial closed source but we want
to keep as much of the OSS ethos as possible available to users
who want to fix it themselves.

In order to unambiguously own and sell Dradis Framework commercial
products, we must have the copyright associated with the entire
codebase. Any code you create which is merged must be owned by us.
That's not us trying to be a jerks, that's just the way it works.

Please review the CONTRIBUTING.md
file for the details.

You can delete this section, but the following sentence needs to
remain in the PR's description:

I assign all rights, including copyright, to any future Dradis
work by myself to Security Roots.

module Dradis::Plugins::Nexpose
class ListFormatter
def format_list(source)
# Add <root> node in case the source is an invalid xml
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we still want to process invalid xml?


def format_nexpose_list(xml, depth = 1)
xml.xpath('./UnorderedList | ./OrderedList').map do |list|
list_type = list.name == 'UnorderedList' ? '*' : '#'
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
list_type = list.name == 'UnorderedList' ? '*' : '#'
list_item_type = list.name == 'UnorderedList' ? '*' : '#'

Or list_item_element / list_element ? Something a bit more descriptive

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