From bb6157e54ac4654eddc0660970fbbf204c5b41a5 Mon Sep 17 00:00:00 2001 From: trishalaneeraj Date: Wed, 21 Sep 2016 14:16:31 +0000 Subject: [PATCH 1/2] added generate file --- .DS_Store | Bin 0 -> 6148 bytes generate.sh | 30 +++++++++++++++++++++++++++++- template.html | 10 ---------- tests/.DS_Store | Bin 0 -> 6148 bytes 4 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 .DS_Store create mode 100644 tests/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..0af4f2b3af583e7f5738e7d1e0335cd6b7e5ef33 GIT binary patch literal 6148 zcmeHK%Wl&^6upzC;3Psaq6j25UV>DjgjZRnAw^&pVGKs&TWo7A9fU>Uvn^9;7Lz_9WCfSysGxQx28*9?7? z(d!Xq3;eGO{4;WFYF5*6c2L))aGsfayue(Q%oL^E%YM%)_g!Sd*<^x}XeQGeq&=Pa z!|R1S%_@~|EVq(hJ$2eD6iec<&lVrGI`N>DxmiE0yU9cO#{Iz4ansE@)A)WIhreRi z+vUNaZLi&lqs-+|kjzl`_ju&TgL>SL{B*yizPHEytkbs7H`pw&S?>~I}B>b~CWIC~$LQ@(Ai~{ottf*I8oc~*YzyHsZ%$rfbDDYn?!19e&qmC)*vvp~5;;ePx tPvF8t-dLfepwP#$48&1<5iSjFjtGD?jbnwVftf!7QU+5P1^%f5KLHi|v-ki2 literal 0 HcmV?d00001 diff --git a/generate.sh b/generate.sh index 51652b1..cefebaf 100755 --- a/generate.sh +++ b/generate.sh @@ -2,4 +2,32 @@ set -ex -# YOUR CODE HERE +# Declaring arguments. The script takes two arguments: +# The input directory +# The output directory +inputDir="$1" +outputDir="$2" + + +template="$( "$outputDir/""$filename.html" + + #Replacing title and body + sed -e "s/{{title}}/$( head -n 1 "$file")/g" "$outputDir/""$filename.html" + sed -e "s/{{body}}/$( tail -n +3 "$file")/g" "$outputDir/""$filename.html" #line 2 is empty +done diff --git a/template.html b/template.html index f196151..e69de29 100644 --- a/template.html +++ b/template.html @@ -1,10 +0,0 @@ - - - - - {{title}} - - - {{body}} - - diff --git a/tests/.DS_Store b/tests/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e4e5e1b8c73c73aa3eb87ceb5d8bb1036a246ea8 GIT binary patch literal 6148 zcmeHK%TB{E5S$GaDpW#+6UQ7mA@K)MRgk#Coj@M~MEXz*hu-pmd;lN7f55E0Ds38i zL>1bVcE@pc*6}!sV*t{58(aWw08P4La==hydS89R66@I~N~qDt1NwNv5cx*7ckH49 zx^^wDR*oqaT)Ut3%dd+`zgJ9p%+S~4ihlMLj4j|WtaCx$5Hrkit`#br_X_72ugsn^ z=43C7Ti_XEywp{Yn@WX~l?qcn?Tr2y;*=F@pF%z=HI7zlD1VFrCK%O?pWJQX&iULU z&Y|F(YG$8&R=B)$a|K)hS70X;;GV74Y(@0w3b+EUz)}JIKBRQT%&?3YJ{=6<2taJG zI~d#gv#6ZZFf%M8@(xWRl^CgFM+}K{_NSJY8I} Date: Wed, 21 Sep 2016 18:12:15 +0000 Subject: [PATCH 2/2] new generate file --- .DS_Store | Bin 6148 -> 6148 bytes .html | 0 generate.sh | 6 +++--- outputDirpostone.html | 0 outputDirsome-other-post.html | 0 postone.html | 0 some-other-post.html | 0 template.html | 10 ++++++++++ 8 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .html create mode 100644 outputDirpostone.html create mode 100644 outputDirsome-other-post.html create mode 100644 postone.html create mode 100644 some-other-post.html diff --git a/.DS_Store b/.DS_Store index 0af4f2b3af583e7f5738e7d1e0335cd6b7e5ef33..407223040f9dd786122c2a621bf13427a02e9d3b 100644 GIT binary patch delta 350 zcmZoMXfc@J&&azmU^g=(?_?g9%z8G4e1=kn5{3d0>6w$CoRpKF#K6EHz`($q1*A3p zg8`7mz#xjOmcfM~lc5NxFQ1_ps6U?}k0F&ok0Ard&Sl6!HHqO2Q1=WZlVo8g)q^dE z7*z}u%mo^v3#3bc2BiXx*M(bv!)V4JG^2UoI`BG)`2$d&#{bFLEH$<- Q>dkjpZZmFX=lIJH0M7 "$outputDir/""$filename.html" #Replacing title and body - sed -e "s/{{title}}/$( head -n 1 "$file")/g" "$outputDir/""$filename.html" - sed -e "s/{{body}}/$( tail -n +3 "$file")/g" "$outputDir/""$filename.html" #line 2 is empty -done + sed -i -e "s/{{title}}/$( head -n 1 "$file")/g" "$outputDir/$filename.html" + sed -i -e "s/{{body}}/$( tail -n +3 "$file")/g" "$outputDir/$filename.html" #line 2 is empty +done \ No newline at end of file diff --git a/outputDirpostone.html b/outputDirpostone.html new file mode 100644 index 0000000..e69de29 diff --git a/outputDirsome-other-post.html b/outputDirsome-other-post.html new file mode 100644 index 0000000..e69de29 diff --git a/postone.html b/postone.html new file mode 100644 index 0000000..e69de29 diff --git a/some-other-post.html b/some-other-post.html new file mode 100644 index 0000000..e69de29 diff --git a/template.html b/template.html index e69de29..f196151 100644 --- a/template.html +++ b/template.html @@ -0,0 +1,10 @@ + + + + + {{title}} + + + {{body}} + +