Coder Social home page Coder Social logo

Comments (4)

Roznoshchik avatar Roznoshchik commented on July 18, 2024

from lurnby.

brodokk avatar brodokk commented on July 18, 2024

Yeah its actually all data that need to be imported back to a local Lumby. I mean it make more sense that way.

from lurnby.

Roznoshchik avatar Roznoshchik commented on July 18, 2024

There is one difficult part of this which is that it's not guaranteed that the highlight will be able to keep the reference to it's counterpart in the actual article text.

When you highlight in an article, the actual html content gets updated with a span that shows the highlight. The span is given an id which matches the newly created highlight_id. That's how we know which highlight to open within the actual article.

That's also how we can navigate back to that part of the text when you're viewing a highlight elsewhere and click the go to highlight button. It opens up the article page and navigates to #HIGHLIGHT<highlight_id>

This causes issues when thinking through the import, because it's not guaranteed that you will be importing into a completely blank database. The lurnby database that you might be trying to import the files into, is likely another active installation which means that the highlight_id may not be unique.

If it's not unique, we will need to generate a new highlight_id to proceed with the import. In which case, the link between the highlight and the text will be broken.

from lurnby.

Roznoshchik avatar Roznoshchik commented on July 18, 2024

Perhaps the issue above isn't so complicated though.

We have

  1. Article text
  2. Original highlight_id
  3. New unique highlight_id

If when importing we determine that a highlight can't be created with the original_id, we create a new highlight id. Then we do a search and replace in the article.text for #Highlight<original_id> replacing it with #Highlight<new_id>

Then the reference stays and we have no issue.

from lurnby.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.