import sys
import yaml
with open(sys.argv[1]) as fp:
data = fp.read()
if not data.find("---") == 0:
# no head
print("NO YAML HEAD FOUND")
sys.exit(-1)
data = data[3:]
head_end = data.find("---")
head = data[0:head_end]
data = data[head_end+3:]
metadata = yaml.safe_load(head)
cats = metadata.pop('categories', None)
if cats != None:
if type(cats) == list:
tags = cats
elif type(cats) == str:
tags = cats.split()
tags = list(map(lambda t: t.lower(), tags))
metadata["tags"] = ", ".join(tags)
new_data = f"---\n{yaml.dump(metadata, default_flow_style=False)}---{data}"
# write it
print(f"coverted: categories to tags: {tags} - {sys.argv[1]}")
with open(sys.argv[1], "w") as fp:
fp.write(new_data)
sys.exit(0)
if not metadata.get("tags", None):
metadata["tags"] = "untagged"
new_data = f"---\n{yaml.dump(metadata, default_flow_style=False)}---{data}"
print(f"untagged: {sys.argv[1]}")
# write it
with open(sys.argv[1], "w") as fp:
fp.write(new_data)
sys.exit(0)
print("No changes needed")
20 lines
989 B
Markdown
20 lines
989 B
Markdown
---
|
|
author: dhananjayishere
|
|
comments: true
|
|
date: 2011-10-11 10:18:00
|
|
layout: post
|
|
slug: latex-on-the-go
|
|
tags: latex, tips
|
|
title: LaTeX on the go.
|
|
wordpress_id: 75017934
|
|
---
|
|
|
|
This is just another day I thanked web 2.0, this time the story goes like this.
|
|
|
|
I needed to prepare a LaTeX document on the go, had no laptop with me and I couldnt find one with LaTeX installed, and installing LaTeX with current internet speeds, was the unthinkable.
|
|
|
|
I tried to settle with a word processor, but the idea hit me that I should search web, a simple search took me to [http://duckduckgo.com/?q=online+latex+editors](http://duckduckgo.com/?q=online+latex+editors)
|
|
|
|
I selected two links from the top,
|
|
[MonkeyTex](http://monkeytex.bradcater.webfactional.com/) has a really simple no frills yet beautiful interface, where [ScribeTex](https://www.scribtex.com/) offer a feature filled one. They also offer paid plans, other than a free plan which restricts you in number of projects and collaborators.
|