Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

jodros
Copy link

@jodros jodros commented Oct 14, 2023

Since the package distribution is made through luarocks this template should have a .rockspec file.

@alerque
Copy link
Member

alerque commented Oct 21, 2023

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
Copy link
Member

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.

Copy link
Author

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...

@jodros
Copy link
Author

jodros commented Oct 22, 2023

@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)

@jodros
Copy link
Author

jodros commented Oct 22, 2023

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.

@jodros jodros requested a review from alerque November 11, 2023 13:39
@@ -0,0 +1,28 @@
package = "package-template.sile"
Copy link
Member

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
Copy link
Member

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 = {}
Copy link
Member

@Omikhleia Omikhleia May 8, 2024

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)
Copy link
Member

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{}
Copy link
Member

@Omikhleia Omikhleia May 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants