Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs unification 1 #19630

Merged
merged 23 commits into from Apr 29, 2024
Merged

Conversation

EnesDONER
Copy link
Contributor

TODO: Abp docs broken links fixed

@hikalkan hikalkan requested a review from maliming April 29, 2024 06:50
@hikalkan hikalkan added this to the 8.3-preview milestone Apr 29, 2024
@maliming
Copy link
Member

maliming commented Apr 29, 2024

hi @EnesDONER

I wrote a link checker. here are source code and results:

// See https://aka.ms/new-console-template for more information

using System.Text.RegularExpressions;

var baseDir = "/Users/maliming/Github/abp/docs/en/";
var mdFiles = Directory.GetFiles(baseDir, "*.md", SearchOption.AllDirectories);

var count = 0;
foreach (var file in mdFiles.Where(x => !x.Contains("_deleted") && !x.Contains("Blog-Posts")))
{
    var regex = new Regex(@"\[[^\[\]]*\]\(((?!http)[^\(\)]*)\)");

    var content = File.ReadAllText(file);
    var matches = regex.Matches(content);
    foreach (Match match in matches)
    {
        var url = match.Groups[1].Value;
        if (!string.IsNullOrWhiteSpace(url) && !url.StartsWith("#"))
        {
            var newUrl = url;
            var parent = file;

            if (newUrl.StartsWith("./"))
            {
                parent = Path.GetDirectoryName(parent);
                newUrl = Path.Combine(parent, url.Replace("./", ""));
            }
            else if (newUrl.StartsWith("../"))
            {
                var count2 = Regex.Count(newUrl, @"\.\./");
                for (var i = 0; i <= count2; i++)
                {
                    parent = Path.GetDirectoryName(parent);
                }

                newUrl = Path.Combine(parent, url.Replace("../", ""));
            }
            else
            {
                newUrl = Path.Combine(Path.GetDirectoryName(parent), url);
            }

            if (newUrl.Contains("?"))
            {
                newUrl = newUrl.Substring(0, newUrl.IndexOf("?"));
            }

            if (!File.Exists(newUrl) && !File.Exists(Path.Combine(newUrl, "index.md")) && !File.Exists(newUrl + ".md"))
            {
                Console.WriteLine($"File : {file.Replace(baseDir, "")}");
                Console.WriteLine($"Url : {url}");
                //Console.WriteLine($"New Url : {newUrl}");
                Console.WriteLine($"File not exists: {newUrl.Replace(baseDir, "")}");
                Console.WriteLine("----------------------------------");

                count++;
            }
        }
    }
}

Console.WriteLine("Wrong Count: " + count);
File : Deploy-azure-app-service.md
Url : images/azdevops-23.png
File not exists: images/azdevops-23.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-1.png
File not exists: images/azdevops-1.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-2.png
File not exists: images/azdevops-2.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-18.png
File not exists: images/azdevops-18.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-3.png
File not exists: images/azdevops-3.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-4.png
File not exists: images/azdevops-4.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-5.png
File not exists: images/azdevops-5.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-6.png
File not exists: images/azdevops-6.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-7.png
File not exists: images/azdevops-7.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-8.png
File not exists: images/azdevops-8.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-9.png
File not exists: images/azdevops-9.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-10.png
File not exists: images/azdevops-10.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-11.png
File not exists: images/azdevops-11.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-12.png
File not exists: images/azdevops-12.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-13.png
File not exists: images/azdevops-13.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-14.png
File not exists: images/azdevops-14.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-19.png
File not exists: images/azdevops-19.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-20.png
File not exists: images/azdevops-20.png
----------------------------------
File : Deploy-azure-app-service.md
Url : images/azdevops-21.png
File not exists: images/azdevops-21.png
----------------------------------

Some results are deleted.

----------------------------------
File : solution-templates/single-layer-web-application/index.md
Url : Application.md
File not exists: solution-templates/single-layer-web-application/Application.md
----------------------------------
File : solution-templates/single-layer-web-application/index.md
Url : ../Domain-Driven-Design.md
File not exists: solution-templates/Domain-Driven-Design.md
----------------------------------
File : solution-templates/single-layer-web-application/index.md
Url : Application.md
File not exists: solution-templates/single-layer-web-application/Application.md
----------------------------------
File : solution-templates/single-layer-web-application/index.md
Url : ../CLI.md
File not exists: solution-templates/CLI.md

File : tutorials/book-store/part-08.md
Url : Part-1.md
File not exists: tutorials/book-store/Part-1.md
----------------------------------
File : tutorials/book-store/part-08.md
Url : Part-2.md
File not exists: tutorials/book-store/Part-2.md
----------------------------------
File : tutorials/book-store/part-08.md
Url : Part-3.md
File not exists: tutorials/book-store/Part-3.md
----------------------------------
File : tutorials/book-store/part-08.md
Url : Part-4.md
File not exists: tutorials/book-store/Part-4.md

File : framework/ui/blazor/Localization.md
Url : ../../Localization.md
File not exists: framework/Localization.md
----------------------------------
File : framework/ui/blazor/Global-Scripts-Styles.md
Url : ../../CLI.md#bundle
File not exists: framework/CLI.md#bundle
----------------------------------
File : framework/ui/blazor/Global-Scripts-Styles.md
Url : ../../CLI.md#bundle
File not exists: framework/CLI.md#bundle
----------------------------------
File : framework/ui/blazor/Authorization.md
Url : ../../Authorization.md
File not exists: framework/Authorization.md

File : framework/architecture/modularity/extending/overriding-user-interface.md
Url : ../../../ui/blazor/customization-user-interface.md
File not exists: framework/ui/blazor/customization-user-interface.md
----------------------------------
File : framework/architecture/modularity/extending/customizing-application-modules-overriding-services.md
Url : Entities.md
File not exists: framework/architecture/modularity/extending/Entities.md
----------------------------------
File : framework/infrastructure/event-bus/distributed/index.md
Url : Local-Event-Bus.md
File not exists: framework/infrastructure/event-bus/distributed/Local-Event-Bus.md
----------------------------------

Wrong Count: 976

@EnesDONER
Copy link
Contributor Author

Hi @maliming, this pull request does not change all links. #19631 needs to be merged with this pull request. Merging with this will eliminate the problems.

@maliming maliming merged commit c240150 into abpframework:docs-unification-1 Apr 29, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants