-
Notifications
You must be signed in to change notification settings - Fork 92
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
Feat/507 add citation field #2023
base: master
Are you sure you want to change the base?
Changes from all commits
2036cd4
8bc6005
01b87ab
2fd7790
720924b
2a38427
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,9 +14,18 @@ | |
</div> | ||
|
||
<div class="meta"> | ||
<h2 class="heading">{{ $store.state.recipe.name }}</h2> | ||
<div class="heading"> | ||
<h2 class="mb-0">{{ $store.state.recipe.name }}</h2> | ||
<p v-if="$store.state.recipe.citation"> | ||
{{ | ||
// TRANSLATORS Indicates citation/source of recipe. Ex. "by Grandma Betty" | ||
t('cookbook', 'by') | ||
}} | ||
<span>{{ $store.state.recipe.citation }}</span> | ||
Comment on lines
+20
to
+24
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. This is not a good way to handle this wrt i10n. In other languages, it might not be in the pattern static text plus name. So, this might be better delegated to the translators. 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. Strictly speaking, you are right. I made this decision to allow different styles for the word "by" and the source string, which might even become an HTML element later on, like
But it would be better to translate the whole string including the citation variable, then HTML-escaping the citation, string-replacing the citation in the translated string with the html-escaped one (plus any additional styling, linking, etc) and using v-html in a span. Maybe there is a simpler method that I don't know of? 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. How about something like Theoretically, one could fall back to |
||
</p> | ||
</div> | ||
<div class="details"> | ||
<div v-if="recipe.keywords.length"> | ||
<div v-if="recipe.keywords.length" class="mb-3"> | ||
<ul v-if="recipe.keywords.length"> | ||
<RecipeKeyword | ||
v-for="(keyword, idx) in recipe.keywords" | ||
|
@@ -816,6 +825,14 @@ export default { | |
</script> | ||
|
||
<style lang="scss" scoped> | ||
.mb-0 { | ||
margin-bottom: 0 !important; | ||
} | ||
|
||
.mb-3 { | ||
margin-bottom: 0.75rem !important; | ||
} | ||
|
||
.wrapper { | ||
width: 100%; | ||
} | ||
|
@@ -873,6 +890,7 @@ export default { | |
|
||
.heading { | ||
margin-top: 12px; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.dates { | ||
|
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 am not so sure about this usage of the
citation
field. According to the schema.org standard, This field seems inappropriate according to the definition of this field:This does not match the use case, especially with the Grandma Betty placeholder content. How about using
author
or thecreator
fied.I find it hard to quickly merge this PR now and soon have to create some sort of migration/fix that changes the code a posteriori.
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.
The "not so sure" part is true for the other fields to. So thank you for initiating the discussion!
According to schema.org the
author
andcreator
fields are the sameHowever, I tend towards the creator being the one that creates the recipe in the cookbook, i.e., the Nextcloud user (analog to the fact that the
dateCreated
field is the non-user-configurable date the recipe was created, and not the date when grandma invented the recipe). This could become relevant when real sharing of cookbooks, recipes, collections, ... between users becomes a thing. It would allow filtering recipes by the user who entered the recipe in the cookbook app. As usual, we could store this info outside of the JSON ...On the other hand, what I, as a creator, am doing when creating the recipe is citing "My grandma", who told me about the list of ingredients and steps to take, but not necessarily the exact wording of each instruction, or the exact format for entering ingredients. I also might add some more comments on how grandma used to watch birds in the front yard while stirring the sauce but still cite her because she originally had the idea.
I do see the point though, that when I want to cite
the approach with "by XXX" falls a bit short and the
creator
(orauthor
) field would make it much clearer what to expect from it, i.e., the "by XXX" syntax could be expected.One option would be to get rid of the word "by" and leave it up to the user to format the string to be shown using Markdown, which would also immediately allow linking. However my idea of moving the
url
property to a href of the citation to clean up the UI when viewing a recipe would then be off the table. I think, it's the usual consideration configurability vs. cleanness/ease of use.Wrapping up, I see how both options have advantages and disadvantages. I'm looking forward for your opinion ;)
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.
The general problem I see is the distinction in schema.org between a natural person/organization and a third (creative) work. The former is referencable by
author
/creator
, while the latter is referenced bycitation
. In my understanding, these associations are mutually exclusive in some sort.How about the following idea: We could have both fields (
citation
andauthor
). One could be used as a source (in the sense of a reference), that would be acitation
, while Grandma's best recipes could be declared usingauthor
. Would that work?Of course, the UI must be thought through here as well. We would have 4 cases (no field, either field is set, or both fields are set). If none is set, we are at status quo. With one field set, your approach might work well (by author or from citation for example). With both present, we could think about it but I would then go with by author and add a reference later on like the URL source currently.