Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e4e93e096
|
||
|
|
5b0bdf333f
|
||
|
|
a903bf0fc8
|
||
|
|
ee570f7487
|
||
|
|
ef03fdfbc4
|
||
|
|
07c8fa50f9
|
||
|
|
8da80916df
|
||
|
|
588eca1c7d | ||
|
|
7f3183bd92 | ||
|
|
3e70585ffa | ||
|
|
1230057477 | ||
|
|
60a54cccf5 |
No files matched your search
@@ -13,7 +13,7 @@ Configure `codly` with the languages. Like this:
|
||||
#import "@preview/codly:1.1.1": *
|
||||
#show: codly-init
|
||||
|
||||
#import "@preview/codly-languages:0.1.5": *
|
||||
#import "@preview/codly-languages:0.1.6": *
|
||||
#codly(languages: codly-languages)
|
||||
```
|
||||
|
||||
@@ -28,12 +28,14 @@ Some languages are still missing. All contributions welcome.
|
||||
|
||||
## Icon Attribution
|
||||
|
||||
| **Icon** | **Source** | **License** |
|
||||
| ----------------- | ---------------------------------------- | ---------------------------- |
|
||||
| `css3.svg` | [CSS-Next/logo.css][css3-source] | [CC0][css3-license] |
|
||||
| `cuda.svg` | [vscode-icons/vscode-icons][cuda-source] | [MIT][cuda-license] |
|
||||
| `lisp.svg` | [Wikipedia (User:Jooja)][lisp-source] | [CC BY-SA 4.0][lisp-license] |
|
||||
| `typst-small.png` | [Dherse/codly][typst-source] | [MIT][typst-license] |
|
||||
| **Icon** | **Source** | **License** |
|
||||
| ----------------- | --------------------------------------------- | -------------------------------- |
|
||||
| `css3.svg` | [CSS-Next/logo.css][css3-source] | [CC0][css3-license] |
|
||||
| `cuda.svg` | [vscode-icons/vscode-icons][cuda-source] | [MIT][cuda-license] |
|
||||
| `lisp.svg` | [Wikipedia (User:Jooja)][lisp-source] | [CC BY-SA 4.0][lisp-license] |
|
||||
| `nextflow.svg` | [nextflow-io/trademark][nextflow-source] | [Limited Use][nextflow-license] |
|
||||
| `splunk.svg` | [denali-design/denali-icons][splunk-source] | [MIT][splunk-license] |
|
||||
| `typst-small.png` | [Dherse/codly][typst-source] | [MIT][typst-license] |
|
||||
|
||||
[css3-source]: https://github.com/CSS-Next/logo.css/blob/main/css.svg?short_path=c59d4da
|
||||
[css3-license]: https://github.com/CSS-Next/logo.css/blob/main/LICENSE
|
||||
@@ -41,6 +43,10 @@ Some languages are still missing. All contributions welcome.
|
||||
[cuda-license]: https://github.com/vscode-icons/vscode-icons/blob/master/LICENSE
|
||||
[lisp-source]: https://commons.wikimedia.org/wiki/File:Lisp_logo.svg
|
||||
[lisp-license]: https://commons.wikimedia.org/wiki/File:Lisp_logo.svg#Licensing
|
||||
[nextflow-source]: https://github.com/nextflow-io/trademark
|
||||
[nextflow-license]: https://github.com/nextflow-io/trademark/blob/master/README.md
|
||||
[splunk-source]: https://github.com/denali-design/denali-icons/blob/master/svg/splunk.svg
|
||||
[splunk-license]: https://github.com/denali-design/denali-icons/blob/master/LICENSE.md
|
||||
[typst-source]: https://github.com/Dherse/codly
|
||||
[typst-license]: https://github.com/Dherse/codly/blob/main/LICENSE
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<svg width="251" height="251" viewBox="0 0 251 251" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0 47.0195C39.45 49.6394 71.06 81.3272 73.54 120.815H119.61C117.05 55.8589 64.93 3.64245 0 0.942627V47.0195Z" fill="#0DC09D"/>
|
||||
<path d="M73.8 131.324C71.18 170.771 39.49 202.379 0 204.859V250.926C64.96 248.366 117.18 196.249 119.88 131.324H73.8Z" fill="#0DC09D"/>
|
||||
<path d="M176.201 120.545C178.821 81.0972 210.511 49.4894 250.001 47.0095V0.942627C185.041 3.50245 132.821 55.619 130.121 120.545H176.201Z" fill="#0DC09D"/>
|
||||
<path d="M250.001 204.849C210.551 202.229 178.941 170.542 176.461 131.054H130.391C132.951 196.01 185.071 248.226 250.001 250.926V204.849Z" fill="#0DC09D"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 693 B |
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- License: MIT. Made by Denali Design: https://github.com/denali-design/denali-icons -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
|
||||
<title>splunk</title>
|
||||
<g id="Layer_2" data-name="Layer 2">
|
||||
<g id="invisible_box" data-name="invisible box">
|
||||
<rect width="48" height="48" fill="none"/>
|
||||
</g>
|
||||
<g id="Q3_icons" data-name="Q3 icons">
|
||||
<path d="M37.5,4h-27A6.5,6.5,0,0,0,4,10.5v27A6.5,6.5,0,0,0,10.5,44h27A6.5,6.5,0,0,0,44,37.5v-27A6.5,6.5,0,0,0,37.5,4ZM33.6,26.1c0,.1,0,.2-.2.3L14.7,35.8c-.1.1-.3-.1-.3-.2V30.8c0-.1,0-.2.1-.2l13.6-6.8L14.5,16.9c-.1,0-.1-.1-.1-.2V11.9c0-.1.2-.3.3-.2l18.7,9.4a.5.5,0,0,1,.2.4Z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 743 B |
@@ -87,6 +87,7 @@
|
||||
markdown: (name: "Markdown", color: rgb("#000000"), icon: __icon("markdown.svg")),
|
||||
matlab: (name: "Matlab", color: rgb("#4499dd"), icon: __icon("matlab.svg")),
|
||||
mysql: (name: "MySQL", color: rgb("#00618a"), icon: __icon("mysql.svg")),
|
||||
nextflow: (name: "Nextflow", color: rgb("#0dc09d"), icon: __icon("nextflow.svg")),
|
||||
neovim: (name: "Neovim", color: rgb("#517d37"), icon: __icon("neovim.svg")),
|
||||
nvim: (name: "Neovim", color: rgb("#517d37"), icon: __icon("neovim.svg")),
|
||||
nginx: (name: "Nginx", color: rgb("#009900"), icon: __icon("nginx.svg")),
|
||||
@@ -125,6 +126,8 @@
|
||||
shell: (name: "Shell", color: rgb("#293138"), icon: __icon("bash.svg")),
|
||||
solidity: (name: "Solidity", color: rgb("#000000"), icon: __icon("solidity.svg")),
|
||||
sol: (name: "Solidity", color: rgb("#000000"), icon: __icon("solidity.svg")),
|
||||
splunk: (name: "Splunk", color: rgb("#76a445"), icon: __icon("splunk.svg")),
|
||||
spl: (name: "Splunk", color: rgb("#76a445"), icon: __icon("splunk.svg")),
|
||||
sql: (name: "SQL", color: rgb("#f2f2f2"), icon: __icon("sql.svg")),
|
||||
sqlite: (name: "SQLite", color: rgb("#0b7fcc"), icon: __icon("sqlite.svg")),
|
||||
ssh-config: (name: "SSH", color: rgb("#231f20"), icon: __icon("ssh.svg")),
|
||||
|
||||
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
@@ -49,6 +49,7 @@
|
||||
"matlab",
|
||||
"mysql",
|
||||
"neovim",
|
||||
"nextflow",
|
||||
"nginx",
|
||||
"nim",
|
||||
"nix",
|
||||
@@ -69,6 +70,7 @@
|
||||
"sass",
|
||||
"scala",
|
||||
"solidity",
|
||||
"splunk",
|
||||
"sql",
|
||||
"sqlite",
|
||||
"ssh-config",
|
||||
@@ -135,6 +137,7 @@ Found all base languages!
|
||||
"sh",
|
||||
"shell",
|
||||
"sol",
|
||||
"spl",
|
||||
"ssh",
|
||||
"styl",
|
||||
"tf",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "codly-languages"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
entrypoint = "lib.typ"
|
||||
authors = ["Stephen Waits <steve@waits.net>"]
|
||||
license = "MIT"
|
||||
|
||||
@@ -41,7 +41,7 @@ different goals:
|
||||
### Import the package
|
||||
|
||||
```typst
|
||||
#import "@preview/glossy:0.5.2": *
|
||||
#import "@preview/glossy:0.6.0": *
|
||||
```
|
||||
|
||||
### Defining Glossary Terms
|
||||
@@ -143,6 +143,7 @@ Available modifiers:
|
||||
- **short**: Shows only short form
|
||||
- **long**: Shows only long form
|
||||
- **def** or **desc**: Shows the description
|
||||
- **noref** or **noindex**: Don't show the term in the glossary.
|
||||
- **a** or **an**: Include the article (`an` is just an alias of `a`, they're
|
||||
equivalent)
|
||||
|
||||
@@ -160,6 +161,9 @@ Modifiers can be combined with colons:
|
||||
| `@tps:short:pl` | "TPSes" |
|
||||
| `@tps:both:pl:cap` | "Technical procedure specifications (TPSes)" |
|
||||
| `@tps:def` | "A formal document describing test steps and expected results" |
|
||||
| `@tps:desc` | _same as above, `desc` is an alias for `def`_ |
|
||||
| `@tps:noref` | _works as normal, just won't show up in glossary_ |
|
||||
| `@tps:noindex` | _same as above, `noindex` is an alias for `noref`_ |
|
||||
|
||||
The `a`/`an` modifier is special because it can either precede or follow the
|
||||
term's key.
|
||||
@@ -180,6 +184,18 @@ For example:
|
||||
Note that the `a`/`an` (article) modifier cannot be combined with the `pl`
|
||||
(plural) modifier.
|
||||
|
||||
### First use logic
|
||||
|
||||
Any use of the `short`, `long`, or `both` modifier will not count against the
|
||||
term's first use.
|
||||
|
||||
This is useful, for example, when you want to use a term in a heading or a
|
||||
caption. In that case, your term might end up in an `outline()` at the top of
|
||||
your document. Normally you don't want that to count as a term's first real use.
|
||||
Normally you want that to happen in the body of your document. So, by using
|
||||
these modifiers in such situations, you can not only specify exactly how you
|
||||
want your term to appear, but also control whether it counts as a "first use".
|
||||
|
||||
### Generating the Glossary
|
||||
|
||||
Display the glossary using the `glossary()` function:
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#let __gloss_entries = state("__gloss_entries", (:))
|
||||
|
||||
#let __gloss_label_prefix = "__gloss:"
|
||||
#let __gloss_first_use_counter_postfix = ":first-use-count"
|
||||
|
||||
// Normalizes a dictionary entry by ensuring all required and optional keys exist
|
||||
// with appropriate default values.
|
||||
@@ -129,11 +130,14 @@
|
||||
// Returns:
|
||||
// none: Updates state as a side effect
|
||||
//
|
||||
#let __mark_term_used(key) = {
|
||||
#let __mark_term_used(key, count-as-first-use) = {
|
||||
counter(__gloss_label_prefix + key).step()
|
||||
if count-as-first-use {
|
||||
counter(__gloss_label_prefix + key + __gloss_first_use_counter_postfix).step()
|
||||
}
|
||||
}
|
||||
|
||||
// Queries the term usage
|
||||
// Queries whether the term is used ANYWHERE
|
||||
//
|
||||
// Parameters:
|
||||
// key (string): The glossary entry key
|
||||
@@ -142,12 +146,29 @@
|
||||
// Returns:
|
||||
// boolean: If the entry is used above the location in the document
|
||||
//
|
||||
#let __is_term_used(key, location: none) = {
|
||||
#let __is_term_ever_used(key, location: none) = {
|
||||
let c = counter(__gloss_label_prefix + key)
|
||||
c = if location == none {c.final()} else {c.at(location)}
|
||||
c.at(0) > 0
|
||||
}
|
||||
|
||||
// Queries whether the term has been "first used"
|
||||
//
|
||||
// "First used" is used to determine how to display the term, either "long
|
||||
// (short)" or just "(short)"
|
||||
//
|
||||
// Parameters:
|
||||
// key (string): The glossary entry key
|
||||
// location (location): The location in the document. Use none for end of document
|
||||
//
|
||||
// Returns:
|
||||
// boolean: If the entry is used above the location in the document
|
||||
//
|
||||
#let __is_term_first_used(key, location: none) = {
|
||||
let c = counter(__gloss_label_prefix + key + __gloss_first_use_counter_postfix)
|
||||
c = if location == none {c.final()} else {c.at(location)}
|
||||
c.at(0) > 0
|
||||
}
|
||||
|
||||
// Determine if the glossary contains a visible entry
|
||||
//
|
||||
@@ -216,8 +237,12 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Manage term usage counting and determine if it's the first reference
|
||||
// ---------------------------------------------------------------------------
|
||||
let is_first_use = not __is_term_used(key, location: here())
|
||||
__mark_term_used(key)
|
||||
let is_first_use = not __is_term_first_used(key, location: here())
|
||||
let count-as-first-use = ("short" not in modifiers and "long" not in modifiers and "both" not in modifiers)
|
||||
let wants_reference = ("noref" not in modifiers and "noindex" not in modifiers)
|
||||
if wants_reference {
|
||||
__mark_term_used(key, count-as-first-use)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Helper Functions
|
||||
@@ -342,15 +367,20 @@
|
||||
} else {
|
||||
term
|
||||
}
|
||||
[#article#show-term(linked-term)#metadata(term)#__term_label(key)]
|
||||
// |^^^^^^^|^^^^^^^^^ |^^^^^^^^ |^^^^^^^^^^^^
|
||||
// \_art. | | |
|
||||
let term-label = if wants_reference {
|
||||
__term_label(key)
|
||||
} else {
|
||||
[]
|
||||
}
|
||||
[#article#show-term(linked-term)#metadata(term)#term-label]
|
||||
// |^^^^^^^|^^^^^^^^^ |^^^^^^^^ |^^^^^^^^^^^^
|
||||
// \_art. | | |
|
||||
// \_ apply user formatting function to the term
|
||||
// | |
|
||||
// \_ metadata lets us label (ie it's "labelable")
|
||||
// |
|
||||
// \_ i.e. <__gloss:key>, etc.
|
||||
// for backlink from glossary
|
||||
// | |
|
||||
// \_ metadata lets us label (ie makes it "labelable")
|
||||
// |
|
||||
// \_ i.e. <__gloss:key>, etc.
|
||||
// for backlink from glossary
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,7 +584,7 @@
|
||||
// Collect and organize entries by group
|
||||
let output = (:)
|
||||
let all_entries = __gloss_entries.final()
|
||||
let all_used = all_entries.keys().filter(key => __is_term_used(key))
|
||||
let all_used = all_entries.keys().filter(key => __is_term_ever_used(key))
|
||||
|
||||
// Determine which groups to process
|
||||
let all_groups = all_entries
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Inspired by academic textbook glossaries
|
||||
#let theme-academic = (
|
||||
section: (title, body) => {
|
||||
set text(font: "New Computer Modern")
|
||||
heading(level: 1, title)
|
||||
v(1em)
|
||||
body
|
||||
|
||||
|
Before Width: | Height: | Size: 479 KiB After Width: | Height: | Size: 489 KiB |
|
Before Width: | Height: | Size: 844 KiB After Width: | Height: | Size: 884 KiB |
@@ -47,6 +47,8 @@ Now make sure I get @tps:a:SHORT report by 2pm! @an:tps:cap is very important!!!
|
||||
[`@tps:both:pl:cap`], [@tps:both:pl:cap],
|
||||
[`@tps:def` ], [@tps:def],
|
||||
[`@tps:desc` ], [@tps:desc],
|
||||
[`@tps:noref` ], [@tps:noref *(not listed in glossary)*],
|
||||
[`@tps:noindex` ], [@tps:noindex *(not listed in glossary)*],
|
||||
)
|
||||
|
||||
== Adding articles via `a`/`an` modifiers
|
||||
|
||||
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 139 KiB |
|
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 184 KiB After Width: | Height: | Size: 179 KiB |
|
After Width: | Height: | Size: 55 KiB |
@@ -0,0 +1,26 @@
|
||||
#import "/lib.typ": *
|
||||
|
||||
// Our test glossary
|
||||
#show: init-glossary.with((
|
||||
Normal: "this is a normal term",
|
||||
NoRef: "this term is noref'd",
|
||||
NoIndex: "this term is noindex'd",
|
||||
NoRefNoIndex: "this term is noref'd and noindex'd",
|
||||
))
|
||||
|
||||
// Configure styling
|
||||
|
||||
#set page(margin: 1em)
|
||||
#set page(width: 3.5in)
|
||||
#set page(height: auto)
|
||||
#set text(size: 10pt)
|
||||
|
||||
@Normal
|
||||
|
||||
@NoRef:noref
|
||||
|
||||
@NoIndex:noindex
|
||||
|
||||
@NoRefNoIndex:noref:noindex
|
||||
|
||||
#glossary()
|
||||
|
After Width: | Height: | Size: 674 KiB |
@@ -0,0 +1,82 @@
|
||||
#import "/lib.typ": *
|
||||
|
||||
// Our test glossary
|
||||
#show: init-glossary.with((
|
||||
ShortInHeader: "short used in header",
|
||||
ShortInCaption: "short used in caption",
|
||||
LongInHeader: "long used in header",
|
||||
LongInCaption: "long used in caption",
|
||||
BothInHeader: "both used in header",
|
||||
BothInCaption: "both used in caption",
|
||||
NormalInHeader: "unmodified use in header",
|
||||
NormalInCaption: "unmodified use in caption",
|
||||
))
|
||||
|
||||
// Configure styling
|
||||
|
||||
#set page(numbering: "1")
|
||||
#set page(margin: 0.5in)
|
||||
#set page(height: auto)
|
||||
#set text(size: 10pt)
|
||||
|
||||
// Outlines
|
||||
|
||||
#outline(title:"Table of Contents", indent: auto)
|
||||
#outline(title: "List of Figures", target: figure.where(kind: image))
|
||||
#block(
|
||||
height:7em,
|
||||
glossary(title: "List of Abbreviations", theme: theme-twocol)
|
||||
)
|
||||
|
||||
#line(length: 100%)
|
||||
|
||||
// Doc Body
|
||||
|
||||
// Use all the terms in headings
|
||||
#heading(level: 1, outlined: false, [Use terms in HEADERS])
|
||||
|
||||
=== `@ShortInHeader:short` = "@ShortInHeader:short"
|
||||
=== `@LongInHeader:long` = "@LongInHeader:long"
|
||||
=== `@BothInHeader:both` = "@BothInHeader:both"
|
||||
=== `@NormalInHeader` = "@NormalInHeader"
|
||||
|
||||
#line(length: 100%)
|
||||
|
||||
// Use all the terms in captions
|
||||
#heading(level: 1, outlined: false, [Use terms in CAPTIONS])
|
||||
|
||||
#figure([], caption: [`@ShortInCaption:short` = "@ShortInCaption:short"])
|
||||
#figure([], caption: [`@LongInCaption:long` = "@LongInCaption:long"])
|
||||
#figure([], caption: [`@BothInCaption:both` = "@BothInCaption:both"])
|
||||
#figure([], caption: [`@NormalInCaption` = "@NormalInCaption"])
|
||||
|
||||
#line(length: 100%)
|
||||
|
||||
// Now use the terms in the body to see if they handle "first use" correctly
|
||||
#heading(level: 1, outlined: false, [Use terms in BODY])
|
||||
|
||||
First `@ShortInHeader` = "@ShortInHeader".
|
||||
Second `@ShortInHeader` = "@ShortInHeader"
|
||||
|
||||
First `@LongInHeader` = "@LongInHeader".
|
||||
Second `@LongInHeader` = "@LongInHeader".
|
||||
|
||||
First `@BothInHeader` = "@BothInHeader".
|
||||
Second `@BothInHeader` = "@BothInHeader".
|
||||
|
||||
First `@NormalInHeader` = "@NormalInHeader".
|
||||
Second `@NormalInHeader` = "@NormalInHeader".
|
||||
|
||||
#v(0.5em)
|
||||
|
||||
First `@ShortInCaption` = "@ShortInCaption".
|
||||
Second `@ShortInCaption` = "@ShortInCaption"
|
||||
|
||||
First `@LongInCaption` = "@LongInCaption".
|
||||
Second `@LongInCaption` = "@LongInCaption".
|
||||
|
||||
First `@BothInCaption` = "@BothInCaption".
|
||||
Second `@BothInCaption` = "@BothInCaption".
|
||||
|
||||
First `@NormalInCaption` = "@NormalInCaption".
|
||||
Second `@NormalInCaption` = "@NormalInCaption".
|
||||
|
Before Width: | Height: | Size: 651 KiB After Width: | Height: | Size: 651 KiB |
|
Before Width: | Height: | Size: 651 KiB After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 332 KiB After Width: | Height: | Size: 117 KiB |
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "glossy"
|
||||
version = "0.5.2"
|
||||
version = "0.6.0"
|
||||
entrypoint = "lib.typ"
|
||||
authors = ["Stephen Waits <steve@waits.net>"]
|
||||
license = "MIT"
|
||||
|
||||