-
Notifications
You must be signed in to change notification settings - Fork 25
quarto: adjust manifest construction #554
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
Data models | ||
""" | ||
|
||
import os | ||
import pathlib | ||
import re | ||
|
||
import fnmatch | ||
|
@@ -163,6 +163,7 @@ class GlobMatcher(object): | |
""" | ||
|
||
def __init__(self, pattern): | ||
pattern = pathlib.PurePath(pattern).as_posix() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 for |
||
if pattern.endswith("/**/*"): | ||
# Note: the index used here makes sure the pattern has a trailing | ||
# slash. We want that. | ||
|
@@ -185,7 +186,8 @@ def _to_parts_list(pattern): | |
:return: a list of pattern pieces and the index of the special '**' pattern. | ||
The index will be None if `**` is never found. | ||
""" | ||
parts = pattern.split(os.path.sep) | ||
# Incoming pattern is ALWAYS a Posix-style path. | ||
parts = pattern.split("/") | ||
depth_wildcard_index = None | ||
for index, name in enumerate(parts): | ||
if name == "**": | ||
|
@@ -197,10 +199,12 @@ def _to_parts_list(pattern): | |
return parts, depth_wildcard_index | ||
|
||
def _match_with_starts_with(self, path): | ||
path = pathlib.PurePath(path).as_posix() | ||
return path.startswith(self._pattern) | ||
|
||
def _match_with_list_parts(self, path): | ||
parts = path.split(os.path.sep) | ||
path = pathlib.PurePath(path).as_posix() | ||
parts = path.split("/") | ||
|
||
def items_match(i1, i2): | ||
if i2 >= len(parts): | ||
|
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
Oops, something went wrong.
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.
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.
Do we not need to set
primary_rmd
?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.
It's not used by Connect for Quarto content, today.
With R Markdown and Jupyter content, we tell the tool the specific file that we want to render, and the output file is written to the
.index
file.This path only applies for projects, and we want to always rely on the Quarto discovery rules in that case. Only projects have the
config.project.render
structure in the output fromquarto inspect
.For Quarto standalone documents, there is a stronger case for communicating the primary document/entrypoint. Connect currently transforms content into a project and then has Quarto use its default discovery rules. If the primary file is deployed along with secondary Markdown files, those would need to be named
_filename.md
to be ignored during rendering. Otherwise, Quarto could render bothprimary.qmd
anddo-not-render.qmd
. They could also deploy a_quarto.yml
file alongside the file, and deploy it as a simple "project". Both of those options feel OK, right now.We may want to eventually annotate the manifest with
metadata.entrypoint
, but I'd like to see if we can avoid it.