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

Rendering link Templates. #1796

Merged
merged 2 commits into from
Jul 29, 2024
Merged

Rendering link Templates. #1796

merged 2 commits into from
Jul 29, 2024

Conversation

lloydtabb
Copy link
Collaborator

Often in an HTML table you want to link to some external resource. This simple mechanism allows create linkage in the result table with simple text substitution.

run: flights -> {

  // by default appends to the end of the template

  # link.url_template="http://faa.gov/lookup?code="
  group_by: origin_code

  // can also do substitution. $$ is replaced.
  // link.url_template="" and link{url_template=""} are equivalent

  # link{url_template="http://faa.gov/carriers/$$/full_detail"}
  group_by: carrier
}

@lloydtabb
Copy link
Collaborator Author

Documentation pull Request here:

malloydata/malloydata.github.io#177

Copy link
Contributor

@skokenes skokenes left a comment

Choose a reason for hiding this comment

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

Just need to fix that indexOf > 0 bug and we are good!

const element = this.document.createElement('a');
element.href = data.value;
if (urlTemplate) {
if (urlTemplate.indexOf('$$') > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Change to >-1

@skokenes skokenes merged commit e46a94b into main Jul 29, 2024
9 checks passed
@skokenes skokenes deleted the ltabb-link-templates branch July 29, 2024 15:39
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.

2 participants