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

feature: include ranged code lines #3393

Merged
merged 1 commit into from
Jan 1, 2019
Merged

feature: include ranged code lines #3393

merged 1 commit into from
Jan 1, 2019

Conversation

kezhenxu94
Copy link
Contributor

@kezhenxu94 kezhenxu94 commented Dec 18, 2018

Fix issue #3310

Thank you for creating a pull request to contribute to Hexo code! Before you open the request please review the following guidelines and tips to help it be more easily integrated:

  • Add test cases for the changes.
  • Passed the CI test.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.009%) to 97.263% when pulling 8d67359 on kezhenxu94:feature/include-ranged-code into ccce9d6 on hexojs:master.

@kezhenxu94
Copy link
Contributor Author

Can anybody tell me why the CI test did not pass and how I could do?

I checked out the master branch before doing any changes and the tests failed too when I run npm run test locally.

I have already added tests for the changes and all of them passed.

@yoshinorin
Copy link
Member

yoshinorin commented Dec 18, 2018

@kezhenxu94
Now we are dealing with CI error problem.
Please see #3392

@tcrowe
Copy link
Contributor

tcrowe commented Dec 21, 2018

Hi @kezhenxu94 👋🏻

Is it possible you can describe what it's doing? I'm not understanding it. Maybe a screen shot? Thank you 👍🏻

@tcrowe tcrowe added need-investigation need-information Further information is requested labels Dec 21, 2018
@kezhenxu94
Copy link
Contributor Author

Hi @tcrowe 👋🏻

As described in issue #3393 , this commit provides possibilities to include just a range of lines in a code file instead of the whole file, for example, file test.js contains the following code:

if (tired && night){
    sleep();
}

and by any chance I just want to include part of the code,

sleep();

So I just need to write:

{% include_code lang:javascript from:2 to:3 test.js %}

to include from line 2(inclusive) to line 3(exclusive).

@tcrowe
Copy link
Contributor

tcrowe commented Dec 22, 2018

@kezhenxu94 Hey, that's pretty cool! Thanks for the explanation.

@tcrowe tcrowe removed need-information Further information is requested need-investigation labels Dec 22, 2018
Copy link
Member

@yoshinorin yoshinorin left a comment

Choose a reason for hiding this comment

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

I test this PR on my local machine like this. It's works well. Thanks 😊

{% include_code lang:javascript from:1 to:2 test.js %}
{% include_code lang:javascript from:3 to:3 test.js %}
{% include_code lang:javascript from:4 test.js %}
{% include_code lang:javascript to:5 test.js %}
{% include_code lang:javascript test.js %}

pr

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.

4 participants