Skip to content

Commit

Permalink
improved cheatsheet ascii renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
juerg committed Mar 21, 2024
1 parent 695f362 commit 0bfe481
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
import com.github.jlangch.venice.impl.util.io.IOStreamUtil;
import com.github.jlangch.venice.impl.util.markdown.Markdown;
import com.github.jlangch.venice.impl.util.markdown.renderer.html.HtmlRenderer;
import com.github.jlangch.venice.impl.util.markdown.renderer.text.TextRenderer;
import com.github.jlangch.venice.javainterop.AcceptAllInterceptor;
import com.lowagie.text.pdf.PdfReader;

Expand Down Expand Up @@ -375,21 +376,25 @@ private List<MarkdownDoc> getMarkdownTopics() {

topics.add(new MarkdownDoc(
"Recursion",
new TextRenderer().softWrap(120).render(loadVeniceDocMarkdown("recursion-doc.md")),
new HtmlRenderer().render(loadVeniceDocMarkdown("recursion-doc.md")),
"concepts.recursion"));

topics.add(new MarkdownDoc(
"Destructuring",
new TextRenderer().softWrap(120).render(loadVeniceDocMarkdown("destructuring-doc.md")),
new HtmlRenderer().render(loadVeniceDocMarkdown("destructuring-doc.md")),
"concepts.destructuring"));

topics.add(new MarkdownDoc(
"VeniceDoc",
new TextRenderer().softWrap(120).render(loadVeniceDocMarkdown("venice-doc.md")),
new HtmlRenderer().render(loadVeniceDocMarkdown("venice-doc.md")),
"venicedoc"));

topics.add(new MarkdownDoc(
"Markdown",
new TextRenderer().softWrap(120).render(loadVeniceDocMarkdown("markdown-doc.md")),
new HtmlRenderer().render(loadVeniceDocMarkdown("markdown-doc.md")),
"markdown"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ public class MarkdownDoc {

public MarkdownDoc(
final String title,
final String docMarkdown,
final String docMarkdownTextStyled,
final String docMarkdownXmlStyled,
final String id
) {
this.title = title;
this.docMarkdown = docMarkdown;
this.docMarkdownTextStyled = docMarkdownTextStyled;
this.docMarkdownXmlStyled = docMarkdownXmlStyled;
this.id = id;
}

Expand All @@ -39,8 +41,12 @@ public String getTitle() {
return title;
}

public String getDocMarkdown() {
return docMarkdown;
public String getDocMarkdownTextStyled() {
return docMarkdownTextStyled;
}

public String getDocMarkdownXmlStyled() {
return docMarkdownXmlStyled;
}

public String getId() {
Expand Down Expand Up @@ -75,6 +81,7 @@ public boolean equals(Object obj) {


private final String title;
private final String docMarkdown;
private final String docMarkdownTextStyled;
private final String docMarkdownXmlStyled;
private final String id;
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,42 +136,51 @@ ${ ) }$



5. Function Details
5. Topics
--------------------------------------------------------------------------------

${ (doseq [it topics] }$
${= (:title it) }$

${= (:docMarkdownTextStyled it) }$


${ ) }$




6. Function Details
--------------------------------------------------------------------------------


${ (doseq [it details] }$
${ (when (:id it) }$

Function name: ${= (:name it) }$

Argument list:
${ (when (not-empty? (:signatures it)) }$
Argument list:
${ (doseq [sig (:signatures it)] }$
${= sig }$
${ ) }$
${= sig }$ ${ ) }$
${ ) }$

Description:
${ (when (not-empty? (:description it)) }$
${= (:description it) }$
${ ) }$


Description: ${ (when (not-empty? (:description it)) }$
${= (:description it) }$ ${ ) }$
${ (when (not-empty? (:descriptionTextStyled it)) }$
${= (:descriptionTextStyled it) }$
${ ) }$
${= (:descriptionTextStyled it) }$ ${ ) }$


Examples:
${ (when (not-empty? (:examples it)) }$
Examples:
${ (doseq [code (:examples it)] }$
${= code }$
${ ) }$
${ ) }$
${ ) }$ ${ ) }$

${ (when (not-empty? (:crossRefs it)) }$
See also:
${ (doseq [{:keys [name]} (:crossRefs it)] }$
${= name }$${ ) }$
${= name }$ ${ ) }$
${ ) }$
${ ) }$
${ ) }$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ <h1>${= (kira/escape-xml (:title it)) }$</h1>
<div class="venicedoc">
<div class="venicedoc-frame">
<div class="venicedoc-body">
${= (:docMarkdown it) }$
${= (:docMarkdownXmlStyled it) }$
</div>
</div>
</div>
Expand Down

0 comments on commit 0bfe481

Please sign in to comment.