-
Notifications
You must be signed in to change notification settings - Fork 2
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
Rockspec example added #2
base: master
Are you sure you want to change the base?
Conversation
When I fired up this template I wasn't sure whether it should be a template for a class or a package or both. I'm leaning towards both and documenting that it can be used for both or just one or the other by nuking the folder for the unused type. What you you think about adding a sample class that inherits from plain and also loads the sample template package? |
description = { | ||
summary = "A template for SILE packages...", | ||
detailed = [[]], | ||
homepage = "", -- e.g. its GitHub repo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets go ahead and fill in the blanks throughout the rockspec with working values so it can actually be built and tested from this template repo, but document each line with a -- TODO: ...
comment noting that it should be changed after initializing the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it can actually be built this way, I had no trouble in my attempts to built and run the test functions...
@alerque How you think a sample function should look like? Write something into the document: self:registerCommand("package-command", function(_, _)
SILE.call("center", {}, function()
SILE.typesetter:typeset("The template package was loaded with the class")
end)
end Or just print something in terminal? Since the purpose is just check it's working... self:registerCommand("about-this-class", function(_, content)
print("This sample class has loaded the follwing packages:")
for classname in pairs(self.packages) do
print(classname)
end
end) |
Another point is that this repo is supposed to be a template, and a template, as far as I know, should be empty, just the skeleton, right? It seems to me this is turning to be more a package-example than an actual template. Would it be better to create a branch for the examples and let the master be the template itself? Or even create a new repository only for examples. |
@@ -0,0 +1,28 @@ | |||
package = "package-template.sile" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First line should probably be rockspec_format = "3.0"
(for compatibility)
} | ||
|
||
source = { | ||
url = "", -- a clonable repository link |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took me a while to understand why some of my GitHub packages didn't work in some cases, until someone told me I had to change my initial git:
prefix to |git+https:
-- And it did the trick. So perhaps we could help the users here, with a working example (or a useful comment)
-- tag = "" | ||
} | ||
|
||
dependencies = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would show an example, and the minimal one might be:
dependencies = {
"lua >= 5.1",
}
(Assuming this repository also eventually provides an adequate .luacheckrc
and a GitHub action, this would be neat.)
|
||
function package:registerCommands() | ||
self:registerCommand("package-command", function(_, _) | ||
end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could minimally do a SILE.process(content)
in these example commands, just processing the content without change.
|
||
package.documentation = [[ | ||
\begin{document} | ||
\autodoc:package{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion (untested): Add some valid example.
E.g.
The \autodoc:package{template} package provides
a sample \autodoc:command{\package-command{<content>}} command,
which does not do anything useful.
Since the package distribution is made through luarocks this template should have a
.rockspec
file.