{"action":"created","comment":{"url":"https://api.github.com/repos/gtk-rs/gir/pulls/comments/51344271","id":51344271,"diff_hunk":"@@ -0,0 +1,232 @@\n+use std::io::{Result, Write};\n+\n+use analysis::namespaces::MAIN;\n+use env::Env;\n+use file_saver::save_to_file;\n+use library::{self, Library, ToStripperType};\n+use library::Type as LType;\n+use writer::primitives;\n+\n+use stripper_interface::{FILE, /*FILE_COMMENT, */MOD_COMMENT, TypeStruct};\n+\n+const DEPRECATED : &'static str = \"/// ====>> DEPRECATED <<====\";\n+\n+pub fn generate(env: &Env) {\n+    let path =  env.config.target_path.join(\"doc.cmts\");\n+    println!(\"Generating documentation {:?}\", path);\n+    save_to_file(&path, env.config.make_backup,\n+        |w| generate_doc(w, &env.library));\n+}\n+\n+fn generate_doc(mut w: &mut Write, lib: &Library) -> Result<()> {\n+    let namespace = lib.namespace(MAIN);\n+\n+    /*if let Some(ref namespace_doc) = namespace.doc {\n+        for line in namespace_doc.split(\"\\n\") {\n+            output.push_str(&format!(\"{}{}\\n\", FILE_COMMENT, line));\n+        }\n+    }\n+    try!(create_sub_docs(&mut output, &namespace.constants, None));*/\n+    for ty in namespace.types.iter().filter_map(|t| t.as_ref()) {\n+        try!(handle_type(&mut w, &ty, None, lib));\n+    }\n+    Ok(())\n+}\n+\n+fn handle_type(w: &mut Write, ty: &library::Type, parent: Option<Box<TypeStruct>>, lib: &Library) -> Result<()> {\n+    match *ty {\n+        LType::Alias(ref a) => {\n+            try!(writeln!(w, \"{}src/auto/{}.rs\", FILE, a.name.to_lowercase()));\n+            create_sub_doc(w, a, parent)\n+        },\n+        LType::Enumeration(ref e) => create_enum_doc(w, &e, parent),\n+        LType::Function(ref f) => create_fn_doc(w, &f, parent),\n+        LType::Interface(ref i) => create_trait_doc(w, &i, parent),\n+        LType::Class(ref c) => create_class_doc(w, &c, parent, lib),\n+        _ => Ok(()),\n+    }\n+}\n+\n+fn create_class_doc(w: &mut Write, class: &library::Class, parent: Option<Box<TypeStruct>>, lib: &Library) -> Result<()> {\n+    let tabs : String = primitives::tabs(compute_ident(&parent));\n+    let mut ty = class.convert();\n+    ty.parent = parent;\n+\n+    try!(writeln!(w, \"{}src/auto/{}.rs\", FILE, class.name.to_lowercase()));\n+    let found = if let Some(ref class_doc) = class.doc {\n+        try!(writeln!(w, \"{}{}\", MOD_COMMENT, ty));","path":"src/codegen/doc/mod.rs","position":97,"original_position":57,"commit_id":"78854ea7d36b6115e328b100f70b3b69c7fb735a","original_commit_id":"146ac14ce232b84060c67740d204b0cf4c67b7ba","user":{"login":"gkoz","id":4260361,"avatar_url":"https://avatars.githubusercontent.com/u/4260361?v=3","gravatar_id":"","url":"https://api.github.com/users/gkoz","html_url":"https://github.com/gkoz","followers_url":"https://api.github.com/users/gkoz/followers","following_url":"https://api.github.com/users/gkoz/following{/other_user}","gists_url":"https://api.github.com/users/gkoz/gists{/gist_id}","starred_url":"https://api.github.com/users/gkoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkoz/subscriptions","organizations_url":"https://api.github.com/users/gkoz/orgs","repos_url":"https://api.github.com/users/gkoz/repos","events_url":"https://api.github.com/users/gkoz/events{/privacy}","received_events_url":"https://api.github.com/users/gkoz/received_events","type":"User","site_admin":false},"body":"And by `&&` I meant `||`... :blush: ","created_at":"2016-01-30T12:09:31Z","updated_at":"2016-01-30T12:09:31Z","html_url":"https://github.com/gtk-rs/gir/pull/198#discussion_r51344271","pull_request_url":"https://api.github.com/repos/gtk-rs/gir/pulls/198","_links":{"self":{"href":"https://api.github.com/repos/gtk-rs/gir/pulls/comments/51344271"},"html":{"href":"https://github.com/gtk-rs/gir/pull/198#discussion_r51344271"},"pull_request":{"href":"https://api.github.com/repos/gtk-rs/gir/pulls/198"}}},"pull_request":{"url":"https://api.github.com/repos/gtk-rs/gir/pulls/198","id":57485768,"html_url":"https://github.com/gtk-rs/gir/pull/198","diff_url":"https://github.com/gtk-rs/gir/pull/198.diff","patch_url":"https://github.com/gtk-rs/gir/pull/198.patch","issue_url":"https://api.github.com/repos/gtk-rs/gir/issues/198","number":198,"state":"open","locked":false,"title":"Add doc generation","user":{"login":"GuillaumeGomez","id":3050060,"avatar_url":"https://avatars.githubusercontent.com/u/3050060?v=3","gravatar_id":"","url":"https://api.github.com/users/GuillaumeGomez","html_url":"https://github.com/GuillaumeGomez","followers_url":"https://api.github.com/users/GuillaumeGomez/followers","following_url":"https://api.github.com/users/GuillaumeGomez/following{/other_user}","gists_url":"https://api.github.com/users/GuillaumeGomez/gists{/gist_id}","starred_url":"https://api.github.com/users/GuillaumeGomez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuillaumeGomez/subscriptions","organizations_url":"https://api.github.com/users/GuillaumeGomez/orgs","repos_url":"https://api.github.com/users/GuillaumeGomez/repos","events_url":"https://api.github.com/users/GuillaumeGomez/events{/privacy}","received_events_url":"https://api.github.com/users/GuillaumeGomez/received_events","type":"User","site_admin":false},"body":"cc @gkoz ","created_at":"2016-01-28T10:58:05Z","updated_at":"2016-01-30T12:09:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0e8ebe498d417545c76d1fe65b582ceda75cd9a7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gtk-rs/gir/pulls/198/commits","review_comments_url":"https://api.github.com/repos/gtk-rs/gir/pulls/198/comments","review_comment_url":"https://api.github.com/repos/gtk-rs/gir/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gtk-rs/gir/issues/198/comments","statuses_url":"https://api.github.com/repos/gtk-rs/gir/statuses/78854ea7d36b6115e328b100f70b3b69c7fb735a","head":{"label":"GuillaumeGomez:master","ref":"master","sha":"78854ea7d36b6115e328b100f70b3b69c7fb735a","user":{"login":"GuillaumeGomez","id":3050060,"avatar_url":"https://avatars.githubusercontent.com/u/3050060?v=3","gravatar_id":"","url":"https://api.github.com/users/GuillaumeGomez","html_url":"https://github.com/GuillaumeGomez","followers_url":"https://api.github.com/users/GuillaumeGomez/followers","following_url":"https://api.github.com/users/GuillaumeGomez/following{/other_user}","gists_url":"https://api.github.com/users/GuillaumeGomez/gists{/gist_id}","starred_url":"https://api.github.com/users/GuillaumeGomez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuillaumeGomez/subscriptions","organizations_url":"https://api.github.com/users/GuillaumeGomez/orgs","repos_url":"https://api.github.com/users/GuillaumeGomez/repos","events_url":"https://api.github.com/users/GuillaumeGomez/events{/privacy}","received_events_url":"https://api.github.com/users/GuillaumeGomez/received_events","type":"User","site_admin":false},"repo":{"id":49569550,"name":"gir","full_name":"GuillaumeGomez/gir","owner":{"login":"GuillaumeGomez","id":3050060,"avatar_url":"https://avatars.githubusercontent.com/u/3050060?v=3","gravatar_id":"","url":"https://api.github.com/users/GuillaumeGomez","html_url":"https://github.com/GuillaumeGomez","followers_url":"https://api.github.com/users/GuillaumeGomez/followers","following_url":"https://api.github.com/users/GuillaumeGomez/following{/other_user}","gists_url":"https://api.github.com/users/GuillaumeGomez/gists{/gist_id}","starred_url":"https://api.github.com/users/GuillaumeGomez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuillaumeGomez/subscriptions","organizations_url":"https://api.github.com/users/GuillaumeGomez/orgs","repos_url":"https://api.github.com/users/GuillaumeGomez/repos","events_url":"https://api.github.com/users/GuillaumeGomez/events{/privacy}","received_events_url":"https://api.github.com/users/GuillaumeGomez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GuillaumeGomez/gir","description":"","fork":true,"url":"https://api.github.com/repos/GuillaumeGomez/gir","forks_url":"https://api.github.com/repos/GuillaumeGomez/gir/forks","keys_url":"https://api.github.com/repos/GuillaumeGomez/gir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GuillaumeGomez/gir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GuillaumeGomez/gir/teams","hooks_url":"https://api.github.com/repos/GuillaumeGomez/gir/hooks","issue_events_url":"https://api.github.com/repos/GuillaumeGomez/gir/issues/events{/number}","events_url":"https://api.github.com/repos/GuillaumeGomez/gir/events","assignees_url":"https://api.github.com/repos/GuillaumeGomez/gir/assignees{/user}","branches_url":"https://api.github.com/repos/GuillaumeGomez/gir/branches{/branch}","tags_url":"https://api.github.com/repos/GuillaumeGomez/gir/tags","blobs_url":"https://api.github.com/repos/GuillaumeGomez/gir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GuillaumeGomez/gir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GuillaumeGomez/gir/git/refs{/sha}","trees_url":"https://api.github.com/repos/GuillaumeGomez/gir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GuillaumeGomez/gir/statuses/{sha}","languages_url":"https://api.github.com/repos/GuillaumeGomez/gir/languages","stargazers_url":"https://api.github.com/repos/GuillaumeGomez/gir/stargazers","contributors_url":"https://api.github.com/repos/GuillaumeGomez/gir/contributors","subscribers_url":"https://api.github.com/repos/GuillaumeGomez/gir/subscribers","subscription_url":"https://api.github.com/repos/GuillaumeGomez/gir/subscription","commits_url":"https://api.github.com/repos/GuillaumeGomez/gir/commits{/sha}","git_commits_url":"https://api.github.com/repos/GuillaumeGomez/gir/git/commits{/sha}","comments_url":"https://api.github.com/repos/GuillaumeGomez/gir/comments{/number}","issue_comment_url":"https://api.github.com/repos/GuillaumeGomez/gir/issues/comments{/number}","contents_url":"https://api.github.com/repos/GuillaumeGomez/gir/contents/{+path}","compare_url":"https://api.github.com/repos/GuillaumeGomez/gir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GuillaumeGomez/gir/merges","archive_url":"https://api.github.com/repos/GuillaumeGomez/gir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GuillaumeGomez/gir/downloads","issues_url":"https://api.github.com/repos/GuillaumeGomez/gir/issues{/number}","pulls_url":"https://api.github.com/repos/GuillaumeGomez/gir/pulls{/number}","milestones_url":"https://api.github.com/repos/GuillaumeGomez/gir/milestones{/number}","notifications_url":"https://api.github.com/repos/GuillaumeGomez/gir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GuillaumeGomez/gir/labels{/name}","releases_url":"https://api.github.com/repos/GuillaumeGomez/gir/releases{/id}","deployments_url":"https://api.github.com/repos/GuillaumeGomez/gir/deployments","created_at":"2016-01-13T11:26:12Z","updated_at":"2016-01-13T11:26:13Z","pushed_at":"2016-01-30T01:14:42Z","git_url":"git://github.com/GuillaumeGomez/gir.git","ssh_url":"git@github.com:GuillaumeGomez/gir.git","clone_url":"https://github.com/GuillaumeGomez/gir.git","svn_url":"https://github.com/GuillaumeGomez/gir","homepage":null,"size":569,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gtk-rs:master","ref":"master","sha":"7446646734536d4c072d750219e1c04f7d3013be","user":{"login":"gtk-rs","id":11757045,"avatar_url":"https://avatars.githubusercontent.com/u/11757045?v=3","gravatar_id":"","url":"https://api.github.com/users/gtk-rs","html_url":"https://github.com/gtk-rs","followers_url":"https://api.github.com/users/gtk-rs/followers","following_url":"https://api.github.com/users/gtk-rs/following{/other_user}","gists_url":"https://api.github.com/users/gtk-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/gtk-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtk-rs/subscriptions","organizations_url":"https://api.github.com/users/gtk-rs/orgs","repos_url":"https://api.github.com/users/gtk-rs/repos","events_url":"https://api.github.com/users/gtk-rs/events{/privacy}","received_events_url":"https://api.github.com/users/gtk-rs/received_events","type":"Organization","site_admin":false},"repo":{"id":37824715,"name":"gir","full_name":"gtk-rs/gir","owner":{"login":"gtk-rs","id":11757045,"avatar_url":"https://avatars.githubusercontent.com/u/11757045?v=3","gravatar_id":"","url":"https://api.github.com/users/gtk-rs","html_url":"https://github.com/gtk-rs","followers_url":"https://api.github.com/users/gtk-rs/followers","following_url":"https://api.github.com/users/gtk-rs/following{/other_user}","gists_url":"https://api.github.com/users/gtk-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/gtk-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtk-rs/subscriptions","organizations_url":"https://api.github.com/users/gtk-rs/orgs","repos_url":"https://api.github.com/users/gtk-rs/repos","events_url":"https://api.github.com/users/gtk-rs/events{/privacy}","received_events_url":"https://api.github.com/users/gtk-rs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gtk-rs/gir","description":"","fork":false,"url":"https://api.github.com/repos/gtk-rs/gir","forks_url":"https://api.github.com/repos/gtk-rs/gir/forks","keys_url":"https://api.github.com/repos/gtk-rs/gir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gtk-rs/gir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gtk-rs/gir/teams","hooks_url":"https://api.github.com/repos/gtk-rs/gir/hooks","issue_events_url":"https://api.github.com/repos/gtk-rs/gir/issues/events{/number}","events_url":"https://api.github.com/repos/gtk-rs/gir/events","assignees_url":"https://api.github.com/repos/gtk-rs/gir/assignees{/user}","branches_url":"https://api.github.com/repos/gtk-rs/gir/branches{/branch}","tags_url":"https://api.github.com/repos/gtk-rs/gir/tags","blobs_url":"https://api.github.com/repos/gtk-rs/gir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gtk-rs/gir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gtk-rs/gir/git/refs{/sha}","trees_url":"https://api.github.com/repos/gtk-rs/gir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gtk-rs/gir/statuses/{sha}","languages_url":"https://api.github.com/repos/gtk-rs/gir/languages","stargazers_url":"https://api.github.com/repos/gtk-rs/gir/stargazers","contributors_url":"https://api.github.com/repos/gtk-rs/gir/contributors","subscribers_url":"https://api.github.com/repos/gtk-rs/gir/subscribers","subscription_url":"https://api.github.com/repos/gtk-rs/gir/subscription","commits_url":"https://api.github.com/repos/gtk-rs/gir/commits{/sha}","git_commits_url":"https://api.github.com/repos/gtk-rs/gir/git/commits{/sha}","comments_url":"https://api.github.com/repos/gtk-rs/gir/comments{/number}","issue_comment_url":"https://api.github.com/repos/gtk-rs/gir/issues/comments{/number}","contents_url":"https://api.github.com/repos/gtk-rs/gir/contents/{+path}","compare_url":"https://api.github.com/repos/gtk-rs/gir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gtk-rs/gir/merges","archive_url":"https://api.github.com/repos/gtk-rs/gir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gtk-rs/gir/downloads","issues_url":"https://api.github.com/repos/gtk-rs/gir/issues{/number}","pulls_url":"https://api.github.com/repos/gtk-rs/gir/pulls{/number}","milestones_url":"https://api.github.com/repos/gtk-rs/gir/milestones{/number}","notifications_url":"https://api.github.com/repos/gtk-rs/gir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gtk-rs/gir/labels{/name}","releases_url":"https://api.github.com/repos/gtk-rs/gir/releases{/id}","deployments_url":"https://api.github.com/repos/gtk-rs/gir/deployments","created_at":"2015-06-21T20:29:55Z","updated_at":"2016-01-14T12:15:50Z","pushed_at":"2016-01-30T01:14:42Z","git_url":"git://github.com/gtk-rs/gir.git","ssh_url":"git@github.com:gtk-rs/gir.git","clone_url":"https://github.com/gtk-rs/gir.git","svn_url":"https://github.com/gtk-rs/gir","homepage":null,"size":556,"stargazers_count":4,"watchers_count":4,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":15,"forks":4,"open_issues":15,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gtk-rs/gir/pulls/198"},"html":{"href":"https://github.com/gtk-rs/gir/pull/198"},"issue":{"href":"https://api.github.com/repos/gtk-rs/gir/issues/198"},"comments":{"href":"https://api.github.com/repos/gtk-rs/gir/issues/198/comments"},"review_comments":{"href":"https://api.github.com/repos/gtk-rs/gir/pulls/198/comments"},"review_comment":{"href":"https://api.github.com/repos/gtk-rs/gir/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gtk-rs/gir/pulls/198/commits"},"statuses":{"href":"https://api.github.com/repos/gtk-rs/gir/statuses/78854ea7d36b6115e328b100f70b3b69c7fb735a"}}}}