From 83091d4212a518eee9d2f72fca3593a7df10f05d Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 21 Jun 2013 13:26:04 +0530 Subject: [PATCH] [docs] made structure for user docs combining manual and existing help --- .../doctype/documentation_tool/documentation_tool.js | 12 +++++++++--- .../doctype/documentation_tool/documentation_tool.py | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/doctype/documentation_tool/documentation_tool.js b/core/doctype/documentation_tool/documentation_tool.js index 0cc902d538..1846e89754 100644 --- a/core/doctype/documentation_tool/documentation_tool.js +++ b/core/doctype/documentation_tool/documentation_tool.js @@ -78,7 +78,10 @@ wn.docs.generate_all = function(logarea) { child_links.next_sibling = page.obj._toc[i+1]; } } - make_page(wn.docs.get_full_name(child_name), child_links); + var docs_full_name = wn.docs.get_full_name(child_name); + if(!wn.docs.to_write[docs_full_name]) { + make_page(docs_full_name, child_links); + } }); } } @@ -94,10 +97,13 @@ wn.docs.generate_all = function(logarea) { wn.provide("docs.dev").modules = r.message.modules; wn.provide("docs.dev.framework.server").webnotes = r.message.webnotes; wn.provide("docs.dev.framework.client").wn = wn; + if(!docs._links) docs._links = []; // append static pages to the "docs" object $.each(r.message.pages || [], function(n, obj) { $.extend(wn.provide(n), obj); + if(n!=="docs") + docs._links.push(n); // to build page (if not in _toc) }); logarea.append("Preparing html...
"); @@ -229,8 +235,8 @@ wn.docs.DocsPage = Class.extend({ make_footer: function() { if(this.obj._gh_source) { $("
").appendTo(this.parent); - $(repl('

\ - Source on GitHub

', { + $(repl('

\ + Improve this doc

', { source: this.obj._gh_source })).appendTo(this.parent); } diff --git a/core/doctype/documentation_tool/documentation_tool.py b/core/doctype/documentation_tool/documentation_tool.py index 891a1ee703..ac26fdbaa4 100644 --- a/core/doctype/documentation_tool/documentation_tool.py +++ b/core/doctype/documentation_tool/documentation_tool.py @@ -118,7 +118,7 @@ def get_gh_url(path): sep = "/lib/" if "/lib/" in path else "/app/" url = gh_prefix \ + ("wnframework" if sep=="/lib/" else "erpnext") \ - + ("/blob" if "." in path else "/tree") \ + + ("/blob" if ("." in path) else "/tree") \ +"/master/" + path.split(sep)[1] if url.endswith(".pyc"): url = url[:-1]