summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-12-03 15:31:40 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-12-03 15:31:40 +0300
commite82157e5418706f4a39476e6e37389b7b1c7c883 (patch)
tree359b680cac09d52a6a514a584fbca5111da01337
parent1f1f425641754a4289d75673247d7d5abeb70bdb (diff)
downloadvsvs-e82157e5418706f4a39476e6e37389b7b1c7c883.tar
vsvs-e82157e5418706f4a39476e6e37389b7b1c7c883.tar.xz
vsvs-e82157e5418706f4a39476e6e37389b7b1c7c883.zip
.
-rwxr-xr-xdefault.do6
-rw-r--r--[-rwxr-xr-x]vsvs-get (renamed from vsvs.sh)0
-rw-r--r--vsvs-map22
-rw-r--r--vsvs-sum22
4 files changed, 47 insertions, 3 deletions
diff --git a/default.do b/default.do
index ee79c29..617cc1c 100755
--- a/default.do
+++ b/default.do
@@ -1,5 +1,5 @@
#!/bin/sh
-export title="$(vsvs.sh title < $1.vs)"
-export content="$(vsvs.sh content < $1.vs)"
-echo -n "$(vsvs.sh template < articles.vs)" | shelter >$3;
+export title="$(vsvs-get title < $1.vs)"
+export content="$(vsvs-get content < $1.vs)"
+echo -n "$(vsvs-get template < articles.vs)" | shelter >$3;
redo-ifchange $1.vs articles.vs
diff --git a/vsvs.sh b/vsvs-get
index e7ab391..e7ab391 100755..100644
--- a/vsvs.sh
+++ b/vsvs-get
diff --git a/vsvs-map b/vsvs-map
new file mode 100644
index 0000000..e1cbd49
--- /dev/null
+++ b/vsvs-map
@@ -0,0 +1,22 @@
+#!/bin/bash
+res=""
+buf=""
+while IFS="" read str
+do
+ if [ -z "${str##* *}" ]
+ then
+ key="${str%% *}"
+ val="${str#* }"
+ else
+ key="${str}"
+ val=""
+ fi
+ if [ -z "${key}" ]
+ then
+ buf="${buf}"$'\n'"${val}"
+ else
+ res="${res}$(echo -n "${buf}" | $1)"
+ buf="${val}"
+ fi
+done
+echo -n "${res}"
diff --git a/vsvs-sum b/vsvs-sum
new file mode 100644
index 0000000..f861e0f
--- /dev/null
+++ b/vsvs-sum
@@ -0,0 +1,22 @@
+#!/bin/bash
+res=""
+buf=""
+while IFS="" read str
+do
+ if [ -z "${str##* *}" ]
+ then
+ key="${str%% *}"
+ val="${str#* }"
+ else
+ key="${str}"
+ val=""
+ fi
+ if [ -z "${key}" ]
+ then
+ buf="${buf}"$'\n'"${val}"
+ else
+ res="$(echo -n "${buf}" | $1 "${res}")"
+ buf="${val}"
+ fi
+done
+echo -n "${res}"