Skip to content

Comments

template: Render collections with appropriate fields#116

Merged
ribose-jeffreylau merged 4 commits intomainfrom
115-collections
Apr 10, 2025
Merged

template: Render collections with appropriate fields#116
ribose-jeffreylau merged 4 commits intomainfrom
115-collections

Conversation

@ribose-jeffreylau
Copy link
Contributor

@ribose-jeffreylau ribose-jeffreylau commented Apr 8, 2025

This pull request addresses issue #115 and introduces changes to render collections with appropriate fields in the default liquid template. Basically, ensuring that rendered Metanorma collections look good on the site index generated by metanorma site generate.

Relevant tests:

  • xml_convertor_spec.rb:
    • Verify that links now are all relative paths.
    • Ensure correct rendering of document identifiers and titles.
  • xml_to_html_renderer_spec.rb:
    • Verify that document entries (like metanorma collections) render without a "stage: " label.

Fixes #115

This makes the titles of individual entries in `metanorma site generate`
without a generated HTML (e.g., collections) that only have generated
PDF/DOC/XML, still contain a valid link (to PDF/DOC/XML), instead of
just being plain text.

Related: #115
@ribose-jeffreylau ribose-jeffreylau added the bug Something isn't working label Apr 8, 2025
@ribose-jeffreylau ribose-jeffreylau self-assigned this Apr 8, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.

Files not reviewed (2)
  • spec/assets/with-collections.xml: Language not supported
  • templates/_document.liquid: Language not supported

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.

Files not reviewed (2)
  • spec/assets/with-collections.xml: Language not supported
  • templates/_document.liquid: Language not supported
Comments suppressed due to low confidence (2)

spec/relaton/cli/xml_to_html_renderer_spec.rb:46

  • [nitpick] Using a hardcoded index [1] to select the second document element may reduce clarity; consider using a more descriptive selector or adding a clarifying comment.
subject(:section) do
          document.div(class: 'document')[1]
        end

spec/relaton/cli/xml_to_html_renderer_spec.rb:59

  • [nitpick] Using numeric indices for selecting document elements may lead to fragile tests if the document order changes; consider iterating directly over the matched elements or using a more robust selection method.
(2..3).map do |i|
            document.div(class: 'document')[i]
          end.each do |e|

@ribose-jeffreylau
Copy link
Contributor Author

@andrew2net Similar to relaton/relaton-itu#76, this PR is crucial in fixing metanorma/itu-contribution-samples#4. Would appreciate it if it can be reviewed at your earliest convenience. Thanks!

@ronaldtse
Copy link
Contributor

Thanks @ribose-jeffreylau !

@andrew2net can you please review and merge? Thanks.

@andrew2net
Copy link
Contributor

@ribose-jeffreylau looks good to me, feel free to release

@ribose-jeffreylau
Copy link
Contributor Author

@andrew2net Cheers!

@ribose-jeffreylau ribose-jeffreylau merged commit e2c719a into main Apr 10, 2025
8 checks passed
@ribose-jeffreylau ribose-jeffreylau deleted the 115-collections branch April 10, 2025 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Render collections with appropriate fields

3 participants