20,741
edits
Line 254: | Line 254: | ||
Ultimately, this would allow the script to self-update its regex/xpath expressions if/when the underlying website (themes) change, but it would also allow to add support for new websites, without ever manually adding the required xpath/regex expressions, i.e. all that is needed is a sufficiently large number of example datasets to obtain the author, date and title information, and a URL for the script to download the HTML markup of the posting in question: | Ultimately, this would allow the script to self-update its regex/xpath expressions if/when the underlying website (themes) change, but it would also allow to add support for new websites, without ever manually adding the required xpath/regex expressions, i.e. all that is needed is a sufficiently large number of example datasets to obtain the author, date and title information, and a URL for the script to download the HTML markup of the posting in question: | ||
{{Note|The date field won't work as is, because it's actually post-processed using a transformation function, so we'd need to undo the transformation or use the actual date string instead}} | |||
<syntaxhighlight lang="javascript"> // vector with tests to be executed for sanity checks (unit testing) | <syntaxhighlight lang="javascript"> // vector with tests to be executed for sanity checks (unit testing) | ||
tests: [ | tests: [ |