From: Florian Brosch Date: Wed, 28 Oct 2009 01:59:55 +0000 (+0100) Subject: signaturebuilder: add support for basic type highlighting X-Git-Tag: 0.37.1~3^2~512 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27cc227d200240e5138e79d019aed47d0978c0a9;p=thirdparty%2Fvala.git signaturebuilder: add support for basic type highlighting --- diff --git a/icons/devhelpstyle.css b/icons/devhelpstyle.css index 88e0e15a5..36be22189 100644 --- a/icons/devhelpstyle.css +++ b/icons/devhelpstyle.css @@ -105,7 +105,7 @@ div.site_body { } -.main_other_type { +.main_type { text-decoration: none; font-style: italic; color: #000000; @@ -482,5 +482,11 @@ a.navi_link:hover, a.external_link:hover { } .main_code_definition a, .leaf_code_definition a { + text-decoration: none; color: inherit; } + +.main_code_definition a:hover, .leaf_code_definition a:hover { + text-decoration: underline; +} + diff --git a/icons/style.css b/icons/style.css index dc498b4ef..d7d0785ac 100644 --- a/icons/style.css +++ b/icons/style.css @@ -119,7 +119,7 @@ div.site_navigation { } -.main_other_type { +.main_type { text-decoration: none; font-style: italic; color: #000000; @@ -496,5 +496,11 @@ a.navi_link:hover, a.external_link:hover { } .main_code_definition a, .leaf_code_definition a { + text-decoration: none; color: inherit; } + +.main_code_definition a:hover, .leaf_code_definition a:hover { + text-decoration: underline; +} + diff --git a/icons/wikistyle.css b/icons/wikistyle.css index 5990d11f9..5f7f0eb82 100644 --- a/icons/wikistyle.css +++ b/icons/wikistyle.css @@ -112,7 +112,7 @@ div.site_navigation { } -.main_other_type { +.main_type { text-decoration: none; font-style: italic; color: #000000; diff --git a/src/libvaladoc/api/signaturebuilder.vala b/src/libvaladoc/api/signaturebuilder.vala index 68fc17f81..7322fde59 100644 --- a/src/libvaladoc/api/signaturebuilder.vala +++ b/src/libvaladoc/api/signaturebuilder.vala @@ -65,7 +65,12 @@ public class Valadoc.Api.SignatureBuilder { } public SignatureBuilder append_type (Node node, bool spaced = true) { - Run inner = new Run (Run.Style.LANG_TYPE); + Run.Style style = Run.Style.LANG_TYPE; + if (node is TypeSymbol && ((TypeSymbol)node).is_basic_type) { + style = Run.Style.LANG_BASIC_TYPE; + } + + Run inner = new Run (style); inner.content.add (new SymbolLink (node, node.name)); return append_content (inner, spaced); } diff --git a/src/libvaladoc/api/typesymbol.vala b/src/libvaladoc/api/typesymbol.vala index 716125d7d..12028f77e 100644 --- a/src/libvaladoc/api/typesymbol.vala +++ b/src/libvaladoc/api/typesymbol.vala @@ -28,6 +28,19 @@ public abstract class Valadoc.Api.TypeSymbol : Symbol { base (symbol, parent); } + public bool is_basic_type { + get { + if (this.symbol is Vala.Struct) { + unowned Vala.Struct mystruct = (Vala.Struct) this.symbol; + return mystruct.base_type == null && (mystruct.is_boolean_type () || mystruct.is_floating_type () || mystruct.is_integer_type ()); + } else if (this.symbol is Vala.Class) { + unowned Vala.Class myclass = (Vala.Class) this.symbol; + return myclass.base_class == null && myclass.name == "string"; + } + return false; + } + } + protected override void process_comments (Settings settings, DocumentationParser parser) { var source_comment = ((Vala.TypeSymbol) symbol).comment; if (source_comment != null) { diff --git a/src/libvaladoc/content/run.vala b/src/libvaladoc/content/run.vala index cc0662258..cc6072ce0 100755 --- a/src/libvaladoc/content/run.vala +++ b/src/libvaladoc/content/run.vala @@ -33,6 +33,7 @@ public class Valadoc.Content.Run : InlineContent, Inline { STROKE, LANG_KEYWORD, LANG_LITERAL, + LANG_BASIC_TYPE, LANG_TYPE } diff --git a/src/libvaladoc/html/htmlrenderer.vala b/src/libvaladoc/html/htmlrenderer.vala index 435cd56cf..e02076bfa 100755 --- a/src/libvaladoc/html/htmlrenderer.vala +++ b/src/libvaladoc/html/htmlrenderer.vala @@ -267,10 +267,14 @@ public class Valadoc.Html.HtmlRenderer : ContentRenderer { tag = "span"; css_type = "main_optional_parameter"; break; - case Run.Style.LANG_TYPE: + case Run.Style.LANG_BASIC_TYPE: tag = "span"; css_type = "main_basic_type"; break; + case Run.Style.LANG_TYPE: + tag = "span"; + css_type = "main_type"; + break; } if (tag != null) { writer.start_tag (tag, {"class", css_type});