15 Commits

Author SHA1 Message Date
Paul Kirth
d4dc5712c4
[clang-doc] Allow setting a base directory for hosted pages (#132482)
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.
2025-03-28 12:49:43 -07:00
Paul Kirth
3fbc9b9efc
[clang-doc] Correct improper file paths in HTML output (#132103)
In index.js the logic of the ternary operator was backwards, preventing
us from generating the correct file paths, or relative paths in the HTML
output.
2025-03-20 14:11:42 -07:00
PeterChou1
91450f1b57
[clang-doc] switched from using relative to absolute paths (#93281)
fixes https://github.com/llvm/llvm-project/issues/92867

This patches changes the way clang-doc index navigation works,
previously it was based a relative path approach, this approach is error
prone and lead to wrong paths for the anchor tag. The new navigation way
is based on absolute paths and should work and be less confusing
codewise.
Because the differences with serving over a http server and viewing via
file system I also added export a RootPath variable to the index_json.js
file
2024-07-25 03:33:02 -04:00
PeterChou1
a9b1e80acb
[clang-doc] add async loading (#93276)
Fixes https://github.com/llvm/llvm-project/issues/93273

This patch changes the way clang-doc loads html indexes. Previously
clang-doc loaded the index via an index_json.js file which uses
JSON.parse to parse the file. This patches changes that to use an async
function called LoadIndex which enables asynchronous loading making the
initial page load not be blocked by loading a large JavaScript object.
2024-06-30 08:52:36 -07:00
Petr Hosek
7003f64c1e [clang-doc] Improving Markdown Output
This change has two components. The moves the generated file
for a namespace to the directory named after the namespace in
a file named 'index.<format>'. This greatly improves the browsing
experience since the index page is shown by default for a directory.

The second improves the markdown output by adding the links to the
referenced pages for children objects and the link back to the source
code.

Patch By: Clayton

Differential Revision: https://reviews.llvm.org/D72954
2020-03-06 17:37:08 -08:00
Petr Hosek
ea086d10ce Revert "[clang-doc] Improving Markdown Output"
This reverts commit 45499f3801d8a00919deaf38c801885d8e75b942, it's
still failing on Windows bots.
2020-03-04 16:00:22 -08:00
Petr Hosek
45499f3801 [clang-doc] Improving Markdown Output
This change has two components. The moves the generated file
for a namespace to the directory named after the namespace in
a file named 'index.<format>'. This greatly improves the browsing
experience since the index page is shown by default for a directory.

The second improves the markdown output by adding the links to the
referenced pages for children objects and the link back to the source
code.

Patch By: Clayton

Differential Revision: https://reviews.llvm.org/D72954
2020-03-04 14:42:07 -08:00
Petr Hosek
7b627bb6e0 Revert "[clang-doc] Improving Markdown Output"
This reverts commit dac21fdd5923730342a4bc9abc0858fb56ff8d52 as this
is failing on Windows.
2020-02-07 19:43:47 -08:00
Petr Hosek
dac21fdd59 [clang-doc] Improving Markdown Output
This change has two components. The moves the generated file
for a namespace to the directory named after the namespace in
a file named 'index.<format>'. This greatly improves the browsing
experience since the index page is shown by default for a directory.

The second improves the markdown output by adding the links to the
referenced pages for children objects and the link back to the source
code.

Patch By: Clayton

Differential Revision: https://reviews.llvm.org/D72954
2020-02-07 19:17:03 -08:00
Petr Hosek
80e63c17c0 Revert "[clang-doc] Improving Markdown Output"
This reverts commit 0fbaf3a7c2395d751cfa4ecd7f483f077b03d9bd as tests
are failing on some bots.
2020-02-03 12:27:09 -08:00
Petr Hosek
0fbaf3a7c2 [clang-doc] Improving Markdown Output
This change has two components. The moves the generated file
for a namespace to the directory named after the namespace in
a file named 'index.<format>'. This greatly improves the browsing
experience since the index page is shown by default for a directory.

The second improves the markdown output by adding the links to the
referenced pages for children objects and the link back to the source
code.

Patch By: Clayton

Differential Revision: https://reviews.llvm.org/D72954
2020-02-03 12:14:17 -08:00
Petr Hosek
c0f475f2e3 Revert "[clang-doc] Improving Markdown Output"
This reverts commit deae8ee6916711b9b20f73fc1a350c3a034d5b34 as it
broke the build on several bots.
2020-01-31 14:30:42 -08:00
Petr Hosek
deae8ee691 [clang-doc] Improving Markdown Output
This change has two components. The moves the generated file
for a namespace to the directory named after the namespace in
a file named 'index.<format>'. This greatly improves the browsing
experience since the index page is shown by default for a directory.

The second improves the markdown output by adding the links to the
referenced pages for children objects and the link back to the source
code.

Patch By: Clayton

Differential Revision: https://reviews.llvm.org/D72954
2020-01-31 14:21:21 -08:00
Diego Astiazaran
3550da79ec [clang-doc] Redesign of generated HTML files
The new design includes a header (contains the project name), a main section, and a footer.
The main section is divided into three subsections. Left, middle, right. The left section contains the general index, the middle contains the info's data, and the right contains the index for the info's content.
The CSS has been updated.
A flag --project-name is added.
The Attributes attribute of the TagNode struct is now a vector of pairs because these attributes should be rendered in the insertion order.
The functions (cpp and js) that converts an Index tree structure into HTML were slightly modified; the first ul tag created is now a ol tag. The inner lists are still ul.

Differential Revision: https://reviews.llvm.org/D66353

llvm-svn: 369139
2019-08-16 18:38:11 +00:00
Diego Astiazaran
7dfe0bc3c1 [clang-doc] Add index in each info html file
An index structure is created while generating the output file for each
info. This structure is parsed to JSON and written to a file in the
output directory. The html for the index is not rendered by clang-doc. A
Javascript file is included in the output directory, this will the JSON
file and insert HTML elements into the file.

Differential Revision: https://reviews.llvm.org/D65690

llvm-svn: 368070
2019-08-06 18:31:46 +00:00