Hello community, here is the log from the commit of package blogc for openSUSE:Factory checked in at 2018-03-22 12:06:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/blogc (Old) and /work/SRC/openSUSE:Factory/.blogc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "blogc" Thu Mar 22 12:06:30 2018 rev:4 rq:589685 version:0.13.4 Changes: -------- --- /work/SRC/openSUSE:Factory/blogc/blogc.changes 2018-03-14 19:40:46.541498311 +0100 +++ /work/SRC/openSUSE:Factory/.blogc.new/blogc.changes 2018-03-22 12:11:30.503928466 +0100 @@ -1,0 +2,12 @@ +Wed Mar 21 09:48:24 UTC 2018 - [email protected] + +- Update to 0.13.4: + Minor release with bug-fixes and a minor blogc-make feature: + * When running commands, blogc-make(1) will show the command's + STDERR always, to avoid suppressing blogc(1) + warnings. + * When setting posts_per_page to -1 in blogcfile(5), the + pagination features are disabled, and all the posts are + included in the template listing blocks. + +------------------------------------------------------------------- Old: ---- blogc-0.13.3.tar.xz New: ---- blogc-0.13.4.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ blogc.spec ++++++ --- /var/tmp/diff_new_pack.jvPCu0/_old 2018-03-22 12:11:31.467893916 +0100 +++ /var/tmp/diff_new_pack.jvPCu0/_new 2018-03-22 12:11:31.475893629 +0100 @@ -17,7 +17,7 @@ Name: blogc -Version: 0.13.3 +Version: 0.13.4 Release: 0 Summary: Blog compiler License: BSD-3-Clause ++++++ blogc-0.13.3.tar.xz -> blogc-0.13.4.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/.tarball-version new/blogc-0.13.4/.tarball-version --- old/blogc-0.13.3/.tarball-version 2018-03-14 02:29:06.000000000 +0100 +++ new/blogc-0.13.4/.tarball-version 2018-03-20 23:34:15.000000000 +0100 @@ -1 +1 @@ -0.13.3 +0.13.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/.version new/blogc-0.13.4/.version --- old/blogc-0.13.3/.version 2018-03-14 02:29:06.000000000 +0100 +++ new/blogc-0.13.4/.version 2018-03-20 23:34:15.000000000 +0100 @@ -1 +1 @@ -0.13.3 +0.13.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/blogc-make.1 new/blogc-0.13.4/blogc-make.1 --- old/blogc-0.13.3/blogc-make.1 2018-03-14 02:29:06.000000000 +0100 +++ new/blogc-0.13.4/blogc-make.1 2018-03-20 23:34:15.000000000 +0100 @@ -109,7 +109,7 @@ \fBatom\fR . .SS "pagination" -Build pagination pages from posts\. +Build pagination pages from posts\. This rule is disabled if \fBposts_per_page\fR value in blogcfile(5) is negative or \fB0\fR\. . .P The rule passes the following helper variables to blogc(1): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/blogc-pagination.7 new/blogc-0.13.4/blogc-pagination.7 --- old/blogc-0.13.3/blogc-pagination.7 2018-03-14 02:29:05.000000000 +0100 +++ new/blogc-0.13.4/blogc-pagination.7 2018-03-20 23:34:14.000000000 +0100 @@ -13,12 +13,12 @@ blogc(1) accepts some variables as \fB\-D\fR options, that are used to filter the files passed as arguments to it: . .TP -\fBFILTER_PER_PAGE\fR -Integer, limits the maximum number of files to be listed\. +\fBFILTER_PAGE\fR +Integer, current page\. If calling blogc(1) with 10 files, \fBFILTER_PER_PAGE=4\fR and \fBFILTER_PAGE=3\fR, it will return just the 2 last files, skipping the first 2 pages with 4 files each one\. . .TP -\fBFILTER_PAGE\fR -Integer, current page\. If calling blogc(1) with 10 files, \fBFILTER_PER_PAGE\fR=4 and \fBFILTER_PAGE\fR=3, it will return just the 2 last files, skipping the first 2 pages with 4 files each one\. +\fBFILTER_PER_PAGE\fR +Integer, limits the maximum number of files to be listed\. If negative or \fB0\fR, no posts are included\. Have no effect if \fBFILTER_PAGE\fR is not defined\. . .TP \fBFILTER_TAG\fR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/blogc.spec new/blogc-0.13.4/blogc.spec --- old/blogc-0.13.3/blogc.spec 2018-03-14 02:29:04.000000000 +0100 +++ new/blogc-0.13.4/blogc.spec 2018-03-20 23:34:13.000000000 +0100 @@ -1,11 +1,11 @@ Name: blogc -Version: 0.13.3 +Version: 0.13.4 Release: 1%{?dist} License: BSD Group: Applications/Text Summary: A blog compiler URL: https://blogc.rgm.io/ -Source0: https://github.com/blogc/blogc/releases/download/v0.13.3/blogc-0.13.3.tar.xz +Source0: https://github.com/blogc/blogc/releases/download/v0.13.4/blogc-0.13.4.tar.xz BuildRequires: libcmocka-devel, bash, coreutils, diffutils %if ! 0%{?el6} BuildRequires: git, tar, make @@ -43,7 +43,7 @@ blogc-runserver is a simple HTTP server to test blogc websites. %prep -%setup -q -n blogc-0.13.3 +%setup -q -n blogc-0.13.4 %build %if 0%{?el6} @@ -88,6 +88,9 @@ %license LICENSE %changelog +* Tue Mar 20 2018 Rafael G. Martins <[email protected]> 0.13.4-1 +- New release. + * Wed Mar 14 2018 Rafael G. Martins <[email protected]> 0.13.3-1 - New release. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/blogc.spec.in new/blogc-0.13.4/blogc.spec.in --- old/blogc-0.13.3/blogc.spec.in 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/blogc.spec.in 2018-03-20 23:33:40.000000000 +0100 @@ -88,6 +88,9 @@ %license LICENSE %changelog +* Tue Mar 20 2018 Rafael G. Martins <[email protected]> 0.13.4-1 +- New release. + * Wed Mar 14 2018 Rafael G. Martins <[email protected]> 0.13.3-1 - New release. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/blogcfile.5 new/blogc-0.13.4/blogcfile.5 --- old/blogc-0.13.3/blogcfile.5 2018-03-14 02:29:06.000000000 +0100 +++ new/blogc-0.13.4/blogcfile.5 2018-03-20 23:34:15.000000000 +0100 @@ -53,7 +53,7 @@ . .TP \fBatom_posts_per_page\fR (default: \fB10\fR) -Number of posts per page in the Atom feeds\. +Number of posts per page in the Atom feeds\. If negative, all the posts are included\. If \fB0\fR, no posts are include\. . .TP \fBatom_prefix\fR (default: \fBatom\fR) @@ -97,7 +97,7 @@ . .TP \fBposts_per_page\fR (default: \fB10\fR) -Number of posts per page in the pagination pages\. +Number of posts per page in the pagination pages\. If negative, all the posts are included\. If \fB0\fR, no posts are included\. Also, if negative or \fB0\fR, the \fBpagination\fR build rule is disabled\. . .TP \fBsource_ext\fR (default: \fB\.txt\fR) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/configure new/blogc-0.13.4/configure --- old/blogc-0.13.3/configure 2018-03-14 02:28:59.000000000 +0100 +++ new/blogc-0.13.4/configure 2018-03-20 23:34:09.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for blogc 0.13.3. +# Generated by GNU Autoconf 2.69 for blogc 0.13.4. # # Report bugs to <https://github.com/blogc/blogc>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='blogc' PACKAGE_TARNAME='blogc' -PACKAGE_VERSION='0.13.3' -PACKAGE_STRING='blogc 0.13.3' +PACKAGE_VERSION='0.13.4' +PACKAGE_STRING='blogc 0.13.4' PACKAGE_BUGREPORT='https://github.com/blogc/blogc' PACKAGE_URL='https://blogc.rgm.io/' @@ -1375,7 +1375,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures blogc 0.13.3 to adapt to many kinds of systems. +\`configure' configures blogc 0.13.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1445,7 +1445,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of blogc 0.13.3:";; + short | recursive ) echo "Configuration of blogc 0.13.4:";; esac cat <<\_ACEOF @@ -1572,7 +1572,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -blogc configure 0.13.3 +blogc configure 0.13.4 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1941,7 +1941,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by blogc $as_me 0.13.3, which was +It was created by blogc $as_me 0.13.4, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2806,7 +2806,7 @@ # Define the identity of the package. PACKAGE='blogc' - VERSION='0.13.3' + VERSION='0.13.4' cat >>confdefs.h <<_ACEOF @@ -14934,7 +14934,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by blogc $as_me 0.13.3, which was +This file was extended by blogc $as_me 0.13.4, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15001,7 +15001,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -blogc config.status 0.13.3 +blogc config.status 0.13.4 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/man/blogc-make.1.ronn new/blogc-0.13.4/man/blogc-make.1.ronn --- old/blogc-0.13.3/man/blogc-make.1.ronn 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/man/blogc-make.1.ronn 2018-03-20 23:33:40.000000000 +0100 @@ -89,7 +89,8 @@ ### pagination -Build pagination pages from posts. +Build pagination pages from posts. This rule is disabled if `posts_per_page` +value in blogcfile(5) is negative or `0`. The rule passes the following helper variables to blogc(1): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/man/blogc-pagination.7.ronn new/blogc-0.13.4/man/blogc-pagination.7.ronn --- old/blogc-0.13.3/man/blogc-pagination.7.ronn 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/man/blogc-pagination.7.ronn 2018-03-20 23:33:40.000000000 +0100 @@ -12,14 +12,16 @@ blogc(1) accepts some variables as `-D` options, that are used to filter the files passed as arguments to it: - * `FILTER_PER_PAGE`: - Integer, limits the maximum number of files to be listed. - * `FILTER_PAGE`: Integer, current page. If calling blogc(1) with 10 files, - `FILTER_PER_PAGE`=4 and `FILTER_PAGE`=3, it will return just the 2 last + `FILTER_PER_PAGE=4` and `FILTER_PAGE=3`, it will return just the 2 last files, skipping the first 2 pages with 4 files each one. + * `FILTER_PER_PAGE`: + Integer, limits the maximum number of files to be listed. If negative or + `0`, no posts are included. Have no effect if `FILTER_PAGE` is not + defined. + * `FILTER_TAG`: String, if defined, blogc(1) will only list files that declare a `TAGS` variable, as a space-separated list of tags (tags can't have spaces, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/man/blogcfile.5.ronn new/blogc-0.13.4/man/blogcfile.5.ronn --- old/blogc-0.13.3/man/blogcfile.5.ronn 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/man/blogcfile.5.ronn 2018-03-20 23:33:40.000000000 +0100 @@ -49,7 +49,8 @@ section. * `atom_posts_per_page` (default: `10`): - Number of posts per page in the Atom feeds. + Number of posts per page in the Atom feeds. If negative, all the posts are + included. If `0`, no posts are include. * `atom_prefix` (default: `atom`): The prefix of the generated Atom feeds. It is relative to the output @@ -98,7 +99,9 @@ directories, and is relative to `content_dir` and the output directory. * `posts_per_page` (default: `10`): - Number of posts per page in the pagination pages. + Number of posts per page in the pagination pages. If negative, all the posts + are included. If `0`, no posts are included. Also, if negative or `0`, the + `pagination` build rule is disabled. * `source_ext` (default: `.txt`): The extension of the source files. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/blogc/content-parser.c new/blogc-0.13.4/src/blogc/content-parser.c --- old/blogc-0.13.3/src/blogc/content-parser.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/blogc/content-parser.c 2018-03-20 23:33:40.000000000 +0100 @@ -688,7 +688,7 @@ size_t eend = 0; size_t real_end = 0; - unsigned int header_level = 0; + size_t header_level = 0; char *prefix = NULL; size_t prefix_len = 0; char *tmp = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/blogc/datetime-parser.c new/blogc-0.13.4/src/blogc/datetime-parser.c --- old/blogc-0.13.3/src/blogc/datetime-parser.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/blogc/datetime-parser.c 2018-03-20 23:33:40.000000000 +0100 @@ -69,7 +69,7 @@ int tmp = 0; int diff = '0'; - for (unsigned int i = 0; orig[i] != '\0'; i++) { + for (size_t i = 0; orig[i] != '\0'; i++) { char c = orig[i]; switch (state) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/blogc/loader.c new/blogc-0.13.4/src/blogc/loader.c --- old/blogc-0.13.3/src/blogc/loader.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/blogc/loader.c 2018-03-20 23:33:40.000000000 +0100 @@ -116,7 +116,7 @@ bc_error_t *tmp_err = NULL; bc_slist_t *rv = NULL; - unsigned int with_date = 0; + size_t with_date = 0; const char *filter_tag = bc_trie_lookup(conf, "FILTER_TAG"); const char *filter_page = bc_trie_lookup(conf, "FILTER_PAGE"); @@ -138,13 +138,13 @@ if (*ptr != '\0' && *endptr != '\0') fprintf(stderr, "warning: invalid value for 'FILTER_PER_PAGE' variable: " "%s. using %ld instead\n", ptr, per_page); - if (per_page <= 0) - per_page = 10; + if (per_page < 0) + per_page = 0; // poor man's pagination - unsigned int start = (page - 1) * per_page; - unsigned int end = start + per_page; - unsigned int counter = 0; + size_t start = (page - 1) * per_page; + size_t end = start + per_page; + size_t counter = 0; for (bc_slist_t *tmp = sources; tmp != NULL; tmp = tmp->next) { char *f = tmp->data; @@ -168,7 +168,7 @@ } char **tags = bc_str_split(tags_str, ' ', 0); bool found = false; - for (unsigned int i = 0; tags[i] != NULL; i++) { + for (size_t i = 0; tags[i] != NULL; i++) { if (tags[i][0] == '\0') continue; if (0 == strcmp(tags[i], filter_tag)) @@ -226,7 +226,7 @@ } if (filter_page != NULL) { - unsigned int last_page = ceilf(((float) counter) / per_page); + size_t last_page = ceilf(((float) counter) / per_page); bc_trie_insert(conf, "CURRENT_PAGE", bc_strdup_printf("%ld", page)); if (page > 1) bc_trie_insert(conf, "PREVIOUS_PAGE", bc_strdup_printf("%ld", page - 1)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/blogc/main.c new/blogc-0.13.4/src/blogc/main.c --- old/blogc-0.13.3/src/blogc/main.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/blogc/main.c 2018-03-20 23:33:40.000000000 +0100 @@ -165,7 +165,7 @@ bc_trie_t *config = bc_trie_new(free); bc_trie_insert(config, "BLOGC_VERSION", bc_strdup(PACKAGE_VERSION)); - for (unsigned int i = 1; i < argc; i++) { + for (size_t i = 1; i < argc; i++) { tmp = NULL; if (argv[i][0] == '-') { switch (argv[i][1]) { @@ -221,7 +221,7 @@ rv = 3; goto cleanup; } - for (unsigned int j = 0; pieces[0][j] != '\0'; j++) { + for (size_t j = 0; pieces[0][j] != '\0'; j++) { if (!((pieces[0][j] >= 'A' && pieces[0][j] <= 'Z') || pieces[0][j] == '_')) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/blogc/renderer.c new/blogc-0.13.4/src/blogc/renderer.c --- old/blogc-0.13.3/src/blogc/renderer.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/blogc/renderer.c 2018-03-20 23:33:40.000000000 +0100 @@ -149,7 +149,7 @@ bc_slist_t *rv = NULL; char **tmp = bc_str_split(value, ' ', 0); - for (unsigned int i = 0; tmp[i] != NULL; i++) { + for (size_t i = 0; tmp[i] != NULL; i++) { if (tmp[i][0] != '\0') // ignore empty strings rv = bc_slist_append(rv, tmp[i]); else @@ -176,7 +176,7 @@ char *config_value = NULL; char *defined = NULL; - unsigned int if_count = 0; + size_t if_count = 0; bc_slist_t *foreach_var = NULL; bc_slist_t *foreach_var_start = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/blogc/template-parser.c new/blogc-0.13.4/src/blogc/template-parser.c --- old/blogc-0.13.3/src/blogc/template-parser.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/blogc/template-parser.c 2018-03-20 23:33:40.000000000 +0100 @@ -57,8 +57,8 @@ blogc_template_operator_t tmp_op = 0; - unsigned int if_count = 0; - unsigned int block_if_count = 0; + size_t if_count = 0; + size_t block_if_count = 0; bool else_open = false; bool foreach_open = false; bool block_foreach_open = false; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/blogc-git-receiver/pre-receive.c new/blogc-0.13.4/src/blogc-git-receiver/pre-receive.c --- old/blogc-0.13.3/src/blogc-git-receiver/pre-receive.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/blogc-git-receiver/pre-receive.c 2018-03-20 23:33:40.000000000 +0100 @@ -21,13 +21,13 @@ #include "pre-receive.h" -static unsigned int +static size_t cpu_count(void) { #ifdef _SC_NPROCESSORS_ONLN long num = sysconf(_SC_NPROCESSORS_ONLN); if (num >= 1) - return (unsigned int) num; + return (size_t) num; #endif return 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/blogc-make/exec.c new/blogc-0.13.4/src/blogc-make/exec.c --- old/blogc-0.13.3/src/blogc-make/exec.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/blogc-make/exec.c 2018-03-20 23:33:40.000000000 +0100 @@ -307,6 +307,10 @@ int rv = bm_exec_command(cmd, input->str, &out, &err, &error); + if (err != NULL) { + fprintf(stderr, "%s", err); + } + if (error != NULL) { bc_error_print(error, "blogc-make"); free(cmd); @@ -337,13 +341,6 @@ "----------------------------->8-----------------------------\n", bc_str_strip(out)); } - if (err != NULL) { - fprintf(stderr, "\nSTDERR:\n" - "----------------------------->8-----------------------------\n" - "%s\n" - "----------------------------->8-----------------------------\n", - bc_str_strip(err)); - } } else { fprintf(stderr, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/blogc-make/main.c new/blogc-0.13.4/src/blogc-make/main.c --- old/blogc-0.13.3/src/blogc-make/main.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/blogc-make/main.c 2018-03-20 23:33:40.000000000 +0100 @@ -68,7 +68,7 @@ char *blogcfile = NULL; bm_ctx_t *ctx = NULL; - for (unsigned int i = 1; i < argc; i++) { + for (size_t i = 1; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { case 'h': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/blogc-make/rules.c new/blogc-0.13.4/src/blogc-make/rules.c --- old/blogc-0.13.3/src/blogc-make/rules.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/blogc-make/rules.c 2018-03-20 23:33:40.000000000 +0100 @@ -35,6 +35,23 @@ } +static void +posts_pagination(bm_ctx_t *ctx, bc_trie_t *variables, const char *variable) +{ + if (ctx == NULL || ctx->settings == NULL || ctx->settings->settings == NULL) + return; // something is wrong, let's not add any variable + + long posts_per_page = strtol( + bc_trie_lookup(ctx->settings->settings, variable), + NULL, 10); // FIXME: improve + if (posts_per_page >= 0) { + bc_trie_insert(variables, "FILTER_PAGE", bc_strdup("1")); + bc_trie_insert(variables, "FILTER_PER_PAGE", + bc_strdup(bc_trie_lookup(ctx->settings->settings, variable))); + } +} + + // INDEX RULE static bc_slist_t* @@ -66,9 +83,7 @@ int rv = 0; bc_trie_t *variables = bc_trie_new(free); - bc_trie_insert(variables, "FILTER_PER_PAGE", - bc_strdup(bc_trie_lookup(ctx->settings->settings, "posts_per_page"))); - bc_trie_insert(variables, "FILTER_PAGE", bc_strdup("1")); + posts_pagination(ctx, variables, "posts_per_page"); posts_ordering(ctx, variables, "html_order"); bc_trie_insert(variables, "DATE_FORMAT", bc_strdup(bc_trie_lookup(ctx->settings->settings, "date_format"))); @@ -123,10 +138,7 @@ int rv = 0; bc_trie_t *variables = bc_trie_new(free); - bc_trie_insert(variables, "FILTER_PER_PAGE", - bc_strdup(bc_trie_lookup(ctx->settings->settings, - "atom_posts_per_page"))); - bc_trie_insert(variables, "FILTER_PAGE", bc_strdup("1")); + posts_pagination(ctx, variables, "atom_posts_per_page"); posts_ordering(ctx, variables, "atom_order"); bc_trie_insert(variables, "DATE_FORMAT", bc_strdup("%Y-%m-%dT%H:%M:%SZ")); bc_trie_insert(variables, "MAKE_RULE", bc_strdup("atom")); @@ -183,10 +195,7 @@ size_t i = 0; bc_trie_t *variables = bc_trie_new(free); - bc_trie_insert(variables, "FILTER_PER_PAGE", - bc_strdup(bc_trie_lookup(ctx->settings->settings, - "atom_posts_per_page"))); - bc_trie_insert(variables, "FILTER_PAGE", bc_strdup("1")); + posts_pagination(ctx, variables, "atom_posts_per_page"); posts_ordering(ctx, variables, "atom_order"); bc_trie_insert(variables, "DATE_FORMAT", bc_strdup("%Y-%m-%dT%H:%M:%SZ")); bc_trie_insert(variables, "MAKE_RULE", bc_strdup("atom_tags")); @@ -228,6 +237,9 @@ long posts_per_page = strtol( bc_trie_lookup(ctx->settings->settings, "posts_per_page"), NULL, 10); // FIXME: improve + if (posts_per_page <= 0) + return NULL; + size_t pages = ceilf(((float) num_posts) / posts_per_page); const char *pagination_prefix = bc_trie_lookup(ctx->settings->settings, @@ -255,6 +267,8 @@ size_t page = 1; bc_trie_t *variables = bc_trie_new(free); + // not using posts_pagination because we set FILTER_PAGE anyway, and the + // first value inserted in that function would be useless bc_trie_insert(variables, "FILTER_PER_PAGE", bc_strdup(bc_trie_lookup(ctx->settings->settings, "posts_per_page"))); posts_ordering(ctx, variables, "html_order"); @@ -382,10 +396,7 @@ size_t i = 0; bc_trie_t *variables = bc_trie_new(free); - bc_trie_insert(variables, "FILTER_PER_PAGE", - bc_strdup(bc_trie_lookup(ctx->settings->settings, - "atom_posts_per_page"))); - bc_trie_insert(variables, "FILTER_PAGE", bc_strdup("1")); + posts_pagination(ctx, variables, "atom_posts_per_page"); posts_ordering(ctx, variables, "html_order"); bc_trie_insert(variables, "DATE_FORMAT", bc_strdup(bc_trie_lookup(ctx->settings->settings, "date_format"))); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/blogc-runserver/httpd-utils.c new/blogc-0.13.4/src/blogc-runserver/httpd-utils.c --- old/blogc-0.13.3/src/blogc-runserver/httpd-utils.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/blogc-runserver/httpd-utils.c 2018-03-20 23:33:40.000000000 +0100 @@ -90,7 +90,7 @@ br_get_extension(const char *filename) { const char *ext = NULL; - unsigned int i; + size_t i; for (i = strlen(filename); i > 0; i--) { if (filename[i] == '.') { ext = filename + i + 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/blogc-runserver/main.c new/blogc-0.13.4/src/blogc-runserver/main.c --- old/blogc-0.13.3/src/blogc-runserver/main.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/blogc-runserver/main.c 2018-03-20 23:33:40.000000000 +0100 @@ -70,9 +70,9 @@ char *tmp_port = getenv("BLOGC_RUNSERVER_DEFAULT_PORT"); char *default_port = bc_strdup(tmp_port != NULL ? tmp_port : "8080"); - unsigned int args = 0; + size_t args = 0; - for (unsigned int i = 1; i < argc; i++) { + for (size_t i = 1; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { case 'h': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/common/utils.c new/blogc-0.13.4/src/common/utils.c --- old/blogc-0.13.3/src/common/utils.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/common/utils.c 2018-03-20 23:33:40.000000000 +0100 @@ -244,12 +244,12 @@ char** -bc_str_split(const char *str, char c, unsigned int max_pieces) +bc_str_split(const char *str, char c, size_t max_pieces) { if (str == NULL) return NULL; char **rv = bc_malloc(sizeof(char*)); - unsigned int i, start = 0, count = 0; + size_t i, start = 0, count = 0; for (i = 0; i < strlen(str) + 1; i++) { if (str[0] == '\0') break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/src/common/utils.h new/blogc-0.13.4/src/common/utils.h --- old/blogc-0.13.3/src/common/utils.h 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/src/common/utils.h 2018-03-20 23:33:40.000000000 +0100 @@ -47,7 +47,7 @@ char* bc_str_lstrip(char *str); char* bc_str_rstrip(char *str); char* bc_str_strip(char *str); -char** bc_str_split(const char *str, char c, unsigned int max_pieces); +char** bc_str_split(const char *str, char c, size_t max_pieces); char* bc_str_replace(const char *str, const char search, const char *replace); char* bc_str_find(const char *str, char c); void bc_strv_free(char **strv); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/tests/blogc/check_renderer.c new/blogc-0.13.4/tests/blogc/check_renderer.c --- old/blogc-0.13.3/tests/blogc/check_renderer.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/tests/blogc/check_renderer.c 2018-03-20 23:33:40.000000000 +0100 @@ -21,7 +21,7 @@ static bc_slist_t* -create_sources(unsigned int count) +create_sources(size_t count) { const char *s[] = { "BOLA: asd\n" @@ -46,7 +46,7 @@ assert_false(count > 3); bc_error_t *err = NULL; bc_slist_t *l = NULL; - for (unsigned int i = 0; i < count; i++) { + for (size_t i = 0; i < count; i++) { l = bc_slist_append(l, blogc_source_parse(s[i], strlen(s[i]), &err)); assert_null(err); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/tests/blogc-make/check_blogc_make.sh.in new/blogc-0.13.4/tests/blogc-make/check_blogc_make.sh.in --- old/blogc-0.13.3/tests/blogc-make/check_blogc_make.sh.in 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/tests/blogc-make/check_blogc_make.sh.in 2018-03-20 23:33:40.000000000 +0100 @@ -49,6 +49,15 @@ This is bar. EOF +for i in $(seq -f "%02g" 1 11); do + cat > "${TEMP}/proj/content/post/post${i}.txt" <<EOF +TITLE: Post ${i} +DATE: 2016-09-${i} +---------------- +This is Post ${i}. +EOF +done + cat > "${TEMP}/proj/templates/main.tmpl" <<EOF {% block listing %} Listing: {% ifdef FILTER_TAG %}{{ FILTER_TAG }} - {% endif %}{{ TITLE }} - {{ DATE_FORMATTED }} @@ -156,6 +165,374 @@ rm -rf "${TEMP}/proj/_build" + +### default settings with some posts, posts per page -1 + +cat > "${TEMP}/proj/blogcfile" <<EOF +[global] +AUTHOR_NAME = Lol +AUTHOR_EMAIL = [email protected] +SITE_TITLE = Lol's Website +SITE_TAGLINE = WAT?! +BASE_DOMAIN = http://example.org + +[settings] +posts_per_page = -1 + +[posts] +post01 +post02 +post03 +post04 +post05 +post06 +post07 +post08 +post09 +post10 +post11 +EOF + +${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 2>&1 | tee "${TEMP}/output.txt" +grep "_build/index\\.html" "${TEMP}/output.txt" +grep "_build/atom\\.xml" "${TEMP}/output.txt" +grep "_build/post/post01/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post02/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post03/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post04/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post05/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post06/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post07/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post08/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post09/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post10/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post11/index\\.html" "${TEMP}/output.txt" + +rm "${TEMP}/output.txt" + +cat > "${TEMP}/expected-index.html" <<EOF + +Listing: Post 11 - Sep 11, 2016, 12:00 AM GMT + +Listing: Post 10 - Sep 10, 2016, 12:00 AM GMT + +Listing: Post 09 - Sep 09, 2016, 12:00 AM GMT + +Listing: Post 08 - Sep 08, 2016, 12:00 AM GMT + +Listing: Post 07 - Sep 07, 2016, 12:00 AM GMT + +Listing: Post 06 - Sep 06, 2016, 12:00 AM GMT + +Listing: Post 05 - Sep 05, 2016, 12:00 AM GMT + +Listing: Post 04 - Sep 04, 2016, 12:00 AM GMT + +Listing: Post 03 - Sep 03, 2016, 12:00 AM GMT + +Listing: Post 02 - Sep 02, 2016, 12:00 AM GMT + +Listing: Post 01 - Sep 01, 2016, 12:00 AM GMT + + +EOF +diff -uN "${TEMP}/proj/_build/index.html" "${TEMP}/expected-index.html" + +cat > "${TEMP}/expected-atom.xml" <<EOF +<?xml version="1.0" encoding="utf-8"?> +<feed xmlns="http://www.w3.org/2005/Atom"> + <title type="text">Lol's Website</title> + <id>/atom.xml</id> + <updated>2016-09-11T00:00:00Z</updated> + <link href="http://example.org/" /> + <link href="http://example.org/atom.xml" rel="self" /> + <author> + <name>Lol</name> + <email>[email protected]</email> + </author> + <subtitle type="text">WAT?!</subtitle> + + <entry> + <title type="text">Post 11</title> + <id>/post/post11/</id> + <updated>2016-09-11T00:00:00Z</updated> + <published>2016-09-11T00:00:00Z</published> + <link href="http://example.org/post/post11/" /> + <author> + <name>Lol</name> + <email>[email protected]</email> + </author> + <content type="html"><![CDATA[<p>This is Post 11.</p> +]]></content> + </entry> + + <entry> + <title type="text">Post 10</title> + <id>/post/post10/</id> + <updated>2016-09-10T00:00:00Z</updated> + <published>2016-09-10T00:00:00Z</published> + <link href="http://example.org/post/post10/" /> + <author> + <name>Lol</name> + <email>[email protected]</email> + </author> + <content type="html"><![CDATA[<p>This is Post 10.</p> +]]></content> + </entry> + + <entry> + <title type="text">Post 09</title> + <id>/post/post09/</id> + <updated>2016-09-09T00:00:00Z</updated> + <published>2016-09-09T00:00:00Z</published> + <link href="http://example.org/post/post09/" /> + <author> + <name>Lol</name> + <email>[email protected]</email> + </author> + <content type="html"><![CDATA[<p>This is Post 09.</p> +]]></content> + </entry> + + <entry> + <title type="text">Post 08</title> + <id>/post/post08/</id> + <updated>2016-09-08T00:00:00Z</updated> + <published>2016-09-08T00:00:00Z</published> + <link href="http://example.org/post/post08/" /> + <author> + <name>Lol</name> + <email>[email protected]</email> + </author> + <content type="html"><![CDATA[<p>This is Post 08.</p> +]]></content> + </entry> + + <entry> + <title type="text">Post 07</title> + <id>/post/post07/</id> + <updated>2016-09-07T00:00:00Z</updated> + <published>2016-09-07T00:00:00Z</published> + <link href="http://example.org/post/post07/" /> + <author> + <name>Lol</name> + <email>[email protected]</email> + </author> + <content type="html"><![CDATA[<p>This is Post 07.</p> +]]></content> + </entry> + + <entry> + <title type="text">Post 06</title> + <id>/post/post06/</id> + <updated>2016-09-06T00:00:00Z</updated> + <published>2016-09-06T00:00:00Z</published> + <link href="http://example.org/post/post06/" /> + <author> + <name>Lol</name> + <email>[email protected]</email> + </author> + <content type="html"><![CDATA[<p>This is Post 06.</p> +]]></content> + </entry> + + <entry> + <title type="text">Post 05</title> + <id>/post/post05/</id> + <updated>2016-09-05T00:00:00Z</updated> + <published>2016-09-05T00:00:00Z</published> + <link href="http://example.org/post/post05/" /> + <author> + <name>Lol</name> + <email>[email protected]</email> + </author> + <content type="html"><![CDATA[<p>This is Post 05.</p> +]]></content> + </entry> + + <entry> + <title type="text">Post 04</title> + <id>/post/post04/</id> + <updated>2016-09-04T00:00:00Z</updated> + <published>2016-09-04T00:00:00Z</published> + <link href="http://example.org/post/post04/" /> + <author> + <name>Lol</name> + <email>[email protected]</email> + </author> + <content type="html"><![CDATA[<p>This is Post 04.</p> +]]></content> + </entry> + + <entry> + <title type="text">Post 03</title> + <id>/post/post03/</id> + <updated>2016-09-03T00:00:00Z</updated> + <published>2016-09-03T00:00:00Z</published> + <link href="http://example.org/post/post03/" /> + <author> + <name>Lol</name> + <email>[email protected]</email> + </author> + <content type="html"><![CDATA[<p>This is Post 03.</p> +]]></content> + </entry> + + <entry> + <title type="text">Post 02</title> + <id>/post/post02/</id> + <updated>2016-09-02T00:00:00Z</updated> + <published>2016-09-02T00:00:00Z</published> + <link href="http://example.org/post/post02/" /> + <author> + <name>Lol</name> + <email>[email protected]</email> + </author> + <content type="html"><![CDATA[<p>This is Post 02.</p> +]]></content> + </entry> + +</feed> +EOF +diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml" + +cat > "${TEMP}/expected-post-post01.html" <<EOF + + +Post 01 - Sep 01, 2016, 12:00 AM GMT + +<p>This is Post 01.</p> + + +EOF +diff -uN "${TEMP}/proj/_build/post/post01/index.html" "${TEMP}/expected-post-post01.html" + +cat > "${TEMP}/expected-post-post11.html" <<EOF + + +Post 11 - Sep 11, 2016, 12:00 AM GMT + +<p>This is Post 11.</p> + + +EOF +diff -uN "${TEMP}/proj/_build/post/post11/index.html" "${TEMP}/expected-post-post11.html" + +rm -rf "${TEMP}/proj/_build" + + +### default settings with some posts, atom posts per page 0 + +cat > "${TEMP}/proj/blogcfile" <<EOF +[global] +AUTHOR_NAME = Lol +AUTHOR_EMAIL = [email protected] +SITE_TITLE = Lol's Website +SITE_TAGLINE = WAT?! +BASE_DOMAIN = http://example.org + +[settings] +atom_posts_per_page = 0 + +[posts] +post01 +post02 +post03 +post04 +post05 +post06 +post07 +post08 +post09 +post10 +post11 +EOF + +${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 2>&1 | tee "${TEMP}/output.txt" +grep "_build/index\\.html" "${TEMP}/output.txt" +grep "_build/atom\\.xml" "${TEMP}/output.txt" +grep "_build/post/post01/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post02/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post03/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post04/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post05/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post06/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post07/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post08/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post09/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post10/index\\.html" "${TEMP}/output.txt" +grep "_build/post/post11/index\\.html" "${TEMP}/output.txt" + +rm "${TEMP}/output.txt" + +cat > "${TEMP}/expected-index.html" <<EOF + +Listing: Post 11 - Sep 11, 2016, 12:00 AM GMT + +Listing: Post 10 - Sep 10, 2016, 12:00 AM GMT + +Listing: Post 09 - Sep 09, 2016, 12:00 AM GMT + +Listing: Post 08 - Sep 08, 2016, 12:00 AM GMT + +Listing: Post 07 - Sep 07, 2016, 12:00 AM GMT + +Listing: Post 06 - Sep 06, 2016, 12:00 AM GMT + +Listing: Post 05 - Sep 05, 2016, 12:00 AM GMT + +Listing: Post 04 - Sep 04, 2016, 12:00 AM GMT + +Listing: Post 03 - Sep 03, 2016, 12:00 AM GMT + +Listing: Post 02 - Sep 02, 2016, 12:00 AM GMT + + +EOF +diff -uN "${TEMP}/proj/_build/index.html" "${TEMP}/expected-index.html" + +cat > "${TEMP}/expected-atom.xml" <<EOF +<?xml version="1.0" encoding="utf-8"?> +<feed xmlns="http://www.w3.org/2005/Atom"> + <title type="text">Lol's Website</title> + <id>/atom.xml</id> + <updated></updated> + <link href="http://example.org/" /> + <link href="http://example.org/atom.xml" rel="self" /> + <author> + <name>Lol</name> + <email>[email protected]</email> + </author> + <subtitle type="text">WAT?!</subtitle> + +</feed> +EOF +diff -uN "${TEMP}/proj/_build/atom.xml" "${TEMP}/expected-atom.xml" + +cat > "${TEMP}/expected-post-post01.html" <<EOF + + +Post 01 - Sep 01, 2016, 12:00 AM GMT + +<p>This is Post 01.</p> + + +EOF +diff -uN "${TEMP}/proj/_build/post/post01/index.html" "${TEMP}/expected-post-post01.html" + +cat > "${TEMP}/expected-post-post11.html" <<EOF + + +Post 11 - Sep 11, 2016, 12:00 AM GMT + +<p>This is Post 11.</p> + + +EOF +diff -uN "${TEMP}/proj/_build/post/post11/index.html" "${TEMP}/expected-post-post11.html" + +rm -rf "${TEMP}/proj/_build" + ### default settings with some posts, order asc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.3/tests/common/check_utils.c new/blogc-0.13.4/tests/common/check_utils.c --- old/blogc-0.13.3/tests/common/check_utils.c 2018-03-14 02:28:35.000000000 +0100 +++ new/blogc-0.13.4/tests/common/check_utils.c 2018-03-20 23:33:40.000000000 +0100 @@ -906,7 +906,7 @@ } -static unsigned int counter; +static size_t counter; static char *expected_keys[] = {"chu", "copa", "bola", "bote", "bo", "b", "test", "testa"}; static char *expected_datas[] = {"nda", "bu", "guda", "aba", "haha", "c", "asd", "lol"};
