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

Make internal preview version of DHQ for proofing the static site #85

Merged
merged 49 commits into from
Jul 23, 2024

Conversation

amclark42
Copy link
Contributor

Besides reviewing my code changes, I’d like my reviewer(s) to try using the makeInternalPreview build target in the command line, as well as the exported oXygen scenarios. I’d like to know:

  • Does it work?
  • Is it easy to use? Are there any terms or steps that might trip up a DHQ editor?
  • Did I miss any main-content links (not in the DHQ header or sidebar) that should be relative?
  • Are there other improvements I should consider making before we switch to a static site publication system?

Background

The main goal here: to allow DHQ editors and continuous integration to generate a proofing copy of the articles listed in the “editorial” section of the DHQ TOC. This is accomplished with a new Ant build target, makeInternalPreview.

makeInternalPreview allows the user to choose between generating a copy of just the unpublished articles (the default), or the entire DHQ site plus the internal preview section. Under the hood, the target customizes the behavior of generateIssues and generateSite. In either case, the results are saved to dhq-proofing, a new directory inside dhq-static.

Other improvements

Because DHQ editors will use the new Ant build target in oXygen, I’ve made a few improvements:

  • Within most TOC-derived pages, links within the main content of each page should be relative. The proofing copy must be navigable in a browser without a server or special setup.
    • I did not attempt a thorough deep-dive into the DHQ XSLT. However, I did try to ensure that all links within a single issue were relative to other resources in that directory.
  • Each HTML page is created with “proofing copy” displayed prominently across the header, as well as a sepia filter on the header image. It should be harder to confuse the unofficial copy with the static site generated for publication.
  • An export of oXygen transformation scenarios is available in common/xslt/static-site.scenarios. Once imported, an oXygen user will be able to run the makeInternalPreview, previewArticle, or zipPreviewArticle scenarios from any file in their local copy of dhq-journal.
  • I’ve completely refactored article_list.xsl, the stylesheet which produces a table of all DHQ articles in the TOC for proofing purposes. The resulting HTML seems cleaner and more useful (to me, anyway), and the stylesheet itself should be significantly easier to read, understand, and maintain.
    • I’ve done my best to try to model the kind of refactoring I think the rest of the DHQ stylesheets will eventually need: moving away from XSLT 1.0; reducing the amount of duplicated code; adding context through comments; etc.

I’ve also tried to aid maintainability by moving the ant help documentation into a single <echo> (making its contents easier to read and edit). I also broke out the Ant property ${toDir} into three settings in the build-properties.xml, so that individual directory names will be easier to edit. And I added a toggle to turn off certain XSLT messages where they would only distract from more useful info or urgent warnings.

amclark42 added 30 commits May 28, 2024 11:36
head.xsl introduces special CSS rules for the preview site, and
topnavigation.xsl adds a "Preview" to the header. A new parameter,
"previewable", determines whether these are added to the HTML
output.

Also, fixed the alt text for the banner and DHQ logos.
generate_static_issues.xsl now includes and passes on the
"doProofing" parameter when generating HTML for articles in the
TOC. The XSLT does not yet transform the "editorial" articles.
toc.xsl now has a "do-list-articles" parameter, which controls
whether or not every article is listed for a given issue. toc.xsl
has it turned on by default. The static_issues stylesheet turns it
off, because the flood of messages hides useful warnings.
Added a "do-proofing-full" parameter to generate_static_issues.xsl,
which, in combination with "do-proofing", determines whether the
stylesheet handles all articles, TOC indexes, and compression of
XML. When "do-proofing" is on and "do-proofing-full" is turned off,
only the "editorial", internal preview is reproduced.
The directories for the static and proofing sites are now set in
build-properties.xml. The paths to those directories, and to the
base directory, are still set in build.xml, with ".path" added to
the property name. So, references to `${toDir.static}` may now have
been changed to `${toDir.static.path}`.

I've tested generateIssues and generateSite, and they work as
before.
I did not replace the link to the Internal Preview's "Articles"
list yet, because the Ant process doesn't generate it.
I discovered that the code used to generate the anchor to the
linked contributor's biography is out-of-sync with the code used
to generate the bios page. Links will work but don't take you
directly to the clicked contributor.
Per collaborative development meeting. We can `rsync` the static
site directory to the DHQ server, rather than taking the time to
compress and transmit it.
The "generateSite" target uses the generic property to determine
where files should be saved. The "makeInternalPreview" target
prompts users whether they want to generate the full site or not.
So someone can issue the command
`ant -Ddo.proofing.full=true makeInternalPreview`
in, for instance, a headless environment.
...it's pretty obviously a Cocoon holdover.
Fixed path to articles from the preview index.
It will be easier to edit the description without having to worry
about shifting tags to accommodate character limits per line.
Also, tweaked paths in the help documentation.
Also added documentation for the `compressStatic` target, since
`generateSite` no longer calls it.
...so the notice only appears when no Ant targets were explicitly
invoked (read: someone just ran `ant`).

