Browse Source

Fixed the title detection

master
Julio Biason 6 years ago
parent
commit
dfbd8c2f10
  1. 8
      makeidx.py
  2. 2
      porque-rust.html

8
makeidx.py

@ -11,7 +11,8 @@ import datetime
import json
DATA_BACKGROUND = re.compile(r"data-background=['\"](.*?)['\"]")
PRES_TITLE = re.compile(r"<h1.*?>(.*?)</h1>")
PRES_TITLE1 = re.compile(r"<h1.*?>(.*?)</h1>")
PRES_TITLE2 = re.compile(r"<h2.*?>(.*?)</h2>")
HEADER = re.compile(r"section.*data-background=['\"]"
r"(?P<image>.*?)['\"].*data-header"
r"(?P<content>.*?)section", re.M | re.S)
@ -33,7 +34,10 @@ def retrieve_presentation_info(filename):
logging.debug('Header: %r', header.groupdict())
image = header.groupdict()['image']
title = PRES_TITLE.search(header.groupdict()['content'])
title = PRES_TITLE1.search(header.groupdict()['content'])
if not title:
title = PRES_TITLE2.search(header.groupdict()['content'])
if content and image and title:
logging.debug('Image for %s = %s', filename, image)

2
porque-rust.html

@ -74,7 +74,7 @@
<div class="slides">
<section>
<section data-background="_images/rust-ferris.png" data-header>
<h2 class="semi-opaque">Porque Rust</h2>
<h2 class="semi-opaque">Porque Você Deveria Aprender Rust</h2>
</section>
</section>

Loading…
Cancel
Save