diff --git a/convert.py b/convert.py
index 2034fa2c..82ad4c38 100644
--- a/convert.py
+++ b/convert.py
@@ -1,6 +1,9 @@
#!/usr/bin/env python3
from pathlib import Path
+import markdown
+# https://github.com/FND/markdown-checklist
+from markdown_checklist.extension import ChecklistExtension
OUTPUT_DIR = 'html'
@@ -18,6 +21,40 @@ CHAPTERS = (
'troubleshooting',
'faq')
+MD_EXTENSIONS = ['toc', 'meta', 'extra', 'footnotes', 'admonition', 'tables',
+ 'attr_list', ChecklistExtension()]
+
+TITLE = 'iRedMail Documentations'
+LINK_INDEX = ' // Document Index'
+TEMPLATE = """
+
+
+
+ {title}
+
+
+
+
+
+
+ {body}
+
+
+
+
+
+"""
+
def _get_dir_languages(path):
FILE_NAME = '_lang.md'
@@ -35,6 +72,17 @@ def _get_dir_languages(path):
return languages
+def _get_content_dir(path):
+ files = sorted([p for p in Path(path).iterdir() if not '_summary' in str(p)])
+ title = files.pop(-1)
+ return files, title
+
+
+def _get_target_name(path):
+ path_html = path.stem.split('-')[1].replace('.', '_') + '.html'
+ return path_html
+
+
def main():
current_dir = Path(__file__).parent
output_dir = current_dir / OUTPUT_DIR
@@ -42,6 +90,41 @@ def main():
languages = _get_dir_languages(current_dir)
en = languages.pop('en_us')
+ index_md = []
+
+ for chapter in CHAPTERS:
+ path_chapter = en['path'] / chapter
+ files, file_title = _get_content_dir(path_chapter)
+ title_chapter = file_title.open(encoding='utf-8').readline()
+ index_md.append(f'### {title_chapter}')
+ index_md.append('')
+ for f in files:
+ name_html = _get_target_name(f)
+ path_html = OUTPUT_DIR + '/' + name_html
+ title = f.open(encoding='utf-8').readline()
+ index_md.append(f'- [{title[2:]}]({name_html})')
+ source = f.read_text(encoding='utf-8')
+ body = markdown.markdown(source, extensions=MD_EXTENSIONS)
+ data = dict(
+ title = title,
+ link_index = LINK_INDEX,
+ body = body
+ )
+ html = TEMPLATE.format(**data)
+ Path(path_html).write_text(html, encoding='utf-8')
+ index_md.append('')
+ break
+
+ path_html = OUTPUT_DIR + '/index.html'
+ body = markdown.markdown('\n'.join(index_md), extensions=MD_EXTENSIONS)
+ data = dict(
+ title = TITLE,
+ link_index = '',
+ body = body
+ )
+ html = TEMPLATE.format(**data)
+ Path(path_html).write_text(html, encoding='utf-8')
+
return
diff --git a/en_US/overview/0-why.build.your.own.mail.server.md b/en_US/overview/1-why.build.your.own.mail.server.md
similarity index 100%
rename from en_US/overview/0-why.build.your.own.mail.server.md
rename to en_US/overview/1-why.build.your.own.mail.server.md
diff --git a/en_US/overview/0-used.components.md b/en_US/overview/2-used.components.md
similarity index 100%
rename from en_US/overview/0-used.components.md
rename to en_US/overview/2-used.components.md
diff --git a/en_US/overview/0-network.ports.md b/en_US/overview/3-network.ports.md
similarity index 100%
rename from en_US/overview/0-network.ports.md
rename to en_US/overview/3-network.ports.md
diff --git a/html/index.html b/html/index.html
index 70d6c5d0..8644e484 100644
--- a/html/index.html
+++ b/html/index.html
@@ -1,11 +1,11 @@
-
-
- iRedMail Documentations
-
-
-
+
+
+ iRedMail Documentations
+
+
+
-Overview
+
+
+
+ Overview
-Install iRedMail
-
-Configure mail client applications
-
-
Quick MUA Settings
-
-- Login username of SMTP/POP3/IMAP services must be full email address.
-- POP3 service: port 110 over STARTTLS (recommended), or port 995 with SSL.
-- IMAP service: port 143 over STARTTLS (recommended), or port 993 with SSL.
-- SMTP service: port 587 over STARTTLS. If you need to support old mail clients with SMTP over SSL (port 465), please check our tutorial: Enable SMTPS service (SMTP over SSL, port 465).
-- CalDAV and CardDAV server addresses:
https://<server>/SOGo/dav/<full email address>
-
-
-
-Release notes and upgrade tutorials
-
-iRedMail Easy - Web-based Deployment, Upgrade and Tech Support Platform
-
-Migrations
-
-How to
-
-Documents contributed by iRedMail users:
-
-Third-party integrations
-Below tutorials are maintained by iRedMail project.
-
-Documents contributed by iRedMail users:
-
-Cluster
-Documents contributed by iRedMail users:
-
-iRedAdmin-Pro
-
-Troubleshooting and Debug
-
-Frequently Asked Questions
-
\ No newline at end of file
+
+
+
+
+