tools: pandoc filters used when making man pages
This commit is contained in:
		
							parent
							
								
									844e04812c
								
							
						
					
					
						commit
						3762ae8f70
					
				
							
								
								
									
										24
									
								
								tools/pandocCapitalizeHeaders.hs
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										24
									
								
								tools/pandocCapitalizeHeaders.hs
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,24 @@ | |||||||
|  | #!/usr/bin/env stack | ||||||
|  | -- stack runghc --package pandoc-types | ||||||
|  | -- ^ installs pandoc-types in the current stack db when needed | ||||||
|  | 
 | ||||||
|  | import Text.Pandoc.JSON | ||||||
|  | import Text.Pandoc.Walk | ||||||
|  | import Data.Char (toUpper) | ||||||
|  | 
 | ||||||
|  | main :: IO () | ||||||
|  | main = toJSONFilter capitalizeHeaders | ||||||
|  | 
 | ||||||
|  | capitalizeHeaders :: Block -> Block | ||||||
|  | capitalizeHeaders (Header 1 attr xs) = Header 1 attr $ walk capitalize xs | ||||||
|  | capitalizeHeaders x = x | ||||||
|  | 
 | ||||||
|  | capitalize :: Inline -> Inline | ||||||
|  | capitalize (Str xs) = Str $ map toUpper xs | ||||||
|  | capitalize x = x | ||||||
|  | 
 | ||||||
|  | {- | ||||||
|  | capitalizeHeaderLinks :: Inline -> Inline | ||||||
|  | capitalizeHeaderLinks (Link xs t@('#':_,_)) = Link (walk capitalize xs) t | ||||||
|  | capitalizeHeaderLinks x = x | ||||||
|  | -} | ||||||
							
								
								
									
										12
									
								
								tools/pandocRemoveLinks.hs
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								tools/pandocRemoveLinks.hs
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | #!/usr/bin/env stack | ||||||
|  | -- stack runghc --package pandoc-types | ||||||
|  | 
 | ||||||
|  | import Text.Pandoc.JSON | ||||||
|  | 
 | ||||||
|  | main :: IO () | ||||||
|  | main = toJSONFilter removeLinks | ||||||
|  | 
 | ||||||
|  | removeLinks :: Inline -> [Inline] | ||||||
|  | removeLinks (Link l _) = l | ||||||
|  | removeLinks x = [x] | ||||||
|  | 
 | ||||||
							
								
								
									
										12
									
								
								tools/pandocRemoveNotes.hs
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								tools/pandocRemoveNotes.hs
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | #!/usr/bin/env stack | ||||||
|  | -- stack runghc --package pandoc-types | ||||||
|  | 
 | ||||||
|  | import Text.Pandoc.JSON | ||||||
|  | 
 | ||||||
|  | main :: IO () | ||||||
|  | main = toJSONFilter removeNotes | ||||||
|  | 
 | ||||||
|  | removeNotes :: Inline -> Inline | ||||||
|  | removeNotes (Note _) = Str "" | ||||||
|  | removeNotes x = x | ||||||
|  | 
 | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user