-
Notifications
You must be signed in to change notification settings - Fork 0
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 an HTML crawler and translator #12
Conversation
… text in HTML tags or attributes via XPath expressions
src/Amara/Varcon/HtmlCrawler.php
Outdated
{ | ||
$document = new DOMDocument(); | ||
$document->loadHTML(mb_convert_encoding( | ||
sprintf('<div>%s</div>', $content), |
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.
Perhaps add a comment explaining why we add a div here?
*/ | ||
interface TranslatorInterface | ||
{ | ||
const QUESTIONABLE_IGNORE = 0; |
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.
Perhaps add a description for what these constants do?
Argument::any(), | ||
Argument::any(), | ||
Argument::any() | ||
)->willReturn('Translated'); // Keep in mind we ignore whitespace this way |
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.
It might make this test better to have it return the text passed in appended with 'Translated' rather than always 'Translated'
Enables translation of HTML tags or attributes via XPath expressions.