GetXref() 공개 정적인 메소드

public static GetXref ( string uid, string text = null, string alt = null ) : string
uid string
text string
alt string
리턴 string
예제 #1
0
        public static ApiReferenceBuildOutput FromModel(ReferenceViewModel vm, string[] supportedLanguages)
        {
            if (vm == null)
            {
                return(null);
            }

            // TODO: may lead to potential problems with have vm.Additional["syntax"] as SyntaxDetailViewModel
            // It is now working as syntax is set only in FillReferenceInformation and not from YAML deserialization
            var result = new ApiReferenceBuildOutput
            {
                Uid          = vm.Uid,
                Id           = Utility.GetHtmlId(vm.Uid),
                Parent       = vm.Parent,
                Definition   = vm.Definition,
                IsExternal   = vm.IsExternal,
                Href         = vm.Href,
                Name         = ApiBuildOutputUtility.TransformToLanguagePairList(vm.Name, vm.NameInDevLangs, supportedLanguages),
                NameWithType = ApiBuildOutputUtility.TransformToLanguagePairList(vm.NameWithType, vm.NameWithTypeInDevLangs, supportedLanguages),
                FullName     = ApiBuildOutputUtility.TransformToLanguagePairList(vm.FullName, vm.FullNameInDevLangs, supportedLanguages),
                Spec         = GetSpecNames(ApiBuildOutputUtility.GetXref(vm.Uid, vm.FullName, vm.Name), supportedLanguages, vm.Specs),
                Metadata     = vm.Additional,
            };
            object syntax;

            if (result.Metadata.TryGetValue("syntax", out syntax))
            {
                result.Syntax = ApiSyntaxBuildOutput.FromModel(syntax as SyntaxDetailViewModel, supportedLanguages);
                result.Metadata.Remove("syntax");
            }
            return(result);
        }
예제 #2
0
        private static string GetCompositeName(SpecViewModel svm)
        {
            // If href does not exists, return full name
            if (string.IsNullOrEmpty(svm.Uid))
            {
                return(System.Web.HttpUtility.HtmlEncode(svm.FullName));
            }

            // If href exists, return name with href
            return(ApiBuildOutputUtility.GetXref(svm.Uid, svm.FullName, svm.Name));
        }
예제 #3
0
        public static ApiReferenceBuildOutput FromModel(ItemViewModel vm)
        {
            if (vm == null)
            {
                return(null);
            }

            var output = new ApiReferenceBuildOutput
            {
                Uid = vm.Uid,
                Id  = Utility.GetHtmlId(vm.Uid),
                IsExplicitInterfaceImplementation = vm.IsExplicitInterfaceImplementation,
                IsExtensionMethod = vm.IsExtensionMethod,
                Parent            = vm.Parent,
                IsExternal        = false,
                Href             = vm.Href,
                Name             = ApiBuildOutputUtility.TransformToLanguagePairList(vm.Name, vm.Names, vm.SupportedLanguages),
                NameWithType     = ApiBuildOutputUtility.TransformToLanguagePairList(vm.NameWithType, vm.NamesWithType, vm.SupportedLanguages),
                FullName         = ApiBuildOutputUtility.TransformToLanguagePairList(vm.FullName, vm.FullNames, vm.SupportedLanguages),
                Spec             = GetSpecNames(ApiBuildOutputUtility.GetXref(vm.Uid, vm.FullName, vm.Name), vm.SupportedLanguages),
                Source           = vm.Source,
                Documentation    = vm.Documentation,
                AssemblyNameList = vm.AssemblyNameList,
                NamespaceName    = vm.NamespaceName,
                Remarks          = vm.Remarks,
                Examples         = vm.Examples,
                Overridden       = ApiNames.FromUid(vm.Overridden),
                Overload         = ApiNames.FromUid(vm.Overload),
                SeeAlsos         = vm.SeeAlsos?.Select(s => ApiLinkInfoBuildOutput.FromModel(s)).ToList(),
                Sees             = vm.Sees?.Select(s => ApiLinkInfoBuildOutput.FromModel(s)).ToList(),
                Inheritance      = vm.Inheritance?.Select(i => FromUid(i)).ToList(),
                Implements       = vm.Implements?.Select(i => ApiNames.FromUid(i)).ToList(),
                InheritedMembers = vm.InheritedMembers,
                ExtensionMethods = vm.ExtensionMethods,
                Modifiers        = vm.Modifiers,
                Conceptual       = vm.Conceptual,
                Metadata         = vm.Metadata,
                Attributes       = vm.Attributes,
                Syntax           = ApiSyntaxBuildOutput.FromModel(vm.Syntax, vm.SupportedLanguages),
                Exceptions       = vm.Exceptions?.Select(s => ApiExceptionInfoBuildOutput.FromModel(s)).ToList(),
            };

            output.Metadata["type"]     = vm.Type;
            output.Metadata["summary"]  = vm.Summary;
            output.Metadata["platform"] = vm.Platform;
            return(output);
        }