-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: heading, images, tables fixed for the boxnotes
- Loading branch information
1 parent
b2cdbcc
commit bb0b4c8
Showing
22 changed files
with
1,819 additions
and
1,656 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,3 +161,6 @@ cython_debug/ | |
|
||
path/* | ||
*.docx | ||
.pypirc | ||
/output | ||
*.boxnote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,72 @@ | ||
# BoxNote to docx Converter | ||
# BoxToDocx | ||
|
||
A Python command-line tool to convert Box Notes to Microsoft Word (docx) documents with preservation of formatting, tables, and images. | ||
A Python command-line tool to convert Box Notes to HTML and Microsoft Word (docx) documents while preserving formatting, tables, and images. | ||
|
||
## Features | ||
|
||
- Convert single BoxNote files to docx | ||
- Batch convert entire directories of BoxNote files | ||
- Preserve formatting, tables, and images | ||
- Support for Box API authentication | ||
- Simple command-line interface | ||
- Convert Box documents to HTML and DOCX formats | ||
- Support for images, tables, and formatted text | ||
- Batch processing of multiple documents | ||
- Optional image downloading with Box authentication or API token | ||
- Choice to generate HTML and images in separate folder | ||
- Comprehensive logging | ||
|
||
## Installation | ||
|
||
```bash | ||
|
||
pip3 install . | ||
pip3 install boxtodocx | ||
``` | ||
|
||
## Usage | ||
|
||
### Basic Usage | ||
|
||
Convert a single file: | ||
### Basic Conversion | ||
```bash | ||
boxtodocx example.boxnote | ||
boxtodocx input.boxnote -d output_directory | ||
``` | ||
|
||
Convert all files in a directory: | ||
### With Image Export (Using Credentials) | ||
```bash | ||
boxtodocx /path/to/directory | ||
boxtodocx input.boxnote -d output_directory --export-images \ | ||
--box-id [email protected] \ | ||
--box-pwd yourpassword \ | ||
--link login-link-id \ | ||
--id user-field-id \ | ||
--pwd password-field-id | ||
``` | ||
|
||
### Advanced Options | ||
|
||
### With Image Export (Using API Token) | ||
```bash | ||
boxtodocx --help | ||
|
||
Options: | ||
-d, --dir TEXT Work directory for temporary files | ||
-t, --token TEXT Box access token | ||
-o, --output TEXT Output file name (only for single file conversion) | ||
-u, --user TEXT Box user id | ||
-v, --verbose Enable verbose logging | ||
--help Show this message and exit | ||
boxtodocx input.boxnote -d output_directory --export-images --api-token YOUR_API_TOKEN | ||
``` | ||
|
||
## Authentication | ||
|
||
To use Box API features (like image downloading), you need to provide a Box access token: | ||
### Process Directory | ||
```bash | ||
boxtodocx directory_path --directory -d output_directory | ||
``` | ||
|
||
### Generate HTML and Images | ||
```bash | ||
boxtodocx input.boxnote -t "your_box_token" -u "your_user_id" | ||
boxtodocx input.boxnote -d output_directory --generate-html | ||
``` | ||
|
||
### Available Options | ||
``` | ||
Options: | ||
--generate-html Generate HTML and save images in separate folder | ||
--api-token TEXT Box API token for direct download | ||
--directory Process all Box documents in a directory | ||
--mfa-otp TEXT MFA code (one-time password) | ||
--mfa-btn-id TEXT ID of button to submit MFA code | ||
--mfa-otp-id TEXT ID of input field for MFA code | ||
--mfa-link TEXT Div ID to click for MFA | ||
--pwd TEXT Password field for Box login | ||
--id TEXT User ID field for Box login | ||
--link TEXT Div ID for additional login step | ||
--box-pwd TEXT Box login password | ||
--box-id TEXT Box login email | ||
--export-images Export images from Box documents | ||
-d, --dest-dir PATH Destination directory for output files | ||
--help Show this message and exit | ||
``` | ||
|
||
## Development | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[build-system] | ||
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.black] | ||
line-length = 88 | ||
include = '\.pyi?$' | ||
extend-exclude = ''' | ||
# Add files to exclude from formatting | ||
''' | ||
|
||
[tool.isort] | ||
profile = "black" | ||
multi_line_output = 3 | ||
|
||
[tool.mypy] | ||
python_version = "3.8" | ||
warn_return_any = true | ||
warn_unused_configs = true | ||
disallow_untyped_defs = true | ||
check_untyped_defs = true | ||
|
||
[tool.pytest.ini_options] | ||
minversion = "6.0" | ||
addopts = "-ra -q" | ||
testpaths = [ | ||
"tests", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
-r requirements.txt | ||
pytest>=7.0.0 | ||
black>=22.3.0 | ||
isort>=5.10.1 | ||
mypy>=0.981 | ||
pytest>=7.1.3 | ||
pytest-cov>=3.0.0 | ||
black>=22.0.0 | ||
isort>=5.10.0 | ||
flake8>=4.0.0 | ||
mypy>=0.950 | ||
tox>=3.24.0 | ||
build>=0.7.0 | ||
twine>=3.8.0 | ||
flake8>=4.0.1 | ||
tox>=3.24.5 | ||
pre-commit>=2.20.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
beautifulsoup4>=4.9.3 | ||
beautifulsoup4>=4.9.3,<5.0.0 | ||
python-docx>=0.8.11 | ||
requests>=2.25.1 | ||
click>=8.0.0 | ||
typing-extensions>=4.0.0 | ||
colorlog>=6.7.0 | ||
Pillow>=10.0.0 | ||
yattag>=1.16.0 | ||
selenium>=4.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,24 @@ | ||
"""Package configuration for boxtodocx.""" | ||
from setuptools import setup, find_packages | ||
|
||
with open("README.md", "r", encoding="utf-8") as fh: | ||
long_description = fh.read() | ||
|
||
with open("requirements.txt", "r", encoding="utf-8") as fh: | ||
requirements = [line.strip() for line in fh if line.strip() and not line.startswith("#")] | ||
|
||
setup( | ||
name="boxtodocx", | ||
version="1.0.0", | ||
version="0.1.0", | ||
author="Ujjwal Kumar", | ||
author_email="[email protected]", | ||
description="Convert Box Notes to Microsoft Word (docx) documents", | ||
description="Convert Box documents to HTML and DOCX formats", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/ujjwal-ibm/boxtodocx", | ||
url="https://github.ibm.com/Ujjwal-Kumar1/boxtodocx", | ||
project_urls={ | ||
"Bug Tracker": "https://github.com/ujjwal-ibm/boxtodocx/issues", | ||
"Documentation": "https://github.com/ujjwal-ibm/boxtodocx", | ||
"Bug Tracker": "https://github.ibm.com/Ujjwal-Kumar1/boxtodocx/issues", | ||
}, | ||
classifiers=[ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: End Users", | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
|
@@ -30,16 +27,25 @@ | |
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Topic :: Office/Business", | ||
"Topic :: Text Processing", | ||
"Topic :: Text Processing :: Markup :: HTML", | ||
], | ||
package_dir={"": "src"}, | ||
packages=find_packages(where="src"), | ||
python_requires=">=3.8", | ||
install_requires=requirements, | ||
install_requires=[ | ||
"beautifulsoup4>=4.9.3", | ||
"python-docx>=0.8.11", | ||
"requests>=2.25.1", | ||
"click>=8.0.0", | ||
"typing-extensions>=4.0.0", | ||
"colorlog>=6.7.0", | ||
"Pillow>=10.0.0", | ||
"yattag>=1.16.0", | ||
"selenium>=4.0.0", | ||
], | ||
entry_points={ | ||
"console_scripts": [ | ||
"boxtodocx=boxtodocx.cli:main", | ||
], | ||
}, | ||
include_package_data=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
"""BoxNote to docx converter package.""" | ||
|
||
__version__ = "1.0.0" | ||
__version__ = "2.0.0" | ||
__author__ = "Ujjwal Kumar" | ||
__email__ = "[email protected]" | ||
__email__ = "[email protected]" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.