add support for forced par-like bibliography entries - #27
Open
Andrew15-5 wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
Instead of #let bibliography(sources, full: auto, style: auto, title: auto) = context {
let read = state("__report-read").get()
assert(
read != none,
message: "Apply template with `read: path => read(path)` argument",
)
let full = if full == auto { std.bibliography.full } else { full }
let style = if style == auto { std.bibliography.style } else { style }
let title = if title == auto { std.bibliography.title } else { title }
let sources = sources
show std.bibliography: none
if type(sources) != array { sources = (sources,) }
load-bibliography(sources, full: full, style: style)
pagebreak()
sources.map(path => pdf.attach(path, bytes(read(path)))).join()
sources = sources.map(read).map(bytes)
std.bibliography(sources, full: full, style: style, title: title)
context {
heading(numbering: none, title)
let (references, ..rest) = get-bibliography("x-")
let bib = (references: references, ..rest)
let gutter = v(par.spacing, weak: true)
for (i, e) in bib.references.enumerate() {
if i != 0 { gutter }
if e.prefix != none { hayagriva.render(e.prefix) + [~] }
[#metadata(none)#label(bib.prefix + e.key)]
hayagriva.render(e.reference)
}
}
}I can do #let bibliography(sources, full: auto, style: auto, title: auto) = context {
let read = state("__report-read").get()
assert(
read != none,
message: "Apply template with `read: path => read(path)` argument",
)
let full = if full == auto { std.bibliography.full } else { full }
let style = if style == auto { std.bibliography.style } else { style }
let title = if title == auto { std.bibliography.title } else { title }
let sources = sources
show std.bibliography: none
if type(sources) != array { sources = (sources,) }
load-bibliography(sources, full: full, style: style)
pagebreak()
sources.map(path => pdf.attach(path, bytes(read(path)))).join()
sources = sources.map(read).map(bytes)
std.bibliography(sources, full: full, style: style, title: title)
set heading(numbering: none)
context {
let (references, ..rest) = get-bibliography("x-")
render-bibliography(
title: title,
par-like: true,
(references: references, ..rest),
)
}
}I guess, if I also can add this to the main function, then it would be even better: #let bibliography(sources, full: auto, style: auto, title: auto) = context {
let read = state("__report-read").get()
assert(
read != none,
message: "Apply template with `read: path => read(path)` argument",
)
let full = if full == auto { std.bibliography.full } else { full }
let style = if style == auto { std.bibliography.style } else { style }
let title = if title == auto { std.bibliography.title } else { title }
let sources = sources
show std.bibliography: none
if type(sources) != array { sources = (sources,) }
pagebreak()
sources.map(path => pdf.attach(path, bytes(read(path)))).join()
sources = sources.map(read).map(bytes)
std.bibliography(sources, full: full, style: style, title: title)
set heading(numbering: none)
bibliographyx(sources, full: full, style: style, title: title, par-like: true)
}And eventually, maybe even this: #let bibliography(sources, full: auto, style: auto, title: auto) = context {
let full = if full == auto { std.bibliography.full } else { full }
let style = if style == auto { std.bibliography.style } else { style }
let title = if title == auto { std.bibliography.title } else { title }
pagebreak()
if type(sources) != array { pdf.attach(sources) } else {
sources.map(pdf.attach).join()
}
show std.bibliography: none
std.bibliography(sources, full: full, style: style, title: title)
set heading(numbering: none)
bibliographyx(sources, full: full, style: style, title: title, par-like: true)
} |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #26.
I tried this with
#import "@preview/alexandria:0.2.1": *, and it works perfectly.