[all-commits] [llvm/llvm-project] 467761: [clang-doc] Allow setting a base directory for hos...

Paul Kirth via All-commits all-commits at lists.llvm.org
Mon Mar 24 17:30:37 PDT 2025


  Branch: refs/heads/users/ilovepi/clang_doc_base_dir
  Home:   https://github.com/llvm/llvm-project
  Commit: 4677619625f2c0ef56fcfdf997c35e9cb26baabf
      https://github.com/llvm/llvm-project/commit/4677619625f2c0ef56fcfdf997c35e9cb26baabf
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-03-25 (Tue, 25 Mar 2025)

  Changed paths:
    M clang-tools-extra/clang-doc/HTMLGenerator.cpp
    M clang-tools-extra/clang-doc/Representation.cpp
    M clang-tools-extra/clang-doc/Representation.h
    M clang-tools-extra/clang-doc/assets/index.js
    M clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
    M clang-tools-extra/test/clang-doc/assets.cpp
    M clang-tools-extra/test/clang-doc/test-path-abs.cpp
    M clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp

  Log Message:
  -----------
  [clang-doc] Allow setting a base directory for hosted pages

Currently, when we set URLs from JS, we set them only using the protocol
and host locations. This works fine when docs are served from the base
directory of the site, but if you want to nest it under another
directory, our JS fails to set the correct path, leading to broken
links.

This patch adds a --base option to specify the path prefix to use, which
is set in the generated index_json.js file. index.json can then fill in
the prefix appropriately when generating links in a browser. This flag
has no effect for non HTML output.

Given an index hosted at: www.docs.com/base_directory/index.html
we used to generate the following link:
    www.docs.com/file.html
Using --base base_directory we now generate:
    www.docs.com/base_directory/file.html

This allows such links to work when hosting pages without using a custom
index.js.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list