Skip to content
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

Do not remove image's styles #32

Merged
merged 1 commit into from
May 19, 2015
Merged

Do not remove image's styles #32

merged 1 commit into from
May 19, 2015

Conversation

gela-d
Copy link

@gela-d gela-d commented May 18, 2015

Before, code from bse-admin remove style for images
<p><img src="https://img-fotki.yandex.ru/get/15483/158800653.1/0_111ff6_bcf15529_orig"></p>
after, we left all of attributes
<p><img style="float: right; padding: 0 0 10px 10px;" title="BEMup в Минске" alt="фотография программы с минского BEMup" src="https://img-fotki.yandex.ru/get/15483/158800653.1/0_111ff6_bcf15529_orig"></p>

@gela-d
Copy link
Author

gela-d commented May 18, 2015

@tormozz48

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 26.98% when pulling e8e06c5 on BEMINFO-1202 into f42d1a0 on master.

@@ -212,8 +212,7 @@ function overrideLinks(content, node, urlHash, lang, doc) {

content = content.replace(REGEXP.SRC, function(str, href){
//if href is absolute (src="http://..." ) return href
href = /^http/.test(href) ? href : buildSrcForImages(href, doc);
return '<img src="' + href + '"';
return /^http/.test(href) ? str : '<img src="' + buildSrcForImages(href, doc) + '"';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for relative links attrs will still be dropped, isn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am agree, looking very strange

@gela-d
Copy link
Author

gela-d commented May 18, 2015

@tadatuta @tavriaforever thank u, Update PR

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 26.98% when pulling 73d5fc3 on BEMINFO-1202 into f42d1a0 on master.

@@ -155,10 +155,11 @@ function recognizeRelativeLinkForLibraryDocs(str, node) {
* @param {BaseNode} doc node
* @returns {*}
*/
function buildSrcForImages(href, doc) {
function buildSrcForImages(str, href, doc) {
var docParentUrl = doc && doc.url.replace(/\/\w*\.md/, '/'); // replace last url's part: repo/docs/a.md -> repo/docs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there's a change that there's no doc, src will be broken

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but we have no another way to know whole path to img.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 26.98% when pulling a2e0d23 on BEMINFO-1202 into f42d1a0 on master.

@tadatuta
Copy link
Member

actually <img src=path/to/image.svg> is still possible and won't be rewritten but LGTM ;)

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 26.98% when pulling fc125cf on BEMINFO-1202 into f42d1a0 on master.

gela-d pushed a commit that referenced this pull request May 19, 2015
Do not remove image's styles
@gela-d gela-d merged commit 72ea024 into master May 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants