-
Notifications
You must be signed in to change notification settings - Fork 68
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 image tag to shortcode task #227
Add image tag to shortcode task #227
Conversation
385bc38
to
c7f4428
Compare
dbcb2be
to
ebde358
Compare
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.
Added some bits of feedback.
The unit tests needs to be updated to be a bit more beefy. e.g.:
- links to hash path
- link to natural path
- link to variants of any path
- link to external files
- broken html
- image tag with and without closing bracket (
<img/>
as opposed to<img>
) - image tag inside a link
- attributes with single quotes
- attributes without quotes
- bad casing for tags or attributes
- images and links that should not be updated
|
||
/** | ||
* Get all tags within some page content and return as array. | ||
* @param $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.
Doesn't look like this has been fixed.
Finds old `img` tags referencing assets and rewrites them to use shortcodes
- `TagsToShortcode` now also rewrites `a` tags instead of just `img` tags - Fix travis build
… necessary for resampled files to work Depends on: https://github.com/open-sausages/silverstripe-assets/tree/pulls/1/natural-path-for-accessing-assets/src/FilenameParsing
- baseClass: The base class that will be used to look up HTMLText fields. Defaults to SilverStripe\ORM\DataObject - includeBaseClass: Whether to include the base class' HTMLText fields or not
…usages/silverstripe-assets into pulls/1/img-to-shortcode
…ilverstripe-assets into pulls/1/img-to-shortcode
Test won't be green until silverstripe/silverstripe-framework#8960 is merge. |
Introduced as a less public API in silverstripe/silverstripe-assets#227
Was it an explicit decision not to rewrite If we're not planning to fix that, it's definitely a gotcha we should mention in the upgrade guide. This is modifying people's data, it's absolutely essential that they understand what's happening. |
$tagsToShortcodeHelper = new TagsToShortcodeHelper(); | ||
$tagsToShortcodeHelper->run(); | ||
|
||
/** @var SiteTree $newPage */ |
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.
Just as a sidenote: I think this isn't great usage of fixtures - it makes it quite hard to see the before/after state. I generally try to avoid fixtures where the data of those records is relevant to understanding the tests, and default to creating them inline. No need to change here, just thought it's worth mentioning.
@chillu We asked the questions in a stand up a wee while ago and you said it wasn't worth it, so we didn't do it (that will be my go-to excuse from now on ... "we told you about it in some unspecified meeting a few months ago"). If you think it's worthwhile, it would not be a big deal to apply it to previous versions as well, although it becomes a bit more murky because some of the files might not be there any more or the DB structure could have changed somewhere in-between. Also, depending on how many previous versions they are, it could take a lot longer to apply the changes. |
$documentID = $this->idFromFixture(File::class, 'document'); | ||
$imageID = $this->idFromFixture(Image::class, 'image1'); | ||
|
||
$this->assertContains( |
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.
Each of these assertions should spell out what they're testing
Grrr ... we still have test failings!!! I'll fix those. |
Those unit test should be working now. |
Finds old
img
/a
tags referencing assets and rewrites them to use shortcodesDepends on silverstripe/silverstripe-framework#8892
Extra tests to add