Update Run CM2 docs#1172
Conversation
|
|
@paigem following my question on Zulip about the redesign of ACCESS-Hive docs, @heidinett has shown me this PR. I have a few comments after working on the Rose/Cylc and Payu pages.
|
|
@paigem @heidinett Reading the docs, I think we could use the Snippets sections feature. This way, we could have the payu instructions, for example, in a single file, and use snippet sections to add the information bits by bits to the Run a Model pages. This would prevent a proliferation of include files, hence, solving the filenaming issue, make it easier to find the information for payu for developers of the documentation and making sure the information between several snippets is coherent. I'm pretty sure I saw the same functionality with Macros. Macros and Snippets seem pretty interchangeable for include files. I think I'd rather keep the Macros usage to real macro/templating cases, but there is no real justification to this choice. |
I agree. Therefore, I think macros works better in most cases.
I think the only feature that snippets allows and macros doesn't is the possibility to reference a particular "section" of an included file. However, I am not in favor of this choice for some reasons:
|
It's interesting because I think totally the opposite in terms of ease of maintenance. To me, it seems keeping information coherent across related but separate files would be harder than when the bits and pieces are together in the same file. And I like the non-proliferation of files... But I have no experience either way, so this opinion is only based on a feeling. |
Your point about coherence makes sense. For the framework to use, I would still vouch for using macros in all cases. In our case, for example, if we want to allow the inclusion of only subsections (e.g. only some specific lines) of an include file, we can create a custom macro in the import os
def define_env(env):
@env.macro
def include_lines(path, start_line=None, end_line=None):
include_dir = env.config.get('include_dir') or env.conf['docs_dir']
full_path = os.path.join(include_dir, path)
with open(full_path, 'r') as f:
lines = f.readlines()
start = (start_line - 1) if start_line else None
end = end_line if end_line else None
content = ''.join(lines[start:end])
return env.render(sliced)And then use it as {{ include_lines("path/to/file", <start>, <end> }}This is only a quick example I made with AI, but we could extend this by being able to select paragraphs instead of lines, or we could do almost anything we'd like. |
ACCESS-Hive Docs
Description
This PR is meant as a test for trying out some ideas of how we could update the Run ACCESS-CM2 (and potentially similar) pages. So for now this is just a draft PR.
First, I am testing how the documentation looks with expandable sections. Later I may try a few other things, and will add a comment to indicate what I test.