diff --git a/.gitignore b/.gitignore
index 7e09b58..2299c8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ __pycache__
MANIFEST
dist
build
+tmp.html
\ No newline at end of file
diff --git a/README.md b/README.md
index a6fcc63..4be0ccc 100644
--- a/README.md
+++ b/README.md
@@ -66,3 +66,4 @@ In this chapter I add at least a link for each of the knowledge needed for devel
* coverage
* gitlab ci/cd
* three.js
+* [pymustache](https://github.com/lotabout/pymustache): for using html template, but in the end I use replace with similar sintax
diff --git a/obj2html/index.html b/obj2html/index.html
new file mode 100644
index 0000000..eb507dc
--- /dev/null
+++ b/obj2html/index.html
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/obj2html/obj2html.py b/obj2html/obj2html.py
index 5e47c64..366b17f 100644
--- a/obj2html/obj2html.py
+++ b/obj2html/obj2html.py
@@ -1,110 +1,25 @@
+import os
import json
-html1 = """
-
-
-
-
-
+TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'index.html')
-
-
-
-
-
-
-
-"""
def obj2html(obj_path, output_html_path=None):
- with open(obj_path, "r") as f:
- content = f.readlines()
- content = '\n'.join(content)
- js_cont = {'obj': content}
- js_string = json.dumps(js_cont)
- html_string = html1+js_string+html2
- if output_html_path != None:
- with open(output_html_path, "w") as f:
- f.write(html_string)
- else:
- return html_string
+ with open(obj_path, "r") as f:
+ content = f.readlines()
+ content = '\n'.join(content)
+ js_cont = {'obj': content}
+ js_string = json.dumps(js_cont)
+
+ with open(TEMPLATE_PATH, "r") as f:
+ html_template = f.read()
+ html_string = html_template.replace("{{obj_3d}}", js_string)
+
+ if output_html_path != None:
+ with open(output_html_path, "w") as f:
+ f.write(html_string)
+ else:
+ return html_string
+
+if __name__ == '__main__':
+ obj2html('test/assets/model.obj', 'tmp.html')
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 9e31819..9fcbcb0 100644
--- a/setup.py
+++ b/setup.py
@@ -45,4 +45,7 @@ setup(
author_email = 'nicolaxx94@live.it',
url = 'https://gitlab.com/nicolalandro/obj2html',
keywords = ['3D', '.obj', '.html', 'jupyter', '3D viewer'],
+ project_urls={
+ 'Source': 'https://gitlab.com/nicolalandro/obj2html',
+ },
)
\ No newline at end of file