diff --git a/content/categories/comercios.xml b/content/categories/comercios.xml
index 274e1ea..0680b6f 100644
--- a/content/categories/comercios.xml
+++ b/content/categories/comercios.xml
@@ -5,6 +5,7 @@
¿Quieres que tu comercio aparezca aquí? Contacta con contact@owlcode.tech
2
+
Comercios
comercios
true
diff --git a/content/categories/donde-comer.xml b/content/categories/donde-comer.xml
index d3abe49..326afb6 100644
--- a/content/categories/donde-comer.xml
+++ b/content/categories/donde-comer.xml
@@ -1,21 +1,23 @@
- Donde comer en Burguillos. - Cartas y Menús.
-
+ Donde comer en Burguillos. - Cartas y Menús.
+
Descubre los bares y restaurantes de Burguillos con sus cartas, menús y datos de contacto.
- Aquí puedes encontrar información acerca de los negocios de hostelería de Burguillos.
+ Aquí puedes encontrar información acerca de los negocios de hostelería de Burguillos.
Disfruta tu comida.
- ¿Quieres que tu comercio aparezca aquí? Contacta con contact@owlcode.tech
-
+ ¿Quieres que tu comercio aparezca aquí? Contacta con contact@owlcode.tech
+
comercios
- 0
- Donde comer
- donde-comer
+ 0
+ Donde comer
+ donde-comer
+
Comida vegana en Burguillos.
comida-vegana
1
Listado de sitios que tienen oferta de platos veganos.
+
Restaurantes y bares con comida vegana en Burguillos.
@@ -31,6 +33,7 @@
reparto-a-domicilio-comida
0
Listado de sitios de comida con reparto a domicilio.
+
Cartas y Menús de Pizzerías, Hamburgueserías, Kebab, Restaurantes, Bares, etc.
@@ -43,6 +46,7 @@
Comer hamburguesas en Burguillos - Cartas y Menús.
hamburguesas
0
+
Listado de sitios de comida que preparan hamburguesas.
Hamburgueserias y todo tipo de establecimientos que preparan hamburguesas.
diff --git a/content/categories/index.xml b/content/categories/index.xml
index 6efaf33..5939d63 100644
--- a/content/categories/index.xml
+++ b/content/categories/index.xml
@@ -1,16 +1,17 @@
Información de Burguillos.
-
-
-
-
-
-
- Burguillos.info no está afiliado con el Ayuntamiento de Burguillos.
+
+
+
+
+
+
+ Descubre todo lo que Burguillos, Sevilla tiene para ofrecerte.
- Esta página está destinada a informar de los sucesos y negocios de nuestro pueblo, cualquiera puede redactar una noticia para que aparezca en este medio mientras pase un proceso de revisión por parte del staff de Burguillos.info.
-
- 0
-
- index
+ Un mundo de posibilidades a tu alcance en Burguillos.
+
+
+ 0
+
+ index
diff --git a/lib/BurguillosInfo/Categories.pm b/lib/BurguillosInfo/Categories.pm
index fcec10f..688f8e0 100644
--- a/lib/BurguillosInfo/Categories.pm
+++ b/lib/BurguillosInfo/Categories.pm
@@ -23,7 +23,7 @@ sub new {
return bless {}, shift;
}
-sub Retrieve($self) {
+sub Retrieve ($self) {
if ( defined $cached_categories ) {
return $cached_categories;
}
@@ -31,35 +31,45 @@ sub Retrieve($self) {
for my $category_file ( $CATEGORIES_DIR->children ) {
warn "Bad file $category_file, omiting...", next
if !-f $category_file || $category_file !~ /\.xml$/;
- my $dom = Mojo::DOM->new( $category_file->slurp_utf8 );
- defined(my $title = $dom->at(':root > title')->text)
+ my $dom = Mojo::DOM->new( $category_file->slurp_utf8 );
+ defined( my $title = $dom->at(':root > title')->text )
or die "Missing title at $category_file.";
- defined(my $description = $dom->at(':root > description')->content)
+ defined( my $description = $dom->at(':root > description')->content )
or die "Missing description at $category_file";
- defined(my $slug = $dom->at(':root > slug')->text)
+ defined( my $slug = $dom->at(':root > slug')->text )
or die "Missing slug at $category_file";
- defined (my $menu_text = $dom->at(':root > menu_text')->content)
+ defined( my $menu_text = $dom->at(':root > menu_text')->content )
or die "Missing menu_text at $category_file";
- defined (my $priority = $dom->at(':root > priority')->text)
+ defined( my $priority = $dom->at(':root > priority')->text )
or die "Missing priority at $category_file";
- my $attributes = $self->_GetAttributes($dom, $category_file);
- my $parent_tag = $dom->at(':root > parent');
- my $random_tag = $dom->at(':root > random');
+ my $attributes = $self->_GetAttributes( $dom, $category_file );
+ my $parent_tag = $dom->at(':root > parent');
+ my $random_tag = $dom->at(':root > random');
+ my $image_element = $dom->at(':root > img');
+ my $image;
+ my $image_bottom_preview;
my $random;
- if (defined $random_tag) {{
- $random = $random_tag->text;
- if ($random =~ /^true$/i || $random =~ /^yes$/ ) {
- $random = 1;
- next;
+
+ if ( defined $random_tag ) {
+ {
+ $random = $random_tag->text;
+ if ( $random =~ /^true$/i || $random =~ /^yes$/ ) {
+ $random = 1;
+ next;
+ }
+ if ( int($random) != 0 ) {
+ $random = 1;
+ next;
+ }
+ $random = 0;
}
- if (int($random) != 0) {
- $random = 1;
- next;
- }
- $random = 0;
- }}
+ }
+ if ( defined $image_element ) {
+ $image = $image_element->attr->{src};
+ $image_bottom_preview = $image_element->attr->{'bottom-preview'};
+ }
my $parent;
- if (defined $parent_tag) {
+ if ( defined $parent_tag ) {
$parent = $parent_tag->content;
}
my $category = {
@@ -69,16 +79,16 @@ sub Retrieve($self) {
description => $description,
priority => $priority,
(
- (defined $parent) ?
- (parent => $parent) :
- ()
+ ( defined $parent ) ? ( parent => $parent )
+ : ()
),
attributes => $attributes,
(
- (defined $random) ?
- (random => $random):
- ()
- )
+ ( defined $random ) ? ( random => $random )
+ : ()
+ ),
+ image_bottom_preview => $image_bottom_preview,
+ image => $image,
};
$cached_categories->{$slug} = $category;
}
@@ -87,47 +97,64 @@ sub Retrieve($self) {
return $cached_categories;
}
-sub _GetAttributes($self, $dom, $category_file) {
+sub _GetAttributes ( $self, $dom, $category_file ) {
my $attributes_tag = $dom->at(':root > attributes');
my %attributes;
- if (defined $attributes_tag) {
- my @attribute_tag_list = $attributes_tag->find('attributes > attribute')->each;
+ if ( defined $attributes_tag ) {
+ my @attribute_tag_list =
+ $attributes_tag->find('attributes > attribute')->each;
for my $attribute_tag (@attribute_tag_list) {
- defined (my $menu_text = $attribute_tag->at('attribute > menu_text')->content)
+ defined( my $menu_text =
+ $attribute_tag->at('attribute > menu_text')->content )
or die "Missing attribute menu_text at $category_file";
- defined (my $description = $attribute_tag->at('attribute > description')->content)
+ defined( my $description =
+ $attribute_tag->at('attribute > description')->content )
or die "Missing attribute description at $category_file";
- defined (my $title = $attribute_tag->at('attribute > title')->text)
+ defined( my $title = $attribute_tag->at('attribute > title')->text )
or die "Missing attribute title at $category_file";
- defined (my $identifier = $attribute_tag->at('attribute > identifier')->text)
+ defined( my $identifier =
+ $attribute_tag->at('attribute > identifier')->text )
or die "Missing attribute identifier at $category_file";
- defined (my $priority = $attribute_tag->at('attribute > priority')->text)
+ defined( my $priority =
+ $attribute_tag->at('attribute > priority')->text )
or die "Missing attribute priority at $category_file";
+ my $image_element = $attribute_tag->at('attribute > img');
+ my $image;
+ my $image_bottom_preview;
+
+ if ( defined $image_element ) {
+ $image = $image_element->attr->{src};
+ $image_bottom_preview =
+ $image_element->attr->{'bottom-preview'};
+ }
$attributes{$identifier} = {
- title => $title,
- identifier => $identifier,
- priority => $priority,
- menu_text => $menu_text,
- description => $description,
+ title => $title,
+ identifier => $identifier,
+ priority => $priority,
+ menu_text => $menu_text,
+ description => $description,
+ image => $image,
+ image_bottom_preview => $image_bottom_preview,
};
}
}
return \%attributes;
}
-sub _PopulateChildrenField($self, $categories) {
- for my $category_name (keys %$categories) {
+sub _PopulateChildrenField ( $self, $categories ) {
+ for my $category_name ( keys %$categories ) {
my $category = $categories->{$category_name};
$category->{children} //= [];
my $parent_name = $category->{parent};
- if (!defined $parent_name) {
+ if ( !defined $parent_name ) {
next;
}
my $parent = $categories->{$parent_name};
- if (!defined $parent) {
- die "Category $parent_name not exists and it is the parent of $category_name.";
+ if ( !defined $parent ) {
+ die
+"Category $parent_name not exists and it is the parent of $category_name.";
}
- if (!exists $category->{random} && exists $parent->{random}) {
+ if ( !exists $category->{random} && exists $parent->{random} ) {
$category->{random} = $parent->{random};
}
$parent->{children} //= [];
@@ -135,19 +162,23 @@ sub _PopulateChildrenField($self, $categories) {
}
}
-sub _AvoidGrandChildCategories($self, $categories) {
- for my $category_slug (keys %$categories) {
+sub _AvoidGrandChildCategories ( $self, $categories ) {
+ for my $category_slug ( keys %$categories ) {
my $category = $categories->{$category_slug};
- my $parent = $category->{parent};
- if (defined $parent && defined $categories->{$parent}{parent}) {
- die "$category_slug category is grandchild of $categories->{$parent}{parent}) category and this is not allowed.";
+ my $parent = $category->{parent};
+ if ( defined $parent && defined $categories->{$parent}{parent} ) {
+ die
+"$category_slug category is grandchild of $categories->{$parent}{parent}) category and this is not allowed.";
}
}
}
-sub PreviewOg($self, $category) {
- my $title = $category->{title};
- my $description = $category->{description};
- return BurguillosInfo::Preview->Generate($title, $description, undef);
+sub PreviewOg ( $self, $category ) {
+ my $title = $category->{title};
+ my $description = $category->{description};
+ my $image = $category->{image};
+ my $image_bottom_preview = $category->{image_bottom_preview};
+ return BurguillosInfo::Preview->Generate( $title, $description, $image,
+ $image_bottom_preview );
}
1;
diff --git a/lib/BurguillosInfo/Command/index.pm b/lib/BurguillosInfo/Command/index.pm
index 3accfe8..47a561f 100644
--- a/lib/BurguillosInfo/Command/index.pm
+++ b/lib/BurguillosInfo/Command/index.pm
@@ -50,16 +50,22 @@ sub _index_categories ( $self, $index, $categories ) {
->all_text;
my $title = $category->{title};
my $attributes = $category->{attributes};
+ my $image = $category->{image};
$self->_index_attributes( $index, $slug, $attributes );
- push @$index,
- {
- title => $title,
- titleNormalized => $index_utils->n($title),
- content => $content,
- contentNormalized => $index_utils->n( $content =~ s/\s+/ /gr ),
- url => $url,
- urlNormalized => $index_utils->n($url),
- };
+ push @$index, {
+ title => $title,
+ titleNormalized => $index_utils->n($title),
+ content => $content,
+ contentNormalized => $index_utils->n( $content =~ s/\s+/ /gr ),
+ url => $url,
+ urlNormalized => $index_utils->n($url),
+ (
+ ( defined $image )
+ ? ( urlImage => $image )
+ : ()
+ )
+
+ };
}
}
@@ -70,6 +76,7 @@ sub _index_attributes ( $self, $index, $category_slug, $attributes ) {
my $slug = $attribute->{identifier};
my $url = "/$category_slug/atributo/$slug";
my $title = $attribute->{title};
+ my $image = $attribute->{image};
my $content =
Mojo::DOM->new( '' . $attribute->{description} . '' )
->all_text;
@@ -81,6 +88,11 @@ sub _index_attributes ( $self, $index, $category_slug, $attributes ) {
content => $content =~ s/\s+/ /gr,
urlNormalized => $index_utils->n($url),
url => $url,
+ (
+ ( defined $image )
+ ? ( urlImage => $image )
+ : ()
+ )
};
}
}
diff --git a/lib/BurguillosInfo/Controller/Attribute.pm b/lib/BurguillosInfo/Controller/Attribute.pm
index 4477631..7107bf8 100644
--- a/lib/BurguillosInfo/Controller/Attribute.pm
+++ b/lib/BurguillosInfo/Controller/Attribute.pm
@@ -28,7 +28,8 @@ sub get_attribute_preview ($self) {
$self->render(
format => 'png',
data => BurguillosInfo::Preview->Generate(
- $attribute->{title}, $attribute->{description}, undef
+ $attribute->{title}, $attribute->{description},
+ $attribute->{image}, $attribute->{image_bottom_preview}
),
);
}
diff --git a/lib/BurguillosInfo/Preview.pm b/lib/BurguillosInfo/Preview.pm
index 4dc0381..f1f333c 100644
--- a/lib/BurguillosInfo/Preview.pm
+++ b/lib/BurguillosInfo/Preview.pm
@@ -23,7 +23,7 @@ const my $SVG_HEIGHT => 627;
const my $SVG_EMBEDDED_IMAGE_MAX_WIDTH => 1200;
const my $SVG_EMBEDDED_IMAGE_MAX_HEIGHT => 400;
-sub Generate($self, $title, $content, $image_file, $image_bottom_preview) {
+sub Generate($self, $title, $content, $image_file = undef, $image_bottom_preview = undef) {
my $dom = Mojo::DOM->new($content);
$content = $dom->all_text;
diff --git a/public/img/comercio.webp b/public/img/comercio.webp
new file mode 100644
index 0000000..827a095
Binary files /dev/null and b/public/img/comercio.webp differ
diff --git a/public/img/comida-domicilio.webp b/public/img/comida-domicilio.webp
new file mode 100644
index 0000000..7cc394a
Binary files /dev/null and b/public/img/comida-domicilio.webp differ
diff --git a/public/img/donde-comer.webp b/public/img/donde-comer.webp
new file mode 100644
index 0000000..eed050a
Binary files /dev/null and b/public/img/donde-comer.webp differ
diff --git a/public/img/hamburguesa.webp b/public/img/hamburguesa.webp
new file mode 100644
index 0000000..6240b16
Binary files /dev/null and b/public/img/hamburguesa.webp differ
diff --git a/public/img/rotonda.webp b/public/img/rotonda.webp
new file mode 100644
index 0000000..807edb5
Binary files /dev/null and b/public/img/rotonda.webp differ
diff --git a/public/img/vegano.webp b/public/img/vegano.webp
new file mode 100644
index 0000000..af2864a
Binary files /dev/null and b/public/img/vegano.webp differ