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

A Way to define SM templates on Item(s') creation #237

Open
ghost opened this issue Aug 23, 2020 · 1 comment
Open

A Way to define SM templates on Item(s') creation #237

ghost opened this issue Aug 23, 2020 · 1 comment
Labels
enhancement New feature or request reverse-engineering sma-api SMA interface API

Comments

@ghost
Copy link

ghost commented Aug 23, 2020

Description

On item/Element creation the user can provide a template to map to be it the currently presented one in the SM window/the default SM template/ a template from the template registry. A prime use for this would be to map between Anki Fields to the SM templates for use in the Anki Importer.

Sketches, Videos, ...

None that I have at the moment.

Environment

This feature should be enabled on element creation, through the SMA SDK.

Motivation

Why do you want to see this feature ?
Anki Cards come in all shapes and templates and the default question and answer format of SM can be disappointing and unappealing to new Users and somewhat restricting to a subset of cards particularly language learning cards.

What use cases does it support ?
Anki to supermemo importer and various possible future importers.

Approximately how big percent of user base do you think would use this feature ?
I guess 80% of anki users migrating to SM or students looking to use Anki as a form of question bank.

Documentation-type explanation

Explain the feature, and the steps to use it as if you were writing instructions for first-time users.

  • When creating a Template:
Template tmplt = ..// Some created template

var elembldr =  new ElementBuilder(ElementType.Item)
                                                ....// some functions
                                                .WithTemplate(tmplt );
  • To create a Template:
// Creating a component
Component mycomponent  = ComponentRegistry.HTML_Component();
mycomponent.Width  = 200;
mycomponent.Height  = 200;
mycomponent.Position = (0,20); // x , y

List<Component> mycomponents = new List<Component>() {// A list of Components};

// Creating a template using the Template Builder
Template tmplt = new TemplateBuilder()
                                     .Named("My New Template")
                                     .WithComponent(ComponentRegistry.HTML_Component()) // default SM components
                                     .WithComponent(mycomponent  )
                                     .WithComponents( mycomponents)
                                     .Build();
  • To get a Template:
Template tmplt = TemplateRegistry.Instance.getNamedTemplate("Youtube Template");
  • To add a template to the registry :
Template tmplt = .../Some created template
TemplateRegistry.Instance.AddTemplate(tmplt);

Drawbacks

What potential issues should we consider ? Why should we not do this ?
Perhaps Template registry needs to add the new currently defined template, or just restrict it to existing templates within the registry. Some way to ensure no corruption to the template registry can occur.

@alexis-
Copy link
Member

alexis- commented Nov 5, 2020

SMA has its own template system, see "Layout" in the source code.

Your FR is still valid though. Excellent write up, by the way.

@alexis- alexis- added enhancement New feature or request sma-api SMA interface API reverse-engineering labels Nov 5, 2020
@alexis- alexis- added this to the SMA 2.2.0 "Pink panther" milestone Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request reverse-engineering sma-api SMA interface API
Development

No branches or pull requests

1 participant