-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix youtube and embed links #14
Conversation
I also ran the code through |
na_empty(get_html_attr(x = x, name = name, element = element)) | ||
}) | ||
names(out) = attributes | ||
names(out) <- attributes |
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.
This is the brand new chunk of code that does the youtube link switching.
'height: "{height}",', | ||
'width: "{width}",', | ||
'align: "{align}"', | ||
'type: "{type}"', |
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.
I've added these two new attributes so we can specify the youtube poster image. 🎉
I believe this closes #6 and makes leanbuild that much more functional. @carriewright11 do you want to see if this does what you need? |
Oh great. 😩 Windows fails because it wants a Git token to install a dependency. I'll have to fix that. |
The lazy/efficient way around this problem is to use functions that aren't part of stringr so we don't have that dependency. I will probably do this. |
Taking a look now. |
Great work! Yeah, looks good. I should test on my files (although maybe you did that?) Can we add instructions to the video conversions - so people know how to expand the videos in Leanpub?(maybe I missed that though). Does the exclamation mark need to move to the end here: |
I was using the 05-promoting_diversity.Rmd file from your course to test and it looked like what it should be as far as my knowledge but I didn't have the ability to push to Leanpub for the final test.
Sounds good!
The exclamation there is a part of the link but we can certainly make the sentence itself exclamatory. Should there not be a |
If you would be able to test on Leanpub for real, that'd be great. If you want to do a full test of this before we merge:
|
I actually published my course yesterday... so I'd need to look into how that works... if you can preview without modifying the published course. Otherwise we could use the template? |
Since these aren't image links, we wouldn't want the |
Markua is fine with that for images. |
OK I am testing from the template... You can see the test now when you look at the latest preview version on leanpub |
|
||
## Set defaults for items that haven't been specified | ||
|
||
# Default for align is center |
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.
I've added these two defaults.
R/replace_html.R
Outdated
} | ||
|
||
# If its an image, use ! otherwise don't | ||
if (!is.null(element) | element == "img") { |
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.
Adding logic to handle whether there should be a ! or not
This is working as far as I can tell, but the one thing that's odd/not working really is the corner part in the videos are gone? This is what the tags for the above look like (also note that "middle" doesn't work -- only "center").
|
This PR has gotten a bit out of hand. I'm going to merge it since it is fixing things and then file separate issues for these new things popping up. |
They aren't gone... it shows up after pressing play... but idk how to convey that more concisely/ assumed people when they saw the word video would press play. They can actually press twice on the right corner (on nothing) and it will expand- you don't have to click the center to play. The text appears to be centered but not the video... let me check how I did that... |
Ok here is an example of mine: {type: video, poster: 'http://img.youtube.com/vi/VOCYL-FNbr0/mqdefault.jpg',height: "400px", width: "100%", align: "middle"} I noticed that the comma is missing before |
Perhaps. It's also odd the comma isn't showing up. I'll look into that. |
Summary
This fixes two of the three things to fix mentioned on: #6 (comment)
Fix one:
Markua needs the "watch" version of youtube links.
So where we have a link like:
"https://www.youtube.com/embed/"
we actually need:"https://www.youtube.com/watch?v="
I've added this change to the existing
replace_image_data()
function of this package. This function appears to parse out all the html attributes so its the perfect time to fix youtube links.This works when I've run it locally.
Fix two:
I added the type and poster specification for youtube links as prescribed by @carriewright11 here: #6 (comment)
Edit:
Fix three:
I believe I've made the changes needed for adding the links for instances where knitr::include_url() are used.