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

More flexible imports for .json files #284

Closed
edreamleo opened this issue May 6, 2016 · 3 comments
Closed

More flexible imports for .json files #284

edreamleo opened this issue May 6, 2016 · 3 comments
Assignees
Labels
Enhancement Won'tDo Issues that EKR won't do

Comments

@edreamleo
Copy link
Member

edreamleo commented May 6, 2016

Original discussion

A helper class, JSON_Import_Helper (jih) would contain all the general code. You could say that this helper class is conceptually similar to the RecursiveImportController class.

Client scripts would tell the jih class what elements are to create outline structure, which elements should be ignored, and which elements are to create headline text, body text, or even may uA's.

See also: #442.

@edreamleo edreamleo self-assigned this May 6, 2016
@edreamleo
Copy link
Member Author

This item will have low priority until someone tells me that it would actually be useful, so at present it will not be targeted to 5.4.

@tbnorth
Copy link
Contributor

tbnorth commented May 6, 2016

On Fri, 06 May 2016 08:55:49 -0700
"Edward K. Ream" notifications@github.com wrote:

This item will have low priority until someone tells me that it would
actually be useful, so at present it will not be targeted to 5.4.

I think I understand how it would be useful, but I also think you're
right in thinking it would need a helper class to actually handle each
specific case.

There's a parallel in the xml_edit plugin, which import and exports XML
in Leo, with namespace and attribute support, and making maximum use of
Leo's tree to display the XML.

By itself, it imports according to the rules in the doc string,
basically element names are in headers and text content is in the body.

But there's a simple database description schema I use, and use
xml_edit to edit, DTD is here:
https://github.com/tbnorth/trans/blob/master/dml.dtd but basically
think of it as

List of foos id foo_text

The vanilla xml_edit imports this with only 'table', 'name', and
'field' as headers, but a domain specific helper script, the helper class
I think the JSON case would need to, appends the name element body content
to the parent's header, so you can actually see the structure in the tree.
This works because xml_edit only looks at the the first whitespace free
part of the header when exporting.

Bottom line I don't think there's a non-code way of describing how to
import things in a domain specific way - you could use some kind of
XPath-ish notation to explain how to do the import, but anyway who could
parse that could probably handle the code based approach. And the code
based approach will always be most flexible, e.g. it could insert info.
about child counts etc. into the headers.

Cheers -Terry

@edreamleo
Copy link
Member Author

#1098 probably suffices.

@edreamleo edreamleo added Won'tDo Issues that EKR won't do and removed Maybe labels Mar 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Won'tDo Issues that EKR won't do
Projects
None yet
Development

No branches or pull requests

2 participants