[docs] now common website for all documentation - erpnext.org
This commit is contained in:
parent
5f9a9aace4
commit
4f0519ef2d
6 changed files with 40 additions and 21 deletions
|
|
@ -2,8 +2,8 @@
|
|||
{
|
||||
"_label": "Framework API",
|
||||
"_toc": [
|
||||
"docs.framework.server",
|
||||
"docs.framework.client"
|
||||
"docs.dev.framework.server",
|
||||
"docs.dev.framework.client"
|
||||
]
|
||||
}
|
||||
---
|
||||
|
|
@ -58,8 +58,8 @@ wn.docs.generate_all = function(logarea) {
|
|||
parent: body,
|
||||
});
|
||||
page.write(function() {
|
||||
//logarea.append("Writing " + name + "...<br>");
|
||||
logarea.append(".");
|
||||
logarea.append("Writing " + name + "...<br>");
|
||||
//logarea.append(".");
|
||||
// recurse
|
||||
if(page.obj._toc) {
|
||||
$.each(page.obj._toc, function(i, name) {
|
||||
|
|
@ -76,8 +76,8 @@ wn.docs.generate_all = function(logarea) {
|
|||
|
||||
// append
|
||||
docs.modules = r.message.modules;
|
||||
wn.provide("docs.framework.server").webnotes = r.message.webnotes;
|
||||
wn.provide("docs.framework.client").wn = wn;
|
||||
wn.provide("docs.dev.framework.server").webnotes = r.message.webnotes;
|
||||
wn.provide("docs.dev.framework.client").wn = wn;
|
||||
|
||||
// append static pages to the "docs" object
|
||||
$.each(r.message.pages, function(n, content) {
|
||||
|
|
@ -104,17 +104,17 @@ wn.docs.get_full_name = function(name) {
|
|||
*/
|
||||
var link_name = name;
|
||||
if(name.substr(0,2)==="wn") {
|
||||
link_name = "docs.framework.client." + name;
|
||||
link_name = "docs.dev.framework.client." + name;
|
||||
}
|
||||
if(name.substr(0,8)==="webnotes") {
|
||||
link_name = "docs.framework.server." + name;
|
||||
link_name = "docs.dev.framework.server." + name;
|
||||
}
|
||||
return link_name;
|
||||
}
|
||||
|
||||
wn.docs.get_short_name = function(namespace) {
|
||||
namespace = namespace.replace("docs.framework.server.", "")
|
||||
namespace = namespace.replace("docs.framework.client.", "")
|
||||
namespace = namespace.replace("docs.dev.framework.server.", "")
|
||||
namespace = namespace.replace("docs.dev.framework.client.", "")
|
||||
return namespace;
|
||||
}
|
||||
|
||||
|
|
@ -132,8 +132,10 @@ wn.docs.DocsPage = Class.extend({
|
|||
this.make(obj);
|
||||
},
|
||||
make: function(obj) {
|
||||
$("<h2>").html(obj._label || wn.docs.get_short_name(this.namespace))
|
||||
.appendTo(this.parent);
|
||||
if(!obj._no_title) {
|
||||
$("<h1>").html(obj._label || wn.docs.get_short_name(this.namespace))
|
||||
.appendTo(this.parent);
|
||||
}
|
||||
this.make_breadcrumbs(obj);
|
||||
this.make_intro(obj);
|
||||
this.make_toc(obj);
|
||||
|
|
@ -165,7 +167,7 @@ wn.docs.DocsPage = Class.extend({
|
|||
});
|
||||
|
||||
$(repl('<li class="active">%(label)s</li>', {
|
||||
label: obj._label || this.namespace
|
||||
label: obj._label || wn.docs.get_short_name(this.namespace)
|
||||
})).appendTo(ul)
|
||||
},
|
||||
make_intro: function(obj) {
|
||||
|
|
|
|||
|
|
@ -16,11 +16,14 @@ def get_docs():
|
|||
def get_pages():
|
||||
mydocs = {}
|
||||
for repo in ("lib", "app"):
|
||||
for fname in os.listdir(os.path.join("..", repo, "docs")):
|
||||
if fname.endswith(".md"):
|
||||
fpath = os.path.join("..", repo, "docs", fname)
|
||||
with open(fpath, "r") as docfile:
|
||||
mydocs[fname[:-3]] = docfile.read()
|
||||
for path, folders, files in os.walk(os.path.join("..", repo)):
|
||||
if os.path.basename(path)=="docs":
|
||||
# docs folder
|
||||
for fname in files:
|
||||
if fname.endswith(".md"):
|
||||
fpath = os.path.join("..", repo, "docs", fname)
|
||||
with open(fpath, "r") as docfile:
|
||||
mydocs[fname[:-3]] = docfile.read()
|
||||
|
||||
return mydocs
|
||||
|
||||
|
|
@ -43,7 +46,6 @@ def get_docs_for(docs, name):
|
|||
mydocs["_intro"] = getattr(obj, "__doc__", "")
|
||||
mydocs["_toc"] = getattr(obj, "_toc", "")
|
||||
mydocs["_type"] = inspect.isclass(obj) and "class" or "module"
|
||||
mydocs["_is_server_api"] = 1
|
||||
|
||||
for name in dir(obj):
|
||||
value = getattr(obj, name)
|
||||
|
|
@ -155,10 +157,25 @@ docs_template = """
|
|||
<script type="text/javascript" src="js/bootstrap.min.js"></script>-->
|
||||
<link type="text/css" rel="stylesheet" href="css/bootstrap.css">
|
||||
<link type="text/css" rel="stylesheet" href="css/font-awesome.css">
|
||||
<style>
|
||||
@import url(http://fonts.googleapis.com/css?family=Arvo:400,700);
|
||||
h1 {
|
||||
font-family: Arvo, Serif;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" style="max-width: 767px;">
|
||||
{{ content }}
|
||||
<div class="container" style="max-width: 767px; margin-top: 30px;">
|
||||
<div class="navbar" style="background-color: #EDE6DA; margin-bottom: 30px;">
|
||||
<a class="navbar-brand" href="docs.html">erpnext.org</a>
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="docs.user.html">User</a></li>
|
||||
<li><a href="docs.dev.html">Developer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{{ content }}
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(".dropdown-toggle").dropdown();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue