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

Docs: Add table shortcode in Features category, Shortcodes page #71

Closed
jwflory opened this issue Mar 14, 2022 · 6 comments · Fixed by #96
Closed

Docs: Add table shortcode in Features category, Shortcodes page #71

jwflory opened this issue Mar 14, 2022 · 6 comments · Fixed by #96
Assignees
Labels
C: documentation Improvements or additions to documentation T: new change Adds new capabilities or functionality

Comments

@jwflory
Copy link
Member

jwflory commented Mar 14, 2022

Summary

Write new documentation to describe the table shortcode added in #70

Background

This feature was added to support rendering complex information in tables as part of an exercise @acabunoc put together when working with Venture Fund companies. The feature should be documented in the sample website to better capture the capabilities and unique features of this theme from what comes natively with Hugo.

Note that the example site was not originally made to be a functioning form of documentation for the project, so some liberty will need to be taken in removing old content or repurposing it as we go.

Details

The shortcode we use as found in /layouts/shortcodes/table.html:

{{ $_hugo_config := `{ "version": 1 }` }}

{{ $htmlTable := .Inner | markdownify }}
{{ $class := .Get 0 }}
{{ $old := "<table>" }}
{{ $new := printf "<table class=\"%s\">" $class }}
{{ $htmlTable := replace $htmlTable $old $new }}
{{ $htmlTable | safeHTML }}

The shortcode as it is used in a post from unicef/inventory#125:

{{<table "table">}}

| Stakeholder | Role | Motivation | Open Source Work |
|----------|----------|----------|----------|
| < stakeholder 1 > ||||
| < stakeholder 2 > ||||
| < stakeholder 3 > ||||

{{</table>}}

Its actual appearance:

Screenshot of the Stakeholder Mapping Exercise in the Open Source Inventory, which uses the table shortcode.

Outcome

Easier to discover this feature when using the theme

@jwflory jwflory added I: help wanted Extra attention is needed C: documentation Improvements or additions to documentation T: new change Adds new capabilities or functionality labels Mar 14, 2022
@yokwejuste
Copy link

yokwejuste commented Mar 28, 2022

the link /layouts/shortcodes/table.html not working. The return is a 404.

@jwflory
Copy link
Member Author

jwflory commented Mar 30, 2022

the link /layouts/shortcodes/table.html not working. The return is a 404.

Thanks, I used a shortcut that doesn't seem to work with GitHub-flavored Markdown. I fixed the URL. It should have pointed here:

https://github.com/unicef/inventory-hugo-theme/blob/main/layouts/shortcodes/table.html

@BeeBombshell
Copy link
Contributor

Hi @jwflory, I'm having a little trouble understanding what needs to be done. 😅
The sample table on the elements page doesn't use the above-mentioned shortcode as of now. So, do we need to add a new table to document the shortcode or use it in an existing table?

image

Also, the shortcode table looks exactly the same as the normal HTML table. Even the styling done for the table element will affect both the normal HTML table and the shortcode table. So, I don't understand how a user will differentiate between the two.

@jwflory
Copy link
Member Author

jwflory commented Apr 6, 2022

The sample table on the elements page doesn't use the above-mentioned shortcode as of now. So, do we need to add a new table to document the shortcode or use it in an existing table?

The documentation site should use the table shortcode instead of the Markdown table. This is because the shortcode works across both Markdown and Asciidoc content.

Also, the shortcode table looks exactly the same as the normal HTML table. Even the styling done for the table element will affect both the normal HTML table and the shortcode table. So, I don't understand how a user will differentiate between the two.

This is the documentation for content writers and not for readers/users. A content writer should use the shortcode when creating tables. A reader or user should not know the difference. So, the fix here is very simple! It is padding the existing Markdown table with the shortcode and perhaps adding a link to a Markdown table generator tool or other Markdown documentation.

Does it make sense?

@BeeBombshell
Copy link
Contributor

@jwflory Yes, makes sense to me... 😊

Can I work on this issue?

@jwflory
Copy link
Member Author

jwflory commented Apr 6, 2022

@BeeBombshell Definitely! 👍🏻

@jwflory jwflory removed the I: help wanted Extra attention is needed label Apr 6, 2022
jwflory pushed a commit that referenced this issue Apr 8, 2022
Fixes #71.

This PR adds table shortcodes to the existing tables along with the documentation to the elements page.
Neha9849 added a commit to Neha9849/inventory-hugo-theme that referenced this issue Jun 1, 2022
fixing the pdf view

minor fix

Update exampleSite/content/installation/elements/_index.en.md

Co-authored-by: Justin W. Flory <jflory7@gmail.com>

:lipstick: layouts(navigation): Use consistent color on all pages (unicef#58)

This commit fixes a bug where the UNICEF Blue was hard-coded into the
navigation bar, and changes that hard-coded value to use the primary
color set by the site maintainer in the Hugo config file (`params.`
`primary_color`).

Additionally, I changed the color for the translations options to use a
white color, since it is hard to read when the primary color is a darker
color.

Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>

:new: :lipstick: layouts: Add dpg-report layout (see unicef/coach#1) (unicef#44)

This commit creates a new custom layout for DPG report cards in the
UNICEF Inventory theme. DPG report cards are at-a-glance views of a
Venture Fund company's progress in meeting the DPG Standard.

More context about this change is in unicef/coach#1. This commit should
be merged once the idea is validated and the early prototyping phase is
complete.

Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>

:new: :lipstick: layouts(shortcodes): Create table layout (unicef#70)

Shortcode for a table used in unicef/inventory#125.

:new: :sparkles: layouts(shortcodes): Add embed-pdf shortcode (unicef#56)

I have added a demo of this shortcode on the `installation/elements` page. For using this Shortcode, we have to pass the name of the pdf into the shortcode as shown in the demo. The pdfs should be stored in the `static/pdfs` folder.

Fixes unicef#33.

Co-authored-by: Justin W. Flory <jflory@unicef.org>

:bug: layouts(default): Add condition to show "RA Section" when content is available (unicef#68)

Fixes unicef#30.

* Add hugo condition to only show "RA Section" when there's content available
* Modify hugo conditions to check for available content before displaying the ra section
* Fix duplication of 'RA' section bug introduce by commit e4a8438
* Refactor hugo condition reposible for fixing the bugs in both issue unicef#30 and commit e4a8438
* Undo code refactoring introduced by commit 3f534dd

Co-authored-by: Zab <zab@marmalade.co.ke>

:lipstick: assets(css): Make Table of Contents more appealing and responsive  (unicef#73)

* Complete the stated task
* Make table of contents more appealing and responsive
* Update template title
* Update layouts/partials/head.html

Commit emoji: https://gitmoji.dev/

Co-authored-by: Justin W. Flory <jflory@unicef.org>

🐛 assets(css): Fix styling of highlight code blocks (unicef#72)

* 🐛 fix: Improved styling of highlight code blocks
* Reduced whitespace between codelines using css
* 📝 docs: Added comment for CSS changes

:recycle: layouts(dpg-report): Reuse download-pdf partial (unicef#74)

The PDF download button logic was moved into a partial after this layout
was created. This refactors to use the partial and maintain less code.

Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>

:bug: :wrench: config: Removed Duplicate Home Link in Footer (unicef#80)

Fixes unicef#57.

In Footer partial, we have this:

```html
 <li><a class="nav-link text-white" href="{{ site.BaseURL | relLangURL }}">HOME</a></li>
        {{ range site.Menus.main }}
          {{if ne .Name "pages"}}
            <li class="nav-item">
              <a class="nav-link text-white text-uppercase" href="{{ .URL | absLangURL }}">{{ .Name }}</a>
            </li>
          {{ end }}
        {{ end }}
```

In all other upstreams, we don't have Home in the Menu array but we do have it in the exampleSite. This is what causes the duplication in exampleSite. So, I have removed it from the config file of the example site.

:bug: :memo: README: Fix link for example site config (unicef#82)

An example configuration used to be bundled at the top of the repo, but
now it is included as part of the example site used in building this
theme. This commit fixes the broken link in the README.

Closes unicef#79.

Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>

:bug: :wrench: ci: Fix GH Pages push with string comparison operator

This commit changes the string comparison operator for the git user name
in the deploy script used in continuous integration. Currently the check
is checking if the string is not empty, then it overrides what was set.
We actually wanted the inverse.

Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>

:new: :memo: .github: Add contributing guidelines (unicef#86)

* 🆕 📝 .github: Add contributing guidelines

This commit adds new contributing guidelines for the UNICEF Inventory
theme. It includes four main topics:

1. Contribution process (a.k.a. governance)
2. Conventions & courtesies
3. Structure & components
4. How to create a developer environment

Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>

* Address @Idadelveloper feedback in PR unicef#86; s/tickets/issues/

This commit makes a few changes, mostly coming from Ida's feedback in
Pull Request unicef#86:

1. Add a note about creating a git feature branch after being assigned
   an issue.
2. Add a note to tag an issue number in the commit message(s) of a Pull
   Request.
3. Change all mentions of "ticket" to "issue" to be more clear.

Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>

💄 Admonitions: Standardize appearance and add new shortcodes (unicef#83)

* 💄 fix: Added CAUTION admonition shortcode (closes unicef#66)
* 💄 fix: Added IMPORTANT admonition shortcode (closes unicef#64)
* 💄 fix: Added admonition icons and updated docs

* Revert IDE changes to French localized file.

Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>

* Remove extraneous changes to index page

Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>

Co-authored-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>

:lipstick: css: Highlight buttons on hovering (unicef#94)

Fixes unicef#90.

Type of Change:

- Code
- User Interface

📝 docs: Added table shortcode in elements page (unicef#96)

Fixes unicef#71.

This PR adds table shortcodes to the existing tables along with the documentation to the elements page.

added inventory layouts

 Added layouts of inventory
jwflory pushed a commit to Neha9849/inventory-hugo-theme that referenced this issue Jun 2, 2022
Fixes unicef#71.

This PR adds table shortcodes to the existing tables along with the documentation to the elements page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: documentation Improvements or additions to documentation T: new change Adds new capabilities or functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants