summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-05 13:45:55 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-05 13:45:55 +0000
commit1dbc1acf6659714374820d59d084fd5be7dd850c (patch)
tree913a3251a431a16498913463315e5722746eb0c0
parent1f440977335cd35370c88c98775a305098e69ddd (diff)
automatic import of python-htmldocxopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-htmldocx.spec275
-rw-r--r--sources1
3 files changed, 277 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..2eb7356 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/htmldocx-0.0.6.tar.gz
diff --git a/python-htmldocx.spec b/python-htmldocx.spec
new file mode 100644
index 0000000..a8d0a03
--- /dev/null
+++ b/python-htmldocx.spec
@@ -0,0 +1,275 @@
+%global _empty_manifest_terminate_build 0
+Name: python-htmldocx
+Version: 0.0.6
+Release: 1
+Summary: Convert html to docx
+License: MIT License
+URL: https://github.com/pqzx/html2docx
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/8b/61/91a6b70ee576a4b07310d81efd4c688fe2e6f63ea42ec95b8f1d436b887e/htmldocx-0.0.6.tar.gz
+BuildArch: noarch
+
+Requires: python3-docx
+Requires: python3-beautifulsoup4
+
+%description
+# htmldocx
+Convert html to docx
+
+Dependencies: `python-docx` & `bs4`
+
+### To install
+
+`pip install htmldocx`
+
+### Usage
+
+Add strings of html to an existing docx.Document object
+
+```
+from docx import Document
+from htmldocx import HtmlToDocx
+
+document = Document()
+new_parser = HtmlToDocx()
+# do stuff to document
+
+html = '<h1>Hello world</h1>'
+new_parser.add_html_to_document(html, document)
+
+# do more stuff to document
+document.save('your_file_name')
+```
+
+Convert files directly
+
+```
+from htmldocx import HtmlToDocx
+
+new_parser = HtmlToDocx()
+new_parser.parse_html_file(input_html_file_path, output_docx_file_path)
+```
+
+Convert files from a string
+
+```
+from htmldocx import HtmlToDocx
+
+new_parser = HtmlToDocx()
+docx = new_parser.parse_html_string(input_html_file_string)
+```
+
+Change table styles
+
+Tables are not styled by default. Use the `table_style` attribute on the parser to set a table
+style. The style is used for all tables.
+
+```
+from htmldocx import HtmlToDocx
+
+new_parser = HtmlToDocx()
+new_parser.table_style = 'Light Shading Accent 4'
+```
+
+To add borders to tables, use the `TableGrid` style:
+
+```
+new_parser.table_style = 'TableGrid'
+```
+
+Default table styles can be found here: https://python-docx.readthedocs.io/en/latest/user/styles-understanding.html#table-styles-in-default-template
+
+
+
+
+%package -n python3-htmldocx
+Summary: Convert html to docx
+Provides: python-htmldocx
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-htmldocx
+# htmldocx
+Convert html to docx
+
+Dependencies: `python-docx` & `bs4`
+
+### To install
+
+`pip install htmldocx`
+
+### Usage
+
+Add strings of html to an existing docx.Document object
+
+```
+from docx import Document
+from htmldocx import HtmlToDocx
+
+document = Document()
+new_parser = HtmlToDocx()
+# do stuff to document
+
+html = '<h1>Hello world</h1>'
+new_parser.add_html_to_document(html, document)
+
+# do more stuff to document
+document.save('your_file_name')
+```
+
+Convert files directly
+
+```
+from htmldocx import HtmlToDocx
+
+new_parser = HtmlToDocx()
+new_parser.parse_html_file(input_html_file_path, output_docx_file_path)
+```
+
+Convert files from a string
+
+```
+from htmldocx import HtmlToDocx
+
+new_parser = HtmlToDocx()
+docx = new_parser.parse_html_string(input_html_file_string)
+```
+
+Change table styles
+
+Tables are not styled by default. Use the `table_style` attribute on the parser to set a table
+style. The style is used for all tables.
+
+```
+from htmldocx import HtmlToDocx
+
+new_parser = HtmlToDocx()
+new_parser.table_style = 'Light Shading Accent 4'
+```
+
+To add borders to tables, use the `TableGrid` style:
+
+```
+new_parser.table_style = 'TableGrid'
+```
+
+Default table styles can be found here: https://python-docx.readthedocs.io/en/latest/user/styles-understanding.html#table-styles-in-default-template
+
+
+
+
+%package help
+Summary: Development documents and examples for htmldocx
+Provides: python3-htmldocx-doc
+%description help
+# htmldocx
+Convert html to docx
+
+Dependencies: `python-docx` & `bs4`
+
+### To install
+
+`pip install htmldocx`
+
+### Usage
+
+Add strings of html to an existing docx.Document object
+
+```
+from docx import Document
+from htmldocx import HtmlToDocx
+
+document = Document()
+new_parser = HtmlToDocx()
+# do stuff to document
+
+html = '<h1>Hello world</h1>'
+new_parser.add_html_to_document(html, document)
+
+# do more stuff to document
+document.save('your_file_name')
+```
+
+Convert files directly
+
+```
+from htmldocx import HtmlToDocx
+
+new_parser = HtmlToDocx()
+new_parser.parse_html_file(input_html_file_path, output_docx_file_path)
+```
+
+Convert files from a string
+
+```
+from htmldocx import HtmlToDocx
+
+new_parser = HtmlToDocx()
+docx = new_parser.parse_html_string(input_html_file_string)
+```
+
+Change table styles
+
+Tables are not styled by default. Use the `table_style` attribute on the parser to set a table
+style. The style is used for all tables.
+
+```
+from htmldocx import HtmlToDocx
+
+new_parser = HtmlToDocx()
+new_parser.table_style = 'Light Shading Accent 4'
+```
+
+To add borders to tables, use the `TableGrid` style:
+
+```
+new_parser.table_style = 'TableGrid'
+```
+
+Default table styles can be found here: https://python-docx.readthedocs.io/en/latest/user/styles-understanding.html#table-styles-in-default-template
+
+
+
+
+%prep
+%autosetup -n htmldocx-0.0.6
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-htmldocx -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.6-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..3b487bf
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+b49ef80c7317602501624779e1f04961 htmldocx-0.0.6.tar.gz