Add conversion tool
This commit is contained in:
		
							parent
							
								
									ec227759d9
								
							
						
					
					
						commit
						ae53ae6b3e
					
				
					 1 changed files with 15 additions and 0 deletions
				
			
		
							
								
								
									
										15
									
								
								tools/convert_page
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										15
									
								
								tools/convert_page
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,15 @@
 | 
				
			||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ $# -lt 2 ]; then
 | 
				
			||||||
 | 
					  echo "Usage: $0 Mediawiki_Page_Name [page|post]"
 | 
				
			||||||
 | 
					  exit
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo Converting $1...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					page=$(echo $1 | sed 's,/,_,g'|tr '[:upper:]' '[:lower:]')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					hugo new $2/$page.md
 | 
				
			||||||
 | 
					curl -s  https://berlin.ccc.de/api.php\?action\=query\&prop\=revisions\&rvprop\=content\&format\=json\&titles\=$1 | \
 | 
				
			||||||
 | 
						 jq -r '.query.pages |..| objects|.["*"]'| sed '/null/d' | pandoc -f mediawiki -t markdown  \
 | 
				
			||||||
 | 
						>> content/$2/$page.md
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue