Mercurial > blahgd > fmt4
changeset 1173:53238409d23e
post fmt3: don't parse \category values
Categories are no more, so we don't need to keep track of \category values.
We simply ignore them.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Fri, 01 Feb 2019 16:26:29 -0500 |
parents | 456cc92b9004 |
children | bab5200701ad |
files | docs/lisp-metadata.txt post.c post_fmt3.l post_fmt3.y |
diffstat | 4 files changed, 6 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/lisp-metadata.txt Fri Feb 01 16:22:11 2019 -0500 +++ b/docs/lisp-metadata.txt Fri Feb 01 16:26:29 2019 -0500 @@ -15,7 +15,6 @@ (title . "abcdef") (fmt . 3) (tags "tag1" "tag2") - (cats "cat1" "cat2") (comments 1 2 3) (listed #t)) @@ -30,11 +29,9 @@ tags: list of tags associated with this post - cats: list of categories associated with this post - comments: entry enumerates all the comment IDs for this post - listed: list this post on the index/category/tag/archive pages? + listed: list this post on the index/tag/archive pages? Comment
--- a/post.c Fri Feb 01 16:22:11 2019 -0500 +++ b/post.c Fri Feb 01 16:26:29 2019 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2018 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * Copyright (c) 2009-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -249,7 +249,6 @@ x.sc_title = NULL; x.sc_pub = NULL; x.sc_tags = NULL; - x.sc_cats = NULL; x.sc_twitter_img = NULL; fmt3_lex_init(&x.scanner); @@ -265,7 +264,7 @@ * Now update struct post based on what we got from the .tex file. * The struct is already populated by data from the metadata file. * For the simple string values, we merely override whatever was - * there. For tags and categories we use the union. + * there. For tags we use the union. */ if (x.sc_title) { @@ -282,7 +281,6 @@ } post_add_tags(&post->tags, x.sc_tags); - post_add_tags(&post->cats, x.sc_cats); str_putref(x.sc_title); str_putref(x.sc_pub); @@ -357,14 +355,12 @@ __refresh_published_prop(post, lv); - /* empty out the tags/cats/comments lists */ + /* empty out the tags/comments lists */ post_remove_all_tags(&post->tags); - post_remove_all_tags(&post->cats); post_remove_all_comments(post); - /* populate the tags/cats/comments lists */ + /* populate the tags/comments lists */ post_add_tags(&post->tags, sexpr_alist_lookup_list(lv, "tags")); - post_add_tags(&post->cats, sexpr_alist_lookup_list(lv, "cats")); post_add_comments(post, sexpr_alist_lookup_list(lv, "comments")); val_putref(lv); @@ -464,8 +460,6 @@ rb_create(&post->tags, tag_cmp, sizeof(struct post_tag), offsetof(struct post_tag, node)); - rb_create(&post->cats, tag_cmp, sizeof(struct post_tag), - offsetof(struct post_tag, node)); list_create(&post->comments, sizeof(struct comment), offsetof(struct comment, list)); refcnt_init(&post->refcnt, 1); @@ -513,7 +507,6 @@ void post_destroy(struct post *post) { post_remove_all_tags(&post->tags); - post_remove_all_tags(&post->cats); post_remove_all_comments(post); nvl_putref(post->files);
--- a/post_fmt3.l Fri Feb 01 16:22:11 2019 -0500 +++ b/post_fmt3.l Fri Feb 01 16:26:29 2019 -0500 @@ -69,7 +69,6 @@ "\\title{" { BEGIN(SPECIALCMD); return TITLESTART; } "\\published{" { BEGIN(SPECIALCMD); return PUBSTART; } "\\tag{" { BEGIN(SPECIALCMD); return TAGSTART; } -"\\category{" { BEGIN(SPECIALCMD); return CATSTART; } "\\twitterimg{" { BEGIN(SPECIALCMD); return TWITTERIMGSTART; } "\\twitterphoto{" { BEGIN(SPECIALCMD); return TWITTERPHOTOSTART; } <SPECIALCMD>"}" { BEGIN(INITIAL); return SPECIALCMDEND; }
--- a/post_fmt3.y Fri Feb 01 16:22:11 2019 -0500 +++ b/post_fmt3.y Fri Feb 01 16:26:29 2019 -0500 @@ -172,7 +172,7 @@ %token <ptr> VERBTEXT %token VERBSTART VERBEND DOLLAR %token LISTSTART LISTEND -%token TITLESTART TAGSTART CATSTART PUBSTART TWITTERIMGSTART +%token TITLESTART TAGSTART PUBSTART TWITTERIMGSTART %token TWITTERPHOTOSTART %token SPECIALCMDEND @@ -223,7 +223,6 @@ | TITLESTART verb SPECIALCMDEND { $$ = NULL; special_cmd(data, &data->sc_title, $2, false); } | PUBSTART verb SPECIALCMDEND { $$ = NULL; special_cmd(data, &data->sc_pub, $2, false); } | TAGSTART verb SPECIALCMDEND { $$ = NULL; special_cmd_list(data, &data->sc_tags, $2); } - | CATSTART verb SPECIALCMDEND { $$ = NULL; special_cmd_list(data, &data->sc_cats, $2); } | TWITTERIMGSTART verb SPECIALCMDEND { $$ = NULL; special_cmd(data, &data->sc_twitter_img, $2, false); } | TWITTERPHOTOSTART verb SPECIALCMDEND