symfony-tools/docs-builder

Next/Prev links not generated for some content

javiereguiluz opened this issue · 6 comments

As reported here: symfony/symfony-docs#19075

The create_framework/* pages don't display a next/prev pager because when building docs with this project, the next and prev items in the generated JSON file are null.

Note that pagination is generated successfully for other contents of Symfony Docs. So, this feature is fully working, except for some particular contents.

This is the RST source of the failing content: https://github.com/symfony/symfony-docs/tree/6.4/create_framework

Thanks!

I've debugged the issue.

In this line:

$next = $this->determineNext($parserFilename, $flattenedTocTree, $masterDocument);

For create_framework docs, the arguments are like this:

$parserFileName = "create_framework/http_kernel_httpkernelinterface"

$flattenedTocTree = array:186 [
  0 => "index"
  1 => "getting_started/index"
  2 => "setup"
  3 => "setup/docker"
  4 => "setup/homestead"
  5 => "setup/web_server_configuration"
  6 => "setup/bundles"
  7 => "setup/file_permissions"
  8 => "setup/flex"
  9 => "setup/flex_private_recipes"
  10 => "setup/symfony_server"
  11 => "setup/unstable_versions"
  12 => "setup/upgrade_major"
  13 => "setup/upgrade_minor"
  14 => "setup/upgrade_patch"
  15 => "page_creation"
  16 => "introduction/from_flat_php_to_symfony"
  17 => "introduction/http_fundamentals"
  18 => "routing"
  19 => "routing/custom_route_loader"
  // ...
  177 => "validation/raw_values"
  178 => "validation/sequence_provider"
  179 => "validation/severity"
  180 => "validation/translations"
  181 => "web_link"
  182 => "webhook"
  183 => "workflow"
  184 => "workflow/workflow-and-state-machine"
  185 => "workflow/dumping-workflows"
];

So, the problem is that we only pass the general TOC tree of the entire Symfony Docs and not the specific TOC tree of the carete_framework/ "book".

Sadly, I have no idea how to solve this. Hopefully someone can help us here. Thanks!

🧙

The answer is finally simple, but like you, i lost a lot of time there digging 😅

In the end, it's "just" a problem of missing links / relative URLs.

What i understand is that the TocTree is fully computed.. from the root.

On the root index.rst file, i believe there is a glitch that make the included links not "root relative" and then ignored in the TocTree.

If you replace the include with a toctree, it works! (in the fjson generated files, the prev & next values are now set)

Want to create your own framework based on Symfony?

- .. include:: /create_framework/map.rst.inc
+ .. toctree::
+    :maxdepth: 2
+
+    create_framework/index

Other exemple: the page "security/access_token" as no prev/next too because it's not linked from the security.rst file (bottom of the page).

:)

So, should we just not fix this bug and make the change you proposed in the RST Docs?

I think you should try (if not already done) and it will then be easier to isolate what is related to configuration, bugs, tree structure, etc.

Feel free to poke me if you need/want on this :)

I'm closing this as "fixed" because the change that Simon proposed is working and the docs now display the Next/Prev links. See https://symfony.com/doc/current/create_framework/introduction.html