Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Support JATS articles #30

Merged
merged 8 commits into from
Jan 29, 2019
Merged

Support JATS articles #30

merged 8 commits into from
Jan 29, 2019

Conversation

thewilkybarkid
Copy link
Contributor

@thewilkybarkid thewilkybarkid commented Jan 11, 2019

Complementary to #29, and based on the possible idea of not requiring content items to be a {http://libero.pub}item.

This changes the scholarly article example to be {http://jats.nlm.nih.gov}article.

@thewilkybarkid thewilkybarkid requested a review from a team as a code owner January 11, 2019 10:59
'content' => [$contentHeader],
]
)
$this->contentHandler->handle($dom->documentElement, $context)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other option is not have separate controllers for each type.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been updated to use a single controller, it seems

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, s/not/to...

const DIRECTION_LTR = 'ltr';
const DIRECTION_RTL = 'rtl';

function text_direction(string $locale) : string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be extracted from this PR. Not entirely sure of the best place for it...

@thewilkybarkid thewilkybarkid changed the title [WIP] Support JATS articles directly [WIP] Support JATS articles Jan 24, 2019
@thewilkybarkid thewilkybarkid changed the title [WIP] Support JATS articles Support JATS articles Jan 24, 2019

</front>
</meta>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the wrapper XML format itself makes sense

use function array_merge;
use function Libero\ContentPageBundle\text_direction;

final class JatsContentHandler implements ContentHandler
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name JatsContentHandler (and perhaps JatsContentBundle) is misleading if, as far as JATS variations go, this can support eLife-like JATS or Libero-constrained JATS rather than the totality of JATS content. This makes a conversion step still necessary from non-Libero-constrained JATS to Libero-constrained JATS, unless this frontend and all the various services make efforts to support various options.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the ingestion validation side of things, I guess a Schema(-tron?) could be written to validate it's Libero-constrained JATS, don't know how difficult it is to do

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, not yet clear what JATS will be supported yet. I suspect it's going to be somewhere between DAR and JATS4R. There might be a certain amount of configuration too, so you could tweak selectors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the concept different from the original eLife 1.0 JATS-to-HTML XSLT, but done with code? For sure, it uses patterns rather than producing HTML directly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not. You probably could use XSLT to do the same (presumably producing JSON which is a valid input for the patterns), but I suspect there's things not possible there (eg having to replace placeholders in code afterwards).

use Symfony\Component\DependencyInjection\Reference;
use function array_keys;

final class ContentHandlerPass implements CompilerPassInterface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these Passes could do with a docblock describing how they map to the YAML schema, but maybe this is already described elsewhere

@@ -47,6 +47,7 @@ private function addPage(string $name, array $config, ContainerBuilder $containe
$definition->setArgument(2, new Reference('twig'));
$definition->setArgument(3, $config['page_template']);
$definition->addTag('controller.service_arguments');
$definition->addTag('libero.content_page.controller', ['handler' => $config['handler']]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handler is overloaded, we'll find a metaphor for the naming I suppose, given publishing wealth of concepts and strange words

@thewilkybarkid thewilkybarkid merged commit a88bdd9 into libero:master Jan 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants