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

Policy and/or guidance on labels for Source Code Blocks #37

Open
ghobona opened this issue Nov 30, 2022 · 8 comments
Open

Policy and/or guidance on labels for Source Code Blocks #37

ghobona opened this issue Nov 30, 2022 · 8 comments
Assignees
Labels

Comments

@ghobona
Copy link
Contributor

ghobona commented Nov 30, 2022

There is a request for DocTeam policy and/or guidance on labels for Source Code Blocks.

metanorma/metanorma-ogc#461

Background:

  • The asciidoctor-based template supported the use of Listing labels on source code blocks.
  • The metanorma-based template offers the use of Figure labels on source code blocks.

Cc: @jechterhoff @ronaldtse

@ronaldtse
Copy link

Thanks @ghobona .

Here are some patterns I notice from other SDOs:

In ISO and IEC:

  • Source code blocks are considered to be Figures (the only numbered document elements are Figures and Tables)
  • If the source code block is considered "inline", they can be unnumbered (i.e. no caption, no number)
  • There is an unspoken rule with ISO Editors that unnumbered source code blocks are allowed, but are discouraged

In NIST and ITU:

  • Source code blocks are typically unnumbered, and cannot be uniquely referenced.

@jechterhoff
Copy link

Unnumered code blocks or snippets are certainly needed. In addition, for the more important code blocks, an editor may wish to make them easily accessible - i.e., findable and referenceable, the latter especially when used within the same document. That is why an auto-numbered label is needed, I think.

Thus far, I've seen and used the label "Listing" for such cases. But maybe that is not a commonly accepted writing "style"? When searching on the Web it was hard to find guidance on source code labeling in documents. However, I've come across examples of equations receiving an extra "Equation" label within a scientific document, rather than just being labeled as "Figure". Imho, it would make sense to allow a distinct label for source code blocks in OGC documents, and likewise for other "kinds of things", such as equations.

@ronaldtse
Copy link

In most SDOs, e.g. ISO, "Equations" is indeed a type of document element labelled separately. (I clearly missed that in my last comment).

One thing that warrant explanation is that a "Figure" is broader than just an "image". Figures are actually containers that can contain:

  • legend, keys and labels
  • units
  • notes
  • paragraphs of text

However, I do agree that source code and pseudocode can warrant another label type.

@ogcscotts
Copy link
Contributor

will add a topic to the DocTeam to discuss code block and equations and not mandating numbering. There are cases where equations may need to be numbered for reference, so the rule should permit numbering where required for context.

@ogcscotts
Copy link
Contributor

DocTeam 23 April 2024 discussion: recommend that blocks be labelled and inline not labelled, but the recommendation is not formal policy and can be ignored at the editor's discretion.

@jechterhoff
Copy link

@ogcscotts Is label "Listing" allowed, too?

@jechterhoff
Copy link

@ogcscotts Nevermind - I just saw the comment from Gobe, that "Listing" is allowed now.

@ogcscotts
Copy link
Contributor

Document templates need to be updated to reflect this guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants