Jekyll Categories, how to create Enum - enums

How to create an ENUM / or something like jekyll, so that you have control of the categories.
---
layout : default
comments : true
title : 'Servindo sites estáticos com Jekyll'
subtitle : 'Entenda como o Jekyll funciona e como ele pode te ajudar a fazer websites estáticos.'
categories : [jekyll]
---

You can have a YAML list (['Apple', 'Orange', 'Strawberry', 'Mango']) or a space-separated string: as they explain in the jekyll Docs:
http://jekyllrb.com/docs/frontmatter/index.html#predefined-variables-for-posts

Related

Using a slot-scope to show text, doesn't show ñ character?

I'm using a slot-scope to show text where there could be special characters like ñ or letters with accents, how to make sure those show up the right way?
This is the outcome right now
Opiniones acerca de las decoraciones navide\u00f1as en las oficinas centrales. tiene un comentario eliminado.
This is the expected outcome
Opiniones acerca de las decoraciones navideñas en las oficinas centrales. tiene un comentario eliminado.
I'm setting the info like this in the controller,
to call the info for the table I call Activity::all()
activity()
->performedOn($comment)
->withProperty('user', auth()->user()->name)
->log($comment->discussionForum()->pluck('theme') . ' tiene un comentario eliminado.');
I'm showing the text like this in a table
<el-table-column>
<template slot-scope="scope">
{{ scope.row.description }}
</template>
</el-table-column>
How can I fix this?
You will need to specify the character encoding in your HTML template so that it can read these letters correctly, e.g.
<meta charset="UTF-8">. Without the charset set, some characters do not appear how they should.
If you have no luck with this, I would try adding the encoding to AppServiceProvider.php in the boot function:
\Blade::setEchoFormat('e(utf8_encode(%s))');
This is the answer I came up with, using the foreign keys to call the model and find the name that way. Since I'm adding this activity when the person saves a comment I can use the FK
$theme = DiscussionForum::where('id', $request->forum_id)->pluck('theme')->first();
activity()
->performedOn($comment)
->withProperty('user', auth()->user()->name)
->log($theme . ' tiene un nuevo comentario.');

How to write some italic words in first slidify slide?

How can I write in italic font the words between ** ** for the first slide in slidify?
---
title : Yield loss of target spot (**Corynespora casiicola**) in soybean
subtitle :
author :
job :
logo : logo1.png
biglogo : logo2.png
framework : io2012 # {io2012, html5slides, shower, dzslides, ...}
widgets : [] # {mathjax, bootstrap, quiz}
mode : selfcontained
hitheme : tomorrow # {tomorrow, tomorrow_night, solarized_dark, solarized_light}
highlighter : highlight.js # {highlight.js, prettify, highlight}

Ruby remove parts of a string

I have a problem with some regular expressions in Ruby. This is the situation:
Input text:
"NU POSTA aşa ceva pe Facebook! „Prostia se plăteşte”
Publicat la: 10.02.2015 10:20 Ultima actualizare: 10.02.2015 10:35
Adresa de e-mail la care vrei sa primesti STIREA atunci cand se intampla
Abonează-te
---- Here is some usefull text ---
Abonează-te
× Citeşte mai mult »
Adauga un comentariu"
I need a regular expression witch can extract only useful text between "Abonează-te" word.
I tried this result = result.gsub(/^[.]{*}\nAbonează-te/, '') to remove the text from the start of the string to the 'Abonează-te' word, but this does not work. I have no ideea how to solve this situation. Can you help me?
Instead of using regular expression, you can use String#split, then take the second part:
s = "NU POSTA aşa ceva pe Facebook! „Prostia se plăteşte”
Publicat la: 10.02.2015 10:20 Ultima actualizare: 10.02.2015 10:35
Adresa de e-mail la care vrei sa primesti STIREA atunci cand se intampla
Abonează-te
---- Here is some usefull text ---
Abonează-te
× Citeşte mai mult »
Adauga un comentariu"
s.split('Abonează-te', 3)[1].strip # 3: at most 3 parts
# => "---- Here is some usefull text ---"
UPDATE
If you want to get multiple matches:
s = "NU
Abonează-te
-- Here's some
Abonează-te
text --
Abonează-te
comentariu"
s.split('Abonează-te')[1..-2].map(&:strip)
# => ["-- Here's some", "text --"]
You could use string.scan function. You don't need to go for string.gsub function where you want to extract a particular text.
> s = "NU POSTA aşa ceva pe Facebook! „Prostia se plăteşte”
" Publicat la: 10.02.2015 10:20 Ultima actualizare: 10.02.2015 10:35
" Adresa de e-mail la care vrei sa primesti STIREA atunci cand se intampla
" Abonează-te
" ---- Here is some usefull text ---
" Abonează-te
" × Citeşte mai mult »
" Adauga un comentariu"
=> "NU POSTA aşa ceva pe Facebook! „Prostia se plăteşte”\nPublicat la: 10.02.2015 10:20 Ultima actualizare: 10.02.2015 10:35\nAdresa de e-mail la care vrei sa primesti STIREA atunci cand se intampla\nAbonează-te\n---- Here is some usefull text --- \nAbonează-te\n× Citeşte mai mult »\nAdauga un comentariu"
irb(main):010:0> s.scan(/(?<=Abonează-te\n)[\s\S]*?(?=\nAbonează-te)/)
=> ["---- Here is some usefull text --- "]
Remove the newline \n character present inside the lookarounds if necessary. [\s\S]*? will do a non-greedy match of space or non-space characters zero or more times.
DEMO
Your regex syntax is incorrect . inside of a character class means match a dot literally, and the {*} matches an opening curly brace "zero or more" times followed by a closing curly brace.
You can match instead of replacing here.
s.match(/Abonează-te(.*?)Abonează-te/m)[1].strip()

Justify + TabSpaces does not work on CKEDITOR

team!
When I use "config.tabSpaces = 20;" in justified text, he gets different spaces. for example:
first paragraph:
<p style="text-align:justify"> Além disso, constata-se que a parte reclamante recebeu, como última remuneração, valor <strong><u>muito acima do piso dos bancários, diferenciando-o de um SIMPLES CAIXA, quer seja pelas atividades desenvolvida, quer seja pela maior remuneração auferida.</u></strong></p>
second paragraph:
<p style="text-align:justify"> Nesse passo, verifica-se que era depositada uma confiança acima do comum, além daquela que é inerente a qualquer relação de emprego, <strong>e muito diferenciada das responsabilidades daqueles que exercem cargos de base (caixas, agentes ou atendentes comerciais)</strong>, estes sim, bancários comuns.</p>
see that tab spaces were different, microsoft word redistributes spaces as the length of the sentence
someone can help me?
CKEditor is not Microsoft Word. CKEditor is focused on editing fragments of HTML documents from the semantical (structural) POV, not from the visual POV. You cannot expect it to work as Microsoft Word which, despite the seeming similarities, is a totally different tool.
So the behaviour you encountered is the right behaviour, because it is caused by how HTML and CSS works.

Initcap skip words smaller than 4 characters

I've got a question about initcap.
Is it posibible to create an initcap statement to skip the change of words that are smaller than 4 characters.
Because i have to change the words with less than 4 characters back to normal, after i've finished the initcap.
So i tought mabye there is a possibility to create an function/procedure/trigger that will just skip the words?? The words are used in an location name like "Son En Breugel", the "En" in the middle must become lower.
The first letter of the string doesn't need to change, only the first small words after a space(Like in the middle of the string)
I've started to create an procedure, but it needs a bit of finetuning
*All strings that don't need to be changed with initcap are changed back
*Initcap with xDutch format
--Still need to find way to change 'S into 's, i think i've deleted the record with this script?
Can somebody assis me with this??
create or replace PROCEDURE Location_Name_Routine IS
BEGIN
DELETE
FROM Location
WHERE Name LIKE '%[^0-9a-zA-Z]%';
UPDATE Location
set Name = nls_initcap(Name, 'NLS_SORT=xDutch');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' En',' en');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' Van',' van');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' De',' de');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' Den',' den');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' Over','over');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' Aan',' aan');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' Bij',' bij');
END;
There may not be a simple answer to the underlying question. I assume you are trying to properly capitalize addresses in Dutch and this question is related to this other question from yesterday.
Combining the questions, there are at least three special cases so far:
'S GRAVENHAGE => 's Gravenhage
IJSLAND => IJsland
SON EN BREUGEL => Son en Breugel
INITCAP and even NLS_INITCAP('...', 'NLS_SORT=xDutch') fail to properly handle them. Before you start coding you should collect all the requirements. Are these the only rules for Dutch capitalization, or are there many more?
The answers posted so far may help to solve one specific exception. But chances are you cannot simply combine regular expressions and solve them all. You may want to take a more top-down approach here.
UPDATE
Based on wolφi's idead, it is possible to brute-force the problem by using all existing names. NLS_INITCAP alone works 95% of the time. Using the 431 names from the spreadsheet at this link it is possible to build a list of all 25 exceptional cases.
Run this statement once to build a DECODE expression to handle all non-trivial cases:
--Build decode for UPDATE.
select
--Start the decode
'decode(upper(name),'||
--List all the exceptions. Single quotes are a mess, no way around it.
listagg(
--Upper case version to match
''''||upper(replace(column_value, '''', ''''''))||
--Pre-defined init-capped version
''','''||replace(column_value, '''', '''''')||''''
, ','||chr(10)
)
within group (order by column_value)
||
--Default to NLS_INITCAP
',nls_initcap(name, ''NLS_SORT=xDutch''))'
from table(sys.odcivarchar2list('Bellingwedde','Menterwolde','Oldambt','Pekela','Stadskanaal','Veendam','Vlagtwedde','Appingedam','Delfzijl','Loppersum','Bedum','Ten Boer','Eemsmond','Groningen','Grootegast','Haren','Hoogezand-Sappemeer','Leek','De Marne','Marum','Slochteren','Winsum','Zuidhorn','Achtkarspelen','Ameland','het Bildt','Boarnsterhim','Dantumadiel','Dongeradeel','Ferwerderadiel','Franekeradeel','Harlingen','Kollumerland en Nieuwkruisland','Leeuwarden','Leeuwarderadeel','Littenseradiel','Menaldumadeel','Schiermonnikoog','Terschelling','Tytsjerksteradiel','Vlieland','Bolsward','Gaasterlân-Sleat','Lemsterland','Nijefurd','Sneek','Wûnseradiel','Wymbritseradiel','Heerenveen','Ooststellingwerf','Opsterland','Skarsterlân','Smallingerland','Weststellingwerf','Aa en Hunze','Assen','Midden-Drenthe','Noordenveld','Tynaarlo','Borger-Odoorn','Coevorden','Emmen','Hoogeveen','Meppel','Westerveld','De Wolden','Dalfsen','Hardenberg','Kampen','Ommen','Staphorst','Steenwijkerland','Zwartewaterland','Zwolle','Deventer','Olst-Wijhe','Raalte','Almelo','Borne','Dinkelland','Enschede','Haaksbergen','Hellendoorn','Hengelo','Hof van Twente','Losser','Oldenzaal','Rijssen-Holten','Tubbergen','Twenterand','Wierden','Apeldoorn','Barneveld','Ede','Elburg','Epe','Ermelo','Harderwijk','Hattem','Heerde','Nijkerk','Nunspeet','Oldebroek','Putten','Scherpenzeel','Voorst','Wageningen','Buren','Culemborg','Geldermalsen','Lingewaal','Maasdriel','Neder-Betuwe','Neerijnen','Tiel','West Maas en Waal','Zaltbommel','Aalten','Berkelland','Bronckhorst','Brummen','Doetinchem','Lochem','Montferland','Oost Gelre','Oude IJsselstreek','Winterswijk','Zutphen','Arnhem','Beuningen','Doesburg','Druten','Duiven','Groesbeek','Heumen','Lingewaard','Millingen aan de Rijn','Nijmegen','Overbetuwe','Renkum','Rheden','Rijnwaarden','Rozendaal','Ubbergen','Westervoort','Wijchen','Zevenaar','Almere','Dronten','Lelystad','Noordoostpolder','Urk','Zeewolde','Abcoude','Amersfoort','Baarn','De Bilt','Breukelen','Bunnik','Bunschoten','Eemnes','Houten','IJsselstein','Leusden','Loenen','Lopik','Maarssen','Montfoort','Nieuwegein','Oudewater','Renswoude','Rhenen','De Ronde Venen','Soest','Utrecht','Utrechtse Heuvelrug','Veenendaal','Vianen','Wijk bij Duurstede','Woerden','Woudenberg','Zeist','Andijk','Anna Paulowna','Drechterland','Enkhuizen','Harenkarspel','Den Helder','Hoorn','Koggenland','Medemblik','Niedorp','Opmeer','Schagen','Stede Broec','Texel','Wervershoof','Wieringen','Wieringermeer','Zijpe','Alkmaar','Bergen (NH.)','Heerhugowaard','Heiloo','Langedijk','Schermer','Beverwijk','Castricum','Heemskerk','Uitgeest','Velsen','Bloemendaal','Haarlem','Haarlemmerliede en Spaarnwoude','Heemstede','Zandvoort','Wormerland','Zaanstad','Aalsmeer','Amstelveen','Amsterdam','Beemster','Diemen','Edam-Volendam','Graft-De Rijp','Haarlemmermeer','Landsmeer','Oostzaan','Ouder-Amstel','Purmerend','Uithoorn','Waterland','Zeevang','Blaricum','Bussum','Hilversum','Huizen','Laren','Muiden','Naarden','Weesp','Wijdemeren','Hillegom','Kaag en Braassem','Katwijk','Leiden','Leiderdorp','Lisse','Noordwijk','Noordwijkerhout','Oegstgeest','Teylingen','Voorschoten','Zoeterwoude','''s-Gravenhage','Leidschendam-Voorburg','Pijnacker-Nootdorp','Rijswijk','Wassenaar','Zoetermeer','Delft','Midden-Delfland','Westland','Alphen aan den Rijn','Bergambacht','Bodegraven','Boskoop','Gouda','Nieuwkoop','Reeuwijk','Rijnwoude','Schoonhoven','Vlist','Waddinxveen','Albrandswaard','Barendrecht','Bernisse','Binnenmaas','Brielle','Capelle aan den IJssel','Cromstrijen','Dirksland','Goedereede','Hellevoetsluis','Korendijk','Krimpen aan den IJssel','Lansingerland','Maassluis','Middelharnis','Nederlek','Oostflakkee','Oud-Beijerland','Ouderkerk','Ridderkerk','Rotterdam','Rozenburg','Schiedam','Spijkenisse','Strijen','Vlaardingen','Westvoorne','Zuidplas','Alblasserdam','Dordrecht','Giessenlanden','Gorinchem','Graafstroom','Hardinxveld-Giessendam','Hendrik-Ido-Ambacht','Leerdam','Liesveld','Nieuw-Lekkerland','Papendrecht','Sliedrecht','Zederik','Zwijndrecht','Hulst','Sluis','Terneuzen','Borsele','Goes','Kapelle','Middelburg','Noord-Beveland','Reimerswaal','Schouwen-Duiveland','Tholen','Veere','Vlissingen','Bergen op Zoom','Breda','Drimmelen','Etten-Leur','Geertruidenberg','Halderberge','Moerdijk','Oosterhout','Roosendaal','Rucphen','Steenbergen','Woensdrecht','Zundert','Aalburg','Alphen-Chaam','Baarle-Nassau','Dongen','Gilze en Rijen','Goirle','Hilvarenbeek','Loon op Zand','Oisterwijk','Tilburg','Waalwijk','Werkendam','Woudrichem','Bernheze','Boekel','Boxmeer','Boxtel','Cuijk','Grave','Haaren','''s-Hertogenbosch','Heusden','Landerd','Lith','Maasdonk','Mill en Sint Hubert','Oss','Schijndel','Sint Anthonis','Sint-Michielsgestel','Sint-Oedenrode','Uden','Veghel','Vught','Asten','Bergeijk','Best','Bladel','Cranendonck','Deurne','Eersel','Eindhoven','Geldrop-Mierlo','Gemert-Bakel','Heeze-Leende','Helmond','Laarbeek','Nuenen, Gerwen en Nederwetten','Oirschot','Reusel-De Mierden','Someren','Son en Breugel','Valkenswaard','Veldhoven','Waalre','Beesel','Bergen (L.)','Gennep','Horst aan de Maas','Mook en Middelaar','Peel en Maas','Venlo','Venray','Echt-Susteren','Leudal','Maasgouw','Nederweert','Roerdalen','Roermond','Weert','Beek','Brunssum','Eijsden','Gulpen-Wittem','Heerlen','Kerkrade','Landgraaf','Maastricht','Margraten','Meerssen','Nuth','Onderbanken','Schinnen','Simpelveld','Sittard-Geleen','Stein','Vaals','Valkenburg aan de Geul','Voerendaal'))
where column_value <> nls_initcap(column_value, 'NLS_SORT=xDutch');
Use the result from that statement to build an UPDATE like this:
--Update names to properly init-capped name, as defined by:
--http://epp.eurostat.ec.europa.eu/portal/page/portal/nuts_nomenclature/local_administrative_units
update location
set name =
decode(upper(name),'''S-GRAVENHAGE','''s-Gravenhage',
'''S-HERTOGENBOSCH','''s-Hertogenbosch',
'AA EN HUNZE','Aa en Hunze',
'ALPHEN AAN DEN RIJN','Alphen aan den Rijn',
'BERGEN (NH.)','Bergen (NH.)',
'BERGEN OP ZOOM','Bergen op Zoom',
'CAPELLE AAN DEN IJSSEL','Capelle aan den IJssel',
'GILZE EN RIJEN','Gilze en Rijen',
'HAARLEMMERLIEDE EN SPAARNWOUDE','Haarlemmerliede en Spaarnwoude',
'HOF VAN TWENTE','Hof van Twente',
'HORST AAN DE MAAS','Horst aan de Maas',
'KAAG EN BRAASSEM','Kaag en Braassem',
'KOLLUMERLAND EN NIEUWKRUISLAND','Kollumerland en Nieuwkruisland',
'KRIMPEN AAN DEN IJSSEL','Krimpen aan den IJssel',
'LOON OP ZAND','Loon op Zand',
'MILL EN SINT HUBERT','Mill en Sint Hubert',
'MILLINGEN AAN DE RIJN','Millingen aan de Rijn',
'MOOK EN MIDDELAAR','Mook en Middelaar',
'NUENEN, GERWEN EN NEDERWETTEN','Nuenen, Gerwen en Nederwetten',
'PEEL EN MAAS','Peel en Maas',
'SON EN BREUGEL','Son en Breugel',
'VALKENBURG AAN DE GEUL','Valkenburg aan de Geul',
'WEST MAAS EN WAAL','West Maas en Waal',
'WIJK BIJ DUURSTEDE','Wijk bij Duurstede',
'HET BILDT','het Bildt',
nls_initcap(name, 'NLS_SORT=xDutch'));
If the question is about Dutch place names, would it be an option to have a lookup table? According to eurostat, there are 418 "Gemeenten" on NUTS5/LAU2 level. A list is available at http://epp.eurostat.ec.europa.eu/portal/page/portal/nuts_nomenclature/local_administrative_units. If this is not acceptable, you could at least verify your procedure with the official list...

Resources