JATS Parser v2.0: JATS XML to HTML and PDF conversion

The current master branch of JATS Parser uses rather PHP DOM → HTML → CSS → TCPDF, without Smarty: https://github.com/Vitaliy-1/JATSParser/tree/master/src/JATSParser/HTML. But I’m considering to return to Smarty approach as it allows easier customization. The drawback here would be the size of templates, basically, it requires much more lines of code than in pure PHP.

I’ll explore those libraries and how they deal with scientific articles.

1 Like

Sounds great to me. Thanks a lot for keeping us updated.

Take care,
m.

Thanks, Vitaliy, finally I was able to make a very small change and style our pdf needed functionality.

We’ll keep waiting to enjoy your new version of Old Gregg!

Best regards

Hi @Vitaliy.

Do you have any update about the fix for not working links to figures and tables?

I had a look on your GitHub project (https://github.com/Vitaliy-1/JATSParser/commits/master) where I didn’t see anything about this fix.

I also noticed that figure’s lables (Fig. 1.) are not shown anymore in the HTML version created by the plugin. It used to work in the previous version of JatsParser that I’m still using for a journal’s web site. Any idea about why it stopped working?

Thanks in advance for your feedback and for all your work.

@Vitaliy

I replay to myself here for 2 updates:

  1. I have to correct myself about the “lables not shown” for figure: it was a mistake, the labels are correctly shown and I was not able to see them due to a css problem

  2. I’ve fixed the “not working links to figures and tables” issues by editig these 2 files:
    A) /src/JATSParser/HTML/Figures.php
    added the following 2 lines below “public function setContent(JATSFigure $jatsFigure) {”
    (line 16)

  // Set "id" attribute for <figure> tag. Needed for links from referenceces to the figure 
  $this->setAttribute("id", $jatsFigure->getId());

B) /src/JATSParser/HTML/Tables.php
added the following 2 lines below “public function setContent(JATSTable $jatsTable) {”
(line 17)

  // Set "id" attribute for <table-wrap> tag. Needed for links from referenceces to the table
  $this->setAttribute("id", $jatsTable->getId());

I’ll ask to my colleagues (best skilled developers than me) for applying a pull request on GitHub for both the fixing

Hi @razzi,

It looks that you are on the right path. If it’s suitable for you, feel free to make a PR on this matter to the master branch. Also, I’m planning to continue the work on a new release next month.

1 Like

Hi @Vitaliy.
My colleague Marcela Greca did the Pull Request a few days ago:
https://github.com/Vitaliy-1/JATSParser/pull/11

Greetings

Thanks @razzi,

It looks good. I’ve left there a comment regarding conflict on line endings. Let me know if it’s possible to correct. If not, I’ll do this in a separate commit.

Hi all, We’re using the jatsParser plugins with good results, but We’re having an issue with a particular tag

In our original XML, contains the ‘disp-quote’ tag that doesn’t work, We replace all tags with ‘blockquote’ but still not working. What’s the correct syntax?.

@Vitaliy

Thank you in advance.

Hi @madileweb,

I have plans to add support for disp-quote. Can you open an issue here: Issues · Vitaliy-1/JATSParser · GitHub and also to add use-cases. I’m planning to allow this element inside sec or body tag and to support paragraphs, section, formatted text, references, tables and figures to be nested inside this element.

Thank you @Vitaliy for your answer!

Sorry for going back to this issue, but I am also interested in having a full-text HTML on the article landing page. Is it something you consider doing? How demanding would you say is the adjustment of the code if our journal try to implement this feature and where to start in this case?

Hi @varachkina,

It should be in the current master branch as far as I remember. What needs to be done is design/styling and testing. Right now it would look like simple HTML without any styles applied except the default one from a theme, thus, the scope of needed work includes only front-end. There are 2 ways to show full-text on article landing page - from a plugin setting and individually for each JATS XML galley.

Master branch should be quite stable. Are you handy with Git? You’ll need to clone the repository with a JATSParser submodule.

Before diving deep into the code, do I understand the steps correctly? First choose how to implement the feature: from a plugin setting or for each JATS XML Galley and then design and style accordingly? What are the pros and cons of each implementation strategy? Is building a theme plugin necessary?

  1. git clone --recurse-submodules https://github.com/Vitaliy-1/JATSParserPlugin jatsParser → clone the plugin with submodules into jatsParser folder
  2. cd jatsParser/JATSParser → cd to parser’s folder
  3. git checkout master → checkout master branch with the latest changes.

In plugin settings, there is a menu:

JATSParser plugin settings menu

  • Force to display references from JATS XML
  • Force to display parsed references from OJS
  • Default

? Convert JATS XML to PDF
Allow plugin to display converted JATS XML galleys on article landing page. By default the first XML galley fetched will be displayed. This can be changed individually via JATS Parser galley settings under each uploaded galley.

? Display JATS XML on the article landing page

The last checkbox is what you want. It will inject converted JATS on the article landing page through Templates::Article::Main hook. This is already done, no need to write anything. There is also additional option under every JATS XML galley file:

These settings are applied to XML galleys on individual basis.

“This option allows to choose JATS XML galley that will be displayed on article landing page. Note that for this option to work, “Display galleys on article landing page” should be enabled via plugin’s settings. By default the plugin will pick up the first uploaded XML galley.”

? Display as a default

The galley will be shown as a default if there are several XML galleys uploaded, and it’s locale specific.

What is left is testing and styling. General styles that are planned to be applied to all the themes should be coded in the plugin. Theme-specific styling - in every theme.

Also, I didn’t test the plugin much, particularly in all possible use-cases, thus it may require corrections.

Thank you for your extensive answer. It was very helpful

Hi everyone. Does this plugin work on OJS 3.2.0.1?

1 Like

I tried the latest version for 3.2.1, but it doesnt work yet.

Hi @varshilmehta and @Amin_Salehi-Abargoue,

Isn’t this version Release 2.1.0.0 · Vitaliy-1/JATSParserPlugin · GitHub released in April compatible with OJS 3.2?

I tried the pre-release one (2.1.9). That didnt work. Will try this one too now. I am using OJS 3.2.1.1