strictdoc icon indicating copy to clipboard operation
strictdoc copied to clipboard

Issue with Mixing FREETEXT and REQUIREMENT in .sdoc Files

Open dahbar opened this issue 1 year ago • 5 comments

Environment

StrictDoc Version: 0.0.47 Python Version: 3.11.6

Description:

I've encountered an issue when working with .sdoc files in StrictDoc. The problem arises when I attempt to use a mix of FREETEXT and REQUIREMENT elements in a single document. It would be great if the document allowed alternating between these two types of tags, but currently, this does not seem to be supported.

Steps to Reproduce:

  1. Create a .sdoc file.

  2. Insert the following content:

[DOCUMENT]
TITLE: TestDoc

[GRAMMAR]
ELEMENTS:
- TAG: REQUIREMENT
  FIELDS:
  - TITLE: UID
    TYPE: String
    REQUIRED: True
  - TITLE: TITLE
    TYPE: String
    REQUIRED: True
  - TITLE: STATEMENT
    TYPE: String
    REQUIRED: False

[FREETEXT]
Test
[/FREETEXT]

[REQUIREMENT]
UID: TEST-0111
TITLE: T1
STATEMENT: Test

[FREETEXT]
Test
[/FREETEXT]

  1. Try to run the StrictDoc server

Error

raise self.nm
arpeggio.NoMatch: Expected Not at position ../strictdoc/TestDoc.sdoc:(30, 2) => 'T: Test  [*FREETEXT] '.

Was this intended or is there something I am missing?

dahbar avatar Dec 19 '23 12:12 dahbar

This is a known issue. Currently, the grammar of StrictDoc is hardcoded to always have free texts to be the first nodes in Document or Section. There was another user's report where they also wanted this to be more flexible.

Changing it to the way you are suggesting is easily doable, and I will prioritize it to be done this year still.

stanislaw avatar Dec 19 '23 12:12 stanislaw

One thing that could help us during the implementation:

So far I haven't seen a document where a free text would be between the surrounding requirements or a free text would be the last one in a section or a document. Could you give an example of your immediate use case?

In other words, I would like to understand which kind of information requires these in-between free texts? It doesn't have to be your real work example but something that gives me an idea. Thanks.

stanislaw avatar Dec 19 '23 21:12 stanislaw

I ran into the same issue while manually translating a pretty unstructured text document into sdoc. Something like this:

This may not happen under one of the following conditions:

  1. Situation
  2. Situation

Short sidebar discussion about 2

  1. Situation

Longer discussion about all of the above

I wanted to translate the three numbered items into requirements, and the other items into freetexts.

rosensymmetri avatar Jan 01 '24 19:01 rosensymmetri

Same use case for me. Unstructured documents some type of information in the middle between requirements or a footer with extra notes about the document.

[DOCUMENT]
TITLE: TestDoc

[GRAMMAR]
ELEMENTS:
- TAG: REQUIREMENT
  FIELDS:
  - TITLE: UID
    TYPE: String
    REQUIRED: True
  - TITLE: TITLE
    TYPE: String
    REQUIRED: True
  - TITLE: STATEMENT
    TYPE: String
    REQUIRED: False

[REQUIREMENT]
UID: TEST-0111
TITLE: T1
STATEMENT: Test

[FREETEXT]
A footer
[/FREETEXT]

dahbar avatar Jan 03 '24 13:01 dahbar

Ok, understood. Thanks @dahbar and @rosensymmetri.

@mettta and I are already discussing the implementation. I don't want to give false promises but I think we could do it within January or probably much sooner.

stanislaw avatar Jan 03 '24 13:01 stanislaw

Closed with the release: https://github.com/strictdoc-project/strictdoc/releases/tag/0.0.57. Please see the release notes.

stanislaw avatar Jun 23 '24 13:06 stanislaw