Skip to content

Doc Title in attributes->default #701

Open

Description

@obruendl

I found out that I have to set the output document title using attributes->defaults->doc->title:

settings:
  digits: 1
  itemformat: yaml
  prefix: SWLH
  sep: '-'
attributes:
  defaults:
    doc:
      title: '<my-document-title>

However, this leads to all new items having this property because it is a default. Is there any way I can set the document title in the documents YAML without having it added to all child items? IMO it is needless to replicate the title into all requirement items.

Activity

  1. thomathy007 commented on Sep 30, 2026

    @thomathy007

    This issue stems from what appears to be an oddly configured parser in
    base.py
    Line 312.

    There seems to be an inconsistency here in parsing the "doc_attributes".
    Given the items listed in "doc_attributes", such as "title" and "copyright" I assume these are intended to be global in nature for the document.

    The issue is in this call:

    attribute_defaults = obj.__getattribute__("_attribute_defaults")
    

    on line 323 which, gonna be honest, not sure how this line works, but it's trying to pull from a key list of

    attributes:
      defaults:
    

    which doesn't seem right given the "defaults" are not global.

    Before I go further, I'll admit I'm new to this tool, so take my suggestion here with a grain of salt:

    Suggestion

    It would be nice to have a clean way of passing global document values to the publisher, for example:

    Expect a .doorstop.yml format of:

    attributes: #or doc_attributes to match bottle template
      doc:
        item1: value
        item2: value
        title: "My Doc Title"
      default:
        #default items stay the same
    

    Then in our *.tpl bottle template file, we should be able to pull whatever fields we want or had defined in .doorstop.yml:

    <div class="container-xxl bd-gutter mt-3 my-md-4 bd-layout">
      <main class="bd-main order-1">
        <div class="bd-intro ps-lg-4">
          <!-- <H1>{{!doc_attributes["item1"]}}</H1> -->
          <!-- <H1>{{!doc_attributes["title"]}}</H1> -->
          {{!body}}
        </div>
      </main>
    </div>
    

    As mentioned, having to use the default key in .doorstop.yml to connect these existing variables is not ideal. I imagine the direct use of the "title" key used to function as a root attribute or directly under "doc" or "attribute", but has since been reworked and this part in base.py got missed.

  2. thomathy007 commented on Sep 30, 2026

    @thomathy007

    Hi, I'm back.

    I've found a very usable workaround:

    Define your .doorstop.yml like so using attributes and publish

    settings:
      digits: 3
      itemformat: yaml
      prefix: REQ
      sep: ''
    attributes:
      publish:
        title: "Software Requirements Specification"
        version: "2.1.0"
        author: "Engineering Team"
        project: "Project Phoenix"
    

    Key names under "publish" can be whatever you want.

    Run publish to create your template folder. Move the template folder to another location.
    Edit template/views/doorstop.tpl:
    For example, the title section:

    <div class="container-xxl bd-gutter mt-3 my-md-4 bd-layout">
      <main class="bd-main order-1">
        <div class="bd-intro ps-lg-4">
          <H1>{{document._attribute_publish["title"]}}</H1>
          {{!body}}
        </div>
      </main>
    </div>
    

    This works because the attribute, publish keys are copied to _attribute_publish in the document object. The variable you want to access is then put into the [" "] section, like I've done with title.

    Lastly, refer to your templates file when calling publish:

    doorstop publish SYS -H ./publish/SYS.html --template ./reqs/sys/template/views/doorstop.tpl
    

    Keep in mind this gets dicey as the global template will not function for Index and Traceability.
    At this point some sort of script that calls different templates for your different documents may be appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions