thibaud frere commited on
Commit
aaf7841
·
1 Parent(s): efb32fc

remove numbers if all authors are affiliated to the same entity

Browse files
app/src/components/Hero.astro CHANGED
@@ -32,6 +32,19 @@ function normalizeAuthors(input: Array<string | { name?: string; url?: string; l
32
 
33
  const normalizedAuthors: Author[] = normalizeAuthors(authors as any);
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  function stripHtml(text: string): string {
36
  return String(text || '').replace(/<[^>]*>/g, '');
37
  }
@@ -64,7 +77,7 @@ const pdfFilename = `${slugify(pdfBase)}.pdf`;
64
  <h3>Author{normalizedAuthors.length > 1 ? 's' : ''}</h3>
65
  <ul class="authors">
66
  {normalizedAuthors.map((a, i) => {
67
- const supers = Array.isArray(a.affiliationIndices) && a.affiliationIndices.length
68
  ? <sup>{a.affiliationIndices.join(',')}</sup>
69
  : null;
70
  return (
@@ -79,11 +92,19 @@ const pdfFilename = `${slugify(pdfBase)}.pdf`;
79
  {(Array.isArray(affiliations) && affiliations.length > 0) && (
80
  <div class="meta-container-cell">
81
  <h3>Affiliation{affiliations.length > 1 ? 's' : ''}</h3>
82
- <ol class="affiliations">
83
- {affiliations.map((af) => (
84
- <li value={af.id}>{af.url ? <a href={af.url} target="_blank" rel="noopener noreferrer">{af.name}</a> : af.name}</li>
85
- ))}
86
- </ol>
 
 
 
 
 
 
 
 
87
  </div>
88
  )}
89
  {(!affiliations || affiliations.length === 0) && affiliation && (
 
32
 
33
  const normalizedAuthors: Author[] = normalizeAuthors(authors as any);
34
 
35
+ // Determine if affiliation superscripts should be shown (only when there are multiple distinct affiliations referenced by authors)
36
+ const authorAffiliationIndexSet = new Set<number>();
37
+ for (const author of normalizedAuthors) {
38
+ const indices = Array.isArray(author.affiliationIndices) ? author.affiliationIndices : [];
39
+ for (const idx of indices) {
40
+ if (typeof idx === 'number') {
41
+ authorAffiliationIndexSet.add(idx);
42
+ }
43
+ }
44
+ }
45
+ const shouldShowAffiliationSupers = authorAffiliationIndexSet.size > 1;
46
+ const hasMultipleAffiliations = Array.isArray(affiliations) && affiliations.length > 1;
47
+
48
  function stripHtml(text: string): string {
49
  return String(text || '').replace(/<[^>]*>/g, '');
50
  }
 
77
  <h3>Author{normalizedAuthors.length > 1 ? 's' : ''}</h3>
78
  <ul class="authors">
79
  {normalizedAuthors.map((a, i) => {
80
+ const supers = shouldShowAffiliationSupers && Array.isArray(a.affiliationIndices) && a.affiliationIndices.length
81
  ? <sup>{a.affiliationIndices.join(',')}</sup>
82
  : null;
83
  return (
 
92
  {(Array.isArray(affiliations) && affiliations.length > 0) && (
93
  <div class="meta-container-cell">
94
  <h3>Affiliation{affiliations.length > 1 ? 's' : ''}</h3>
95
+ {hasMultipleAffiliations ? (
96
+ <ol class="affiliations">
97
+ {affiliations.map((af) => (
98
+ <li value={af.id}>{af.url ? <a href={af.url} target="_blank" rel="noopener noreferrer">{af.name}</a> : af.name}</li>
99
+ ))}
100
+ </ol>
101
+ ) : (
102
+ <p>
103
+ {affiliations[0]?.url
104
+ ? <a href={affiliations[0].url} target="_blank" rel="noopener noreferrer">{affiliations[0].name}</a>
105
+ : affiliations[0]?.name}
106
+ </p>
107
+ )}
108
  </div>
109
  )}
110
  {(!affiliations || affiliations.length === 0) && affiliation && (
app/src/content/article.mdx CHANGED
@@ -7,15 +7,9 @@ authors:
7
  - name: "Thibaud Frere"
8
  url: "https://huggingface.co/tfrere"
9
  affiliations: [1]
10
- - name: "Alice Example"
11
- url: "https://example.com/~alice"
12
- affiliations: [1, 2]
13
- - name: "Bob Researcher"
14
  affiliations:
15
  - name: "Hugging Face"
16
  url: "https://huggingface.co"
17
- - name: "Example University"
18
- url: "https://example.edu"
19
  published: "Sep. 01, 2025"
20
  doi: 10.1234/abcd.efgh
21
  licence: >
@@ -34,7 +28,6 @@ import AvailableBlocks from "./chapters/markdown.mdx";
34
  import GettingStarted from "./chapters/getting-started.mdx";
35
  import Markdown from "./chapters/markdown.mdx";
36
  import Components from "./chapters/components.mdx";
37
- import DebugComponents from "./chapters/debug-components.mdx";
38
 
39
  <Introduction />
40
 
@@ -48,4 +41,3 @@ import DebugComponents from "./chapters/debug-components.mdx";
48
 
49
  <BestPractices />
50
 
51
- <DebugComponents />
 
7
  - name: "Thibaud Frere"
8
  url: "https://huggingface.co/tfrere"
9
  affiliations: [1]
 
 
 
 
10
  affiliations:
11
  - name: "Hugging Face"
12
  url: "https://huggingface.co"
 
 
13
  published: "Sep. 01, 2025"
14
  doi: 10.1234/abcd.efgh
15
  licence: >
 
28
  import GettingStarted from "./chapters/getting-started.mdx";
29
  import Markdown from "./chapters/markdown.mdx";
30
  import Components from "./chapters/components.mdx";
 
31
 
32
  <Introduction />
33
 
 
41
 
42
  <BestPractices />
43
 
 
app/src/styles/components/_code.css CHANGED
@@ -33,12 +33,7 @@ section.content-grid pre {
33
  box-sizing: border-box;
34
  -webkit-overflow-scrolling: touch;
35
  padding: 0;
36
- }
37
-
38
- /* Consistent vertical spacing for code blocks */
39
- .astro-code,
40
- section.content-grid pre {
41
- margin: 0 0 var(--block-spacing-y);
42
  }
43
 
44
  section.content-grid pre { margin: 0; }
@@ -120,11 +115,14 @@ section.content-grid pre code {
120
 
121
  .code-card .code-copy {
122
  position: absolute;
123
- top: 6px;
124
- right: 6px;
125
  z-index: 3;
126
- padding: 6px 12px;
127
- border: none;
 
 
 
128
  }
129
 
130
  .code-card .code-copy svg {
@@ -136,20 +134,6 @@ section.content-grid pre code {
136
 
137
  .code-card pre { margin: 0 0 var(--spacing-1); }
138
 
139
- /* Discreet filetype/language label shown under the Copy button */
140
- .code-card::after {
141
- content: attr(data-language);
142
- position: absolute;
143
- top: 8px;
144
- right: 56px; /* leave room for copy button */
145
- font-size: 10px;
146
- line-height: 1;
147
- text-transform: uppercase;
148
- color: var(--muted-color);
149
- pointer-events: none;
150
- z-index: 2;
151
- }
152
-
153
  /* When no copy button (single-line), keep the label in the top-right corner */
154
  .code-card.no-copy::after { top: 8px; right: 8px; }
155
 
@@ -162,9 +146,9 @@ section.content-grid pre code {
162
  /* ============================================================================ */
163
  /* Language/extension vignette (bottom-right, discreet) */
164
  /* ============================================================================ */
165
- .astro-code::after {
166
  content: attr(data-language);
167
- position: sticky;
168
  right: 0;
169
  bottom: 0;
170
  font-size: 10px;
@@ -175,10 +159,10 @@ section.content-grid pre code {
175
  border-top: 1px solid var(--border-color);
176
  border-left: 1px solid var(--border-color);
177
  opacity: 1;
178
- border-radius: 8px 0 0 0; /* round only top-left */
179
  padding: 4px 6px;
180
  pointer-events: none;
181
- }
182
 
183
  /* Fallback if Shiki uses data-lang instead of data-language */
184
  .astro-code[data-lang]::after { content: attr(data-lang); }
 
33
  box-sizing: border-box;
34
  -webkit-overflow-scrolling: touch;
35
  padding: 0;
36
+ margin-bottom: var(--block-spacing-y) !important;
 
 
 
 
 
37
  }
38
 
39
  section.content-grid pre { margin: 0; }
 
115
 
116
  .code-card .code-copy {
117
  position: absolute;
118
+ top: var(--spacing-2);
119
+ right: var(--spacing-2);
120
  z-index: 3;
121
+ display: none;
122
+ }
123
+
124
+ .code-card:hover .code-copy {
125
+ display: block;
126
  }
127
 
128
  .code-card .code-copy svg {
 
134
 
135
  .code-card pre { margin: 0 0 var(--spacing-1); }
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  /* When no copy button (single-line), keep the label in the top-right corner */
138
  .code-card.no-copy::after { top: 8px; right: 8px; }
139
 
 
146
  /* ============================================================================ */
147
  /* Language/extension vignette (bottom-right, discreet) */
148
  /* ============================================================================ */
149
+ /* .astro-code::after {
150
  content: attr(data-language);
151
+ position: absolute;
152
  right: 0;
153
  bottom: 0;
154
  font-size: 10px;
 
159
  border-top: 1px solid var(--border-color);
160
  border-left: 1px solid var(--border-color);
161
  opacity: 1;
162
+ border-radius: 8px 0 0 0;
163
  padding: 4px 6px;
164
  pointer-events: none;
165
+ } */
166
 
167
  /* Fallback if Shiki uses data-lang instead of data-language */
168
  .astro-code[data-lang]::after { content: attr(data-lang); }