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

Cleanup of models and data #476

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
93dd3f9
Schematron now reports duplicate definitions in a Metaschema as an er…
wendellpiez Aug 23, 2019
9e60b9d
Catalog metaschema and SP800-53 catalog adjustments renaming 'subcont…
wendellpiez Aug 23, 2019
19d26a9
Refactored metaschemas to avoid definition clashes; more/better Schem…
wendellpiez Aug 26, 2019
4091793
Adding new module now required by catalog and profile metaschemas
wendellpiez Aug 26, 2019
9f59ed0
Revising profiles to be valid to newly revised schema (no more refere…
wendellpiez Aug 26, 2019
d9a3d49
Bug fix in Metaschema Schematron
wendellpiez Aug 26, 2019
d878367
Delete FedRAMP_HIGH-baseline_profile.xml
brian-ruf Aug 21, 2019
385d4aa
Delete FedRAMP_LOW-baseline_profile.xml
brian-ruf Aug 21, 2019
6725714
Delete FedRAMP_MODERATE-baseline_profile.xml
brian-ruf Aug 21, 2019
20154cd
Create temp.txt
brian-ruf Aug 21, 2019
4f54335
Revised FedRAMP Profiles
brian-ruf Aug 21, 2019
10c4037
Delete temp.txt
brian-ruf Aug 22, 2019
a3eaa09
moved updated fedramp content to correct location
david-waltermire Aug 26, 2019
a3391b1
Merge pull request #8 from david-waltermire-nist/wendellpiez-issue473…
wendellpiez Aug 26, 2019
290dd3b
New and improved FedRAMP profiles
wendellpiez Aug 26, 2019
20c18c3
Repaired broken markdown conversion; added missing title content to F…
wendellpiez Aug 27, 2019
3095afb
add note about b -> strong and i -> em (#9)
david-waltermire Aug 27, 2019
9785bcb
Changed inline markup in FedRAMP profiles for lossless conversion
wendellpiez Aug 27, 2019
8994105
One more adjustment in Markdown->XML conversion (images)
wendellpiez Aug 27, 2019
f87472e
One more time (cleaning up cleanup)
wendellpiez Aug 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 44 additions & 15 deletions build/metaschema/json/md-oscal-converter.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<xsl:param name="target-ns" as="xs:string?">http://csrc.nist.gov/ns/oscal/1.0</xsl:param>

<xsl:template name="xsl:initial-template" match="/">
<!--<xsl:copy-of select="$tag-replacements"/>-->
<!--<xsl:copy-of select="$examples"/>-->
<xsl:call-template name="parse">
<xsl:with-param name="markdown-str" select="string($examples)"/>
Expand Down Expand Up @@ -85,10 +86,12 @@
<xsl:variable name="flat-structures">
<xsl:apply-templates select="$rough-blocks" mode="mark-structures"/>
</xsl:variable>
<!--<xsl:copy-of select="$flat-structures"/>-->
<!-- for debugging <xsl:copy-of select="$flat-structures"/>-->

<xsl:variable name="nested-structures">
<xsl:apply-templates select="$flat-structures" mode="build-structures"/>
</xsl:variable>
<!-- for debugging <xsl:copy-of select="$nested-structures"/>-->

<xsl:variable name="fully-marked">
<xsl:apply-templates select="$nested-structures" mode="infer-inlines"/>
Expand Down Expand Up @@ -239,10 +242,11 @@
<xsl:param name="group" select="m:li"/>

<xsl:variable name="this-type" select="$group[1]/@type"/>
<!-- first, splitting ul from ol groups -->
<xsl:for-each-group select="$group" group-starting-with="*[@level = $level and not(@type = preceding-sibling::*/@type)]">
<xsl:element name="m:{ $group[1]/@type }" namespace="http://csrc.nist.gov/ns/oscal/1.0/md-convertor">
<xsl:for-each-group select="current-group()" group-starting-with="li[@level = $level]">
<!--first, splitting ul from ol groups -->
<!--<xsl:for-each-group select="$group" group-starting-with="*[@level = $level and not(@type = preceding-sibling::*[1]/@type)]">-->
<!--<xsl:for-each-group select="$group" group-starting-with="*[@level = $level]">-->
<xsl:element name="m:{ $group[1]/@type }" namespace="http://csrc.nist.gov/ns/oscal/1.0/md-convertor">
<xsl:for-each-group select="$group" group-starting-with="m:li[(@level = $level) or not(@type = preceding-sibling::*[1]/@type)]">
<xsl:choose>
<xsl:when test="@level = $level (: checking first item in group :)">
<m:li>
Expand All @@ -269,7 +273,7 @@
</xsl:choose>
</xsl:for-each-group>
</xsl:element>
</xsl:for-each-group>
<!--</xsl:for-each-group>-->
</xsl:template>

<xsl:template match="m:pre//text()" mode="infer-inlines">
Expand Down Expand Up @@ -363,10 +367,10 @@

<q>"<text/>"</q>

<img alt="!\[{{$text}}\]" src="\({{$text}}\)"/>
<img alt="!\[{{$noclosebracket}}\]" src="\({{$nocloseparen}}\)"/>
<insert param-id="\{{\{{{{$nws}}\}}\}}"/>

<a href="\[{{$text}}\]">\(<text/>\)</a>
<a href="\[{{$nocloseparen}}\]">\(<text not="\)"/>\)</a>
<code>`<text/>`</code>
<strong>
<em>\*\*\*<text/>\*\*\*</em>
Expand Down Expand Up @@ -402,6 +406,14 @@
<xsl:value-of select="replace(., '\{\$text\}', '(.*)?')"/>
</xsl:template>

<xsl:template match="@*[matches(., '\{\$nocloseparen\}')]" mode="write-match">
<xsl:value-of select="replace(., '\{\$nocloseparen\}', '([^\\(]*)?')"/>
</xsl:template>

<xsl:template match="@*[matches(., '\{\$noclosebracket\}')]" mode="write-match">
<xsl:value-of select="replace(., '\{\$noclosebracket\}', '([^\\[]*)?')"/>
</xsl:template>

<xsl:template match="@*[matches(., '\{\$nws\}')]" mode="write-match">
<!--<xsl:value-of select="."/>-->
<!--<xsl:value-of select="replace(., '\{\$nws\}', '(\S*)?')"/>-->
Expand Down Expand Up @@ -435,6 +447,16 @@
<xsl:text>(.*?)</xsl:text>
</xsl:template>

<xsl:template match="m:text[@not]" mode="write-match">
<xsl:text expand-text="true">([^{ @not }]*?)</xsl:text>
</xsl:template>

<!--<xsl:template match="m:text" mode="write-match">
<xsl:variable name="match-char"
select="if (matches(@not,'\S')) then ('[' || @not || ']') else '.'"/>
<xsl:text expand-text="true">({ $match-char }*?)</xsl:text>
</xsl:template>-->

<xsl:variable name="line-example" xml:space="preserve"> { insertion } </xsl:variable>

<xsl:variable name="examples" xml:space="preserve">
Expand All @@ -448,10 +470,11 @@ Paragraph, \n\nand new paragraph
Bit of `code` here and there, such as one might have along with *italics*.

no insertion here: { ac-4.4_prm_2 }


An anchor looks like [this](this.file) or [that](that.file)

Extra long x
y and z
y and z **strong** and **bold**


Here's a text with a *parameter* insertion: {{ insert }}
Expand All @@ -465,7 +488,7 @@ And many paragraphs!
* One item in a list, with "quoted text"
* Another item in a list
* Sublist
* subsublist
* subsublist
* Item three

```xml
Expand All @@ -474,6 +497,8 @@ And many paragraphs!
... select ...>
```

Some paragraphs have ![images](http://www.links.com) in them, sometimes ![many](../many/links)

And Prose!

```
Expand All @@ -496,10 +521,14 @@ And stuff.

</p>
<p>Here's a markdown string.</p>
<p>This `string should *break` (overlap)*</p>
<p>`code` may occasionally turn up `in the middle`.</p>
<p>Here's a ***really interesting*** markdown string.</p>
<p>Some paragraphs might have [links elsewhere](https://link.org).</p>

<p>This `string should *break` (overlap)*</p>

<p>`code` may occasionally turn up `in the middle`.</p>

<p>Here's a ***really interesting*** markdown string.</p>

<p>Some paragraphs might have [links elsewhere](https://link.org).</p>
</xsl:variable>

</xsl:stylesheet>
7 changes: 3 additions & 4 deletions build/metaschema/lib/metaschema-check.sch
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<xsl:key name="invocation-by-ref" match="m:assembly[exists(@ref)] | m:field[exists(@ref)] | m:flag[exists(@ref)]" use="@ref"/>
<xsl:key name="flags-by-name" match="m:define-flag | m:flag[@name]" use="@name"/>


<sch:ns uri="http://csrc.nist.gov/ns/oscal/metaschema/1.0" prefix="m"/>

<xsl:variable name="example-ns" select="'http://csrc.nist.gov/ns/oscal/example'"/>
Expand All @@ -37,17 +36,17 @@
<!-- grouping name can't be the same as the name
group-as is present whenever not(@max-occurs = 1) -->
<sch:pattern>

<sch:rule context="m:define-assembly | m:define-field | m:define-flag">
<sch:assert role="warning" test="count(key('definition-by-name',@name)) = 1">Definition for '<sch:value-of select="@name"/>' is not unique in this metaschema module (only the last one found will be used)</sch:assert>
<!-- $compleat assembles all definitions from all modules (in metaschema-compose.xsl) -->
<sch:let name="contenders" value="key('definition-by-name',@name,$compleat)"/>
<sch:assert role="warning" test="count( $contenders ) = 1">Definition for '<sch:value-of select="@name"/>' is not unique in this metaschema; cf <xsl:value-of select="$contenders/../@module" separator=", "/>.</sch:assert>
<sch:assert test="exists(m:formal-name)">formal-name missing from <sch:name/></sch:assert>
<sch:assert test="exists(m:description)">description missing from <sch:name/></sch:assert>
<sch:assert test="empty(self::m:define-assembly) or exists(m:model)">model missing from <sch:name/></sch:assert>
<sch:assert test="not(@as-type='boolean') or empty(m:flag)">Property defined as boolean may not have flags.</sch:assert>
<sch:assert test="not(key('invocation-by-ref',@name)/m:group-as/@json-behavior='BY_KEY') or exists(m:json-key)"><sch:value-of select="substring-after(local-name(),
'define-')"/> is assigned a json key, but no 'json-key' is given</sch:assert>
<sch:report test="@name=('RICHTEXT','STRVALUE','PROSE')">Names "STRVALUE", "RICHTEXT" or "PROSE" (reserved names)</sch:report>

</sch:rule>

<sch:rule context="m:json-key">
Expand Down
2 changes: 2 additions & 0 deletions docs/content/documentation/schemas/datatypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ The following table describes the equavalent constructs in HTML and Markdown use
| Ordered List Item | &lt;ol&gt;&lt;li&gt;*text*&lt;/li&gt;&lt;/ol&gt; | 1. *text*
| Unordered List Item | &lt;ul&gt;&lt;li&gt;*text*&lt;/li&gt;&lt;/ul&gt; | - *text*

Note: Markdown does not have an equivalent of the HTML &lt;i&gt; and &lt;b&gt; tags, which indicate italics and bold respectively. These concepts are mapped in OSCAL markup text to &lt;em&gt; and &lt;strong&gt; [common mark](https://spec.commonmark.org/0.29/#emphasis-and-strong-emphasis), which render equivalently in browsers, but do not have exactly the same semantics. While this mapping is imperfect, it represents the common uses of these HTML tags.

#### Parameter Insertion

The OSCAL catalog, profile, and implementation layer models allow for control parameters to be defined and injected into prose text.
Expand Down
Loading