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

ensure import routines include glossary #37

Open
bdolor opened this issue Jul 31, 2018 · 6 comments
Open

ensure import routines include glossary #37

bdolor opened this issue Jul 31, 2018 · 6 comments
Labels

Comments

@bdolor
Copy link

bdolor commented Jul 31, 2018

With the introduction of a new post type we need to ensure the import routines are capable of bringing over the data.

How do we ensure that a shortcode in the content area in the old book that was referencing a glossary term with id='99 is still referencing a glossary term that exists in the new book?

@bdolor bdolor added the BIG - 7 label Jul 31, 2018
@bdolor bdolor self-assigned this Aug 1, 2018
@bdolor
Copy link
Author

bdolor commented Aug 9, 2018

XML will bring in glossary terms if they exist via a641351

Including glossary terms in the cloning operation is being handed off to the PB team.

All other import items will bring glossary items if they are represented as html in a page but will not bring in the glossary terms, since they aren't represented anywhere in an epub, docx, or odt file as they are in xml or via the api. Work on using shortcodes to facilitate import has some momentum...pressbooks@330bee8 will discuss with PB team to understand if including [pb_glossary] shortcode fits in with the use case that class-complex was intended to address.

@josieg - let's look at this ticket as done for now. Please verify that XML imports do bring in glossary terms. Feel free to verify that other export file import the HTML display of glossary terms, but know that if it's HTML, the answer is likely yes, it works.

@bdolor bdolor removed their assignment Aug 9, 2018
@josieg
Copy link

josieg commented Aug 9, 2018

This works. I tested importing via XML, epub, and html files. XML brought in glossary terms. The epub and html brought in the html.

A few questions which might not be solvable:

  1. What if someone tries to import a book with glossary terms via an XML file into their existing book that also has glossary terms? These books have totally different glossary terms, but two of the glossary terms have the same ID.
  • Is there a fair chance of this happening?
  • If so, would that cause a big problem?
  • In my testing, I imported the xml file into the same book that produced that xml file. It created two of all the terms, but didn't change the IDs of the new terms added. Obviously this isn't a likely scenario, but it may demonstrate the behaviour if a book has two different terms with the same ID.
  1. When importing via an XML file, I am give the option of what pages I want to import. The glossary terms all appear as individual "Glossary" items with no label describing what term is which (See screenshot). This makes it impossible to import just one term, it would either be all or nothing. This could be a problem if a person only wants to import a small section of the book. Can we add the glossary term titles to these?
    glossaryimport

  2. Also, what if I don't select any of the glossary terms when importing, just the chapters. The shortcode with the glossary ID within the content is still imported, but now there is no corresponding glossary term. Does this have the potential to cause problems or will it just make the editor view look messy? Here is a book where I did this in: https://pressbooksdev.bccampus.ca/testingimpotwglossary/

@bdolor
Copy link
Author

bdolor commented Aug 9, 2018

Thanks Josie - number 2 is the most relevant. Will look to address that and then provide responses to the others once #2 is complete.

@bdolor
Copy link
Author

bdolor commented Aug 9, 2018

once PR #47 is merged, it will take care of 2. To address 1 re: glossary terms being imported into a book with glossary terms and their being an ID collision. For xml import anyways, an ID collision will never happen. Similar to how chapters are created on import...it creates a new post for every new glossary term. The act of creating a new post creates a new unique ID, therefore the relationship between the old ID and the new ID is broken. Everything except the id of the old glossary term is carried over is another way of putting it.

The above process describes the challenge of number 3. Similar to how images have to be 'scraped and kneaded' during the import process, a similarly aggressive routine might be considered for glossary term reference found as [pb_glossary id='32']apple[/pb_glossary] in the content area. For some added complexity there's no guarantee at the point of the import process that the combination of glossary term and corresponding chapter (or vice versa) will be selected. Nevertheless, looking for shortcodes in content and transforming them to meaningful html is the point of the the new class-complex.php but AFAIK hasn't been implemented yet. It would seem that adding [pb_glossary] to class-complex.php would be reasonable, but I have to confirm with them. Plus, they might want to do it. At any rate, it would only work when importing from xml or or the api when glossary ID's refer to something real. In xhtml or any flavour of html (besides web), a reference to a glossary id is meaningless/doesn't go anywhere. Hope that helps.

@bdolor
Copy link
Author

bdolor commented Aug 9, 2018

@josieg - can be (re)validated

@josieg
Copy link

josieg commented Aug 10, 2018

Looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants