-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(renderer): version-label not honored
This supports the version-label be changed, or even reset for document attributes. To support resetting this label, the initial value is located in the Predefined attributes, and a reset of the attribute is stored as a nil attribute value instead of deleting it from the attributes. This allows us to distinguish a reset as an override. This approach will be used for other predefined text values in follow ups. Fixes #710
- Loading branch information
Showing
10 changed files
with
119 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,6 +173,92 @@ a paragraph` | |
)).To(MatchHTMLTemplate(expected, now)) | ||
}) | ||
|
||
It("with author and version label reset", func() { | ||
source := `= Document Title | ||
Joe Blow <[email protected]> | ||
1.5, May 21, 1999 | ||
:version-label!: | ||
a paragraph` | ||
expected := `<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | ||
<head> | ||
<meta charset="UTF-8"/> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
<meta name="generator" content="libasciidoc"/> | ||
<meta name="author" content="Joe Blow"/> | ||
<title>Document Title</title> | ||
</head> | ||
<body class="article"> | ||
<div id="header"> | ||
<h1>Document Title</h1> | ||
<div class="details"> | ||
<span id="author" class="author">Joe Blow</span><br/> | ||
<span id="email" class="email"><a href="mailto:[email protected]">[email protected]</a></span><br/> | ||
<span id="revnumber">1.5,</span> | ||
<span id="revdate">May 21, 1999</span> | ||
</div> | ||
</div> | ||
<div id="content"> | ||
<div class="paragraph"> | ||
<p>a paragraph</p> | ||
</div> | ||
</div> | ||
</body> | ||
</html>` | ||
Expect(RenderXHTML(source, | ||
configuration.WithHeaderFooter(true), | ||
configuration.WithLastUpdated(now), | ||
configuration.WithAttributes(map[string]string{ | ||
types.AttrNoFooter: "", | ||
}), | ||
)).To(MatchHTMLTemplate(expected, now)) | ||
}) | ||
|
||
It("with author and custom version label only", func() { | ||
source := `= Document Title | ||
Joe Blow <[email protected]> | ||
1.0, May 21, 1999 | ||
:version-label: Edition | ||
a paragraph` | ||
expected := `<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | ||
<head> | ||
<meta charset="UTF-8"/> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
<meta name="generator" content="libasciidoc"/> | ||
<meta name="author" content="Joe Blow"/> | ||
<title>Document Title</title> | ||
</head> | ||
<body class="article"> | ||
<div id="header"> | ||
<h1>Document Title</h1> | ||
<div class="details"> | ||
<span id="author" class="author">Joe Blow</span><br/> | ||
<span id="email" class="email"><a href="mailto:[email protected]">[email protected]</a></span><br/> | ||
<span id="revnumber">Edition 1.0,</span> | ||
<span id="revdate">May 21, 1999</span> | ||
</div> | ||
</div> | ||
<div id="content"> | ||
<div class="paragraph"> | ||
<p>a paragraph</p> | ||
</div> | ||
</div> | ||
</body> | ||
</html>` | ||
Expect(RenderXHTML(source, | ||
configuration.WithHeaderFooter(true), | ||
configuration.WithLastUpdated(now), | ||
configuration.WithAttributes(map[string]string{ | ||
types.AttrNoFooter: "", | ||
}), | ||
)).To(MatchHTMLTemplate(expected, now)) | ||
}) | ||
|
||
It("without header and with footer", func() { | ||
source := `= Document Title | ||
|
@@ -238,6 +324,5 @@ a paragraph` | |
}), | ||
)).To(MatchHTMLTemplate(expected, now)) | ||
}) | ||
|
||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,5 +34,6 @@ func init() { | |
"two-colons": "::", | ||
"two-semicolons": ";", | ||
"cpp": "C++", | ||
AttrVersionLabel: "version", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters