Drasil icon indicating copy to clipboard operation
Drasil copied to clipboard

Extra Spaces Added after references in generated Jupyter Notebook

Open harmanpreet-sagar opened this issue 1 year ago • 10 comments

When adding references in the Organization of Document section for #3318, the Jupyter Notebook generated adds extra spaces between the punctuations and the references.

image

image

Is it ok to have the spaces, or should it be fixed?

The discussion where it was first identified can be found here @smiths @samm82

harmanpreet-sagar avatar May 11 '23 15:05 harmanpreet-sagar

In a previous version of this implementation (without the Oxford comma), I noticed that there was an extra space before the "and" (e.g., item and instead of item and); the issue seems to be with an extra space added after the references instead of being inserted before the punctuation. It doesn't look like the double space shows up when rendering the Jupyter notebook, but it should still be fixed to be correct.

samm82 avatar May 11 '23 16:05 samm82

@harmanpreet-sagar, thank you for creating this issue. Yes, we definitely should look into this and generate the Jupyter notebook without the extra spaces.

smiths avatar Jun 01 '23 17:06 smiths

Question: I cannot find the generated code file's position, can you tell me which of the file is changing the jupyterhub notebook? @samm82

daijingz avatar Jan 01 '24 06:01 daijingz

@samm82 I did not find where the error is. I try to open the generated code and file, however, the space before and is all single space. Also, the given image cannot be opened, can you give these images again?

daijingz avatar Jan 06 '24 20:01 daijingz

Sorry for the delay on this! This issue can be found on the following line:

https://github.com/JacquesCarette/Drasil/blob/d5afe5c61d5fac443a5eac96fef5856bf07454e8/code/stable/projectile/SRS/JSON/Projectile_SRS.ipynb#L174

My guess is that this issue occurs throughout all generated Jupyter notebook files whenever a list of references is encountered (although it may also occur with any list of items; this would be something to look into).

samm82 avatar Jan 11 '24 05:01 samm82

I see some of them have this problem, these are places with this issue: @`D J89I~X{$2TW~{696J73 Three examples have this issue: GlassBR, PD controller, and SSP

daijingz avatar Jan 12 '24 19:01 daijingz

@samm82 For all these three examples, we need to change the Section 4.2 code parts. However, the corresponding section says it is automatically generated: (As you can see on section 4.2.4) W040F9_ER4~A {)V2E}W8 Looks like there is nothing we can change. If there is a section elsewhere (which determine that), where is it?

daijingz avatar Jan 12 '24 20:01 daijingz

You're right that the issue is with the code that determines how this is generated. I'm not sure where that code would be; figuring that out is part of this issue! 😅

samm82 avatar Jan 12 '24 23:01 samm82

My guess is that this is an issue with how lists of references are rendered when generated code and not specific to the Data Definitions section. Don't know where that happens off the top of my head, but hopefully that points you in the right direction!

samm82 avatar Jan 12 '24 23:01 samm82

@samm82 I suspect the contents of function "Comma" has some problems, so there is an extra space added after each references. image

however, remember this problem only occurs at the Jupyterhub notebook. I wonder how we generate the notebook files, where is the code transferable text to Jupyterhub notebook (unique code for on Jupyterhub notebook rendering).

Up to now, the code of printing reference texts is already found, but this text does not have any problems (Otherwise Latex and Html SRS documentations will have the mentioned extra space too)

daijingz avatar Jan 19 '24 21:01 daijingz