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

Exclude submenu and TOC items for excluded folders. #106

Conversation

bobneuman
Copy link

This is a PR to fix #76 by inspecting for the presence of child items within a section before adding to the TOC and Menu.

@bobneuman
Copy link
Author

Given a sample site dir below, I needed to generate a pdf for a manual. The exclude left a number of empty sections (a bug). At first I used the exclude, but that presumes we'll stay abreast of new folders to exclude. I replicated the option from the enum-headings for include and fixed the empty sections. The manual still had the parent structure. Printing Operations resulted an index that included References, Guides, Operations. The print_docs_dir resets the root of the process to provide a clean TOC.

-docs
|-Ops
|-Logistics
| |-Hardware
| | |-data
| | |-data_guidance.md
| | |-data.csv
| |-Software
| | |-data
| | |-data_guidance.md
| | |-data.csv
|-References
| |-Guides
| | |-Quick Start
| | | |-Intro.md
| | | |-Setup.md
| | | |-data
| | | |-data_guidance.md
| | | |-data.csv
| | |-Operations
| | | |-Intro.md
| | | |-Startup.md
| | | |-Backups.md
| | | |-Maintenance.md
| | | |-data
| | | |-data_guidance.md
| | | |-data.csv

I'll eventually need a print for multiple docs and will need to update on_config to use an an array of print_docs_dir folders, page names, and other data.
References/Guides/Quick Start , print_quick_start, potentially (customer cover pages and header/footer)
References/Guides/Quick Start , print_operations, potentially (customer cover pages and header/footer)

@bobneuman bobneuman closed this Jun 13, 2024
@timvink
Copy link
Owner

timvink commented Jun 13, 2024

I havent had the chance to take a look yet. Any reason why you closed this PR? Looks like you put in quite some effort

@bobneuman
Copy link
Author

bobneuman commented Jun 13, 2024

The eventuality I mentioned above arrived. I addressed the big parts yesterday and a quick test this morning. The change allows all the normal "config" inputs to be used as it is now, but if a "pages_to_print" is defined those become global settings that can be overwritten by page level configs. I still need to do some tests, annotate the docs/user guide, and research feeding the variables that are in the config for the page to the .tpl. Right now my tpl is using {{ config.extra.print_title }} and I need to modify env.globals = {"config": self.mkdocs_config, "page": self.print_page} in renderer.py to add the page information.

  - print-site:
      add_cover_page: true
      cover_page_template: "docs/assets/cover_page_policy.tpl"
      add_table_of_contents: true
      add_print_site_banner: false
      pages_to_print:
      - page_name: 'print_policy_page'
        config:
          - add_table_of_contents: true
          - add_print_site_banner: false
          - print_page_title: "Policy and Procedures"
          - print_docs_dir: "Reference/Policies"
      - page_name: 'print_presales'
        config:
          - add_table_of_contents: false
          - add_print_site_banner: true
          - print_page_title: "Pre Sales Onboarding Guide"
          - print_docs_dir: "Reference/Pre Sales Onboarding Guide"
      - page_name: 'print_service_catalog'
        config:
          - add_cover_page: true
          - add_table_of_contents: true
          - add_print_site_banner: false
          - print_page_title: "Service Catalog"
          - print_docs_dir: "Reference/Service Catalog"

@bobneuman
Copy link
Author

Tim, I resubmitted under #108 last month.

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.

Excluding directory does not exclude submenu
2 participants