-
Notifications
You must be signed in to change notification settings - Fork 79
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
Added nolinks flag to skip links during rendering #80
Open
debuggio
wants to merge
6
commits into
reddit:master
Choose a base branch
from
debuggio:evtim/AE-598
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3d4cf4c
Added nolinks flag to skip links during rendering
debuggio d6e2afb
Added header for snudown to remove code duplication
debuggio 395c8e5
Code review fixes and refactoring
debuggio b2e380a
minor refactoring in renderers
debuggio a7375dc
Removed include of unexisting file from snudown-validator
debuggio 877d9f6
Fix for snudown-validator
debuggio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -422,6 +422,64 @@ | |
'<p><table scope="foo"></p>\n', | ||
} | ||
|
||
|
||
no_links_cases = { | ||
'http://www.reddit.com': | ||
'<p>http://www.reddit.com</p>\n', | ||
|
||
'http://www.reddit.com/a\x00b': | ||
'<p>http://www.reddit.com/ab</p>\n', | ||
|
||
'ampersands http://www.google.com?test&blah': | ||
'<p>ampersands http://www.google.com?test&blah</p>\n', | ||
|
||
'www.http://example.com/': | ||
'<p>www.http://example.com/</p>\n', | ||
|
||
'[email protected]': | ||
'<p>[email protected]</p>\n', | ||
|
||
'/u/test/m/test test': | ||
'<p>/u/test/m/test test</p>\n', | ||
|
||
'/u/test': | ||
'<p>/u/test</p>\n', | ||
|
||
'/r/not.cool': | ||
'<p>/r/not.cool</p>\n', | ||
|
||
'u/test': | ||
'<p>u/test</p>\n', | ||
|
||
'/r/whatever: fork': | ||
'<p>/r/whatever: fork</p>\n', | ||
|
||
'/r/t:timereddit': | ||
'<p>/r/t:timereddit</p>\n', | ||
|
||
'/r/reddit.com': | ||
'<p>/r/reddit.com</p>\n', | ||
|
||
'r/not.cool': | ||
'<p>r/not.cool</p>\n', | ||
|
||
'/r/very+clever+multireddit+reddit.com+t:fork+yay': | ||
'<p>/r/very+clever+multireddit+reddit.com+t:fork+yay</p>\n', | ||
|
||
'/r/t:heatdeathoftheuniverse': | ||
'<p>/r/t:heatdeathoftheuniverse</p>\n', | ||
|
||
'/r/all-minus-something': | ||
'<p>/r/all-minus-something</p>\n', | ||
|
||
r'escaped \/r/test': | ||
'<p>escaped /r/test</p>\n', | ||
|
||
'Words words /r/test words': | ||
'<p>Words words /r/test words</p>\n', | ||
} | ||
|
||
|
||
class SnudownTestCase(unittest.TestCase): | ||
def __init__(self, renderer=snudown.RENDERER_USERTEXT): | ||
self.renderer = renderer | ||
|
@@ -458,4 +516,10 @@ def test_snudown(): | |
case.expected_output = expected_output | ||
suite.addTest(case) | ||
|
||
for input, expected_output in no_links_cases.iteritems(): | ||
case = SnudownTestCase(renderer=snudown.RENDERER_USERTEXT_WITHOUTLINKS) | ||
case.input = input | ||
case.expected_output = expected_output | ||
suite.addTest(case) | ||
|
||
return suite |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this repeated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repeated where?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly same code is in fuzzing/snudown-validator.c
I don't understand how fuzzer/validator works in this code base, yet, but that seems like a DRY violation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolutely agree. But, at least it doesn't register modules, also there are some minor differences that may affect something. I asked Peter about it. His response: "snudown-validator is the snudown.c with a main() function added, so it can be run as a standalone program for fuzz-testing."
I thought about rewriting this part to use validator.c but because I'm not sure how to test it, I decided to leave it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we just have a
.h
file that we include from fuzz and main ?