{"action":"created","comment":{"url":"https://api.github.com/repos/Statoil/webviz/pulls/comments/218794243","pull_request_review_id":156801212,"id":218794243,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODc5NDI0Mw==","diff_hunk":"@@ -68,64 +60,59 @@ def init_parser():\n     return parser\n \n \n-root_folder = init_parser().parse_args().site_folder\n-\n-env = jinja2.Environment(\n-    loader=jinja2.FileSystemLoader(root_folder),\n-)\n-\n-config = read_config()\n-\n-prevdir = os.getcwd()\n-submenus = {}\n-web = Webviz(config['title'], theme=config['theme'])\n-web.add_page = web.add\n-submenus[root_folder] = web\n-os.chdir(root_folder)\n-for root, dirs, files in os.walk(root_folder, topdown=True):\n-    dirs[:] = [d for d in dirs if d != 'html_output']\n-    for dirname in dirs:\n-        submenus[path.join(root, dirname)] = SubMenu(dirname)\n-    for filename in files:\n-        name, ext = path.splitext(filename)\n-        if ext == '.md':\n-            templ = env.get_template(\n-                path.relpath(path.join(root, filename), root_folder))\n-            collected_elements = []\n-            untemplated_markdown = templ.render(page_element=page_element)\n-            rendered = markdown.markdown(\n-                untemplated_markdown,\n-                extensions=[\n-                    'markdown.extensions.tables',\n-                    'markdown.extensions.codehilite'\n-                ]\n-            )\n-            page = None\n-            if filename == 'index.md':\n-                page = web.index\n-            else:\n-                page = Page(name)\n-\n-            html = Html(rendered)\n-            for element in collected_elements:\n-                for js in element.get_js_dep():\n-                    html.add_js_dep(js)\n-                for css in element.get_css_dep():\n-                    html.add_css_dep(css)\n-            html.add_css_dep(\n-                path.join(\n-                    path.dirname(__file__),\n-                    'resources',\n-                    'css',\n-                    'codehilite.css')\n-            )\n-\n-            page.add_content(html)\n-            if filename != 'index.md':\n-                submenus[root].add_page(page)\n-\n-for submenu in itervalues(submenus):\n-    if isinstance(submenu, SubMenu):\n-        web.add(submenu)\n-\n-web.write_html(path.join(root_folder, 'html_output'), overwrite=True)\n+def main():\n+    top_directory = init_parser().parse_args().site_folder\n+    env = Environment(\n+        loader=FileSystemLoader(top_directory),\n+    )\n+    config = read_config(top_directory=top_directory)\n+    web = Webviz(config['title'], theme=config['theme'])\n+    web.add_page = web.add\n+    submenus = {}\n+    submenus[top_directory] = web\n+    os.chdir(top_directory)\n+    page_elements = get_page_elements()\n+    for root, dirs, files in os.walk(top_directory, topdown=True):\n+        dirs[:] = [d for d in dirs if d != 'html_output']\n+        for dirname in dirs:\n+            full_dir_name = get_full_path(root=root, original_path=dirname)\n+            if dir_contains_md_file(dir=full_dir_name):\n+                submenus[full_dir_name] = SubMenu(dirname)\n+        for filename in files:\n+            name, ext = path.splitext(filename)\n+            if ext == '.md':\n+                full_file_name = get_relative_path(\n+                    original_path=filename,\n+                    root=root,\n+                    top_directory=top_directory\n+                )\n+                template_node = get_template_node(\n+                    env=env, full_file_name=full_file_name)\n+                template_arguments = get_template_arguments(\n+                    template_node=template_node,\n+                    root=root,\n+                    top_directory=top_directory\n+                )\n+                element = get_element(\n+                    page_elements=page_elements,\n+                    template_arguments=template_arguments\n+                )\n+                html = get_html(\n+                    env=env,\n+                    full_file_name=full_file_name,\n+                    element=element","path":"core/webviz/__main__.py","position":164,"original_position":164,"commit_id":"cb20a3e752bf0cc1b8ad62e78b9e8829a427d54a","original_commit_id":"cb20a3e752bf0cc1b8ad62e78b9e8829a427d54a","user":{"login":"eivindjahren","id":32731672,"node_id":"MDQ6VXNlcjMyNzMxNjcy","avatar_url":"https://avatars1.githubusercontent.com/u/32731672?v=4","gravatar_id":"","url":"https://api.github.com/users/eivindjahren","html_url":"https://github.com/eivindjahren","followers_url":"https://api.github.com/users/eivindjahren/followers","following_url":"https://api.github.com/users/eivindjahren/following{/other_user}","gists_url":"https://api.github.com/users/eivindjahren/gists{/gist_id}","starred_url":"https://api.github.com/users/eivindjahren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eivindjahren/subscriptions","organizations_url":"https://api.github.com/users/eivindjahren/orgs","repos_url":"https://api.github.com/users/eivindjahren/repos","events_url":"https://api.github.com/users/eivindjahren/events{/privacy}","received_events_url":"https://api.github.com/users/eivindjahren/received_events","type":"User","site_admin":false},"body":"Does this work if there is more than one visualization per page?","created_at":"2018-09-19T13:05:35Z","updated_at":"2018-09-19T13:05:40Z","html_url":"https://github.com/Statoil/webviz/pull/93#discussion_r218794243","pull_request_url":"https://api.github.com/repos/Statoil/webviz/pulls/93","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Statoil/webviz/pulls/comments/218794243"},"html":{"href":"https://github.com/Statoil/webviz/pull/93#discussion_r218794243"},"pull_request":{"href":"https://api.github.com/repos/Statoil/webviz/pulls/93"}}},"pull_request":{"url":"https://api.github.com/repos/Statoil/webviz/pulls/93","id":216528428,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2NTI4NDI4","html_url":"https://github.com/Statoil/webviz/pull/93","diff_url":"https://github.com/Statoil/webviz/pull/93.diff","patch_url":"https://github.com/Statoil/webviz/pull/93.patch","issue_url":"https://api.github.com/repos/Statoil/webviz/issues/93","number":93,"state":"open","locked":false,"title":"fix: use relative paths when indexing files for import","user":{"login":"fortena","id":5881109,"node_id":"MDQ6VXNlcjU4ODExMDk=","avatar_url":"https://avatars2.githubusercontent.com/u/5881109?v=4","gravatar_id":"","url":"https://api.github.com/users/fortena","html_url":"https://github.com/fortena","followers_url":"https://api.github.com/users/fortena/followers","following_url":"https://api.github.com/users/fortena/following{/other_user}","gists_url":"https://api.github.com/users/fortena/gists{/gist_id}","starred_url":"https://api.github.com/users/fortena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fortena/subscriptions","organizations_url":"https://api.github.com/users/fortena/orgs","repos_url":"https://api.github.com/users/fortena/repos","events_url":"https://api.github.com/users/fortena/events{/privacy}","received_events_url":"https://api.github.com/users/fortena/received_events","type":"User","site_admin":false},"body":"This fixes a bug where files were not imported from the same depth level as the file referring to them.\r\nIt also contains a refactor where some code is moved from the global scope.","created_at":"2018-09-19T06:35:44Z","updated_at":"2018-09-19T13:05:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6e10218e9aefbbcdb9e87f20157b9afb78b858a5","assignee":{"login":"fortena","id":5881109,"node_id":"MDQ6VXNlcjU4ODExMDk=","avatar_url":"https://avatars2.githubusercontent.com/u/5881109?v=4","gravatar_id":"","url":"https://api.github.com/users/fortena","html_url":"https://github.com/fortena","followers_url":"https://api.github.com/users/fortena/followers","following_url":"https://api.github.com/users/fortena/following{/other_user}","gists_url":"https://api.github.com/users/fortena/gists{/gist_id}","starred_url":"https://api.github.com/users/fortena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fortena/subscriptions","organizations_url":"https://api.github.com/users/fortena/orgs","repos_url":"https://api.github.com/users/fortena/repos","events_url":"https://api.github.com/users/fortena/events{/privacy}","received_events_url":"https://api.github.com/users/fortena/received_events","type":"User","site_admin":false},"assignees":[{"login":"fortena","id":5881109,"node_id":"MDQ6VXNlcjU4ODExMDk=","avatar_url":"https://avatars2.githubusercontent.com/u/5881109?v=4","gravatar_id":"","url":"https://api.github.com/users/fortena","html_url":"https://github.com/fortena","followers_url":"https://api.github.com/users/fortena/followers","following_url":"https://api.github.com/users/fortena/following{/other_user}","gists_url":"https://api.github.com/users/fortena/gists{/gist_id}","starred_url":"https://api.github.com/users/fortena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fortena/subscriptions","organizations_url":"https://api.github.com/users/fortena/orgs","repos_url":"https://api.github.com/users/fortena/repos","events_url":"https://api.github.com/users/fortena/events{/privacy}","received_events_url":"https://api.github.com/users/fortena/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"kristofferlund","id":5398219,"node_id":"MDQ6VXNlcjUzOTgyMTk=","avatar_url":"https://avatars1.githubusercontent.com/u/5398219?v=4","gravatar_id":"","url":"https://api.github.com/users/kristofferlund","html_url":"https://github.com/kristofferlund","followers_url":"https://api.github.com/users/kristofferlund/followers","following_url":"https://api.github.com/users/kristofferlund/following{/other_user}","gists_url":"https://api.github.com/users/kristofferlund/gists{/gist_id}","starred_url":"https://api.github.com/users/kristofferlund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kristofferlund/subscriptions","organizations_url":"https://api.github.com/users/kristofferlund/orgs","repos_url":"https://api.github.com/users/kristofferlund/repos","events_url":"https://api.github.com/users/kristofferlund/events{/privacy}","received_events_url":"https://api.github.com/users/kristofferlund/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":988391027,"node_id":"MDU6TGFiZWw5ODgzOTEwMjc=","url":"https://api.github.com/repos/Statoil/webviz/labels/bug","name":"bug","color":"d73a4a","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/Statoil/webviz/pulls/93/commits","review_comments_url":"https://api.github.com/repos/Statoil/webviz/pulls/93/comments","review_comment_url":"https://api.github.com/repos/Statoil/webviz/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Statoil/webviz/issues/93/comments","statuses_url":"https://api.github.com/repos/Statoil/webviz/statuses/cb20a3e752bf0cc1b8ad62e78b9e8829a427d54a","head":{"label":"Statoil:use-relative-paths","ref":"use-relative-paths","sha":"cb20a3e752bf0cc1b8ad62e78b9e8829a427d54a","user":{"login":"Statoil","id":525862,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyNTg2Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/525862?v=4","gravatar_id":"","url":"https://api.github.com/users/Statoil","html_url":"https://github.com/Statoil","followers_url":"https://api.github.com/users/Statoil/followers","following_url":"https://api.github.com/users/Statoil/following{/other_user}","gists_url":"https://api.github.com/users/Statoil/gists{/gist_id}","starred_url":"https://api.github.com/users/Statoil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Statoil/subscriptions","organizations_url":"https://api.github.com/users/Statoil/orgs","repos_url":"https://api.github.com/users/Statoil/repos","events_url":"https://api.github.com/users/Statoil/events{/privacy}","received_events_url":"https://api.github.com/users/Statoil/received_events","type":"Organization","site_admin":false},"repo":{"id":140293618,"node_id":"MDEwOlJlcG9zaXRvcnkxNDAyOTM2MTg=","name":"webviz","full_name":"Statoil/webviz","private":false,"owner":{"login":"Statoil","id":525862,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyNTg2Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/525862?v=4","gravatar_id":"","url":"https://api.github.com/users/Statoil","html_url":"https://github.com/Statoil","followers_url":"https://api.github.com/users/Statoil/followers","following_url":"https://api.github.com/users/Statoil/following{/other_user}","gists_url":"https://api.github.com/users/Statoil/gists{/gist_id}","starred_url":"https://api.github.com/users/Statoil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Statoil/subscriptions","organizations_url":"https://api.github.com/users/Statoil/orgs","repos_url":"https://api.github.com/users/Statoil/repos","events_url":"https://api.github.com/users/Statoil/events{/privacy}","received_events_url":"https://api.github.com/users/Statoil/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Statoil/webviz","description":"Webviz is a static site generator that facilitates automatic reporting and visualization.","fork":false,"url":"https://api.github.com/repos/Statoil/webviz","forks_url":"https://api.github.com/repos/Statoil/webviz/forks","keys_url":"https://api.github.com/repos/Statoil/webviz/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Statoil/webviz/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Statoil/webviz/teams","hooks_url":"https://api.github.com/repos/Statoil/webviz/hooks","issue_events_url":"https://api.github.com/repos/Statoil/webviz/issues/events{/number}","events_url":"https://api.github.com/repos/Statoil/webviz/events","assignees_url":"https://api.github.com/repos/Statoil/webviz/assignees{/user}","branches_url":"https://api.github.com/repos/Statoil/webviz/branches{/branch}","tags_url":"https://api.github.com/repos/Statoil/webviz/tags","blobs_url":"https://api.github.com/repos/Statoil/webviz/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Statoil/webviz/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Statoil/webviz/git/refs{/sha}","trees_url":"https://api.github.com/repos/Statoil/webviz/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Statoil/webviz/statuses/{sha}","languages_url":"https://api.github.com/repos/Statoil/webviz/languages","stargazers_url":"https://api.github.com/repos/Statoil/webviz/stargazers","contributors_url":"https://api.github.com/repos/Statoil/webviz/contributors","subscribers_url":"https://api.github.com/repos/Statoil/webviz/subscribers","subscription_url":"https://api.github.com/repos/Statoil/webviz/subscription","commits_url":"https://api.github.com/repos/Statoil/webviz/commits{/sha}","git_commits_url":"https://api.github.com/repos/Statoil/webviz/git/commits{/sha}","comments_url":"https://api.github.com/repos/Statoil/webviz/comments{/number}","issue_comment_url":"https://api.github.com/repos/Statoil/webviz/issues/comments{/number}","contents_url":"https://api.github.com/repos/Statoil/webviz/contents/{+path}","compare_url":"https://api.github.com/repos/Statoil/webviz/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Statoil/webviz/merges","archive_url":"https://api.github.com/repos/Statoil/webviz/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Statoil/webviz/downloads","issues_url":"https://api.github.com/repos/Statoil/webviz/issues{/number}","pulls_url":"https://api.github.com/repos/Statoil/webviz/pulls{/number}","milestones_url":"https://api.github.com/repos/Statoil/webviz/milestones{/number}","notifications_url":"https://api.github.com/repos/Statoil/webviz/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Statoil/webviz/labels{/name}","releases_url":"https://api.github.com/repos/Statoil/webviz/releases{/id}","deployments_url":"https://api.github.com/repos/Statoil/webviz/deployments","created_at":"2018-07-09T14:00:36Z","updated_at":"2018-09-19T06:37:07Z","pushed_at":"2018-09-19T08:22:40Z","git_url":"git://github.com/Statoil/webviz.git","ssh_url":"git@github.com:Statoil/webviz.git","clone_url":"https://github.com/Statoil/webviz.git","svn_url":"https://github.com/Statoil/webviz","homepage":"","size":2602,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":23,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":8,"open_issues":23,"watchers":7,"default_branch":"master"}},"base":{"label":"Statoil:master","ref":"master","sha":"ca5cf749c0e049bee8b5ec98421836e09acbdd29","user":{"login":"Statoil","id":525862,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyNTg2Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/525862?v=4","gravatar_id":"","url":"https://api.github.com/users/Statoil","html_url":"https://github.com/Statoil","followers_url":"https://api.github.com/users/Statoil/followers","following_url":"https://api.github.com/users/Statoil/following{/other_user}","gists_url":"https://api.github.com/users/Statoil/gists{/gist_id}","starred_url":"https://api.github.com/users/Statoil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Statoil/subscriptions","organizations_url":"https://api.github.com/users/Statoil/orgs","repos_url":"https://api.github.com/users/Statoil/repos","events_url":"https://api.github.com/users/Statoil/events{/privacy}","received_events_url":"https://api.github.com/users/Statoil/received_events","type":"Organization","site_admin":false},"repo":{"id":140293618,"node_id":"MDEwOlJlcG9zaXRvcnkxNDAyOTM2MTg=","name":"webviz","full_name":"Statoil/webviz","private":false,"owner":{"login":"Statoil","id":525862,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyNTg2Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/525862?v=4","gravatar_id":"","url":"https://api.github.com/users/Statoil","html_url":"https://github.com/Statoil","followers_url":"https://api.github.com/users/Statoil/followers","following_url":"https://api.github.com/users/Statoil/following{/other_user}","gists_url":"https://api.github.com/users/Statoil/gists{/gist_id}","starred_url":"https://api.github.com/users/Statoil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Statoil/subscriptions","organizations_url":"https://api.github.com/users/Statoil/orgs","repos_url":"https://api.github.com/users/Statoil/repos","events_url":"https://api.github.com/users/Statoil/events{/privacy}","received_events_url":"https://api.github.com/users/Statoil/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Statoil/webviz","description":"Webviz is a static site generator that facilitates automatic reporting and visualization.","fork":false,"url":"https://api.github.com/repos/Statoil/webviz","forks_url":"https://api.github.com/repos/Statoil/webviz/forks","keys_url":"https://api.github.com/repos/Statoil/webviz/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Statoil/webviz/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Statoil/webviz/teams","hooks_url":"https://api.github.com/repos/Statoil/webviz/hooks","issue_events_url":"https://api.github.com/repos/Statoil/webviz/issues/events{/number}","events_url":"https://api.github.com/repos/Statoil/webviz/events","assignees_url":"https://api.github.com/repos/Statoil/webviz/assignees{/user}","branches_url":"https://api.github.com/repos/Statoil/webviz/branches{/branch}","tags_url":"https://api.github.com/repos/Statoil/webviz/tags","blobs_url":"https://api.github.com/repos/Statoil/webviz/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Statoil/webviz/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Statoil/webviz/git/refs{/sha}","trees_url":"https://api.github.com/repos/Statoil/webviz/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Statoil/webviz/statuses/{sha}","languages_url":"https://api.github.com/repos/Statoil/webviz/languages","stargazers_url":"https://api.github.com/repos/Statoil/webviz/stargazers","contributors_url":"https://api.github.com/repos/Statoil/webviz/contributors","subscribers_url":"https://api.github.com/repos/Statoil/webviz/subscribers","subscription_url":"https://api.github.com/repos/Statoil/webviz/subscription","commits_url":"https://api.github.com/repos/Statoil/webviz/commits{/sha}","git_commits_url":"https://api.github.com/repos/Statoil/webviz/git/commits{/sha}","comments_url":"https://api.github.com/repos/Statoil/webviz/comments{/number}","issue_comment_url":"https://api.github.com/repos/Statoil/webviz/issues/comments{/number}","contents_url":"https://api.github.com/repos/Statoil/webviz/contents/{+path}","compare_url":"https://api.github.com/repos/Statoil/webviz/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Statoil/webviz/merges","archive_url":"https://api.github.com/repos/Statoil/webviz/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Statoil/webviz/downloads","issues_url":"https://api.github.com/repos/Statoil/webviz/issues{/number}","pulls_url":"https://api.github.com/repos/Statoil/webviz/pulls{/number}","milestones_url":"https://api.github.com/repos/Statoil/webviz/milestones{/number}","notifications_url":"https://api.github.com/repos/Statoil/webviz/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Statoil/webviz/labels{/name}","releases_url":"https://api.github.com/repos/Statoil/webviz/releases{/id}","deployments_url":"https://api.github.com/repos/Statoil/webviz/deployments","created_at":"2018-07-09T14:00:36Z","updated_at":"2018-09-19T06:37:07Z","pushed_at":"2018-09-19T08:22:40Z","git_url":"git://github.com/Statoil/webviz.git","ssh_url":"git@github.com:Statoil/webviz.git","clone_url":"https://github.com/Statoil/webviz.git","svn_url":"https://github.com/Statoil/webviz","homepage":"","size":2602,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":23,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":8,"open_issues":23,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Statoil/webviz/pulls/93"},"html":{"href":"https://github.com/Statoil/webviz/pull/93"},"issue":{"href":"https://api.github.com/repos/Statoil/webviz/issues/93"},"comments":{"href":"https://api.github.com/repos/Statoil/webviz/issues/93/comments"},"review_comments":{"href":"https://api.github.com/repos/Statoil/webviz/pulls/93/comments"},"review_comment":{"href":"https://api.github.com/repos/Statoil/webviz/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Statoil/webviz/pulls/93/commits"},"statuses":{"href":"https://api.github.com/repos/Statoil/webviz/statuses/cb20a3e752bf0cc1b8ad62e78b9e8829a427d54a"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"eivindjahren"}}