shithub: epublish

Download patch

ref: 825b7e6424d8bed086c576f79997bf8704143bb8
parent: b6e0c25f3e1cfc89399fcb1611e463de55d0fa96
author: sirjofri <sirjofri@sirjofri.de>
date: Thu Sep 9 10:25:45 EDT 2021

fixes version-exclusive stuff

--- a/sample/mkfile
+++ b/sample/mkfile
@@ -7,4 +7,9 @@
 MSARGS=-v 'firstheader=1'
 EBOOKARGS=-v 'firstheader=1'
 
+all:V: sample.pdf sample.epub
+
+sample.pdf: sample.ms
+	troff -ms <sample.ms | lp -dstdout | ps2pdf > $target
+
 <../mkfile
--- a/sample/text/chap1.txt
+++ b/sample/text/chap1.txt
@@ -3,3 +3,12 @@
 # Sample Chapter 1
 
 Hello Chapter 1.
+
+[[[ms
+.B
+MS exclusive
+.R
+]]]
+[[[ebook
+<p><b>ebook exclusive</b></p>
+]]]
--- a/txt2ebook
+++ b/txt2ebook
@@ -34,15 +34,10 @@
 }
 
 $1 ~ /^\[\[\[ebook/ {
-	ismsblock = 1
+	isebookblock = 1
 	next
 }
 
-$1 ~ /^\]\]\]ebook/ {
-	ismsblock = 0
-	next
-}
-
 $1 ~ /^\[\[\[/ {
 	ignore = 1
 	next
@@ -50,10 +45,16 @@
 
 $1 ~ /^\]\]\]/ {
 	ignore = 0
+	isebookblock = 0
 	next
 }
 
 ignore {
+	next
+}
+
+isebookblock {
+	print
 	next
 }
 
--- a/txt2ms
+++ b/txt2ms
@@ -29,11 +29,6 @@
 	next
 }
 
-$1 ~ /^\]\]\]ms/ {
-	ismsblock = 0
-	next
-}
-
 $1 ~ /^\[\[\[/ {
 	ignore = 1
 	next
@@ -40,11 +35,17 @@
 }
 
 $1 ~ /^\]\]\]/ {
+	ismsblock = 0
 	ignore = 0
 	next
 }
 
 ignore {
+	next
+}
+
+ismsblock {
+	print
 	next
 }