From 8ec5a2af47522771ad8ec49ec3062f9aa6134f60 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Thu, 22 Mar 2018 23:10:18 +0100 Subject: [PATCH 01/10] Style struct members like functions --- site/index.html | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/site/index.html b/site/index.html index 5ef9ca177..b824a5d38 100644 --- a/site/index.html +++ b/site/index.html @@ -255,17 +255,13 @@

<%= type.tname %><%= type.type %>

<%= type.data.comments %>

<% } %> - +
<% _.each(type.data.fields, function(field) { %> - - - - <% if (field.comments) { %> - - + + + - <% } %> <% }) %>
<%= field.type %><%= field.name %>
<%= field.comments %><%= field.type %><%= field.name %><% if (field.comments) { %><%= field.comments %><% } %>
From f3174eb95c86b5e5f354905667760324f0708fb4 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Tue, 11 Jun 2019 15:30:37 +0200 Subject: [PATCH 02/10] Use the paragraph's text directly Fixes the rendering of bulleted lists in structures. --- lib/docurium/docparser.rb | 2 +- test/docurium_test.rb | 13 +++++++---- test/fixtures/git2/repository.h | 39 +++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/lib/docurium/docparser.rb b/lib/docurium/docparser.rb index fd50fec02..524732f68 100644 --- a/lib/docurium/docparser.rb +++ b/lib/docurium/docparser.rb @@ -149,7 +149,7 @@ def extract_function_args(cursor, cmt) def extract_subject_desc(comment) subject = comment.child.text - paras = comment.find_all { |cmt| cmt.kind == :comment_paragraph }.drop(1).map { |p| p.map(&:text).join() } + paras = comment.find_all { |cmt| cmt.kind == :comment_paragraph }.drop(1).map { |p| p.text } desc = paras.join("\n\n") return subject, desc end diff --git a/test/docurium_test.rb b/test/docurium_test.rb index 7851f8913..7cdfea256 100644 --- a/test/docurium_test.rb +++ b/test/docurium_test.rb @@ -161,11 +161,16 @@ def test_can_parse_function_cast_args assert_equal 'int (*)(const char *, void *)', func[:args][2][:type] assert_equal 'Function which will be called for every listed ref', func[:args][2][:comment] expect_comment =<<-EOF -

The listed references may be filtered by type, or using a bitwise OR of several types. Use the magic value GIT_REF_LISTALL to obtain all references, including packed ones.

- -

The callback function will be called for each of the references in the repository, and will receive the name of the reference and the payload value passed to this method.

+

The listed references may be filtered by type, or using + a bitwise OR of several types. Use the magic value + GIT_REF_LISTALL to obtain all references, including + packed ones.

+ +

The callback function will be called for each of the references + in the repository, and will receive the name of the reference and + the payload value passed to this method.

EOF - assert_equal expect_comment.split("\n").map(&:strip), func[:comments].split("\n") + assert_equal expect_comment.split("\n"), func[:comments].split("\n") end def test_can_get_the_full_description_from_multi_liners diff --git a/test/fixtures/git2/repository.h b/test/fixtures/git2/repository.h index c47fcfc9a..4c814947d 100644 --- a/test/fixtures/git2/repository.h +++ b/test/fixtures/git2/repository.h @@ -212,6 +212,45 @@ GIT_EXTERN(const char *) git_repository_path(git_repository *repo); */ GIT_EXTERN(const char *) git_repository_workdir(git_repository *repo); +/** + * Extended options structure for `git_repository_init_ext`. + * + * This contains extra options for `git_repository_init_ext` that enable + * additional initialization features. The fields are: + * + * * flags - Combination of GIT_REPOSITORY_INIT flags above. + * * mode - Set to one of the standard GIT_REPOSITORY_INIT_SHARED_... + * constants above, or to a custom value that you would like. + * * workdir_path - The path to the working dir or NULL for default (i.e. + * repo_path parent on non-bare repos). IF THIS IS RELATIVE PATH, + * IT WILL BE EVALUATED RELATIVE TO THE REPO_PATH. If this is not + * the "natural" working directory, a .git gitlink file will be + * created here linking to the repo_path. + * * description - If set, this will be used to initialize the "description" + * file in the repository, instead of using the template content. + * * template_path - When GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE is set, + * this contains the path to use for the template directory. If + * this is NULL, the config or default directory options will be + * used instead. + * * initial_head - The name of the head to point HEAD at. If NULL, then + * this will be treated as "master" and the HEAD ref will be set + * to "refs/heads/master". If this begins with "refs/" it will be + * used verbatim; otherwise "refs/heads/" will be prefixed. + * * origin_url - If this is non-NULL, then after the rest of the + * repository initialization is completed, an "origin" remote + * will be added pointing to this URL. + */ +typedef struct { + unsigned int version; + uint32_t flags; + uint32_t mode; + const char *workdir_path; + const char *description; + const char *template_path; + const char *initial_head; + const char *origin_url; +} git_repository_init_options; + /** @} */ GIT_END_DECL #endif From e7a5ab7d5ce3b985c227dd4ef3820a15dca0a600 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Thu, 22 Mar 2018 23:10:58 +0100 Subject: [PATCH 03/10] Try harder to preserve information on structs --- lib/docurium.rb | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/docurium.rb b/lib/docurium.rb index e4bafbda6..1ba187ef5 100644 --- a/lib/docurium.rb +++ b/lib/docurium.rb @@ -503,13 +503,24 @@ def update_globals!(data, recs) when :struct, :fnptr data[:types][r[:name]] ||= {} + known = data[:types][r[:name]] r[:value] ||= r[:name] - wanted[:types].each do |k| - next unless r.has_key? k - if k == :comments - data[:types][r[:name]][k] = md.render r[k] - else - data[:types][r[:name]][k] = r[k] + # we don't want to override "opaque" structs with typedefs or + # "public" documentation + unless r[:tdef].nil? and known[:fields] and known[:comments] and known[:description] + wanted[:types].each do |k| + next unless r.has_key? k + if k == :comments + data[:types][r[:name]][k] = md.render r[k] + else + data[:types][r[:name]][k] = r[k] + end + end + else + # We're about to skip that type. Just make sure we preserve the + # :fields comment + if r[:fields] and known[:fields].empty? + data[:types][r[:name]][:fields] = r[:fields] end end if r[:type] == :fnptr From e60d566eca8477f1c52387f6b38fd2e841b4bf8b Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Tue, 19 Feb 2019 19:59:45 +0100 Subject: [PATCH 04/10] Split styling classes on semantic tables --- site/css/style.css | 15 +++++++++------ site/index.html | 8 ++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/site/css/style.css b/site/css/style.css index 2222d024b..b5e3b08c3 100644 --- a/site/css/style.css +++ b/site/css/style.css @@ -117,14 +117,15 @@ table.methods tr td.methodName a { font-weight: bold; } -table.funcTable tr td { +table.funcTable tr td, +table.structTable tr td { padding: 5px 10px; border-bottom: 1px solid #eee; } -table.funcTable tr td.comment { - color: #999; -} -table.funcTable tr td.var { + +.enumTable .var, +.funcTable .var, +.structTable .var { font-weight: bold; color: #833; } @@ -152,7 +153,9 @@ code.params { .returns { margin-bottom: 15px; } -h1.funcTitle { +h1.funcTitle, +h1.enumTitle, +h1.structTitle { font-size: 1.6em; } h3.funcDesc { diff --git a/site/index.html b/site/index.html index b824a5d38..b4a375319 100644 --- a/site/index.html +++ b/site/index.html @@ -218,7 +218,7 @@

Argument in