We may still decide to change the default Ant target before
switching to the static site for publication.
amclark42 added 12 commits June 21, 2024 16:45
Had to add back the "get-vol" template which was needed by
template_editorial_article.xsl.
Per meeting with Syd and Julia. The scenario builds only the
"editorial" section of the TOC, not any other part of the DHQ site.
New scenarios for the Ant build targets: generateSite,
previewArticle, and zipPreviewArticle. All scenarios load the Saxon
JARs from `common/lib/`.
Because this is preferable to running "generateSite", I removed
that target from the oXygen scenarios.
article_list.xsl produces a single webpage for a given sort method
and sort direction. The new stylesheet `article_list_all.xsl`
runs 6 transformations to produce every webpage variant of
`editorial/articles.html`.
I removed and condensed a lot of repeated code into two templates:
one that creates and sorts all the rows of the table, and one that
generates all the cells for the row corresponding to an article.

Rather than nesting a table of author names into the last cell of
each row, I set up an unordered list of names. I also removed the
"center" class from the first two cells, because the
`display:block;` CSS rule was keeping them from displaying like
regular table cells.

I also added comments and variables, and re-formatted the
whitespace for readability.
Rather than having table headings that serve as both labels and
actionable links, I've moved the links to alternative sort pages
into a list shown before the table. `<a>` elements aren't used when
the link would be to the current page, which makes it easy to see
at a glance which sort method is applied. The display of the table
and the navigation stay consistent when navigating between pages.
@sydb
Copy link
Contributor

sydb commented Jul 3, 2024

BUILD FAILED
/home/syd/Documents/dhq-journal/build.xml:286: Directory does not exist: /home/syd/Documents/dhq-static/dhq-proofing

I am going to create that directory so I can continue testing. (As you might have guessed, I am testing the commandline interface, using bash.)

For example, if the directory doesn't exist because this is the
first time we're running "makeInternalPreview", the <delete> task
shouldn't fail.

Also, delete the empty `dhq-proofing/vol/` directory created by
"generateArticles" when we're not proofing the full site.
@amclark42
Copy link
Contributor Author

@sydb Good catch, thank you! I fixed that bug.

amclark42 added 6 commits July 5, 2024 10:29
Fixes a broken link to article 000605's XML.
Rather than starting with "/dhq/", URLs to other articles start
with "../../../../" to get back to the root directory. (We could
trim the `/vol/` from the full URL to reduce the path, but this
seemed simpler and fairly reliable.)
Updated column used to create a relative link to recommended article,
and added a fallback message if the URL column doesn't match
expectations. (The fallback is very noisy but doesn't terminate the
transformation.)
Per DHQ collaborative development meeting. Because DHQ editors are
most likely to use the oXygen transformation scenarios rather than
the command line, we agreed that it is most helpful for Ant to
outline the possible targets when the user hasn't explicitly said
which one they want.
The `${git(working_copy_path)}` editor variable might be new in
oXygen v26; it doesn't work in v25.1.
@juliaflanders
Copy link
Contributor

I've tested the three scenarios and they all seem to work as planned :-) To respond to Ash's questions above:

  1. It does work
  2. It seems very easy to use. The Managing Editor workflow already includes using XSLT to generate a proofing copy, so this would simply replace and expand on that functionality, using a familiar process. The mechanisms for specifying an individual article and for choosing how much to generate (whole site or just preview) are both easy and clear. I like the fact that the default is "just the internal site" so hitting return does what people most often need.
  3. I did not find any broken/problematic links in the generated HTML articles, but the link from the article XML (in the generated site) to the schema is broken, I think because of the introduction of the vol/ layer?
  4. I can't think of any other improvements at this point.

@amclark42 amclark42 requested review from jawalsh and removed request for jawalsh July 22, 2024 16:31
@amclark42 amclark42 merged commit ac26978 into static_site_generation Jul 23, 2024
@amclark42 amclark42 deleted the static_site_preview-site branch July 23, 2024 13:16
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.

3 participants