Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

Add markdown comments

by roundabout, Thursday, 4 April 2024, 05:31:38 (1712208698), pushed by roundabout, Wednesday, 31 July 2024, 06:54:44 (1722408884)

Author identity: vlad <vlad.muntoiu@gmail.com>

5a8d8c9a584d3aab0cde71303ed83eae36dc0dee

markdown.py

@@ -306,7 +306,7 @@ def tokenise(source):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                i = 0
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                while i < len(lines):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    line = lines[i]
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                if not line.strip():
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                if not line.strip() or line.startswith(";"):
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        # Void block
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        tokens.append(current_block)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -403,6 +403,7 @@ def tokenise(source):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        while (i < len(lines)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                               and not lines[i].startswith("#")
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                               and not lines[i].startswith(">")
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                           and not lines[i].startswith(";")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                               and not lines[i].startswith("* ")
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                               and not lines[i].startswith("+ ")
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                               and not lines[i].startswith("- ")
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -452,13 +453,7 @@ def make_html(ast):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            if __name__ == '__main__':
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                with open("/home/vlad/roundabout/doc/changelog/0.1.0 (2024-03-31).md") as file:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    # Generate an AST from a markdown file
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                ast = tokenise(
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    """
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    _test_
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    and this is another _test_ by the way
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    """
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                )
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                ast = tokenise(file.read())
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    # for i in ast:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    #     print(repr(i))