{% comment %} # ----------------------------------------------------------------------------- # ~/_includes/themes/j1/procedures/components/create_word_cloud.proc # Liquid PROCEDURE to create a word cloud from a list of comma separated # words. # # https://jekyll-one.com # # Copyright (C) 2019 Juergen Adams # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one/j1_template_mde/blob/master/LICENSE # # ----------------------------------------------------------------------------- # Components procedure. Create the HTML code (to be included in a page) for # a word cloud generated from a LIST of comma separated WORDS. All words are # counted against a given SOURCE (how often they are found). # Supported SOURCES are: tags|categories # # If a (second) list of words given by 'skip_words', all words will be # EXCLUDED from the word cloud. # # Usage: # 1) assign the 'source', 'word_list' and 'skip_words' variables # 2) include the create_word_cloud.proc procedure # # Example: # # {% capture create_word_cloud %}themes/{{site.template.name}}/procedures/global/create_word_cloud.proc{% endcapture %} # # {% capture my_site_tag_list %}{% for tag in site.tags %}{{ tag | first }}{% unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %} # {% include {{create_word_cloud}} source="tags" word_list=my_site_tag_list %} # # ----------------------------------------------------------------------------- # Test data: # liquid_var: {{ liquid_var | debug }} # # ----------------------------------------------------------------------------- {% endcomment %} {% comment %} Variables ------------------------------------------------------------ {% endcomment %} {% assign word_list = include.word_list %} {% assign source = include.source %} {% assign skip_words = include.skip_words | remove: ' ' %} {% assign skip_word_array = skip_words | split:',' | sort %} {% assign word_array = word_list | split:',' | sort %} {% if source == 'categories' %} {% assign categories = site.categories | sort %} {% endif %} {% assign skip = false %} {% comment %} Liquid procedures ------------------------------------------------------------ {% endcomment %} {% comment %} Main ------------------------------------------------------------ {% endcomment %}