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

Added support for git file versions in snippets #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

loarabia
Copy link

CONTEXT
Wheat currently supports snippets that are demarcated by a newline < > newline.

Inside of the snippet's brackets, you can specify the relative path from one of
Wheat's markdown articles to a code snippet. In addition to that, wheat can
handle those snippets in different ways.

A snippet ending in a , for example foo/bar.baz. Will be executed and the
result shown beneath the snippet in final rendering.

A snippet ending in a #label will look inside the snippet file for a comment
and display from that #forward.

For instance, foo/bar.baz#doAwesomeStuff will look for:

//doAwesomeStuff
doSomethingAwesome();

//doSomethingLessAwesome
doLesserThings();

and diaplay just the doSomethingAwesome.

CHANGE MOTIVIATION
This change proposes the addition of an additional syntax, :SHA which will
get a specific version of a file in Wheat's git repository.

One would want this when building out a demo application step by step. If you
make a project directory under articles and commit to it piece by piece, it is
very natural as a developer.

On the other hand, right now when using Wheat, a developer often makes multiple
copies of the same file for instance app.js, app2.js, app-final.js to use as
snippets during different stages of the article. If you're not careful, this
can get confusing (speaking from experience here using Wheat) especially if
you go to update an article you wrote a while back.

CHANGE USAGE
With this change, you can use the below as the content of a snippet:

foo/bar.baz:aaaaabbbbbcccccdddddeeeeefffff1111100040
and
foo/bar.baz:ffffffffffffffffffffffffffffffffff00040

and get different versions of the same file from git.

When using this feature, you must specify the full 40 character git SHA and it
does not work with # (although it does work with *) -- the theory being do the
smallest change possible.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! CONTEXT
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Wheat currently supports snippets that are demarcated by a newline < > newline.

Inside of the snippet's brackets, you can specify the relative path from one of
Wheat's markdown articles to a code snippet. In addition to that, wheat can
handle those snippets in different ways.

A snippet ending in a *, for example foo/bar.baz*. Will be executed and the
result shown beneath the snippet in final rendering.

A snippet ending in a #label will look inside the snippet file for a comment
and display from that #forward.

For instance, foo/bar.baz#doAwesomeStuff will look for:

 //doAwesomeStuff
 doSomethingAwesome();

 //doSomethingLessAwesome
 doLesserThings();

and diaplay just the doSomethingAwesome.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! CHANGE MOTIVIATION
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
This change proposes the addition of an additional syntax, :SHA which will
get a specific version of a file in Wheat's git repository.

One would want this when building out a demo application step by step. If you
make a project directory under articles and commit to it piece by piece, it is
very natural as a developer.

On the other hand, right now when using Wheat, a developer often makes multiple
copies of the same file for instance app.js, app2.js, app-final.js to use as
snippets during different stages of the article. If you're not careful, this
can get confusing (speaking from experience here using Wheat) especially if
you go to update an article you wrote a while back.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! CHANGE USAGE
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
With this change, you can use the below as the content of a snippet:

foo/bar.baz:aaaaabbbbbcccccdddddeeeeefffff1111100040
and
foo/bar.baz:ffffffffffffffffffffffffffffffffff00040

and get different versions of the same file from git.

When using this feature, you must specify the full 40 character git SHA and it
does not work with # (although it does work with *) -- the theory being do the
smallest change possible.
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.

1 participant