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

https://github.com/PresKhaled/epubx #20

Open
PresKhaled opened this issue Aug 15, 2023 · 0 comments
Open

https://github.com/PresKhaled/epubx #20

PresKhaled opened this issue Aug 15, 2023 · 0 comments

Comments

@PresKhaled
Copy link

This version has been added some simple features to it, as follows: -

  • Added [EpubLanguageRelatedAttributes] to certain classes (EpubMetadataDescription, EpubMetadataPublisher, EpubMetadataRight) and will be filled during the processing of some meta items to support the xml:lang, and dir attributes.
    [PackageReader].readMetadata > result.MetaItems are now filled in before iterating over the children of [metadataNode].
  • Added support for the specification of ePub 3.0 for the element's creator and contributor.
  • Types of titles were collected instead of one title, to be processed in the application that uses the package.
    • To provide processing: Main, subtitle, short, collection, edition and expanded.
      Example of the process:
final epubx.EpubMetadataTitle primaryTitle = (titles.firstWhereOrNull(
      (epubx.EpubMetadataTitle? titleElement) {
        final epubx.EpubMetadataMeta? associatedMeta = _getMetaAssociatedWithTitle(
          metaItems: epubMetadata.MetaItems,
          titleElement: titleElement,
        );

        if (associatedMeta != null && associatedMeta.Scheme == null) {
          return (associatedMeta.Content == 'main');
        }

        return false;
      },
    ) ??
    titles.first);

final epubx.EpubMetadataTitle? subtitle = titles.firstWhereOrNull(
      (epubx.EpubMetadataTitle? titleElement) {
        final epubx.EpubMetadataMeta? associatedMeta = _getMetaAssociatedWithTitle(
          metaItems: epubMetadata.MetaItems,
          titleElement: titleElement,
        );

        if (associatedMeta != null && associatedMeta.Scheme == null) {
          return (associatedMeta.Content == 'subtitle');
        }

        return false;
      },
    );

static epubx.EpubMetadataMeta? _getMetaAssociatedWithTitle({
    required List<epubx.EpubMetadataMeta>? metaItems,
    required epubx.EpubMetadataTitle? titleElement,
  }) {
    return metaItems?.firstWhereOrNull(
      (meta) => (meta.Refines == '#${titleElement?.Id}' && (meta.Property == 'title-type')),
    );
  }

The data coming from the package can be transferred to classes and stored as it is in a database that accepts this matter.
I do not like to use Pull Requests permanently.

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

No branches or pull requests

1 participant