Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

OpenBookPublishers/obp-image-manipulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

obp-image-manipulation

This script simplifies elements of html files exported from InDesign.

With our present configuration, InDesign outputs images and captions like so:

<div>
    <div id="important-id">
        <img />
    </div>
</div>
<p class="caption"></p>

Where #important-id describes important rules to display the image.

Whereas this works fine, our workflow can benefit from a more streamlined structure to embed tools (i.e. zoomify) more efficiently. This would be:

<figure>
    <img id="important-id" />
    <p class="caption"></p>
</figure>

Installation

Install the system packages. On Debian:

$ apt-get install python3.5-venv python3-pip

You might want to install third-party python libraries and run the script in a virtual environment. Create the environment first:

$ cd your-work-folder
$ pyvenv-3.5 .venv
$ source .venv/bin/activate

Then install the dependencies:

(.venv) $ pip3 -r requirements.txt 

Run the script

Simply:

(.venv) $ python3 main.py input-file.xhtml output-file.xhtml

If needed, get tips by:

(.venv) $ python3 main.py -h

Troubleshooting

Character encoding

The current version of the script outputs utf-8 files. If required a different encoding (i.e. utf-16), please change this in the last part of main.py, when beautifulsoup encodes the soup prior writing the output file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages