SOFTWARE-CLINIC/featurebook-html

View on GitHub
lib/META-INF/html/feature.pug

Summary

Maintainability
Test Coverage
mixin printStep(step)
  div.featurebook-step
    span.featurebook-step-keyword= step.keyword
    span.featurebook-step-text= step.text
      if step.argument && step.argument.type == 'DataTable'
        table.featurebook-data-table
          each row in step.argument.rows
            tr
              each cell in row.cells
                td= cell.value
      if step.argument && step.argument.type == 'DocString'
        pre.featurebook-doc-string= step.argument.content

doctype html
html
  head
    title #{metadata.title} #{metadata.version}
    style
      include stylesheet.css

  body
    div.featurebook-container
      include _metadata.pug
      include _spec-tree.pug

      main.featurebook-main
        div.featurebook-feature-name #{feature.keyword}: #{feature.name}

        div.featurebook-feature-description.featurebook-markdown !{feature.description}

        if feature.background
          div.featurebook-background
            div.featurebook-background-name #{feature.background.keyword}: #{feature.background.name}
            each step in feature.background.steps
              +printStep(step)

        each scenarioDefinition in feature.scenarioDefinitions
          div.featurebook-scenario-definition
            each tag in scenarioDefinition.tags
              div.featurebook-tag= tag.name
            div.featurebook-scenario-definition-name= scenarioDefinition.keyword + ': ' + scenarioDefinition.name
            div !{scenarioDefinition.description}
            each step in scenarioDefinition.steps
              +printStep(step)

            if scenarioDefinition.examples
              each example in scenarioDefinition.examples
                div.featurebook-examples
                  div.featurebook-examples-name= example.keyword + ': ' + example.name
                  table.featurebook-data-table
                    tr
                      each cell in example.tableHeader.cells
                        th= cell.value
                    each row in example.tableBody
                      tr
                        each cell in row.cells
                          td= cell.value