Skip to content

Add --rights <text> flag for explicit dc:rights in OPF #21

@roelvangils

Description

@roelvangils

Summary

Add a small `--rights ` flag (and possibly `--rights-from-file `) on `dpub convert` that stamps a `dc:rights` element in the EPUB's OPF metadata.

Why

Came up in a discussion with the maintainer about copyright information in DAISY books. DAISY 2.02 NCC files sometimes carry rights information; sometimes not (the reference Belgian title in our memory tests does not have a `dc:rights` field). EPUB 3 readers and aggregators surface `dc:rights` in book metadata, so producers may want to assert it explicitly even when the source doesn't.

This is also useful for the EAA-context narrative: producers redistributing accessibility-exception copies often need to clarify the rights frame they're operating under (Marrakesh Treaty / EU exception). A simple `--rights` flag lets them stamp that text into every conversion in their pipeline without post-processing.

Suggested shape

```
dpub convert -o book.epub \
--rights "© 2008 Geertje De Ceuleneer / PHK. Distributed under accessibility exception."
```

Or, for longer text:

```
dpub convert -o book.epub --rights-from-file rights.txt
```

If `--rights` is not provided, dpub keeps the current behaviour: `dc:rights` from the source DAISY metadata if present, omitted otherwise.

Implementation

  • Add `PackageMetadata.rights: Option` to `crates/epub3-writer/src/model.rs` (Optional — surfaces as `dc:rights` in `writers.rs::write_opf_metadata`).
  • Wire through `ConvertOptions.rights` in `dpub-convert`, sourced from CLI.
  • Default behaviour: copy from `book.metadata().rights` if present in the DAISY source; CLI flag overrides.

Roughly 1 hour of work plus tests.

Out of scope

  • Rights-language detection (English vs Dutch).
  • Standard rights statement libraries (CC, Marrakesh, etc.). Plain text is enough for v1; structured statements are a future enhancement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions