Corrección de limpieza de texto para etiquetas 'title'

This commit is contained in:
Nika Zhenya 2019-03-20 15:47:17 -06:00
parent 0ef14aa1d8
commit 95501e31cc
3 changed files with 11 additions and 6 deletions

View File

@ -69,9 +69,6 @@ Dir.glob(po_dir + '*/*.po').each do |po|
hash['content'].map!{|l| l.gsub('\\n', "\n")}
# Gets the title
hash['title'] = hash['content'][0].gsub(/^#\s+/, '').gsub(/\n\n/, '').strip
# Creates locale folder if it doesn't exists
if !File.directory?(html_dir + hash['locale'])
Dir.mkdir(html_dir + hash['locale'])
@ -90,6 +87,14 @@ Dir.glob(po_dir + '*/*.po').each do |po|
system("pc-pandog -i #{md_name} -o #{html_name}")
FileUtils.rm(md_name)
# Gets the title
hash['title'] = File.read(html_name)
.gsub(/\n/, '')
.gsub(/<style>[^<]*?<\/style>/, '')
.split(/<body>\s+<h1[^<]*?>/).last
.split(/<\/h1>/).first.strip
.gsub(/<[^<]*?>/, '')
# Cleans headers and footers and adds new headers and footers
html_tmp = File.read(html_name).split(/\n/)[8..-3]
html_tmp = html_tmp.unshift(File.read('../../../' + template_dir + 'header.html'))

View File

@ -50,7 +50,7 @@
</section>
<footer>
<p class="left no-indent">All content is under <a href="../../../content/html/en/_fork.html">Open and Free Publishing License (<span class="smallcap">LEAL</span>)</a>.</p>
<p class="left no-indent">Last build of this page: 2019/03/20, 15:15.</p>
<p class="left no-indent">Last build of this page: 2019/03/20, 15:46.</p>
<p class="left no-indent"><span class="smallcap"><a target="_blank" href="https://perrotuerto.blog/feed/en/rss.xml">RSS</a></span> | <a href="../../../content/html/en/001_free-publishing.html"><span class="versalita">EN</span></a> | <a href="../../../content/html/es/001_free-publishing.html"><span class="versalita">ES</span></a></p>
</footer>
</body>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="es">
<head>
<title>De la edición con _software_ libre a la edición libre</title>
<title>De la edición con software libre a la edición libre</title>
<meta charset="utf-8" />
<meta name="application-name" content="Publishing is Coding: Change My Mind">
<meta name="description" content="Blog about free culture, free software and free publishing.">
@ -50,7 +50,7 @@
</section>
<footer>
<p class="left no-indent">Todo el contenido está bajo <a href="../../../content/html/es/_fork.html">Licencia Editorial Abierta y Libre (<span class="smallcap">LEAL</span>)</a>.</p>
<p class="left no-indent">Última modificación de esta página: 2019/03/20, 15:15.</p>
<p class="left no-indent">Última modificación de esta página: 2019/03/20, 15:46.</p>
<p class="left no-indent"><span class="smallcap"><a target="_blank" href="https://perrotuerto.blog/feed/es/rss.xml">RSS</a></span> | <a href="../../../content/html/en/001_free-publishing.html"><span class="versalita">EN</span></a> | <a href="../../../content/html/es/001_free-publishing.html"><span class="versalita">ES</span></a></p>
</footer>
</body>