|
|
@@ -166,8 +166,8 @@ class HelpDatabase(object): |
|
|
|
docs_app=docs_app, web_folder=web_folder) |
|
|
|
if os.path.exists(docs_folder): |
|
|
|
app_name = getattr(frappe.get_module(app), '__title__', None) or app.title() |
|
|
|
doc_contents += '<li><a data-path="/{docs_app}/index">{app_name}</a></li>'.format( |
|
|
|
docs_app=docs_app, app_name=app_name) |
|
|
|
doc_contents += '<li><a data-path="/{app}/index">{app_name}</a></li>'.format( |
|
|
|
app=app, app_name=app_name) |
|
|
|
|
|
|
|
for basepath, folders, files in os.walk(docs_folder): |
|
|
|
files = self.reorder_files(files) |
|
|
@@ -177,14 +177,14 @@ class HelpDatabase(object): |
|
|
|
with io.open(fpath, 'r', encoding = 'utf-8') as f: |
|
|
|
try: |
|
|
|
content = frappe.render_template(f.read(), |
|
|
|
{'docs_base_url': '/assets/{app}_docs'.format(app=app)}) |
|
|
|
{'docs_base_url': '/assets/{docs_app}_docs'.format(docs_app=docs_app)}) |
|
|
|
|
|
|
|
relpath = self.get_out_path(fpath) |
|
|
|
relpath = relpath.replace("user", app) |
|
|
|
content = frappe.utils.md_to_html(content) |
|
|
|
title = self.make_title(basepath, fname, content) |
|
|
|
intro = self.make_intro(content) |
|
|
|
content = self.make_content(content, fpath, relpath, app) |
|
|
|
content = self.make_content(content, fpath, relpath, app, docs_app) |
|
|
|
self.db.sql('''insert into help(path, content, title, intro, full_path) |
|
|
|
values (%s, %s, %s, %s, %s)''', (relpath, content, title, intro, fpath)) |
|
|
|
except jinja2.exceptions.TemplateSyntaxError: |
|
|
@@ -212,7 +212,7 @@ class HelpDatabase(object): |
|
|
|
intro = "Help Video: " + intro |
|
|
|
return intro |
|
|
|
|
|
|
|
def make_content(self, html, path, relpath, app_name): |
|
|
|
def make_content(self, html, path, relpath, app_name, doc_app): |
|
|
|
if '<h1>' in html: |
|
|
|
html = html.split('</h1>', 1)[1] |
|
|
|
|
|
|
@@ -222,7 +222,7 @@ class HelpDatabase(object): |
|
|
|
soup = BeautifulSoup(html, 'html.parser') |
|
|
|
|
|
|
|
self.fix_links(soup, app_name) |
|
|
|
self.fix_images(soup, app_name) |
|
|
|
self.fix_images(soup, doc_app) |
|
|
|
|
|
|
|
parent = self.get_parent(relpath) |
|
|
|
if parent: |
|
|
|