halostatue

halostatue

TableauExcerptExtension - Extract excerpts from your Tableau posts

Over the last several months, I’ve been using Tableau to rebuild my long-neglected website. Tableau is part of the Elixir Tools project headed by @mhanberg, and is built on top of MDEx by @leandrocp. This library is one of ten libraries and Elixir extensions that I built. Most of these were built with the assistance of Kiro.

TableauExcerptExtensions is a Tableau extension that works with Tableau.PostExtension and automatically extracts excerpts from posts for use in index pages. Posts with an existing excerpt field will
be unmodified, and there are three strategies for excerpt extraction.

  1. Excerpt Range Markers can excerpt specific content from anywhere in the post.
---
title: My Post
---

Opening paragraph.

<!--excerpt:start-->This specific section becomes the excerpt.<!--excerpt:end-->

More content.

This extracts only the marked content as the excerpt:

%{excerpt: "This specific section becomes the excerpt."}
  1. Excerpt Split Marker extracts all content before the split marker.
---
title: My Post
---

This is the first paragraph that will become the excerpt.<!--more-->

This is the rest of the post content.

This extracts whatever content is before <!--more-->:

%{excerpt: "This is the first paragraph that will become the excerpt."}
  1. Structural Excerpt Extraction is used as a fallback when no markers are found. This configurable strategy will extract the first N paragraphs (:paragraph), the first N sentences (:sentence), or the first N words (:word). These are simple definitions based on the number of newlines, terminal punctuation, or words split by spaces.

When excerpts are pulled from Markdown content, there is some automatic cleaning:

  • Footnotes are removed from the excerpted text;
  • Reference links are converted to inline ([text][ref][text](url))
  • Whitespace is normalized

Rendering Excerpts

Excerpts are captured in the source content format, so it will be necessary to call the appropriate content formatter for the excerpt.

defmodule MySite.PostsPage do
  def template(assigns) do
    temple do
      for post <- posts do
        if post[:excerpt] do
          div class: "excerpt" do
            Tableau.markdown(post.excerpt)
          end
        end
      end
    end
  end
end

https://github.com/halostatue/tableau_excerpt_extension

First Post!

halostatue

halostatue

And I’ve now released the version that supports range markers…

Whoops.

Where Next?

Popular in Announcing Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 43487 311
New
martinthenth
Hello everybody :wave: Recently, some of my colleagues talked about database ids and uuids and their problems, and I remembered the pain...
New
josevalim
EDIT: since Ecto 3.0 final version is out, this post was amended to use the final versions in the instructions below. Hi everyone, We a...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 10342 134
New
brainlid
LangChain is short for Language Chain. An LLM, or Large Language Model, is the “Language” part. This library makes it easier for Elixir a...
New
Eiji
ExApi is a library that I’m developing now and hope release soon This library will allow to: list all apis list all api implementation...
New
mindok
What is ContEx? A pure Elixir server-side data plotting/charting library outputting SVG. It has nice barcharts in particular and works g...
New
achempion
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library. The progre...
New
fuelen
Hey folks! Want to present a toolkit for writing command-line user interfaces. It provides a convenient interface for colorizing text...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New

Other popular topics Top

Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement