Closed fdb closed 6 years ago
Can I try this, if work not yet started on it?
@kunal-mohta afaik, noone is working on this yet.
On a further note, I am wondering if, in the above example, 'headline' could serve as a namespace.
article would become then:
article:
- <article><h1>{{ headline.root }}</h1><a href="#">Read More...</a></article>
That way, individual pieces of a sketch could be reused. I'm not sure if we really need to go this far though.
That would be really nice.
Let me first try getting the #import
work, then we can further discuss on how far we need to go.
Are these lines meant for #import
only?
Or should I start with a different block?
No, lines starting with # are considered comment lines and are now skipped. #import would be an exception to the rule.
Okay, I will take that into consideration.
Currently I am facing some trouble handling the asynchronicity of the firebase.database()
function.
Is it fine if I take some more time to figure it out?
One more query, do we only have to import the code of the saved sketch, or the seed as well?
What I mean is, should the code imported from the import
statement follow the present seed or the one in which it was saved?
No, I don't see any reason to import the seed value of the imported sketch.
I have tried something. It is not complete, but before working further on it I want to show it you so that we can figure out whether I am going in the right direction or not. Should I send a PR?
Maybe you could set it up as a different branch on your forked repo of Seed? I could take a look at it then.
Sure. I will do that and send a PR?
Ok.
Okay so I have the basic case for 'import' covered, currently living inside the 'asyncPhrasebook' branch. It could be interesting to see how it could be further extended to the namespace thing I described above. Since the name of a block can contain period signs (except for two consecutively, this is reserved for ranges), this may require some extra attention.
Okay, I will have a look at your code. So should I continue working on this, or are you planning to implement it?
If you can improve upon it, that would be great. I don't know yet if I have much time to work on it the next couple of days.
I can try it.
That is a very nice piece of code you have written.
I wanted to clarify something.
Are periods allowed in the names of the import statements.
For example, is #import "key" as head.line
valid?
Further, you have stored the data of the imported sketch in this format -
So when a user writes , say for example {{ headline.root }}
, what all things do you plan to display?
Because the root
key of the headline
object is as
Well, if you 'import something as headline' then {{ headline.root }} should call root in 'something'. Now {{ headline }} automatically calls root, which is good, but I think {{ headline.root }} should also work.
But the syntax for imports also needs to change from the # character to the % character. It belongs to the preamble. Lines starting with a # should stay comments.
I also prefer the %
over the #
character, since #
could be confused with comments.
This is now fixed in 9b44c587ef69ca51365d4161e4c6735b2056a964. We still need the documentation. At least in the cheat sheet, but perhaps this deserves its own reference page.
The base issue has been covered and nobody is reading this anymore so I made two follow-up issues.
As a user I want to bring in other sketches in my sketches so I can re-use existing work/
As an example, you could create a "fake title" generator that could be used in a "fake news website" generator. Imagine we have a fake title generator saved as sketch
-L41HTgXT1z6Vaxno2eR
. This is how we could import it:Because sketch URLs are immutable there are no version conflicts (although it makes it harder to upgrade them with new features).
This depends on #4 (preamble syntax).