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

Static site generation: Ant task for previewing articles #38

Draft
wants to merge 323 commits into
base: encoding_workflow
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
323 commits
Select commit Hold shift + click to select a range
6fbbf56
Reduce code duplication w/ new "transform-with-sorting" template
amclark42 Feb 16, 2024
3d03f57
Add search capability, take 3, step 1:
sydb Feb 19, 2024
16b60d3
Add UVEPSS metadata to HTML head elements
sydb Feb 19, 2024
7e1f681
bug fix: forgot namespace decls.
sydb Feb 19, 2024
e0f1a2d
Basically working UVEPSS version with some extant problems
sydb Feb 22, 2024
918afff
Build file tweaks:
sydb Feb 24, 2024
6abcd61
put IDs on all output HTML elements
sydb Feb 24, 2024
c5c2c36
Add StaticSearch:
sydb Feb 24, 2024
f025945
Added a new "explore" page
juliaflanders Mar 6, 2024
a13f6de
Update explore.html
juliaflanders Mar 6, 2024
3efe28d
Use just "satticSearch", expecting that that will be symlinked to wha…
sydb Mar 10, 2024
8019edc
first pass at hardcoded recommendations for SPECTER and Keywords
joelsjlee Mar 14, 2024
d987b1d
Add Saxon HE processor JAR (v11.5)
amclark42 Apr 3, 2023
3234d2d
Create Apache Ant buildfile.
amclark42 Apr 3, 2023
45ca0e1
Alter XSLT to be run outside Cocoon.
amclark42 Apr 3, 2023
273658c
Add Saxon HE licenses
amclark42 Apr 4, 2023
c3e92c5
Add "compressStatic" task and stub for generating HTML articles
amclark42 Apr 4, 2023
f532482
Add XSLT to parse the TOC and generate static HTML for articles
amclark42 Apr 4, 2023
7ec0720
Run generate_static_articles.xsl using the Ant buildfile.
amclark42 Apr 4, 2023
0804b28
Small tweaks, mostly to comments
amclark42 Apr 4, 2023
b0de402
Use file separator Ant property for OS-agnostic processing.
amclark42 Apr 24, 2023
cc47c49
Add missing xmlresolver and jline JARs
amclark42 May 1, 2023
934c754
Add "checkXmlResolver" Ant build target.
amclark42 May 2, 2023
66cbb3f
Build out "generateSite" task.
amclark42 May 5, 2023
862de6e
Comment out call to external Ant build file.
amclark42 May 12, 2023
ec9b734
With @amclark42 start developing real ANT output
sydb May 22, 2023
de9e871
Add "zipPreviewArticle" task to the Ant build file.
amclark42 Jun 2, 2023
75595a7
Tweak name of ZIP file
amclark42 Jun 2, 2023
0ca52a3
Small edits to comments.
amclark42 Jun 6, 2023
4958882
Fix paths when generating static article HTML
amclark42 Jun 6, 2023
93eaf0c
Set up a second property for the static directory path.
amclark42 Jun 6, 2023
1e0394c
With Ash make minor fixes to static site generation such that it now …
sydb Jun 6, 2023
1a5a90f
Add `$doProofing` parameter to get around TOC check on articles.
amclark42 Jun 7, 2023
b8d4f8f
With @amclark42, generate individual issue indices.
sydb Jun 8, 2023
96fd68d
Get fpath right (we think), and generate main index page, too. —Syd &…
sydb Jun 15, 2023
52eb0cd
Change name of generation routine to "issue" (from "article") because…
sydb Jul 3, 2023
79dde76
Generate bios along with issue articles
sydb Jul 3, 2023
974d128
More DRY maps
amclark42 Jul 3, 2023
4c1912c
Tweak how maps for transforms are handled (including moving filename …
sydb Jul 3, 2023
b2e2224
Update some comments; small code tweaks
amclark42 Jul 3, 2023
5f29cbf
Add `dhq:set-filesystem-path()` to further reduce duplicated code
amclark42 Jul 3, 2023
10a79fb
Handle articles that appear in 2+ issues (000109).
amclark42 Jul 4, 2023
19bf9a9
Remove ".xhtml" files from preview ZIPs
amclark42 Jul 11, 2023
4c74578
First crack at 'help' target documenting other targets
sydb Aug 7, 2023
bf65d9e
Add metadata-insertion routine for experimentations with UVic Endings…
sydb Sep 14, 2023
198b711
Update insert-metas-for-staticSearch routine to use collection().
sydb Sep 16, 2023
a637d7d
Escape a back-slash directory separator in regex
amclark42 Nov 1, 2023
9d3dbe1
Handle backslashes by modifying the results of dhq:set-filesystem-path()
amclark42 Nov 1, 2023
c120d8e
Check if forward-slashes are okay for dir-separators in Windows
amclark42 Nov 1, 2023
ed37f2d
Download a local copy of XHTML DTD to keep from slamming W3C server.
amclark42 Nov 2, 2023
e7cfccc
Remove `$dir-separator` from generate_static_issues.xsl.
amclark42 Nov 21, 2023
c14102c
Add a file mapper to put article XML in the issue directory.
amclark42 Nov 21, 2023
1d84127
Ensure that the URLs at the bottom of the page are accurate.
amclark42 Dec 8, 2023
e2fac6d
Generate the Atom news feed
amclark42 Jan 22, 2024
54abba5
Create favicon.ico.base64
jawalsh Feb 5, 2024
b6eeb93
Add base64 versions of site images
jawalsh Feb 12, 2024
a808c10
Embedd css, js, images directly in html output
jawalsh Feb 12, 2024
b9337e2
Embed images directly in html output
jawalsh Feb 12, 2024
93cb6dc
Generate exactly one previous version of an article.
amclark42 Feb 5, 2024
8249abc
Zip up stable articles in XML format, for About page.
amclark42 Feb 6, 2024
78a58f4
Add an explanatory comment to the derived Ant build file.
amclark42 Feb 6, 2024
1ff3d35
Saxon updates:
sydb Feb 9, 2024
c882a33
Add preview/index.html and preview/bios.html.
amclark42 Feb 16, 2024
59b7f8c
Add indexes of DHQ articles and authors.
amclark42 Feb 16, 2024
d6b76d7
Reduce code duplication w/ new "transform-with-sorting" template
amclark42 Feb 16, 2024
156029e
Add search capability, take 3, step 1:
sydb Feb 19, 2024
4af5e49
Add UVEPSS metadata to HTML head elements
sydb Feb 19, 2024
8f02f84
bug fix: forgot namespace decls.
sydb Feb 19, 2024
0fff056
Basically working UVEPSS version with some extant problems
sydb Feb 22, 2024
7a40292
Build file tweaks:
sydb Feb 24, 2024
3350ea9
put IDs on all output HTML elements
sydb Feb 24, 2024
bf91ecc
Add StaticSearch:
sydb Feb 24, 2024
8840d7b
Use just "satticSearch", expecting that that will be symlinked to wha…
sydb Mar 10, 2024
fdac62a
dunno; git told me to pull after a rebase
sydb Mar 17, 2024
fad2164
Minor changes to "head" file & template:
sydb Mar 20, 2024
8945c5d
Prep file for future changes:
sydb Mar 21, 2024
c8a4c6e
Further simplify handling of vol # w/o 0s
sydb Mar 21, 2024
b73663a
A bit more clean-up prior to languagization
sydb Mar 22, 2024
e809b69
Even a bit *more* clean-up prior to languagization
sydb Mar 22, 2024
d580435
Handle xml:lang —
sydb Mar 23, 2024
2e80f3f
Add lang srch & swap iss & vol:
sydb Mar 24, 2024
f9995cb
In broad terms seems to be a working version
sydb Mar 29, 2024
73ab5e0
Grab whatever has happened in main
sydb Apr 3, 2024
8c6818c
Grab latest from static_site_generation
sydb Apr 3, 2024
6b7f8fb
remove a snippet of debugging code
sydb Apr 3, 2024
1f528be
Minor configuration changes:
sydb Apr 21, 2024
23b41d4
Merge branch 'main' into static_site_generation
amclark42 Apr 29, 2024
38c347f
Grab latest from the static
sydb Apr 29, 2024
bbb073e
Remove cruft preview files pre-indexing:
sydb May 7, 2024
5229e6d
Add DHQ function and refactor code, add third set of recommendations
joelsjlee May 9, 2024
431153d
Merge branch 'main' into static_site_generation
amclark42 May 9, 2024
afd9536
changes to comments
sydb May 10, 2024
de5b94d
latest from static_site_generation, itself recently merged from main
sydb May 10, 2024
db1c91f
Update explore.html
juliaflanders May 13, 2024
d62e497
Search output tweaks:
sydb May 13, 2024
e22d322
Update .gitignore
jawalsh May 13, 2024
8beb473
Update from UVEPSS 1.4.5 to 1.4.7
sydb May 13, 2024
72e5c41
I am not at all sure ...
sydb May 13, 2024
847dd36
fix a tags to have relative urls and put recommendation tsvs in data/…
joelsjlee May 14, 2024
9ad7904
Merge branch 'static_site_generation' of https://github.com/Digital-H…
joelsjlee May 14, 2024
1119d86
Merge branch 'add_recommendations' into static_site_generation
joelsjlee May 15, 2024
6a256c9
connect explore.html page to the recommendation box
joelsjlee May 15, 2024
0c167ed
change recommendation box color for better contrast with links, short…
joelsjlee May 15, 2024
48b1882
Add 404 and 500 error pages to static site.
amclark42 May 17, 2024
dfdd940
Create search.html
jawalsh May 20, 2024
cde2d99
Update head.xsl
jawalsh May 20, 2024
46330b2
Delete obsolete code.
jawalsh May 20, 2024
1f256e5
Add process to generate dhq-flavored advanced search page.
jawalsh May 20, 2024
568e61b
replace new tsvs, edit the indexing of the xslt pull from the tsv to …
joelsjlee May 21, 2024
47c461d
update tsv rec file to remove id 664
joelsjlee May 22, 2024
f5df700
change index comments to match new tsv, add some additional comments
joelsjlee May 22, 2024
3d5de3f
Merge branch 'main' into static_site_for-merging
amclark42 May 23, 2024
6473971
Merge branch 'main' into static_site_for-merging
amclark42 May 24, 2024
c995f93
Prepare to generate preview version of the site.
amclark42 May 28, 2024
08b72a8
Adjust the styling of "preview": white text with a black outline
amclark42 May 28, 2024
2faa52c
"Preview" -> "Proofing"
amclark42 May 28, 2024
bfd575e
Set up new Ant build target, "makeProofingSite".
amclark42 May 28, 2024
7e41d56
Remove unnecessary `@inheritall` on antcall
amclark42 May 28, 2024
17d25cf
Comment out noisy XSL message
amclark42 May 28, 2024
f1bd6d7
Generate index and bios pages for the "Internal Preview" area
amclark42 May 28, 2024
3826ded
Transform articles in "editorial" section into HTML
amclark42 May 28, 2024
05f7724
Restructure template in toc.xsl; add parameter to control noise.
amclark42 May 28, 2024
7b18112
Use new function to generate lists of recommendations.
amclark42 May 29, 2024
da95426
Fix variable used to generate keyword recommendations
amclark42 May 29, 2024
3484e97
Implement CSS suggestions for readability
amclark42 May 29, 2024
1f0752a
Include "explore" HTML in the static site build.
amclark42 May 29, 2024
38ee456
Produce ONLY the internal preview when asked.
amclark42 Jun 6, 2024
443cabc
Merge branch 'main' into static_site_for-merging
amclark42 Jun 6, 2024
d704846
Merge branch 'static_site_for-merging' into static_site_preview-site
amclark42 Jun 6, 2024
9375ccb
Separate `${toDir}` property into multiple properties.
amclark42 Jun 7, 2024
a948fdd
Move named templates; add more whitespace for readability
amclark42 Jun 10, 2024
e158852
Update comments with actual location of referenced named template
amclark42 Jun 10, 2024
207edc8
Use relative links to articles and bios from editorial/issue index.
amclark42 Jun 10, 2024
19c7b13
Use relative links for Internal Preview articles
amclark42 Jun 10, 2024
d653eaa
update TSVs, restructure recommendation code and add conditionals whe…
joelsjlee Jun 10, 2024
2da73bb
Use XSLT parameter to fill in the static site directory
amclark42 Jun 10, 2024
74733eb
Use relative links from proofing article page to bios page.
amclark42 Jun 10, 2024
af4d7f8
Don't run "compressStatic" as part of "generateSite" target.
amclark42 Jun 11, 2024
7613d10
Merge branch 'main' into static_site_for-merging
amclark42 Jun 12, 2024
7c99b7d
add conditional to See Recommendations toolbar link, add a comma in t…
joelsjlee Jun 12, 2024
571fd1b
Provide the option to generate a full copy of DHQ for proofing.
amclark42 Jun 12, 2024
02d1b98
Only prompt for `do.proofing.full` if it hasn't been set yet.
amclark42 Jun 12, 2024
ae2ba24
Remove starter.html from full site build.
amclark42 Jun 12, 2024
21f736d
Make sure home page index points to pages inside that issue dir
amclark42 Jun 12, 2024
e18ae76
Use relative links within toolbars for published/preview articles.
amclark42 Jun 12, 2024
458b7f2
Fix link to preview biographies page.
amclark42 Jun 12, 2024
49a3223
Add global variable as flag for the article having recommendations
amclark42 Jun 13, 2024
4f9240a
Use "m" flag for multi-line matching
amclark42 Jun 13, 2024
452d67f
update with stable versions of tsvs, fixing quoting issues and commen…
joelsjlee Jun 13, 2024
df41f75
Merge pull request #77 from Digital-Humanities-Quarterly/static_site_…
joelsjlee Jun 13, 2024
40edcf2
complete prev merge (that had a conflict in dhq2html, which Joel, Ash…
sydb Jun 17, 2024
5c6bc6f
Manually correct dhq2html.xsl …
sydb Jun 17, 2024
9de15d9
Merge in static site, which includes:
sydb Jun 17, 2024
2d23b88
update TSVs with Authors with Affiliations column, adjust dhq2html.xs…
joelsjlee Jun 20, 2024
f34aca7
Keep words in one piece in `help` output
amclark42 Jun 21, 2024
767770c
Make `help` description into one big `<echo>`.
amclark42 Jun 21, 2024
f23c138
Add `help` documentation for `makeInternalPreview` target.
amclark42 Jun 21, 2024
236ba47
Edit `help` documentation for `generateIssues` and -`Site`.
amclark42 Jun 21, 2024
924c389
Tweak the use of @sydb's `defaultnotice` target...
amclark42 Jun 21, 2024
d04b7e6
Merge branch 'static_site_generation' into static_site_preview-site
amclark42 Jun 21, 2024
a4b84c8
Merge pull request #80 from Digital-Humanities-Quarterly/joel_auth_affil
joelsjlee Jun 24, 2024
cfe9a2c
Export oXygen scenario for running the "makeInternalPreview" build.
amclark42 Jul 1, 2024
87d2eda
Add more Ant-in-oXygen scenarios!
amclark42 Jul 1, 2024
4a23479
Prompt to generate a proofing copy of the full DHQ site.
amclark42 Jul 1, 2024
df35610
Create XSLT to generate all lists of articles for proofing.
amclark42 Jul 2, 2024
f1eb4f0
Run `article_list_all.xsl` as part of `makeInternalPreview`
amclark42 Jul 2, 2024
164efcc
Newest and bestest from static site generation (my base) branch
sydb Jul 2, 2024
fd4dbc0
Refactor article_list.xsl to use XSLT 3.0, reduce duplication.
amclark42 Jul 2, 2024
b8fea22
Remove "_asc" from article list file names
amclark42 Jul 2, 2024
b46ccd7
Move sorting links outside the table, into new named template.
amclark42 Jul 3, 2024
089432e
Add `@aria-label` for "descending" sort direction links.
amclark42 Jul 3, 2024
b29730d
Use relative links for all main content.
amclark42 Jul 3, 2024
d701c4d
Use relative link from editorial index to articles.html
amclark42 Jul 3, 2024
7e25a20
Don't kill the build if the proofing directory can't be deleted.
amclark42 Jul 5, 2024
8beda44
Merge branch 'main' into static_site_generation
amclark42 Jul 5, 2024
2bfc84a
Normalize whitespace in article ID.
amclark42 Jul 5, 2024
ad0bc29
Edit URLs in the recommendations box to work without a server.
amclark42 Jul 5, 2024
d0afc57
Merge branch 'static_site_generation' into static_site_preview-site
amclark42 Jul 8, 2024
32c4f40
Change default Ant target to `help`.
amclark42 Jul 8, 2024
56b5518
Remove AddThis button and Editorial area "logout" button
amclark42 Jul 8, 2024
a14d23c
Use relative paths in oXygen scenarios.
amclark42 Jul 8, 2024
7621122
Merge branch 'encoding_workflow' into static_site_generation
amclark42 Jul 12, 2024
33bef26
finish merge post manual fix
sydb Jul 15, 2024
cc270d8
Switch name of output search page to just “search.html”.
sydb Jul 15, 2024
31432a5
Begin implementing search box in topnavigation menu.
jawalsh Jul 19, 2024
ff6c7f7
merge latestest work from Syd's search branch into John's search branch
jawalsh Jul 19, 2024
40c300e
Update dhq_screen.css
jawalsh Jul 19, 2024
7969745
Update topnavigation.xsl
jawalsh Jul 19, 2024
8454d33
Add `path_to_home` parameter to various stylesheets.
amclark42 Jul 22, 2024
8afe010
Include note on how to set `do.proofing.full` from the command line
amclark42 Jul 22, 2024
27bdc94
Use relative links in `sidenavigation.xsl`, update to XSLT 3.0.
amclark42 Jul 22, 2024
85fe646
Use relative link to Recommendations documentation
amclark42 Jul 22, 2024
50354cf
Use correct relative path for preview index and bios.
amclark42 Jul 22, 2024
721afc7
Add `dhq:set-up-issue-transformation#4` for setting relative paths.
amclark42 Jul 22, 2024
2c6a4b6
Use relative paths in static pages...
amclark42 Jul 22, 2024
7750eb3
Remove caveat about the static site's internal links
amclark42 Jul 22, 2024
6861a94
Fix link to news.xml
amclark42 Jul 22, 2024
7065156
Use zipPreviewArticle to generate previewArticle.
amclark42 Jul 22, 2024
0a3d358
Tweak documentation in Ant `help` target
amclark42 Jul 22, 2024
bad9d2d
Delete the generated article HTML after compressing it
amclark42 Jul 22, 2024
85da91c
Fix relative links in navbars for DHQ indexes
amclark42 Jul 22, 2024
fcb1383
Fix sidebar nav in 000150.
amclark42 Jul 22, 2024
ac26978
Merge pull request #85 from Digital-Humanities-Quarterly/static_site_…
amclark42 Jul 23, 2024
2773d22
Merge branch 'static_site_generation' into static_site_make-standalone
amclark42 Jul 23, 2024
e701ca9
More small refactors to `sidenavigation.xsl`.
amclark42 Jul 23, 2024
a1428a5
First pass at refactoring author_index.xsl.
amclark42 Jul 26, 2024
213e776
Use "fall-through" XSLT behavior for author names.
amclark42 Jul 26, 2024
a5a55d3
Also handle names without family names in generating sort key
amclark42 Jul 26, 2024
7e181d9
Compile each author's articles; remove author_sort from workflow.
amclark42 Jul 26, 2024
6e1f48a
Add internal navigation for author index.
amclark42 Jul 26, 2024
7e5e357
Only include headings for actual letters in Authors Index.
amclark42 Jul 26, 2024
fbd1449
Concluding merge after two seroiusly
sydb Jul 27, 2024
d2852e0
Make sure each article is only listed once per author
amclark42 Aug 5, 2024
9e77135
Add ARIA labels for heading and link back to navbar.
amclark42 Aug 5, 2024
5a6f993
Fix extra whitespace when author name ends in ", Jr"
amclark42 Aug 5, 2024
0066c2f
Move common code into template and function.
amclark42 Aug 5, 2024
f10e991
Move components into new XSLT, common-components.xsl
amclark42 Aug 5, 2024
7714370
Handle elements within an article title, remove ending whitespace.
amclark42 Aug 6, 2024
3024f27
Add comment stating that author_sort.xsl is no longer used.
amclark42 Aug 6, 2024
4fdf36e
Move "get-article-title" template to common components stylesheet.
amclark42 Aug 6, 2024
45485d3
Start refactoring title_index.xsl.
amclark42 Aug 6, 2024
f74a2bc
Implement language-specific stopwords for sorting titles.
amclark42 Aug 7, 2024
cd8af74
Handle stopwords when the first child of <title> has `@xml:lang`.
amclark42 Aug 7, 2024
caf4c00
Sort titles in index; adjust XHTML output
amclark42 Aug 7, 2024
4c5f8a8
Sort articles with non-Latin letters at the top of the index
amclark42 Aug 7, 2024
b552dec
Add navbar back to titles index; clean up and edit comments
amclark42 Aug 7, 2024
11b0977
Use CSS media queries instead of `expression()`.
amclark42 Aug 7, 2024
7d23a25
Move assets copying to `generateIssues` build step.
amclark42 Aug 30, 2024
7050a0c
Include more explanation of `$path_to_home` parameter and values.
amclark42 Aug 30, 2024
bd5a1d2
Merge pull request #89 from Digital-Humanities-Quarterly/static_site_…
jawalsh Sep 17, 2024
5bb55d9
finish merging sydb_uvepss_03 into jawalsh_uvepss_01
sydb Oct 1, 2024
091e56b
Finished with manual merge:
sydb Nov 5, 2024
0efeafe
Fix lowercase
jawalsh Nov 5, 2024
2d7e667
staticSearch changes:
sydb Nov 5, 2024
1bcf8b0
Address most issues raised
sydb Dec 8, 2024
83847f4
Various responses
sydb Dec 16, 2024
f409aad
Handle a few
sydb Dec 18, 2024
556d546
Ooops; also need to take out reference to non-XML DTD
sydb Dec 19, 2024
3fbb025
Two small code changes:
sydb Dec 21, 2024
f962c2f
Per suggestion @amclark42,
sydb Dec 21, 2024
08e79f5
Changes:
sydb Dec 21, 2024
62e16bd
With @jawalsh and
sydb Jan 9, 2025
97cbe1d
Merge pull request #92 from Digital-Humanities-Quarterly/deal_with_so…
jawalsh Jan 9, 2025
3814672
Use dynamic, rather than
sydb Jan 24, 2025
7701555
commented out
sydb Feb 7, 2025
affefde
Merge pull request #91 from Digital-Humanities-Quarterly/jawalsh_uvep…
amclark42 Feb 7, 2025
f5aeb0f
Cosmetic fixes to search interface
jawalsh Feb 7, 2025
2d54c22
remove debugging code, even that which was commented out
sydb Feb 21, 2025
6332261
Merge pull request #93 from Digital-Humanities-Quarterly/sydb_remove_…
amclark42 Feb 21, 2025
f25be19
Merge branch 'encoding_workflow' into static_site_generation
amclark42 Feb 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Implement language-specific stopwords for sorting titles.
The implementation works for titles with language codes placed
directly on them. It will fail for titles that are mostly in
English but which lead with some text marked as being in another
language.

Also, moved the logic for generating links to articles into a
common function.
amclark42 committed Aug 7, 2024
commit f74a2bc7d2b518f95d1cc9483ff6b14a5dd26fce
23 changes: 2 additions & 21 deletions common/xslt/author_index.xsl
Original file line number Diff line number Diff line change
@@ -213,27 +213,8 @@
<xsl:variable name="articleId"
select="normalize-space($fileDesc/tei:publicationStmt/tei:idno[@type='DHQarticle-id'])"/>
<!-- Try to generate a URL to use for this article. -->
<xsl:variable name="linkUrl" as="xs:string?">
<xsl:choose>
<xsl:when test="not($vol_no_zeroes = '') and not($issue = '')">
<xsl:sequence
select="concat($path_to_home,'/vol/',$vol_no_zeroes,'/',$issue,'/',$articleId,'/',$articleId,'.html')"/>
</xsl:when>
<!-- If we don't have a usable volume or issue number, output a debugging message and do NOT
generate a link. -->
<xsl:otherwise>
<xsl:message terminate="no">
<xsl:text>Article </xsl:text>
<xsl:value-of select="$articleId"/>
<xsl:text> has a volume of '</xsl:text>
<xsl:value-of select="$vol"/>
<xsl:text>' and an issue of '</xsl:text>
<xsl:value-of select="$issue"/>
<xsl:text>'</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="linkUrl" as="xs:string?"
select="dhqf:link-to-article($articleId, $vol, $issue)"/>
<!-- Generate the text description of this article. It will be reproduced for each author. -->
<xsl:variable name="articleTitles" as="node()*">
<xsl:variable name="hasTitleNotInEnglish" as="xs:boolean"
37 changes: 37 additions & 0 deletions common/xslt/common-components.xsl
Original file line number Diff line number Diff line change
@@ -16,6 +16,12 @@
Initially compiled by Ash Clark in 2024.
-->

<!-- PARAMETERS -->

<!-- The relative path from the webpage to the DHQ home directory. -->
<xsl:param name="path_to_home" select="'.'" as="xs:string"/>


<!--
GLOBAL VARIABLES
-->
@@ -170,6 +176,37 @@
</xsl:choose>
</xsl:function>

<!-- Given a volume, issue, and article number, generate a link to an article. This function uses the
value of the $path_to_home parameter to return to the DHQ home directory. -->
<xsl:function name="dhqf:link-to-article" as="xs:string?">
<!-- The article ID is placed first because there could be a use for a 1-parameter version of this
function which generates a link using information from the TOC. -->
<xsl:param name="article-id" as="xs:string"/>
<xsl:param name="volume" as="xs:string?"/>
<xsl:param name="issue" as="xs:string?"/>
<xsl:choose>
<!-- If we don't have a usable volume or issue number, output a debugging message and do NOT
generate a link. -->
<xsl:when test="empty($volume) or normalize-space($volume) eq ''
or empty($issue) or normalize-space($issue) eq ''">
<xsl:message terminate="no">
<xsl:text>Article </xsl:text>
<xsl:value-of select="$article-id"/>
<xsl:text> has a volume of '</xsl:text>
<xsl:value-of select="$volume"/>
<xsl:text>' and an issue of '</xsl:text>
<xsl:value-of select="$issue"/>
<xsl:text>'</xsl:text>
</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="vol_no_zeroes" select="dhqf:remove-leading-zeroes($volume)"/>
<xsl:sequence
select="concat($path_to_home,'/vol/',$vol_no_zeroes,'/',$issue,'/',$article-id,'/',$article-id,'.html')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>

<!-- Given 1+ string(s), create a single string that can be used as an HTML identifier as well as a
sort key. -->
<xsl:function name="dhqf:make-sortable-key" as="xs:string?">
87 changes: 53 additions & 34 deletions common/xslt/title_index.xsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tei="http://www.tei-c.org/ns/1.0"
@@ -32,6 +33,24 @@
<xsl:param name="fpath"/>
<xsl:param name="staticPublishingPath" select="'../../articles/'"/>

<!-- GLOBAL VARIABLES -->
<!-- Lower-cased words which, for sorting purposes, should be removed from the beginning of titles.
If the stopword is a full word, add a space after it. Articles like "l'" should have no space
after. -->
<xsl:variable name="stopword-map" as="map(*)">
<xsl:variable name="apos" as="xs:string">'</xsl:variable>
<xsl:sequence select="map {
'de': ( 'der ', 'die ', 'das ', 'ein ', 'eine ' ),
'en': ( 'the ', 'an ', 'a ' ),
'es': ( 'el ', 'la ', 'los ', 'las ',
'un ', 'una ', 'unos ', 'unas ' ),
'fr': ( 'le ', 'la ', 'l'||$apos, 'les ',
'un ', 'une ', 'des ' ),
'pt': ( 'o ', 'a ', 'os ', 'as ',
'um ', 'uma ', 'uns', 'umas ' )
}"/>
</xsl:variable>


<!--
TEMPLATES, #default MODE
@@ -136,27 +155,8 @@
<xsl:variable name="vol_no_zeroes"
select="dhqf:remove-leading-zeroes($vol) => normalize-space()"/>
<!-- Try to generate a URL to use for this article. -->
<xsl:variable name="linkUrl" as="xs:string?">
<xsl:choose>
<xsl:when test="not($vol_no_zeroes = '') and not($issue = '')">
<xsl:sequence
select="concat($path_to_home,'/vol/',$vol_no_zeroes,'/',$issue,'/',$articleId,'/',$articleId,'.html')"/>
</xsl:when>
<!-- If we don't have a usable volume or issue number, output a debugging message and do NOT
generate a link. -->
<xsl:otherwise>
<xsl:message terminate="no">
<xsl:text>Article </xsl:text>
<xsl:value-of select="$articleId"/>
<xsl:text> has a volume of '</xsl:text>
<xsl:value-of select="$vol"/>
<xsl:text>' and an issue of '</xsl:text>
<xsl:value-of select="$issue"/>
<xsl:text>'</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="linkUrl" as="xs:string?"
select="dhqf:link-to-article($articleId, $vol, $issue)"/>

<xsl:for-each select="$fileDesc/tei:titleStmt/tei:title">
<xsl:variable name="title" as="node()*">
@@ -167,20 +167,11 @@
<xsl:with-param name="article-has-non-english-title" select="$hasTitleNotInEnglish"/>
</xsl:call-template>
</xsl:variable>
<!-- Stopwords filter from Jeni Tennison, http://www.stylusstudio.com/xsllist/200112/post10410.html -->
<!--<xsl:variable name="lower">0123456789abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="upper">0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
<xsl:variable name="punctuation">[/\].,+-=*~@#$%^(){}`"“”'!?&amp;&lt;&gt;</xsl:variable>
<xsl:variable name="stoplist" select="document('../../toc/stoplist.xml')/stoplist/ignore" />
<xsl:variable name="string"><xsl:value-of select="substring(translate($title, $punctuation, ''),
string-length(
$stoplist[starts-with(
translate($title,
concat($lower, $punctuation),
$upper),
translate(., $lower, $upper))]) + 1)"/></xsl:variable>-->
<xsl:variable name="sortTitle"
select="dhqf:remove-leading-stopwords(xs:string(.), @xml:lang/data(.))
=> dhqf:make-sortable-key()"/>
<xsl:variable name="apos">'</xsl:variable>
<p class="title" data-sort-key="{dhqf:make-sortable-key($title)}">
<p class="title" data-sort-key="{$sortTitle}">
<xsl:sequence select="$title"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="$issueTitle"/>
@@ -238,5 +229,33 @@
<xsl:template match="dhq:authorInfo/dhq:affiliation">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>


<!--
FUNCTIONS
-->

<!-- Given a string and a language code, produce a version of the string suitable for sorting, by
lower-casing it, normalizing its whitespace, and finally, removing its leading stopwords. -->
<xsl:function name="dhqf:remove-leading-stopwords" as="xs:string">
<xsl:param name="string" as="xs:string"/>
<xsl:param name="language-code" as="xs:string?"/>
<!-- If $language-code isn't provided, fallback on English. -->
<xsl:variable name="useLang" select="($language-code, 'en')[1]"/>
<xsl:choose>
<!-- If the provided language code matches one of those in $stopword-map, we have stopwords that
may be removed from the beginning of the input string. -->
<xsl:when test="$language-code = map:keys($stopword-map)">
<xsl:variable name="cleanerStr" select="lower-case(normalize-space($string))"/>
<xsl:variable name="langStopwordSeq" select="map:get($stopword-map, $language-code)"/>
<xsl:variable name="regex" select="'^('||string-join($langStopwordSeq, '|')||')'"/>
<xsl:sequence select="replace($cleanerStr, $regex, '')"/>
</xsl:when>
<!-- By default, simply return the input string as-is. -->
<xsl:otherwise>
<xsl:sequence select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>

</xsl:stylesheet>