mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 01:36:13 +00:00
Clean some code and add documentation
This commit is contained in:
parent
06685bbe13
commit
9b05a0bc8e
15 changed files with 208 additions and 140 deletions
|
@ -1,13 +1,17 @@
|
|||
require 'yaml'
|
||||
require 'ffi-icu'
|
||||
|
||||
#alphab_for allows to loop in an array sorted by the translated value of
|
||||
#each key using appropriate collation for the current language. Example :
|
||||
#each key using appropriate collation for the current language. In short,
|
||||
#this is used to generate translated table of contents.
|
||||
|
||||
#Example:
|
||||
#{% alphab_for v in page.voc %}
|
||||
# ..
|
||||
#{% endalphab_for %}
|
||||
|
||||
require 'yaml'
|
||||
require 'ffi-icu'
|
||||
|
||||
module Jekyll
|
||||
|
||||
module AlphabForImpl
|
||||
def render(context)
|
||||
#load translations files
|
||||
|
@ -61,7 +65,6 @@ module Jekyll
|
|||
|
||||
class AlphabForTag < Liquid::For
|
||||
include AlphabForImpl
|
||||
|
||||
def collection_to_sort(context)
|
||||
return context[@collection_name].dup
|
||||
end
|
||||
|
@ -70,6 +73,7 @@ module Jekyll
|
|||
'endalphab_for'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Liquid::Template.register_tag('alphab_for', Jekyll::AlphabForTag)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue