forked from boyska/sito-hackit-17
Merge branch 'master' of git.lattuga.net:boyska/sito-hackit-17
This commit is contained in:
commit
f01e8b25e0
3 changed files with 22 additions and 14 deletions
5
Makefile
5
Makefile
|
@ -12,6 +12,10 @@ DEBUG ?= 0
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
PELICANOPTS += -D
|
PELICANOPTS += -D
|
||||||
endif
|
endif
|
||||||
|
VERBOSE ?= 0
|
||||||
|
ifeq ($(VERBOSE), 1)
|
||||||
|
PELICANOPTS += -v
|
||||||
|
endif
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo 'Makefile for a pelican Web site '
|
@echo 'Makefile for a pelican Web site '
|
||||||
|
@ -25,6 +29,7 @@ help:
|
||||||
@echo ' make devserver [PORT=8000] start/restart develop_server.sh '
|
@echo ' make devserver [PORT=8000] start/restart develop_server.sh '
|
||||||
@echo ' make stopserver stop local server '
|
@echo ' make stopserver stop local server '
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
@echo 'Set the VERBOSE variable to 1 for some more messages, e.g. make VERBOSE=1 html'
|
||||||
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
|
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,15 @@ Also, `make help` is your friend.
|
||||||
|
|
||||||
**Morte ai nemici dell'UTF-8**
|
**Morte ai nemici dell'UTF-8**
|
||||||
|
|
||||||
|
Se devi debuggare, `make DEBUG=1 publish`
|
||||||
|
|
||||||
Aggiungere un talk
|
Aggiungere un talk
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
```sh
|
```
|
||||||
cp -r talks/_talk_example/ talks/MIOTALK/
|
cp -r talks/_talk_example/ talks/MIOTALK/
|
||||||
vim talks/MIOTALK/meta.yaml
|
vim talks/MIOTALK/meta.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Quindi rifai `make publish` come spiegato prima: l'output ti informa di eventuali errori nei campi o
|
Quindi rifai `make publish` come spiegato prima: l'output ti informa di eventuali errori nei campi o
|
||||||
sovrapposizioni con altri talk, leggilo!
|
sovrapposizioni con altri talk, leggilo!
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ def get_talk_data(talkname):
|
||||||
with io.open(fname, encoding='utf8') as buf:
|
with io.open(fname, encoding='utf8') as buf:
|
||||||
try:
|
try:
|
||||||
data = yaml.load(buf)
|
data = yaml.load(buf)
|
||||||
except Exception as exc:
|
except:
|
||||||
logging.exception("Syntax error reading %s; skipping", fname)
|
logging.exception("Syntax error reading %s; skipping", fname)
|
||||||
return None
|
return None
|
||||||
if data is None:
|
if data is None:
|
||||||
|
@ -134,15 +134,16 @@ def get_talk_data(talkname):
|
||||||
if 'day' in data:
|
if 'day' in data:
|
||||||
del data['day']
|
del data['day']
|
||||||
if 'day' in data:
|
if 'day' in data:
|
||||||
data['day'] = get_global_data()['startdate'] + datetime.timedelta(days=data['day'])
|
data['day'] = get_global_data()['startdate'] + \
|
||||||
|
datetime.timedelta(days=data['day'])
|
||||||
if 'time' in data and 'day' in data:
|
if 'time' in data and 'day' in data:
|
||||||
timeparts = re.findall(r'\d+', str(data['time']))
|
timeparts = re.findall(r'\d+', str(data['time']))
|
||||||
if 4 > len(timeparts) > 0:
|
if 4 > len(timeparts) > 0:
|
||||||
timeparts = [int(p) for p in timeparts]
|
timeparts = [int(p) for p in timeparts]
|
||||||
data['time'] = datetime.datetime.combine(data['day'],
|
data['time'] = datetime.datetime.combine(
|
||||||
datetime.time(*timeparts))
|
data['day'], datetime.time(*timeparts))
|
||||||
else:
|
else:
|
||||||
logging.error("Talk <{}> has malformed `time`".format(talkname))
|
logging.error("Talk <%s> has malformed `time`", talkname)
|
||||||
data['id'] = talkname
|
data['id'] = talkname
|
||||||
resdir = os.path.join(TALKS_PATH, talkname, TALK_ATTACHMENT_PATH)
|
resdir = os.path.join(TALKS_PATH, talkname, TALK_ATTACHMENT_PATH)
|
||||||
if os.path.isdir(resdir) and os.listdir(resdir):
|
if os.path.isdir(resdir) and os.listdir(resdir):
|
||||||
|
@ -251,16 +252,16 @@ class TalkGridDirective(Directive):
|
||||||
times[position + i*GRID_STEP][roomnum] = copy(talk)
|
times[position + i*GRID_STEP][roomnum] = copy(talk)
|
||||||
times[position + i*GRID_STEP][roomnum]['skip'] = True
|
times[position + i*GRID_STEP][roomnum]['skip'] = True
|
||||||
|
|
||||||
#with setlocale(locale.normalize(lang)):
|
|
||||||
render = tmpl.render(times=times,
|
render = tmpl.render(times=times,
|
||||||
rooms=rooms,
|
rooms=rooms,
|
||||||
mintime=mintime, maxtime=maxtime,
|
mintime=mintime, maxtime=maxtime,
|
||||||
timestep=GRID_STEP,
|
timestep=GRID_STEP,
|
||||||
lang=lang,
|
lang=lang,
|
||||||
)
|
)
|
||||||
output.append(nodes.raw('', u'<h4>%s</h4>' %
|
output.append(nodes.raw(
|
||||||
format_date(day, format='full', locale=lang),
|
'', u'<h4>%s</h4>' % format_date(day, format='full',
|
||||||
format='html'))
|
locale=lang),
|
||||||
|
format='html'))
|
||||||
output.append(nodes.raw('', render, format='html'))
|
output.append(nodes.raw('', render, format='html'))
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
@ -280,17 +281,18 @@ def talk_to_ics(talk):
|
||||||
if 'time' not in talk or 'duration' not in talk or 'room' not in talk:
|
if 'time' not in talk or 'duration' not in talk or 'room' not in talk:
|
||||||
return ''
|
return ''
|
||||||
start = talk['time']
|
start = talk['time']
|
||||||
end = start + datetime.timedelta(minutes=talk['duration'])
|
end = start + datetime.timedelta(minutes=talk['duration'])
|
||||||
content = 'BEGIN:VEVENT\n'
|
content = 'BEGIN:VEVENT\n'
|
||||||
content += "UID:%s@%d.hackmeeting.org\n" % (talk['id'], talk['day'].year)
|
content += "UID:%s@%d.hackmeeting.org\n" % (talk['id'], talk['day'].year)
|
||||||
content += "SUMMARY:%s\n" % talk['title']
|
content += "SUMMARY:%s\n" % talk['title']
|
||||||
content += "DTSTAMP:%s\n" % time.strftime('%Y%m%dT%H%M%SZ',
|
content += "DTSTAMP:%s\n" % time.strftime('%Y%m%dT%H%M%SZ',
|
||||||
time.gmtime(float(start.strftime('%s'))))
|
time.gmtime(float(
|
||||||
|
start.strftime('%s'))))
|
||||||
content += "DTSTART:%s\n" % time.strftime('%Y%m%dT%H%M%SZ',
|
content += "DTSTART:%s\n" % time.strftime('%Y%m%dT%H%M%SZ',
|
||||||
time.gmtime(float(
|
time.gmtime(float(
|
||||||
start.strftime('%s'))))
|
start.strftime('%s'))))
|
||||||
content += "DTEND:%s\n" % time.strftime('%Y%m%dT%H%M%SZ',
|
content += "DTEND:%s\n" % time.strftime('%Y%m%dT%H%M%SZ',
|
||||||
time.gmtime(float(
|
time.gmtime(float(
|
||||||
end.strftime('%s'))))
|
end.strftime('%s'))))
|
||||||
content += "LOCATION:%s\n" % talk['room']
|
content += "LOCATION:%s\n" % talk['room']
|
||||||
content += 'END:VEVENT\n'
|
content += 'END:VEVENT\n'
|
||||||
|
|
Loading…
Reference in a new issue